/* Component system tokens */
:root {
    --ink: #122238;
    --ink-soft: #42546a;
    --navy: #10253f;
    --navy-light: #1b3553;
    --paper: #f3f1ec;
    --surface: #fffefa;
    --surface-muted: #fbfaf7;
    --surface-field: #f8f7f3;
    --line: #dedbd3;
    --line-soft: #ebe7df;
    --line-control: #d4d3ce;
    --muted: #768393;
    --accent: #e7684b;
    --accent-soft: #f9e3dc;
    --mint: #83c7b2;
    --state-success-text: #245b4b;
    --state-success-strong: #126b21;
    --state-success-bg: #dff1eb;
    --state-success-soft: #f3fbf8;
    --state-warning-text: #87520a;
    --state-warning-strong: #8a5c16;
    --state-warning-bg: #ffe2a8;
    --state-warning-soft: #f7ecd5;
    --state-danger-text: #9b1f22;
    --state-danger-soft: #f9e3dc;
    --state-danger-bg: #fde1dc;
    --state-info-text: #0f5596;
    --state-info-bg: #cfe7ff;
    --state-muted-bg: #f1f0ec;
    --state-muted-strong: #5b6470;
    --radius-control: 9px;
    --radius-field: 10px;
    --radius-card: 12px;
    --radius-panel: 14px;
    --radius-pill: 999px;
    --focus-ring: 0 0 0 3px rgba(18,34,56,.08);
    --shadow: 0 18px 44px rgba(21, 35, 52, .07);
    font-family: Inter, Aptos, "Segoe UI", Helvetica, Arial, sans-serif;
    color: var(--ink);
    background: var(--paper);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--paper); }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
:is(.search-form button, .save-button, .login-submit, .daily-focus a, .secondary-button, .mini-link, .empty-state-action, .page-button, .account-filter-chip, .daily-summary-item, .daily-task-item, .crm-account-table .row-action a, .account-edit-trigger, .crm-modal__close, .help-close, .icon-action):focus-visible {
    outline: 0;
    border-color: var(--ink);
    box-shadow: var(--focus-ring);
}
:is(.form-field input, .form-field textarea, .form-field select, .search-box, .daily-replan-form input, .inline-link-form select):focus,
:is(.search-box, .permission-toggle):focus-within {
    outline: 0;
    border-color: var(--ink);
    box-shadow: var(--focus-ring);
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar {
    position: sticky; top: 0; height: 100vh; padding: 30px 22px 24px;
    display: flex; flex-direction: column; color: #fff; background: var(--navy);
}
.brand { display: block; margin-bottom: 46px; }
.brand img { display: block; width: min(190px, 100%); height: auto; }
.main-nav { display: grid; gap: 8px; }
.nav-item {
    min-height: 48px; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px;
    padding: 0 12px; border-radius: 10px; color: #b8c3cf; font-size: 14px;
}
.nav-item.is-active { color: #fff; background: var(--navy-light); box-shadow: inset 3px 0 0 var(--accent); }
.nav-item.is-disabled { opacity: .55; }
.nav-item small { font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.nav-icon { font-size: 18px; }
.sync-card {
    margin-top: auto; padding: 15px 14px; display: flex; align-items: center; gap: 11px;
    border: 1px solid rgba(255,255,255,.12); border-radius: 12px; background: rgba(255,255,255,.04);
}
.sync-card div { display: flex; flex-direction: column; gap: 3px; }
.sync-card strong { font-size: 12px; }
.sync-card small { color: #9eacbc; font-size: 10px; }
.sync-light { width: 9px; height: 9px; flex: 0 0 auto; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(131,199,178,.12); }
.logout-form { margin-top: 9px; }
.logout-form button { width: 100%; padding: 10px 12px; display: flex; align-items: center; gap: 9px; border: 0; color: #9eacbc; background: transparent; cursor: pointer; font-size: 11px; text-align: left; }
.logout-form button:hover { color: #fff; }

.main-content { min-width: 0; padding: 36px clamp(24px, 4vw, 62px) 56px; }
.topbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 30px; }
.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: .14em; }
h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 4vw, 56px); font-weight: 500; letter-spacing: -.045em; line-height: .95; }
.page-intro { margin: 13px 0 0; color: var(--ink-soft); font-size: 14px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding-top: 5px; }
.user-chip > span { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: #fff; font-size: 11px; font-weight: 800; }
.user-chip div { display: flex; flex-direction: column; gap: 2px; }
.user-chip strong { font-size: 12px; }
.user-chip small { color: var(--muted); font-size: 10px; }

.metric-grid { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1.35fr; gap: 12px; margin-bottom: 20px; }
.metric-card { min-height: 128px; padding: 20px; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,254,250,.72); }
.metric-card strong { margin: auto 0 5px; font-size: clamp(24px, 2.1vw, 34px); letter-spacing: -.045em; }
.metric-card small { color: var(--muted); font-size: 11px; }
.metric-label { color: var(--ink-soft); font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.metric-card--ink { border-color: var(--ink); color: #fff; background: var(--ink); }
.metric-card--ink .metric-label, .metric-card--ink small { color: #bfc8d2; }
.metric-card--accent { border-color: #efb5a5; background: var(--accent-soft); }

.data-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.panel-toolbar { min-height: 78px; padding: 14px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.search-form { flex: 1; display: flex; align-items: center; gap: 9px; }
.search-box { width: min(540px, 100%); height: 46px; display: flex; align-items: center; gap: 10px; padding: 0 14px; border: 1px solid var(--line-control); border-radius: var(--radius-field); background: var(--surface-field); }
.search-box span { color: var(--muted); font-size: 22px; }
.search-box input { min-width: 0; width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search-form button { height: 46px; padding: 0 18px; border: 0; border-radius: var(--radius-field); color: #fff; background: var(--ink); cursor: pointer; font-size: 12px; font-weight: 750; }
.clear-search { color: var(--accent); font-size: 12px; font-weight: 700; }
.result-count { flex: 0 0 auto; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
.result-count strong { color: var(--ink); }
.account-filter-bar { min-height: 54px; padding: 10px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); background: var(--surface-muted); }
.account-filter-chip { min-height: 34px; padding: 0 10px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid #e1ddd5; border-radius: var(--radius-pill); color: var(--ink-soft); background: #fff; font-size: 11px; font-weight: 850; }
.account-filter-chip strong { min-width: 22px; padding: 3px 6px; border-radius: var(--radius-pill); color: var(--muted); background: var(--state-muted-bg); font-size: 10px; font-weight: 850; text-align: center; }
.account-filter-chip:hover { border-color: #c9c4ba; color: var(--ink); }
.account-filter-chip:focus-visible { outline: 0; border-color: var(--ink); box-shadow: var(--focus-ring); }
.account-filter-chip.is-active { border-color: var(--ink); color: #fff; background: var(--ink); }
.account-filter-chip.is-active strong { color: var(--ink); background: #fff; }
.account-filter-clear { margin-left: auto; color: var(--accent); font-size: 11px; font-weight: 850; }
.account-filter-clear:focus-visible { outline: 0; text-decoration: underline; text-underline-offset: 3px; }
.account-filter-note { min-height: 36px; padding: 9px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-bottom: 1px solid #ebe7df; color: var(--ink-soft); background: #fffefa; font-size: 11px; line-height: 1.45; }
.account-filter-note span { padding: 3px 7px; border-radius: var(--radius-pill); color: var(--ink); background: var(--state-muted-bg); font-size: 10px; font-weight: 850; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 12px 18px; color: var(--muted); background: #faf9f6; font-size: 10px; font-weight: 800; text-align: left; text-transform: uppercase; letter-spacing: .055em; white-space: nowrap; }
.sortable-header { display: inline-flex; align-items: center; gap: 7px; color: inherit; }
.sortable-header span { color: #a8adb2; font-size: 12px; font-weight: 500; transition: color .16s ease; }
.sortable-header:hover, th[aria-sort="ascending"] .sortable-header, th[aria-sort="descending"] .sortable-header { color: var(--ink); }
th[aria-sort="ascending"] .sortable-header span, th[aria-sort="descending"] .sortable-header span { color: var(--accent); }
.sortable-header--numeric { justify-content: flex-end; width: 100%; }
td { height: 68px; padding: 10px 18px; border-top: 1px solid #ebe9e4; color: var(--ink-soft); font-size: 12px; }
.crm-account-table { table-layout: fixed; min-width: 0; }
.crm-account-table th, .crm-account-table td { padding-inline: 12px; }
.crm-account-table .col-account { width: auto; }
.crm-account-table .col-tasks { width: 96px; }
.crm-account-table .col-contact { width: 118px; }
.crm-account-table .col-people { width: 116px; }
.crm-account-table .col-stage { width: 128px; }
.crm-account-table .col-activity { width: 132px; }
.crm-account-table .col-origin { width: 72px; text-align: center; }
.crm-account-table .col-action { width: 64px; }
.crm-account-table td:nth-child(7) { text-align: center; }
.crm-account-table td:nth-child(7) .source-chip-list { justify-content: center; }
tbody tr { transition: background .16s ease; }
tbody tr:hover { background: #fbf6f2; }
.crm-account-table tbody tr.account-row td { transition: background .16s ease; }
.crm-account-table tbody tr.account-row--urgent td { background: #fff7f5; }
.crm-account-table tbody tr.account-row--today td { background: #fffaf1; }
.crm-account-table tbody tr.account-row--uncontactable:not(.account-row--urgent):not(.account-row--today) td { background: #fffdf9; }
.crm-account-table tbody tr.account-row--incomplete:not(.account-row--urgent):not(.account-row--today):not(.account-row--uncontactable) td { background: var(--surface-muted); }
.crm-account-table tbody tr.account-row:hover td { background: #f7f8fa; }
.customer-cell { min-width: 300px; display: flex; align-items: center; gap: 12px; }
.customer-cell > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.customer-cell strong { overflow: hidden; color: var(--ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.customer-link:hover strong { color: var(--accent); }
.customer-cell small { overflow: hidden; max-width: 390px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.customer-cell .customer-location { color: #8b8176; }
.sales-rep-chip { width: fit-content; max-width: 100%; padding: 4px 8px; display: inline-flex; align-items: center; border-radius: var(--radius-pill); color: var(--state-success-text); background: var(--state-success-bg); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .045em; line-height: 1.1; }
.avatar { width: 36px; height: 36px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 11px 4px 11px 4px; color: #735142; background: #f1ddd2; font-size: 10px; font-weight: 850; }
td > small { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }
.location { color: var(--ink); }
.numeric { text-align: right; font-variant-numeric: tabular-nums; }
.source-chip-list { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.source-chip { min-width: 26px; min-height: 26px; padding: 5px 8px; display: inline-flex; align-items: center; justify-content: center; border-radius: 7px; color: var(--state-success-text); background: var(--state-success-bg); font-size: 11px; font-weight: 850; line-height: 1; }
.source-chip--sage { color: var(--state-info-text); background: var(--state-info-bg); }
.source-chip--brevo { color: #5231a0; background: #dfd3ff; }
.source-chip--web { color: var(--state-success-strong); background: #cff0cf; }
.source-chip--manual { color: var(--state-muted-strong); background: #eceff1; }
.source-chip--muted { color: var(--muted); background: #eeece7; }
.signal-badge { min-height: 28px; padding: 0 9px; display: inline-flex; align-items: center; border-radius: var(--radius-pill); font-size: 10px; font-weight: 850; line-height: 1; white-space: nowrap; }
.data-pill { font-size: 10px; }
.data-pill--confirmed { color: var(--state-success-strong); background: #ccefcf; }
.data-pill--provisional { color: var(--state-warning-text); background: var(--state-warning-bg); }
.data-pill--empty { color: var(--ink-soft); background: #f3f1ec; border: 1px solid #e1ddd5; }
.contact-badge--ok { color: var(--state-success-strong); background: #ccefcf; }
.contact-badge--stop { color: #8e3d2a; background: var(--state-danger-soft); }
.contact-badge--empty { color: var(--ink-soft); background: #f3f1ec; border: 1px solid #e1ddd5; }
.task-signal { color: var(--state-success-text); background: var(--state-success-bg); font-size: 11px; }
.task-signal--danger { color: var(--state-danger-text); background: var(--state-danger-bg); }
.task-signal--warn { color: var(--state-warning-strong); background: var(--state-warning-soft); }
.task-signal--muted { color: var(--muted); background: #eeece7; }
.crm-account-table .customer-cell { min-width: 0; }
.crm-account-table .status-pill--planned { max-width: 100%; display: inline-flex; align-items: center; overflow: hidden; color: var(--ink-soft); background: var(--state-muted-bg); line-height: 1; text-overflow: ellipsis; white-space: nowrap; }
.order-badge { min-width: 30px; display: inline-flex; justify-content: center; padding: 5px 8px; border-radius: var(--radius-pill); color: var(--state-success-text); background: var(--state-success-bg); font-weight: 800; }
.order-badge.is-empty { color: var(--muted); background: #eeece7; }
.date-value { white-space: nowrap; }
.amount { color: var(--ink); font-weight: 750; white-space: nowrap; }
.row-action { width: 48px; padding-left: 0; }
.row-action a { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #fff; transition: .16s ease; }
.row-action a:hover { border-color: var(--ink); color: #fff; background: var(--ink); transform: translateX(2px); }
.crm-account-table .row-action { width: 64px; padding-inline: 4px 8px; text-align: right; }
.crm-account-table .row-action a { width: 52px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; gap: 0; border-radius: var(--radius-pill); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .02em; }
.crm-account-table .row-action a:hover { transform: none; }
.crm-account-table .row-action a span { display: none; }
.crm-account-table .row-action a:focus-visible { outline: 0; border-color: var(--ink); box-shadow: var(--focus-ring); }

.pagination { min-height: 64px; padding: 12px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.pagination > div { display: flex; align-items: center; gap: 12px; }
.page-button { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; }
.page-button:hover:not(.is-disabled) { border-color: var(--ink); }
.page-button.is-disabled { pointer-events: none; opacity: .35; }
.empty-state { padding: 70px 24px; text-align: center; }
.empty-state > span { font-size: 34px; color: var(--accent); }
.empty-state h2 { margin: 10px 0 6px; font-family: Georgia, serif; font-size: 25px; font-weight: 500; }
.empty-state p { margin: 0; color: var(--muted); font-size: 13px; }
.empty-state-action { margin-top: 14px; min-height: 36px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius-pill); color: var(--ink); background: #fff; font-size: 11px; font-weight: 850; }
.empty-state-action:hover { border-color: var(--ink); background: var(--state-muted-bg); }
.empty-state-action:focus-visible { outline: 0; border-color: var(--ink); box-shadow: var(--focus-ring); }
.empty-state--compact { padding-block: 46px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* Daily home */
.daily-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 22px; }
.daily-header h1 { font-family: Inter, Aptos, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 44px; font-weight: 820; letter-spacing: 0; line-height: 1; }
.daily-kicker { margin: 0 0 8px; color: #245b4b; font-size: 12px; font-weight: 850; }
.daily-focus { min-height: 92px; margin-bottom: 14px; padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.daily-focus div { min-width: 0; display: grid; gap: 4px; }
.daily-focus span { color: var(--ink-soft); font-size: 11px; font-weight: 850; }
.daily-focus strong { color: var(--ink); font-size: 23px; line-height: 1.15; letter-spacing: 0; }
.daily-focus p { max-width: 760px; margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.daily-focus a { min-height: 38px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--ink); border-radius: var(--radius-control); color: #fff; background: var(--ink); font-size: 11px; font-weight: 850; white-space: nowrap; }
.daily-focus a:hover { background: var(--navy-light); }
.daily-focus a:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.daily-focus--danger { border-color: #edc5ba; background: #fff6f3; }
.daily-focus--warn { border-color: #ead2a9; background: #fffaf1; }
.daily-focus--normal { border-color: #cfded9; background: #f7fbf9; }
.daily-focus--ok { border-color: #cbded7; background: var(--state-success-soft); }
.daily-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.daily-summary-item { min-height: 92px; padding: 14px 16px; display: grid; align-content: space-between; border: 1px solid var(--line); border-radius: 12px; background: #fff; transition: border-color .16s ease, background .16s ease, transform .16s ease; }
.daily-summary-item:hover { border-color: #c9c4ba; background: var(--surface-muted); transform: translateY(-1px); }
.daily-summary-item:focus-visible { outline: 0; border-color: var(--ink); box-shadow: var(--focus-ring); }
.daily-summary-item span { color: var(--ink-soft); font-size: 11px; font-weight: 850; }
.daily-summary-item strong { color: var(--ink); font-size: 30px; font-weight: 820; letter-spacing: 0; }
.daily-summary-item small { color: var(--muted); font-size: 10px; font-weight: 750; }
.daily-summary-item--urgent { border-color: #edc5ba; background: #fff6f3; }
.daily-summary-item--today { border-color: #c9dfd7; background: #f3fbf8; }
.daily-workspace { display: grid; grid-template-columns: minmax(380px, .44fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.daily-queue, .daily-detail { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.daily-queue-toolbar { min-height: 72px; padding: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; border-bottom: 1px solid #ece8df; }
.daily-queue-toolbar h2, .daily-detail-title h2 { margin: 0; color: var(--ink); font-size: 22px; line-height: 1.15; letter-spacing: 0; }
.daily-queue-toolbar p, .daily-detail-title p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.daily-detail-title a { color: var(--ink); font-weight: 850; }
.daily-detail-title a:hover { color: var(--accent); }
.daily-filter-form { padding: 12px 16px 14px; display: flex; align-items: flex-end; gap: 10px; border-bottom: 1px solid #ece8df; background: var(--surface-muted); }
.daily-filter-form .form-field { flex: 1; margin: 0; }
.daily-queue-groups { max-height: calc(100vh - 285px); overflow-y: auto; padding: 12px; display: grid; gap: 14px; }
.daily-queue-group header { margin-bottom: 8px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.daily-queue-group h3 { margin: 0; font-size: 13px; }
.daily-queue-group p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.4; }
.daily-queue-group header > span { min-width: 28px; height: 26px; padding: 0 8px; display: inline-grid; place-items: center; border-radius: var(--radius-pill); color: var(--ink-soft); background: #f0eee8; font-size: 11px; font-weight: 850; }
.daily-queue-group--overdue header > span { color: var(--state-danger-text); background: var(--state-danger-bg); }
.daily-queue-group--today header > span { color: var(--state-success-text); background: var(--state-success-bg); }
.daily-queue-group--unscheduled header > span { color: var(--state-warning-text); background: var(--state-warning-bg); }
.daily-group-empty { padding: 10px 12px; border: 1px dashed #d8d3ca; border-radius: 10px; background: #fff; }
.daily-task-list { display: grid; gap: 7px; }
.daily-task-item { min-height: 58px; padding: 10px 10px 10px 12px; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid #ebe7df; border-radius: 11px; background: #fff; transition: border-color .16s ease, background .16s ease; }
.daily-task-item:hover, .daily-task-item.is-active { border-color: #aebed6; background: #f4f8ff; }
.daily-task-item:focus-visible { outline: 0; border-color: var(--ink); box-shadow: var(--focus-ring); }
.daily-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #8da0b6; }
.daily-task-item--danger .daily-status-dot { background: #bf4b37; }
.daily-task-item--warn .daily-status-dot { background: #c98219; }
.daily-task-item--normal .daily-status-dot { background: var(--state-success-text); }
.daily-task-item--empty .daily-status-dot { background: #9ca5af; }
.daily-task-copy { min-width: 0; display: grid; gap: 3px; }
.daily-task-copy strong, .daily-task-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.daily-task-copy strong { color: var(--ink); font-size: 12px; }
.daily-task-copy small { color: var(--muted); font-size: 10px; }
.daily-task-date { color: var(--ink-soft); font-size: 10px; font-weight: 850; white-space: nowrap; }
.daily-detail { min-height: 560px; padding: 22px; display: flex; flex-direction: column; gap: 18px; background: #fff; }
.daily-detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.daily-note { padding: 14px 15px; border: 1px solid #e9e2d7; border-radius: 11px; color: var(--ink-soft); background: #fffaf2; font-size: 13px; line-height: 1.6; }
.daily-context-grid { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid #ebe7df; border-radius: 12px; overflow: hidden; }
.daily-context-grid div { min-width: 0; padding: 14px; border-right: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: var(--surface-muted); }
.daily-context-grid div:nth-child(3n) { border-right: 0; }
.daily-context-grid div:nth-last-child(-n+3) { border-bottom: 0; }
.daily-context-grid dt { margin-bottom: 5px; color: var(--muted); font-size: 10px; font-weight: 850; }
.daily-context-grid dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 13px; line-height: 1.45; }
.daily-action-panel { padding: 14px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 9px; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--surface-muted); }
.daily-action-panel form { margin: 0; }
.daily-replan-form { display: flex; align-items: flex-end; gap: 8px; }
.daily-replan-form label { display: grid; gap: 6px; }
.daily-replan-form span { color: var(--ink-soft); font-size: 10px; font-weight: 850; }
.daily-replan-form input { width: 146px; height: 38px; padding: 0 10px; border: 1px solid var(--line-control); border-radius: var(--radius-control); color: var(--ink); background: #fff; }
.daily-empty-state { min-height: 450px; display: grid; place-content: center; justify-items: center; text-align: center; }
.daily-empty-state > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--state-success-text); background: var(--state-success-bg); font-size: 20px; font-weight: 850; }
.daily-empty-state h2 { margin: 14px 0 6px; font-size: 22px; }
.daily-empty-state p { max-width: 360px; margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }

/* Customer detail */
.detail-page { max-width: 1280px; margin: 0 auto; }
.back-link { display: inline-flex; margin-bottom: 27px; color: var(--ink-soft); font-size: 12px; font-weight: 700; }
.back-link:hover { color: var(--accent); }
.flash-message { margin: -10px 0 22px; padding: 12px 14px; border-radius: 10px; font-size: 12px; font-weight: 750; }
.flash-message--success { border: 1px solid #cbded7; color: var(--state-success-text); background: #edf7f3; }
.flash-message--error { border: 1px solid #e7afa0; color: #8e3d2a; background: var(--state-danger-soft); }
.flash-message--floating { position: fixed; top: 18px; right: clamp(18px, 3vw, 38px); z-index: 42; width: min(380px, calc(100vw - 36px)); margin: 0; box-shadow: 0 14px 34px rgba(18,34,56,.14); }
.account-command { margin-bottom: 16px; padding: 20px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .36fr); gap: 18px; align-items: stretch; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.account-command__main { min-width: 0; display: flex; align-items: flex-start; gap: 16px; }
.account-command__main > div { min-width: 0; }
.account-command__label { margin: 0 0 7px; color: var(--state-success-text); font-size: 12px; font-weight: 850; }
.account-command h1 { max-width: 980px; font-family: Inter, Aptos, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 34px; font-weight: 820; letter-spacing: 0; line-height: 1.08; }
.account-command__meta { margin-top: 13px; display: flex; flex-wrap: wrap; gap: 7px; }
.account-command__meta span { padding: 7px 9px; border-radius: var(--radius-pill); color: var(--ink-soft); background: var(--state-muted-bg); font-size: 11px; font-weight: 800; line-height: 1; }
.account-command__status { min-width: 0; padding: 16px; display: grid; align-content: center; gap: 7px; border: 1px solid #d8d4cc; border-radius: var(--radius-card); background: var(--surface-muted); }
.account-command__status span { width: fit-content; padding: 6px 9px; border-radius: var(--radius-pill); font-size: 10px; font-weight: 850; line-height: 1; }
.account-command__status strong { color: var(--ink); font-size: 15px; line-height: 1.35; }
.account-command__status small { overflow-wrap: anywhere; color: var(--ink-soft); font-size: 12px; line-height: 1.45; }
.account-command__status--ok { border-color: #cbded7; background: var(--state-success-soft); }
.account-command__status--ok span { color: var(--state-success-text); background: var(--state-success-bg); }
.account-command__status--stop { border-color: #e7afa0; background: #fff6f3; }
.account-command__status--stop span { color: #8e3d2a; background: var(--state-danger-soft); }
.account-command__status--empty span { color: var(--ink-soft); background: #eceff1; }
.account-work-grid { margin-bottom: 20px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.account-action-card { min-width: 0; min-height: 248px; padding: 16px; display: flex; flex-direction: column; gap: 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
.account-action-card--primary { grid-column: span 2; border-color: #d4d0c7; background: #fffdf8; }
.account-action-card--sage { background: #f9fbfd; }
.account-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.account-card-head span { color: var(--ink-soft); font-size: 11px; font-weight: 850; }
.account-card-head h2 { margin: 5px 0 0; color: var(--ink); font-size: 20px; line-height: 1.2; letter-spacing: 0; }
.account-action-card > p { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.account-task-line { color: var(--ink); font-weight: 750; }
.account-task-note { padding: 11px 12px; border-radius: var(--radius-field); background: var(--surface-muted); }
.account-complete-form { margin: 0; }
.account-action-links { margin-top: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.account-mini-list { margin: 0; display: grid; gap: 9px; }
.account-mini-list div { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; align-items: baseline; }
.account-mini-list dt { color: var(--muted); font-size: 10px; font-weight: 850; }
.account-mini-list dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 12px; line-height: 1.45; }
.customer-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 28px; margin-bottom: 24px; }
.customer-hero--crm { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.customer-identity { min-width: 0; display: flex; align-items: center; gap: 20px; }
.customer-identity h1 { max-width: 870px; font-size: clamp(34px, 4vw, 52px); line-height: 1.02; }
.hero-avatar { width: 74px; height: 74px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 22px 7px 22px 7px; color: #6e4739; background: #efd5c9; font-size: 19px; font-weight: 850; }
.legal-name { margin: 10px 0 0; color: var(--muted); font-size: 12px; }
.source-chip-list--detail { margin-top: 14px; }
.source-chip-list--detail .source-chip { min-width: auto; padding-inline: 13px; font-size: 12px; }
.customer-state { flex: 0 0 auto; margin-top: 8px; padding: 9px 12px; display: flex; align-items: center; gap: 8px; border: 1px solid #cbded7; border-radius: var(--radius-pill); color: var(--state-success-text); background: #edf7f3; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; }
.state-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--mint); }
.customer-state-stack { flex: 0 0 auto; display: grid; justify-items: end; gap: 10px; text-align: right; }
.assigned-user { color: var(--ink-soft); font-size: 13px; font-weight: 750; }
.contact-summary { font-size: 13px; font-weight: 800; }
.contact-summary--ok { color: #006f19; }
.contact-summary--stop { color: #8e3d2a; }
.contact-summary--empty { color: var(--muted); }
.detail-metrics { display: grid; grid-template-columns: repeat(5, 1fr); margin-bottom: 20px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: var(--shadow); }
.detail-metrics article { min-height: 100px; padding: 20px 24px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); }
.detail-metrics article:last-child { border-right: 0; }
.detail-metrics span { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.detail-metrics strong { font-size: clamp(22px, 2vw, 30px); letter-spacing: -.04em; }
.metric-danger { color: var(--state-danger-text); }
.account-overview-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 20px; margin-bottom: 20px; }
.account-overview-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.account-overview-card--work { border-color: #d6d1c7; background: #fffdf8; }
.section-heading--compact { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading--compact h2 { font-size: 24px; }
.mini-link { flex: 0 0 auto; margin-top: 3px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--ink); background: #fff; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .055em; }
.mini-link:hover { border-color: var(--ink); background: var(--state-muted-bg); }
.work-signal-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.work-signal-row span { padding: 7px 9px; border-radius: var(--radius-pill); color: var(--ink-soft); background: var(--state-muted-bg); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.work-signal-row .is-danger { color: var(--state-danger-text); background: var(--state-danger-soft); }
.work-signal-row .is-warn { color: var(--state-warning-strong); background: var(--state-warning-soft); }
.overview-empty { margin: 0; padding: 16px; border: 1px dashed #d9d4ca; border-radius: 11px; color: var(--muted); background: var(--surface-muted); font-size: 12px; line-height: 1.55; }
.overview-task-list, .overview-activity-list { display: grid; gap: 8px; }
.overview-task, .overview-activity-item { min-width: 0; padding: 11px 12px; display: grid; gap: 4px; border: 1px solid #ebe7df; border-left-width: 4px; border-radius: 10px; background: #fff; }
.overview-task--danger { border-left-color: var(--state-danger-text); }
.overview-task--warn { border-left-color: #c98219; }
.overview-task--normal { border-left-color: var(--mint); }
.overview-task strong, .overview-activity-item strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.overview-task small, .overview-activity-item small { overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.4; text-overflow: ellipsis; white-space: nowrap; }
.overview-activity-item { grid-template-columns: 54px minmax(0, 1fr); align-items: center; border-left-width: 1px; }
.overview-activity-item > span { padding: 6px 8px; border-radius: var(--radius-pill); color: var(--state-success-text); background: var(--state-success-bg); font-size: 9px; font-weight: 850; text-align: center; letter-spacing: .05em; }
.overview-activity-item--order > span { color: var(--state-info-text); background: var(--state-info-bg); }
.contact-card, .order-history { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.contact-workbench { grid-column: 1 / span 3; grid-row: 2; }
.account-data-card { grid-column: 4; grid-row: 2; align-self: start; }
.contact-card { padding: 24px; }
.section-heading .eyebrow { margin-bottom: 6px; }
.section-heading h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 27px; font-weight: 500; letter-spacing: -.025em; }
.contact-card dl { margin: 24px 0 0; }
.contact-card dl > div { padding: 15px 0; border-top: 1px solid #ebe9e4; }
.contact-card dt { margin-bottom: 6px; color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.contact-card dd { margin: 0; overflow-wrap: anywhere; color: var(--ink); font-size: 12px; line-height: 1.6; }
.contact-card code { padding: 3px 6px; border-radius: 4px; background: #efede8; font-size: 11px; }
.account-data-card { padding: 20px; }
.account-data-card .section-heading h2 { font-family: Inter, Aptos, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 20px; font-weight: 820; letter-spacing: 0; }
.account-data-card dl { margin-top: 18px; }
.account-data-card dl > div { padding: 12px 0; }
.account-data-card .form-row--two { grid-template-columns: 1fr; gap: 10px; }
.account-edit-trigger { width: 100%; min-height: 44px; margin-top: 16px; padding: 0 11px 0 15px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid #e4e0d8; border-radius: 11px; color: var(--ink); background: var(--surface-muted); cursor: pointer; font-size: 11px; font-weight: 850; text-align: left; text-transform: uppercase; letter-spacing: .06em; }
.account-edit-trigger:hover { border-color: #c9c4ba; background: #fff; }
.account-edit-trigger:focus-visible { outline: 0; border-color: var(--ink); box-shadow: var(--focus-ring); }
.account-edit-trigger span { width: 24px; height: 24px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--ink); font-size: 16px; line-height: 1; letter-spacing: 0; }
.read-only-note { margin: 16px 0 0; padding: 12px; display: flex; gap: 9px; border-radius: var(--radius-control); color: var(--ink-soft); background: var(--state-muted-bg); font-size: 10px; line-height: 1.45; }
.read-only-note span { width: 16px; height: 16px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--ink-soft); font-family: Georgia, serif; }
.back-to-top { position: fixed; right: clamp(18px, 3vw, 38px); bottom: 22px; z-index: 24; min-height: 40px; padding: 0 13px 0 10px; display: inline-flex; align-items: center; gap: 8px; border: 1px solid rgba(18,34,56,.18); border-radius: 999px; color: #fff; background: var(--ink); box-shadow: 0 10px 24px rgba(18,34,56,.16); font-size: 11px; font-weight: 850; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s ease, transform .18s ease, background .18s ease; }
.back-to-top span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: var(--ink); background: #fff; font-size: 14px; line-height: 1; }
.back-to-top.is-visible { opacity: 1; pointer-events: auto; transform: translateY(0); }
.back-to-top:hover { background: var(--navy-light); }
.inline-editor { scroll-margin-top: 18px; margin-top: 16px; border: 1px solid #e4e0d8; border-radius: 11px; background: #fbfaf7; transition: border-color .16s ease, background .16s ease; }
.inline-editor--compact { margin-top: 2px; }
.inline-editor--timeline { margin: 14px; }
.inline-editor > summary { min-height: 42px; padding: 0 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; list-style: none; }
.inline-editor > summary::-webkit-details-marker { display: none; }
.inline-editor > summary::after { content: '+'; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--ink); font-size: 14px; line-height: 1; }
.inline-editor > summary:focus-visible { outline: 0; box-shadow: inset 0 0 0 3px rgba(18,34,56,.08); }
.inline-editor[open] { border-color: #c9c4ba; background: #fff; }
.inline-editor[open] > summary::after { content: '−'; }
.crm-form { padding: 0 13px 13px; display: grid; gap: 10px; }
.crm-form--standalone { padding: 18px 0 0; }
.crm-form--modal { padding: 0; }
.crm-form .form-field { margin-top: 0; }
.crm-form-section { padding: 12px; display: grid; gap: 10px; border: 1px solid #ebe7df; border-radius: 10px; background: #fff; }
.crm-form-section--muted { background: #f8f7f3; }
.crm-form-section h3 { margin: 0; color: var(--ink); font-size: 11px; font-weight: 850; text-transform: uppercase; letter-spacing: .07em; }
.crm-form-section p { margin: -2px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.crm-form-actions { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.crm-form .toggle-row { padding: 2px 0; }
.permission-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(156px, 1fr)); gap: 8px; }
.permission-toggle { min-height: 58px; padding: 10px; display: flex; align-items: flex-start; gap: 9px; border: 1px solid #dedbd4; border-radius: var(--radius-field); color: var(--ink-soft); background: #fff; cursor: pointer; transition: border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.permission-toggle:hover { border-color: #c9c3b8; background: #fffdf8; }
.permission-toggle:has(input:checked) { border-color: #bfd7ce; background: var(--state-success-soft); }
.permission-toggle:focus-within { border-color: var(--ink); box-shadow: var(--focus-ring); }
.permission-toggle input { width: 16px; height: 16px; margin: 2px 0 0; flex: 0 0 auto; accent-color: var(--ink); }
.permission-toggle span { min-width: 0; display: grid; gap: 3px; }
.permission-toggle strong { color: var(--ink); font-size: 11px; font-weight: 850; line-height: 1.25; }
.permission-toggle small { color: var(--muted); font-size: 10px; line-height: 1.35; text-wrap: pretty; }
.crm-modal { width: min(860px, calc(100vw - 48px)); max-height: min(760px, calc(100vh - 48px)); padding: 0; border: 1px solid rgba(18,34,56,.16); border-radius: 14px; color: var(--ink); background: var(--surface); box-shadow: 0 26px 70px rgba(18,34,56,.24); }
.crm-modal::backdrop { background: rgba(18,34,56,.42); }
.crm-modal__panel { max-height: min(760px, calc(100vh - 48px)); display: grid; grid-template-rows: auto minmax(0, 1fr); }
.crm-modal__header { min-height: 82px; padding: 20px 24px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); }
.crm-modal__header .eyebrow { margin-bottom: 6px; }
.crm-modal__header h2 { margin: 0; font-family: Inter, Aptos, "Segoe UI", Helvetica, Arial, sans-serif; font-size: 24px; font-weight: 850; letter-spacing: 0; line-height: 1.05; }
.crm-modal__close { width: 34px; height: 34px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #fff; cursor: pointer; font-size: 22px; line-height: 1; }
.crm-modal__close:hover { border-color: var(--ink); background: var(--state-muted-bg); }
.crm-modal .crm-form { overflow: auto; padding: 16px 24px 20px; grid-template-columns: minmax(0, 1.18fr) minmax(280px, .82fr); align-content: start; gap: 12px; }
.crm-modal .crm-form-section { align-content: start; }
.crm-modal .crm-form-section:last-of-type { grid-column: 1 / -1; }
.crm-modal .crm-form-actions { position: sticky; bottom: -20px; grid-column: 1 / -1; margin: 2px -24px -20px; padding: 13px 24px; border-top: 1px solid var(--line); background: rgba(255,254,250,.96); }
.task-edit-inline { scroll-margin-top: 18px; overflow: hidden; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--surface-muted); transition: border-color .16s ease, background .16s ease; }
.task-edit-inline > summary { min-height: 42px; padding: 0 13px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 850; list-style: none; }
.task-edit-inline > summary::-webkit-details-marker { display: none; }
.task-edit-inline > summary::after { content: '+'; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--ink); font-size: 14px; line-height: 1; }
.task-edit-inline > summary:focus-visible { outline: 0; box-shadow: inset 0 0 0 3px rgba(18,34,56,.08); }
.task-edit-inline > summary > small { margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 750; }
.task-edit-inline--row { background: #fff; }
.task-edit-inline--row > summary { min-height: 58px; justify-content: flex-start; }
.task-edit-inline--row > summary::after { content: 'Editar'; width: auto; height: auto; margin-left: auto; padding: 5px 8px; color: var(--ink-soft); background: var(--state-muted-bg); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.task-edit-inline--row > summary > div { min-width: 0; display: grid; gap: 4px; }
.task-edit-inline--row > summary strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.task-edit-inline--row > summary small { overflow: hidden; color: var(--muted); font-size: 10px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.task-edit-inline[open] > summary { border-bottom: 1px solid #ebe7df; }
.task-edit-inline[open] > summary::after { content: '−'; }
.task-edit-inline[open] { border-color: #c9c4ba; background: #fff; }
.task-edit-inline--row[open] > summary { background: var(--surface-muted); }
.task-edit-inline--row[open] > summary::after { content: 'Cerrar'; }
.task-edit-form { padding: 13px; }
.task-edit-grid { display: grid; grid-template-columns: minmax(0, 1fr) 150px 140px; gap: 10px; }
.task-edit-grid--create { grid-template-columns: minmax(220px, 1.3fr) 150px 140px minmax(150px, .8fr); }
.task-edit-grid--expanded { grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(130px, .7fr)); }
.task-edit-title { min-width: 0; }
.form-field select { width: 100%; min-width: 0; height: 42px; padding: 0 11px; border: 1px solid var(--line-control); border-radius: var(--radius-field); outline: 0; color: var(--ink); background: #fff; }
.form-field select:focus { border-color: var(--ink); box-shadow: var(--focus-ring); }
.form-row--two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.section-heading--orders { min-height: 86px; padding: 20px 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.section-heading--orders > span { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .07em; }
.collapsible-panel { overflow: hidden; }
.collapsible-panel > summary { cursor: pointer; list-style: none; }
.collapsible-panel > summary::-webkit-details-marker { display: none; }
.collapsible-panel > summary::after { content: '+'; width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: var(--ink); font-size: 17px; line-height: 1; }
.collapsible-panel[open] > summary::after { content: '-'; }
.order-list { padding: 12px; display: grid; gap: 9px; }
.order-card { overflow: hidden; border: 1px solid #e6e3dd; border-radius: 11px; background: #fff; }
.order-card summary { min-height: 68px; padding: 12px 15px; display: grid; grid-template-columns: minmax(190px, 1fr) auto minmax(100px, auto); align-items: center; gap: 18px; cursor: pointer; list-style: none; }
.order-card summary::-webkit-details-marker { display: none; }
.order-number { min-width: 0; display: flex; align-items: center; gap: 11px; }
.order-number > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.order-number strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.order-number small { color: var(--muted); font-size: 10px; }
.order-chevron { width: 27px; height: 27px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: var(--ink); background: #f0eee9; font-size: 20px; transition: transform .18s ease; }
.order-card[open] .order-chevron { transform: rotate(90deg); }
.status-pill { padding: 6px 9px; border-radius: var(--radius-pill); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.status-pill--invoiced { color: var(--state-success-text); background: var(--state-success-bg); }
.status-pill--pending { color: var(--state-warning-strong); background: var(--state-warning-soft); }
.status-pill--planned { color: #744d9c; background: #eee4f7; }
.status-pill--muted { color: var(--state-muted-strong); background: #eceff1; }
.status-pill--pipeline { color: var(--state-info-text); background: var(--state-info-bg); font-size: 12px; text-transform: none; letter-spacing: 0; }
.order-amount { text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; }
.order-content { border-top: 1px solid #ebe9e4; background: #fcfbf8; }
.order-meta { padding: 11px 15px; display: flex; flex-wrap: wrap; gap: 18px; border-bottom: 1px solid #ebe9e4; color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.order-meta strong { margin-left: 4px; color: var(--ink); }
.line-table-wrap { overflow-x: auto; }
.line-table th { background: transparent; }
.line-table td { height: 56px; background: transparent; }
.line-table td:first-child { min-width: 210px; }
.line-table td strong { display: block; color: var(--ink); font-size: 11px; }
.line-table td small { margin-top: 3px; }
.crm-product-badge { margin-left: 7px; padding: 3px 7px; display: inline-flex; vertical-align: middle; border-radius: var(--radius-pill); color: var(--state-success-text); background: var(--state-success-bg); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; }
.empty-orders { padding: 60px 24px; text-align: center; }
.empty-orders > span { color: var(--accent); font-size: 30px; }
.empty-orders h3 { margin: 9px 0 5px; font-family: Georgia, serif; font-size: 22px; font-weight: 500; }
.empty-orders p { margin: 0; color: var(--muted); font-size: 11px; }
.identity-list, .timeline-list, .task-list { padding: 14px; display: grid; gap: 10px; }
.identity-list--wide { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.identity-item, .task-item { min-height: 58px; padding: 12px; display: flex; align-items: center; gap: 12px; border: 1px solid #ebe7df; border-radius: 10px; background: #fff; }
.edit-row { scroll-margin-top: 18px; overflow: hidden; border: 1px solid #ebe7df; border-radius: 10px; background: #fff; transition: border-color .16s ease, background .16s ease; }
.edit-row > summary { min-height: 58px; padding: 12px; display: flex; align-items: center; gap: 12px; cursor: pointer; list-style: none; }
.edit-row > summary::-webkit-details-marker { display: none; }
.edit-row > summary::after { content: 'Editar'; margin-left: auto; padding: 5px 8px; border-radius: var(--radius-pill); color: var(--ink-soft); background: var(--state-muted-bg); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.edit-row > summary:focus-visible { outline: 0; box-shadow: inset 0 0 0 3px rgba(18,34,56,.08); }
.edit-row[open] { border-color: #c9c4ba; }
.edit-row[open] > summary { border-bottom: 1px solid var(--line-soft); background: var(--surface-muted); }
.edit-row[open] > summary::after { content: 'Cerrar'; }
.edit-row .crm-form { padding: 13px; background: var(--surface-muted); }
.nested-action-form { padding: 0 13px 13px; background: var(--surface-muted); }
.nested-action-form button { width: 100%; min-height: 38px; padding: 0 12px; border: 1px dashed #d4d0c7; border-radius: 9px; color: var(--ink); background: #fff; cursor: pointer; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.nested-action-form button:hover { border-color: var(--ink); background: var(--state-muted-bg); }
.identity-source { min-width: 58px; padding: 6px 8px; border-radius: var(--radius-pill); color: var(--state-success-text); background: var(--state-success-bg); font-size: 9px; font-weight: 850; text-align: center; letter-spacing: .06em; }
.identity-item div, .task-item div, .edit-row summary div { min-width: 0; display: grid; gap: 4px; }
.identity-item strong, .task-item strong, .edit-row summary strong { overflow: hidden; color: var(--ink); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.identity-item small, .task-item small, .edit-row summary small { color: var(--muted); font-size: 10px; line-height: 1.45; }
.profile-badge { margin-left: 5px; padding: 3px 6px; display: inline-flex; vertical-align: middle; border-radius: var(--radius-pill); font-size: 8px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.profile-badge--confirmed { color: var(--state-success-text); background: var(--state-success-bg); }
.profile-badge--provisional { color: var(--state-warning-strong); background: var(--state-warning-soft); }
.profile-badge--generic { color: var(--state-muted-strong); background: #eceff1; }
.contactability-badge { margin-left: 5px; padding: 3px 6px; display: inline-flex; vertical-align: middle; border-radius: var(--radius-pill); font-size: 8px; font-weight: 850; text-transform: uppercase; letter-spacing: .05em; }
.contactability-badge--ok { color: var(--state-success-text); background: var(--state-success-bg); }
.contactability-badge--warn { color: var(--state-warning-strong); background: var(--state-warning-soft); }
.contactability-badge--stop { color: #8e3d2a; background: var(--state-danger-soft); }
.contactability-badge--muted { color: var(--state-muted-strong); background: #eceff1; }
.resolution-note { margin: 0; padding: 9px 10px; border-radius: 8px; color: var(--ink-soft); background: var(--state-muted-bg); font-size: 10px; line-height: 1.45; }
.contact-workbench .section-heading--orders { min-height: 78px; padding: 18px 20px; }
.crm-relationship-grid { padding: 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.relationship-block { min-width: 0; min-height: 172px; display: flex; flex-direction: column; gap: 10px; }
.relationship-block h3 { margin: 0; color: var(--ink); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.relationship-block > .inline-editor--compact { margin-top: auto; }
.muted-note { min-height: 62px; margin: 0; padding: 13px; display: flex; align-items: center; border: 1px dashed #d9d4ca; border-radius: var(--radius-field); color: var(--muted); background: var(--surface-muted); font-size: 11px; line-height: 1.55; }
.sales-rep-list { padding: 14px; display: grid; gap: 10px; }
.crm-detail-columns { margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 20px; align-items: start; }
.crm-orders-block { margin-top: 20px; }
.timeline-item { position: relative; min-height: 64px; padding: 12px 12px 12px 34px; border: 1px solid #ebe7df; border-radius: 10px; background: #fff; }
.timeline-dot { position: absolute; left: 13px; top: 18px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(231,104,75,.11); }
.timeline-item div { display: grid; gap: 5px; }
.timeline-item strong { color: var(--ink); font-size: 12px; }
.timeline-item small { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.timeline-item p { margin: 0; color: var(--ink-soft); font-size: 11px; line-height: 1.55; }
.not-found { max-width: 640px; margin: 15vh auto 0; text-align: center; }
.not-found p:not(.eyebrow) { color: var(--muted); }
.not-found a { display: inline-flex; margin-top: 18px; padding: 12px 16px; border-radius: 9px; color: #fff; background: var(--ink); font-size: 12px; font-weight: 750; }

/* Contextual help */
.help-drawer { position: relative; z-index: 30; }
.help-drawer > summary { cursor: pointer; list-style: none; }
.help-drawer > summary::-webkit-details-marker { display: none; }
.help-drawer[open] > summary { color: #fff; background: var(--navy-light); box-shadow: inset 3px 0 0 var(--accent); }
.help-panel { position: fixed; top: 0; right: 0; width: min(380px, calc(100vw - 28px)); height: 100vh; padding: 30px 24px 28px; overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface); box-shadow: -24px 0 60px rgba(18,34,56,.16); }
.help-panel__header { position: relative; padding: 4px 44px 20px 0; border-bottom: 1px solid #ebe9e4; }
.help-close { position: absolute; top: 0; right: 0; width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); background: #fff; cursor: pointer; font-size: 20px; line-height: 1; }
.help-close:hover { border-color: var(--ink); color: #fff; background: var(--ink); }
.help-panel__header h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 500; letter-spacing: -.025em; }
.help-panel__header p:last-child { margin: 12px 0 0; color: var(--ink-soft); font-size: 13px; line-height: 1.55; }
.help-panel__sections { display: grid; gap: 16px; padding-top: 18px; }
.help-panel__sections section { padding: 15px; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--surface-muted); }
.help-panel__sections h3 { margin: 0 0 7px; color: var(--ink); font-size: 13px; }
.help-panel__sections p { margin: 0; color: var(--ink-soft); font-size: 12px; line-height: 1.55; }
.help-panel__sections ul { margin: 10px 0 0; padding-left: 18px; color: var(--ink-soft); font-size: 12px; line-height: 1.65; }

/* Task workbench */
.task-metric-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.task-metric { min-height: 92px; padding: 16px; display: grid; align-content: space-between; border: 1px solid var(--line); border-radius: 13px; background: rgba(255,254,250,.72); transition: .16s ease; }
.task-metric:hover, .task-metric.is-active { border-color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
.task-metric.is-active { box-shadow: inset 0 -3px 0 var(--accent), var(--shadow); }
.task-metric span { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.task-metric strong { color: var(--ink); font-size: 28px; letter-spacing: -.04em; }
.task-workbench { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.task-toolbar { align-items: flex-end; }
.task-toolbar h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 30px; font-weight: 500; letter-spacing: -.025em; }
.task-toolbar p:not(.eyebrow) { margin: 6px 0 0; color: var(--ink-soft); font-size: 12px; }
.task-filter-form { display: flex; align-items: flex-end; gap: 10px; }
.task-filter-form .form-field { min-width: 230px; }
.task-inbox-list { padding: 14px; display: grid; gap: 10px; }
.task-inbox-item { min-width: 0; padding: 14px; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(210px, .55fr) auto; gap: 16px; align-items: center; border: 1px solid #ebe7df; border-left-width: 4px; border-radius: 12px; background: #fff; }
.task-inbox-item--danger { border-left-color: var(--state-danger-text); }
.task-inbox-item--warn { border-left-color: #c98219; }
.task-inbox-item--normal { border-left-color: var(--state-success-text); }
.task-inbox-item--empty { border-left-color: #9ca5af; }
.task-inbox-item--done { border-left-color: var(--mint); opacity: .86; }
.task-inbox-main { min-width: 0; display: flex; align-items: center; gap: 13px; }
.task-inbox-main > div { min-width: 0; display: grid; gap: 5px; }
.task-inbox-main h3 { margin: 0; overflow: hidden; color: var(--ink); font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.task-inbox-main p { margin: 0; color: var(--ink-soft); font-size: 12px; }
.task-inbox-main p a { color: var(--ink); font-weight: 850; }
.task-inbox-main p a:hover { color: var(--accent); }
.task-inbox-main small { overflow: hidden; color: var(--muted); font-size: 11px; line-height: 1.45; text-overflow: ellipsis; white-space: nowrap; }
.task-due-chip { min-width: 82px; padding: 8px 9px; display: inline-flex; justify-content: center; border-radius: var(--radius-control); font-size: 11px; font-weight: 850; white-space: nowrap; }
.task-due-chip--danger { color: var(--state-danger-text); background: var(--state-danger-soft); }
.task-due-chip--warn { color: var(--state-warning-strong); background: var(--state-warning-soft); }
.task-due-chip--normal { color: var(--state-success-text); background: var(--state-success-bg); }
.task-due-chip--empty { color: var(--ink-soft); background: var(--state-muted-bg); }
.task-due-chip--done { color: var(--state-success-text); background: #edf7f3; }
.task-inbox-meta { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.task-inbox-meta small { flex: 1 1 100%; color: var(--muted); font-size: 10px; line-height: 1.35; }
.priority-chip { padding: 6px 8px; border-radius: var(--radius-pill); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.priority-chip--high { color: var(--state-danger-text); background: var(--state-danger-soft); }
.priority-chip--normal { color: var(--state-info-text); background: var(--state-info-bg); }
.priority-chip--low { color: var(--state-muted-strong); background: #eceff1; }
.task-inbox-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.task-inbox-actions form { margin: 0; }
.task-inbox-item > .task-edit-inline { grid-column: 1 / -1; }
.secondary-button { min-height: 38px; padding: 0 13px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: var(--radius-control); color: var(--ink); background: #fff; cursor: pointer; font-size: 11px; font-weight: 850; white-space: nowrap; }
.secondary-button:hover { border-color: var(--ink); background: var(--state-muted-bg); }
.secondary-button--button { font-family: inherit; }
.secondary-button--muted { color: var(--ink-soft); background: var(--state-muted-bg); }
.secondary-button--muted:hover { border-color: #c9c4ba; color: var(--ink); background: #ebe8e1; }

/* Manual */
.manual-layout { max-width: 1180px; display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.manual-nav { position: sticky; top: 24px; padding: 18px; display: grid; gap: 7px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.manual-nav a { padding: 9px 10px; border-radius: 8px; color: var(--ink-soft); font-size: 12px; font-weight: 750; }
.manual-nav a:hover { color: var(--ink); background: var(--state-muted-bg); }
.manual-content { display: grid; gap: 18px; }
.manual-section { scroll-margin-top: 24px; padding: 28px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.manual-section h2 { margin: 0 0 12px; font-family: Georgia, "Times New Roman", serif; font-size: 32px; font-weight: 500; letter-spacing: -.025em; }
.manual-section h3 { margin: 22px 0 8px; color: var(--ink); font-size: 14px; }
.manual-section p { margin: 0 0 12px; color: var(--ink-soft); font-size: 14px; line-height: 1.7; }
.manual-section ol, .manual-section ul { margin: 10px 0 0; padding-left: 22px; color: var(--ink-soft); font-size: 14px; line-height: 1.8; }
.manual-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.manual-grid > div, .manual-callout { padding: 16px; border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--surface-muted); }
.manual-grid h3 { margin-top: 0; }
.manual-grid p:last-child, .manual-callout p:last-child { margin-bottom: 0; }
.manual-callout { margin: 16px 0; border-color: #cbded7; background: #edf7f3; }
.manual-callout strong { display: block; margin-bottom: 6px; color: var(--ink); font-size: 13px; }
.manual-table-wrap { margin: 18px 0; overflow-x: auto; border: 1px solid #ebe7df; border-radius: 12px; }
.manual-table th { background: #f8f7f3; }
.manual-table td { height: auto; vertical-align: top; line-height: 1.6; }
.manual-table td:first-child { color: var(--ink); white-space: nowrap; }
.manual-faq { display: grid; gap: 10px; }
.manual-faq details { border: 1px solid var(--line-soft); border-radius: var(--radius-card); background: var(--surface-muted); }
.manual-faq summary { min-height: 48px; padding: 0 15px; display: flex; align-items: center; color: var(--ink); cursor: pointer; font-size: 13px; font-weight: 850; list-style: none; }
.manual-faq summary::-webkit-details-marker { display: none; }
.manual-faq p { padding: 0 15px 15px; }

/* CRM administration */
.admin-grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
.product-cell { min-width: 260px; display: flex; flex-direction: column; gap: 4px; }
.product-cell strong { color: var(--ink); font-size: 12px; }
.product-cell small { color: var(--muted); font-size: 10px; }
.icon-action { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: #fff; background: var(--ink); cursor: pointer; font-size: 16px; line-height: 1; }
.icon-action:hover { background: var(--navy-light); }
.icon-action--disabled { color: var(--state-success-text); background: var(--state-success-bg); cursor: default; }
.inline-link-form { display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.inline-link-form select { width: 138px; height: 32px; border: 1px solid var(--line-control); border-radius: 8px; color: var(--ink); background: #fff; font-size: 11px; }
.crm-product-list { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.crm-product-cards { padding: 16px; display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; align-items: start; }
.crm-product-card { min-width: 0; padding: 18px; display: grid; gap: 14px; border: 1px solid #d9d4ca; border-radius: 12px; background: #fff; box-shadow: 0 10px 28px rgba(18,34,56,.06); }
.crm-product-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.crm-product-card__head > div { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.crm-product-card__head strong { overflow: hidden; color: var(--ink); font-size: 18px; letter-spacing: -.025em; text-overflow: ellipsis; white-space: nowrap; }
.crm-product-card__head small { color: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .06em; }
.crm-product-fields { display: grid; gap: 10px; }
.sage-link-list { display: grid; gap: 7px; padding: 11px; border: 1px solid #ece8df; border-radius: 9px; background: #f8f7f3; }
.sage-reference { min-height: 34px; display: grid; grid-template-columns: minmax(72px, auto) minmax(0, 1fr) auto auto; align-items: center; gap: 9px; color: var(--ink-soft); font-size: 11px; line-height: 1.4; }
.sage-reference__code { padding: 4px 7px; border-radius: 7px; color: var(--ink); background: #fff; font-size: 10px; font-weight: 850; font-variant-numeric: tabular-nums; }
.sage-reference__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sage-reference__family { color: var(--muted); font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.sage-link-list em { color: var(--state-success-text); font-size: 9px; font-style: normal; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.sage-link-list button { border: 0; color: #9b3f2b; background: transparent; cursor: pointer; font-size: 9px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.danger-link { flex: 0 0 auto; border: 0; color: #9b3f2b; background: transparent; cursor: pointer; font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .06em; }
.danger-link:hover { color: var(--accent); }
.form-field--compact { margin-top: 0; }
.form-field textarea { width: 100%; padding: 12px 14px; border: 1px solid var(--line-control); border-radius: var(--radius-field); outline: 0; color: var(--ink); background: #fff; resize: vertical; }
.form-field textarea:focus { border-color: var(--ink); box-shadow: var(--focus-ring); }
.form-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 86px; gap: 10px; }
.form-row.form-row--two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.form-row > * { min-width: 0; }
.toggle-row { display: flex; flex-wrap: wrap; gap: 12px; }
.toggle-row label { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 11px; font-weight: 750; }
.toggle-row input { width: 15px; height: 15px; accent-color: var(--ink); }
.save-button { justify-self: end; height: 38px; padding: 0 15px; border: 0; border-radius: var(--radius-control); color: #fff; background: var(--ink); cursor: pointer; font-size: 11px; font-weight: 850; }
.save-button:hover { background: var(--navy-light); }

/* Authentication */
.auth-body { min-height: 100vh; color: var(--ink); background: var(--paper); }
.login-shell { min-height: calc(100vh - 40px); display: grid; grid-template-columns: minmax(360px, .92fr) minmax(440px, 1.08fr); }
.login-brand-panel { position: relative; overflow: hidden; padding: clamp(34px, 5vw, 72px); display: flex; flex-direction: column; color: #fff; background: var(--navy); }
.login-brand-panel::after { content: ''; position: absolute; right: -180px; bottom: -210px; width: 520px; height: 520px; border: 1px solid rgba(131,199,178,.22); border-radius: 50%; box-shadow: 0 0 0 74px rgba(131,199,178,.035), 0 0 0 148px rgba(131,199,178,.025); }
.login-logo { position: relative; z-index: 1; width: min(370px, 78%); height: auto; }
.login-message { position: relative; z-index: 1; max-width: 560px; margin: auto 0; }
.login-message .eyebrow { color: var(--mint); }
.login-message h1 { max-width: 620px; color: #fff; font-size: clamp(44px, 5vw, 76px); line-height: .98; }
.login-message > p:last-child { max-width: 480px; margin: 24px 0 0; color: #aebbc9; font-size: 14px; line-height: 1.7; }
.login-security { position: relative; z-index: 1; margin: 0; display: flex; align-items: center; gap: 9px; color: #aebbc9; font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.login-security span { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 4px rgba(131,199,178,.12); }
.login-form-panel { padding: 40px clamp(28px, 7vw, 110px); display: grid; place-items: center; }
.login-form { width: min(430px, 100%); }
.login-form header { margin-bottom: 32px; }
.login-form h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: 42px; font-weight: 500; letter-spacing: -.035em; }
.login-form header > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.form-field { margin-top: 18px; display: grid; gap: 8px; }
.form-field span { color: var(--ink-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; }
.form-field input { width: 100%; min-width: 0; height: 50px; padding: 0 14px; border: 1px solid var(--line-control); border-radius: var(--radius-field); outline: 0; color: var(--ink); background: #fff; }
.form-field input:focus { border-color: var(--ink); box-shadow: var(--focus-ring); }
.login-submit { width: 100%; height: 52px; margin-top: 24px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: var(--radius-field); color: #fff; background: var(--ink); cursor: pointer; font-size: 12px; font-weight: 800; }
.login-submit:hover { background: var(--navy-light); }
.login-submit span { font-size: 18px; }
.login-help { margin: 18px 0 0; color: var(--muted); font-size: 10px; text-align: center; }
.login-error { margin-bottom: 18px; padding: 12px 14px; border: 1px solid #e7afa0; border-radius: var(--radius-control); color: #8e3d2a; background: var(--state-danger-soft); font-size: 11px; }
.studio-signature { min-height: 40px; margin: 0; padding: 12px 18px; color: rgba(91, 101, 112, .72); background: var(--paper); font-size: 11px; letter-spacing: .025em; text-align: right; }
.studio-signature a { color: inherit; font-weight: 750; text-decoration: none; }
.studio-signature a:hover, .studio-signature a:focus-visible { color: #fab710; text-decoration: underline; text-underline-offset: 2px; }

@media (max-width: 1080px) {
    .app-shell { grid-template-columns: 82px minmax(0, 1fr); }
    .sidebar { padding-inline: 14px; }
    .nav-item span:not(.nav-icon), .nav-item small, .sync-card div { display: none; }
    .brand { justify-content: center; }
    .brand img { width: 54px; margin-inline: auto; }
    .nav-item { grid-template-columns: 1fr; justify-items: center; }
    .sync-card { justify-content: center; padding-inline: 8px; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .detail-metrics { grid-template-columns: repeat(3, 1fr); }
    .detail-metrics article:nth-child(3) { border-right: 0; }
    .detail-metrics article:nth-child(n+4) { border-top: 1px solid var(--line); }
    .account-overview-grid { grid-template-columns: 1fr; }
    .account-command { grid-template-columns: 1fr; }
    .account-work-grid { grid-template-columns: 1fr; }
    .account-action-card--primary, .contact-workbench, .account-data-card { grid-column: auto; grid-row: auto; }
    .crm-detail-columns { grid-template-columns: 1fr; }
    .crm-relationship-grid { grid-template-columns: 1fr; }
    .task-metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .task-inbox-item { grid-template-columns: 1fr; align-items: start; }
    .task-inbox-actions { justify-content: flex-start; }
    .daily-workspace { grid-template-columns: 1fr; }
    .daily-queue-groups { max-height: none; }
    .admin-grid { grid-template-columns: 1fr; }
    .manual-layout { grid-template-columns: 1fr; }
    .manual-nav { position: static; }
    .contact-card { display: grid; grid-template-columns: 180px 1fr; gap: 22px; }
    .contact-card dl { margin-top: 0; }
    .read-only-note { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
    .app-shell { display: block; }
    .sidebar { position: static; width: 100%; height: auto; padding: 12px 16px; flex-direction: row; align-items: center; }
    .brand { margin: 0; }
    .brand img { width: 150px; margin: 0; }
    .main-nav { margin-left: auto; display: flex; }
    .nav-item { min-height: 38px; width: 42px; padding: 0; }
    .nav-item.is-disabled, .sync-card { display: none; }
    .logout-form { margin: 0 0 0 6px; }
    .logout-form button { width: 38px; height: 38px; padding: 0; justify-content: center; border: 1px solid rgba(255,255,255,.13); border-radius: 9px; font-size: 0; }
    .logout-form button span { font-size: 16px; }
    .main-content { padding: 26px 16px 40px; }
    .topbar { margin-bottom: 22px; }
    .user-chip div { display: none; }
    .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .metric-card { min-height: 112px; padding: 15px; }
    .metric-card strong { font-size: 23px; }
    .panel-toolbar { align-items: stretch; flex-direction: column; }
    .search-form { align-items: stretch; }
    .search-form button { padding-inline: 12px; }
    .result-count { padding-left: 2px; }
    .task-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .task-metric { min-height: 82px; padding: 13px; }
    .task-toolbar { align-items: stretch; }
    .task-filter-form { align-items: stretch; flex-direction: column; }
    .task-filter-form .form-field { min-width: 0; }
    .task-inbox-main { align-items: flex-start; flex-direction: column; }
    .task-due-chip { min-width: 0; }
    .task-inbox-actions { align-items: stretch; flex-direction: column; }
    .task-inbox-actions .save-button, .task-inbox-actions .secondary-button, .task-inbox-actions form { width: 100%; }
    .daily-header { margin-bottom: 18px; }
    .daily-focus { align-items: stretch; flex-direction: column; }
    .daily-focus a { width: 100%; }
    .daily-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .daily-filter-form { align-items: stretch; flex-direction: column; }
    .daily-context-grid { grid-template-columns: 1fr; }
    .daily-context-grid div, .daily-context-grid div:nth-child(3n), .daily-context-grid div:nth-last-child(-n+3) { border-right: 0; border-bottom: 1px solid #ebe7df; }
    .daily-context-grid div:last-child { border-bottom: 0; }
    .daily-action-panel, .daily-replan-form { align-items: stretch; flex-direction: column; }
    .daily-action-panel .secondary-button, .daily-action-panel .save-button, .daily-action-panel form, .daily-replan-form input { width: 100%; }
    .daily-detail-head .status-pill { grid-column: auto; grid-row: auto; margin-left: 0; }
    .task-edit-grid { grid-template-columns: 1fr; }
    table { table-layout: fixed; }
    th:nth-child(n+2):not(:last-child), td:nth-child(n+2):not(:last-child) { display: none; }
    th:last-child, td:last-child { width: 48px; }
    .customer-cell { min-width: 0; }
    .pagination { align-items: flex-start; flex-direction: column; }
    .customer-hero { align-items: flex-start; flex-direction: column; }
    .customer-hero--crm { padding: 18px; }
    .customer-identity { align-items: flex-start; gap: 13px; }
    .customer-state-stack { justify-items: start; text-align: left; }
    .customer-state-stack .status-pill { grid-column: auto; grid-row: auto; margin-left: 0; }
    .hero-avatar { width: 54px; height: 54px; border-radius: 16px 5px 16px 5px; font-size: 14px; }
    .customer-identity h1 { font-size: 30px; }
    .customer-state { margin-top: 0; }
    .detail-metrics { grid-template-columns: 1fr; }
    .detail-metrics article { min-height: 82px; border-right: 0; border-bottom: 1px solid var(--line); }
    .detail-metrics article:last-child { border-bottom: 0; }
    .section-heading--compact { flex-direction: column; }
    .mini-link { margin-top: 0; }
    .overview-activity-item { grid-template-columns: 1fr; align-items: start; }
    .overview-activity-item > span { width: fit-content; }
    .contact-card { margin-bottom: 14px; display: block; }
    .contact-card dl { margin-top: 22px; }
    .section-heading--orders { align-items: flex-start; }
    .order-card summary { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
    .status-pill { grid-column: 1; grid-row: 2; justify-self: start; margin-left: 38px; }
    .order-amount { grid-column: 2; grid-row: 1 / span 2; }
    .line-price { display: none; }
    .help-panel { width: 100vw; max-width: none; padding: 62px 18px 24px; }
    .help-panel__header { padding-right: 44px; }
    .crm-modal { width: calc(100vw - 24px); max-height: calc(100vh - 24px); }
    .crm-modal__panel { max-height: calc(100vh - 24px); }
    .crm-modal__header { padding: 18px; }
    .crm-modal .crm-form { padding: 14px 18px 18px; grid-template-columns: 1fr; }
    .crm-modal .crm-form-actions { margin: 2px -18px -18px; padding: 12px 18px; }
    .crm-product-cards { grid-template-columns: 1fr; padding: 12px; }
    .sage-reference { grid-template-columns: 1fr; align-items: start; }
    .form-row { grid-template-columns: 1fr; }
    .manual-section { padding: 20px; }
    .manual-grid { grid-template-columns: 1fr; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand-panel { min-height: 235px; padding: 24px; }
    .login-logo { width: min(290px, 76%); }
    .login-message { margin: 38px 0 30px; }
    .login-message h1 { font-size: 36px; }
    .login-message > p:last-child, .login-security { display: none; }
    .login-form-panel { padding: 42px 24px 60px; align-items: start; }
    .login-form h2 { font-size: 36px; }
    .studio-signature { text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .back-to-top { transition: none; }
    .inline-editor, .edit-row, .task-edit-inline { transition: none; }
    .crm-account-table tbody tr.account-row td, .crm-account-table .row-action a { transition: none; }
    .daily-summary-item { transition: none; }
    .daily-summary-item:hover { transform: none; }
}
