/* Algo admin panel. APIDM brand: Blue #0034AF, Cyan #00C0F2, Navy #082666, Green #AFD75A, Neutral Cyan #EFF9FE. */
:root {
  --blue: #0034AF; --cyan: #00C0F2; --navy: #082666; --green: #AFD75A; --ice: #EFF9FE;
  --orange: #FDA04E; --purple: #9A6DB0; --muted: #3A5280; --line: #D6E6F5; --bg: #F5FAFE; --white: #fff;
  --red: #C2362B; --ok: #3E8A12;
  --high-bg: #E8F5D6; --high-fg: #3C5A0F; --rec-bg: #DDF5FD; --rec-fg: #00587A;
  --mod-bg: #FFEBD9; --mod-fg: #8A4A06; --not-bg: #FDE5E5; --not-fg: #A51D1D;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--navy); font: 400 15px/1.5 "Plus Jakarta Sans", Arial, sans-serif; }
a { color: var(--blue); }
h1, h2, h3 { font-family: "Red Hat Display", Arial, sans-serif; line-height: 1.2; margin: 0; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 19px; font-weight: 700; margin: 0 0 12px; }
h3 { font-size: 16px; font-weight: 700; margin: 0 0 8px; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--muted); }
.boot img { width: 64px; height: 64px; border-radius: 50%; }

/* auth screens */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--ice); }
.auth-card { width: 100%; max-width: 420px; background: #fff; border-radius: 20px; padding: 28px 24px; box-shadow: 0 12px 40px rgba(8, 38, 102, .12); }
.auth-card .brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-card .brand img { width: 48px; height: 48px; border-radius: 50%; }
.auth-card .brand b { font: 700 20px "Red Hat Display", Arial, sans-serif; display: block; }
.auth-card .bar { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--cyan), var(--green)); margin: 0 0 18px; }

/* layout */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #fff; padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.side .brand img { width: 38px; height: 38px; border-radius: 50%; background: #fff; }
.side .brand b { font: 700 17px "Red Hat Display", Arial, sans-serif; display: block; }
.side .brand span { font-size: 12px; opacity: .75; }
.side a { color: #fff; text-decoration: none; padding: 10px 12px; border-radius: 10px; font-weight: 500; display: block; opacity: .85; }
.side a:hover { background: rgba(255, 255, 255, .08); opacity: 1; }
.side a.on { background: rgba(0, 192, 242, .18); opacity: 1; box-shadow: inset 3px 0 0 var(--cyan); }
.side .grow { flex: 1; }
.side .me { font-size: 13px; padding: 10px 12px; opacity: .8; border-top: 1px solid rgba(255, 255, 255, .12); }
.main { padding: 26px 28px 60px; min-width: 0; }
.topline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.topline h1 { flex: 1 1 auto; }
.mobile-top { display: none; }

/* cards & grid */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; }
.grid.k4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font: 700 28px "Red Hat Display", Arial, sans-serif; }
.kpi .l { color: var(--muted); font-size: 13px; }

/* banners */
.banner { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-size: 14px; }
.banner.warn { background: #FFF3E6; border: 1px solid #F7C99B; color: #6B3A05; }
.banner.info { background: var(--ice); border: 1px solid var(--line); }
.banner.bad { background: #FDECEA; border: 1px solid #F2B8B2; color: #7A1E16; }

/* tables */
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid #EDF3FA; vertical-align: top; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--ice); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* pills & badges */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--ice); color: var(--muted); white-space: nowrap; }
.pill.live { background: var(--high-bg); color: var(--high-fg); }
.pill.draft { background: var(--mod-bg); color: var(--mod-fg); }
.pill.high { background: var(--high-bg); color: var(--high-fg); }
.pill.rec { background: var(--rec-bg); color: var(--rec-fg); }
.pill.mod { background: var(--mod-bg); color: var(--mod-fg); }
.pill.not { background: var(--not-bg); color: var(--not-fg); }
.pill.test { background: #EEE; color: #555; }
.pill.synced { background: var(--high-bg); color: var(--high-fg); }
.pill.failed { background: #FDECEA; color: var(--red); }
.pill.pending { background: var(--mod-bg); color: var(--mod-fg); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; background: var(--ok); }
.dot.no { background: var(--orange); }

/* forms */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 5px; }
label.f > small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], input[type=month], input[type=search], select, textarea {
  width: 100%; font: inherit; color: var(--navy); background: #fff; border: 1.5px solid var(--line); border-radius: 10px; padding: 9px 11px;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
textarea.code { font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; min-height: 320px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(0, 192, 242, .18); }
input:disabled, select:disabled, textarea:disabled { background: #F6F9FC; color: var(--muted); }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 12px; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--blue); }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1 1 180px; }
.err { color: var(--red); font-size: 13.5px; margin: 6px 0; }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline > input, .inline > select { width: auto; }

/* buttons */
.btn { display: inline-flex; align-items: center; gap: 6px; font: 600 14px/1 "Plus Jakarta Sans", Arial, sans-serif; padding: 10px 16px; border-radius: 999px; border: 1.5px solid var(--blue); background: #fff; color: var(--blue); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--ice); }
.btn.solid { background: var(--blue); color: #fff; }
.btn.solid:hover { background: #002A8E; }
.btn.danger { border-color: var(--red); color: var(--red); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; justify-content: center; padding: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--blue); font: inherit; cursor: pointer; text-decoration: underline; }

/* tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 3px solid transparent; padding: 10px 14px; font: 600 14px "Plus Jakarta Sans", Arial, sans-serif; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button.on { color: var(--blue); border-color: var(--blue); }

/* savebar */
.savebar { position: sticky; bottom: 0; background: rgba(245, 250, 254, .96); border-top: 1px solid var(--line); padding: 12px 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; z-index: 5; }
.savebar .msg { flex: 1; font-size: 14px; }

/* lead detail */
.ring { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; font: 700 26px "Red Hat Display", Arial, sans-serif; }
.leadhead { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.dims .d { margin-bottom: 10px; }
.dims .d div { height: 8px; background: var(--ice); border-radius: 8px; overflow: hidden; margin-top: 4px; }
.dims .d div i { display: block; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); }
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }
ol.answers { padding-left: 20px; margin: 0; }
ol.answers li { margin-bottom: 10px; }
ol.answers li span { display: block; color: var(--muted); font-size: 13px; }
ul.tight { margin: 4px 0; padding-left: 18px; }

/* chart */
.chart svg { width: 100%; height: 160px; display: block; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tierbar { display: flex; height: 14px; border-radius: 8px; overflow: hidden; background: var(--ice); }
.tierbar i { display: block; height: 100%; }

/* misc */
pre.snippet { background: var(--navy); color: #E6F3FF; padding: 14px; border-radius: 12px; overflow: auto; font-size: 12.5px; max-height: 260px; white-space: pre-wrap; word-break: break-all; }
.qtable td { padding: 6px 6px; }
.qtable input { padding: 7px 9px; }
.qtable td.n { width: 90px; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }
.optrow { display: grid; grid-template-columns: 1fr 90px 1fr; gap: 8px; margin-bottom: 8px; }
.faq { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .2s; z-index: 100; max-width: calc(100vw - 32px); }
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.bad { background: var(--red); }
.modal-bg { position: fixed; inset: 0; background: rgba(8, 38, 102, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 90; }
.modal { background: #fff; border-radius: 16px; padding: 22px; max-width: 440px; width: 100%; box-shadow: 0 20px 50px rgba(8, 38, 102, .3); }
.modal .inline { justify-content: flex-end; margin-top: 18px; }
.steps { counter-reset: s; padding: 0; margin: 0; list-style: none; }
.steps > li { counter-increment: s; position: relative; padding: 0 0 18px 44px; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%; background: var(--blue); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 30% 0 0; z-index: 50; transform: translateX(-102%); transition: transform .2s; height: 100%; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(8, 38, 102, .4); }
  .mobile-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 40; }
  .mobile-top button { background: none; border: 0; color: #fff; font-size: 24px; cursor: pointer; padding: 4px 8px; }
  .mobile-top img { width: 30px; height: 30px; border-radius: 50%; background: #fff; }
  .main { padding: 18px 16px 60px; }
  dl.kv { grid-template-columns: 1fr; gap: 2px; }
  dl.kv dd { margin-bottom: 8px; }
  .optrow { grid-template-columns: 1fr 70px; }
  .optrow > :nth-child(3) { grid-column: 1 / -1; }
}
