:root {
  --bg: #f5f5f7;
  --surface: rgba(255,255,255,.86);
  --surface-solid: #ffffff;
  --surface-2: #fbfbfd;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --muted-2: #86868b;
  --line: rgba(0,0,0,.08);
  --line-strong: rgba(0,0,0,.14);
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --green: #248a3d;
  --green-bg: #e9f7ed;
  --amber: #9a6700;
  --amber-bg: #fff7dd;
  --red: #d70015;
  --red-bg: #fff0f1;
  --purple: #6e5ad7;
  --teal: #078e9a;
  --shadow: 0 14px 38px rgba(0,0,0,.07), 0 2px 8px rgba(0,0,0,.03);
  --shadow-soft: 0 8px 22px rgba(0,0,0,.045);
  --radius: 22px;
  --radius-sm: 14px;
  --sidebar: 260px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
}

html[data-theme="dark"] {
  --bg: #000000;
  --surface: rgba(29,29,31,.88);
  --surface-solid: #1d1d1f;
  --surface-2: #161617;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --muted-2: #86868b;
  --line: rgba(255,255,255,.09);
  --line-strong: rgba(255,255,255,.16);
  --green-bg: rgba(48,209,88,.12);
  --amber-bg: rgba(255,214,10,.12);
  --red-bg: rgba(255,69,58,.12);
  --shadow: 0 14px 38px rgba(0,0,0,.36), 0 2px 8px rgba(0,0,0,.2);
  --shadow-soft: 0 8px 22px rgba(0,0,0,.24);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }

/* Login */
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr);
  background:
    radial-gradient(circle at 18% 12%, rgba(0,113,227,.13), transparent 34%),
    radial-gradient(circle at 80% 84%, rgba(110,90,215,.12), transparent 30%),
    var(--bg);
}
.login-visual { padding: 68px; display:flex; flex-direction:column; justify-content:space-between; min-height:100vh; }
.brand-lockup { display:flex; align-items:center; gap:12px; font-weight:700; letter-spacing:-.02em; }
.brand-mark { width:38px; height:38px; border-radius:12px; background: linear-gradient(145deg,#111,#3a3a3c); color:white; display:grid; place-items:center; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.brand-mark svg { width:22px; height:22px; }
.brand-lockup .word { font-size:20px; }
.login-copy { max-width:760px; margin: 80px 0; }
.login-copy .eyebrow { color:var(--blue); font-weight:650; font-size:15px; margin-bottom:16px; }
.login-copy h1 { margin:0; font-size: clamp(48px, 6vw, 88px); line-height:.96; letter-spacing:-.055em; font-weight:720; }
.login-copy p { font-size:21px; line-height:1.45; color:var(--muted); max-width:620px; margin:28px 0 0; letter-spacing:-.015em; }
.login-foot { color:var(--muted-2); font-size:13px; }
.login-panel { display:flex; align-items:center; justify-content:center; padding:44px; }
.login-card { width:min(430px,100%); background:var(--surface); backdrop-filter:blur(30px); -webkit-backdrop-filter:blur(30px); border:1px solid var(--line); border-radius:32px; padding:36px; box-shadow:var(--shadow); }
.login-card h2 { font-size:30px; letter-spacing:-.035em; margin:0 0 8px; }
.login-card .sub { margin:0 0 28px; color:var(--muted); line-height:1.5; }

/* App shell */
.app-shell { min-height:100vh; }
.sidebar {
  position:fixed; inset:0 auto 0 0; width:var(--sidebar); padding:22px 14px 18px;
  background:color-mix(in srgb, var(--surface-solid) 88%, transparent);
  border-right:1px solid var(--line); backdrop-filter:blur(28px); -webkit-backdrop-filter:blur(28px); z-index:50;
  display:flex; flex-direction:column;
}
.sidebar-brand { padding:4px 10px 24px; display:flex; align-items:center; gap:10px; }
.sidebar-brand .brand-mark { width:34px; height:34px; border-radius:10px; }
.sidebar-brand strong { font-size:17px; letter-spacing:-.02em; }
.sidebar-brand small { display:block; color:var(--muted); font-size:10px; letter-spacing:.04em; margin-top:1px; text-transform:uppercase; }
.nav-section-label { font-size:11px; font-weight:600; color:var(--muted-2); padding:16px 12px 7px; text-transform:uppercase; letter-spacing:.08em; }
.nav-item { width:100%; border:0; background:transparent; color:var(--muted); padding:10px 12px; display:flex; align-items:center; gap:11px; border-radius:11px; cursor:pointer; text-align:left; font-size:14px; font-weight:520; transition:.18s ease; }
.nav-item:hover { background:var(--surface-2); color:var(--text); }
.nav-item.active { background:color-mix(in srgb, var(--blue) 11%, transparent); color:var(--blue); font-weight:650; }
.nav-icon { width:19px; height:19px; display:grid; place-items:center; }
.nav-icon svg { width:18px; height:18px; }
.sidebar-spacer { flex:1; }
.user-chip { margin:10px 4px 2px; border-top:1px solid var(--line); padding:15px 8px 4px; }
.user-main { display:flex; align-items:center; gap:10px; }
.avatar { width:34px; height:34px; border-radius:50%; display:grid; place-items:center; background:linear-gradient(145deg,#d9eaff,#b7d9ff); color:#005cb8; font-weight:720; font-size:13px; }
html[data-theme="dark"] .avatar { background:#2b4661; color:#8bc3ff; }
.user-name { font-size:13px; font-weight:650; }
.user-role { font-size:11px; color:var(--muted); margin-top:2px; }
.user-actions { display:flex; gap:5px; margin-top:10px; }
.icon-btn { border:1px solid var(--line); background:var(--surface-2); color:var(--muted); border-radius:10px; width:34px; height:32px; display:grid; place-items:center; cursor:pointer; }
.icon-btn:hover { color:var(--text); border-color:var(--line-strong); }
.icon-btn svg { width:16px; height:16px; }

.main { margin-left:var(--sidebar); min-height:100vh; }
.topbar { position:sticky; top:0; z-index:40; height:72px; display:flex; align-items:center; justify-content:space-between; gap:18px; padding:0 34px; background:color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter:blur(24px); -webkit-backdrop-filter:blur(24px); border-bottom:1px solid var(--line); }
.top-title { font-size:18px; font-weight:680; letter-spacing:-.025em; }
.top-actions { display:flex; align-items:center; gap:10px; }
.global-search { position:relative; width:min(360px,35vw); }
.global-search input { width:100%; padding:10px 14px 10px 37px; border-radius:12px; border:1px solid var(--line); background:var(--surface); color:var(--text); outline:none; transition:.18s; }
.global-search input:focus { border-color:rgba(0,113,227,.45); box-shadow:0 0 0 4px rgba(0,113,227,.08); }
.global-search svg { position:absolute; left:12px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--muted-2); }
.content { padding:34px; max-width:1680px; margin:0 auto; }

/* Type */
.page-kicker { color:var(--blue); font-size:13px; font-weight:650; margin-bottom:8px; }
.page-head { display:flex; justify-content:space-between; align-items:flex-end; gap:20px; margin-bottom:28px; }
.page-head h1 { margin:0; font-size:36px; line-height:1.05; letter-spacing:-.045em; font-weight:720; }
.page-head p { margin:10px 0 0; color:var(--muted); font-size:15px; }
.section-title { font-size:20px; font-weight:690; letter-spacing:-.025em; margin:0; }
.section-sub { color:var(--muted); font-size:13px; margin-top:5px; }
.muted { color:var(--muted); }
.tiny { font-size:11px; }
.mono { font-variant-numeric:tabular-nums; font-feature-settings:"tnum"; }

/* Cards and layout */
.grid { display:grid; gap:18px; }
.kpi-grid { grid-template-columns: repeat(4,minmax(0,1fr)); margin-bottom:22px; }
.kpi-card { background:var(--surface-solid); border:1px solid var(--line); border-radius:var(--radius); padding:22px; box-shadow:var(--shadow-soft); min-height:138px; position:relative; overflow:hidden; }
.kpi-card::after { content:""; position:absolute; width:92px; height:92px; right:-28px; top:-28px; border-radius:50%; background:var(--accent,rgba(0,113,227,.08)); }
.kpi-label { font-size:12px; color:var(--muted); font-weight:600; letter-spacing:.005em; }
.kpi-value { font-size:31px; font-weight:720; letter-spacing:-.045em; margin-top:18px; line-height:1; }
.kpi-meta { font-size:12px; color:var(--muted); margin-top:10px; }
.two-col { grid-template-columns:minmax(0,1.55fr) minmax(320px,.75fr); align-items:start; }
.card { background:var(--surface-solid); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow-soft); overflow:hidden; }
.card-pad { padding:22px; }
.card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:21px 22px 15px; border-bottom:1px solid var(--line); }
.card-head.no-line { border-bottom:0; padding-bottom:6px; }
.empty { padding:42px 24px; text-align:center; color:var(--muted); }
.empty-icon { width:48px; height:48px; border-radius:16px; background:var(--surface-2); display:grid; place-items:center; margin:0 auto 13px; color:var(--muted-2); }

/* Buttons */
.btn { appearance:none; border:1px solid transparent; border-radius:12px; padding:9px 14px; font-size:13px; font-weight:630; cursor:pointer; display:inline-flex; align-items:center; justify-content:center; gap:7px; transition:transform .13s ease, background .15s ease, border-color .15s ease, color .15s ease; white-space:nowrap; }
.btn:active { transform:scale(.98); }
.btn-primary { background:var(--blue); color:white; }
.btn-primary:hover { background:var(--blue-hover); }
.btn-secondary { background:var(--surface-solid); color:var(--text); border-color:var(--line-strong); }
.btn-secondary:hover { background:var(--surface-2); }
.btn-quiet { background:var(--surface-2); color:var(--text); border-color:var(--line); }
.btn-danger { background:var(--red-bg); color:var(--red); border-color:color-mix(in srgb,var(--red) 18%,transparent); }
.btn-sm { padding:7px 10px; border-radius:10px; font-size:12px; }
.btn svg { width:15px; height:15px; }

/* Forms */
.field { display:flex; flex-direction:column; gap:7px; }
.field label { color:var(--muted); font-size:12px; font-weight:610; }
.field input, .field select, .field textarea { width:100%; border:1px solid var(--line-strong); background:var(--surface-solid); color:var(--text); border-radius:12px; padding:10px 12px; outline:none; transition:.16s; }
.field textarea { min-height:92px; resize:vertical; line-height:1.45; }
.field input:focus, .field select:focus, .field textarea:focus { border-color:rgba(0,113,227,.48); box-shadow:0 0 0 4px rgba(0,113,227,.08); }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.form-grid .span-2 { grid-column:span 2; }
.form-section { margin-top:23px; padding-top:21px; border-top:1px solid var(--line); }
.form-section h4 { margin:0 0 13px; font-size:14px; }
.checkbox-row { display:flex; align-items:center; gap:9px; font-size:13px; color:var(--muted); }
.checkbox-row input { width:16px; height:16px; }
.form-hint { color:var(--muted-2); font-size:11px; line-height:1.4; }

/* Badges */
.badge { display:inline-flex; align-items:center; gap:5px; padding:5px 9px; border-radius:999px; font-size:11px; font-weight:650; line-height:1; border:1px solid transparent; }
.badge-dot::before { content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge-blue { color:#0066cc; background:#edf6ff; border-color:#d9ebff; }
.badge-green { color:var(--green); background:var(--green-bg); border-color:color-mix(in srgb,var(--green) 14%,transparent); }
.badge-amber { color:var(--amber); background:var(--amber-bg); border-color:color-mix(in srgb,var(--amber) 14%,transparent); }
.badge-red { color:var(--red); background:var(--red-bg); border-color:color-mix(in srgb,var(--red) 14%,transparent); }
.badge-grey { color:var(--muted); background:var(--surface-2); border-color:var(--line); }
.badge-purple { color:var(--purple); background:color-mix(in srgb,var(--purple) 10%,transparent); border-color:color-mix(in srgb,var(--purple) 14%,transparent); }
.badge-teal { color:var(--teal); background:color-mix(in srgb,var(--teal) 10%,transparent); border-color:color-mix(in srgb,var(--teal) 14%,transparent); }
.brand-aakuna { color:#005ec4; background:#eaf4ff; }
.brand-trublu { color:#007b83; background:#e9fbfc; }
.brand-reservedd { color:#6e5ad7; background:#f1efff; }
html[data-theme="dark"] .badge-blue, html[data-theme="dark"] .brand-aakuna { background:rgba(10,132,255,.13); color:#64aaff; border-color:rgba(10,132,255,.18); }
html[data-theme="dark"] .brand-trublu { background:rgba(48,209,188,.12); color:#64d8c8; }
html[data-theme="dark"] .brand-reservedd { background:rgba(191,90,242,.12); color:#d3a4f0; }

/* Tables */
.table-wrap { overflow:auto; }
table { width:100%; border-collapse:collapse; font-size:13px; }
th { color:var(--muted); font-size:11px; font-weight:650; text-transform:uppercase; letter-spacing:.055em; padding:12px 16px; text-align:left; white-space:nowrap; border-bottom:1px solid var(--line); background:var(--surface-2); }
td { padding:14px 16px; border-bottom:1px solid var(--line); vertical-align:middle; }
tbody tr:last-child td { border-bottom:0; }
tbody tr.clickable { cursor:pointer; transition:background .12s; }
tbody tr.clickable:hover { background:var(--surface-2); }
.customer-cell strong { display:block; font-size:13.5px; letter-spacing:-.01em; }
.customer-cell small { display:block; color:var(--muted); margin-top:3px; }
.money { font-weight:650; font-variant-numeric:tabular-nums; }

/* Filters */
.filterbar { background:var(--surface-solid); border:1px solid var(--line); border-radius:18px; padding:12px; display:flex; align-items:center; justify-content:space-between; gap:12px; margin-bottom:16px; box-shadow:var(--shadow-soft); }
.segmented { display:flex; gap:4px; padding:3px; border-radius:12px; background:var(--surface-2); }
.segmented button { border:0; background:transparent; color:var(--muted); border-radius:9px; padding:7px 10px; font-size:12px; cursor:pointer; }
.segmented button.active { background:var(--surface-solid); color:var(--text); box-shadow:0 1px 4px rgba(0,0,0,.08); font-weight:620; }
.filter-search { min-width:260px; flex:0 1 360px; }
.filter-search input { width:100%; border:1px solid var(--line); background:var(--surface-2); padding:9px 12px; border-radius:11px; color:var(--text); outline:none; }

/* Detail page */
.back-link { border:0; background:transparent; color:var(--blue); padding:0; font-weight:600; cursor:pointer; display:inline-flex; align-items:center; gap:5px; margin-bottom:15px; }
.customer-hero { display:flex; justify-content:space-between; align-items:flex-start; gap:24px; margin-bottom:22px; }
.customer-title-row { display:flex; align-items:center; gap:11px; flex-wrap:wrap; }
.customer-hero h1 { margin:0; font-size:34px; letter-spacing:-.045em; line-height:1.08; }
.customer-meta { margin-top:10px; display:flex; flex-wrap:wrap; gap:9px 18px; color:var(--muted); font-size:13px; }
.hero-actions { display:flex; gap:8px; flex-wrap:wrap; justify-content:flex-end; }
.summary-strip { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); background:var(--surface-solid); border:1px solid var(--line); border-radius:22px; overflow:hidden; margin-bottom:22px; box-shadow:var(--shadow-soft); }
.summary-item { padding:18px 20px; border-right:1px solid var(--line); }
.summary-item:last-child { border-right:0; }
.summary-label { font-size:11px; color:var(--muted); margin-bottom:7px; }
.summary-value { font-size:19px; font-weight:700; letter-spacing:-.025em; }
.tabs { display:flex; gap:4px; border-bottom:1px solid var(--line); margin-bottom:18px; overflow:auto; }
.tab { border:0; background:transparent; color:var(--muted); padding:11px 13px; cursor:pointer; font-size:13px; font-weight:570; border-bottom:2px solid transparent; white-space:nowrap; }
.tab.active { color:var(--text); border-bottom-color:var(--text); font-weight:650; }
.detail-grid { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(300px,.65fr); gap:18px; align-items:start; }
.info-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 28px; }
.info-row { padding:12px 0; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; gap:16px; font-size:13px; }
.info-row .label { color:var(--muted); }
.info-row .value { text-align:right; font-weight:560; }
.agreement-card { border:1px solid var(--line); border-radius:18px; margin-bottom:14px; overflow:hidden; background:var(--surface-solid); }
.agreement-top { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:17px; border-bottom:1px solid var(--line); }
.agreement-title { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.agreement-title strong { font-size:14px; }
.agreement-actions { display:flex; gap:6px; flex-wrap:wrap; }
.agreement-metrics { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); }
.agreement-metric { padding:15px 16px; border-right:1px solid var(--line); }
.agreement-metric:last-child { border-right:0; }
.agreement-metric label { display:block; color:var(--muted); font-size:10.5px; margin-bottom:6px; }
.agreement-metric div { font-size:14px; font-weight:670; }
.progress { height:7px; border-radius:20px; background:var(--surface-2); overflow:hidden; border:1px solid var(--line); }
.progress > span { display:block; height:100%; background:var(--blue); border-radius:20px; }
.service-list { padding:4px 17px 15px; }
.service-row { display:grid; grid-template-columns:minmax(0,1fr) 130px 130px auto; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); font-size:12.5px; }
.service-row:last-child { border-bottom:0; }
.service-name { font-weight:620; }
.service-name small { display:block; color:var(--muted); font-weight:400; margin-top:3px; }

.timeline { position:relative; }
.timeline-item { display:grid; grid-template-columns:16px minmax(0,1fr); gap:11px; padding:0 0 18px; }
.timeline-dot { width:9px; height:9px; border-radius:50%; background:var(--blue); margin-top:5px; position:relative; }
.timeline-dot::after { content:""; position:absolute; width:1px; background:var(--line-strong); top:12px; bottom:-24px; left:4px; }
.timeline-item:last-child .timeline-dot::after { display:none; }
.timeline-body { font-size:12.5px; line-height:1.5; }
.timeline-body strong { font-weight:650; }
.timeline-meta { color:var(--muted); font-size:11px; margin-top:4px; }
.note-card { padding:14px 0; border-bottom:1px solid var(--line); }
.note-card:last-child { border-bottom:0; }
.note-top { display:flex; justify-content:space-between; gap:10px; margin-bottom:7px; }
.note-body { font-size:13px; line-height:1.55; white-space:pre-wrap; }
.doc-row { display:flex; align-items:center; justify-content:space-between; gap:15px; padding:13px 0; border-bottom:1px solid var(--line); }
.doc-row:last-child { border-bottom:0; }
.doc-main { display:flex; gap:11px; min-width:0; align-items:center; }
.doc-icon { width:38px; height:38px; border-radius:11px; background:var(--surface-2); display:grid; place-items:center; color:var(--blue); flex:0 0 auto; }
.doc-name { font-size:13px; font-weight:610; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; max-width:380px; }
.doc-meta { color:var(--muted); font-size:11px; margin-top:3px; }

/* Modal */
.modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.35); backdrop-filter:blur(8px); -webkit-backdrop-filter:blur(8px); z-index:100; display:flex; align-items:center; justify-content:center; padding:24px; animation:fadeIn .14s ease; }
.modal { width:min(680px,100%); max-height:min(88vh,900px); background:var(--surface-solid); border:1px solid var(--line); border-radius:24px; box-shadow:0 30px 80px rgba(0,0,0,.2); overflow:hidden; display:flex; flex-direction:column; animation:popIn .16s ease; }
.modal.wide { width:min(940px,100%); }
.modal-header { display:flex; align-items:center; justify-content:space-between; gap:20px; padding:20px 22px 16px; border-bottom:1px solid var(--line); }
.modal-header h3 { margin:0; font-size:20px; letter-spacing:-.025em; }
.modal-close { border:0; background:var(--surface-2); color:var(--muted); width:32px; height:32px; border-radius:50%; cursor:pointer; font-size:20px; line-height:1; }
.modal-body { padding:20px 22px; overflow:auto; }
.modal-footer { padding:14px 22px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:8px; background:var(--surface-2); }
.wizard-steps { display:flex; gap:8px; margin-bottom:18px; }
.wizard-step { flex:1; height:4px; background:var(--line); border-radius:20px; }
.wizard-step.active { background:var(--blue); }
.service-builder-row { display:grid; grid-template-columns:minmax(180px,1.4fr) 150px 135px 115px 38px; gap:8px; align-items:end; padding:12px; background:var(--surface-2); border:1px solid var(--line); border-radius:15px; margin-bottom:9px; }
.service-builder-row .field label { font-size:10.5px; }
.mini-remove { width:36px; height:38px; border:1px solid var(--line); border-radius:10px; background:var(--surface-solid); color:var(--red); cursor:pointer; }
.installment-builder { margin-top:8px; padding-top:8px; border-top:1px dashed var(--line-strong); }
.installment-row { display:grid; grid-template-columns:1fr 130px 140px 36px; gap:7px; margin-top:7px; }

/* Toast */
.toast-wrap { position:fixed; right:22px; bottom:22px; z-index:200; display:flex; flex-direction:column; gap:8px; }
.toast { min-width:280px; max-width:430px; background:var(--text); color:var(--bg); padding:12px 15px; border-radius:13px; box-shadow:var(--shadow); font-size:13px; animation:toastIn .18s ease; }
.toast.error { background:#b42318; color:#fff; }

/* Utility / reports */
.brand-bars { padding:8px 0 0; }
.brand-bar { margin:15px 0; }
.brand-bar-top { display:flex; justify-content:space-between; gap:10px; font-size:12px; margin-bottom:7px; }
.brand-bar-track { height:7px; background:var(--surface-2); border:1px solid var(--line); border-radius:99px; overflow:hidden; }
.brand-bar-track span { display:block; height:100%; border-radius:99px; }
.renewal-list { padding:3px 0; }
.renewal-row { display:grid; grid-template-columns:minmax(0,1fr) 100px 115px; align-items:center; gap:12px; padding:13px 0; border-bottom:1px solid var(--line); cursor:pointer; }
.renewal-row:last-child { border-bottom:0; }
.renewal-row:hover .renewal-name { color:var(--blue); }
.renewal-name { font-size:13px; font-weight:620; transition:.12s; }
.renewal-sub { font-size:11px; color:var(--muted); margin-top:3px; }
.staff-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; }
.staff-card { background:var(--surface-solid); border:1px solid var(--line); border-radius:18px; padding:18px; box-shadow:var(--shadow-soft); }
.staff-card .avatar { width:42px; height:42px; margin-bottom:13px; }
.staff-card h4 { margin:0; font-size:15px; }
.staff-card p { margin:5px 0 0; color:var(--muted); font-size:12px; }
.service-master-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:13px; }
.service-master-card { background:var(--surface-solid); border:1px solid var(--line); border-radius:17px; padding:17px; box-shadow:var(--shadow-soft); }
.service-master-card .code { color:var(--muted); font-size:10px; font-weight:650; letter-spacing:.06em; text-transform:uppercase; }
.service-master-card h4 { margin:8px 0 6px; font-size:14px; }
.service-master-card p { margin:0; color:var(--muted); font-size:11.5px; line-height:1.45; display:-webkit-box; -webkit-line-clamp:3; -webkit-box-orient:vertical; overflow:hidden; }

@keyframes fadeIn { from {opacity:0} to {opacity:1} }
@keyframes popIn { from {opacity:0; transform:translateY(8px) scale(.985)} to {opacity:1; transform:none} }
@keyframes toastIn { from {opacity:0; transform:translateY(8px)} to {opacity:1; transform:none} }

@media (max-width: 1220px) {
  :root { --sidebar: 220px; }
  .kpi-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .summary-strip { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .summary-item:nth-child(3) { border-right:0; }
  .summary-item:nth-child(n+4) { border-top:1px solid var(--line); }
  .staff-grid, .service-master-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .login-shell { grid-template-columns:1fr; }
  .login-visual { display:none; }
  .login-panel { min-height:100vh; }
  .sidebar { width:74px; padding:18px 9px; }
  .sidebar-brand strong, .sidebar-brand small, .nav-item span:not(.nav-icon), .nav-section-label, .user-main > div:not(.avatar), .user-actions { display:none; }
  .sidebar-brand { justify-content:center; padding:4px 0 20px; }
  .nav-item { justify-content:center; padding:11px; }
  .user-main { justify-content:center; }
  .main { margin-left:74px; }
  .topbar { padding:0 20px; }
  .content { padding:24px 20px; }
  .two-col, .detail-grid { grid-template-columns:1fr; }
  .agreement-metrics { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .agreement-metric:nth-child(3) { border-right:0; }
  .agreement-metric:nth-child(n+4) { border-top:1px solid var(--line); }
}
@media (max-width: 680px) {
  .main { margin-left:0; padding-bottom:74px; }
  .sidebar { position:fixed; inset:auto 0 0 0; width:auto; height:66px; flex-direction:row; align-items:center; justify-content:space-around; padding:7px 10px; border-right:0; border-top:1px solid var(--line); }
  .sidebar-brand, .nav-section-label, .sidebar-spacer, .user-chip, .nav-item.admin-only { display:none !important; }
  .sidebar nav { display:flex; width:100%; justify-content:space-around; }
  .nav-item { width:auto; min-width:48px; }
  .topbar { height:62px; padding:0 14px; }
  .global-search { display:none; }
  .content { padding:20px 14px; }
  .page-head { align-items:flex-start; flex-direction:column; }
  .page-head h1 { font-size:30px; }
  .kpi-grid { grid-template-columns:1fr 1fr; gap:10px; }
  .kpi-card { padding:16px; min-height:118px; border-radius:18px; }
  .kpi-value { font-size:23px; }
  .filterbar { align-items:stretch; flex-direction:column; }
  .filter-search { min-width:0; width:100%; }
  .customer-hero { flex-direction:column; }
  .hero-actions { justify-content:flex-start; }
  .summary-strip { grid-template-columns:1fr 1fr; }
  .summary-item { border-top:1px solid var(--line); }
  .summary-item:nth-child(-n+2) { border-top:0; }
  .summary-item:nth-child(2n) { border-right:0; }
  .info-grid, .form-grid { grid-template-columns:1fr; }
  .form-grid .span-2 { grid-column:span 1; }
  .agreement-metrics { grid-template-columns:1fr 1fr; }
  .agreement-metric:nth-child(n) { border-top:1px solid var(--line); border-right:1px solid var(--line); }
  .agreement-metric:nth-child(-n+2) { border-top:0; }
  .agreement-metric:nth-child(2n) { border-right:0; }
  .service-row { grid-template-columns:1fr; }
  .service-builder-row { grid-template-columns:1fr 1fr; }
  .service-builder-row > :first-child { grid-column:span 2; }
  .staff-grid,.service-master-grid { grid-template-columns:1fr; }
  .modal-backdrop { padding:10px; align-items:flex-end; }
  .modal { border-radius:24px 24px 12px 12px; max-height:94vh; }
}

/* V2 · TruBlu catalogue and Procuret finance */
.master-section { margin-bottom:22px; }
.trublu-master-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:14px; padding:0 22px 22px; }
.trublu-master-card { background:linear-gradient(180deg,var(--surface-solid),var(--surface-2)); border:1px solid var(--line); border-radius:20px; padding:20px; box-shadow:var(--shadow-soft); }
.plan-cap { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.plan-cap > span { color:var(--blue); font-size:10.5px; font-weight:700; letter-spacing:.08em; }
.trublu-master-card h3 { margin:13px 0 17px; font-size:23px; letter-spacing:-.035em; }
.plan-prices { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.plan-prices > div { background:var(--surface-solid); border:1px solid var(--line); border-radius:14px; padding:12px; }
.plan-prices span,.plan-prices small { display:block; color:var(--muted); font-size:10.5px; }
.plan-prices strong { display:block; margin:5px 0 4px; font-size:19px; letter-spacing:-.03em; }
.feature-list { list-style:none; padding:0; margin:16px 0 0; display:grid; gap:8px; color:var(--muted); font-size:11.5px; }
.feature-list li::before { content:'✓'; color:var(--green); font-weight:800; margin-right:8px; }
.addon-master-list { padding:0 22px 22px; }
.addon-master-row { display:grid; grid-template-columns:minmax(0,1fr) 145px 145px auto; gap:18px; align-items:center; padding:15px 0; border-top:1px solid var(--line); }
.addon-master-row:first-child { border-top:0; }
.addon-master-row small,.addon-master-row span { display:block; color:var(--muted); font-size:10.5px; margin-top:3px; }
.addon-master-row strong { font-size:13px; }
.page-subhead { display:flex; justify-content:space-between; align-items:end; gap:20px; margin:30px 0 14px; }
.page-subhead h2 { margin:0; font-size:22px; letter-spacing:-.03em; }
.page-subhead p { margin:5px 0 0; color:var(--muted); font-size:12px; }

.procuret-shell { display:grid; grid-template-columns:minmax(360px,.85fr) minmax(420px,1.15fr); gap:18px; align-items:stretch; }
.procuret-input-card,.procuret-result-card { border-radius:26px; overflow:hidden; }
.procuret-input-card { background:var(--surface-solid); border:1px solid var(--line); box-shadow:var(--shadow-soft); padding:26px; }
.procuret-result-card { background:#30302f; color:white; padding:30px; box-shadow:var(--shadow); }
html[data-theme="dark"] .procuret-result-card { background:#242423; }
.procuret-result-card .muted { color:#c9c3bd; }
.procuret-hero { padding:25px 0 27px; border-bottom:1px solid rgba(255,255,255,.14); }
.procuret-hero label { display:block; font-size:12px; color:#d9d2cb; margin-bottom:8px; }
.procuret-hero strong { font-size:50px; font-weight:560; letter-spacing:-.055em; }
.procuret-hero small { color:#ffb178; margin-left:8px; }
.procuret-metrics { margin-top:10px; }
.procuret-metrics > div { display:flex; justify-content:space-between; align-items:baseline; gap:18px; padding:13px 0; border-bottom:1px solid rgba(255,255,255,.08); font-size:12px; color:#d9d2cb; }
.procuret-metrics strong { color:white; font-size:17px; }
.quote-box { margin-top:18px; padding:16px; border-radius:14px; background:var(--surface-2); border:1px solid var(--line); font-size:12px; line-height:1.6; color:var(--muted); }
.finance-live-card { display:grid; grid-template-columns:repeat(3,1fr); gap:8px; background:var(--surface-2); border:1px solid var(--line); border-radius:15px; padding:12px; }
.finance-live-card > div { padding:6px 9px; }
.finance-live-card span { display:block; color:var(--muted); font-size:10.5px; margin-bottom:4px; }
.finance-live-card strong { font-size:14px; }
.finance-profile-card { margin:0 17px 16px; border:1px solid var(--line); border-radius:15px; padding:15px; background:color-mix(in srgb,var(--blue) 4%,var(--surface-solid)); }
.finance-profile-top { display:flex; justify-content:space-between; gap:12px; align-items:center; margin-bottom:11px; }

.trublu-builder { border:1px solid var(--line); background:var(--surface-2); border-radius:20px; padding:17px; }
.trublu-builder-head { display:flex; justify-content:space-between; gap:16px; align-items:flex-start; margin-bottom:14px; }
.trublu-plan-picker { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:9px; }
.trublu-pick { text-align:left; border:1px solid var(--line); background:var(--surface-solid); color:var(--text); border-radius:16px; padding:14px; cursor:pointer; transition:.15s ease; }
.trublu-pick:hover { border-color:rgba(0,113,227,.35); transform:translateY(-1px); }
.trublu-pick.selected { border-color:var(--blue); box-shadow:0 0 0 3px rgba(0,113,227,.09); }
.trublu-pick > span { display:block; color:var(--blue); font-size:9.5px; font-weight:750; letter-spacing:.07em; }
.trublu-pick > strong { display:block; font-size:15px; margin:6px 0 10px; }
.trublu-pick > div { font-size:20px; font-weight:700; letter-spacing:-.03em; }
.trublu-pick small { font-size:10px; color:var(--muted); font-weight:500; }
.trublu-pick p { margin:9px 0 0; color:var(--muted); font-size:10.5px; line-height:1.4; }
.plan-config-card { margin-top:12px; background:var(--surface-solid); border:1px solid var(--line); border-radius:17px; padding:15px; }
.addon-heading { margin:17px 0 8px; font-size:11px; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.06em; }
.plan-addon-list { display:grid; gap:7px; }
.plan-addon { display:grid; grid-template-columns:22px minmax(0,1fr) 145px; gap:9px; align-items:center; border:1px solid var(--line); border-radius:13px; padding:10px; }
.plan-addon.included { background:var(--green-bg); }
.plan-addon strong { font-size:12px; }
.plan-addon small { display:block; color:var(--muted); font-size:10px; margin-top:2px; }
.addon-price input { width:100%; }
.plan-empty { padding:20px; color:var(--muted); text-align:center; font-size:12px; }
.service-addons { display:flex; gap:5px; flex-wrap:wrap; margin-top:5px; }
.service-addons span { display:inline-block; background:var(--surface-2); border:1px solid var(--line); border-radius:999px; padding:3px 7px; font-size:9.5px; color:var(--muted); }

@media (max-width: 1100px) {
  .trublu-master-grid { grid-template-columns:1fr; }
  .procuret-shell { grid-template-columns:1fr; }
}
@media (max-width: 720px) {
  .trublu-plan-picker,.finance-live-card { grid-template-columns:1fr; }
  .addon-master-row { grid-template-columns:1fr 1fr; }
  .addon-master-row > :first-child,.addon-master-row > :last-child { grid-column:1/-1; }
  .plan-addon { grid-template-columns:22px 1fr; }
  .plan-addon .addon-price { grid-column:2; }
  .procuret-hero strong { font-size:40px; }
}

/* V3 · AAKUNA product system */
:root {
  --blue:#eb600b;
  --blue-hover:#d94d17;
  --aakuna-orange:#eb600b;
  --aakuna-charcoal:#333333;
}
.login-shell {
  background:radial-gradient(circle at 16% 10%,rgba(234,90,34,.12),transparent 34%),radial-gradient(circle at 78% 86%,rgba(52,52,54,.08),transparent 30%),var(--bg);
}
.brand-logo-lockup img { width:min(280px,72%); height:auto; display:block; }
.sidebar-logo { display:block; padding:7px 10px 22px; }
.sidebar-logo img { display:block; width:158px; max-width:100%; height:auto; }
.sidebar-logo small { margin-top:8px; margin-left:2px; }
.btn-primary { background:var(--aakuna-orange); border-color:var(--aakuna-orange); color:#fff; }
.btn-primary:hover { background:var(--blue-hover); border-color:var(--blue-hover); }
.nav-item.active { color:var(--text); background:color-mix(in srgb,var(--aakuna-orange) 10%,var(--surface-solid)); }
.nav-item.active .nav-icon { color:var(--aakuna-orange); }
.page-kicker,.login-copy .eyebrow { color:var(--aakuna-orange); }

/* Mixed service setup */
.service-builder-row.service-builder-v3,.service-builder-v3 { grid-template-columns:minmax(170px,1.45fr) 116px 118px 128px 126px 118px auto; align-items:end; }
.service-builder-row.service-builder-v3 > :first-child,.service-builder-v3 > :first-child { grid-column:auto; }
.service-row-v3 { grid-template-columns:minmax(0,1.7fr) 210px 150px auto; }

/* Customer profile: services first, commercial facts in one line */
.customer-services-card { overflow:visible; }
.customer-service-table { padding:4px 22px 20px; }
.customer-service-line {
  display:grid;
  grid-template-columns:minmax(220px,1.8fr) repeat(8,minmax(86px,.72fr)) auto;
  gap:14px;
  align-items:center;
  padding:17px 0;
  border-top:1px solid var(--line);
}
.customer-service-line:first-child { border-top:0; }
.customer-service-line > div:not(.svc-main):not(.svc-actions) span { display:block; color:var(--muted); font-size:9.5px; font-weight:650; text-transform:uppercase; letter-spacing:.045em; margin-bottom:5px; }
.customer-service-line > div:not(.svc-main):not(.svc-actions) strong { font-size:12px; font-weight:620; white-space:nowrap; }
.svc-title { display:flex; align-items:center; flex-wrap:wrap; gap:7px; font-size:14px; font-weight:680; letter-spacing:-.012em; }
.svc-sub { margin-top:5px; color:var(--muted); font-size:10.5px; }
.svc-actions { display:flex; justify-content:flex-end; align-items:center; gap:6px; }
.customer-financial-grid { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:10px; padding:18px 22px 22px; }
.mini-stat { border:1px solid var(--line); background:var(--surface-2); border-radius:16px; padding:14px 15px; }
.mini-stat span { display:block; color:var(--muted); font-size:10px; margin-bottom:6px; }
.mini-stat strong { font-size:17px; letter-spacing:-.025em; }

/* Quotations */
.quote-action-band { display:flex; gap:8px; flex-wrap:wrap; align-items:center; }
.quote-grid { display:grid; grid-template-columns:minmax(0,1.5fr) minmax(300px,.65fr); gap:18px; align-items:start; }
.quote-items { display:grid; gap:8px; }
.quote-item { display:grid; grid-template-columns:minmax(0,1fr) 140px 130px; gap:15px; align-items:center; padding:15px 0; border-top:1px solid var(--line); }
.quote-item:first-child { border-top:0; }
.quote-item small { display:block; color:var(--muted); margin-top:4px; line-height:1.45; }
.quote-price { text-align:right; }
.quote-price strong { display:block; font-size:15px; }
.quote-price span { font-size:10px; color:var(--muted); }
.quote-builder-row { display:grid; grid-template-columns:minmax(150px,1.25fr) 105px 112px 124px 120px 115px minmax(140px,1fr) auto; gap:8px; align-items:end; border:1px solid var(--line); background:var(--surface-2); border-radius:16px; padding:11px; margin-bottom:8px; }
.quote-builder-row .field label { font-size:9.5px; }
.quote-hero { margin-bottom:16px; }

/* Recovery settings */
.recovery-card { display:grid; grid-template-columns:minmax(0,1fr) auto; gap:15px; align-items:center; padding:13px 0; border-top:1px solid var(--line); }
.recovery-card:first-child { border-top:0; }
.recovery-card small,.recovery-card span { display:block; color:var(--muted); font-size:10.5px; margin-top:4px; }
.recovery-card > div:last-child { text-align:right; }
.recovery-card > div:last-child strong { font-size:12px; }

@media (max-width:1350px){
  .customer-service-line { grid-template-columns:minmax(210px,1.6fr) repeat(4,minmax(92px,.8fr)); }
  .customer-service-line > div:nth-child(n+6) { padding-top:6px; }
  .svc-actions { justify-content:flex-start; }
  .service-builder-row.service-builder-v3,.service-builder-v3 { grid-template-columns:repeat(3,minmax(0,1fr)); }
  .quote-builder-row { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:900px){
  .quote-grid { grid-template-columns:1fr; }
  .customer-financial-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .customer-service-line { grid-template-columns:repeat(2,minmax(0,1fr)); border:1px solid var(--line); border-radius:17px; padding:15px; margin:10px 0; }
  .customer-service-line:first-child { border-top:1px solid var(--line); }
  .customer-service-line .svc-main,.customer-service-line .svc-actions { grid-column:1/-1; }
}
@media (max-width:680px){
  .brand-logo-lockup img { width:190px; }
  .customer-financial-grid,.service-builder-row.service-builder-v3,.service-builder-v3,.quote-builder-row { grid-template-columns:1fr; }
  .service-builder-row.service-builder-v3 > :first-child,.service-builder-v3 > :first-child { grid-column:auto; }
  .quote-item { grid-template-columns:1fr; }
  .quote-price { text-align:left; }
}
.recovery-actions { display:flex; justify-content:flex-end; gap:6px; margin-top:8px; }

/* V4 · contract recovery + full TruBlu plan inclusions */
.plan-selected-summary { display:flex; align-items:flex-start; justify-content:space-between; gap:16px; margin-bottom:14px; padding-bottom:14px; border-bottom:1px solid var(--line); }
.plan-selected-summary > div:first-child strong { display:block; margin-top:4px; font-size:18px; letter-spacing:-.025em; }
.legacy-upfront-note { text-align:right; }
.legacy-upfront-note strong { display:block; font-size:13px; color:var(--text); }
.legacy-upfront-note span { display:block; color:var(--muted); font-size:10px; margin-top:3px; }
.plan-inclusion-panel { margin-top:18px; padding-top:3px; }
.plan-inclusion-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:7px 18px; }
.plan-inclusion-grid > div { display:flex; align-items:flex-start; gap:8px; padding:8px 0; border-bottom:1px solid var(--line); color:var(--text-secondary); font-size:11px; line-height:1.4; }
.plan-check { color:var(--aakuna-orange); font-weight:800; flex:none; }
.customer-plan-inclusions { grid-column:1/-1; margin-top:3px; border-top:1px solid var(--line); padding-top:10px; }
.customer-plan-inclusions summary { cursor:pointer; color:var(--muted); font-size:10px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; }
.customer-plan-inclusions > div { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px 16px; padding-top:9px; }
.customer-plan-inclusions span { color:var(--text-secondary) !important; font-size:10.5px !important; text-transform:none !important; letter-spacing:0 !important; margin:0 !important; }
.reactivate-list { display:grid; gap:8px; }
.reactivate-choice { width:100%; text-align:left; border:1px solid var(--line); background:var(--surface-2); color:var(--text); border-radius:14px; padding:13px 14px; cursor:pointer; }
.reactivate-choice:hover { border-color:var(--aakuna-orange); background:color-mix(in srgb,var(--aakuna-orange) 6%,var(--surface-solid)); }
.reactivate-choice strong { display:block; font-size:13px; }
.reactivate-choice span { display:block; font-size:10.5px; color:var(--muted); margin-top:4px; }
.quote-builder-row { grid-template-columns:minmax(170px,1.3fr) 105px 112px 124px 120px 115px auto; }
.quote-builder-row .span-2 { grid-column:1 / -2; }
.quote-builder-row textarea { min-height:86px; resize:vertical; }
.trublu-master-card .feature-list { max-height:none; }
.trublu-master-card .feature-list li { line-height:1.35; }

@media (max-width:900px){
  .plan-inclusion-grid,.customer-plan-inclusions > div { grid-template-columns:1fr; }
  .plan-selected-summary { flex-direction:column; }
  .legacy-upfront-note { text-align:left; }
}
