/* Client Portal demo styles. System fonts only, nothing loaded from the internet. */
:root {
  --charcoal: #1B2838; --mint: #00D4AA; --mint-dark: #00B894; --mint-light: #E8FBF6;
  --gray: #64748B; --gray-light: #94A3B8; --line: #E2E8F0; --bg: #F8FAFC; --card: #fff;
  --good: #059669; --bad: #EF4444; --bar-h: 56px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--charcoal); font: 400 15px/1.5 var(--font); }
button, select, input, textarea { font: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }

/* ---- shell ---- */
.layout { display: flex; min-height: 100vh; }
.side {
  width: 256px; flex: none; background: var(--charcoal); color: #fff; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; padding-bottom: var(--bar-h);
}
.logo { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,.1); text-decoration: none; }
.logo .mk { width: 40px; height: 40px; border-radius: 9px; background: var(--mint); display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding-bottom: 8px; flex: none; }
.logo .mk i { width: 5px; border-radius: 2px; background: var(--charcoal); display: block; }
.logo b { display: block; font-size: 18px; font-weight: 650; }
.logo small { display: block; font-size: 11px; color: #9CA3AF; }
.side-x { display: none; }
.nav { flex: 1; overflow-y: auto; padding: 16px; }
.nav a, .nav .off { display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 8px; font-size: 14px; font-weight: 500; color: #D1D5DB; text-decoration: none; margin-bottom: 4px; cursor: pointer; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.on { background: var(--mint); color: var(--charcoal); }
.nav .off { color: #6B7A8C; cursor: default; }
.nav .off em { margin-left: auto; font-style: normal; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; border: 1px solid #3A4A5E; border-radius: 99px; padding: 1px 7px; }
.nav .sec { padding: 22px 16px 8px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #6B7280; }
.nav svg { width: 20px; height: 20px; flex: none; }
.badge { margin-left: auto; background: var(--mint); color: var(--charcoal); font-size: 11px; font-weight: 700; border-radius: 99px; padding: 1px 8px; }
.nav a.on .badge { background: var(--charcoal); color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { background: #fff; border-bottom: 1px solid var(--line); height: 80px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding: 0 28px; }
.menu-btn { display: none; margin-right: auto; width: 40px; height: 40px; border-radius: 8px; background: var(--charcoal); color: #fff; border: 0; align-items: center; justify-content: center; }
.user { display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--charcoal); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; flex: none; }
.user b { display: block; font-size: 14px; font-weight: 600; }
.user small { display: block; font-size: 12px; color: var(--gray); }
.content { padding: 28px; max-width: 1400px; width: 100%; }

/* ---- page head ---- */
.phead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 28px; }
.phead h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.phead p { color: var(--gray); margin-top: 4px; }
.tools-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.sync-note { font-size: 12px; color: var(--gray); display: flex; align-items: center; gap: 6px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--charcoal); border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--gray-light); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--mint); border-color: var(--mint); color: var(--charcoal); font-weight: 600; }
.btn.primary:hover { background: var(--mint-dark); }
.btn.dark { background: var(--charcoal); border-color: var(--charcoal); color: #fff; }
.btn[disabled] { opacity: .6; cursor: default; }
select.btn { font-size: 16px; padding: 7px 10px; }
.org { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 15px; }
.org svg { width: 18px; height: 18px; color: var(--gray); }
.spin svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- cards ---- */
.card { background: var(--card); border: 1px solid #EEF2F6; border-radius: 12px; padding: 24px; box-shadow: 0 1px 2px rgba(15,23,42,.04); min-width: 0; }
.card h3 { font-size: 17px; font-weight: 650; }
.card .sub { color: var(--gray); font-size: 13px; margin-top: 2px; }
.card-h { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.ico { width: 40px; height: 40px; border-radius: 9px; background: var(--mint-light); color: var(--mint-dark); display: flex; align-items: center; justify-content: center; flex: none; }
.ico svg { width: 20px; height: 20px; }
.ico.sm { width: 32px; height: 32px; }
.ico.sm svg { width: 16px; height: 16px; }
.grid { display: grid; gap: 24px; margin-bottom: 24px; }
.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)); }
.g21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }

.hero { background: var(--charcoal); border-radius: 12px; padding: 32px; margin-bottom: 24px; color: #fff; }
.hero .k { font-size: 14px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--gray-light); }
.hero .kk { font-size: 12px; color: rgba(148,163,184,.65); margin: 2px 0 8px; }
.hero .v { font-size: 48px; font-weight: 700; color: var(--mint); letter-spacing: -.02em; line-height: 1.1; margin-bottom: 10px; }
.hero .c { font-size: 14px; color: var(--gray-light); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.kpi .top-r { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.kpi .l { font-size: 14px; color: var(--gray); }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -.01em; margin: 2px 0; }
.kpi .n { font-size: 12px; color: var(--gray); }
.chg { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; white-space: nowrap; }
.chg svg { width: 14px; height: 14px; }
.chg.up { color: var(--good); } .chg.down { color: var(--bad); } .chg.flat { color: var(--gray); }
.hero .chg.up { color: #34D399; } .hero .chg.down { color: #F87171; }

.roi .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 16px; }
.roi .l { font-size: 14px; color: var(--gray); margin-bottom: 2px; }
.roi .v { font-size: 26px; font-weight: 700; }
.roi .v span { color: var(--gray-light); font-weight: 400; font-size: 18px; margin-right: 4px; }
.roi .foot { border-top: 1px solid #F1F5F9; padding-top: 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pill { font-weight: 700; font-size: 20px; padding: 4px 12px; border-radius: 8px; color: #047857; background: #ECFDF5; }

/* ---- charts ---- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font: 11px var(--font); fill: var(--gray); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 13px; color: var(--gray); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.hbar { margin-bottom: 14px; }
.hbar .t { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 6px; gap: 8px; }
.hbar .t b { font-weight: 600; }
.hbar .track { height: 10px; background: #F1F5F9; border-radius: 99px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 99px; }

/* ---- tables ---- */
.tbl-wrap { overflow-x: auto; margin: 0 -24px -8px; padding: 0 24px 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--gray); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px; border-bottom: 1px solid #F1F5F9; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #F8FAFC; }
.cname b { display: block; font-weight: 600; }
.cname small { color: var(--gray); font-size: 12px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: #F1F5F9; color: var(--gray); }
.tag.mint { background: var(--mint-light); color: #047857; }
.tag.amber { background: #FEF3C7; color: #92400E; }
.tag.red { background: #FEE2E2; color: #B91C1C; }
.tag.indigo { background: #EEF2FF; color: #4338CA; }

/* ---- platforms ---- */
.plats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plat { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: flex; gap: 10px; align-items: center; }
.plat b { display: block; font-size: 14px; font-weight: 600; }
.plat small { display: block; font-size: 12px; color: var(--gray); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); flex: none; }

/* ---- tools ---- */
.tool-grp { margin-bottom: 28px; }
.tool-grp h2 { font-size: 18px; font-weight: 650; }
.tool-grp > p { color: var(--gray); font-size: 14px; margin: 2px 0 14px; }
.tool { display: flex; flex-direction: column; gap: 10px; cursor: pointer; text-align: left; border: 1px solid #EEF2F6; }
.tool:hover { border-color: var(--mint); }
.tool.sel { border-color: var(--mint); box-shadow: 0 0 0 2px var(--mint-light); }
.tool b { font-size: 15px; }
.tool p { font-size: 13px; color: var(--gray); }
.tool .meta { display: flex; gap: 8px; align-items: center; margin-top: auto; font-size: 12px; color: var(--gray); }
.panel { margin-bottom: 28px; border: 1px solid var(--mint); }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field select, .field input, .field textarea { width: 100%; font-size: 16px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--charcoal); }
.field textarea { min-height: 84px; resize: vertical; }
.out { background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; padding: 16px; white-space: pre-wrap; font-size: 14px; min-height: 120px; }
.out.empty { color: var(--gray); display: flex; align-items: center; justify-content: center; text-align: center; }
.calc-res { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 4px; }
.calc-res div { background: var(--bg); border-radius: 10px; padding: 12px; }
.calc-res small { display: block; color: var(--gray); font-size: 12px; }
.calc-res b { font-size: 20px; }

/* ---- content review ---- */
.draft { margin-bottom: 16px; }
.draft .dh { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.draft .dh h3 { margin-right: auto; }
.draft .body { white-space: pre-wrap; font-size: 14px; background: var(--bg); border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.draft .acts { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.draft .meta { font-size: 12px; color: var(--gray); }
.draft.done { opacity: .75; }
.note-box { margin-top: 12px; }
.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 20px; }

/* ---- toast ---- */
#toast { position: fixed; left: 50%; bottom: calc(var(--bar-h) + 16px); transform: translateX(-50%); background: var(--charcoal); color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; }

/* ---- demo bar ---- */
body { padding-bottom: var(--bar-h); }
#tkbsDemoBar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147483000;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 16px;
  padding: 9px 16px; background: #0F1720; color: #E6EDF5;
  font: 500 13px/1.35 system-ui, -apple-system, "Segoe UI", Arial, sans-serif; border-top: 2px solid #3DDC97;
}
#tkbsDemoBar b { color: #3DDC97; letter-spacing: .06em; font-weight: 700; }
#tkbsDemoBar a { color: #fff; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
#tkbsDemoBar a.cta { background: #3DDC97; color: #0F1720; text-decoration: none; font-weight: 700; padding: 6px 12px; border-radius: 999px; }
#tkbsDemoBar .viewas { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: center; }
#tkbsDemoBar .seg { display: inline-flex; border: 1px solid #33465A; border-radius: 999px; overflow: hidden; }
#tkbsDemoBar .seg button { background: transparent; color: #CBD5E1; border: 0; padding: 5px 11px; font: 600 12px/1.2 system-ui, -apple-system, "Segoe UI", Arial, sans-serif; cursor: pointer; }
#tkbsDemoBar .seg button.on { background: #3DDC97; color: #0F1720; }

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g21 { grid-template-columns: minmax(0, 1fr); }
  .plats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .side { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform .2s; height: auto; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; }
  .scrim { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 45; }
  .side-x { display: flex; margin-left: auto; width: 36px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: #D1D5DB; align-items: center; justify-content: center; }
  .menu-btn { display: inline-flex; }
  .top { padding: 0 16px; height: 64px; }
  .content { padding: 20px 16px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .g4, .g3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
  .grid { gap: 12px; margin-bottom: 12px; }
  .card { padding: 16px; }
  .tbl-wrap { margin: 0 -16px -8px; padding: 0 16px 8px; }
  .kpi .v { font-size: 20px; }
  .kpi .top-r { margin-bottom: 8px; }
  .kpi .ico { width: 32px; height: 32px; }
  .phead h1 { font-size: 24px; }
  .hero { padding: 22px; }
  .hero .v { font-size: 36px; }
  .roi .v { font-size: 20px; }
  .plats { grid-template-columns: minmax(0, 1fr); }
  .calc-res { grid-template-columns: minmax(0, 1fr); }
  .tools-grid.g3 { grid-template-columns: minmax(0, 1fr); }
  .user small { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .sync-note { width: 100%; }
}
@media (hover: none) { .nav a:hover { background: none; } .nav a.on:hover { background: var(--mint); } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
