/* ULTRAND ARSENAL — client portal. Same tokens and type as the public site. */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700;800&display=swap');

:root {
  --paper: #f5f5f0; --white: #fff; --ink: #171b19; --muted: #5f6760; --soft: #6b736c; --line: #dfe3dc; --line-2: #eceee8;
  --lime: #d7fa63; --lime-2: #c8ef4b; --green: #283a2f; --deep: #1d2c23; --side: #22332a;
  --ok: #5f7f1a; --ok-bg: #eef6d9; --warn: #9a5b12; --warn-bg: #fff0dc; --bad: #a33a2c; --bad-bg: #fde6e1; --info-bg: #eeeaff; --info: #5b4cb0;
  --mono: "DM Mono", ui-monospace, monospace; --sans: "DM Sans", Arial, sans-serif; --display: "Manrope", "DM Sans", sans-serif;
  --ease: cubic-bezier(.2, .75, .25, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #8baa29; outline-offset: 2px; }
h1, h2, h3, h4, p { margin-top: 0; }
[hidden] { display: none !important; }

/* ---- Brand ---------------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { width: 30px; height: 30px; background: var(--green); color: var(--lime); display: grid; place-items: center; font: 800 13px var(--display); letter-spacing: -.5px; flex: none; }
.brand-name { font: 500 11px var(--mono); letter-spacing: .09em; }
.brand-name b { font-weight: 500; color: #6d756d; }

/* ---- Shell ---------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--deep); color: #dfe6dc; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { padding: 22px 20px 18px; }
.side .brand-mark { background: var(--lime); color: var(--green); }
.side .brand-name { color: #eef2ea; }
.side .brand-name b { color: #9fb09c; }
.side-biz { margin: 0 14px 10px; padding: 12px; background: #2a3c31; border: 1px solid #3a4d40; }
.side-biz b { display: block; font: 650 14px var(--display); letter-spacing: -.02em; color: #fff; overflow-wrap: anywhere; }
.side-biz small { font: 500 9px var(--mono); letter-spacing: .08em; color: #b9c8a6; text-transform: uppercase; }
.nav { display: grid; gap: 2px; padding: 6px 10px; }
.nav-label { font: 500 9px var(--mono); letter-spacing: .1em; color: #8fa08d; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; text-decoration: none; color: #c9d3c6; font-size: 13px; border-radius: 2px; transition: background .15s, color .15s; }
.nav a:hover { background: #2c3f33; color: #fff; }
.nav a[aria-current="page"] { background: #3b4f40; color: #fff; }
.nav a.locked { color: #9aa898; }
.nav-icon { width: 24px; height: 24px; display: grid; place-items: center; background: #3a4c3d; color: var(--lime); font-size: 12px; flex: none; }
.nav a.locked .nav-icon { background: #2b3b30; color: #6f806d; }
.nav-count { margin-left: auto; background: var(--lime); color: var(--green); font: 600 10px var(--mono); padding: 1px 6px; border-radius: 9px; }
.nav-lock { margin-left: auto; font: 500 9px var(--mono); color: #9aa898; letter-spacing: .06em; }
.side-foot { margin-top: auto; padding: 14px 20px 20px; border-top: 1px solid #34463a; font-size: 12px; color: #a7b5a4; display: grid; gap: 8px; }
.side-foot button { background: none; border: 0; color: #dfe6dc; padding: 0; text-align: left; cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }

.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 40px 0; }
.crumb { font: 500 10px var(--mono); letter-spacing: .09em; color: var(--soft); text-transform: uppercase; }
.page { padding: 10px 40px 64px; max-width: 1240px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 6px 0 24px; flex-wrap: wrap; }
.page-head h1 { font: 650 clamp(28px, 3.2vw, 38px)/1.05 var(--display); letter-spacing: -.055em; margin: 0; }
.page-head p { color: var(--muted); margin: 8px 0 0; max-width: 620px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Buttons -------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid #cfd5ca; background: var(--white); color: var(--ink); padding: 9px 14px; font-size: 12.5px; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .15s var(--ease), background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: #aab69e; transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: wait; transform: none; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn-primary:hover { background: #354b3c; border-color: #354b3c; }
.btn-lime { background: var(--lime); border-color: var(--lime); color: #253021; }
.btn-lime:hover { background: var(--lime-2); border-color: var(--lime-2); }
.btn-danger { color: var(--bad); }
.btn-danger:hover { border-color: var(--bad); }
.btn-sm { padding: 6px 10px; font-size: 11.5px; }
.btn-link { background: none; border: 0; padding: 0; color: #526b20; font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 12.5px; }

/* ---- Cards, KPIs ---------------------------------------------------------- */
.card { background: var(--white); border: 1px solid var(--line); padding: 20px 22px; margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card h2 { font: 650 17px var(--display); letter-spacing: -.035em; margin: 0; }
.card h3 { font: 650 14px var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.card-sub { color: var(--muted); font-size: 12.5px; margin: 4px 0 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-2 > .card { margin-bottom: 0; }
.stack { display: grid; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--white); border: 1px solid var(--line); padding: 15px 17px; min-width: 0; }
.kpi span { display: block; font: 500 9.5px var(--mono); letter-spacing: .08em; color: var(--soft); text-transform: uppercase; }
.kpi strong { display: block; font: 650 26px/1.15 var(--display); letter-spacing: -.05em; margin-top: 6px; overflow-wrap: anywhere; }
.kpi small { color: var(--muted); font-size: 11.5px; }
.kpi.accent { background: var(--green); border-color: var(--green); color: #fff; }
.kpi.accent span, .kpi.accent small { color: #c5d3b8; }
.kpi a { color: inherit; text-decoration: none; }

.meter { height: 8px; background: var(--line-2); margin: 10px 0 6px; overflow: hidden; }
.meter i { display: block; height: 100%; background: #8db82e; }
.meter.hot i { background: #d9822b; }

/* ---- Tabs ----------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--green); }
.tabs .count { font: 500 10px var(--mono); background: var(--line-2); padding: 1px 6px; border-radius: 9px; margin-left: 5px; }

/* ---- Tables --------------------------------------------------------------- */
.table-wrap { overflow-x: auto; margin: 0 -22px; padding: 0 22px; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
.t th { text-align: left; font: 500 9.5px var(--mono); letter-spacing: .07em; color: var(--soft); text-transform: uppercase; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.t td { padding: 11px 10px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.t tr:last-child td { border-bottom: 0; }
.t td.num, .t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.t .actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.t small { color: var(--muted); display: block; }
.score { font: 600 12px var(--mono); padding: 3px 7px; background: var(--ok-bg); color: var(--ok); }

/* ---- Badges --------------------------------------------------------------- */
.badge { display: inline-block; font: 500 9.5px var(--mono); letter-spacing: .05em; text-transform: uppercase; padding: 3px 7px; background: var(--line-2); color: #555d56; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.chips { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---- Forms ---------------------------------------------------------------- */
.form { display: grid; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > span { font: 500 10px var(--mono); letter-spacing: .07em; color: var(--muted); text-transform: uppercase; }
.field > small { color: var(--soft); font-size: 11.5px; }
.input, .select, .textarea { width: 100%; border: 1px solid #cfd5ca; background: #fcfcfa; padding: 10px 12px; font-size: 13.5px; border-radius: 0; }
.input:focus, .select:focus, .textarea:focus { border-color: #8baa29; background: #fff; outline: none; box-shadow: 0 0 0 3px #e3f1bf; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.textarea.tall { min-height: 220px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--green); }
.form-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.hours { display: grid; gap: 6px; }
.hours-row { display: grid; grid-template-columns: 70px 110px 1fr 1fr; gap: 10px; align-items: center; }
.hours-row b { font-weight: 600; font-size: 13px; }
.kv-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: start; }

/* ---- Content blocks ------------------------------------------------------- */
.empty { text-align: center; padding: 34px 18px; color: var(--muted); border: 1px dashed #cdd3c7; background: #fafaf7; }
.empty b { display: block; color: var(--ink); font: 650 15px var(--display); margin-bottom: 4px; }
.empty .btn { margin-top: 12px; }
.notice { padding: 12px 14px; background: var(--info-bg); color: #3f3480; font-size: 13px; margin-bottom: 16px; border-left: 3px solid var(--info); }
.notice.warn { background: var(--warn-bg); color: #6b3f0c; border-color: #d9822b; }
.notice.ok { background: var(--ok-bg); color: #3f5510; border-color: #8db82e; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.code { font: 12px/1.5 var(--mono); background: #f1f2ed; padding: 8px 10px; overflow-wrap: anywhere; display: block; }

.item { border: 1px solid var(--line); padding: 16px 18px; background: #fff; margin-bottom: 12px; }
.item-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 8px; }
.item-head b { font-weight: 650; }
.quote { border-left: 3px solid var(--line); padding: 2px 0 2px 12px; color: #424943; margin: 8px 0 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.stars { color: #c99a1c; letter-spacing: 1px; }

.chat { display: grid; gap: 8px; max-height: 420px; overflow-y: auto; padding: 4px 2px; }
.bubble { max-width: 82%; padding: 9px 12px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.user { background: #eef0ea; justify-self: start; }
.bubble.assistant { background: var(--green); color: #f1f5ec; justify-self: end; }
.bubble.system { background: none; color: var(--soft); font-size: 11.5px; justify-self: center; font-style: italic; }
.bubble time { display: block; font: 500 9px var(--mono); opacity: .65; margin-top: 4px; }

.list-row { display: flex; gap: 12px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .grow small { display: block; color: var(--muted); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #c8cec2; flex: none; }
.dot.ok { background: #8db82e; }
.dot.warn { background: #d9822b; }
.dot.bad { background: var(--bad); }

.post { border: 1px solid var(--line); padding: 16px; background: #fff; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.posts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.post-hook { font-weight: 700; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; color: #353b36; font-size: 13px; }
.post-foot { margin-top: auto; display: flex; justify-content: space-between; gap: 8px; align-items: center; flex-wrap: wrap; }

.tool-tile { display: flex; gap: 12px; padding: 14px; border: 1px solid var(--line); background: #fafaf7; text-decoration: none; align-items: flex-start; }
.tool-tile:hover { border-color: #b9c79c; background: #fff; }
.tool-tile .nav-icon { background: #e7efd2; color: var(--green); }
.tool-tile b { display: block; font-size: 13.5px; }
.tool-tile small { color: var(--muted); font-size: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }

/* ---- Toast + loading ------------------------------------------------------ */
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: min(420px, calc(100vw - 40px)); padding: 12px 16px; background: var(--deep); color: #fff; font-size: 13px; box-shadow: 0 10px 30px #0003; opacity: 0; transform: translateY(8px); pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: #7a2a20; }
.loading { padding: 40px 0; color: var(--muted); }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Auth ----------------------------------------------------------------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 80% 10%, #eef6d9 0, transparent 45%), var(--paper); }
.auth-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); padding: 32px 30px; box-shadow: 0 25px 70px rgba(42, 54, 44, .1); }
.auth-card .brand { margin-bottom: 28px; }
.auth-card > h1 { font: 650 26px/1.15 var(--display); letter-spacing: -.05em; margin: 0 0 8px; }
.auth-card > p { color: var(--muted); }
.auth-card .btn { width: 100%; padding: 13px; margin-top: 6px; }
.auth-card > form { display: grid; gap: 12px; margin-top: 18px; }
.auth-foot { font-size: 12px; color: var(--soft); margin: 18px 0 0; }

/* ---- Support session + payment page --------------------------------------- */
.support-bar { background: #fff3c4; color: #5a4300; border-bottom: 1px solid #ecd27a; padding: 10px 40px; font-size: 13px; }
.support-bar .btn-link { color: #5a4300; margin-left: 6px; }
.eyebrow { display: block; font: 500 10px var(--mono); letter-spacing: .09em; color: var(--muted); margin-bottom: 8px; }
.t.order { margin: 18px 0 6px; }
.t.order .total td { font-weight: 700; border-top: 2px solid var(--ink); }
.auth-card > form .btn { margin-top: 12px; }

/* ---- Admin variant (visually distinct from a client's dashboard) ----------- */
.is-admin .side { background: #15181a; }
.is-admin .side .brand-mark { background: #f1f1ec; color: #15181a; }
.is-admin .side-biz { background: #22272a; border-color: #343b3f; }
.is-admin .nav a:hover { background: #242a2d; }
.is-admin .nav a[aria-current="page"] { background: #30373b; }
.is-admin .nav-icon { background: #2c3337; color: #f1f1ec; }
.is-admin .side-foot { border-color: #2c3337; }
.admin-tag { display: inline-block; font: 600 9px var(--mono); letter-spacing: .1em; background: #ffb84d; color: #2b1d00; padding: 2px 6px; margin-left: 6px; vertical-align: middle; }
.secret-once { background: #fff8e1; border: 1px solid #f0d78a; padding: 14px 16px; margin-bottom: 16px; }
.secret-once code { display: block; font: 13px/1.5 var(--mono); background: #fff; border: 1px solid #ead9a0; padding: 8px 10px; margin: 8px 0; overflow-wrap: anywhere; user-select: all; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px 16px; }
.search { width: min(360px, 100%); }
.row-link { cursor: pointer; }
.row-link:hover td { background: #fafaf7; }
.dl { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; font-size: 13px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; overflow-wrap: anywhere; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- Responsive ----------------------------------------------------------- */
@media (max-width: 1000px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar, .page { padding-left: 24px; padding-right: 24px; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { min-width: 0; position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; overflow: visible; }
  .side .brand { padding: 14px 16px; }
  .side-biz { display: none; }
  .nav { order: 3; width: 100%; display: flex; overflow-x: auto; padding: 0 10px 10px; gap: 4px; }
  .nav-label { display: none; }
  .nav a { flex: none; padding: 7px 10px; }
  .side-foot { margin: 0 0 0 auto; border: 0; padding: 14px 16px; display: flex; gap: 14px; }
  .side-foot .who { display: none; }
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px; padding: 0 16px; }
  .hours-row { grid-template-columns: 50px 90px 1fr 1fr; gap: 6px; }
  .kv-row { grid-template-columns: 1fr; }
  .support-bar { padding: 10px 16px; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---- Fieldsets (grouped checkboxes) ---------------------------------------- */
fieldset.field { border: 0; padding: 0; margin: 0; min-width: 0; }
.field-legend { font: 500 10px var(--mono); letter-spacing: .07em; color: var(--muted); text-transform: uppercase; padding: 0; margin-bottom: 8px; }
.crumb { margin: 0 0 4px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px 20px; align-items: start; }
#page:focus { outline: none; } /* focus is moved here on navigation for screen readers; no visible ring needed */
