/* =====================================================================
   AUREM TRADING GUIDE — design system
   Palette: #0A0A0A (black) · #E8DFD1 (cream). Colore usato con moderazione.
   ===================================================================== */
/* Font: General Sans (Fontshare, ITF Free Font License) caricato con <link> nelle pagine; fallback di sistema. */

:root {
  --bg: #0A0A0A;
  --surface: #111111;
  --surface-2: #161616;
  --surface-3: #1C1B1A;
  --line: #242220;
  --line-2: #312E2B;
  --cream: #E8DFD1;
  --cream-dim: rgba(232, 223, 209, 0.6);
  --text: #E6E1DA;
  --muted: #8C857B;
  --dim: #5E5850;
  --ok: #86B8A0;
  --warn: #D8B477;
  --fail: #D57F76;
  --radius: 14px;
  --radius-sm: 9px;
  --sidebar: 268px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: "General Sans", "Satoshi", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gold: #C8A96A;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body { font-family: var(--font); font-weight: 400; font-size: 15px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
a { color: var(--cream); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font-family: inherit; font-size: 14px; }
::selection { background: var(--cream); color: var(--bg); }
:focus-visible { outline: 1px solid var(--cream); outline-offset: 2px; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; border-right: 1px solid var(--line); padding: 28px 18px 24px; display: flex; flex-direction: column; background: var(--bg); }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; color: var(--cream); }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand-text { line-height: 1.15; }
.brand-name { font-weight: 500; letter-spacing: .34em; font-size: 15px; }
.brand-sub { font-size: 9.5px; letter-spacing: .32em; color: var(--muted); margin-top: 3px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--muted); font-size: 13.5px; font-weight: 400; transition: background .2s var(--ease), color .2s var(--ease); }
.nav a:hover { background: var(--surface); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--surface-2); color: var(--cream); }
.nav .num { font-size: 10.5px; letter-spacing: .08em; color: var(--dim); width: 18px; }
.nav a.active .num { color: var(--cream-dim); }
.nav svg { width: 16px; height: 16px; flex: none; opacity: .85; }
.nav-sep { height: 1px; background: var(--line); margin: 14px 8px; }
.sidebar-foot { margin-top: auto; padding: 18px 8px 0; font-size: 11px; color: var(--dim); line-height: 1.5; }

.main { min-width: 0; }
.topbar { display: none; }
.page { max-width: 1120px; margin: 0 auto; padding: 44px 44px 90px; animation: fade .35s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- typography ---------- */
.eyebrow { font-size: 11px; letter-spacing: .28em; text-transform: uppercase; color: var(--muted); font-weight: 400; }
h1, h2, h3, h4 { font-weight: 500; color: var(--text); margin: 0; letter-spacing: -.005em; }
h1 { font-size: 34px; line-height: 1.2; margin-top: 8px; }
h2 { font-size: 22px; line-height: 1.3; }
h3 { font-size: 16.5px; }
h4 { font-size: 14px; }
.lead { font-size: 16.5px; color: var(--muted); max-width: 720px; margin: 14px 0 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: 12.5px; }
.cream { color: var(--cream); }
.page-head { margin-bottom: 34px; }
.section { margin-top: 42px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; transition: border-color .2s var(--ease), transform .2s var(--ease), background .2s var(--ease); }
a.card:hover, .card.hover:hover { border-color: var(--line-2); background: var(--surface-2); text-decoration: none; transform: translateY(-1px); }
a.card { display: block; color: var(--text); }
.card-title { font-size: 15.5px; font-weight: 500; color: var(--text); }
.card-meta { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.divider { height: 1px; background: var(--line); margin: 22px 0; }

/* ---------- hero ---------- */
.hero { position: relative; border: 1px solid var(--line); border-radius: 20px; padding: 56px 48px; overflow: hidden; background: radial-gradient(1200px 400px at 85% -20%, rgba(232, 223, 209, 0.06), transparent 60%), var(--surface); }
.hero .mark { position: absolute; right: -40px; bottom: -60px; width: 360px; height: 360px; opacity: .045; color: var(--cream); }
.hero h1 { font-size: 40px; letter-spacing: .02em; }
.hero .tagline { margin-top: 18px; font-size: 17px; color: var(--muted); line-height: 1.8; }
.hero .tagline span { display: block; }
.loop { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 30px; }
.loop a { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-2); border-radius: 999px; padding: 7px 14px; }
.loop a:hover { color: var(--cream); border-color: var(--cream-dim); text-decoration: none; }
.loop .arrow { color: var(--dim); align-self: center; font-size: 12px; }

/* ---------- progress ---------- */
.progress { height: 4px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--cream); border-radius: 99px; transition: width .6s var(--ease); }
.progress.slim { height: 3px; }
.blocks { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 1px; color: var(--cream); font-size: 13px; }
.blocks .off { color: var(--line-2); }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .v { font-size: 28px; font-weight: 500; color: var(--cream); line-height: 1.1; }
.stat .k { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--dim); }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line-2); background: transparent; color: var(--text); padding: 9px 16px; border-radius: 10px; cursor: pointer; font-size: 13px; font-weight: 400; transition: all .2s var(--ease); white-space: nowrap; }
.btn:hover { border-color: var(--cream-dim); color: var(--cream); text-decoration: none; }
.btn.primary { background: var(--cream); color: var(--bg); border-color: var(--cream); font-weight: 500; }
.btn.primary:hover { background: #F2EBE0; color: var(--bg); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--cream); }
.btn.danger:hover { border-color: var(--fail); color: var(--fail); }
.btn.sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn[disabled] { opacity: .4; cursor: not-allowed; }
label.field { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; letter-spacing: .08em; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=search], select, textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); color: var(--text); padding: 10px 12px; border-radius: 9px; transition: border-color .2s var(--ease);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cream-dim); }
textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.form-grid .span2 { grid-column: span 2; }
.form-grid .span3 { grid-column: span 3; }
.form-grid .span4 { grid-column: 1 / -1; }

/* ---------- options / choices ---------- */
.choices { display: grid; gap: 8px; }
.choice { display: flex; gap: 12px; align-items: flex-start; text-align: left; width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: 11px; padding: 12px 14px; color: var(--text); cursor: pointer; transition: all .18s var(--ease); font-size: 14px; }
.choice:hover { border-color: var(--cream-dim); }
.choice .key { flex: none; width: 24px; height: 24px; border-radius: 7px; border: 1px solid var(--line-2); display: grid; place-items: center; font-size: 11.5px; color: var(--muted); }
.choice.selected { border-color: var(--cream); }
.choice.selected .key { background: var(--cream); color: var(--bg); border-color: var(--cream); }
.choice.correct { border-color: var(--ok); }
.choice.correct .key { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.choice.wrong { border-color: var(--fail); }
.choice.wrong .key { background: var(--fail); border-color: var(--fail); color: var(--bg); }
.choice[disabled] { cursor: default; }

/* ---------- checklist ---------- */
.check { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; user-select: none; transition: all .2s var(--ease); }
.check:hover { border-color: var(--line-2); }
.check .box { flex: none; width: 20px; height: 20px; border: 1px solid var(--line-2); border-radius: 6px; display: grid; place-items: center; transition: all .2s var(--ease); }
.check .box svg { width: 12px; height: 12px; opacity: 0; transform: scale(.6); transition: all .2s var(--ease); color: var(--bg); }
.check.on { border-color: var(--line-2); background: var(--surface-2); }
.check.on .box { background: var(--cream); border-color: var(--cream); }
.check.on .box svg { opacity: 1; transform: none; }
.check .t { flex: 1; }
.check .t b { font-weight: 500; display: block; color: var(--text); }
.check .t span { font-size: 12.5px; color: var(--muted); }

/* ---------- badges / pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line-2); padding: 4px 10px; border-radius: 99px; }
.pill.ok { color: var(--ok); border-color: rgba(134, 184, 160, .4); }
.pill.warn { color: var(--warn); border-color: rgba(216, 180, 119, .4); }
.pill.fail { color: var(--fail); border-color: rgba(213, 127, 118, .4); }
.pill.cream { color: var(--cream); border-color: var(--cream-dim); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dim); display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.fail { background: var(--fail); } .dot.cream { background: var(--cream); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; }
.tabs button { background: none; border: none; color: var(--muted); padding: 10px 14px; cursor: pointer; font-size: 13px; border-bottom: 1px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--cream); border-bottom-color: var(--cream); }

/* ---------- figures ---------- */
.figure { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #0D0D0D; cursor: zoom-in; }
.figure img { width: 100%; }
.figure .cap { padding: 12px 14px 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--line); background: var(--surface); }
.figure .cap b { color: var(--text); font-weight: 500; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; font-weight: 400; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .15s; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--surface); }

/* ---------- callouts ---------- */
.note { border-left: 2px solid var(--cream-dim); padding: 12px 16px; background: var(--surface); border-radius: 0 10px 10px 0; font-size: 13.5px; color: var(--muted); }
.note.warn { border-left-color: var(--warn); }
.note.fail { border-left-color: var(--fail); }
.note.ok { border-left-color: var(--ok); }
.note b { color: var(--text); font-weight: 500; }
.legal { font-size: 11.5px; color: var(--dim); line-height: 1.6; }

/* ---------- decision ---------- */
.decision { border-radius: 16px; padding: 30px; text-align: center; border: 1px solid var(--line-2); }
.decision .word { font-size: 34px; letter-spacing: .28em; font-weight: 500; }
.decision.no { border-color: rgba(213, 127, 118, .45); background: rgba(213, 127, 118, .05); }
.decision.no .word { color: var(--fail); }
.decision.yes { border-color: rgba(134, 184, 160, .45); background: rgba(134, 184, 160, .05); }
.decision.yes .word { color: var(--ok); }

/* ---------- wizard ---------- */
.wizard { display: grid; grid-template-columns: 250px 1fr; gap: 24px; align-items: start; }
.steps { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; }
.steps button { display: flex; align-items: center; gap: 10px; background: none; border: none; color: var(--muted); padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; font-size: 13px; }
.steps button:hover { background: var(--surface); }
.steps button.active { background: var(--surface-2); color: var(--cream); }
.steps .sn { font-size: 10.5px; color: var(--dim); width: 20px; letter-spacing: .06em; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; background: rgba(5, 5, 5, .86); backdrop-filter: blur(6px); z-index: 50; display: grid; place-items: center; padding: 28px; animation: fade .2s var(--ease); }
.modal-body { background: var(--surface); border: 1px solid var(--line-2); border-radius: 16px; max-width: 980px; width: 100%; max-height: 92vh; overflow-y: auto; padding: 26px; position: relative; }
.modal-close { position: absolute; top: 12px; right: 12px; }
.lightbox img { border-radius: 10px; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--cream); color: var(--bg); padding: 10px 18px; border-radius: 10px; font-size: 13px; font-weight: 500; opacity: 0; transition: all .3s var(--ease); z-index: 60; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- misc ---------- */
.kbd { font-size: 11px; border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; color: var(--muted); }
.empty { text-align: center; padding: 50px 20px; color: var(--dim); border: 1px dashed var(--line-2); border-radius: 14px; }
.thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.pdf-frame { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: 12px; background: #0D0D0D; }
canvas.chart { width: 100%; height: 220px; display: block; }
.num-big { font-size: 40px; font-weight: 500; color: var(--cream); line-height: 1; }
.week.done { border-color: var(--line-2); }
.week .wn { font-size: 11px; letter-spacing: .24em; color: var(--dim); }
.sp { height: 8px; }

/* ---------- responsive ---------- */
@media (max-width: 1060px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wizard { grid-template-columns: 1fr; }
  .steps { position: static; flex-direction: row; overflow-x: auto; }
  .steps button { white-space: nowrap; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .3s var(--ease); z-index: 40; }
  .sidebar.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .6); }
  .topbar { display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 30; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(10, 10, 10, .92); backdrop-filter: blur(8px); }
  .topbar .brand { padding: 0; }
  .page { padding: 28px 18px 80px; }
  .hero { padding: 36px 24px; }
  .hero h1 { font-size: 30px; }
  h1 { font-size: 27px; }
  .g2, .g3, .g4 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid .span2, .form-grid .span3 { grid-column: 1 / -1; }
}
@media print {
  .sidebar, .topbar, .btn { display: none !important; }
  .app { display: block; }
  body { background: #fff; color: #000; }
}

/* ---------- AUREM platform additions ---------- */
.pill.gold { color: var(--gold); border-color: rgba(200, 169, 106, .45); }
.gold { color: var(--gold); }
.eyebrow.gold-dot::before { content: ""; display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--gold); margin-right: 10px; vertical-align: middle; }
.userbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 44px 0; max-width: 1208px; margin: 0 auto; }
.userbar .who { font-size: 13px; color: var(--muted); }
.userbar .who b { color: var(--text); font-weight: 500; }
.nav a.sub { padding-left: 40px; font-size: 12.5px; }
.phase-head { font-size: 10.5px; letter-spacing: .24em; text-transform: uppercase; color: var(--gold); padding: 12px 10px 4px; }
.method { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.method button { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 14px; text-align: left; color: var(--text); cursor: pointer; transition: all .2s var(--ease); font: inherit; }
.method button:hover { border-color: var(--line-2); }
.method button.active { border-color: var(--cream-dim); background: var(--surface-2); }
.method .mn { font-size: 10.5px; letter-spacing: .2em; color: var(--dim); }
.method .mt { font-weight: 500; margin-top: 6px; font-size: 14.5px; }
.method .ms { font-size: 12px; color: var(--muted); margin-top: 2px; }
.method-detail { margin-top: 12px; }
.lesson { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.lesson > summary { list-style: none; cursor: pointer; padding: 18px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.lesson > summary::-webkit-details-marker { display: none; }
.lesson[open] > summary { border-bottom: 1px solid var(--line); }
.lesson .lesson-body { padding: 20px 22px 24px; }
.viewer { display: grid; grid-template-columns: 260px 1fr; gap: 20px; align-items: start; }
.viewer-toc { max-height: 80vh; overflow-y: auto; padding: 8px; }
.viewer-toc a { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; color: var(--muted); }
.viewer-toc a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.viewer-toc a.active { background: var(--surface-2); color: var(--cream); }
.viewer-stage { position: relative; background: #0D0D0D; border: 1px solid var(--line); border-radius: 12px; min-height: 60vh; display: grid; place-items: center; overflow: hidden; }
.viewer-stage canvas { max-width: 100%; height: auto; display: block; }
.viewer-stage .wm { position: absolute; right: 12px; bottom: 10px; font-size: 10px; color: rgba(232, 223, 209, .28); pointer-events: none; }
.viewer-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.viewer-bar input { width: 80px; text-align: center; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line-2); border-top-color: var(--cream); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.steps7 { display: grid; gap: 10px; }
.steps7 .s7 { display: grid; grid-template-columns: 70px 1fr auto; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; color: var(--text); }
.steps7 a.s7:hover { border-color: var(--line-2); text-decoration: none; }
.steps7 .s7 .sn { font-size: 10.5px; letter-spacing: .22em; color: var(--dim); }
.steps7 .s7.done .sn { color: var(--gold); }
@media (max-width: 1060px) { .method { grid-template-columns: repeat(3, minmax(0, 1fr)); } .viewer { grid-template-columns: 1fr; } .viewer-toc { max-height: 240px; } }
@media (max-width: 860px) { .userbar { padding: 14px 18px 0; } .method { grid-template-columns: repeat(2, minmax(0, 1fr)); } .steps7 .s7 { grid-template-columns: 1fr; gap: 4px; } }

/* ---------- modalità app (icona sulla schermata Home) ---------- */
@media (display-mode: standalone) {
  .topbar, .site-head { padding-top: max(12px, env(safe-area-inset-top)); }
  .sidebar { padding-top: max(28px, env(safe-area-inset-top)); }
}
