:root {
  --ink: #17231f;
  --muted: #68756f;
  --line: #dfe6e2;
  --surface: #ffffff;
  --canvas: #f5f8f6;
  --brand: #146a4e;
  --brand-strong: #0d4d39;
  --brand-soft: #e7f4ee;
  --success: #217a50;
  --warning: #a05b10;
  --warning-soft: #fff3df;
  --danger: #b33b35;
  --danger-soft: #fdebea;
  --info: #335c9a;
  --info-soft: #eaf1fb;
  --shadow: 0 18px 50px rgba(23, 35, 31, .08);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.loading-screen { min-height: 100vh; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.spinner { width: 32px; height: 32px; border: 3px solid var(--line); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.login-page { min-height: calc(100vh - 49px); display: grid; grid-template-columns: minmax(320px, .95fr) minmax(440px, 1.05fr); }
.login-story { padding: clamp(48px, 8vw, 112px); background: var(--brand-strong); color: white; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-story::after { content: ""; width: 520px; height: 520px; border: 90px solid rgba(255,255,255,.06); border-radius: 50%; position: absolute; right: -260px; bottom: -250px; }
.brand-mark { display: inline-flex; align-items: center; padding: 14px 18px; border-radius: 12px; background: white; position: relative; z-index: 1; }
.login-company-logo { display: block; width: clamp(220px, 23vw, 310px); height: auto; }
.login-story h1 { max-width: 640px; font-size: clamp(38px, 5vw, 68px); line-height: 1.08; margin: 80px 0 22px; letter-spacing: -.04em; position: relative; z-index: 1; }
.login-story p { max-width: 540px; color: rgba(255,255,255,.72); font-size: 18px; line-height: 1.75; position: relative; z-index: 1; }
.source-note { font-size: 13px !important; border-top: 1px solid rgba(255,255,255,.18); padding-top: 22px; margin-top: 48px; }
.login-panel { padding: 56px clamp(32px, 7vw, 112px); display: grid; align-content: center; background: var(--surface); }
.login-card { max-width: 520px; width: 100%; margin: auto; }
.eyebrow { color: var(--brand); font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.login-card h2 { font-size: 34px; margin: 10px 0 8px; letter-spacing: -.02em; }
.subtle { color: var(--muted); line-height: 1.6; }
.demo-accounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 28px 0; }
.demo-account { border: 1px solid var(--line); background: var(--canvas); border-radius: 12px; padding: 12px; text-align: left; cursor: pointer; transition: .18s ease; }
.demo-account:hover, .demo-account:focus { border-color: var(--brand); background: var(--brand-soft); outline: none; }
.demo-account strong, .demo-account span { display: block; }
.demo-account span { margin-top: 4px; color: var(--muted); font-size: 12px; }
.field { display: grid; gap: 8px; margin: 18px 0; }
.field label { font-size: 14px; font-weight: 650; }
.field small { color: var(--muted); font-size: 11px; line-height: 1.5; }
.field input, .field select, .field textarea, .filters input, .filters select { width: 100%; border: 1px solid var(--line); border-radius: 11px; padding: 13px 14px; background: white; color: var(--ink); outline: none; }
.field input:focus, .field select:focus, .field textarea:focus, .filters input:focus, .filters select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20,106,78,.1); }
.primary-button, .secondary-button, .danger-button, .ghost-button { border: 0; border-radius: 11px; padding: 12px 17px; font-weight: 700; cursor: pointer; transition: .18s ease; }
.primary-button { background: var(--brand); color: white; }
.primary-button:hover { background: var(--brand-strong); transform: translateY(-1px); }
.secondary-button { background: var(--brand-soft); color: var(--brand-strong); }
.danger-button { background: var(--danger-soft); color: var(--danger); }
.danger-button:hover { background: #f5d7d4; }
.ghost-button { background: transparent; color: var(--muted); }
.wide { width: 100%; padding-block: 14px; }
.form-error { min-height: 20px; color: var(--danger); font-size: 14px; }

.site-footer { min-height: 49px; display: flex; align-items: center; justify-content: center; gap: 16px; padding: 13px 20px; border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: 12px; }
.site-footer a { color: var(--brand-strong); }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--brand); text-decoration: underline; }

.app-header { height: 68px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(20px, 4vw, 56px); position: sticky; top: 0; z-index: 10; }
.app-brand { display: flex; gap: 12px; align-items: center; font-weight: 760; }
.header-company-logo { display: block; width: 142px; height: auto; }
.product-name { padding-left: 12px; border-left: 1px solid var(--line); white-space: nowrap; }
.header-user { display: flex; align-items: center; gap: 14px; }
.header-nav-link { color: var(--brand-strong); background: var(--brand-soft); border-radius: 9px; padding: 9px 12px; font-size: 13px; font-weight: 700; }
.header-nav-link:hover { background: #d9ede4; }
.user-copy { text-align: right; }
.user-copy strong, .user-copy span { display: block; }
.user-copy span { color: var(--muted); font-size: 12px; margin-top: 2px; }
.page { max-width: 1440px; margin: auto; padding: 36px clamp(20px, 4vw, 56px) 72px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.page-heading h1 { font-size: clamp(28px, 3vw, 42px); letter-spacing: -.035em; margin: 5px 0 4px; }
.page-heading p { margin: 0; color: var(--muted); }
.compact-heading { margin: 22px 0 18px; }
.page-action { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; flex-wrap: wrap; }
.back-link { color: var(--brand); font-weight: 700; font-size: 14px; }
.role-banner { display: flex; align-items: center; gap: 12px; padding: 13px 16px; margin: -12px 0 20px; border: 1px solid #cce1d7; border-radius: 13px; background: var(--brand-soft); color: var(--brand-strong); font-size: 13px; }
.role-banner strong { padding-right: 12px; border-right: 1px solid #b8d5c8; }

.form-page { max-width: 1040px; }
.form-card { display: grid; gap: 18px; }
.form-section { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: 0 9px 32px rgba(23,35,31,.04); }
.form-section-header { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding-bottom: 14px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }
.form-section-header h2 { margin: 0; font-size: 19px; }
.form-section-header span { color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
.form-grid .field { margin: 14px 0 0; }
.field textarea { min-height: 104px; resize: vertical; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; }
.form-actions .secondary-button { display: inline-flex; align-items: center; justify-content: center; }

.account-page { max-width: 1500px; }
.account-layout { display: grid; grid-template-columns: minmax(360px, .78fr) minmax(560px, 1.22fr); gap: 18px; align-items: start; }
.account-create-panel { position: sticky; top: 88px; }
.account-input { display: flex; align-items: stretch; }
.account-input input { border-radius: 11px 0 0 11px; }
.account-input span { display: flex; align-items: center; border: 1px solid var(--line); border-left: 0; border-radius: 0 11px 11px 0; padding: 0 13px; background: #f1f5f3; color: var(--brand-strong); font-weight: 700; white-space: nowrap; }
.brand-fieldset { border: 0; padding: 12px 0 0; margin: 0; }
.brand-fieldset legend { font-size: 14px; font-weight: 650; margin-bottom: 8px; }
.checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.checkbox-card { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; cursor: pointer; }
.checkbox-card:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.checkbox-card input { accent-color: var(--brand); }
.checkbox-card span, .checkbox-card strong, .checkbox-card small { display: block; }
.checkbox-card small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.security-hint { margin: 17px 0 0; padding: 11px 12px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-strong); font-size: 12px; line-height: 1.55; }
.account-list-panel { min-width: 0; }
.account-list-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; }
.account-list-heading h2, .account-list-heading p { margin: 0; }
.account-list-heading h2 { font-size: 19px; }
.account-list-heading p { margin-top: 4px; color: var(--muted); font-size: 12px; }
.account-list-heading > strong { font-size: 28px; color: var(--brand); }
.account-table { min-width: 680px; }
.account-table .staff-status-action { padding: 8px 12px; }
.account-table button:disabled { cursor: not-allowed; opacity: .5; }
.table-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.table-actions button { padding: 8px 11px; white-space: nowrap; }
.hidden { display: none !important; }
.inline-action-panel { padding: 20px; border-top: 1px solid var(--line); background: #fbfdfc; }
.inline-action-panel .form-section-header { margin-bottom: 8px; }
.inline-action-panel .form-section-header h2 span { color: var(--brand-strong); }
.password-card { max-width: 620px; }

.brand-page { max-width: 1600px; }
.brand-layout { display: grid; grid-template-columns: minmax(640px, 1.05fr) minmax(480px, .95fr); gap: 24px; align-items: start; }
.brand-create-panel { position: sticky; top: 88px; }
.brand-rule-heading { display: grid; gap: 5px; margin: 22px 0 11px; }
.brand-rule-heading strong { font-size: 15px; }
.brand-rule-heading span { color: var(--muted); font-size: 11px; line-height: 1.55; }
.brand-rule-groups { display: grid; gap: 14px; }
.brand-rule-group { padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #fcfefd; }
.brand-rule-group-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.brand-rule-group-title strong { color: var(--brand-strong); font-size: 14px; }
.brand-rule-group-title span { color: var(--muted); font-size: 10px; }
.brand-rule-editor { display: grid; gap: 8px; }
.brand-rule-row { display: grid; grid-template-columns: 64px minmax(105px, .8fr) minmax(120px, .9fr) minmax(175px, 1.35fr); gap: 9px; align-items: end; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: #f8fbf9; }
.brand-rule-row > strong { align-self: center; color: var(--brand-strong); font-size: 13px; }
.brand-rule-row label { display: grid; gap: 5px; }
.brand-rule-row label span { color: var(--muted); font-size: 10px; }
.brand-rule-row input, .brand-rule-row select { min-width: 0; width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px; background: white; }

@media (max-width: 1280px) {
  .brand-layout { grid-template-columns: 1fr; }
  .brand-create-panel { position: static; }
}
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-heading h2, .section-heading p { margin: 0; }
.section-heading h2 { font-size: 20px; }
.section-heading p { margin-top: 5px; color: var(--muted); font-size: 12px; }
.section-heading > strong { font-size: 28px; color: var(--brand); }
.brand-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.brand-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 13px; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 9px 32px rgba(23,35,31,.04); }
.brand-card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.brand-card-actions .primary-button, .brand-card-actions .secondary-button { padding: 9px 12px; white-space: nowrap; }
.brand-card-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand-strong); font-weight: 800; }
.brand-card-copy { min-width: 0; }
.brand-card-copy h3, .brand-card-copy span { display: block; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-card-copy h3 { font-size: 16px; }
.brand-card-copy span { margin-top: 4px; color: var(--muted); font-size: 10px; }

.rules-page { max-width: 1500px; }
.rule-warning { display: flex; align-items: flex-start; gap: 14px; padding: 15px 17px; border: 1px solid #ead0a2; border-radius: 13px; background: var(--warning-soft); color: #755024; font-size: 13px; line-height: 1.6; }
.rule-warning strong { white-space: nowrap; }
.mode-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 14px 0 20px; }
.mode-grid article { padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.mode-grid strong, .mode-grid span { display: block; }
.mode-grid span { margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.rule-filter { display: flex; align-items: end; gap: 10px; max-width: 460px; margin-bottom: 14px; }
.rule-filter .field { flex: 1; margin: 0; }
.rules-table { min-width: 1040px; }
.rule-mode-select { min-width: 190px; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; background: white; color: var(--ink); }
.rule-number-input { display: flex; align-items: stretch; min-width: 120px; }
.rule-number-input input { min-width: 78px; width: 100%; border: 1px solid var(--line); border-radius: 9px 0 0 9px; padding: 9px 10px; outline: none; }
.rule-number-input input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(20,106,78,.1); }
.rule-number-input span { display: flex; align-items: center; padding: 0 9px; border: 1px solid var(--line); border-left: 0; border-radius: 0 9px 9px 0; background: var(--canvas); color: var(--muted); font-size: 12px; }
.rule-save { padding: 9px 13px; }

.summary-grid { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 14px; margin-bottom: 20px; }
.summary-card, .metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 18px 20px; }
.summary-card span, .metric-card span { color: var(--muted); font-size: 13px; }
.summary-card strong, .metric-card strong { display: block; font-size: 28px; margin-top: 9px; letter-spacing: -.03em; }
.summary-card small { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.summary-card-link { color: inherit; text-decoration: none; transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.summary-card-link:hover, .summary-card-link:focus-visible { border-color: var(--green-500); box-shadow: 0 10px 24px rgba(25, 92, 69, .1); transform: translateY(-1px); outline: none; }
.dashboard-page { max-width: 1560px; }
.dashboard-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); gap: 12px; margin-bottom: 16px; }
.dashboard-definition { display: flex; align-items: flex-start; gap: 14px; padding: 14px 17px; margin-bottom: 16px; border: 1px solid #cce1d7; border-radius: 13px; background: var(--brand-soft); color: var(--brand-strong); font-size: 13px; line-height: 1.6; }
.dashboard-definition strong { white-space: nowrap; }
.service-summary-panel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-bottom: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--line); }
.service-summary-panel > div { padding: 17px 19px; background: var(--surface); }
.service-summary-panel span, .service-summary-panel strong, .service-summary-panel small { display: block; }
.service-summary-panel span, .service-summary-panel small { color: var(--muted); font-size: 11px; }
.service-summary-panel strong { margin: 7px 0 4px; font-size: 18px; }
.dashboard-stack { display: grid; gap: 18px; }
.dashboard-table-panel { padding: 0; overflow: hidden; }
.dashboard-table-panel .panel-header { padding: 18px 20px; margin: 0; }
.dashboard-table-panel .panel-header h2 { margin-bottom: 4px; }
.dashboard-table-panel .panel-header > strong { color: var(--brand); font-size: 26px; }
.dashboard-table { min-width: 980px; }
.dashboard-table td:first-child { min-width: 170px; }
.dashboard-table td:nth-child(3) { min-width: 220px; }
.continuation-rule-panel { margin-bottom: 18px; }
.continuation-rule-form { display: flex; align-items: end; gap: 14px; }
.continuation-rule-form .field { width: min(320px, 100%); }
.table-link { color: var(--brand-strong); font-weight: 750; }
.table-link:hover { text-decoration: underline; }
.rate-cell { display: grid; gap: 6px; }
.rate-cell > div:first-child { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.rate-cell > div:first-child span { color: var(--muted); font-size: 11px; }
.rate-track { height: 7px; overflow: hidden; border-radius: 999px; background: #e7ece9; }
.rate-track i { display: block; height: 100%; border-radius: inherit; }
.rate-track i.good { background: var(--success); }
.rate-track i.watch { background: #c28b2e; }
.rate-track i.risk { background: var(--danger); }
.scope-note { margin: 14px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.filters { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(135px, .8fr)) auto; gap: 10px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 15px; margin-bottom: 16px; }
.table-shell { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow-x: auto; box-shadow: var(--shadow); }
.client-table { width: 100%; min-width: 1220px; border-collapse: collapse; }
.latest-follow-up { min-width: 210px; max-width: 290px; }
.follow-up-preview { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.client-table th { background: #f1f5f3; color: var(--muted); text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .03em; padding: 13px 15px; }
.client-table td { border-top: 1px solid var(--line); padding: 15px; vertical-align: middle; font-size: 14px; }
.client-row { cursor: pointer; transition: background .15s ease; }
.client-row:hover { background: #f8fbf9; }
.clients-page { max-width: 1680px; padding-inline: clamp(20px, 2.5vw, 40px); }
.clients-page .summary-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.clients-page .client-table { min-width: 1180px; table-layout: fixed; }
.clients-page col:nth-child(1) { width: 12%; }
.clients-page col:nth-child(2) { width: 9%; }
.clients-page col:nth-child(3) { width: 8%; }
.clients-page col:nth-child(4) { width: 11%; }
.clients-page col:nth-child(5) { width: 12%; }
.clients-page col:nth-child(6) { width: 17%; }
.clients-page col:nth-child(7) { width: 7%; }
.clients-page col:nth-child(8) { width: 24%; }
.clients-page .client-row { height: var(--client-row-height, auto); }
.clients-page .client-table th, .clients-page .client-table td { padding: 14px 12px; overflow-wrap: anywhere; }
.clients-page .client-table th { white-space: nowrap; }
.clients-page .client-table td .badge { white-space: normal; }
.clients-page .client-table td:nth-child(7) { white-space: nowrap; font-variant-numeric: tabular-nums; }
.clients-page .client-table .latest-follow-up, .clients-page .client-reminders { min-width: 0; max-width: none; }
.clients-page .client-row:nth-child(even) { background: #fbfcfb; }
.clients-page .client-row:hover, .clients-page .client-row:focus-visible { background: #f0f7f3; }
.clients-page .client-tag-groups > div { display: grid; grid-template-columns: 52px minmax(0, 1fr); gap: 8px; align-items: start; }
.clients-page .reminder-heading { padding-top: 5px; margin: 0; white-space: nowrap; }
.clients-page .reminder-empty { padding-top: 4px; font-size: 11px; }
.clients-page .reminder-tag { max-width: 100%; }
.clients-page .reminder-tag .badge { line-height: 1.5; }
.clients-page .client-tag-groups { margin-top: 0; }
.client-service-status { margin: 7px 0; }
.renewal-queue { margin-block: 22px; }
.renewal-counts { display: flex; flex-wrap: wrap; gap: 10px 22px; font-size: 13px; color: var(--muted); }
.renewal-counts strong { color: var(--ink); margin-left: 5px; }
.renewal-count-button { border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; background: white; color: var(--muted); font: inherit; cursor: pointer; }
.renewal-count-button[aria-pressed="true"] { background: var(--brand-soft); border-color: var(--brand-strong); color: var(--brand-strong); }
.renewal-count-button:focus-visible { outline: 2px solid var(--brand-strong); outline-offset: 2px; }
.renewal-count-button:disabled { opacity: .6; cursor: wait; }
.renewal-filters { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.renewal-filters label { display: grid; gap: 6px; font-size: 12px; min-width: 170px; }
.renewal-filters select { padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: white; }
.renewal-table { min-width: 900px; }
.renewal-queue .table-shell { max-height: 480px; overflow: auto; }
.renewal-table thead th { position: sticky; top: 0; z-index: 1; background: #f5f8f6; }
.renewal-table td { overflow-wrap: anywhere; }
.renewal-table td:first-child { min-width: 140px; }
.renewal-empty { padding: 18px; }
.renewal-confirm { display: flex; align-items: start; gap: 8px; font-size: 12px; line-height: 1.7; margin: 14px 0; }
.renewal-confirm input { margin-top: 4px; flex-shrink: 0; }
.renewal-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.renewal-actions button { flex: 1 1 130px; font-size: 12px; }
.renewal-next { padding: 12px; background: var(--brand-soft); border-radius: 10px; color: var(--brand-strong); font-size: 13px; line-height: 1.7; }
.service-renewal-panel summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.client-name { font-weight: 750; font-size: 15px; }
.muted-line { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; }
.number { font-variant-numeric: tabular-nums; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.client-reminders { min-width: 240px; max-width: 340px; }
.client-tag-groups { display: grid; gap: 8px; margin-top: 8px; font-size: 12px; }
.reminder-heading { display: block; font-size: 11px; font-weight: 700; margin-bottom: 5px; }
.reminder-empty { color: var(--muted); font-size: 12px; }
.reminder-policy summary { cursor: pointer; font-size: 12px; }
.reminder-legacy p { margin: 5px 0 0; color: var(--muted); }
.detail-hero .reminder-legacy p { color: rgba(255,255,255,.8); }
.manual-tag-manager { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 14px; }
.manual-tag-manager h3 { font-size: 15px; margin: 0; }
.manual-tag-manager summary { cursor: pointer; color: var(--brand-strong); font-size: 13px; font-weight: 650; margin: 12px 0; }
.manual-tag-category { border: 0; padding: 0; margin: 15px 0; min-width: 0; }
.manual-tag-category legend { padding: 0; margin-bottom: 8px; font-size: 12px; color: var(--muted); }
.tag-choice-list { display: flex; gap: 8px; flex-wrap: wrap; }
.tag-choice { position: relative; cursor: pointer; }
.tag-choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tag-choice span { display: inline-flex; align-items: center; gap: 5px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: white; font-size: 12px; }
.tag-choice span::before { content: "＋"; }
.tag-choice input:checked + span { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-strong); }
.tag-choice input:checked + span::before { content: "✓"; }
.tag-choice input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 2px; }
.tag-choice input:disabled + span { opacity: .55; cursor: wait; }
.manual-tag-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--info-soft); color: var(--info); border-radius: 9px; padding: 5px 8px; font-size: 12px; }
.manual-tag-chip button { border: 0; color: inherit; background: transparent; cursor: pointer; font-size: 18px; padding: 2px 5px; }
.manual-tag-history { list-style: none; padding: 0; margin: 0; font-size: 12px; max-height: 240px; overflow-y: auto; }
.manual-tag-history li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.manual-tag-history span { display: block; margin-top: 4px; color: var(--muted); }
.legacy-tag-review { display: grid; gap: 9px; margin-top: 16px; padding: 13px; border: 1px solid #ead5b4; border-radius: 12px; background: #fffaf1; }
.legacy-tag-review h4 { margin: 0; color: #755024; font-size: 13px; }
.legacy-tag-review-row { display: grid; gap: 9px; padding-top: 10px; border-top: 1px solid #efdfc6; }
.legacy-tag-review-row:first-of-type { border-top: 0; }
.legacy-tag-review-row strong, .legacy-tag-review-row span { display: block; }
.legacy-tag-review-row strong { font-size: 13px; }
.legacy-tag-review-row span { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.legacy-tag-review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.legacy-tag-review-actions .secondary-button { padding: 8px 10px; font-size: 11px; }
.legacy-tag-review-actions .text-button { font-size: 11px; }
.tag-review-complete { margin: 14px 0 0; padding: 10px 12px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-strong); font-size: 12px; }
.client-tag-groups p, .reminder-policy p { font-size: 12px; line-height: 1.6; max-width: 760px; }
.reminder-tag .badge { white-space: normal; overflow-wrap: anywhere; }
.reminder-policy { margin: 12px 0; }
.detail-hero .reminder-empty { color: rgba(255,255,255,.8); }
.detail-hero .hero-tags { min-width: 0; }
.badge { display: inline-flex; align-items: center; min-height: 25px; padding: 4px 8px; border-radius: 999px; background: #eef2f0; color: #45524c; font-size: 11px; font-weight: 700; white-space: nowrap; }
.badge.success { background: var(--brand-soft); color: var(--success); }
.badge.warning { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.empty-state { padding: 68px 24px; text-align: center; color: var(--muted); }
.data-review-page { max-width: 1600px; }
.data-review-summary { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.review-principle { display: flex; align-items: flex-start; gap: 14px; padding: 14px 17px; margin: -8px 0 18px; border: 1px solid #ead5b4; border-radius: 13px; background: #fffaf1; color: #755024; font-size: 13px; line-height: 1.65; }
.review-principle strong { white-space: nowrap; }
.data-review-filters { grid-template-columns: minmax(180px, 1fr) minmax(200px, 1fr) auto; }
.data-review-table { min-width: 1120px; }
.data-review-table td { vertical-align: top; }
.data-review-table td:first-child { min-width: 180px; }
.data-review-table td:nth-child(2) { min-width: 210px; }
.data-review-table td:nth-child(4) { min-width: 220px; max-width: 320px; }
.data-review-table td:last-child { min-width: 190px; }
.data-review-badges { align-items: flex-start; }
.review-fact { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.review-complete { color: var(--success); font-size: 12px; font-weight: 700; }
.review-actions { display: grid; justify-items: start; gap: 8px; }
.review-action-note { color: var(--muted); font-size: 11px; line-height: 1.5; }

.detail-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; padding: 25px; border-radius: 18px; color: white; background: linear-gradient(120deg, var(--brand-strong), #1c7c5d); margin: 18px 0; }
.detail-hero h1 { margin: 4px 0 8px; font-size: 34px; }
.detail-meta { display: flex; gap: 16px; flex-wrap: wrap; color: rgba(255,255,255,.78); font-size: 14px; }
.hero-tags { justify-content: flex-end; max-width: 420px; }
.hero-tags .badge { background: rgba(255,255,255,.15); color: white; }
.hero-tags .reminder-current .badge { background: #fff2d6; color: #755011; }
.hero-actions { display: grid; justify-items: end; gap: 14px; }
.cycle-tabs { display: flex; gap: 8px; overflow-x: auto; padding: 5px 0 14px; }
.cycle-tab { border: 1px solid var(--line); background: white; color: var(--muted); padding: 10px 14px; border-radius: 10px; cursor: pointer; white-space: nowrap; }
.cycle-tab.active { background: var(--brand); color: white; border-color: var(--brand); }
.metric-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 18px; }
.metric-card strong { font-size: 22px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(320px, .8fr); gap: 18px; align-items: start; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 21px; box-shadow: 0 9px 32px rgba(23,35,31,.04); }
.panel-header { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin-bottom: 16px; }
.panel h2 { font-size: 18px; margin: 0; }
.panel small { color: var(--muted); }
.trend-chart { width: 100%; min-height: 250px; display: block; }
.chart-grid { stroke: #e6ece8; stroke-width: 1; }
.chart-line { fill: none; stroke: var(--brand); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: white; stroke: var(--brand); stroke-width: 2; }
.waist-chart .chart-line, .waist-chart .chart-dot { stroke: #467f9b; }
.chart-label { font-size: 10px; fill: var(--muted); }
.milestone-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; }
.milestone { border: 1px solid var(--line); border-radius: 12px; padding: 13px; min-height: 122px; }
.milestone strong, .milestone span { display: block; }
.milestone strong { margin: 8px 0 5px; }
.milestone span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.milestone.met { border-color: #acd9c4; background: var(--brand-soft); }
.milestone.not-met { border-color: #e9b8b5; background: var(--danger-soft); }
.daily-scroll { overflow-x: auto; max-height: 520px; }
.daily-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.daily-table th { position: sticky; top: 0; background: #f1f5f3; color: var(--muted); text-align: left; padding: 10px; }
.daily-table td { border-top: 1px solid var(--line); padding: 10px; vertical-align: top; }
.daily-table tr.exception { background: #fffaf1; }
.daily-date-button, .text-button { border: 0; background: transparent; color: var(--brand); cursor: pointer; font: inherit; padding: 4px; text-decoration: underline; text-underline-offset: 3px; }
.daily-date-button { white-space: nowrap; }
.daily-date-button[aria-expanded="true"] { background: var(--brand-soft); border-radius: 5px; font-weight: 700; }
.daily-date-button:focus-visible, .text-button:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.daily-note-row { background: #f5fbf8; }
.daily-note-row[hidden] { display: none; }
.day-note-content { display: grid; gap: 8px; margin-top: 10px; }
.daily-raw-note { overflow-wrap: anywhere; min-width: 100px; max-width: 240px; white-space: pre-wrap; }
.timeline { display: grid; gap: 13px; }
.timeline-item { border-left: 2px solid var(--line); padding-left: 13px; }
.timeline-item strong { display: block; font-size: 14px; }
.timeline-item span { color: var(--muted); font-size: 12px; }
.profile-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.profile-item { padding: 11px 12px; background: #f5f8f6; border-radius: 10px; }
.profile-item span, .profile-item strong { display: block; }
.profile-item span { color: var(--muted); font-size: 11px; margin-bottom: 5px; }
.profile-item strong { font-size: 14px; font-weight: 720; white-space: pre-wrap; overflow-wrap: anywhere; }
.export-content-grid { margin-top: 18px; }
.exception-list { display: grid; gap: 9px; max-height: 390px; overflow: auto; }
.exception-item { padding: 11px 12px; background: var(--warning-soft); border-radius: 10px; }
.exception-item strong { font-size: 13px; }
.exception-item p { margin: 5px 0 0; color: #755024; font-size: 12px; line-height: 1.5; }
.note-list { display: grid; gap: 10px; max-height: 480px; overflow: auto; }
.note { border: 1px solid var(--line); border-radius: 11px; padding: 12px; }
.note.follow-up { border-color: #a9d6c2; background: #f5fbf8; }
.note p { margin: 7px 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.55; font-size: 13px; }
.note-meta { color: var(--muted); font-size: 11px; }
.note-form { border-bottom: 1px solid var(--line); margin-bottom: 16px; padding-bottom: 16px; }
.assignment-details { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.assignment-details summary { cursor: pointer; color: var(--brand); font-weight: 700; }
#selected-daily-summary { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-form textarea { min-height: 92px; resize: vertical; }
.daily-entry-panel { border-color: #a9d6c2; background: linear-gradient(180deg, #fbfffd, #f5fbf8); }
.daily-entry-panel .panel-header { align-items: start; }
.daily-entry-panel .panel-header small { display: block; margin-top: 5px; line-height: 1.45; }
.evaluation-profile-panel { border-color: #b9d7ca; background: linear-gradient(180deg, #ffffff, #f6fbf8); }
.evaluation-profile-panel .panel-header { align-items: start; }
.evaluation-profile-panel .panel-header small { display: block; margin-top: 5px; line-height: 1.45; }
.operation-panel { padding: 0; overflow: hidden; }
.operation-panel > .panel-header, .operation-panel > form, .operation-panel > p { margin-left: 21px; margin-right: 21px; }
.operation-panel > .panel-header { margin-top: 21px; }
.operation-panel > form { margin-bottom: 21px; }
.operation-panel details > summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 19px 21px; cursor: pointer; list-style: none; }
.operation-panel details > summary::-webkit-details-marker { display: none; }
.operation-panel details > summary span, .operation-panel details > summary strong, .operation-panel details > summary small { display: block; }
.operation-panel details > summary small { margin-top: 5px; }
.operation-panel details > summary > span:last-child { color: var(--brand); font-size: 12px; font-weight: 700; white-space: nowrap; }
.details-form { padding: 0 21px 21px; border-top: 1px solid var(--line); }
.ready-operation { border-color: #a9d6c2; background: linear-gradient(180deg, #fff, #f5fbf8); }
.no-divider { border-top: 0; padding-top: 0; margin-bottom: 21px !important; }
.profile-help { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.compact-grid { gap: 0 12px; }
.compact-grid .field { margin-top: 11px; }
.read-only-hint { padding-top: 14px; margin: 14px 0 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: .64; transform: none; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; background: var(--ink); color: white; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translateY(0); }

.import-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin: 18px 0 22px; }
.import-steps article { align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; display: flex; gap: 12px; padding: 16px; }
.import-steps article > span { align-items: center; background: var(--brand-soft); border-radius: 50%; color: var(--brand-strong); display: inline-flex; flex: 0 0 30px; font-weight: 800; height: 30px; justify-content: center; }
.import-steps strong { display: block; margin-bottom: 4px; }
.import-steps p { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; }
.import-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 22px; }
.import-download-panel { align-items: center; display: flex; gap: 24px; justify-content: space-between; }
.import-download-panel h2 { margin: 4px 0 6px; }
.import-download-panel p { color: var(--muted); margin: 0; }
.file-drop { align-items: center; background: #F7FBF9; border: 1.5px dashed #9BC7B5; border-radius: 16px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; justify-content: center; min-height: 190px; padding: 26px; text-align: center; transition: background .18s ease, border-color .18s ease; }
.file-drop:hover, .file-drop:focus-within { background: #EFF8F4; border-color: var(--brand); }
.file-drop input { height: 1px; opacity: 0; overflow: hidden; position: absolute; width: 1px; }
.file-drop-icon { background: var(--brand-soft); border-radius: 10px; color: var(--brand-strong); font-size: 12px; font-weight: 800; letter-spacing: .08em; padding: 10px 13px; }
.file-drop small { color: var(--muted); line-height: 1.6; max-width: 500px; }
.import-upload-panel form { display: grid; gap: 14px; }
.import-errors { display: grid; gap: 10px; max-height: 360px; overflow-y: auto; }
.import-errors article { background: #FFF6F3; border: 1px solid #F0CFC4; border-radius: 12px; padding: 12px 14px; }
.import-errors article strong { color: #9C3C24; }
.import-errors ul { color: #6E3324; line-height: 1.6; margin: 7px 0 0; padding-left: 20px; }
.import-success { align-items: flex-start; background: #EAF7F0; border: 1px solid #B8DDCA; border-radius: 14px; display: grid; gap: 8px; margin-top: 16px; padding: 16px; }
.import-success[hidden] { display: none; }
.import-success strong { color: var(--brand-strong); font-size: 18px; }
.import-success span { color: var(--muted); line-height: 1.6; }
.import-success a { justify-self: start; margin-top: 4px; }
.compact-reference-table { border-collapse: collapse; min-width: 100%; width: 100%; }
.compact-reference-table th, .compact-reference-table td { border-bottom: 1px solid var(--line); font-size: 12px; padding: 10px 8px; text-align: left; vertical-align: top; }
.compact-reference-table th { color: var(--muted); font-weight: 600; }

@media (max-width: 1100px) {
  .dashboard-summary-grid { grid-template-columns: repeat(3, 1fr); }
  .service-summary-panel { grid-template-columns: repeat(2, 1fr); }
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .content-grid { grid-template-columns: minmax(0, 1fr); }
  .milestone-grid { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: repeat(2, 1fr); }
  .filters input { grid-column: span 2; }
  .account-layout { grid-template-columns: 1fr; }
  .account-create-panel { position: static; }
  .brand-layout { grid-template-columns: 1fr; }
  .brand-create-panel { position: static; }
  .brand-rule-row { grid-template-columns: 54px repeat(3, minmax(0, 1fr)); }
  .mode-grid { grid-template-columns: repeat(2, 1fr); }
  .import-layout { grid-template-columns: 1fr; }
}

.admin-dialog { width: min(680px, calc(100vw - 32px)); max-height: 88vh; border: 1px solid #dce7e3; border-radius: 18px; padding: 26px; color: #203d35; box-shadow: 0 24px 70px #143d3533; }
.admin-dialog::backdrop { background: #143d3570; }
.admin-dialog .brand-fieldset { margin-block: 18px; }
.admin-dialog .form-actions { flex-wrap: wrap; }
.staff-brands-action { margin-top: 10px; }
.audit-filters { display: flex; flex-wrap: wrap; align-items: end; }
.audit-filters label { display: grid; gap: 6px; flex: 1 1 170px; font-size: 13px; }
.audit-filters select, .audit-filters input { width: 100%; min-width: 0; }
.audit-table { min-width: 960px; }
.audit-table td { vertical-align: top; padding-block: 18px; }
.audit-time { white-space: nowrap; font-variant-numeric: tabular-nums; }
.audit-details { display: grid; gap: 6px; min-width: 210px; max-width: 420px; overflow-wrap: anywhere; }
.audit-details small { color: #6d8079; margin-right: 10px; }
.audit-pagination { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-top: 18px; }

@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: calc(100vh - 49px); padding: 32px 22px; }
  .site-footer { flex-direction: column; gap: 4px; text-align: center; }
  .demo-accounts { grid-template-columns: 1fr; }
  .app-header { padding-inline: 16px; }
  .app-brand span:last-child { display: none; }
  .user-copy { display: none; }
  .header-nav-link { padding: 8px 9px; }
  .header-user { max-width: calc(100vw - 72px); overflow-x: auto; }
  .page { padding: 24px 14px 56px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-actions { justify-content: stretch; }
  .page-actions .page-action { flex: 1; }
  .role-banner { align-items: flex-start; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .form-section { padding: 18px; }
  .form-section-header { display: block; }
  .form-section-header span { display: block; margin-top: 6px; }
  .checkbox-grid { grid-template-columns: 1fr; }
  .brand-grid { grid-template-columns: 1fr; }
  .brand-rule-row { grid-template-columns: 1fr; }
  .mode-grid { grid-template-columns: 1fr; }
  .rule-warning { display: grid; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .summary-grid { grid-template-columns: repeat(2, 1fr); }
  .clients-page .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .service-summary-panel { grid-template-columns: 1fr; }
  .dashboard-definition { display: grid; }
  .continuation-rule-form { align-items: stretch; flex-direction: column; }
  .filters { grid-template-columns: 1fr; }
  .filters input { grid-column: auto; }
  .table-shell { box-shadow: none; overflow-x: auto; }
  .detail-hero { display: block; }
  .hero-tags { justify-content: flex-start; margin-top: 18px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .milestone-grid { grid-template-columns: repeat(2, 1fr); }
  .import-steps { grid-template-columns: 1fr; }
  .import-download-panel { align-items: stretch; flex-direction: column; }
}
