/* Design tokens copied from the company portal (portal.empirian.com) so both portals look like one product. */
:root {
  --blue: #0069CB; --blue-deep: #00529E; --blue-ink: #0058AB;
  --green: #79AA00; --green-text: #567B00; --gray: #7E94AF;
  --amber: #B8760A; --amber-ink: #8A4B00; --red: #B3261E; --red-ink: #9A2016;
  --ink: #1E2A36; --muted: #5B6B82; --line: #DFE5EC; --ground: #F5F7F9; --card: #FFFFFF;
  --chip-blue: #E6F0FA; --chip-green: #EEF5DD; --chip-amber: #FFF4E0; --chip-gray: #EDF1F5; --chip-red: #FDE7E3;
  --side: #0069CB; --side-ink: #FFFFFF; --side-mute: #D6E6F7;
  --side-hover: rgba(255,255,255,.12); --side-active: rgba(255,255,255,.22);
  --shadow: 0 1px 2px rgba(30,42,54,.05), 0 8px 24px rgba(30,42,54,.06);
  --shadow-lg: 0 1px 2px rgba(30,42,54,.06), 0 14px 34px rgba(30,42,54,.10);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 14px/1.5 "IBM Plex Sans", -apple-system, system-ui, sans-serif; color: var(--ink); background: var(--ground); }
a { color: inherit; text-decoration: none; }
.link { color: var(--blue-ink); }
.link:hover { text-decoration: underline; }
.mono { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12.5px; color: var(--muted); }
.ico { width: 18px; height: 18px; flex: none; }

/* ---- shell: sidebar + main */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 24px 16px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.logo { display: inline-flex; background: #fff; border-radius: 12px; padding: 10px 14px; align-self: flex-start; }
.side-label { margin: 12px 2px 0; font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--side-mute); display: flex; align-items: center; gap: 8px; }
.side-client { margin: 4px 2px 18px; font-weight: 600; font-size: 15px; }
.side nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: 10px; font-size: 14.5px; font-weight: 500; color: var(--side-ink); }
.nav span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav:hover { background: var(--side-hover); }
.nav.active { background: var(--side-active); }
.nav-group { margin: 14px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--side-mute); }
.nav-empty { padding: 6px 12px; color: var(--side-mute); }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; background: rgba(0,0,0,.14); border-radius: 12px; padding: 10px 12px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #fff; color: var(--blue-ink); display: grid; place-items: center; font-weight: 600; flex: none; }
.me-name { font-weight: 500; }
.me-tag { font-size: 11px; color: var(--side-mute); }
.me a { color: var(--side-ink); text-decoration: underline; font-size: 13px; }
.env { font-size: 10.5px; font-weight: 600; letter-spacing: .06em; padding: 1px 7px; border-radius: 8px; background: var(--chip-amber); color: var(--amber-ink); }

.main { padding: 34px 32px 64px; max-width: 1120px; width: 100%; }
.eyebrow { font-size: 13px; font-weight: 500; color: var(--muted); }
h1 { font-size: 30px; font-weight: 600; margin: 6px 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 600; margin: 32px 0 12px; }
.lede { font-size: 13.5px; color: var(--muted); margin: 0 0 8px; }

/* ---- cards / tiles (same as company portal stat cards) */
.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 20px 22px; }
.card.flush { padding: 0; overflow: hidden; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-top: 16px; }
.tile { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); padding: 20px 22px; min-height: 120px; display: flex; flex-direction: column; justify-content: space-between; transition: box-shadow .15s, transform .15s; }
.tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.tile-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.tile-title { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.tile-sub { font-size: 13px; color: var(--muted); }
.chip { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.chip.blue { background: var(--chip-blue); color: var(--blue-ink); }
.chip.green { background: var(--chip-green); color: var(--green-text); }
.chip.amber { background: var(--chip-amber); color: var(--amber-ink); }
.chip.gray { background: var(--chip-gray); color: var(--muted); }
.chip.red { background: var(--chip-red); color: var(--red-ink); }
.kpi .kv { font-size: 30px; font-weight: 600; margin-top: 10px; }
.embed { margin-top: 18px; }
.chart-card { margin-top: 16px; max-width: 600px; }
.chart { width: 100%; margin-top: 8px; }
.chart .bar { fill: var(--blue); }
.chart text { font-size: 11px; fill: var(--muted); font-family: "IBM Plex Sans", sans-serif; }
.chart .val { fill: var(--ink); font-weight: 600; }
.notice-h { margin: 0 0 6px; }
.alert { background: var(--chip-amber); color: var(--amber-ink); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; margin: 12px 0; }

/* ---- dashboard tabs + embed area */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 18px; background: var(--card); padding: 6px; border-radius: 12px; box-shadow: var(--shadow); width: fit-content; }
.tab { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px; font-weight: 500; color: var(--muted); }
.tab .ico { width: 14px; height: 14px; }
.tab:hover { background: var(--ground); color: var(--ink); }
.tab.active { background: var(--chip-blue); color: var(--blue-ink); }
.main { max-width: none; min-width: 0; }
/* ---- settings */
.settings { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; margin-top: 18px; max-width: 1120px; }
.card-h { font-size: 15px; margin: 0 0 10px; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-top: 1px solid var(--line); }
.kv-row:first-of-type { border-top: 0; }
.kv-row .k { color: var(--muted); }
.kv-row .v { font-weight: 500; text-align: right; }
.btn.ghost { background: var(--card); color: var(--blue-ink); border: 1px solid var(--line); margin-top: 6px; padding: 9px 18px; }
.btn.ghost:hover { background: var(--chip-blue); }

/* ---- solo pages (sign-in etc.) */
.solo { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 110px 16px 32px; background: linear-gradient(180deg, var(--side) 0 220px, var(--ground) 220px); }
.solo-brand { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; box-shadow: var(--shadow); }
.solo-card { width: 100%; max-width: 440px; text-align: center; padding: 32px 30px; box-shadow: var(--shadow-lg); }
.solo-card.wide { max-width: 560px; text-align: left; }
.solo-card h1 { font-size: 24px; }
.btn { display: inline-block; margin-top: 14px; padding: 11px 26px; border-radius: 10px; background: var(--blue); color: #fff; font-weight: 600; font-size: 14.5px; }
.btn:hover { background: var(--blue-deep); }
.pick { margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.pick-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-top: 1px solid var(--line); font-weight: 500; }
.pick-row:first-child { border-top: 0; }
.pick-row:hover { background: var(--chip-blue); }
.foot { font-size: 12px; color: var(--muted); margin-top: 28px; }

@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .main { padding: 24px 18px 48px; }
}

/* ---- badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; vertical-align: middle; }
.badge .ico { width: 12px; height: 12px; }
.badge.green { background: var(--chip-green); color: var(--green-text); }
.badge.amber { background: var(--chip-amber); color: var(--amber-ink); }
.badge.blue { background: var(--chip-blue); color: var(--blue-ink); }
.badge.gray { background: var(--chip-gray); color: var(--muted); }
.side .badge.amber { background: rgba(255,244,224,.9); }

/* ---- client dashboard: tile grid (6 columns) */
.dgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.w-third { grid-column: span 2; } .w-half { grid-column: span 3; } .w-twothirds { grid-column: span 4; } .w-full { grid-column: span 6; }
.dtile { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; }
.dtile-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 14px 18px 10px; font-weight: 600; font-size: 14.5px; }
.dtile-b { position: relative; padding: 0 8px 8px; }
.dtile-b > tableau-viz, .dtile-b > .pbi-embed { display: block; width: 100%; height: 100%; }
.pbi-embed iframe { border: 0; }
.tile-msg { height: 100%; display: grid; place-items: center; text-align: center; color: var(--muted); background: var(--ground); border-radius: 10px; padding: 16px; }
.ph { height: 100%; display: flex; flex-direction: column; background: var(--ground); border-radius: 10px; padding: 12px; }
.ph-note { font-size: 12px; color: var(--amber-ink); }
.ph .chart { flex: 1; min-height: 0; height: 100%; max-width: 620px; margin: 0 auto; width: 100%; }

/* ---- admin */
.head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.head-row .btn { margin-top: 10px; display: inline-flex; align-items: center; gap: 6px; }
.btn .ico { width: 16px; height: 16px; vertical-align: -3px; }
.btn.sm { padding: 5px 10px; font-size: 13px; margin: 0; }
.btn.danger, .btn.ghost.danger { color: var(--red); }
.btn.danger:not(.ghost) { background: var(--red); color: #fff; }
button.btn { border: 0; cursor: pointer; font: inherit; font-weight: 600; }
button.btn.ghost { border: 1px solid var(--line); }
button.btn[disabled] { opacity: .4; cursor: default; }
.flash { background: var(--chip-green); color: var(--green-text); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; font-weight: 500; }
.errors { background: var(--chip-red); color: var(--red-ink); border-radius: 10px; padding: 10px 14px; margin: 12px 0; }
.errors ul { margin: 6px 0 0; padding-left: 18px; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .right { text-align: right; white-space: nowrap; }
.strong { font-weight: 600; }
.muted { color: var(--muted); font-size: 12.5px; }
.form { max-width: 900px; margin-top: 12px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.wide { grid-column: 1 / -1; }
.field > span { font-weight: 500; font-size: 13.5px; }
.field small { color: var(--muted); font-size: 12.5px; }
.field input, .field select, .inline input { font: inherit; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); min-width: 0; }
.field input:focus, .field select:focus { outline: 2px solid var(--chip-blue); border-color: var(--blue); }
.field input[disabled] { background: var(--ground); color: var(--muted); }
.prefix { display: flex; align-items: stretch; }
.prefix span { padding: 9px 4px 9px 12px; background: var(--ground); border: 1px solid var(--line); border-right: 0; border-radius: 10px 0 0 10px; color: var(--muted); font-family: "IBM Plex Mono", monospace; font-size: 12.5px; }
.prefix input { border-radius: 0 10px 10px 0; flex: 1; font-family: "IBM Plex Mono", monospace; }
fieldset.group { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; margin: 16px 0 0; }
fieldset.group legend { padding: 0 6px; font-weight: 600; }
.actions { display: flex; gap: 10px; margin-top: 18px; align-items: center; }
.actions .btn { margin-top: 0; }
.inline { display: flex; gap: 10px; margin-top: 8px; }
.egrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; margin-top: 12px; }
.etile { background: var(--card); border-radius: 14px; box-shadow: var(--shadow); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-height: 130px; }
.etile-top { display: flex; gap: 6px; flex-wrap: wrap; }
.etile-title { font-weight: 600; font-size: 15px; }
.etile-actions { margin-top: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.etile-actions form { display: inline; }
.etile.add { border: 2px dashed var(--line); box-shadow: none; background: transparent; align-items: center; justify-content: center; color: var(--blue-ink); font-weight: 600; }
.etile.add:hover { background: var(--chip-blue); border-color: var(--blue); }
.steps ol { margin: 0; padding-left: 20px; } .steps li { margin: 8px 0; }
.plain { margin: 0; padding-left: 18px; } .plain li { margin: 4px 0; }
.main > .card { margin-top: 12px; }
@media (max-width: 1000px) { .w-third, .w-half, .w-twothirds { grid-column: span 6; } }

/* Menu pages (admin) */
.tbl form.inline { margin: 0; align-items: center; }
.tbl form.inline input { padding: 6px 10px; }
.tbl form.inline .btn, .tbl form.inl .btn { margin-top: 0; }
form.inl { display: inline; }
.page-h { display: flex; align-items: center; gap: 8px; margin: 22px 0 10px; font-size: 15px; font-weight: 600; }
.page-h .link { font-size: 12.5px; font-weight: 400; font-family: 'IBM Plex Mono', monospace; }

.chk { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; white-space: nowrap; }
.dtile.no-h .dtile-b { padding-top: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
