:root {
  --forest: #0d2418;
  --forest-2: #143523;
  --brand: #2f8f4e;
  --brand-2: #3fae62;
  --lime: #8cc63f;
  --gold: #c9a24a;
  --bg: #f4f7f5;
  --surface: #ffffff;
  --surface-2: #f7faf8;
  --ink: #12211a;
  --ink-2: #44594c;
  --muted: #74877b;
  --line: #e2e9e4;
  --danger: #c43d3d;
  --danger-bg: #fdeeee;
  --warn: #b7791f;
  --warn-bg: #fff6e5;
  --info: #2563a8;
  --info-bg: #eaf2fc;
  --ok-bg: #e9f6ee;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(13, 36, 24, .05), 0 8px 24px rgba(13, 36, 24, .06);
  --shadow-lg: 0 20px 60px rgba(13, 36, 24, .14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1510; --surface: #111e17; --surface-2: #15251c; --ink: #e8f1eb; --ink-2: #b9cbbf; --muted: #8aa093;
    --line: #22362a; --danger-bg: #3a1717; --warn-bg: #36290f; --info-bg: #13253a; --ok-bg: #143323;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.55 'Plus Jakarta Sans', system-ui, -apple-system, Segoe UI, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.01em; }
.boot { min-height: 100vh; display: grid; place-content: center; gap: 22px; justify-items: center; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero { position: relative; overflow: hidden; background: radial-gradient(1200px 600px at 10% -10%, #1f5a37 0%, transparent 60%), radial-gradient(900px 500px at 110% 120%, #27472f 0%, transparent 55%), var(--forest); color: #eaf5ee; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero::after { content: ''; position: absolute; inset: auto -120px -160px auto; width: 520px; height: 520px; border-radius: 50%; border: 1px solid rgba(201,162,74,.25); box-shadow: 0 0 0 60px rgba(201,162,74,.04), 0 0 0 140px rgba(140,198,63,.03); }
.login-hero h1 { font-size: clamp(30px, 4vw, 46px); font-weight: 800; max-width: 520px; margin-top: 40px; }
.login-hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--lime), var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero p { color: #b8d2c1; max-width: 460px; font-size: 16px; }
.hero-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.hero-pills span { border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.05); padding: 6px 12px; border-radius: 999px; font-size: 13px; color: #d7e9dd; }
.login-side { display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: 100%; max-width: 420px; animation: rise .4s ease; }
.login-card h2 { font-size: 26px; margin: 22px 0 6px; }
.login-card .sub { color: var(--muted); margin: 0 0 26px; }
#gsi { min-height: 44px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; margin: 28px 0 18px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.wa-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); display: grid; gap: 10px; }
.wa-card b { font-size: 15px; }
.wa-card small { color: var(--muted); }
.fineprint { color: var(--muted); font-size: 12.5px; margin-top: 22px; }

/* ---------- shell ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--forest) 96%, transparent); backdrop-filter: blur(10px); color: #e6f2ea; }
.topbar-in { max-width: 1240px; margin: auto; padding: 12px 20px; display: flex; align-items: center; gap: 18px; }
.topbar img { height: 32px; display: block; }
.brand-sep { width: 1px; height: 26px; background: rgba(255,255,255,.15); }
.brand-title { font-weight: 700; font-size: 15px; letter-spacing: .01em; }
.brand-title small { display: block; font-weight: 500; font-size: 11.5px; color: #9fbca9; letter-spacing: .06em; text-transform: uppercase; }
.nav { display: flex; gap: 4px; margin-left: 12px; }
.nav a { color: #c4dacb; text-decoration: none; padding: 8px 12px; border-radius: 10px; font-weight: 600; font-size: 14px; }
.nav a.on, .nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; }
.me img, .avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--brand); display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; }
.me .who { line-height: 1.2; text-align: right; }
.me .who b { font-size: 13.5px; display: block; }
.me .who span { font-size: 11.5px; color: #9fbca9; }
.iconbtn { background: transparent; border: 0; color: inherit; cursor: pointer; padding: 8px; border-radius: 10px; display: grid; place-items: center; }
.iconbtn:hover { background: rgba(255,255,255,.08); }
main { max-width: 1240px; margin: auto; padding: 28px 20px 80px; animation: rise .35s ease; }
.banner { max-width: 1240px; margin: 16px auto 0; padding: 0 20px; }
.banner > div { display: flex; gap: 12px; align-items: center; border-radius: 12px; padding: 12px 16px; font-weight: 600; }
.banner .info { background: var(--info-bg); color: var(--info); }
.banner .warning { background: var(--warn-bg); color: var(--warn); }
.banner .outage { background: var(--danger-bg); color: var(--danger); }

/* ---------- common ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.pad { padding: 22px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 16px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; background: var(--brand); color: #fff; font-weight: 700; padding: 11px 18px; border-radius: 12px; cursor: pointer; text-decoration: none; font-size: 14.5px; transition: transform .08s, background .15s, box-shadow .15s; }
.btn:hover { background: var(--brand-2); box-shadow: 0 6px 18px rgba(47,143,78,.28); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); box-shadow: none; }
.btn.wa { background: #1fae5b; }
.btn.wa:hover { background: #22c063; }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.block { width: 100%; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.pill.dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-new { color: #2563a8; background: var(--info-bg); border-color: transparent; }
.s-in_progress { color: #8a5a00; background: var(--warn-bg); border-color: transparent; }
.s-waiting_user, .s-waiting_vendor { color: #7a3fb0; background: color-mix(in srgb, #7a3fb0 12%, transparent); border-color: transparent; }
.s-resolved { color: var(--brand); background: var(--ok-bg); border-color: transparent; }
.s-closed { color: var(--muted); }
.p-P1 { color: #fff; background: var(--danger); border-color: transparent; }
.p-P2 { color: var(--danger); background: var(--danger-bg); border-color: transparent; }
.p-P3 { color: var(--ink-2); }
.p-P4 { color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }
label.f { display: grid; gap: 6px; font-weight: 600; font-size: 13.5px; }
label.f .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; }
input.i, select.i, textarea.i { width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); outline: none; transition: border .15s, box-shadow .15s; }
input.i:focus, select.i:focus, textarea.i:focus { border-color: var(--brand); box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 16%, transparent); }
textarea.i { min-height: 130px; resize: vertical; }
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 12px; border-radius: 9px; font-weight: 600; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.alert { border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.alert.danger { background: var(--danger-bg); color: var(--danger); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--info-bg); color: var(--info); }
.alert.ok { background: var(--ok-bg); color: var(--brand); }
.alert b { display: block; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }
#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: all .25s; background: var(--forest); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 99; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--danger); }
svg.ic { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- home ---------- */
.hello { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.hello h1 { font-size: clamp(24px, 3vw, 32px); font-weight: 800; }
.dept-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--ok-bg); color: var(--brand); padding: 6px 12px; border-radius: 999px; font-weight: 700; font-size: 13px; margin-top: 10px; }
.cats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.cat { text-align: left; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 18px; cursor: pointer; display: grid; gap: 10px; transition: transform .15s, box-shadow .15s, border-color .15s; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.cat:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.cat .ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 16%, transparent), color-mix(in srgb, var(--lime) 18%, transparent)); color: var(--brand); }
.cat b { font-size: 15.5px; }
.cat span { color: var(--muted); font-size: 13px; }
.cat.featured { background: linear-gradient(160deg, var(--forest-2), var(--forest)); color: #eaf5ee; border-color: transparent; }
.cat.featured span { color: #a9c6b3; }
.cat.featured .ico { background: rgba(255,255,255,.08); color: var(--lime); }
.cat.wa-cat { border-style: dashed; }
.cat.wa-cat .ico { background: color-mix(in srgb, #1fae5b 15%, transparent); color: #1fae5b; }
.section-h { display: flex; justify-content: space-between; align-items: center; margin: 36px 0 14px; }
.section-h h2 { font-size: 19px; }
.tlist { display: grid; gap: 10px; }
.titem { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; padding: 14px 18px; text-decoration: none; color: inherit; transition: border-color .15s; }
.titem:hover { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.titem .num { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; color: var(--muted); }
.titem b { display: block; font-size: 15px; }

/* ---------- new ticket ---------- */
.form-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 22px; align-items: start; }
.form-wrap .side { position: sticky; top: 84px; display: grid; gap: 16px; }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 14px; margin-bottom: 14px; }
.steps-h { display: flex; gap: 14px; align-items: center; margin-bottom: 20px; }
.steps-h .ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--ok-bg); color: var(--brand); }
.steps-h h1 { font-size: 24px; font-weight: 800; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.fgrid .full { grid-column: 1 / -1; }
.drop { border: 2px dashed var(--line); border-radius: 14px; padding: 22px; text-align: center; color: var(--muted); cursor: pointer; transition: all .15s; background: var(--surface-2); }
.drop.over, .drop:hover { border-color: var(--brand); color: var(--brand); background: var(--ok-bg); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; margin-top: 12px; }
.thumb { position: relative; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); aspect-ratio: 4/3; background: var(--surface-2); display: grid; place-items: center; font-size: 11px; color: var(--muted); padding: 4px; text-align: center; word-break: break-all; }
.thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; font-size: 13px; line-height: 1; }
.guide { border-radius: var(--radius); background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
.guide h3 { font-size: 15px; display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.guide ol, .guide ul { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; color: var(--ink-2); }
.guide code, .kbd { font-family: ui-monospace, Menlo, monospace; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
.ai-tips { border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); }
.ai-tips .h { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--brand); margin-bottom: 8px; font-size: 14px; }
.sparkle { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: linear-gradient(135deg, var(--brand), var(--lime)); color: #fff; }
.speed { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.speed div { background: var(--surface-2); border-radius: 12px; padding: 12px; text-align: center; border: 1px solid var(--line); }
.speed b { display: block; font-size: 22px; }
.speed span { font-size: 12px; color: var(--muted); }
.tabs-mini { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.yn { display: grid; gap: 10px; }
.yn .q { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; font-size: 14px; }

/* ---------- ticket ---------- */
.tk-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.tk-head h1 { font-size: 24px; font-weight: 800; margin: 8px 0 10px; }
.timeline { display: grid; gap: 14px; margin-top: 20px; }
.ev { display: grid; grid-template-columns: 36px 1fr; gap: 12px; }
.ev .bubble { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow); }
.ev.staff .bubble { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.ev.ai .bubble { background: linear-gradient(180deg, color-mix(in srgb, var(--brand) 7%, var(--surface)), var(--surface)); border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.ev.internal .bubble { background: var(--warn-bg); border-color: transparent; }
.ev.sys .bubble { background: transparent; box-shadow: none; border-style: dashed; padding: 8px 14px; font-size: 13.5px; color: var(--muted); }
.ev .meta { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; font-size: 13px; margin-bottom: 6px; }
.ev .meta b { font-size: 14px; }
.ev .msg { white-space: pre-wrap; word-wrap: break-word; font-size: 14.5px; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.atts a { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 4px; text-decoration: none; color: var(--ink-2); font-size: 12.5px; background: var(--surface-2); }
.atts a img { width: 120px; height: 84px; object-fit: cover; border-radius: 7px; display: block; }
.atts a.file { padding: 8px 10px; }
.reply { margin-top: 20px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.side h3 { font-size: 14px; margin-bottom: 12px; }
.stars { display: flex; gap: 6px; }
.stars button { background: none; border: 0; font-size: 28px; cursor: pointer; color: var(--line); padding: 0; }
.stars button.on { color: var(--gold); }
.sla { font-size: 12.5px; display: flex; gap: 6px; align-items: center; }
.sla.bad { color: var(--danger); font-weight: 700; }

/* ---------- console ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi { padding: 16px 18px; }
.kpi span { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi b { display: block; font-size: 28px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.kpi.alert-k b { color: var(--danger); }
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .i { width: auto; min-width: 150px; }
.filters input.i { flex: 1; min-width: 200px; }
table.q { width: 100%; border-collapse: collapse; font-size: 14px; }
table.q th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; }
table.q td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.q tr:hover td { background: var(--surface-2); cursor: pointer; }
table.q .num { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--muted); }
.table-scroll { overflow: auto; max-height: 70vh; border-radius: var(--radius); }
.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: 140px 1fr 36px; gap: 10px; align-items: center; font-size: 13px; }
.bar i { display: block; height: 10px; border-radius: 6px; background: linear-gradient(90deg, var(--brand), var(--lime)); }
.bar .track { background: var(--surface-2); border-radius: 6px; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 20px; }
.tabbar { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabbar a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 700; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabbar a.on { color: var(--ink); border-color: var(--brand); }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; }

@media (max-width: 980px) {
  .login { grid-template-columns: 1fr; }
  .login-hero { padding: 32px 24px; min-height: auto; }
  .login-hero h1 { margin-top: 24px; }
  .form-wrap, .tk-wrap { grid-template-columns: 1fr; }
  .form-wrap .side { position: static; }
  .nav { display: none; }
  .me .who { display: none; }
}
@media (max-width: 560px) {
  main { padding: 20px 16px 60px; }
  .fgrid { grid-template-columns: 1fr; }
  .titem { grid-template-columns: 1fr; gap: 6px; }
  .brand-sep, .brand-title { display: none; }
  .bar { grid-template-columns: 100px 1fr 30px; }
}
