/* Kingdom Resources Analytics — design system v2
   Identity from the Kingdom Resources logo (navy, blue, red, green, yellow) + brand colours.
   Fonts: Almarai (text) + Readex Pro (numbers, headings). Icons: Tabler. RTL-first (logical properties). */
:root {
  --navy-900: #0f1f3d; --navy-800: #14284b; --navy-700: #1e3a6e; --navy-600: #2a4d8c;
  --blue: #2f6fd6; --blue-soft: #e7f0fd;
  --green: #15925a; --green-soft: #e5f6ee;
  --red: #d33a3a; --red-soft: #fdecec;
  --amber: #e9a20b; --amber-soft: #fdf4dd;
  --orange: #f26b2d; --orange-soft: #feeee6;
  --violet: #7048e8; --violet-soft: #efeafd;
  --teal: #0e9f9a; --teal-soft: #e2f5f4;
  --pink: #d6336c; --pink-soft: #fce8ef;

  --bg: #f2f4f8; --surface: #ffffff; --surface-2: #f6f8fb; --surface-3: #eef2f7;
  --text: #16213a; --text-2: #3c4a63; --muted: #6b778c; --border: #e2e7ef; --border-strong: #cfd6e2;
  --primary: var(--navy-700); --primary-strong: var(--navy-800); --accent: var(--orange);
  --good: var(--green); --bad: var(--red); --warn: var(--amber);
  --shadow-sm: 0 1px 2px rgba(15, 31, 61, .06);
  --shadow: 0 1px 3px rgba(15, 31, 61, .08), 0 6px 16px -8px rgba(15, 31, 61, .12);
  --radius: 14px; --radius-sm: 10px;
  --brand-pb: #f26b2d; --brand-tc: #0e9f9a; --brand-db: #8e2433;
  --sidebar-w: 268px;
  --font-text: "Almarai", "Segoe UI", Tahoma, sans-serif;
  --font-num: "Readex Pro", "Almarai", "Segoe UI", sans-serif;
}
[data-theme="dark"] {
  --bg: #0b1222; --surface: #121b2f; --surface-2: #17223a; --surface-3: #1d2944;
  --text: #e8edf6; --text-2: #c3cddd; --muted: #8f9bb3; --border: #24314d; --border-strong: #31416a;
  --primary: #8fb3f5; --primary-strong: #b9cff8;
  --blue-soft: #16294d; --green-soft: #0f2e22; --red-soft: #3a1717; --amber-soft: #352a0d; --orange-soft: #3a2014;
  --violet-soft: #251d45; --teal-soft: #0d2f2e; --pink-soft: #3a1626;
  --shadow-sm: none; --shadow: 0 0 0 1px var(--border);
  --brand-db: #e07784;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 15px/1.6 var(--font-text); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-num); letter-spacing: 0; margin: 0; }
h1 { font-size: 1.55rem; font-weight: 700; } h2 { font-size: 1.2rem; font-weight: 600; } h3 { font-size: 1rem; font-weight: 600; }
small, .muted { color: var(--muted); }
.num, .kpi-value, .tbl .num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.ti { font-size: 1.2em; line-height: 1; vertical-align: -0.12em; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ------------------------------------------------------------------ app shell */
.shell { min-height: 100vh; }
.sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); z-index: 50; overflow-y: auto;
  background: linear-gradient(180deg, var(--navy-900), var(--navy-700)); color: #dbe5f7; padding: 1rem .75rem 2rem;
  transition: transform .22s ease; }
.sidebar .logo { display: flex; align-items: center; gap: .65rem; padding: .35rem .5rem 1rem; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: .75rem; }
.sidebar .logo img { height: 40px; background: #fff; border-radius: 10px; padding: 3px 6px; }
.sidebar .logo b { font-family: var(--font-num); font-size: .95rem; color: #fff; line-height: 1.3; }
.sidebar .logo small { display: block; color: #9fb4da; font-size: .72rem; font-weight: 400; }
.nav-sec { margin: .9rem .5rem .35rem; font-size: .72rem; color: #8ea6d3; font-weight: 700; }
.sidebar a, .sidebar summary { display: flex; align-items: center; gap: .7rem; padding: .55rem .7rem; border-radius: 10px; cursor: pointer;
  color: #dbe5f7; font-size: .93rem; transition: background .15s, color .15s; list-style: none; }
.sidebar summary::-webkit-details-marker { display: none; }
.sidebar a:hover, .sidebar summary:hover { background: rgba(255,255,255,.08); color: #fff; }
.sidebar a.on { background: #fff; color: var(--navy-800); font-weight: 700; box-shadow: 0 4px 14px -6px rgba(0,0,0,.4); }
.sidebar .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: rgba(255,255,255,.08); }
.sidebar a.on .ico { background: var(--blue-soft); color: var(--blue); }
.sidebar details > summary .chev { margin-inline-start: auto; transition: transform .2s; opacity: .7; }
.sidebar details[open] > summary .chev { transform: rotate(180deg); }
.sidebar details .sub a { padding-inline-start: 3.1rem; font-size: .88rem; }
.sidebar details .sub a .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .5; }
.main { margin-inline-start: var(--sidebar-w); min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .9rem; padding: .7rem 1.5rem;
  background: rgba(242, 244, 248, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
[data-theme="dark"] .topbar { background: rgba(11, 18, 34, .88); }
.topbar .crumb { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.topbar .crumb small { font-size: .75rem; }
.topbar .crumb b { font-family: var(--font-num); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-end { margin-inline-start: auto; display: flex; align-items: center; gap: .55rem; }
.chip-sync { display: inline-flex; align-items: center; gap: .35rem; font-size: .8rem; color: var(--green); background: var(--green-soft);
  padding: .3rem .65rem; border-radius: 999px; font-weight: 700; }
.iconbtn { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); cursor: pointer; font: inherit; font-size: 1.05rem; transition: border-color .15s; }
.iconbtn:hover { border-color: var(--blue); color: var(--blue); }
.user { display: flex; align-items: center; gap: .55rem; padding: .2rem .25rem .2rem .7rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.user .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-700); color: #fff; font-family: var(--font-num); font-size: .85rem; }
.user span { font-size: .85rem; line-height: 1.2; } .user small { display: block; font-size: .72rem; }
#menuBtn { display: none; }
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(8, 15, 30, .45); display: none; }
.page { padding: 1.4rem 1.5rem 3rem; max-width: 1560px; }
.bare { min-height: 100vh; }

/* ------------------------------------------------------------------ page header + filters */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head .t { display: flex; align-items: center; gap: .85rem; }
.page-head .t .big-ico { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; font-size: 1.6rem;
  background: linear-gradient(135deg, var(--navy-700), var(--blue)); color: #fff; box-shadow: 0 8px 20px -10px var(--navy-700); }
.page-head p { margin: .2rem 0 0; color: var(--muted); font-size: .9rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; background: var(--navy-700); color: #fff; border: 0;
  border-radius: 11px; padding: .6rem 1.1rem; font: inherit; font-weight: 700; font-size: .9rem; cursor: pointer; min-height: 40px;
  transition: transform .12s, box-shadow .15s, background .15s; }
.btn:hover { background: var(--navy-600); box-shadow: 0 6px 16px -8px var(--navy-700); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.ghost:hover { border-color: var(--blue); color: var(--blue); box-shadow: none; }
.btn.green { background: var(--green); } .btn.red { background: var(--red); }
.btn.block { width: 100%; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; padding: 3px; }
.seg a { padding: .4rem .85rem; border-radius: 8px; font-size: .86rem; font-weight: 700; color: var(--text-2); }
.seg a.on { background: var(--navy-700); color: #fff; }

.filters { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .8rem 1rem; margin-bottom: 1.2rem; box-shadow: var(--shadow-sm); }
.presets { display: flex; flex-wrap: wrap; gap: .35rem; margin-bottom: .7rem; align-items: center; }
.presets .lbl { margin-inline-end: .3rem; }
.chip { border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); border-radius: 999px; padding: .28rem .8rem;
  font: inherit; font-size: .82rem; font-weight: 700; cursor: pointer; transition: all .15s; }
.chip:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-soft); }
.frow { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; }
.fld { display: flex; flex-direction: column; gap: .25rem; }
.lbl { font-size: .76rem; color: var(--muted); font-weight: 700; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: .45rem .65rem; min-height: 40px; }
input:focus, select:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
.ms { position: relative; }
.ms summary { list-style: none; display: flex; flex-direction: column; gap: .25rem; cursor: pointer; }
.ms summary::-webkit-details-marker { display: none; }
.ms summary b { font-weight: 400; border: 1px solid var(--border-strong); border-radius: 10px; padding: .45rem .65rem; min-width: 130px; min-height: 40px;
  display: flex; align-items: center; justify-content: space-between; gap: .5rem; background: var(--surface); }
.ms summary b::after { content: "▾"; color: var(--muted); font-size: .8rem; }
.ms-list { position: absolute; z-index: 25; inset-inline-start: 0; top: 100%; margin-top: .3rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 14px 34px -10px rgba(15,31,61,.35); padding: .45rem; max-height: 340px; overflow: auto; min-width: 250px; }
.ms-list label { display: flex; gap: .55rem; align-items: center; padding: .35rem .5rem; border-radius: 8px; white-space: nowrap; cursor: pointer; }
.ms-list label:hover { background: var(--surface-2); }
.ms-list input { min-height: auto; accent-color: var(--navy-700); }
.factions { display: flex; gap: .5rem; margin-inline-start: auto; }

/* ------------------------------------------------------------------ section navigation + sections */
.jump { position: sticky; top: 64px; z-index: 20; display: flex; gap: .4rem; overflow-x: auto; padding: .55rem .2rem; margin: -.3rem 0 1rem;
  background: var(--bg); scrollbar-width: thin; }
.jump a { flex: none; display: inline-flex; align-items: center; gap: .35rem; padding: .35rem .8rem; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); font-size: .82rem; font-weight: 700; color: var(--text-2); }
.jump a:hover { border-color: var(--blue); color: var(--blue); }
.jump a .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--navy-700); color: #fff; font-size: .7rem; font-family: var(--font-num); }
.section { margin-bottom: 1.6rem; scroll-margin-top: 120px; }
.sec-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .85rem; }
.sec-head .n { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-family: var(--font-num); font-weight: 700;
  background: var(--navy-700); color: #fff; flex: none; }
.sec-head .tt { min-width: 0; }
.sec-head h2 { font-size: 1.15rem; }
.sec-head p { margin: .1rem 0 0; color: var(--muted); font-size: .88rem; }
.sec-head .ico { margin-inline-start: auto; font-size: 1.4rem; color: var(--border-strong); }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.span-12 { grid-column: span 12; } .span-8 { grid-column: span 8; } .span-7 { grid-column: span 7; } .span-6 { grid-column: span 6; }
.span-5 { grid-column: span 5; } .span-4 { grid-column: span 4; } .span-3 { grid-column: span 3; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem 1.1rem; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem; margin-bottom: .6rem; }
.card-head h3 { display: flex; align-items: center; gap: .45rem; font-size: .98rem; }
.card-head h3 .ti { color: var(--blue); }
.card-head p { margin: .15rem 0 0; color: var(--muted); font-size: .82rem; }
.card-head .count { font-family: var(--font-num); font-size: .78rem; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: .1rem .55rem; }

/* insights */
.insights { display: grid; gap: .55rem; }
.insight { display: flex; gap: .65rem; align-items: flex-start; padding: .7rem .85rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
  font-size: .9rem; line-height: 1.75; }
.insight .ti { font-size: 1.25rem; flex: none; margin-top: .15rem; }
.insight.good { background: var(--green-soft); border-color: transparent; } .insight.good .ti { color: var(--green); }
.insight.bad { background: var(--red-soft); border-color: transparent; } .insight.bad .ti { color: var(--red); }
.insight.warn { background: var(--amber-soft); border-color: transparent; } .insight.warn .ti { color: var(--amber); }
.insight.info { background: var(--blue-soft); border-color: transparent; } .insight.info .ti { color: var(--blue); }
.insight b { font-family: var(--font-num); }

/* ------------------------------------------------------------------ KPI cards */
.kpis { display: grid; gap: .9rem; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); }
.kpi { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: .95rem 1rem .8rem; display: flex; flex-direction: column; gap: .2rem; min-height: 132px; }
.kpi::before { content: ""; position: absolute; inset-block-start: 0; inset-inline: 0; height: 4px; background: var(--tone, var(--blue)); }
.kpi .top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.kpi .lbl { font-size: .84rem; color: var(--text-2); font-weight: 700; }
.kpi .icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 1.25rem; color: var(--tone, var(--blue));
  background: var(--tone-soft, var(--blue-soft)); flex: none; }
.kpi .kpi-value { font-size: 1.7rem; font-weight: 700; color: var(--text); line-height: 1.25; letter-spacing: -.01em; }
.kpi .kpi-value small { font-size: .78rem; font-weight: 400; color: var(--muted); margin-inline-start: .2rem; }
.kpi .row { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; }
.kpi .sub { font-size: .78rem; color: var(--muted); line-height: 1.5; }
.kpi .spark { height: 34px; margin-top: auto; }
.delta { display: inline-flex; align-items: center; gap: .15rem; font-size: .78rem; font-weight: 700; padding: .08rem .45rem; border-radius: 999px; font-family: var(--font-num); }
.delta.up { color: var(--green); background: var(--green-soft); } .delta.down { color: var(--red); background: var(--red-soft); }
.tone-blue { --tone: var(--blue); --tone-soft: var(--blue-soft); } .tone-green { --tone: var(--green); --tone-soft: var(--green-soft); }
.tone-red { --tone: var(--red); --tone-soft: var(--red-soft); } .tone-amber { --tone: var(--amber); --tone-soft: var(--amber-soft); }
.tone-orange { --tone: var(--orange); --tone-soft: var(--orange-soft); } .tone-violet { --tone: var(--violet); --tone-soft: var(--violet-soft); }
.tone-teal { --tone: var(--teal); --tone-soft: var(--teal-soft); } .tone-pink { --tone: var(--pink); --tone-soft: var(--pink-soft); }
.tone-navy { --tone: var(--navy-700); --tone-soft: var(--blue-soft); }

/* ------------------------------------------------------------------ charts */
.chart { position: relative; width: 100%; height: 320px; }
.chart.h-sm { height: 240px; } .chart.h-lg { height: 420px; } .chart.h-xl { height: 540px; }

/* ------------------------------------------------------------------ tables */
.tbl-tools { display: flex; gap: .5rem; align-items: center; }
.tsearch { min-width: 200px; padding-inline-start: 2rem; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236b778c' stroke-width='2'%3E%3Ccircle cx='7' cy='7' r='5'/%3E%3Cpath d='m14 14-3.5-3.5'/%3E%3C/svg%3E") no-repeat; background-position: right .6rem center; }
[dir="ltr"] .tsearch { padding-inline-start: .65rem; padding-inline-end: 2rem; background-position: right .6rem center; }
.tscroll { overflow: auto; max-height: 640px; border: 1px solid var(--border); border-radius: 12px; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .87rem; }
.tbl th { position: sticky; top: 0; z-index: 2; background: var(--surface-3); color: var(--text-2); font-weight: 700; font-size: .8rem; text-align: start;
  padding: .6rem .7rem; border-bottom: 1px solid var(--border-strong); white-space: nowrap; cursor: pointer; user-select: none; }
.tbl th[data-dir="asc"]::after { content: " ▲"; color: var(--blue); } .tbl th[data-dir="desc"]::after { content: " ▼"; color: var(--blue); }
.tbl td { padding: .55rem .7rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr:nth-child(even) td { background: var(--surface-2); }
.tbl tbody tr:hover td { background: var(--blue-soft); }
.tbl .num { text-align: end; white-space: nowrap; }
.tbl td.neg { color: var(--red); }
.tbl td.pos { color: var(--green); }
.tbl tfoot td { position: sticky; bottom: 0; background: var(--surface-3); font-weight: 700; border-top: 2px solid var(--navy-700); }
.tbl td.txt { min-width: 120px; max-width: 360px; }
.tbl.data:not(.all):not(.searching) tr.more { display: none; }
.bar-cell { position: relative; }
.bar-cell .bar { position: absolute; inset-block: 5px; inset-inline-end: 6px; border-radius: 6px; background: var(--blue-soft); z-index: 0; }
.bar-cell.neg .bar { background: var(--red-soft); }
.bar-cell span { position: relative; z-index: 1; }
.pill { display: inline-flex; align-items: center; gap: .25rem; padding: .12rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 700; white-space: nowrap; }
.pill.good { color: var(--green); background: var(--green-soft); } .pill.bad { color: var(--red); background: var(--red-soft); }
.pill.warn { color: #9a6700; background: var(--amber-soft); } .pill.info { color: var(--blue); background: var(--blue-soft); }
.pill.neutral { color: var(--text-2); background: var(--surface-3); }
[data-theme="dark"] .pill.warn { color: var(--amber); }
.rank { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: var(--surface-3); font-family: var(--font-num); font-size: .78rem; font-weight: 700; }
.rank.r1 { background: #fde68a; color: #7a5200; } .rank.r2 { background: #e2e8f0; color: #334155; } .rank.r3 { background: #fed7aa; color: #7c2d12; }
.brand-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: .35rem; vertical-align: middle; }
.showmore { margin-top: .6rem; }

/* P&L style tables */
.pnl tr.k-sub td, .pnl tr.k-head td { font-weight: 700; background: var(--surface-3) !important; }
.pnl tr.k-total td { font-weight: 700; font-size: .95rem; border-top: 2px solid var(--navy-700); background: var(--blue-soft) !important; }
.pnl tr.k-pct td { color: var(--muted); font-size: .8rem; }
.pnl tr.k-detail td:first-child { padding-inline-start: 1.6rem; color: var(--text-2); }

/* ------------------------------------------------------------------ misc */
.notes { color: var(--muted); font-size: .84rem; margin-top: 1rem; background: var(--surface); border: 1px dashed var(--border-strong); border-radius: 12px; padding: .7rem 1rem; }
.notes p { margin: .25rem 0; }
.narr { font-size: .95rem; line-height: 1.95; }
.empty { text-align: center; padding: 3rem 1rem; }
.empty .big { font-size: 3rem; color: var(--border-strong); }
.alert { background: var(--red-soft); color: var(--red); border-radius: 12px; padding: .7rem .9rem; font-weight: 700; }
.note { background: var(--amber-soft); border-radius: 12px; padding: .7rem .9rem; }
.ok-note { color: var(--green); font-weight: 700; }
.badge { font-size: .72rem; background: var(--surface-3); border-radius: 999px; padding: .05rem .5rem; font-weight: 700; }
.link { color: var(--blue); font-weight: 700; }
.narrow { max-width: 600px; margin: 0 auto; }
.check { display: flex; align-items: center; gap: .55rem; padding: .3rem 0; cursor: pointer; }
.check input { min-height: auto; width: 17px; height: 17px; accent-color: var(--navy-700); }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 1rem; }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: .6rem .9rem; margin: 0; }
legend { font-weight: 700; padding: 0 .35rem; font-family: var(--font-num); }
.form .fld { margin-bottom: .9rem; } .form .fld input, .form .fld select { width: 100%; }
.tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.tabs a { padding: .45rem .95rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: .88rem; font-weight: 700; }
.tabs a.on { background: var(--navy-700); color: #fff; border-color: var(--navy-700); }
.num-in { width: 120px; text-align: end; }
.selectors { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; margin-bottom: 1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .7rem 1rem; }

/* hub tiles */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: .9rem; }
.cards.big { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.tile { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.05rem; display: flex;
  flex-direction: column; gap: .4rem; box-shadow: var(--shadow); transition: transform .15s, border-color .15s; }
.tile:hover { transform: translateY(-2px); border-color: var(--blue); }
.tile .tico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 1.35rem; color: var(--tone, var(--blue)); background: var(--tone-soft, var(--blue-soft)); }
.tile strong { font-family: var(--font-num); font-size: 1.02rem; }
.tile span { color: var(--muted); font-size: .86rem; line-height: 1.7; }
.tile .go { margin-top: auto; color: var(--blue); font-weight: 700; font-size: .85rem; display: inline-flex; align-items: center; gap: .3rem; }
.tile-group { font-size: .75rem; color: var(--orange); font-weight: 700; }

/* login */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 1rem; gap: 1rem; align-content: center;
  background: radial-gradient(1200px 600px at 100% 0%, #2a4d8c 0%, transparent 60%), linear-gradient(160deg, var(--navy-900), var(--navy-700)); }
.auth-card { width: min(430px, 100%); background: var(--surface); border-radius: 20px; box-shadow: 0 30px 60px -20px rgba(0,0,0,.45); padding: 2rem; display: flex; flex-direction: column; gap: 1rem; }
.auth-card h1 { text-align: center; font-size: 1.25rem; }
.auth-logo { height: 76px; width: auto; align-self: center; }
.auth-card .fld input { width: 100%; }
.brands { display: flex; justify-content: center; align-items: center; gap: 1rem; padding-top: .7rem; border-top: 1px solid var(--border); }
.brands img { height: 46px; width: auto; }
.brands .tacos { background: var(--brand-pb); border-radius: 8px; padding: 2px 4px; display: inline-flex; }
.brands .tacos img { height: 42px; }
.auth-lang { display: flex; gap: .5rem; }
.auth-lang .btn.ghost { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.25); }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .span-8, .span-7, .span-6, .span-5, .span-4, .span-3 { grid-column: span 12; }
}
@media (max-width: 980px) {
  .sidebar { transform: translateX(100%); }
  [dir="ltr"] .sidebar { transform: translateX(-100%); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .scrim { display: block; }
  .main { margin-inline-start: 0; }
  #menuBtn { display: inline-grid; }
  .user span, .chip-sync span { display: none; }
  .page { padding: 1rem .9rem 3rem; }
  .factions { margin-inline-start: 0; width: 100%; }
  .frow > * { flex: 1 1 140px; }
  .ms summary b { min-width: 0; }
  .jump { top: 60px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

[hidden] { display: none !important; }

/* ---- navigation buttons (back / home) */
.navbtns { display: flex; gap: .35rem; }
.navbtn { display: inline-flex; align-items: center; gap: .3rem; height: 36px; padding: 0 .7rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-size: .85rem; cursor: pointer; text-decoration: none; }
.navbtn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.navbtn .ti { font-size: 1.05rem; }
@media (max-width: 720px) { .navbtn span { display: none; } }

/* ---- "All" in multi-selects */
.ms-list .ms-all { border-bottom: 1px solid var(--border); margin-bottom: .2rem; padding-bottom: .45rem; }

/* ---- details on hover inside a finding */
.insight .det { position: relative; display: inline-flex; align-items: center; gap: .2rem; margin-inline-start: .5rem; padding: .05rem .5rem;
  border-radius: 999px; background: rgba(0,0,0,.06); font-size: .78rem; cursor: help; white-space: nowrap; }
.insight .det .ti { font-size: .95rem; margin: 0; color: inherit; }
.insight .det-pop { display: none; position: absolute; z-index: 40; top: 120%; inset-inline-start: 0; min-width: 240px; max-width: 420px; max-height: 320px; overflow: auto;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 12px 32px rgba(15,23,42,.18);
  padding: .55rem .75rem; white-space: normal; font-size: .82rem; line-height: 1.6; }
.insight .det:hover .det-pop, .insight .det:focus .det-pop, .insight .det:focus-within .det-pop { display: block; }
.insight .det-pop ul { margin: 0; padding-inline-start: 1.1rem; }

/* ---- filter buttons above a table */
.tbl-tools { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.seg.chips button { border: 0; background: transparent; font: inherit; font-size: .82rem; padding: .3rem .75rem; border-radius: 8px; cursor: pointer; color: var(--muted); }
.seg.chips button.on { background: var(--navy-700); color: #fff; }
tr[hidden] { display: none !important; }

/* ---- dashboard: hero band + coloured areas (different from the report pages) */
.sec-hero .sec-head { display: none; }
.hero { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .9rem; padding: 1.1rem; border-radius: 20px;
  background: linear-gradient(135deg, #142a52 0%, #1e3a6e 55%, #2f5aa8 100%); box-shadow: 0 14px 34px rgba(20,42,82,.25); }
.hero-card { position: relative; display: flex; flex-direction: column; gap: .3rem; padding: 1rem 1.05rem; border-radius: 15px; color: #fff; text-decoration: none;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); transition: transform .15s ease, background .15s ease; min-height: 140px; }
.hero-card:hover { transform: translateY(-2px); background: rgba(255,255,255,.14); }
.hero-card .h-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; font-size: 1.25rem; background: var(--h, #fff2); color: #fff; }
.hero-card.tone-navy { --h: #4f7fd6; } .hero-card.tone-orange { --h: #f26b2d; } .hero-card.tone-teal { --h: #0e9f9a; }
.hero-card.tone-red { --h: #d33a3a; } .hero-card.tone-violet { --h: #7c5cc4; }
.hero-card .h-lbl { font-size: .85rem; opacity: .85; }
.hero-card .h-val { font-family: var(--font-num); font-size: 1.75rem; font-weight: 700; line-height: 1.1; }
.hero-card .h-val small { font-size: .8rem; opacity: .7; margin-inline-start: .25rem; font-weight: 400; }
.hero-card .h-sub { font-size: .78rem; opacity: .8; }
.hero-card .h-delta { position: absolute; top: .9rem; inset-inline-end: .9rem; font-size: .78rem; font-weight: 700; padding: .1rem .45rem; border-radius: 999px; }
.hero-card .h-delta.up { background: #16a34a33; color: #b8f5cd; } .hero-card .h-delta.down { background: #dc262633; color: #ffc9c9; }

.section[class*="sec-"]:not(.sec-hero):not(.sec-plain) { background: var(--surface); border: 1px solid var(--border); border-radius: 20px; padding: 1rem 1.1rem 1.1rem;
  border-top: 5px solid var(--acc, var(--navy-700)); }
.sec-navy { --acc: #1e3a6e; } .sec-orange { --acc: #f26b2d; } .sec-teal { --acc: #0e9f9a; } .sec-violet { --acc: #7c5cc4; } .sec-red { --acc: #d33a3a; }
.section[class*="sec-"] .sec-head .n { background: var(--acc, var(--navy-700)); color: #fff; }
.section[class*="sec-"] .sec-head .ico { color: var(--acc, var(--navy-700)); }
.sec-link { margin-inline-start: auto; font-size: .85rem; font-weight: 700; color: var(--acc, var(--navy-700)); text-decoration: none; white-space: nowrap;
  padding: .35rem .7rem; border-radius: 10px; border: 1px solid var(--border); }
.sec-link:hover { background: var(--surface-2); }
.sec-head:has(.sec-link) .ico { display: none; }

/* uploads: type cards, drop zone, review table */
.upl .utypes { display: flex; flex-wrap: wrap; gap: .5rem; margin: .4rem 0 .6rem; }
.upl .utype input { position: absolute; opacity: 0; pointer-events: none; }
.upl .utype span { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .9rem; border: 1px solid var(--line, #d6dce6);
  border-radius: 10px; cursor: pointer; font-weight: 600; background: var(--card, #fff); }
.upl .utype input:checked + span { border-color: var(--navy, #1e3a6e); background: var(--navy, #1e3a6e); color: #fff; }
.upl .utype input:focus-visible + span { outline: 2px solid var(--orange, #f26b2d); outline-offset: 2px; }
.upl .drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: .3rem; padding: 1.6rem 1rem;
  border: 2px dashed var(--line, #c9d2e0); border-radius: 14px; text-align: center; cursor: pointer; }
.upl .drop.over { border-color: var(--orange, #f26b2d); background: rgba(242, 107, 45, .06); }
.upl .drop i { font-size: 2rem; color: var(--navy, #1e3a6e); }
.upl .drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upl .picked { font-size: .85rem; color: var(--navy, #1e3a6e); font-weight: 600; }
.tbl.review tr.bad td { background: rgba(220, 38, 38, .07); }
.tbl.review select, .tbl.review input[type=date], .tbl.review input[type=month] { min-width: 11rem; }
.selectors.in-sec { margin-bottom: 0; }
