/* Acsero console. Warm paper and ink from the Rave Neal & Associates identity; Acsero teal for action and "live". */
:root {
  --paper: #f7f4ee;
  --paper-2: #efe9dd;
  --line: #e4ddd0;
  --line-strong: #d3cab9;
  --ink: #211b15;
  --ink-2: #4a4239;
  --muted: #6e655b;
  --teal: #0f766e;
  --teal-ink: #0b5a54;
  --teal-wash: #e3f1ee;
  --brown: #6b3b2e;
  --amber-ink: #8a4b08;
  --amber-wash: #fbefd9;
  --red-ink: #a12222;
  --red-wash: #f8e4e1;
  --card: #fffdf9;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 0 rgba(33, 27, 21, 0.04), 0 8px 24px -14px rgba(33, 27, 21, 0.25);
  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 15px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 32px; line-height: 1.15; }
h2 { font-size: 21px; line-height: 1.25; }
h3 { font-size: 16px; font-family: var(--sans); font-weight: 600; letter-spacing: 0; }
p { margin: 0; }
a { color: var(--teal-ink); }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------------------------------------- shell */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.side {
  background: var(--paper-2); border-right: 1px solid var(--line); padding: 22px 16px;
  display: flex; flex-direction: column; gap: 22px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px; text-decoration: none; color: var(--ink); }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { font-family: var(--serif); font-weight: 600; font-size: 22px; letter-spacing: -0.02em; }
.brand small { display: block; font-size: 11.5px; color: var(--muted); margin-top: -3px; letter-spacing: 0.02em; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font: 500 11px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); padding: 0 10px 8px; }
.nav a {
  display: flex; align-items: center; gap: 11px; min-height: 44px; padding: 0 12px; border-radius: 10px;
  color: var(--ink-2); text-decoration: none; font-weight: 500; cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(33, 27, 21, 0.06); }
.nav a[aria-current='page'] { background: var(--ink); color: var(--paper); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav .count { margin-left: auto; font: 600 12px/1 var(--mono); background: var(--amber-wash); color: var(--amber-ink); padding: 4px 7px; border-radius: 99px; }
.nav a[aria-current='page'] .count { background: var(--paper); }
.who { margin-top: auto; border-top: 1px solid var(--line-strong); padding: 16px 8px 0; display: flex; flex-direction: column; gap: 10px; }
.who .name { font-weight: 600; }
.who .meta { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.main { padding: 40px clamp(20px, 4vw, 56px) 80px; max-width: 1180px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 28px; }
.page-head p { color: var(--muted); margin-top: 8px; max-width: 62ch; }
.eyebrow { font: 500 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--brown); margin-bottom: 12px; display: block; }
.topbar { display: none; }

/* ---------------------------------------------------------------------------------------------- pieces */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.stat { padding: 18px 20px; }
.stat .k { font: 500 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat .v { font: 500 38px/1.1 var(--serif); margin-top: 12px; letter-spacing: -0.02em; }
.stat .n { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat.warn .v { color: var(--amber-ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border-radius: 99px; border: 1px solid var(--ink); background: var(--ink); color: var(--paper); font-weight: 600; cursor: pointer;
  transition: background 0.15s, transform 0.1s, border-color 0.15s;
}
.btn:hover { background: #3a3128; }
.btn:active { transform: translateY(1px); }
a.btn { text-decoration: none; }
.btn svg { width: 17px; height: 17px; }
.btn.teal { background: var(--teal); border-color: var(--teal); }
.btn.teal:hover { background: var(--teal-ink); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.danger { background: transparent; color: var(--red-ink); border-color: #e0b7b1; }
.btn.danger:hover { background: var(--red-wash); }
.btn.sm { min-height: 44px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.icon-btn { width: 44px; height: 44px; border-radius: 10px; border: 1px solid transparent; background: transparent; display: inline-grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: rgba(33, 27, 21, 0.07); }
.icon-btn svg { width: 19px; height: 19px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font: 600 12px/1.5 var(--sans); background: var(--paper-2); color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: 0.85; }
.pill.ok { background: var(--teal-wash); color: var(--teal-ink); }
.pill.warn { background: var(--amber-wash); color: var(--amber-ink); }
.pill.bad { background: var(--red-wash); color: var(--red-ink); }
.pill.plain::before { display: none; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 500 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 14px 22px; border-bottom: 1px solid var(--line); background: rgba(239, 233, 221, 0.4); }
td { padding: 15px 22px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; transition: background 0.12s; }
tbody tr.click:hover { background: rgba(239, 233, 221, 0.45); }
.tbl-wrap { overflow-x: auto; }
td .sub { display: block; color: var(--muted); font-size: 13px; }

.empty { text-align: center; padding: 56px 24px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: var(--line-strong); margin-bottom: 12px; }
.empty b { display: block; color: var(--ink); font: 500 19px/1.3 var(--serif); margin-bottom: 4px; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; background: var(--paper-2); border-radius: 99px; }
.tabs button { min-height: 40px; padding: 0 16px; border: 0; border-radius: 99px; background: transparent; cursor: pointer; font-weight: 600; color: var(--ink-2); }
.tabs button[aria-pressed='true'] { background: var(--ink); color: var(--paper); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label, .field .lab { font-weight: 600; font-size: 14px; }
.field .hint { color: var(--muted); font-size: 13px; }
.field .err { color: var(--red-ink); font-size: 13px; font-weight: 500; }
input[type='text'], input[type='email'], input[type='password'], input[type='number'], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: #fff; transition: border-color 0.15s, box-shadow 0.15s;
}
textarea { min-height: 96px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b9ae9a; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.2); }
input[aria-invalid='true'] { border-color: var(--red-ink); }
.money { position: relative; }
.money span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 30px; }

.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: var(--line-strong); border-radius: 99px; transition: background 0.18s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.18s; }
.switch input:checked + i { background: var(--teal); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch input:focus-visible + i { outline: 3px solid var(--teal); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + i { opacity: 0.55; }

.choice { display: grid; gap: 10px; }
.choice label { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); cursor: pointer; background: #fff; }
.choice label:has(input:checked) { border-color: var(--teal); background: var(--teal-wash); }
.choice input { margin-top: 4px; accent-color: var(--teal); width: 17px; height: 17px; }
.choice b { display: block; }
.choice span { color: var(--muted); font-size: 13.5px; }

/* licence matrix */
.mod { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 18px; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.mod:last-child { border-bottom: 0; }
.mod h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mod p { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.mod .terms { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.group-title { padding: 14px 22px 10px; font: 500 11.5px/1 var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--brown); background: rgba(239, 233, 221, 0.4); border-bottom: 1px solid var(--line); }

/* module cards: one look everywhere a module appears (onboarding, the plan editor, a tenant's licence) */
.module-icon { flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--paper-2); color: var(--brown); display: grid; place-items: center; transition: background 0.15s, color 0.15s; }
.module-icon svg { width: 19px; height: 19px; }
.module-icon-sm { width: 34px; height: 34px; }
.module-icon-sm svg { width: 17px; height: 17px; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; padding: 14px 22px 22px; }
.module-card {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; cursor: pointer; transition: border-color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.module-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); border-color: #b9ae9a; }
.module-card.on { border-color: var(--teal); background: var(--teal-wash); }
.module-card.on .module-icon { background: var(--teal); color: #fff; }
.module-card:has(input:disabled) { cursor: default; }
.module-card:has(input:disabled):hover { transform: none; box-shadow: none; }
.module-card:has(input:focus-visible) { outline: 3px solid var(--teal); outline-offset: 2px; }
.module-body { flex: 1; min-width: 0; }
.module-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-weight: 600; margin-bottom: 3px; }
.module-body p { color: var(--muted); font-size: 13px; margin: 0; }
.module-switch { margin-top: 2px; }

/* AI agent scope */
.ai-row { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.ai-row > b { font-size: 14px; }

/* approvals */
.ap { padding: 20px 22px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 14px 24px; align-items: start; }
.ap:last-child { border-bottom: 0; }
.ap .amt { font: 500 28px/1 var(--serif); }
.ap .meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--muted); font-size: 13.5px; margin-top: 8px; }
.ap .decided { margin-top: 10px; padding: 10px 14px; background: var(--paper-2); border-radius: var(--radius-sm); font-size: 14px; }

/* conversation */
.bubbles { display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 82%; padding: 11px 15px; border-radius: 16px; background: var(--paper-2); overflow-wrap: anywhere; }
.bubble.out { align-self: flex-end; background: var(--teal); color: #fff; border-bottom-right-radius: 5px; }
.bubble.in { border-bottom-left-radius: 5px; }
.bubble.note { align-self: center; max-width: 92%; background: var(--amber-wash); color: var(--amber-ink); font-size: 13.5px; border: 1px dashed #e2c48b; }
.bubble small { display: block; opacity: 0.75; font-size: 11.5px; margin-bottom: 2px; font-family: var(--mono); }

/* audit */
.ev { display: grid; grid-template-columns: 158px 1fr; gap: 6px 20px; padding: 15px 22px; border-bottom: 1px solid var(--line); }
.ev:last-child { border-bottom: 0; }
.ev time { font: 13px/1.5 var(--mono); color: var(--muted); }
.ev .act { font-weight: 600; }
.ev .act code { background: var(--paper-2); padding: 2px 7px; border-radius: 6px; font-size: 13px; }
.ev .why { color: var(--ink-2); font-size: 14px; margin-top: 3px; }
.ev details { margin-top: 6px; }
.ev summary { cursor: pointer; color: var(--teal-ink); font-size: 13px; font-weight: 500; }
.ev pre { margin: 8px 0 0; padding: 12px; background: var(--paper-2); border-radius: var(--radius-sm); overflow-x: auto; font: 12.5px/1.5 var(--mono); }
.hash { font: 12px var(--mono); color: var(--muted); }

/* dialog, toast */
dialog { border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 32px)); background: var(--card); color: var(--ink); box-shadow: 0 30px 80px -20px rgba(33, 27, 21, 0.5); }
dialog::backdrop { background: rgba(33, 27, 21, 0.5); backdrop-filter: blur(3px); }
dialog.wide { width: min(680px, calc(100vw - 32px)); }
.dlg-head { padding: 24px 26px 4px; }
.dlg-head p { color: var(--muted); margin-top: 6px; font-size: 14px; }
.dlg-body { padding: 18px 26px 6px; }
.dlg-foot { padding: 14px 26px 24px; display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.secret { display: flex; gap: 8px; align-items: center; background: var(--ink); color: #f7f4ee; padding: 12px 14px; border-radius: var(--radius-sm); }
.secret code { flex: 1; overflow-wrap: anywhere; font-size: 13px; }
.secret button { background: #f7f4ee; color: var(--ink); border: 0; border-radius: 8px; min-height: 40px; padding: 0 12px; font-weight: 600; cursor: pointer; }
.callout { padding: 12px 15px; border-radius: var(--radius-sm); background: var(--amber-wash); color: var(--amber-ink); font-size: 14px; }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 50; }
.toast { background: var(--ink); color: var(--paper); padding: 13px 18px; border-radius: 12px; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5); max-width: 360px; animation: rise 0.2s ease-out; }
.toast.bad { background: var(--red-ink); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(900px 500px at 85% -10%, rgba(15, 118, 110, 0.10), transparent 60%),
  radial-gradient(700px 500px at -5% 105%, rgba(107, 59, 46, 0.10), transparent 60%), var(--paper); }
.login .card { width: min(440px, 100%); padding: 38px 34px 32px; }
.login .brand { padding: 0; margin-bottom: 26px; }
.login h1 { font-size: 30px; margin-bottom: 8px; }
.login .lede { color: var(--muted); margin-bottom: 24px; }
.reveal { position: relative; }
.reveal .icon-btn { position: absolute; right: 1px; bottom: 1px; height: 44px; }
.reveal input { padding-right: 52px; }
.skeleton { height: 18px; border-radius: 6px; background: linear-gradient(90deg, var(--paper-2), #f6f1e6, var(--paper-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* dashboard app panel: a narrow Chatwoot sidebar iframe, not the two-column console shell */
.panel { padding: 18px; max-width: 640px; margin: 0 auto; }
.panel .login { min-height: 0; padding: 0; background: none; display: block; }
.panel .login .card { width: 100%; padding: 26px 22px 22px; }
.panel .identity { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.panel .identity .who b { display: block; }
.panel .identity .who span { color: var(--muted); font-size: 13px; }
.panel .callout.chatwoot { margin-bottom: 16px; }
.panel h1 { font-size: 22px; margin-bottom: 4px; }

/* ---------------------------------------------------------------------------------------------- responsive */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 30; transform: translateX(-102%); transition: transform 0.22s ease; }
  .side.open { transform: none; box-shadow: 20px 0 50px -20px rgba(0, 0, 0, 0.4); }
  .topbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--paper-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .topbar .brand b { font-size: 19px; }
  .scrim { position: fixed; inset: 0; background: rgba(33, 27, 21, 0.45); z-index: 25; }
  .main { padding: 26px 16px 64px; }
  h1 { font-size: 27px; }
  .ev { grid-template-columns: 1fr; }
  .ap { grid-template-columns: 1fr; }
  .mod { grid-template-columns: 1fr; }
  th, td { padding-left: 14px; padding-right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
