/* Bolt ZK portal — Bolt HR design tokens (same as Bolt Verify: bolt-v2-react src/index.css). */

:root {
    --radius: 10px;
    --radius-sm: 7px;
    --bg: #ffffff;
    --surface: #ffffff;
    --canvas: #fafafa;
    --fg: #18181b;
    --muted: #64748b;
    --faint: #94a3b8;
    --border: #ebebeb;
    --border-strong: #dcdce0;
    --primary: #5209FA;
    --primary-hover: #4308d1;
    --primary-soft: #faf5ff;
    --primary-ring: rgba(82, 9, 250, .18);

    --ok: #15803d;      --ok-soft: #ecfdf3;
    --warn: #b45309;    --warn-soft: #fffbeb;
    --bad: #c2410c;     --bad-soft: #fff4ed;
    --info: #1d4ed8;    --info-soft: #eff6ff;
    --idle: #52525b;    --idle-soft: #f4f4f5;

    --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --sidebar-w: 248px;
}

* { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: "Figtree", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: var(--fg);
    background: var(--canvas);
    line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .86em; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ── Shell ─────────────────────────────────────────────────────────────── */
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex-shrink: 0; background: var(--bg);
    border-right: 1px solid var(--border); display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; padding: 18px 12px;
}
.brand {
    display: flex; align-items: center; gap: 2px; padding: 4px 10px 18px;
    font-weight: 700; font-size: 1.25rem; color: var(--fg); letter-spacing: -.02em;
}
.brand:hover { color: var(--fg); }
.brand .zap { color: var(--primary); display: inline-flex; }
.brand small {
    margin-left: 8px; font-size: .68rem; font-weight: 600; color: var(--muted);
    border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px; letter-spacing: 0;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-section {
    font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
    color: var(--faint); padding: 14px 10px 6px;
}
.nav a {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-sm);
    color: #3f3f46; font-weight: 500;
}
.nav a:hover { background: var(--idle-soft); color: var(--fg); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav a svg { flex-shrink: 0; opacity: .85; }
.nav .badge { margin-left: auto; }
.sidebar-foot {
    margin-top: auto; border-top: 1px solid var(--border); padding: 12px 10px 0;
    display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .87rem;
}
.sidebar-foot form { margin: 0; }
.linkish { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font: inherit; }
.linkish:hover { color: var(--fg); }

.main { flex: 1; min-width: 0; }
.topbar {
    display: none; align-items: center; gap: 10px; padding: 12px 16px; background: var(--bg);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.content { max-width: 1240px; margin: 0 auto; padding: 28px 32px 56px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.55rem; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: .87rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--fg); }

/* ── Cards & stats ─────────────────────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 1rem; font-weight: 600; }
.card-head .sub { font-size: .85rem; color: var(--muted); }
.card-body { padding: 16px 18px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px 18px; }
.stat .label { font-size: .82rem; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 1.75rem; font-weight: 700; margin-top: 6px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: .95rem; color: var(--muted); font-weight: 500; }
.stat .foot { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.stat.attention { border-color: #fed7aa; background: linear-gradient(0deg, var(--bad-soft), var(--surface)); }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; }

/* ── Device cards ──────────────────────────────────────────────────────── */
.device-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.device-card { padding: 16px 18px; display: block; color: inherit; transition: border-color .15s, box-shadow .15s; }
.device-card:hover { color: inherit; border-color: #d4c4fd; box-shadow: 0 0 0 3px var(--primary-ring); }
.device-card .top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.device-card h3 { font-size: 1rem; font-weight: 600; }
.device-card .serial { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.device-card .meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border); }
.device-card .meta b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.device-card .meta span { font-size: .76rem; color: var(--muted); }
.device-card .seen { font-size: .8rem; color: var(--muted); margin-top: 10px; }

/* ── Pills, dots, badges ───────────────────────────────────────────────── */
.pill {
    display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600;
    padding: 2px 9px; border-radius: 999px; white-space: nowrap; line-height: 1.6;
    background: var(--idle-soft); color: var(--idle);
}
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.pill.info { background: var(--info-soft); color: var(--info); }
.pill.brand { background: var(--primary-soft); color: var(--primary); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; flex-shrink: 0; }
.pill.ok .dot { box-shadow: 0 0 0 3px rgba(21, 128, 61, .15); }
.badge {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: .72rem; font-weight: 700;
    background: var(--bad); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ── Tables ────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th {
    text-align: left; font-size: .76rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
    color: var(--muted); padding: 10px 18px; border-bottom: 1px solid var(--border); background: #fcfcfd; white-space: nowrap;
}
.table td { padding: 11px 18px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfcfe; }
.table .primary-cell { font-weight: 600; }
.table .sub { display: block; font-size: .8rem; color: var(--muted); font-weight: 400; }
.table .err { color: var(--bad); font-size: .82rem; max-width: 380px; }
.table form { margin: 0; display: inline; }

.empty { padding: 36px 18px; text-align: center; color: var(--muted); }
.empty svg { color: var(--faint); margin-bottom: 8px; }
.empty b { display: block; color: var(--fg); font-weight: 600; margin-bottom: 2px; }

/* ── Buttons & forms ───────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
    border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg); color: var(--fg);
    font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; white-space: nowrap;
    transition: background .15s, border-color .15s, box-shadow .15s;
}
.btn:hover { background: #f8f8fa; color: var(--fg); }
.btn:focus-visible, .input:focus, select:focus, textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--primary-ring); border-color: var(--primary); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-soft); border-color: #fdba74; }
.btn.sm { height: 30px; padding: 0 10px; font-size: .84rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

label { font-size: .84rem; font-weight: 600; display: block; margin-bottom: 6px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 5px; font-weight: 400; }
.input, select, textarea {
    width: 100%; height: 38px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font: inherit; font-size: .92rem; color: var(--fg); background: var(--bg);
}
textarea { height: auto; padding: 9px 11px; }
.field + .field, .form-grid + .field { margin-top: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.filters .input, .filters select { width: auto; min-width: 150px; height: 34px; font-size: .88rem; }
.filters .grow { flex: 1; min-width: 200px; }
.filters .grow .input { width: 100%; }

.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg a { padding: 6px 12px; font-size: .85rem; font-weight: 600; color: var(--muted); border-left: 1px solid var(--border-strong); }
.seg a:first-child { border-left: 0; }
.seg a.on { background: var(--primary-soft); color: var(--primary); }

/* ── Tabs ──────────────────────────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs a {
    padding: 12px 10px; font-weight: 600; font-size: .9rem; color: var(--muted);
    border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--fg); }
.tabs a.on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { font-weight: 500; color: var(--faint); margin-left: 4px; }

/* ── Key/value ─────────────────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 10px 16px; font-size: .92rem; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ── Flash / callouts ──────────────────────────────────────────────────── */
.flash { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: .92rem; border: 1px solid; }
.flash.success { background: var(--ok-soft); border-color: #bbf7d0; color: #14532d; }
.flash.error { background: var(--bad-soft); border-color: #fed7aa; color: #7c2d12; }
.flash.info, .flash.warning { background: var(--warn-soft); border-color: #fde68a; color: #78350f; }
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid #fde68a; background: var(--warn-soft); color: #78350f; margin-bottom: 20px; align-items: flex-start; }
.callout.note { border-color: #e9d5ff; background: var(--primary-soft); color: #3b0764; }
.callout b { color: inherit; }
.callout .grow { flex: 1; }

/* ── Pagination ────────────────────────────────────────────────────────── */
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; border-top: 1px solid var(--border); font-size: .87rem; color: var(--muted); }

/* ── Steps (connect page) ──────────────────────────────────────────────── */
.steps { counter-reset: step; display: grid; gap: 14px; }
.step { display: grid; grid-template-columns: 34px 1fr; gap: 14px; padding: 18px; }
.step::before {
    counter-increment: step; content: counter(step); width: 30px; height: 30px; border-radius: 50%;
    background: var(--primary-soft); color: var(--primary); font-weight: 700; display: grid; place-items: center;
}
.step h3 { font-size: 1rem; margin-bottom: 6px; }
.step p { margin: 0 0 8px; color: #3f3f46; }
.copy { display: inline-flex; align-items: center; gap: 8px; background: var(--canvas); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 5px 6px 5px 10px; font-family: ui-monospace, Menlo, monospace; font-size: .88rem; }
.copy button { border: 0; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; font: inherit; font-family: inherit; font-size: .76rem; padding: 2px 8px; cursor: pointer; color: var(--muted); }
.settings-table { width: 100%; border-collapse: collapse; margin-top: 6px; font-size: .9rem; }
.settings-table td { padding: 7px 0; border-bottom: 1px dashed var(--border); }
.settings-table td:first-child { color: var(--muted); width: 210px; }

/* ── Login ─────────────────────────────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
    radial-gradient(1200px 500px at 50% -10%, #efe7ff 0%, rgba(239, 231, 255, 0) 60%), var(--canvas); }
.login { width: 100%; max-width: 380px; padding: 30px 28px; }
.login .brand { justify-content: center; padding: 0 0 6px; font-size: 1.5rem; }
.login p.lead { text-align: center; color: var(--muted); margin: 0 0 22px; font-size: .92rem; }
.login .btn { width: 100%; height: 40px; margin-top: 18px; }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 1080px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
    .sidebar { position: fixed; z-index: 30; left: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 40px rgba(0, 0, 0, .12); }
    .sidebar.open { transform: none; }
    .topbar { display: flex; }
    .content { padding: 20px 16px 48px; }
    .form-grid { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 120px 1fr; }
}
@media (max-width: 520px) {
    .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat .value { font-size: 1.4rem; }
    .filters .input, .filters select { min-width: 0; width: 100%; }
}
