@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@500;600;700&display=swap');

:root {
  color-scheme: light;
  --canvas: #faebd7;
  --surface: #fffaf3;
  --surface-strong: #ffffff;
  --sidebar: #2a013d;
  --ink: #2a013d;
  --muted: #65596f;
  --line: #dfcdbb;
  --rose: #61559d;
  --rose-dark: #2a3374;
  --rose-soft: #ece9f7;
  --gold: #f9b85e;
  --gold-soft: #fff0d8;
  --green: #2a3374;
  --green-soft: #dfeaf0;
  --danger: #ed6842;
  --danger-soft: #fde5dd;
  --shadow: 0 12px 32px rgba(42, 1, 61, .08);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --canvas: #120819;
  --surface: #1d1025;
  --surface-strong: #2a1635;
  --sidebar: #08020c;
  --ink: #faebd7;
  --muted: #b9acc1;
  --line: #4c3558;
  --rose: #7a6db5;
  --rose-dark: #8db2c3;
  --rose-soft: #342044;
  --gold: #f9b85e;
  --gold-soft: #3e2d1b;
  --green: #8db2c3;
  --green-soft: #1d3140;
  --danger: #ed6842;
  --danger-soft: #4a231b;
  --shadow: 0 14px 38px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 16px; }
body { margin: 0; color: var(--ink); background: var(--canvas); font-family: "DM Sans", system-ui, sans-serif; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(97,85,157,.32); outline-offset: 2px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Manrope", "DM Sans", sans-serif; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; z-index: 10; height: 100vh; display: flex; flex-direction: column; overflow-y: auto; color: var(--canvas); background: var(--sidebar); }
.brand { display: flex; align-items: center; gap: 12px; padding: 28px 23px 30px; color: white; text-decoration: none; }
.brand > span:last-child { min-width: 0; }
.brand strong, .brand small { display: block; }
.brand strong { display: -webkit-box; overflow: hidden; font: 700 1.05rem/1.2 "Manrope", sans-serif; letter-spacing: -.03em; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.brand small { margin-top: 4px; overflow: hidden; color: #bfb3ab; font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.sun-mark { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px; border: 1px solid var(--gold); border-radius: 50%; color: var(--gold); font-size: 1.45rem; }
.sun-mark svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
.workspace-label { margin: 0; padding: 0 22px 12px; color: var(--gold); font-size: .62rem; font-weight: 600; letter-spacing: .14em; }
.nav { display: grid; gap: 5px; padding: 0 12px; }
.nav-item { min-height: 44px; display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 13px; border: 0; border-radius: 9px; color: #e2d8e7; background: transparent; text-align: left; font-size: .82rem; }
.nav-item:hover { color: white; background: #421b55; }
.nav-item.active { color: #fff; background: #61559d; font-weight: 600; }
.nav-item > span { width: 21px; color: #f9b85e; text-align: center; }
.nav-item b { margin-left: auto; min-width: 22px; padding: 3px 6px; border-radius: 999px; color: #2a013d; background: #f9b85e; font-size: .65rem; text-align: center; }
.theme-toggle { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 9px 13px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: var(--surface); font-size: .72rem; font-weight: 600; }
.theme-toggle:hover { border-color: var(--rose); }
.theme-toggle [data-theme-icon] { font-size: 1rem; line-height: 1; }
.theme-toggle-sidebar { margin: auto 16px 10px; color: #faebd7; border-color: #61559d; background: #1c0828; }
.theme-toggle-sidebar:hover { color: white; border-color: #f9b85e; }
.theme-toggle-floating { position: absolute; top: 22px; right: 24px; z-index: 2; }
.account { display: flex; align-items: center; gap: 10px; width: 100%; padding: 16px; border: 0; border-top: 1px solid #4c3558; color: #faebd7; background: transparent; text-align: left; }
.account > span:last-child { min-width: 0; }
.account strong, .account small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account strong { font-size: .75rem; }
.account small { margin-top: 4px; color: #aa9f98; font-size: .65rem; }
.avatar { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 36px; border-radius: 50%; color: white; background: var(--rose); font-size: .7rem; font-weight: 700; }
.avatar.soft { color: var(--rose-dark); background: var(--rose-soft); }
.avatar.large { width: 52px; height: 52px; flex-basis: 52px; font-size: .85rem; }

.page-shell { min-width: 0; }
.topbar { height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(255,253,251,.92); backdrop-filter: blur(12px); }
.breadcrumb { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: .72rem; }
.breadcrumb i { color: #c4b9b1; font-style: normal; }
.breadcrumb strong { color: var(--ink); }
.topbar-actions { display: flex; align-items: center; gap: 15px; }
.live-context { max-width: 360px; text-align: right; line-height: 1.25; }
.live-context strong, .live-context span { display: block; }
.live-context strong { font-size: .68rem; }
.live-context span { margin-top: 3px; color: var(--muted); font-size: .6rem; text-transform: capitalize; }
.notification-pill, .demo-label { padding: 7px 10px; border-radius: 999px; color: #766147; background: var(--gold-soft); font-size: .66rem; }
.notification-pill i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--gold); }
.demo-label { color: var(--rose-dark); background: var(--rose-soft); }
.menu-toggle { display: none; border: 0; color: var(--ink); background: transparent; font-size: 1.3rem; }
.workspace { width: min(100%, 1480px); margin: 0 auto; padding: 36px 38px 56px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 27px; }
.page-heading h1 { margin-bottom: 7px; font-size: clamp(1.7rem, 3vw, 2.15rem); line-height: 1.15; letter-spacing: -.045em; }
.page-heading > div > p:last-child { margin: 0; color: var(--muted); font-size: .8rem; }
.eyebrow { margin: 0 0 8px; color: var(--rose-dark); font-size: .61rem; font-weight: 700; letter-spacing: .14em; }

.button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border: 1px solid transparent; border-radius: 8px; font-size: .76rem; font-weight: 600; }
.button.primary { color: white; border-color: var(--rose-dark); background: var(--rose-dark); box-shadow: 0 7px 16px rgba(42,51,116,.2); }
.button.primary:hover { background: #2a013d; }
.button.secondary { color: var(--rose-dark); border-color: #8db2c3; background: white; }
.button.danger { color: var(--danger); border-color: #f2b09d; background: #fff7f3; }
.button.compact { min-height: 34px; padding: 7px 11px; font-size: .69rem; }
.text-link { padding: 4px; border: 0; color: var(--rose-dark); background: transparent; font-size: .72rem; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.stats-extended .stat { min-height: 132px; }
.stat, .panel, .service-card, .approval-card, .message-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.stat { position: relative; overflow: hidden; padding: 20px; }
.stat::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: #d6c9c2; }
.stat.rose::before { background: var(--rose); }
.stat.gold::before { background: var(--gold); }
.stat.danger::before { background: var(--danger); }
.stat.success::before { background: var(--green); }
.stat > span { color: var(--muted); font-size: .73rem; }
.stat strong { display: block; margin: 15px 0 5px; font: 600 2rem/1 "Manrope", sans-serif; }
.stat small { color: #918780; font-size: .65rem; }
.dashboard-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; }
.panel { overflow: hidden; }
.panel-head { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 20px; border-bottom: 1px solid #eee7e1; }
.panel-head h2 { margin: 0; font-size: .92rem; }
.panel-head .eyebrow { margin-bottom: 5px; }
.panel-body { padding: 21px; }
.list { min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.reminder-row { width: 100%; min-width: 0; min-height: 75px; display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid #eee8e3; }
.reminder-row:last-child { border-bottom: 0; }
.date-block { width: 70px; flex: 0 0 70px; }
.date-block strong, .date-block span { display: block; }
.date-block strong { font-size: .72rem; }
.date-block span { margin-top: 4px; color: var(--muted); font-size: .64rem; }
.reminder-main { min-width: 0; flex: 1; }
.reminder-main strong, .reminder-main small { display: block; }
.reminder-main strong { font-size: .76rem; }
.reminder-main small { margin-top: 5px; overflow: hidden; color: var(--muted); font-size: .65rem; text-overflow: ellipsis; white-space: nowrap; }
.status { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 999px; color: #685f5a; background: #eeeae6; font-size: .62rem; white-space: nowrap; }
.status.success { color: var(--green); background: var(--green-soft); }
.status.warning { color: #80653c; background: var(--gold-soft); }
.status.danger { color: var(--danger); background: var(--danger-soft); }
.badge { display: inline-flex; padding: 5px 8px; border-radius: 999px; color: var(--rose-dark); background: var(--rose-soft); font-size: .62rem; }
.empty { padding: 48px 20px; color: var(--muted); text-align: center; font-size: .75rem; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.toolbar > p { margin: 0; color: var(--muted); font-size: .76rem; }
.search { min-width: 310px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.search input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; }
.select-control { min-height: 40px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; border-bottom: 1px solid #eee8e3; text-align: left; font-size: .72rem; }
th { color: #857b75; background: #fcfaf8; font-size: .61rem; letter-spacing: .06em; text-transform: uppercase; }
td small { display: block; margin-top: 4px; color: var(--muted); }
.person { display: flex; align-items: center; gap: 10px; }
.person strong, .person small { display: block; }

.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 17px; }
.service-card { padding: 19px; }
.service-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.deadline { color: var(--muted); font-size: .68rem; }
.service-card .eyebrow { margin-top: 17px; }
.service-card h3 { min-height: 43px; margin-bottom: 8px; font-size: .94rem; line-height: 1.4; }
.service-card > p:not(.eyebrow) { color: var(--muted); font-size: .7rem; }
.service-card .button { width: 100%; margin-top: 14px; }
.progress-line { height: 5px; overflow: hidden; border-radius: 99px; background: #eee8e3; }
.progress-line i { display: block; height: 100%; border-radius: inherit; background: var(--rose); }

.info-banner { display: flex; align-items: flex-start; gap: 12px; padding: 15px 17px; margin-bottom: 18px; border: 1px solid #e8dac2; border-radius: 10px; color: #6f5f48; background: #fbf5e9; }
.info-banner > span { width: 24px; height: 24px; display: grid; place-items: center; flex: 0 0 24px; border-radius: 50%; color: white; background: var(--gold); font-size: .7rem; }
.info-banner p { margin: 2px 0 0; font-size: .72rem; line-height: 1.55; }
.approval-list { display: grid; gap: 15px; }
.approval-card { padding: 20px; }
.approval-summary { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; }
.approval-summary h3 { margin: 12px 0 5px; font-size: .98rem; }
.approval-summary p { margin: 0; color: var(--muted); font-size: .7rem; }
.approval-date { text-align: right; }
.approval-date small, .approval-date strong, .approval-date span { display: block; }
.approval-date small { color: var(--muted); font-size: .62rem; }
.approval-date strong { margin: 5px 0; font-size: .82rem; }
.approval-date span { color: var(--muted); font-size: .65rem; }
.message-box { padding: 14px; margin-top: 17px; border: 1px solid #e5ddd7; border-radius: 9px; background: #fbfaf8; }
.message-box small { color: var(--rose-dark); font-size: .57rem; font-weight: 700; letter-spacing: .09em; }
.message-box p { margin: 7px 0 0; color: #5e5550; font-size: .72rem; line-height: 1.55; }
.message-box.preview { background: #f9f5f1; }
.card-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; margin-top: 16px; }

.message-layout { display: grid; grid-template-columns: minmax(0, 1fr) 270px; gap: 18px; }
.message-library { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.message-card { display: flex; flex-direction: column; padding: 18px; }
.message-card h3 { margin: 11px 0 0; font-size: .82rem; line-height: 1.4; }
.message-card > p { min-height: 70px; margin: 15px 0 0; color: var(--muted); font-size: .69rem; line-height: 1.55; }
.message-card .card-actions { margin-top: auto; padding-top: 15px; border-top: 1px solid #eee8e3; }
.message-card .card-actions small { margin-right: auto; color: var(--muted); font-size: .61rem; }
.variable-panel { position: sticky; top: 90px; align-self: start; }
.variable-panel code { display: block; margin-bottom: 8px; padding: 7px 9px; border-radius: 6px; color: var(--rose-dark); background: var(--rose-soft); font-size: .66rem; }

.report-form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: end; gap: 12px; padding: 21px; }
.report-log { margin-top: 18px; }
.settings-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 18px; }
.settings-section:first-child { grid-row: span 2; }
.deadline-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.deadline-chips > span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; border: 1px solid #ded5cf; border-radius: 999px; background: white; font-size: .67rem; }
.deadline-chips small { color: var(--muted); font-size: .55rem; }
.deadline-chips button { border: 0; color: var(--danger); background: transparent; }
.inline-form { display: flex; gap: 9px; margin-top: 17px; }
.inline-form input { min-width: 0; flex: 1; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
.secret-result { padding: 11px; margin-top: 13px; overflow-wrap: anywhere; border-radius: 7px; color: #685a45; background: var(--gold-soft); font: .66rem ui-monospace, monospace; }
.muted { color: var(--muted); font-size: .72rem; line-height: 1.55; }
.integration-controls { display: grid; gap: 16px; }
.automation-toggle { display: flex; align-items: flex-start; gap: 11px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fafbfd; cursor: pointer; }
.automation-toggle input { margin-top: 3px; accent-color: var(--rose); }
.automation-toggle span, .automation-toggle small { display: block; }
.automation-toggle strong { font-size: .73rem; }
.automation-toggle small { margin-top: 5px; color: var(--muted); font-size: .63rem; line-height: 1.45; }
.integration-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.integration-status { display: inline-block; margin-top: 5px; padding: 4px 8px; border-radius: 999px; color: #826b34; background: var(--gold-soft); font-size: .58rem; }
.integration-status.online { color: #176644; background: #e2f4e9; }
.settings-save { grid-column: 1 / -1; display: flex; justify-content: flex-end; }

dialog { width: min(94vw, 620px); max-height: 92vh; padding: 0; overflow: hidden; border: 0; border-radius: 14px; color: var(--ink); background: white; box-shadow: 0 25px 80px rgba(48,37,32,.3); }
dialog.wide { width: min(94vw, 880px); }
dialog::backdrop { background: rgba(35,29,27,.6); backdrop-filter: blur(3px); }
.modal-card { max-height: 92vh; display: flex; flex-direction: column; padding: 0; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 23px 25px 17px; border-bottom: 1px solid #eee8e3; }
.modal-head h2 { margin: 0; font-size: 1.2rem; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: white; font-size: 1.2rem; }
#modal-body { padding: 22px 25px; overflow-y: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 25px 21px; border-top: 1px solid #eee8e3; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; color: #665d58; font-size: .69rem; }
.field.full, .choice-group.full, .form-note.full { grid-column: 1 / -1; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 10px 11px; border: 1px solid #ddd4ce; border-radius: 8px; color: var(--ink); background: white; }
.field textarea { min-height: 95px; resize: vertical; line-height: 1.5; }
.field small { color: var(--muted); font-size: .6rem; }
.phone-inputs { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 8px; }
.phone-inputs label { display: grid; gap: 5px; }
.phone-inputs small { font-size: .56rem; letter-spacing: .03em; }
.check { display: flex; align-items: center; gap: 7px; color: #5f5651; font-size: .7rem; }
.choice-group { display: flex; flex-wrap: wrap; gap: 14px; padding: 13px; border: 1px solid #e1d8d2; border-radius: 8px; }
.choice-group legend { padding: 0 5px; color: var(--muted); font-size: .64rem; }
.deadline-checkboxes { display: flex; flex-wrap: wrap; gap: 8px; }
.deadline-checkboxes label { padding: 6px 8px; border-radius: 6px; background: #f7f3ef; font-size: .66rem; }
.form-note { margin: 0; color: var(--muted); font-size: .68rem; line-height: 1.55; }
.review-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 17px; }
.review-summary > div { padding: 12px; border-radius: 8px; background: #f8f4f1; }
.review-summary small, .review-summary strong { display: block; }
.review-summary small { color: var(--muted); font-size: .6rem; }
.review-summary strong { margin-top: 5px; font-size: .73rem; }
.review-list { display: grid; gap: 12px; }
.review-reminder { padding: 15px; border: 1px solid var(--line); border-radius: 9px; }
.review-reminder.skipped { opacity: .58; background: #f7f3f0; }
.review-reminder-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.review-reminder-head strong, .review-reminder-head small { display: block; }
.review-reminder-head strong { font-size: .75rem; }
.review-reminder-head small { margin-top: 4px; color: var(--muted); font-size: .62rem; }
.review-options { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 10px; }
.detail-header { display: flex; align-items: center; gap: 13px; }
.detail-header > div { flex: 1; }
.detail-header strong { font-size: .9rem; }
.detail-header p { margin: 5px 0 0; color: var(--muted); font-size: .7rem; }
.contact-strip { display: flex; flex-wrap: wrap; gap: 9px; padding: 12px; margin: 17px 0; border-radius: 8px; background: #f8f4f1; }
.contact-strip span { min-width: 140px; flex: 1; color: var(--muted); font-size: .61rem; }
.contact-strip strong { display: block; margin-top: 4px; color: var(--ink); font-size: .69rem; }
.detail-columns { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; }
.mini-list { display: grid; gap: 7px; }
.mini-list button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink); background: white; text-align: left; }
.mini-list strong, .mini-list small { display: block; }
.mini-list strong { font-size: .7rem; }
.mini-list small { margin-top: 4px; color: var(--muted); font-size: .61rem; }
.timeline { display: grid; }
.timeline > div { display: flex; gap: 10px; padding: 0 0 15px; }
.timeline i { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--gold); }
.timeline strong, .timeline small { display: block; }
.timeline strong { font-size: .68rem; }
.timeline small { margin-top: 4px; color: var(--muted); font-size: .6rem; }
.service-detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.service-detail-head p { margin: 9px 0 0; color: var(--muted); font-size: .7rem; }
.service-detail-head > div:last-child { text-align: right; }
.service-detail-head small, .service-detail-head strong { display: block; }
.service-detail-head small { color: var(--muted); font-size: .61rem; }
.service-detail-head strong { margin-top: 5px; }
.workflow-actions { display: flex; gap: 9px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.approval-message-field { margin-bottom: 10px; }
.send-now-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; padding: 14px; border: 1px solid #e1d8d2; border-radius: 8px; background: #f8f4ef; }
.send-now-panel strong, .send-now-panel small { display: block; }
.send-now-panel small { margin-top: 4px; color: var(--muted); font-size: .63rem; line-height: 1.45; }
.button.send-now { flex: 0 0 auto; color: white; border-color: #1f7a55; background: #1f7a55; }
.button.send-now:hover { background: #176243; }
.button.send-now:disabled { cursor: default; opacity: .65; box-shadow: none; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 40; max-width: 360px; padding: 12px 15px; border-radius: 8px; color: white; background: #3b3431; box-shadow: 0 12px 30px rgba(35,28,25,.25); opacity: 0; transform: translateY(8px); pointer-events: none; transition: .2s; font-size: .72rem; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--danger); }
.loading { min-height: 280px; display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--muted); font-size: .75rem; }
.loading span { width: 18px; height: 18px; border: 2px solid #decfca; border-top-color: var(--rose); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-banner { padding: 15px; border: 1px solid #e1bbb5; border-radius: 8px; color: var(--danger); background: #fff5f3; }

.auth-page { min-height: 100vh; }
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.auth-brand-panel { display: flex; flex-direction: column; padding: 35px 48px; color: #f5eee8; background: linear-gradient(145deg, #302a28, #493733); }
.auth-brand { padding: 0; }
.auth-copy { max-width: 590px; margin: auto 0; }
.auth-copy h1 { margin-bottom: 20px; font-size: clamp(2.4rem, 5vw, 4.4rem); line-height: 1.07; letter-spacing: -.055em; }
.auth-copy > p:last-child { max-width: 500px; color: #cfc2bb; font-size: .9rem; line-height: 1.7; }
.auth-form-panel { position: relative; display: grid; place-items: center; padding: 35px; }
.auth-card { width: min(100%, 440px); padding: 30px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; padding: 4px; margin-bottom: 27px; border-radius: 9px; background: #f2ece8; }
.auth-tabs button { padding: 9px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: .72rem; }
.auth-tabs button.active { color: var(--rose-dark); background: white; box-shadow: 0 2px 8px rgba(55,42,36,.06); font-weight: 600; }
.auth-form { display: grid; gap: 15px; }
.auth-form h2 { margin-bottom: 6px; font-size: 1.35rem; }
.auth-form > div > p:last-child { margin: 0; color: var(--muted); font-size: .72rem; }
.auth-form .button { width: 100%; margin-top: 4px; }
.auth-error { min-height: 18px; margin: 15px 0 0; color: var(--danger); font-size: .68rem; }
.demo-entry { display: block; margin-top: 13px; color: var(--rose-dark); text-align: center; text-decoration: none; font-size: .7rem; }

.segmented { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 18px; border-radius: 9px; background: #ebe4de; }
.segmented button { padding: 9px 14px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: .72rem; }
.segmented button.active { color: white; background: var(--rose-dark); box-shadow: 0 4px 12px rgba(80,50,45,.12); }
.filter-panel { margin-bottom: 18px; }
.filters-grid { display: grid; grid-template-columns: repeat(5,minmax(120px,1fr)) auto auto; align-items: end; gap: 11px; padding: 17px; }
.filters-grid label { display: grid; gap: 6px; color: var(--muted); font-size: .65rem; }
.filters-grid input, .filters-grid select { min-width: 0; height: 38px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); background: white; }
.history-filters { grid-template-columns: repeat(6,minmax(100px,1fr)) auto auto auto; }
.inline-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.inline-select { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: .66rem; }
.inline-select select { padding: 6px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.collapsed-summary { padding: 28px 20px; color: var(--muted); text-align: center; font-size: .75rem; }
.collapsed-summary strong { color: var(--ink); }
.action-row { border: 0; border-bottom: 1px solid #eee8e3; color: inherit; background: transparent; text-align: left; }
.action-row:hover { background: #fbf7f3; }
.client-cards { display: grid; gap: 10px; }
.client-card { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.client-card-main { min-width: 0; display: flex; align-items: center; gap: 13px; }
.client-card-main p, .client-card-main small { display: block; margin: 3px 0 0; color: var(--muted); font-size: .68rem; }
.client-name { padding: 0; border: 0; color: var(--ink); background: transparent; font-weight: 700; text-align: left; }
.client-name:hover { color: var(--rose-dark); text-decoration: underline; }
.client-profile { display: flex; align-items: center; gap: 15px; margin-bottom: 18px; }
.client-profile > div { flex: 1; }
.client-profile h3, .client-profile p { margin-bottom: 4px; }
.children-summary { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; margin-bottom: 20px; border-radius: 8px; background: #f8f3ef; font-size: .69rem; }
.children-summary span { padding: 6px 9px; border-radius: 999px; background: white; }
.child-entry { display: grid; grid-template-columns: 1fr 1fr auto; align-items: end; gap: 10px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px; }
.template-list { display: grid; gap: 11px; }
.template-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 18px 20px; }
.template-row h3 { margin: 8px 0 4px; font-size: .88rem; }
.template-row p, .template-row small { margin: 0; color: var(--muted); font-size: .68rem; }
.template-message { margin-top: 10px; }
.calendar-panel { margin-bottom: 18px; }
.calendar-layout { display: grid; grid-template-columns: 290px minmax(0,1fr); gap: 28px; align-items: center; }
.mini-calendar { width: 280px; }
.calendar-title-row { display: grid; grid-template-columns: 34px 1fr 34px; align-items: center; gap: 8px; margin-bottom: 4px; }
.calendar-title { margin: 0; font-weight: 700; text-align: center; text-transform: capitalize; }
.calendar-nav { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; color: var(--rose-dark); background: var(--surface-strong); font-size: 1.2rem; line-height: 1; }
.calendar-nav:hover { color: white; border-color: var(--rose); background: var(--rose); }
.calendar-today { display: block; margin: 0 auto 10px; padding: 3px 8px; border: 0; color: var(--rose-dark); background: transparent; font-size: .58rem; font-weight: 600; }
.calendar-today:hover { text-decoration: underline; }
.calendar-week, .calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 4px; }
.calendar-week span { color: var(--muted); font-size: .58rem; text-align: center; }
.calendar-day { position: relative; aspect-ratio: 1; display: grid; place-items: center; border: 1px solid transparent; border-radius: 7px; color: var(--ink); background: #faf7f4; font-size: .65rem; }
.calendar-day:hover, .calendar-day.selected { border-color: var(--rose); background: var(--rose-soft); }
.calendar-day.has-items::after { content: ""; position: absolute; bottom: 4px; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.calendar-day i { position: absolute; top: 2px; right: 3px; color: var(--rose-dark); font-size: .48rem; font-style: normal; }
.calendar-copy h2 { margin-bottom: 8px; }
.calendar-copy > p:last-of-type { max-width: 650px; color: var(--muted); font-size: .74rem; line-height: 1.6; }
.approval-list, .birthday-list { display: grid; gap: 14px; }
.approval-card { padding: 20px; }
.focused-card { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(172,138,79,.13), var(--shadow); }
.automatic-note { padding: 10px 12px; margin-top: 12px; border-radius: 7px; color: var(--green); background: var(--green-soft); font-size: .68rem; }
.channel-timeline { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 13px; }
.channel-timeline span { padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; color: var(--muted); font-size: .64rem; }
.channel-timeline strong { display: block; margin-bottom: 3px; color: var(--ink); }
.birthday-card { overflow: hidden; }
.birthday-main { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 17px 20px; }
.birthday-main p { margin: 4px 0 0; color: var(--muted); font-size: .68rem; }
.birthday-main > div:last-child { text-align: right; }
.birthday-main strong, .birthday-main small { display: block; }
.birthday-main small { margin-top: 3px; color: var(--muted); font-size: .64rem; }
.birthday-detail { padding: 16px 20px 20px; border-top: 1px solid var(--line); background: #fbf8f5; }
.history-layout { display: grid; grid-template-columns: minmax(0,1.25fr) minmax(320px,.75fr); gap: 18px; }
.history-row { display: grid; grid-template-columns: 150px minmax(0,1fr) auto; align-items: center; gap: 14px; padding: 13px 16px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: white; text-align: left; }
.history-row:hover, .history-row.selected { background: var(--rose-soft); }
.history-row strong, .history-row small { display: block; }
.history-row strong { font-size: .7rem; }
.history-row small { margin-top: 3px; color: var(--muted); font-size: .62rem; }
.history-detail { align-self: start; position: sticky; top: 88px; }
.detail-list { display: grid; gap: 10px; margin: 0 0 16px; }
.detail-list div { display: grid; grid-template-columns: 100px 1fr; gap: 10px; }
.detail-list dt { color: var(--muted); font-size: .64rem; }
.detail-list dd { margin: 0; font-size: .68rem; }
.message-editor { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.variable-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.variable-buttons button { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; color: var(--rose-dark); background: #fff; font: .62rem ui-monospace,monospace; }
.variable-list { display: grid; gap: 8px; }
.variable-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.variable-row:last-child { padding-bottom: 0; border-bottom: 0; }
.variable-row > div { min-width: 0; }
.variable-row code { display: inline-block; margin: 0; }
.variable-row small { display: block; margin-top: 4px; color: var(--muted); font-size: .56rem; line-height: 1.35; }
.email-preview { min-height: 230px; padding: 28px; border: 10px solid #f2eadb; border-radius: 14px; background: white; box-shadow: inset 0 0 0 1px #e7dac7; }
.email-preview strong { display: block; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.email-preview p { margin: 22px 0; font-size: .76rem; line-height: 1.7; }
.email-preview small { color: var(--muted); }
.integration-placeholder { padding: 24px; border: 1px dashed #d8c9bd; border-radius: 10px; text-align: center; }
.integration-placeholder span { display: block; color: var(--gold); font-size: 2rem; }
.integration-placeholder strong { display: block; margin: 8px 0; }
.integration-placeholder p { margin: 0; color: var(--muted); font-size: .7rem; line-height: 1.55; }

html[data-theme="dark"] .topbar { background: rgba(29, 16, 37, .94); }
html[data-theme="dark"] :is(.button.secondary, .search, .select-control, dialog, .icon-button, .field input, .field select, .field textarea, .deadline-chips > span, .inline-form input, .mini-list button, .auth-card, .auth-tabs button.active, .filters-grid input, .filters-grid select, .inline-select select, .children-summary span, .history-row, .variable-buttons button, .email-preview) { color: var(--ink); border-color: var(--line); background: var(--surface-strong); }
html[data-theme="dark"] :is(.panel-head, .reminder-row, .message-card .card-actions, .modal-head, .modal-actions, .action-row) { border-color: var(--line); }
html[data-theme="dark"] :is(.field, .check) { color: var(--muted); }
html[data-theme="dark"] :is(.message-box, .message-box.preview, .birthday-detail, .automation-toggle, .review-summary > div, .review-reminder.skipped, .contact-strip, .children-summary, .calendar-day, .action-row:hover) { color: var(--ink); border-color: var(--line); background: var(--surface-strong); }
html[data-theme="dark"] .send-now-panel { color: var(--ink); border-color: var(--line); background: var(--surface-strong); }
html[data-theme="dark"] .message-box p { color: var(--muted); }
html[data-theme="dark"] .info-banner { color: var(--gold); border-color: #6b4d25; background: var(--gold-soft); }
html[data-theme="dark"] .button.danger { border-color: var(--danger); background: var(--danger-soft); }
html[data-theme="dark"] :is(.auth-tabs, .segmented, .deadline-checkboxes label) { background: #25152f; }
html[data-theme="dark"] .email-preview { border-color: var(--gold-soft); box-shadow: inset 0 0 0 1px #6b4d25; }
html[data-theme="dark"] .integration-status.online { color: var(--green); background: var(--green-soft); }
html[data-theme="dark"] .error-banner { border-color: var(--danger); background: var(--danger-soft); }
html[data-theme="dark"] .calendar-day:hover,
html[data-theme="dark"] .calendar-day.selected,
html[data-theme="dark"] .history-row:hover,
html[data-theme="dark"] .history-row.selected { background: var(--rose-soft); }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .settings-grid { grid-template-columns: 1fr; }
  .settings-section:first-child { grid-row: auto; }
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-grid, .history-filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .history-layout { grid-template-columns: 1fr; }
  .history-detail { position: static; }
  .live-context { display: none; }
}
@media (max-width: 780px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; width: 252px; transform: translateX(-100%); transition: transform .22s; box-shadow: 20px 0 50px rgba(30,24,22,.25); }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: block; }
  .topbar { height: 62px; padding: 0 16px; }
  .breadcrumb { margin-right: auto; }
  .notification-pill { display: none; }
  .workspace { padding: 26px 15px 42px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .stats, .service-grid, .message-library, .message-layout, .detail-columns, .auth-layout { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; flex-direction: column; }
  .search { min-width: 0; width: 100%; }
  .approval-summary { flex-direction: column; }
  .approval-date { text-align: left; }
  .report-form, .form-grid, .review-summary { grid-template-columns: 1fr; }
  .filters-grid, .history-filters, .calendar-layout, .message-editor { grid-template-columns: 1fr; }
  .mini-calendar { width: 100%; max-width: 300px; }
  .client-card, .template-row, .birthday-main { align-items: flex-start; flex-direction: column; }
  .child-entry { grid-template-columns: 1fr; }
  .history-row { grid-template-columns: 1fr auto; }
  .history-row > span:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .field.full, .choice-group.full, .form-note.full { grid-column: auto; }
  .variable-panel { position: static; }
  .auth-brand-panel { min-height: 420px; padding: 28px 24px; }
  .auth-copy h1 { font-size: 2.5rem; }
  .auth-form-panel { padding: 24px 15px 40px; }
  .theme-toggle-floating { top: 14px; right: 15px; }
  .reminder-row { align-items: flex-start; flex-wrap: wrap; }
}
