:root,
:root[data-theme="light"] {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #eef3f4;
    --raised: #fbfcfd;
    --input-bg: #ffffff;
    --text: #1d2633;
    --muted: #667085;
    --border: #d9e0e6;
    --primary: #126c67;
    --primary-dark: #0d5552;
    --accent: #8f4a1a;
    --danger: #a83d43;
    --track-bg: #e8eef1;
    --good-bg: #dff1ec;
    --good-text: #0d5552;
    --warn-bg: #fff7ed;
    --warn-text: #8f4a1a;
    --bad-bg: #fde7e9;
    --bad-text: #a83d43;
    --toast-bg: #1d2633;
    --toast-text: #ffffff;
    --shadow: 0 16px 40px rgba(28, 36, 48, 0.08);
}

:root[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f141a;
    --surface: #161d26;
    --surface-soft: #1f2935;
    --raised: #1a222c;
    --input-bg: #121922;
    --text: #e6edf3;
    --muted: #9aa7b4;
    --border: #2a3543;
    --primary: #2bb5ab;
    --primary-dark: #1e8d85;
    --accent: #d98a4f;
    --danger: #e0646b;
    --track-bg: #25303d;
    --good-bg: rgba(43, 181, 171, 0.18);
    --good-text: #6fd6cd;
    --warn-bg: rgba(217, 138, 79, 0.18);
    --warn-text: #e6a877;
    --bad-bg: rgba(224, 100, 107, 0.18);
    --bad-text: #f0969b;
    --toast-bg: #e6edf3;
    --toast-text: #0f141a;
    --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    letter-spacing: 0;
}

button,
textarea,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding: 28px 22px;
    background: var(--raised);
    border-right: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    font-weight: 800;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.section-header h3,
.section-header p {
    margin: 0;
}

.brand h1 {
    font-size: 21px;
}

.brand p,
.section-header p,
.field span,
.empty-state p,
.detail-block p,
.status-box p {
    color: var(--muted);
}

.nav-stack {
    display: grid;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 0 14px;
    text-align: left;
    color: var(--text);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 8px;
}

.nav-item.active,
.nav-item:hover {
    background: var(--surface-soft);
    border-color: var(--border);
}

.icon {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.nav-icon,
.btn-icon,
.tab-icon {
    display: inline-flex;
    align-items: center;
    color: var(--muted);
}

.nav-item.active .nav-icon,
.nav-item:hover .nav-icon,
.request-tab.active .tab-icon {
    color: var(--primary);
}

.with-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.section-header-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.setup-editor {
    display: grid;
    gap: 16px;
    padding: 16px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.setup-editor[hidden] {
    display: none;
}

#edit-price-book.active,
#edit-business-profile.active {
    color: var(--primary-dark);
    border-color: var(--primary);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(8, 12, 18, 0.55);
}

.modal-backdrop[hidden] {
    display: none;
}

/* When opened, the setup editor becomes a centered modal instead of cramping the column. */
.setup-editor.setup-modal:not([hidden]) {
    position: fixed;
    z-index: 70;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    gap: 0;
    width: min(960px, 94vw);
    max-height: 88vh;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.setup-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.setup-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.setup-modal-body {
    display: grid;
    gap: 16px;
    padding: 20px;
    overflow-y: auto;
}

.setup-modal-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.setup-modal-close:hover {
    color: var(--text);
    background: var(--surface-soft);
}

.setup-modal-close .icon {
    width: 18px;
    height: 18px;
}

.theme-switcher {
    display: grid;
    gap: 8px;
}

.theme-switcher-label {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.theme-options {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.theme-option {
    min-height: 34px;
    padding: 0 6px;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
}

.theme-option:hover {
    color: var(--text);
}

.theme-option.active {
    color: var(--text);
    background: var(--surface-soft);
    border-color: var(--border);
}

.theme-option:focus-visible {
    outline: 3px solid rgba(18, 108, 103, 0.3);
    outline-offset: 1px;
}

.sidebar-footer {
    display: grid;
    gap: 16px;
    margin-top: auto;
}

.status-box {
    display: grid;
    grid-template-columns: 12px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.status-dot {
    width: 10px;
    height: 10px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--accent);
}

.status-dot.ready {
    background: var(--primary);
}

.status-dot.error {
    background: var(--danger);
}

.workspace {
    min-width: 0;
    padding: 28px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.eyebrow {
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
    text-transform: uppercase;
}

.topbar h2 {
    font-size: 28px;
    line-height: 1.2;
}

.panel {
    display: none;
}

.panel.active {
    display: block;
}

.request-tabs {
    display: flex;
    gap: 6px;
    align-items: end;
    margin-bottom: 0;
    padding-left: 8px;
    border-bottom: 1px solid var(--border);
}

.request-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 18px;
    color: var(--muted);
    background: var(--raised);
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: 8px 8px 0 0;
    font-weight: 800;
}

.request-tab:hover {
    color: var(--text);
    background: var(--surface-soft);
}

.request-tab.active {
    position: relative;
    z-index: 1;
    color: var(--text);
    background: var(--surface);
    box-shadow: inset 0 3px 0 var(--primary);
}

.request-tab-pane {
    display: none;
    padding-top: 18px;
}

.request-tab-pane.active {
    display: block;
}

.two-column {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(420px, 1.05fr);
    gap: 20px;
    align-items: start;
}

.setup-grid {
    grid-template-columns: minmax(320px, 0.85fr) minmax(520px, 1.15fr);
}

.work-section {
    padding: 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.request-queue-section {
    margin-bottom: 20px;
}

.request-tab-pane .request-queue-section {
    margin-bottom: 0;
}

.section-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-header > div {
    min-width: 0;
}

.section-header h3 {
    font-size: 20px;
}

.stack {
    display: grid;
    gap: 16px;
}

.field {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.field span {
    font-size: 13px;
    font-weight: 700;
}

textarea {
    width: 100%;
    resize: vertical;
    min-height: 96px;
    padding: 12px;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    line-height: 1.5;
}

input,
select {
    min-height: 42px;
    min-width: 0;
    width: 100%;
    padding: 0 12px;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

textarea:focus,
input:focus,
select:focus {
    outline: 3px solid rgba(18, 108, 103, 0.18);
    border-color: var(--primary);
}

.intake-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.import-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.file-picker {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    min-height: 42px;
    min-width: 0;
    overflow: hidden;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.file-picker-input {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

.file-picker-button {
    display: inline-flex;
    align-items: center;
    align-self: stretch;
    padding: 0 14px;
    background: var(--surface-soft);
    border-right: 1px solid var(--border);
    font-weight: 800;
    white-space: nowrap;
}

.file-picker-name {
    min-width: 0;
    padding: 0 12px;
    overflow: hidden;
    color: var(--muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-picker.has-file .file-picker-name {
    color: var(--text);
}

.file-picker:focus-within {
    outline: 3px solid rgba(18, 108, 103, 0.18);
    border-color: var(--primary);
}

.manual-attachment-panel {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(280px, 1.2fr);
    gap: 12px;
    align-items: start;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.intake-request-doc-panel {
    border-color: var(--primary);
    border-left-width: 3px;
}

.manual-attachment-copy strong {
    display: block;
    margin-bottom: 4px;
}

.manual-attachment-copy p,
.manual-attachment-status {
    margin: 0;
    color: var(--muted);
}

.manual-attachment-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: start;
}

.manual-file-picker {
    min-height: 40px;
}

.manual-attachment-status {
    grid-column: 1 / -1;
    font-size: 13px;
    line-height: 1.35;
}

.setup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    min-width: 0;
}

.settings-pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    align-items: start;
    min-width: 0;
}

.settings-stack {
    display: grid;
    gap: 14px;
    min-width: 0;
}

.settings-wide {
    grid-column: 1 / -1;
}

.setup-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-width: 0;
    padding: 14px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.setup-option > div {
    min-width: 0;
}

.setup-option strong {
    display: block;
    margin-bottom: 4px;
}

.setup-option p {
    margin: 0;
    color: var(--muted);
}

.restore-zone {
    align-items: flex-start;
}

.restore-messages-panel {
    display: grid;
    gap: 12px;
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.restore-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 10px;
    min-width: 0;
}

.restore-message-list {
    display: grid;
    gap: 8px;
    max-height: 260px;
    overflow: auto;
    min-width: 0;
}

.restore-message-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    align-items: flex-start;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.restore-message-row input {
    margin-top: 3px;
    accent-color: var(--primary);
}

.restore-message-body {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.restore-message-body strong,
.restore-message-body span {
    overflow-wrap: anywhere;
}

.restore-message-body span {
    color: var(--muted);
    font-size: 13px;
}

.sync-batch-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    justify-content: flex-end;
    gap: 10px;
    min-width: min(100%, 280px);
}

.sync-batch-controls .field {
    width: 160px;
}

.toggle-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
    font-weight: 800;
    white-space: nowrap;
}

.toggle-control input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--primary);
}

.automation-mode-card {
    align-items: center;
}

.sync-schedule-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
    min-width: 0;
    overflow: hidden;
}

.sync-schedule-card > * {
    min-width: 0;
    max-width: 100%;
}

.sync-schedule-controls {
    display: grid;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.sync-mode-options {
    justify-self: stretch;
    width: 100%;
    min-width: 0;
}

.sync-mode-options .mode-option {
    flex: 1 1 0;
}

.sync-schedule-panel {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
}

.interval-horizon-state {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.sync-clock-panel {
    grid-template-columns: 1fr;
    gap: 10px;
    max-width: 100%;
    overflow: hidden;
}

.clock-schedule-list {
    display: grid;
    gap: 12px;
    max-width: 100%;
    min-width: 0;
}

.clock-schedule-card {
    display: grid;
    gap: 10px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--raised);
}

.clock-card-header {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto auto auto;
    align-items: center;
    gap: 10px;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.clock-card-title {
    font-size: 14px;
    flex: 0 0 auto;
}

.clock-card-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
    padding: 0;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
}

.clock-card-toggle:hover {
    color: var(--text);
}

.clock-card-chevron {
    transition: transform 120ms ease;
}

.clock-schedule-card.is-collapsed .clock-card-chevron {
    transform: rotate(-90deg);
}

.clock-card-summary {
    display: none;
    min-width: 0;
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
    white-space: normal;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
}

.clock-schedule-card.is-collapsed .clock-card-header {
    grid-template-columns: auto minmax(0, 1fr) auto auto auto;
}

.clock-schedule-card.is-collapsed .clock-card-toggle {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: start;
}

.clock-schedule-card.is-collapsed .clock-card-title {
    grid-column: 2;
    grid-row: 1;
}

.clock-schedule-card.is-collapsed .clock-card-summary {
    display: block;
    grid-column: 2 / 6;
    grid-row: 2;
    overflow: visible;
    text-overflow: clip;
}

.clock-schedule-card.is-collapsed .clock-card-import {
    grid-column: 3;
    grid-row: 1;
}

.clock-schedule-card.is-collapsed .clock-card-export {
    grid-column: 4;
    grid-row: 1;
}

.clock-schedule-card.is-collapsed .clock-card-remove {
    grid-column: 5;
    grid-row: 1;
}

.clock-schedule-card.is-collapsed .clock-card-body {
    display: none;
}

.clock-card-import,
.clock-card-export,
.clock-card-remove {
    min-height: 32px;
    min-width: max-content;
    justify-self: end;
}

.clock-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
}

.clock-routing-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
}

.clock-routing-grid .clock-contact-field {
    grid-column: span 2;
}

.clock-message-horizon {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 1.6fr);
    gap: 10px;
    align-items: end;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
    min-width: 0;
}

.clock-message-horizon strong,
.clock-message-horizon p {
    margin: 0;
}

.clock-message-horizon p {
    color: var(--muted);
    font-size: 13px;
}

.clock-message-horizon-controls {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
}

.clock-days-field {
    display: grid;
    gap: 8px;
}

.clock-days-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

.clock-days-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--muted);
}

.clock-days-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.day-preset {
    min-height: 28px;
    padding: 0 10px;
    color: var(--muted);
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.day-preset:hover {
    color: var(--text);
    border-color: var(--primary);
}

.clock-days-toggles {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.day-toggle {
    min-height: 34px;
    padding: 0 4px;
    color: var(--muted);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
}

.day-toggle:hover {
    color: var(--text);
}

.day-toggle.active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.clock-holiday-bar {
    display: grid;
    gap: 6px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.clock-holiday-country {
    max-width: 320px;
}

.country-combobox {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 38px;
}

.country-combobox input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.country-dropdown-button {
    min-height: 38px;
    width: 38px;
    padding: 0;
    color: var(--text);
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-left: 0;
    border-radius: 0 8px 8px 0;
}

.country-dropdown-button:hover,
.country-dropdown-button:focus {
    border-color: var(--primary);
}

.country-options {
    position: absolute;
    z-index: 20;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 260px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.24);
}

.country-option {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 34px;
    padding: 6px 8px;
    color: var(--text);
    text-align: left;
    background: transparent;
    border: 0;
    border-radius: 6px;
}

.country-option:hover,
.country-option:focus,
.country-option.is-active {
    color: var(--text);
    background: var(--good-bg);
}

.country-option.is-active {
    font-weight: 700;
    box-shadow: inset 2px 0 0 var(--primary);
}

.country-option code {
    color: inherit;
    opacity: 0.8;
}

.clock-holiday-status {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.clock-holiday-pick {
    display: grid;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.clock-holiday-pick-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px;
}

.clock-holiday-pick-hint {
    font-size: 12px;
    color: var(--muted);
}

.clock-holiday-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px 14px;
    max-height: 260px;
    overflow-y: auto;
}

.clock-holiday-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    column-gap: 8px;
    row-gap: 2px;
    min-width: 0;
    font-size: 13px;
}

.clock-holiday-option span {
    overflow-wrap: anywhere;
    white-space: normal;
}

.clock-holiday-name {
    grid-column: 2;
    min-width: 0;
}

.clock-holiday-date {
    grid-column: 2;
    color: var(--muted);
    font-size: 12px;
}

.clock-holiday-option input {
    grid-row: 1 / span 2;
}

.clock-holiday-empty {
    margin: 0;
    font-size: 13px;
    color: var(--muted);
}

.add-clock-schedule {
    justify-self: start;
}

.clock-schedule-actions,
.schedule-save-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.sync-date-row {
    grid-template-columns: minmax(0, 1fr) 42px;
}

.sync-quiet-windows {
    display: grid;
    grid-column: 1 / -1;
    gap: 8px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.sync-quiet-header,
.sync-quiet-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
}

.sync-quiet-header p,
.sync-quiet-empty {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.sync-quiet-list {
    display: grid;
    gap: 8px;
}

.sync-quiet-row {
    grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1fr) minmax(
            0,
            1fr
        ) 42px;
    align-items: end;
}

.sync-quiet-row.is-time {
    grid-template-columns: minmax(120px, 0.9fr) minmax(0, 1fr) 42px;
}

.sync-quiet-row.is-time .sync-quiet-end-field {
    display: none;
}

.sync-time-row {
    grid-template-columns: minmax(0, 1fr) 42px;
}

.sync-quiet-remove {
    min-width: 0;
    width: 100%;
    min-height: 38px;
    padding-inline: 0;
}

#auto-sync-interval-panel {
    grid-template-columns: minmax(90px, 1fr) minmax(120px, 1.2fr);
}

.compact-field {
    gap: 5px;
}

.clock-field-head {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    min-width: 0;
}

/* Sliding on/off switch (track + knob). The "On"/"Off" text stays as the accessible
   name but is visually collapsed so the switch shape reads as a toggle at a glance. */
.mini-toggle {
    position: relative;
    display: inline-flex;
    flex: none;
    width: 46px;
    height: 24px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--input-bg);
    font-size: 0;
    color: transparent;
    cursor: pointer;
    transition:
        background-color 0.18s ease,
        border-color 0.18s ease;
}

.mini-toggle::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 3px;
    width: 16px;
    height: 16px;
    transform: translateY(-50%);
    border-radius: 50%;
    background: var(--muted);
    transition:
        transform 0.18s ease,
        background-color 0.18s ease;
}

.mini-toggle.active {
    border-color: var(--primary);
    background: var(--primary);
}

.mini-toggle.active::before {
    transform: translateY(-50%) translateX(22px);
    background: #fff;
}

.mini-toggle:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.mini-toggle:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.clock-interval-field.is-off input[type="number"] {
    color: var(--muted);
    opacity: 0.65;
}

.compact-field input,
.compact-field select {
    min-height: 38px;
}

.sync-preview {
    margin-top: 8px !important;
    font-size: 13px;
}

.automation-mode-options {
    display: inline-flex;
    gap: 8px;
    flex: 0 0 auto;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
}

.mode-option {
    min-width: 86px;
    min-height: 34px;
    padding: 0 12px;
    border: 0;
    border-radius: 6px;
    color: var(--muted);
    background: transparent;
    font-weight: 800;
}

.mode-option:hover,
.mode-option.active {
    color: var(--text);
    background: var(--surface-soft);
}

.mode-option.active {
    color: var(--text);
    background: var(--surface-soft);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.mode-option.danger-mode.active {
    color: var(--bad-text);
    box-shadow: inset 0 0 0 1px var(--bad-text);
}

.mode-option:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.selection-control {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 34px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.selection-control input {
    width: 18px;
    min-height: 18px;
    accent-color: var(--primary);
}

.intake-checklist {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.check-item {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 6px 8px;
    min-height: 54px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.check-dot {
    width: 9px;
    height: 9px;
    margin-top: 5px;
    border-radius: 50%;
    background: var(--accent);
}

.check-item strong {
    min-width: 0;
    font-size: 13px;
}

.check-item em {
    grid-column: 2;
    color: var(--muted);
    font-size: 12px;
    font-style: normal;
    font-weight: 700;
}

.check-item.is-complete .check-dot {
    background: var(--primary);
}

.check-item.is-complete em {
    color: var(--good-text);
}

.review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.delivery-state {
    display: grid;
    gap: 8px;
    padding: 16px;
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: var(--good-bg);
}

.delivery-state p {
    margin: 0;
    color: var(--text);
}

.delivery-state #delivery-meta {
    color: var(--muted);
    font-size: 13px;
}

.primary-button,
.secondary-button {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    font-weight: 800;
}

.primary-button {
    color: white;
    background: var(--primary);
    border-color: var(--primary);
}

.primary-button:hover {
    background: var(--primary-dark);
}

.primary-button:disabled,
.secondary-button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.primary-button.is-busy,
.secondary-button.is-busy {
    cursor: progress;
}

.secondary-button {
    color: var(--text);
    background: var(--input-bg);
}

.secondary-button:hover {
    background: var(--surface-soft);
}

.danger-button {
    color: var(--bad-text);
    border-color: var(--bad-text);
}

.danger-button:hover {
    background: var(--bad-bg);
}

.compact-button {
    min-height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

.pill {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    min-height: 32px;
    padding: 0 12px;
    border-radius: 8px;
    color: var(--good-text);
    background: var(--good-bg);
    font-size: 13px;
    font-weight: 800;
    white-space: nowrap;
}

.empty-state {
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 10px;
    min-height: 280px;
    padding: 30px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background:
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--primary) 7%, transparent),
            transparent 46%
        ),
        var(--raised);
}

.empty-state:not(.workflow-empty-state)::before {
    content: "";
    display: block;
    width: 46px;
    height: 32px;
    margin-bottom: 4px;
    border: 1px solid color-mix(in srgb, var(--primary) 34%, var(--border));
    border-radius: 8px;
    background:
        linear-gradient(
            90deg,
            color-mix(in srgb, var(--primary) 48%, transparent) 0 28%,
            transparent 28% 100%
        ),
        var(--surface);
    box-shadow:
        10px 10px 0 -6px color-mix(in srgb, var(--accent) 35%, transparent),
        0 10px 28px color-mix(in srgb, var(--primary) 10%, transparent);
}

.empty-state strong {
    font-size: 18px;
}

.empty-state p {
    max-width: 560px;
    margin: 0;
}

.request-loading-preview {
    display: grid;
    gap: 12px;
}

.request-loading-preview span {
    display: block;
    min-height: 84px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background:
        linear-gradient(
            90deg,
            transparent,
            color-mix(in srgb, var(--text) 6%, transparent),
            transparent
        ),
        var(--raised);
    background-size: 220% 100%;
    animation: loading-sheen 1.5s linear infinite;
}

@keyframes loading-sheen {
    from {
        background-position: 120% 0;
    }

    to {
        background-position: -120% 0;
    }
}

.workflow-empty-state {
    align-content: center;
    gap: 28px;
    min-height: 440px;
    overflow: hidden;
    border-style: solid;
    background:
        linear-gradient(
            135deg,
            color-mix(in srgb, var(--primary) 12%, transparent),
            transparent 48%
        ),
        var(--raised);
}

.workflow-empty-flow {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) minmax(34px, 70px) minmax(120px, 1fr) minmax(34px, 70px) minmax(120px, 1fr);
    align-items: center;
    width: min(100%, 760px);
    gap: 12px;
}

.workflow-empty-step {
    display: grid;
    gap: 8px;
    justify-items: start;
    min-height: 118px;
    padding: 16px;
    text-align: left;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: color-mix(in srgb, var(--surface) 78%, transparent);
    box-shadow: inset 0 1px 0 color-mix(in srgb, var(--text) 8%, transparent);
}

.workflow-empty-step.is-live {
    border-color: var(--primary);
    box-shadow:
        inset 0 1px 0 color-mix(in srgb, var(--text) 10%, transparent),
        0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent);
}

.workflow-step-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 28px;
    color: var(--primary);
    border: 1px solid color-mix(in srgb, var(--primary) 45%, var(--border));
    border-radius: 999px;
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
}

.workflow-empty-step strong {
    font-size: 18px;
}

.workflow-empty-step small {
    color: var(--muted);
    font-weight: 700;
}

.workflow-empty-rail {
    display: block;
    height: 2px;
    background: linear-gradient(
        90deg,
        color-mix(in srgb, var(--primary) 30%, transparent),
        color-mix(in srgb, var(--accent) 42%, transparent)
    );
}

.workflow-empty-copy {
    display: grid;
    gap: 8px;
    max-width: 640px;
}

.workflow-empty-copy strong {
    font-size: 22px;
}

.workflow-empty-copy p {
    margin: 0;
    color: var(--muted);
}

.workflow-empty-meters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.workflow-empty-meters span {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 12px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    font-size: 13px;
    font-weight: 800;
}

.hidden {
    display: none !important;
}

.draft-view {
    display: grid;
    gap: 16px;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.summary-grid div,
.mini-card {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.summary-grid span,
.mini-card span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.summary-grid strong,
.mini-card strong {
    display: block;
    overflow-wrap: anywhere;
}

.price-book-panel {
    display: grid;
    gap: 14px;
    margin-top: 16px;
}

.quick-price-builder {
    display: grid;
    gap: 12px;
    margin-bottom: 16px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.quick-price-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 14px;
}

.quick-price-header h4,
.quick-price-header p,
.quick-price-detection {
    margin: 0;
}

.quick-price-header p,
.quick-price-detection {
    color: var(--muted);
}

.currency-field {
    width: min(100%, 260px);
}

.quick-price-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--input-bg);
}

.quick-price-table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: fixed;
}

.quick-price-table th:nth-child(1) {
    width: 18%;
}

.quick-price-table th:nth-child(2) {
    width: 27%;
}

.quick-price-table th:nth-child(3) {
    width: 14%;
}

.quick-price-table th:nth-child(4) {
    width: 14%;
}

.quick-price-table th:nth-child(5) {
    width: 19%;
}

.quick-price-table th:nth-child(6) {
    width: 8%;
}

.quick-price-table th,
.quick-price-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border);
    border-right: 1px solid var(--border);
    vertical-align: top;
}

.quick-price-table th:last-child,
.quick-price-table td:last-child {
    border-right: 0;
}

.quick-price-table tbody tr:last-child td {
    border-bottom: 0;
}

.quick-price-table th {
    color: var(--muted);
    background: var(--surface);
    font-size: 12px;
    font-weight: 800;
    text-align: left;
    text-transform: uppercase;
}

.quick-price-input {
    width: 100%;
    min-height: 36px;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    box-sizing: border-box;
}

.quick-price-input:focus {
    outline: 2px solid rgba(18, 108, 103, 0.22);
    background: var(--surface);
}

.quick-row-delete {
    width: 100%;
    min-height: 36px;
    min-width: 0;
    padding-inline: 0;
}

.quick-price-actions {
    margin-bottom: 0;
}

.price-book-summary {
    margin-bottom: 0;
}

.price-preview-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.price-preview {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    table-layout: fixed;
}

.price-preview th:nth-child(1) {
    width: 22%;
}

.price-preview th:nth-child(2) {
    width: 43%;
}

.price-preview th:nth-child(3) {
    width: 20%;
}

.price-preview th:nth-child(4) {
    width: 15%;
}

.price-preview th,
.price-preview td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    overflow-wrap: anywhere;
}

.price-preview th {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.price-preview tbody tr:last-child td {
    border-bottom: 0;
}

.price-gap-block {
    margin-top: 0;
}

.insight-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ops-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.ops-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.ops-card > div {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.ops-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.ops-card strong {
    text-align: right;
}

.ops-card p,
.ops-card small {
    margin: 0;
    color: var(--muted);
}

.ops-card ul {
    margin: 0;
    padding-left: 20px;
}

.ops-card textarea {
    min-height: 118px;
    resize: vertical;
}

.ops-card.is-ready {
    border-color: var(--primary);
}

.ops-card.is-warning {
    border-color: var(--accent);
}

.ops-card.is-blocked {
    border-color: var(--danger);
}

.follow-up-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.detail-block {
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.detail-block h4 {
    margin: 0 0 8px;
}

.detail-block ul {
    margin: 0;
    padding-left: 20px;
}

.timeline,
.tool-list,
.check-list {
    display: grid;
    gap: 10px;
}

.timeline-item,
.tool-row,
.check-row {
    display: grid;
    gap: 10px;
}

.timeline-item {
    grid-template-columns: 14px minmax(0, 1fr);
}

.timeline-item p,
.tool-row p,
.check-row p,
.empty-inline {
    margin: 4px 0 0;
    color: var(--muted);
}

.timeline-marker {
    width: 10px;
    height: 10px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.tool-row {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.tool-row:last-child,
.check-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.tool-row p {
    grid-column: 1 / -1;
}

.check-row {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.risk-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 16px;
}

.risk-grid span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 800;
    background: var(--warn-bg);
    color: var(--warn-text);
    white-space: nowrap;
}

.is-good {
    background: var(--good-bg);
    color: var(--good-text);
}

.is-warn {
    background: var(--warn-bg);
    color: var(--warn-text);
}

.is-bad {
    background: var(--bad-bg);
    color: var(--bad-text);
}

.is-muted {
    background: var(--surface-soft);
    color: var(--muted);
}

.line-items {
    display: grid;
    gap: 8px;
}

.line-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.line-item:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.line-item span {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.line-item-breakdown {
    margin-top: 2px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.line-item strong:last-child {
    white-space: nowrap;
}

.revision-box {
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--warn-bg);
}

.job-list {
    display: grid;
    gap: 12px;
}

.job-card,
.inbox-card {
    display: grid;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
    overflow-wrap: anywhere;
}

.job-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
}

.inbox-card {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
}

.job-select-control {
    align-self: start;
}

.job-card h4,
.job-card p,
.inbox-card h4,
.inbox-card p {
    margin: 0;
}

.job-card p,
.inbox-card p {
    margin-top: 6px;
    color: var(--muted);
}

.inbox-list,
.request-queue-list,
.activity-list,
.bar-list {
    display: grid;
    gap: 12px;
}

.queue-actions {
    display: grid;
    gap: 8px;
    justify-items: end;
}

.queue-actions p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.danger-zone {
    border-color: var(--bad-text);
}

.request-card {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: start;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.request-card.is-answered {
    border-color: var(--primary);
}

.request-rank {
    display: grid;
    justify-items: center;
    gap: 2px;
    padding: 8px 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}

.request-rank strong {
    font-size: 22px;
    line-height: 1;
}

.request-rank span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.request-topline {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.request-topline h4,
.request-card p {
    margin: 0;
}

.request-card p {
    margin-top: 6px;
    color: var(--muted);
}

.request-actions {
    display: flex;
    justify-content: flex-end;
}

.request-empty {
    min-height: 170px;
}

@media (max-width: 720px) {
    .list-tools {
        grid-template-columns: 1fr;
    }
}

.inbox-header-actions {
    display: grid;
    gap: 6px;
    justify-items: end;
    align-content: start;
    inline-size: clamp(360px, 38vw, 560px);
    min-height: 60px;
}

.sync-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.email-status {
    margin: 0;
    inline-size: 100%;
    min-height: 18px;
    font-size: 13px;
    line-height: 1.35;
    color: var(--muted);
    white-space: normal;
    overflow: visible;
    overflow-wrap: break-word;
    text-align: right;
    text-overflow: clip;
}

.email-status::after {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-left: 8px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0;
    transform: scale(0.75);
    transition: opacity 120ms ease;
}

.email-status.is-syncing::after {
    opacity: 1;
    animation: sync-pulse 900ms ease-in-out infinite;
}

.settings-status {
    margin-top: 8px;
    text-align: left;
}

.inbox-header-actions .email-status {
    min-height: 36px;
}

.settings-theme {
    max-width: 420px;
}

@keyframes sync-pulse {
    0%,
    100% {
        transform: scale(0.65);
    }

    50% {
        transform: scale(1);
    }
}

.inbox-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
}

.inbox-filter {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--muted);
    background: var(--surface);
    font-weight: 800;
}

.inbox-filter span {
    display: grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--surface-soft);
    color: var(--text);
    font-size: 12px;
}

.inbox-filter.active,
.inbox-filter:hover {
    color: var(--text);
    background: var(--surface-soft);
}

.inbox-summary {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 13px;
}

.list-tools {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(300px, 340px);
    gap: 12px;
    align-items: end;
    margin-bottom: 12px;
}

.list-search-field,
.list-sort-field {
    margin: 0;
}

.inbox-bulk-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    margin-bottom: 10px;
}

.inbox-bulk-actions p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.inbox-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.inbox-chip-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.inbox-meta {
    font-size: 13px;
}

.triage-reason {
    color: var(--accent);
    font-size: 13px;
    font-weight: 700;
}

.inbox-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 10px;
}

.inbox-select-control {
    align-self: start;
}

.inbox-card.is-filtered {
    border-style: dashed;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.metric-card {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--raised);
}

.metric-card span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.metric-card strong {
    display: block;
    font-size: 22px;
    line-height: 1.2;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.bar-row,
.activity-row {
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.bar-row:last-child,
.activity-row:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.bar-header {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.bar-track {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--track-bg);
}

.bar-track span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
}

.activity-row p {
    margin: 6px 0 0;
    color: var(--muted);
}

.toast {
    position: fixed;
    z-index: 140;
    right: 24px;
    bottom: 24px;
    max-width: 380px;
    padding: 14px 16px;
    color: var(--toast-text);
    background: var(--toast-bg);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

@media (max-width: 980px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        overflow: visible;
        gap: 16px;
    }

    .nav-stack {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .nav-item {
        justify-content: center;
        text-align: center;
    }

    .two-column,
    .setup-grid,
    .settings-grid,
    .settings-pair {
        grid-template-columns: 1fr;
    }

    .insight-grid,
    .ops-grid,
    .metrics-grid,
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .workspace {
        padding: 18px;
    }
}

@media (max-width: 640px) {
    .topbar,
    .section-header,
    .quick-price-header,
    .setup-option,
    .job-card,
    .inbox-card,
    .request-card {
        align-items: stretch;
        flex-direction: column;
        grid-template-columns: 1fr;
    }

    .request-rank {
        grid-template-columns: auto auto;
        justify-content: start;
        justify-items: start;
        width: fit-content;
        padding: 8px 10px;
    }

    .request-actions {
        justify-content: stretch;
    }

    .inbox-actions {
        justify-content: stretch;
    }

    .inbox-actions .primary-button,
    .inbox-actions .secondary-button {
        width: 100%;
    }

    .sync-controls {
        justify-content: flex-start;
    }

    .inbox-header-actions {
        inline-size: 100%;
        justify-items: start;
    }

    .email-status {
        text-align: left;
    }

    .currency-field {
        width: 100%;
    }

    .quick-price-table {
        min-width: 640px;
        table-layout: auto;
    }

    .request-actions .primary-button,
    .request-actions .secondary-button {
        width: 100%;
    }

    .nav-stack,
    .request-tabs,
    .intake-grid,
    .manual-attachment-panel,
    .manual-attachment-controls,
    .import-grid,
    .summary-grid,
    .insight-grid,
    .ops-grid,
    .risk-grid,
    .metrics-grid,
    .dashboard-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }

    .request-tabs {
        display: grid;
        gap: 6px;
        padding-left: 0;
        border-bottom: 0;
    }

    .request-tab {
        border: 1px solid var(--border);
        border-radius: 8px;
    }

    .intake-checklist {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .automation-mode-options {
        display: grid;
        grid-template-columns: 1fr;
    }

    .sync-schedule-controls,
    .sync-schedule-panel,
    .sync-quiet-header,
    .sync-quiet-row,
    .sync-quiet-row.is-time,
    .sync-time-row,
    .sync-date-row,
    .clock-message-horizon,
    .clock-message-horizon-controls,
    .clock-card-grid,
    .clock-routing-grid,
    #auto-sync-interval-panel {
        grid-template-columns: 1fr;
    }

    .clock-routing-grid .clock-contact-field {
        grid-column: auto;
    }

    .topbar h2 {
        font-size: 24px;
    }

    .workflow-empty-state {
        min-height: auto;
        padding: 20px;
    }

    .workflow-empty-flow {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .workflow-empty-rail {
        width: 2px;
        height: 24px;
        justify-self: center;
        background: linear-gradient(
            180deg,
            color-mix(in srgb, var(--primary) 30%, transparent),
            color-mix(in srgb, var(--accent) 42%, transparent)
        );
    }
}

/* Per-message "Schedule send" box in Workflow Review */
.schedule-send-box {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    display: grid;
    gap: 8px;
}

.schedule-send-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.schedule-send-status {
    color: var(--muted);
    font-size: 13px;
}

.schedule-send-hint {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.schedule-send-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.schedule-send-controls input[type="datetime-local"] {
    flex: 1 1 220px;
    min-height: 38px;
}

.schedule-extra {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
    display: grid;
    gap: 8px;
}

.schedule-extra > p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.job-scheduled-badge {
    margin: 4px 0 0;
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
    background: var(--good-bg);
    border: 1px solid var(--primary);
    border-radius: 999px;
    padding: 2px 10px;
}
