:root {
  color-scheme: light;
  --page: #f4f6f9;
  --surface: #ffffff;
  --ink: #172b42;
  --muted: #526478;
  --line: #e4e9ef;
  --blue: #00588a;
  --blue-dark: #00426a;
  --blue-light: #edf3fb;
  --navy: #13283f;
  --green: #27765b;
  --amber: #946a15;
  --red: #b44543;
  --radius: 10px;
  --shadow: 0 3px 14px rgb(24 43 65 / 3%);
  font-family: Inter, "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  font-size: 14px;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); line-height: 1.55; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid #7eb0e7;
  outline-offset: 3px;
}
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: clamp(25px, 2.4vw, 32px); line-height: 1.25; letter-spacing: -.7px; font-weight: 700; }
h2 { font-size: 18px; line-height: 1.4; letter-spacing: -.3px; }
h3 { font-size: 15px; font-weight: 650; }
small { font-size: 12px; }
.icon { width: 18px; height: 18px; flex: 0 0 auto; vertical-align: middle; }
svg.icon { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

.app-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--navy);
  color: #edf3fa;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 29px 18px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 0 4px; }
.brand-logo { display: block; width: 100%; max-width: 220px; padding: 10px 9px; border-radius: 7px; background: #fff; }
.brand-logo img { display: block; width: 100%; height: auto; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: #29455f;
  border: 1px solid #3a5670;
  border-radius: 10px;
  color: #d9e9fc;
  flex-shrink: 0;
}
.brand-mark .icon { width: 23px; height: 23px; }
.brand-name { font-size: 17px; font-weight: 700; letter-spacing: -.3px; }
.brand-subtitle { font-size: 11px; color: #a5b7ca; margin-top: 1px; }
.nav-list { display: flex; flex-direction: column; gap: 7px; }
.nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #b9c8d9;
  text-align: left;
  font-weight: 550;
  transition: background .15s, color .15s;
}
.nav-button:hover { background: #203a53; color: white; }
.nav-button.active { background: #2b4866; color: white; box-shadow: inset 3px 0 #8ab4e2; }
.nav-button .icon { opacity: .9; }
.sidebar-footer { margin-top: auto; padding: 17px 10px 2px; border-top: 1px solid #31465b; font-size: 12px; color: #b3c3d4; }
.sidebar-footer p { margin-top: 10px; line-height: 1.6; }
.demo-pill { display: inline-flex; align-items: center; gap: 6px; border: 1px solid #516780; border-radius: 30px; padding: 3px 9px; color: #e2edf9; font-size: 11px; font-weight: 650; }
.demo-pill::before { content: ""; width: 5px; height: 5px; background: #96bbdf; border-radius: 50%; }
.workspace { min-width: 0; }
.topbar {
  min-height: 74px;
  padding: 15px 35px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 13px; color: var(--muted); }
.topbar-actions { display: flex; align-items: center; gap: 17px; }
.internal-label { color: var(--muted); font-size: 11px; font-weight: 600; white-space: nowrap; }
.profile { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; font-size: 12px; }
.profile > span:first-child { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #e8eff7; color: #496585; }
.demo-banner {
  margin: 22px 35px 0;
  padding: 11px 15px;
  border: 1px solid #d4e0ef;
  background: #edf3fa;
  border-radius: 8px;
  color: #456381;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.demo-banner .icon { width: 16px; height: 16px; }
.content { padding: 29px 35px 40px; max-width: 1560px; margin: 0 auto; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 25px; }
.page-heading p { margin-top: 7px; color: var(--muted); }
.heading-actions { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.eyebrow { color: var(--muted); font-size: 11px; font-weight: 650; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.button.primary { background: var(--blue); color: white; border-color: var(--blue); }
.button.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.button.secondary { background: white; color: var(--ink); border-color: #d5dee8; }
.button.secondary:hover { background: #f7f9fc; border-color: #a4b7cc; }
.button.ghost { color: var(--blue); background: transparent; }
.button.ghost:hover { background: var(--blue-light); }
.button.danger { background: #fff4f3; border-color: #ecc9c6; color: var(--red); }
.button.danger:hover { background: #ffeae7; }
.button.small { font-size: 12px; min-height: 32px; padding: 6px 10px; }
.button.small .icon { width: 15px; height: 15px; }

.stats-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 25px; }
.stat-card { background: white; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: var(--radius); padding: 19px 21px; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 550; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label .icon { color: #7891af; width: 17px; height: 17px; }
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -.8px; line-height: 1.4; margin-top: 7px; }
.stat-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 11px; margin-bottom: 18px; }
.search-field { position: relative; flex: 1 1 240px; max-width: 480px; }
.search-field input { padding-left: 39px; width: 100%; }
.search-field > .icon { position: absolute; left: 13px; top: 12px; color: #77899e; pointer-events: none; }
.filter-field { min-width: 160px; }
.filter-field select { width: 100%; }
.toolbar-end { margin-left: auto; color: var(--muted); font-size: 12px; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select {
  width: 100%;
  border: 1px solid #d5dee8;
  border-radius: 7px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  min-height: 42px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #8b98a9; opacity: 1; }
input:hover, textarea:hover, select:hover { border-color: #aebfce; }
input:focus, textarea:focus, select:focus { border-color: #6f95c6; }
input[readonly] { background: #f5f7fa; color: var(--muted); }
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
select { cursor: pointer; padding-right: 28px; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--blue); width: 16px; height: 16px; margin: 0; flex-shrink: 0; cursor: pointer; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-header { padding: 19px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.panel-header p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.panel-body { padding: 22px; }
.customer-table { overflow-x: auto; scrollbar-color: #c5d1df transparent; }
.customer-table table { border-collapse: collapse; width: 100%; min-width: 770px; text-align: left; }
.customer-table th { background: #f9fafc; color: var(--muted); font-size: 12px; text-transform: none; letter-spacing: 0; font-weight: 650; padding: 13px 20px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.customer-table td { padding: 16px 20px; border-bottom: 1px solid #edf0f4; font-size: 13px; vertical-align: middle; }
.customer-table tbody tr:last-child td { border-bottom: 0; }
.customer-table tbody tr:hover { background: #f7faff; }
.customer-table tbody tr[data-customer-id] { cursor: pointer; }
.table-primary { font-weight: 650; color: var(--ink); }
button.table-primary { background: transparent; border: 0; padding: 0; text-align: left; font: inherit; font-weight: 650; }
button.table-primary:hover { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.table-secondary { color: var(--muted); font-size: 12px; margin-top: 3px; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 5px; font-size: 11px; line-height: 1.6; font-weight: 600; white-space: nowrap; }
.badge.blue { background: #edf3fc; color: #365f94; }
.badge.green { background: #edf7f1; color: #2b7658; }
.badge.amber { background: #fbf4e5; color: #90671a; }
.badge.red { background: #fcefed; color: #b04b42; }
.badge.neutral { background: #eff2f6; color: #66788e; }
.empty-state { text-align: center; padding: 45px 22px; color: var(--muted); }
.empty-state .icon { width: 35px; height: 35px; color: #9aadc4; margin-bottom: 12px; }
.empty-state h3 { color: var(--ink); margin-bottom: 7px; }
.empty-state p { max-width: 400px; margin: 0 auto; font-size: 13px; }
.empty-state .button { margin-top: 17px; }

.back-button { display: inline-flex; align-items: center; gap: 7px; padding: 0; margin-bottom: 19px; border: 0; background: transparent; color: var(--muted); font-size: 12px; }
.back-button:hover { color: var(--blue); }
.back-button .icon { width: 15px; height: 15px; }
.detail-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.detail-title { min-width: 0; }
.detail-title h1 { overflow-wrap: anywhere; }
.detail-title p { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; color: var(--muted); margin-top: 8px; font-size: 12px; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.detail-tabs { display: flex; gap: 24px; border-bottom: 1px solid #dce4ed; margin-bottom: 23px; overflow-x: auto; }
.tab-button { background: transparent; color: var(--muted); border: 0; border-bottom: 2px solid transparent; padding: 0 1px 12px; font-weight: 600; white-space: nowrap; }
.tab-button:hover { color: var(--blue); }
.tab-button.active { color: var(--blue); border-bottom-color: var(--blue); }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr); gap: 20px; align-items: start; }
.detail-grid > div { min-width: 0; }
.detail-grid > div > .panel + .panel { margin-top: 20px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 21px 25px; }
.info-item { min-width: 0; }
.info-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.info-value { font-size: 13px; font-weight: 550; overflow-wrap: anywhere; }
.section-title { font-size: 13px; font-weight: 650; margin: 22px 0 10px; }
.section-title:first-child { margin-top: 0; }
.contact-list { display: flex; flex-direction: column; gap: 10px; }
.contact-card { padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: #fcfdff; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.contact-card p { color: var(--muted); font-size: 12px; margin-top: 2px; overflow-wrap: anywhere; }
.contact-card .badge { margin-top: 1px; }
.timeline { display: flex; flex-direction: column; padding-top: 3px; }
.timeline-item { display: flex; gap: 14px; position: relative; padding-bottom: 22px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item:not(:last-child)::before { content: ""; position: absolute; width: 1px; background: #dfe6ee; left: 5px; top: 12px; bottom: 0; }
.timeline-dot { width: 11px; height: 11px; flex: 0 0 11px; border-radius: 50%; background: #6c91bc; border: 2px solid #e3edf8; margin-top: 6px; z-index: 1; }
.timeline-content { min-width: 0; font-size: 13px; }
.timeline-content p { white-space: pre-wrap; overflow-wrap: anywhere; }
.timeline-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; color: var(--muted); font-size: 11px; margin-top: 5px; }

.task-list { display: flex; flex-direction: column; }
.task-row { display: flex; align-items: center; gap: 13px; border-bottom: 1px solid var(--line); padding: 15px 0; }
.task-row:first-child { padding-top: 0; }
.task-row:last-child { border-bottom: 0; padding-bottom: 0; }
.task-main { min-width: 0; flex: 1; }
.task-main > p, .task-main > strong { font-size: 13px; font-weight: 600; overflow-wrap: anywhere; }
.task-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 4px; font-size: 11px; color: var(--muted); }
.task-actions { display: flex; gap: 5px; flex-shrink: 0; }
.overdue .task-meta, .task-meta .overdue { color: var(--red); }
.completed .task-main > p, .completed .task-main > strong { text-decoration: line-through; color: var(--muted); }
.completed { opacity: .72; }
.credit-box { background: #f7fafc; border: 1px solid var(--line); padding: 18px; border-radius: 8px; }
.credit-score { font-size: 32px; font-weight: 700; line-height: 1.25; color: var(--green); }
.credit-meta { color: var(--muted); font-size: 11px; margin-top: 7px; line-height: 1.75; }
.credit-demo-label { display: inline-block; padding: 3px 8px; background: #eef2f7; color: #65768b; border-radius: 5px; font-size: 10px; margin-top: 12px; }

.mail-grid { display: grid; grid-template-columns: minmax(270px, .8fr) minmax(0, 1.2fr); gap: 22px; align-items: start; }
.mail-recipient-list { margin: 14px -2px 0; max-height: 375px; overflow-y: auto; padding: 0 2px; }
.recipient-row { display: flex; align-items: center; gap: 11px; padding: 13px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.recipient-row:last-child { border-bottom: 0; }
.recipient-row:hover .recipient-copy strong { color: var(--blue); }
.recipient-checkbox { display: flex; align-items: center; }
.recipient-copy { min-width: 0; }
.recipient-copy strong { font-size: 12px; font-weight: 600; display: block; }
.recipient-copy p { font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }
.recipient-count { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0 0; margin-top: 9px; border-top: 1px solid var(--line); font-size: 12px; font-weight: 600; }
.mail-preview { margin-top: 19px; border: 1px solid #dbe4ed; border-radius: 8px; overflow: hidden; background: #fbfcfe; }
.mail-preview > header, .mail-preview > div:first-child:not(.mail-preview-body) { padding: 13px 17px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.mail-preview-body { padding: 23px; background: white; font-size: 13px; line-height: 1.8; white-space: pre-wrap; overflow-wrap: anywhere; }
.mail-preview-body h3 { margin-bottom: 13px; font-size: 17px; }
.mail-preview-body p + p { margin-top: 14px; }
.mail-preview-body footer { margin-top: 24px; color: var(--muted); font-size: 12px; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-field label, .form-field > span:first-child { font-size: 12px; font-weight: 600; }
.form-field small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.form-field + .form-field { margin-top: 0; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 20px; }
.inline-form { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 10px; padding-top: 18px; margin-top: 18px; border-top: 1px solid var(--line); }
.inline-form .form-field { flex: 1 1 180px; }
.inline-form textarea { min-height: 90px; }

dialog.modal { width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); border: 1px solid #dbe3ec; padding: 0; border-radius: 12px; color: var(--ink); box-shadow: 0 20px 75px rgb(13 34 57 / 20%); }
dialog.modal::backdrop { background: rgb(11 27 45 / 46%); backdrop-filter: blur(2px); }
.modal-header { display: flex; justify-content: space-between; align-items: center; gap: 15px; padding: 21px 24px; border-bottom: 1px solid var(--line); }
.modal-header h2 { font-size: 20px; }
.modal-header p { font-size: 12px; color: var(--muted); margin-top: 4px; }
.modal-close { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border: 0; background: #f1f4f8; border-radius: 7px; color: var(--muted); font-size: 24px; line-height: 1; }
.modal-close:hover { background: #e5ebf2; color: var(--ink); }
.modal-body { padding: 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 9px; padding: 17px 24px; border-top: 1px solid var(--line); background: #fafbfd; }
.toast { position: fixed; left: calc(50% + 115px); bottom: 26px; z-index: 1000; transform: translate(-50%, 16px); border: 1px solid #294760; border-radius: 8px; background: #19364e; color: white; padding: 13px 20px; box-shadow: 0 8px 30px rgb(15 38 60 / 20%); font-size: 13px; max-width: calc(100vw - 32px); opacity: 0; visibility: hidden; transition: opacity .18s, transform .18s, visibility .18s; }
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.settings-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 23px; box-shadow: var(--shadow); }
.settings-card h2 { margin-bottom: 8px; }
.settings-card p { color: var(--muted); font-size: 13px; margin-bottom: 17px; }
.settings-card .button + .button { margin-left: 6px; }
.notice { padding: 13px 16px; background: #eef4fb; border: 1px solid #d9e4f1; color: #466582; font-size: 12px; border-radius: 8px; line-height: 1.65; }
.notice.warning, .warning { background: #fcf7ea; border-color: #ece0bf; color: #846721; }
.panel-body > .notice + *, .panel-body > .form-grid + .notice { margin-top: 18px; }

@media (min-width: 1600px) {
  .content { padding-top: 34px; }
}
@media (max-width: 1150px) {
  .app-shell { grid-template-columns: 205px minmax(0, 1fr); }
  .sidebar { padding-right: 14px; padding-left: 14px; }
  .topbar { padding-right: 25px; padding-left: 25px; }
  .demo-banner { margin-right: 25px; margin-left: 25px; }
  .content { padding: 26px 25px 35px; }
  .stat-card { padding: 16px; }
  .detail-grid { grid-template-columns: minmax(0, 1.6fr) minmax(240px, 1fr); gap: 17px; }
  .mail-grid { gap: 17px; grid-template-columns: minmax(240px, .8fr) minmax(0, 1.2fr); }
  .toast { left: calc(50% + 102.5px); }
}
@media (max-width: 930px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .detail-grid, .mail-grid { grid-template-columns: minmax(0,1fr); }
  .page-heading { align-items: flex-start; }
  .heading-actions { padding-top: 2px; }
  .detail-heading { align-items: flex-start; }
  .detail-actions { justify-content: flex-end; max-width: 220px; }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .app-shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 15px 16px 11px; gap: 16px; }
  .brand { padding: 0 3px; flex-direction: row; align-items: center; gap: 15px; }
  .brand-logo { width: 190px; flex: 0 1 190px; padding: 9px 8px; }
  .brand-mark { width: 32px; height: 32px; border-radius: 8px; }
  .brand-name { font-size: 16px; }
  .brand-subtitle { font-size: 10px; }
  .nav-list { flex-direction: row; gap: 5px; overflow-x: auto; padding-bottom: 1px; }
  .nav-button { width: auto; flex: 1 0 auto; padding: 9px 11px; font-size: 12px; justify-content: center; gap: 7px; }
  .nav-button .icon { width: 16px; height: 16px; }
  .nav-button.active { box-shadow: inset 0 -2px #8ab4e2; }
  .sidebar-footer { display: none; }
  .topbar { min-height: 56px; padding: 10px 19px; gap: 10px; }
  .topbar-title { font-size: 11px; }
  .topbar-actions { gap: 8px; }
  .internal-label { font-size: 10px; }
  .profile { font-size: 11px; gap: 6px; }
  .profile > span:first-child { width: 28px; height: 28px; }
  .demo-banner { margin: 15px 19px 0; align-items: flex-start; padding: 10px 12px; font-size: 11px; }
  .demo-banner .icon { margin-top: 2px; }
  .content { padding: 24px 19px 30px; }
  .page-heading { margin-bottom: 20px; gap: 13px; }
  .page-heading p { font-size: 12px; }
  .heading-actions .button { padding: 9px 11px; min-height: 36px; font-size: 12px; }
  .toolbar { gap: 9px; }
  .search-field { flex-basis: 100%; max-width: none; }
  .filter-field { min-width: 140px; flex: 1; }
  .toolbar-end { font-size: 11px; }
  .stats-row { gap: 11px; margin-bottom: 20px; }
  .stat-card { padding: 14px 16px; }
  .stat-label { font-size: 11px; }
  .stat-value { font-size: 26px; }
  .panel-header { padding: 16px 18px; }
  .panel-body { padding: 18px; }
  .customer-table th, .customer-table td { padding-left: 17px; padding-right: 17px; }
  .detail-heading { flex-direction: column; gap: 15px; }
  .detail-actions { justify-content: flex-start; max-width: none; }
  .detail-tabs { gap: 22px; font-size: 12px; }
  .toast { left: 50%; bottom: 18px; font-size: 12px; text-align: center; }
}
@media (max-width: 440px) {
  .sidebar { padding-left: 12px; padding-right: 12px; }
  .nav-button { font-size: 11px; padding: 9px 8px; gap: 5px; }
  .nav-button .icon { width: 14px; height: 14px; }
  .topbar { padding-left: 15px; padding-right: 15px; }
  .profile > span:not(:first-child) { display: none; }
  .demo-banner { margin-left: 15px; margin-right: 15px; }
  .content { padding-left: 15px; padding-right: 15px; }
  .page-heading { flex-direction: column; gap: 14px; }
  .heading-actions { width: 100%; padding: 0; }
  .heading-actions .button.primary { flex: 1; }
  .stats-row { gap: 9px; }
  .stat-card { padding: 12px; }
  .stat-meta { font-size: 10px; }
  .stat-label .icon { display: none; }
  .info-grid, .form-grid { grid-template-columns: 1fr; gap: 16px; }
  .span-2 { grid-column: auto; }
  .contact-card { flex-direction: column; gap: 8px; }
  .task-row { flex-wrap: wrap; gap: 10px; }
  .task-actions { margin-left: 26px; }
  .panel-header { flex-wrap: wrap; gap: 9px; }
  .panel-header h2 { font-size: 16px; }
  .modal-header, .modal-body { padding: 18px; }
  .modal-footer { padding: 15px 18px; flex-wrap: wrap; }
  .modal-footer .button { flex: 1; }
  .settings-card { padding: 18px; }
  .mail-preview-body { padding: 17px; }
  .recipient-count { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
@media print {
  .sidebar, .topbar, .demo-banner, .heading-actions, .detail-actions, .row-actions, .toast { display: none !important; }
  .app-shell { display: block; }
  body, .workspace { background: white; }
  .content { padding: 0; }
  .panel, .stat-card { box-shadow: none; break-inside: avoid; }
}

/* Application-specific refinements. */
.overview-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:22px; margin-bottom:22px; }
.overview-stat { text-align:left; color:inherit; border:1px solid var(--line); font:inherit; }
.overview-stat:hover { border-color:var(--blue); }
.inline-link { border:0; background:transparent; color:var(--blue-dark); font:inherit; text-decoration:underline; padding:0; }
.branch-list { padding-left:20px; margin-bottom:12px; }
.branch-list li + li { margin-top:10px; }
.service-options { border:1px solid var(--line); border-radius:8px; padding:12px 15px; display:flex; flex-wrap:wrap; gap:12px 22px; min-width:0; }
.service-options legend { padding:0 6px; font-weight:600; }
.transport-details { margin-bottom:18px; }
.transport-details .info-value { white-space:pre-wrap; overflow-wrap:anywhere; }
.favorite-toolbar { display:flex; flex-wrap:wrap; align-items:flex-end; gap:10px; margin-bottom:20px; }
.favorite-toolbar label { min-width:180px; }
.favorite-toolbar label span { display:block; color:var(--muted); font-size:12px; margin-bottom:5px; }
.favorite-toolbar select { width:100%; }
.favorite-toolbar small { width:100%; color:var(--muted); }
@media(max-width:720px) { .overview-grid { grid-template-columns:1fr; } .overview-grid .panel { min-width:0; } .favorite-toolbar label { width:100%; } }
.brand { color: #edf3fa; text-decoration: none; }
.brand-name, .brand-subtitle, .stat-value, .stat-meta { display: block; }
.stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.toolbar > label > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.search-field input { padding-left: 12px; }
.toolbar-end { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.table-primary { display: block; padding: 0; border: 0; background: transparent; color: var(--blue-dark); text-align: left; font: inherit; font-weight: 650; }
.table-primary:hover { text-decoration: underline; }
.table-secondary { display: block; overflow-wrap: anywhere; }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.sr-only { position: absolute; left:0; top:0; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.checkbox-field { display: flex; gap: 10px; align-items: center; }
.checkbox-field input { width: 18px; height: 18px; accent-color: var(--blue); }
.recipient-details { margin-top: 18px; overflow-wrap: anywhere; }
.recipient-details summary { cursor: pointer; }
.recipient-details ul { padding-left: 20px; }
.settings-card.panel { padding: 0; }
.settings-card .form-field { margin-bottom: 14px; }
.storage-warning { margin: 15px 35px 0; padding: 12px 15px; background: #fff0ed; color: #9c3830; border: 1px solid #edc9c3; border-radius: 8px; }
.task-main { min-width: 0; overflow-wrap: anywhere; }
.task-main > strong { display: block; }
.credit-demo-label { white-space: nowrap; }
.warning:empty { display: none; }
.mail-grid > div { min-width:0; }
.recipient-copy { display:block; min-width:0; flex:1; overflow-wrap:anywhere; }
.recipient-copy > span, .recipient-copy > small { display:block; }
.recipient-copy > small { color:var(--muted); margin-top:3px; }
#mail-form > .form-field + .form-field { margin-top:16px; }
.form-actions + .notice { margin-top:16px; }
@media(max-width:930px) { .stats-row { grid-template-columns:repeat(3,minmax(0,1fr)); } }
@media(max-width:720px) { .storage-warning { margin-left:19px; margin-right:19px; } }
@media(max-width:440px) { .stats-row { grid-template-columns:1fr; } .storage-warning { margin-left:15px; margin-right:15px; } .button { max-width:100%; white-space:normal; } .detail-actions, .form-actions { flex-wrap:wrap; } }

/* Import and administration share the existing demo panels. */
[data-admin-nav][hidden]{display:none}
.admin-table{overflow-x:auto;max-width:100%}
.admin-table table{width:100%;border-collapse:collapse}
.admin-table th,.admin-table td{padding:10px;text-align:left;vertical-align:top;overflow-wrap:anywhere;min-width:100px;max-width:440px;border-bottom:1px solid #e5eaf0}
.import-item,.audit-item{padding:16px 0;border-bottom:1px solid #e5eaf0}
.import-item details,.audit-item details{margin-top:10px}
.import-item summary,.audit-item summary{cursor:pointer;padding:8px 0}
#import-confirm{margin-top:20px}
#member-editor:empty,#backup-confirm:empty{display:none}
#member-editor{margin-top:18px;padding-top:18px;border-top:1px solid #e5eaf0}
#import-preview .toolbar{flex-wrap:wrap}
@media(max-width:640px){.import-item .checkbox-field{align-items:flex-start}.admin-table td{max-width:240px}}


.brreg-panel{padding:16px;margin:0 0 20px;border:1px solid #d8e2eb;border-radius:10px;background:#f7faff;min-width:0}
.brreg-panel legend{font-weight:700;padding:0 6px}
.brreg-panel .form-field{margin-bottom:12px}
.brreg-candidate{display:block;text-align:left;white-space:normal;margin:6px 0}



.field-error { margin: 6px 0 0; color: #8a2b2b; font-size: 13px; line-height: 1.45; }
.form-required-hint { margin: 0 0 12px; }

/* Bedriftssøk: samme skjema- og knappestil som resten av CRM. */
.company-search-form,.company-search-results{display:grid;gap:1rem}
.company-search-result{border:1px solid #d8e0e8;border-radius:8px;padding:1rem}
.company-search-actions{display:flex;gap:.5rem;flex-wrap:wrap;align-items:center}

/* Customer-only administration. Public site and demo styles remain unchanged. */
.table-wrap { max-width:100%; overflow-x:auto; }
/* R02: customer-only read views for tasks, offers and agreement reviews. */
.crm-record { min-width:0; padding:16px 0; overflow-wrap:anywhere; }
.crm-record + .crm-record { border-top:1px solid var(--line); }
.crm-record :is(h2,h3,h4) { margin:0 0 8px; font-size:16px; }
.crm-record > p { margin:6px 0 10px; }
.crm-record-details { display:grid; gap:8px; margin:12px 0; }
.crm-record-details > div { display:grid; grid-template-columns:minmax(100px,.7fr) minmax(0,1.3fr); gap:12px; }
.crm-record-details dt { color:var(--muted); }
.crm-record-details dd { margin:0; min-width:0; white-space:pre-wrap; }
.crm-customer-related { margin-top:24px; }
.crm-deadline-owner { max-width:320px; }
.crm-deadlines .panel, .crm-deadlines .panel-body { min-width:0; }
.crm-record .inline-link { display:inline; white-space:normal; }
@media(max-width:720px) {
  .crm-record-details > div { grid-template-columns:minmax(0,1fr); gap:3px; }
  .crm-record .button { min-height:44px; white-space:normal; }
}
[data-member] { padding:16px 0; }
[data-member] strong { display:block; overflow-wrap:anywhere; margin-bottom:12px; }
[data-admin-message], [data-import-error] { white-space:pre-wrap; overflow-wrap:anywhere; }
[data-preview] { margin:16px 0; }
[data-preview] td { overflow-wrap:anywhere; }
[data-invite] { display:grid; gap:12px; }
[data-preview] table { width:100%; min-width:560px; border-collapse:collapse; }
[data-preview] th, [data-preview] td { padding:10px; text-align:left; vertical-align:top; border-bottom:1px solid var(--line); }
[data-preview] th { white-space:nowrap; }
[data-preview] .table-wrap:focus-visible { outline:2px solid var(--blue); outline-offset:2px; }

.mail-capture{display:grid;gap:14px;padding:20px;max-width:680px}.mail-capture .form-field{display:grid;gap:6px}.mail-capture input,.mail-capture select,.mail-capture textarea{width:100%;min-height:44px;padding:10px;font:inherit;box-sizing:border-box}.mail-confirm{display:flex;gap:10px;align-items:flex-start}.mail-confirm input{width:22px;min-height:22px;flex-shrink:0}.mail-text{white-space:pre-wrap;overflow-wrap:anywhere;font:inherit}dialog[aria-label="Kundens e-post"]{width:min(760px,94vw);max-height:90vh;overflow:auto}dialog[aria-label="Kundens e-post"]>button{margin:15px}
