/* ==========================================================================
   digiStratium — Design System
   Shared, external stylesheet used by every page (replaces old inline <style>
   blocks previously duplicated inside lib/functionhtml.php and
   lib/functionhtmlparts.php). Pure CSS/HTML redesign only — no PHP logic,
   no database code, no queries were touched anywhere in this project.
   ========================================================================== */

:root{
  --brand-900:#062a44;
  --brand-800:#083a5c;
  --brand-700:#085085;
  --brand-600:#0d6aab;
  --brand-500:#1583d1;
  --brand-100:#e8f3fc;
  --ink-900:#0f1a24;
  --ink-700:#3a4a58;
  --ink-500:#647587;
  --ink-300:#aebccb;
  --surface:#ffffff;
  --surface-muted:#f4f7fa;
  --surface-alt:#eef2f6;
  --border:#dfe6ed;
  --success:#1c9c6b;
  --success-bg:#e7f8f0;
  --danger:#d1435b;
  --danger-bg:#fdeaee;
  --warning:#c98a12;
  --warning-bg:#fbf2e0;
  --radius-sm:6px;
  --radius-md:12px;
  --radius-lg:20px;
  --shadow-sm:0 1px 2px rgba(15,26,36,.06),0 1px 1px rgba(15,26,36,.04);
  --shadow-md:0 8px 24px rgba(8,58,92,.10);
  --shadow-lg:0 20px 48px rgba(8,58,92,.16);
  --header-h:68px;
  --maxw:1180px;
  --font: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
}

*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; scroll-behavior:smooth; }
body{
  margin:0;
  font-family:var(--font);
  background:var(--surface-muted);
  color:var(--ink-900);
  line-height:1.55;
  -webkit-font-smoothing:antialiased;
  display:flex;
  flex-direction:column;
  min-height:100vh;
}
img{ max-width:100%; display:block; }
a{ color:var(--brand-600); text-decoration:none; }
a:hover{ color:var(--brand-700); }
h1,h2,h3,h4{ line-height:1.25; margin:0 0 .5em; color:var(--ink-900); font-weight:700; }
p{ margin:0 0 1em; color:var(--ink-700); }
.container{ max-width:var(--maxw); margin:0 auto; padding:0 20px; }

/* ---------------------------------- Header / Nav ------------------------ */
.site-header{
  position:sticky; top:0; z-index:100;
  background:linear-gradient(135deg,var(--brand-800),var(--brand-700));
  box-shadow:var(--shadow-sm);
}
.nav-bar{
  max-width:var(--maxw); margin:0 auto; padding:0 20px;
  height:var(--header-h);
  display:flex; align-items:center; justify-content:space-between; gap:16px;
}
.brand{ display:flex; align-items:center; gap:10px; color:#fff; font-size:19px; font-weight:800; letter-spacing:.2px; }
.brand img{ height:34px; width:auto; }
.brand:hover{ color:#fff; }

.nav-links{ display:flex; align-items:center; gap:6px; list-style:none; margin:0; padding:0; }
.nav-links a{
  color:rgba(255,255,255,.88); font-weight:600; font-size:14.5px;
  padding:9px 14px; border-radius:999px; transition:background .15s ease,color .15s ease;
}
.nav-links a:hover{ background:rgba(255,255,255,.12); color:#fff; }
.nav-links a.active{ background:rgba(255,255,255,.18); color:#fff; }

.nav-actions{ display:flex; align-items:center; gap:10px; }
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:0; cursor:pointer; font-family:inherit; font-weight:700; font-size:14.5px;
  padding:10px 20px; border-radius:999px; transition:transform .1s ease,box-shadow .15s ease,opacity .15s ease;
  text-decoration:none; line-height:1;
}
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:#fff; color:var(--brand-700); box-shadow:var(--shadow-sm); }
.btn-primary:hover{ box-shadow:var(--shadow-md); color:var(--brand-700); }
.btn-ghost{ background:rgba(255,255,255,.10); color:#fff; border:1px solid rgba(255,255,255,.35); }
.btn-ghost:hover{ background:rgba(255,255,255,.18); color:#fff; }
.btn-solid{ background:linear-gradient(135deg,var(--brand-500),var(--brand-700)); color:#fff; }
.btn-solid:hover{ background:linear-gradient(135deg,var(--brand-600),var(--brand-800)); color:#fff; }
.btn-outline{ background:transparent; color:var(--brand-600); border:1.5px solid var(--brand-600); }
.btn-outline:hover{ background:var(--brand-100); }
.btn-danger{ background:linear-gradient(135deg,var(--danger),#96291d); color:#fff; }
.btn-danger:hover{ background:linear-gradient(135deg,#c23a50,#7a2016); color:#fff; opacity:1; }
.btn-block{ width:100%; }
.btn-sm{ padding:7px 14px; font-size:13px; }

.nav-toggle{
  display:none; background:transparent; border:0; width:40px; height:40px;
  border-radius:8px; color:#fff; cursor:pointer; align-items:center; justify-content:center;
}
.nav-toggle:hover{ background:rgba(255,255,255,.12); }
.nav-toggle svg{ width:24px; height:24px; }

/* Mobile nav */
@media (max-width:860px){
  .nav-links{
    position:fixed; inset:var(--header-h) 0 auto 0; flex-direction:column; align-items:stretch;
    background:var(--brand-800); padding:10px 16px 18px; gap:2px; box-shadow:var(--shadow-md);
    transform:translateY(-8px); opacity:0; pointer-events:none; transition:opacity .18s ease, transform .18s ease;
    max-height:calc(100vh - var(--header-h)); overflow:auto;
  }
  .nav-links.is-open{ transform:translateY(0); opacity:1; pointer-events:auto; }
  .nav-links a{ padding:12px 14px; border-radius:8px; }
  .nav-toggle{ display:flex; }
  .nav-actions .btn-ghost-desktop{ display:none; }
}

/* ---------------------------------- Footer ------------------------------ */
.site-footer{
  background:var(--brand-900); color:rgba(255,255,255,.75);
  padding:36px 0 22px; margin-top:auto; font-size:14px; flex-shrink:0;
}
.site-footer a{ color:rgba(255,255,255,.85); }
.site-footer a:hover{ color:#fff; }
.footer-inner{ display:flex; flex-wrap:wrap; gap:24px; justify-content:space-between; align-items:flex-start; }
.footer-links{ display:flex; flex-wrap:wrap; gap:18px; list-style:none; padding:0; margin:0; }
.footer-bottom{ margin-top:24px; padding-top:18px; border-top:1px solid rgba(255,255,255,.12); font-size:13px; color:rgba(255,255,255,.55); }

/* ---------------------------------- Hero ------------------------------- */
.hero{
  background:radial-gradient(1100px 480px at 50% -120px,var(--brand-600),var(--brand-900) 78%);
  color:#fff; padding:64px 0 84px; text-align:center;
}
.hero h1{ color:#fff; font-size:clamp(28px,4.4vw,44px); max-width:820px; margin:0 auto 16px; }
.hero p.lead{ color:rgba(255,255,255,.85); max-width:640px; margin:0 auto 28px; font-size:17px; }
.hero-actions{ display:flex; gap:12px; justify-content:center; flex-wrap:wrap; }

/* ---------------------------------- Cards / Sections --------------------- */
.section{ padding:56px 0; }
.section-title{ text-align:center; max-width:680px; margin:0 auto 40px; }
.section-title h2{ font-size:clamp(22px,3vw,30px); }
.section-title p{ font-size:15.5px; }

.grid{ display:grid; gap:20px; }
.grid-3{ grid-template-columns:repeat(3,1fr); }
.grid-2{ grid-template-columns:repeat(2,1fr); }
@media (max-width:860px){ .grid-3,.grid-2{ grid-template-columns:1fr; } }

.card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md);
  padding:26px; box-shadow:var(--shadow-sm); transition:box-shadow .15s ease,transform .15s ease;
}
.card:hover{ box-shadow:var(--shadow-md); transform:translateY(-2px); }
.card .icon{
  width:46px; height:46px; border-radius:12px; background:var(--brand-100); color:var(--brand-700);
  display:flex; align-items:center; justify-content:center; margin-bottom:14px; font-size:20px;
}
.card h3{ font-size:17px; margin-bottom:8px; }
.card p{ font-size:14.5px; margin-bottom:0; }

/* ---------------------------------- Auth / Forms ------------------------- */
.auth-wrap{ min-height:calc(100vh - var(--header-h) - 260px); display:flex; align-items:center; justify-content:center; padding:48px 16px; }
.auth-card{
  width:100%; max-width:420px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-lg); box-shadow:var(--shadow-lg); padding:36px 32px;
}
.auth-card h1{ font-size:22px; text-align:center; }
.auth-card .sub{ text-align:center; color:var(--ink-500); font-size:14px; margin-bottom:24px; }

.field{ margin-bottom:16px; }
.field label{ display:block; font-size:13.5px; font-weight:700; color:var(--ink-700); margin-bottom:6px; }
.field .hint{ font-size:12.5px; color:var(--ink-500); margin-top:6px; }

input[type=text],input[type=email],input[type=password],input[type=number],
input[type=tel],input[type=search],input[type=date],textarea,select{
  width:100%; font-family:inherit; font-size:14.5px; color:var(--ink-900);
  padding:11px 13px; border:1.5px solid var(--border); border-radius:var(--radius-sm);
  background:var(--surface); transition:border-color .15s ease, box-shadow .15s ease;
}
input:focus,textarea:focus,select:focus{
  outline:none; border-color:var(--brand-500); box-shadow:0 0 0 3px rgba(21,131,209,.15);
}
textarea{ resize:vertical; min-height:100px; }

.form-row{ display:flex; justify-content:space-between; align-items:center; font-size:13.5px; margin:4px 0 20px; }
.form-row a{ font-weight:600; }
.divider{ display:flex; align-items:center; gap:12px; color:var(--ink-500); font-size:12.5px; margin:22px 0; }
.divider::before,.divider::after{ content:""; flex:1; height:1px; background:var(--border); }

.alert{ padding:12px 14px; border-radius:var(--radius-sm); font-size:13.5px; margin-bottom:18px; }
.alert-error{ background:var(--danger-bg); color:var(--danger); border:1px solid rgba(209,67,91,.25); }
.alert-success{ background:var(--success-bg); color:var(--success); border:1px solid rgba(28,156,107,.25); }
.alert-warning{ background:var(--warning-bg); color:var(--warning); border:1px solid rgba(201,138,18,.25); }

/* ---------------------------------- Dashboard shell ---------------------- */
.app-shell{ display:flex; align-items:flex-start; gap:24px; max-width:var(--maxw); margin:0 auto; padding:24px 20px 0; }
.app-main{ flex:1; min-width:0; padding-bottom:60px; width:100%; }

.sidebar{
  width:230px; flex:0 0 230px; background:var(--surface); border:1px solid var(--border);
  border-radius:var(--radius-md); box-shadow:var(--shadow-sm); padding:14px; position:sticky; top:calc(var(--header-h) + 16px);
}
.sidebar-group{ margin-bottom:6px; }
.sidebar a, .sidebar .sidebar-label{
  display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:8px;
  color:var(--ink-700); font-weight:600; font-size:14px; text-decoration:none;
}
.sidebar a:hover{ background:var(--surface-alt); color:var(--brand-700); }
.sidebar .sub-links{ margin-left:14px; padding-left:10px; border-left:2px solid var(--border); display:flex; flex-direction:column; }
.sidebar .sub-links a{ font-weight:500; font-size:13.5px; padding:7px 10px; }
.sidebar-toggle{
  display:none; width:100%; align-items:center; justify-content:space-between; background:var(--surface);
  border:1px solid var(--border); border-radius:var(--radius-sm); padding:12px 14px; font-weight:700; color:var(--ink-900);
  margin-bottom:14px; cursor:pointer;
}

@media (max-width:900px){
  .app-shell{ flex-direction:column; padding:16px 14px 0; }
  .sidebar{ width:100%; flex:1 1 auto; position:static; display:none; }
  .sidebar.is-open{ display:block; }
  .sidebar-toggle{ display:flex; }
}
.page-head{ display:flex; flex-wrap:wrap; gap:12px; justify-content:space-between; align-items:center; margin-bottom:22px; }
.page-head h1{ font-size:22px; margin:0; }

.panel{
  background:var(--surface); border:1px solid var(--border); border-top:none; border-radius:var(--radius-md);
  box-shadow:var(--shadow-sm); position:relative; overflow:hidden;
}
.panel::before{
  content:""; position:absolute; top:0; left:0; right:0; height:3px;
  background:linear-gradient(90deg,var(--brand-500),var(--brand-800));
}
.panel + .panel{ margin-top:18px; }
.panel.panel-accent-success::before{ background:linear-gradient(90deg,var(--success),#14795a); }
.panel.panel-accent-warning::before{ background:linear-gradient(90deg,var(--warning),#a3720e); }
.panel-header{ padding:16px 20px; border-bottom:1px solid var(--border); display:flex; justify-content:space-between; align-items:center; gap:10px; flex-wrap:wrap; }
.panel-header h2{ font-size:16px; margin:0; display:flex; align-items:center; gap:10px; }
.panel-header .icon{
  width:32px; height:32px; border-radius:var(--radius-sm); background:var(--brand-100); color:var(--brand-700);
  display:inline-flex; align-items:center; justify-content:center; font-size:15px; flex-shrink:0;
}
.panel-body{ padding:20px; }

/* Gain / loss tinted field boxes (Take Profit / Stop Loss inputs etc.) */
.field-gain{ background:linear-gradient(160deg,var(--success-bg),#c9f0e0); border-radius:var(--radius-md); padding:14px; }
.field-gain label{ color:var(--success); }
.field-loss{ background:linear-gradient(160deg,var(--danger-bg),#fad7de); border-radius:var(--radius-md); padding:14px; }
.field-loss label{ color:var(--danger); }

.stat-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:16px; margin-bottom:22px; }
.stat-card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); padding:18px 20px; box-shadow:var(--shadow-sm); }
.stat-card .label{ font-size:12.5px; text-transform:uppercase; letter-spacing:.05em; color:var(--ink-500); font-weight:700; margin-bottom:8px; }
.stat-card .value{
  font-size:24px; font-weight:800; color:var(--ink-900);
  background:linear-gradient(135deg,var(--brand-600),var(--brand-800));
  -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent;
}
.stat-card .value.up{ background:linear-gradient(135deg,var(--success),#14795a); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }
.stat-card .value.down{ background:linear-gradient(135deg,var(--danger),#96291d); -webkit-background-clip:text; background-clip:text; -webkit-text-fill-color:transparent; }

/* ---------------------------------- Tables ------------------------------- */
.table-wrap{ width:100%; overflow-x:auto; -webkit-overflow-scrolling:touch; }
table.data-table{ width:100%; border-collapse:collapse; font-size:13.5px; min-width:560px; }
table.data-table th{
  text-align:left; padding:11px 14px; background:var(--surface-alt); color:var(--ink-700);
  font-weight:700; font-size:12.5px; text-transform:uppercase; letter-spacing:.03em;
  border-bottom:1px solid var(--border); white-space:nowrap;
}
table.data-table td{ padding:12px 14px; border-bottom:1px solid var(--border); color:var(--ink-900); }
table.data-table td.actions{ display:flex; flex-wrap:wrap; gap:6px; align-items:center; }
table.data-table tr:last-child td{ border-bottom:0; }
table.data-table tr:hover td{ background:var(--surface-muted); }
table.data-table tr.subtotal-row td{ background:var(--surface-alt); border-top:1px solid var(--border); }
table.data-table tr.total-row td{ background:linear-gradient(135deg,var(--brand-100),#d5e9f7); border-top:2px solid var(--brand-500); font-size:14px; }
.badge{ display:inline-flex; align-items:center; padding:3px 10px; border-radius:999px; font-size:12px; font-weight:700; }
.badge-success{ background:linear-gradient(135deg,var(--success-bg),#c9f0e0); color:var(--success); }
.badge-danger{ background:linear-gradient(135deg,var(--danger-bg),#fad7de); color:var(--danger); }
.badge-warning{ background:linear-gradient(135deg,var(--warning-bg),#f6e4bd); color:var(--warning); }
.badge-muted{ background:var(--surface-alt); color:var(--ink-500); }

/* ---------------------------------- Lab Tools / Analysis ------------------ */
.tool-tabs{ display:flex; flex-wrap:wrap; gap:6px; padding:6px; background:var(--surface-alt); border-radius:999px; margin-bottom:20px; }
.tool-tabs input{ position:absolute; opacity:0; width:0; height:0; pointer-events:none; }
.tool-tab{
  flex:1; text-align:center; padding:11px 16px; border-radius:999px; font-weight:700; font-size:13.5px;
  color:var(--ink-700); cursor:pointer; transition:background .15s ease,color .15s ease,box-shadow .15s ease;
  white-space:nowrap; user-select:none;
}
.tool-tab:hover{ color:var(--brand-700); }
.tool-tabs input:checked + .tool-tab{ background:linear-gradient(135deg,var(--brand-500),var(--brand-700)); color:#fff; box-shadow:var(--shadow-sm); }
.tool-tabs input:focus-visible + .tool-tab{ outline:2px solid var(--brand-500); outline-offset:2px; }

.tool-form-grid{ display:grid; gap:16px; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); align-items:end; }
.tool-form-grid .field{ margin-bottom:0; }

.tool-placeholder{ text-align:center; padding:48px 20px; color:var(--ink-500); }
.tool-placeholder .glyph{ font-size:34px; margin-bottom:10px; }

/* Support/resistance pivot levels */
.levels-grid{ display:grid; grid-template-columns:repeat(auto-fit,minmax(112px,1fr)); gap:12px; }
.level-box{ background:var(--surface-alt); border-radius:var(--radius-md); padding:16px 10px; text-align:center; }
.level-box .label{ font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--ink-500); font-weight:700; margin-bottom:8px; }
.level-box .value{ font-size:19px; font-weight:800; color:var(--ink-900); }
.level-box.support{ background:linear-gradient(160deg,var(--success-bg),#c9f0e0); }
.level-box.support .value{ color:var(--success); }
.level-box.resistance{ background:linear-gradient(160deg,var(--danger-bg),#fad7de); }
.level-box.resistance .value{ color:var(--danger); }

/* Mover / ranking lists */
.rank-list{ display:flex; flex-direction:column; }
.rank-row{ display:flex; align-items:center; gap:14px; padding:12px 6px; border-bottom:1px solid var(--border); }
.rank-row:last-child{ border-bottom:0; }
.rank-row:hover{ background:var(--surface-muted); }
.rank-num{
  width:26px; height:26px; border-radius:50%; background:var(--surface-alt); color:var(--ink-500);
  font-size:11.5px; font-weight:800; display:flex; align-items:center; justify-content:center; flex-shrink:0;
}
.rank-ticker{ font-weight:700; color:var(--ink-900); min-width:88px; }
.rank-metrics{ display:flex; gap:8px; margin-left:auto; flex-wrap:wrap; justify-content:flex-end; }
.trend{ display:inline-flex; align-items:center; gap:3px; padding:3px 10px; border-radius:999px; font-size:12.5px; font-weight:700; white-space:nowrap; }
.trend-up{ background:linear-gradient(135deg,var(--success-bg),#c9f0e0); color:var(--success); }
.trend-down{ background:linear-gradient(135deg,var(--danger-bg),#fad7de); color:var(--danger); }

/* ---------------------------------- FAQ ----------------------------------- */
.faq-toc{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:32px; }
.faq-toc a{
  background:var(--surface); border:1px solid var(--border); border-radius:999px; padding:8px 16px;
  font-size:13px; font-weight:600; color:var(--ink-700);
}
.faq-toc a:hover{ border-color:var(--brand-500); color:var(--brand-700); background:var(--brand-100); }

.faq-section{ margin-bottom:48px; scroll-margin-top:calc(var(--header-h) + 16px); }
.faq-section-head{ display:flex; align-items:center; gap:14px; margin-bottom:18px; }
.faq-section-head .icon{
  width:44px; height:44px; border-radius:var(--radius-md); background:var(--brand-100); color:var(--brand-700);
  display:flex; align-items:center; justify-content:center; font-size:21px; flex-shrink:0;
}
.faq-section-head h2{ margin:0; font-size:19px; }

.faq-illustration{
  background:linear-gradient(160deg,var(--brand-100),var(--surface) 65%); border:1px solid var(--border);
  border-radius:var(--radius-lg); padding:22px; margin-bottom:18px; display:flex; align-items:center; justify-content:center;
}
.faq-illustration svg{ width:100%; max-width:520px; height:auto; }

.faq-item{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-md); margin-bottom:10px; overflow:hidden; }
.faq-item summary{
  list-style:none; cursor:pointer; padding:15px 18px; font-weight:700; font-size:14.5px; color:var(--ink-900);
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.faq-item summary::-webkit-details-marker{ display:none; }
.faq-item summary::after{
  content:"+"; font-size:20px; font-weight:400; color:var(--brand-600); flex-shrink:0; transition:transform .15s ease;
}
.faq-item[open] summary::after{ transform:rotate(45deg); }
.faq-item summary:hover{ background:var(--surface-muted); }
.faq-item .faq-answer{ padding:0 18px 18px; color:var(--ink-700); font-size:14.5px; }
.faq-item .faq-answer p:last-child{ margin-bottom:0; }
.faq-item .faq-answer ul{ margin:0 0 1em; padding-left:20px; }
.faq-item .faq-answer li{ margin-bottom:4px; }

/* ---------------------------------- Utilities ---------------------------- */
.text-center{ text-align:center; }
.text-muted{ color:var(--ink-500); }
.mt-0{ margin-top:0; } .mb-0{ margin-bottom:0; }
.flex{ display:flex; } .items-center{ align-items:center; } .justify-between{ justify-content:space-between; }
.gap-8{ gap:8px; } .gap-12{ gap:12px; } .gap-16{ gap:16px; }
.hidden{ display:none !important; }

.prose{ max-width:760px; margin:0 auto; }
.prose pre{
  white-space:pre-wrap; font-family:inherit; font-size:15.5px; line-height:1.75;
  color:var(--ink-700); margin:0; background:none; border:0; padding:0;
}

@media (max-width:600px){
  .hero{ padding:48px 0 60px; }
  .section{ padding:40px 0; }
  .auth-card{ padding:28px 20px; }
  .app-main{ padding:20px 14px 44px; }
}
