:root { --bg:#f6f4ee; --card:#fff; --ink:#1f2937; --muted:#6b7280; --line:#e5e7eb; --brand:#f5a800; --brand-ink:#1f2937; --bad:#b91c1c; --good:#15803d; --warn:#b45309; --side:#fffdf6; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: system-ui, "Segoe UI", Roboto, sans-serif; font-size: 15px; line-height: 1.45; }
a { color: inherit; }
code, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* shell */
.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.topbar .brand { font-weight: 800; font-size: 18px; text-decoration: none; display: flex; align-items: center; }
.topbar .brand img { height: 34px; width: auto; display: block; }
.login-logo { display: block; height: 84px; width: auto; margin: 0 auto 10px; }
.login h2 { text-align: center; }
.topbar .brand small { font-weight: 500; color: var(--muted); margin-left: 8px; font-size: 12px; }
.topbar .spacer { flex: 1; }
.topbar .who { text-align: right; font-size: 13px; color: var(--muted); line-height: 1.2; }
.topbar .who strong { display: block; color: var(--ink); }
.shell { display: grid; grid-template-columns: 230px 1fr; min-height: calc(100vh - 52px); }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 14px 10px 24px; display: flex; flex-direction: column; gap: 2px; }
.side .group { margin: 16px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.side a, .side button { display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; color: var(--ink); }
.side a:hover, .side button:hover { background: #fff3cf; }
.side a.active { background: var(--brand); font-weight: 700; }
.main { padding: 26px 32px 60px; max-width: 1180px; width: 100%; }
@media (max-width: 800px) { .shell { grid-template-columns: 1fr; } .side { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); } .side .group { display: none; } .main { padding: 18px; } }

/* page */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
h1 { margin: 0 0 4px; font-size: 26px; } h2 { margin: 0; font-size: 18px; } h3 { margin: 22px 0 8px; font-size: 16px; }
p { margin: 6px 0; } .lead { color: var(--muted); margin: 0; max-width: 760px; }
.muted { color: var(--muted); } .good { color: var(--good); font-weight: 700; } .bad { color: var(--bad); font-weight: 700; } .warn { color: var(--warn); font-weight: 700; }
.sub { display: block; color: var(--muted); font-size: 13px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* cards, grids */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; }
.card > header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.card > header p { color: var(--muted); font-size: 13px; margin: 2px 0 0; }
.grid { display: grid; gap: 16px; } .grid-2 { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); } .grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 13px; } .stat .v { font-size: 26px; font-weight: 800; margin-top: 2px; } .stat .s { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.field { margin-bottom: 12px; } .field label { display: block; font-weight: 600; margin-bottom: 4px; font-size: 14px; }
.help { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; }
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; margin: 0; } dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: #fff; }
.card table { border: 0; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #fafafa; font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td .sub { margin-top: 1px; }
.empty { text-align: center; color: var(--muted); padding: 28px; }

/* controls */
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid #d1d5db; border-radius: 8px; background: #fff; max-width: 100%; }
input[type=number] { width: 130px; } .input-wide { width: 100%; max-width: 560px; }
textarea { width: 100%; max-width: 820px; }
button, .btn { font: inherit; font-weight: 700; padding: 8px 14px; border-radius: 8px; border: 0; background: var(--brand); color: var(--brand-ink); cursor: pointer; text-decoration: none; display: inline-block; }
button.ghost, .btn.ghost { background: #fff; border: 1px solid #d1d5db; font-weight: 600; }
button.danger, .btn.danger { background: var(--bad); color: #fff; }
.btn.sm, button.sm { padding: 5px 10px; font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.check { display: flex; gap: 10px; align-items: flex-start; margin: 8px 0; cursor: pointer; } .check input { margin-top: 4px; } .check small { display: block; color: var(--muted); font-weight: 400; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; background: #eef2f7; color: #374151; margin-left: 4px; vertical-align: middle; }
.badge.success { background: #dcfce7; color: #166534; } .badge.warning { background: #fef3c7; color: #92400e; } .badge.danger { background: #fee2e2; color: #991b1b; } .badge.primary { background: #fde9a8; color: #5c4400; }
.msg { padding: 10px 14px; border-radius: 10px; margin-bottom: 14px; background: #ecfdf3; border: 1px solid #bbf7d0; }
.err { background: #fef2f2; border: 1px solid #fecaca; color: var(--bad); }
.bar { height: 10px; background: var(--brand); border-radius: 5px; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: flex-end; padding: 10px 4px 0; color: var(--muted); font-size: 13px; }

/* support tools on a customer */
details.tool { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fff; }
details.tool > summary { cursor: pointer; padding: 11px 14px; font-weight: 700; list-style: none; }
details.tool > summary::-webkit-details-marker { display: none; }
details.tool > summary::after { content: "+"; float: right; color: var(--muted); }
details.tool[open] > summary::after { content: "−"; }
details.tool .body { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
details.tool.danger > summary { color: var(--bad); }
pre.meta { margin: 6px 0 0; padding: 8px; background: #f8fafc; border-radius: 8px; font-size: 12px; overflow-x: auto; max-width: 520px; }

/* sign in */
.login { max-width: 380px; margin: 12vh auto; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 26px; }
.login input { width: 100%; margin: 6px 0 14px; } .login h2 { margin-bottom: 14px; }
