﻿@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700;800&family=Space+Grotesk:wght@600;700&display=swap');

:root,
:root[data-theme="dark"] {
    --bg-app: #111826;
    --bg-nav: #182236;
    --bg-list: #1a273d;
    --bg-editor: #152033;
    --bg-card: #202f46;
    --bg-input: #1f2d43;
    --bg-hover: #253752;
    --bg-active: #2c4060;

    --border-subtle: rgba(171, 194, 228, 0.16);
    --border-soft: rgba(171, 194, 228, 0.24);
    --border-strong: rgba(126, 164, 255, 0.48);

    --text-strong: #f4f7ff;
    --text-main: #e3eaf8;
    --text-muted: #9fb2d1;
    --text-dim: #7488a9;

    --blue-main: #4b79ff;
    --blue-hover: #5f89ff;
    --blue-pressed: #3d69ec;
    --blue-soft: rgba(75, 121, 255, 0.2);

    --success-bg: rgba(73, 198, 142, 0.14);
    --success-text: #8be0b3;
    --warning-bg: rgba(237, 182, 78, 0.18);
    --warning-text: #f7d38b;
    --danger-bg: rgba(217, 87, 108, 0.16);
    --danger-text: #ffb5c2;

    --surface-shadow: 0 20px 40px rgba(4, 10, 22, 0.38);
    --section-shadow: 0 10px 24px rgba(5, 11, 26, 0.26);
}

:root[data-theme="light"] {
    --bg-app: #edf2fb;
    --bg-nav: #f6f9ff;
    --bg-list: #f7faff;
    --bg-editor: #ffffff;
    --bg-card: #f7f9ff;
    --bg-input: #eef3fc;
    --bg-hover: #e8eefb;
    --bg-active: #dde8fd;

    --border-subtle: rgba(56, 78, 120, 0.14);
    --border-soft: rgba(56, 78, 120, 0.22);
    --border-strong: rgba(74, 122, 255, 0.45);

    --text-strong: #142036;
    --text-main: #273754;
    --text-muted: #5f7398;
    --text-dim: #7c90b0;

    --blue-main: #4a7aff;
    --blue-hover: #628fff;
    --blue-pressed: #3e6be6;
    --blue-soft: rgba(74, 122, 255, 0.14);

    --success-bg: rgba(38, 174, 111, 0.14);
    --success-text: #227c52;
    --warning-bg: rgba(222, 158, 32, 0.18);
    --warning-text: #845c10;
    --danger-bg: rgba(212, 73, 95, 0.14);
    --danger-text: #9d3651;

    --surface-shadow: 0 18px 38px rgba(24, 41, 78, 0.14);
    --section-shadow: 0 8px 20px rgba(24, 41, 78, 0.11);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    height: 100%;
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--text-main);
    background: radial-gradient(circle at 12% 6%, rgba(74, 122, 255, 0.12), transparent 32%),
        radial-gradient(circle at 88% 0%, rgba(56, 152, 255, 0.1), transparent 30%),
        var(--bg-app);
    overflow: hidden;
}

#app {
    height: 100%;
}

a {
    color: inherit;
}

.dashboard-shell {
    width: 100vw;
    height: 100vh;
    min-height: 100vh;
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    background: transparent;
    overflow: hidden;
}

.sidebar-shell {
    background: var(--bg-nav);
    border-right: 1px solid var(--border-subtle);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.03);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    min-height: 62px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    padding: 0 14px;
}

.sidebar-brand-text {
    min-width: 0;
}

.sidebar-title {
    color: var(--text-strong);
    font-family: "Space Grotesk", "Manrope", sans-serif;
    font-size: 1.03rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.sidebar-subtitle {
    margin-top: 2px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
}

.sidebar-links {
    display: grid;
    gap: 8px;
}

.side-link {
    min-height: 44px;
    border-radius: 12px;
    padding: 0 14px;
    display: grid;
    grid-template-columns: 18px 1fr;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: background-color 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.side-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border-color: var(--border-subtle);
}

.side-link.active {
    background: var(--blue-soft);
    border-color: var(--border-strong);
    color: var(--text-strong);
}

.side-link-icon {
    width: 16px;
    height: 16px;
    display: block;
    fill: currentColor;
    opacity: 0.96;
}

.side-link-text {
    font-size: 13px;
    font-weight: 700;
}

.dashboard-main {
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
    min-height: 0;
}

.topbar-shell {
    min-height: 72px;
    background: rgba(17, 26, 40, 0.72);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.topbar-title-wrap {
    min-width: 0;
}

.topbar-title {
    font-family: "Space Grotesk", "Manrope", sans-serif;
    font-size: 25px;
    font-weight: 700;
    line-height: 1.08;
    color: var(--text-strong);
    white-space: nowrap;
}

.topbar-subtitle {
    margin-top: 2px;
    color: var(--text-dim);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.health-pill,
.server-time-pill,
.user-pill {
    min-height: 32px;
    padding: 0 11px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--border-soft);
}

.health-pill.status-ok {
    background: var(--success-bg);
    color: var(--success-text);
}

.health-pill.status-fail {
    background: var(--danger-bg);
    color: var(--danger-text);
}

.health-pill.status-unknown {
    background: var(--warning-bg);
    color: var(--warning-text);
}

.server-time-pill {
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
}

.server-time-pill.connected {
    border-color: var(--border-strong);
    color: var(--text-main);
}

.server-time-pill.disconnected {
    opacity: 0.8;
}

.user-pill {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.dashboard-content {
    padding: 24px;
    min-width: 0;
    min-height: 0;
    overflow: auto;
}

.master-detail-layout,
.two-pane-layout {
    display: grid;
    grid-template-columns: minmax(340px, 380px) minmax(0, 1fr);
    gap: 24px;
    min-height: calc(100vh - 72px - 48px);
    align-items: start;
}

.list-panel,
.pane-left {
    background: var(--bg-list);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 16px;
    min-height: 0;
    box-shadow: var(--surface-shadow);
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 12px;
    overflow: hidden;
}

.editor-stage,
.pane-right {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
}

.editor-panel {
    max-width: 1100px;
    width: 100%;
    background: var(--bg-editor);
    border: 1px solid var(--border-subtle);
    border-radius: 22px;
    padding: 24px;
    box-shadow: var(--surface-shadow);
}

.lead-list-header {
    display: grid;
    gap: 10px;
}

.lead-control-zone {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 10px;
}

.lead-mobile-toolbar,
.lead-list-overlay {
    display: none;
}

.lead-search-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.status-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.status-filters.compact {
    gap: 5px;
}

.status-chip {
    min-height: 30px;
    padding-inline: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 9px;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: all 0.16s ease;
}

.status-chip:hover {
    background: var(--bg-hover);
    border-color: var(--border-soft);
    color: var(--text-main);
}

.status-chip.active {
    background: var(--blue-soft);
    border-color: var(--border-strong);
    color: var(--text-strong);
}

.lead-list-scroll {
    min-height: 0;
    overflow: auto;
    display: grid;
    gap: 10px;
    align-content: start;
    padding-right: 2px;
}

.lead-row-wrap {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
}

.lead-row {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 12px 13px;
    display: grid;
    gap: 6px;
    text-align: left;
    color: var(--text-main);
    cursor: pointer;
    transition: border-color 0.16s ease, background-color 0.16s ease, transform 0.16s ease;
}

.lead-row:hover {
    background: var(--bg-hover);
    border-color: var(--border-soft);
    transform: translateY(-1px);
}

.lead-row-wrap.selected .lead-row,
.lead-row.selected {
    background: var(--bg-active);
    border-color: var(--border-strong);
    box-shadow: inset 0 0 0 1px rgba(127, 164, 255, 0.17);
}

.lead-row-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.lead-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-strong);
    line-height: 1.15;
}

.lead-row-subtitle {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.lead-row-problem {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    line-height: 1.4;
}

.lead-row-meta,
.lead-row-next {
    font-size: 12px;
    color: var(--text-dim);
}

.status-badge {
    min-height: 22px;
    padding: 0 9px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    display: inline-flex;
    align-items: center;
    border: 1px solid transparent;
}

.status-badge.status-new {
    background: rgba(75, 121, 255, 0.18);
    border-color: rgba(127, 164, 255, 0.38);
    color: #a9c0ff;
}

.status-badge.status-contact {
    background: rgba(53, 178, 219, 0.18);
    border-color: rgba(99, 208, 243, 0.34);
    color: #9edff9;
}

.status-badge.status-waiting {
    background: rgba(232, 175, 74, 0.2);
    border-color: rgba(255, 209, 117, 0.34);
    color: #f9d98d;
}

.status-badge.status-inprogress {
    background: rgba(83, 194, 145, 0.18);
    border-color: rgba(115, 221, 175, 0.34);
    color: #9de4bf;
}

.status-badge.status-paused {
    background: rgba(167, 126, 223, 0.18);
    border-color: rgba(199, 162, 248, 0.33);
    color: #d8bbff;
}

.status-badge.status-done {
    background: rgba(149, 164, 186, 0.18);
    border-color: rgba(191, 202, 220, 0.28);
    color: #c7d3e7;
}

.editor-shell {
    display: grid;
    gap: 16px;
    align-content: start;
}

.lead-editor-grid {
    display: grid;
    gap: 16px;
    width: 100%;
    align-items: start;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(0, 0.9fr);
}

.lead-grid-item {
    min-width: 0;
}

.lead-grid-header {
    grid-column: 1 / -1;
}

.lead-grid-notice {
    grid-column: 1 / -1;
}

.lead-grid-client {
    grid-column: 1 / span 2;
}

.lead-grid-boat {
    grid-column: 3;
}

.lead-grid-motor {
    grid-column: 3;
}

.lead-grid-task {
    grid-column: 1 / span 2;
}

.lead-grid-planning {
    grid-column: 3;
}

.lead-grid-checklist {
    grid-column: 3;
}

.lead-grid-comment {
    grid-column: 1 / span 2;
}

.lead-grid-kit {
    grid-column: 1 / -1;
}

.editor-header-card {
    position: sticky;
    top: 8px;
    z-index: 6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--border-soft);
    background: linear-gradient(145deg, rgba(75, 121, 255, 0.07), rgba(255, 255, 255, 0.02));
    backdrop-filter: blur(7px);
    box-shadow: var(--section-shadow);
}

.editor-header-main {
    min-width: 0;
}

.editor-title {
    font-family: "Space Grotesk", "Manrope", sans-serif;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-strong);
}

.editor-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    line-height: 1.4;
}

.editor-header-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.lead-floating-status-field {
    min-width: 210px;
    gap: 4px;
}

.lead-status-select {
    min-height: 40px;
    font-size: 13px;
}

.lead-status-pill {
    min-height: 30px;
    padding-inline: 11px;
}

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

.tab-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tab-btn {
    min-height: 34px;
    padding-inline: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    transition: all 0.16s ease;
}

.tab-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-soft);
    color: var(--text-main);
}

.tab-btn.active {
    background: var(--blue-soft);
    border-color: var(--border-strong);
    color: var(--text-strong);
}

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

.editor-column {
    display: grid;
    gap: 16px;
}

.editor-section-card,
.editor-section,
.settings-editor,
.users-create,
.checklist-block {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 20px;
    display: grid;
    gap: 12px;
    box-shadow: var(--section-shadow);
}

.section-span-full {
    width: 100%;
}

.section-title,
.section-header,
.checklist-block h4,
.settings-card h3,
.users-create h4,
.auth-card h1 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--text-strong);
    text-transform: uppercase;
}

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

.field-span-2 {
    grid-column: 1 / -1;
}

.field-block {
    display: grid;
    gap: 6px;
}

.field-block label,
.auth-form label,
.backup-edit-grid label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.form-input {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    border-radius: 12px;
    min-height: 44px;
    padding: 0 13px;
    font-size: 14px;
    width: 100%;
    outline: none;
    font-family: inherit;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

.form-input:hover {
    border-color: var(--border-soft);
    background: color-mix(in oklab, var(--bg-input) 86%, var(--bg-hover));
}

textarea.form-input {
    min-height: 108px;
    padding: 11px 13px;
    resize: vertical;
}

.form-input::placeholder {
    color: var(--text-dim);
}

.form-input:focus {
    border-color: var(--blue-main);
    box-shadow: 0 0 0 4px rgba(75, 121, 255, 0.22);
}

.form-input option {
    color: var(--text-main);
    background: var(--bg-card);
}

select.form-input {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background: var(--bg-input) !important;
    background-clip: padding-box;
    color: var(--text-main) !important;
    padding-right: 56px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239fb2d1' stroke-width='2.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 18px center !important;
    background-size: 20px 20px !important;
    transition: background-color 0.16s ease, background-image 0.16s ease;
}

select.form-input:focus,
select.form-input:hover {
    background-color: color-mix(in oklab, var(--bg-input) 86%, var(--bg-hover)) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%239fb2d1' stroke-width='2.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E") !important;
}

@supports selector(select:open) {
    select.form-input:open {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23e3eaf8' stroke-width='2.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 15 12 9 18 15'/%3E%3C/svg%3E") !important;
    }
}

select.form-input::-ms-expand {
    display: none;
}

.text-area {
    min-height: 108px;
}

.next-contact-single-field {
    position: relative;
}

.next-contact-text-input {
    padding-right: 50px;
}

.next-contact-picker-icon {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    pointer-events: none;
    font-size: 17px;
    color: var(--text-muted);
}

.next-contact-picker-hitbox {
    position: absolute;
    top: 4px;
    right: 4px;
    bottom: 4px;
    width: 42px;
    border: none;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.btn {
    border-radius: 12px;
    border: 1px solid transparent;
    min-height: 42px;
    padding: 0 14px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-family: inherit;
    transition: all 0.16s ease;
}

.btn:disabled {
    opacity: 0.62;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--blue-main);
    color: #ffffff;
    border-color: var(--blue-main);
}

.btn-primary:hover {
    background: var(--blue-hover);
    border-color: var(--blue-hover);
}

.btn-primary:active {
    background: var(--blue-pressed);
    border-color: var(--blue-pressed);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    border-color: var(--border-subtle);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-soft);
}

.btn-danger {
    background: rgba(217, 87, 108, 0.12);
    color: var(--danger-text);
    border-color: rgba(255, 171, 187, 0.32);
}

.btn-danger:hover {
    background: rgba(217, 87, 108, 0.22);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
    min-height: 38px;
}

.btn-ghost:hover {
    border-color: var(--border-subtle);
    background: rgba(255, 255, 255, 0.03);
}

.btn-sm {
    min-height: 34px;
    padding: 0 10px;
    font-size: 12px;
    border-radius: 10px;
}

.w-full {
    width: 100%;
}

.inline-note,
.inline-error,
.inline-success {
    border-radius: 12px;
    padding: 11px 12px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid transparent;
}

.inline-note {
    background: rgba(255, 255, 255, 0.03);
    border-color: var(--border-subtle);
    color: var(--text-muted);
}

.inline-error {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: rgba(255, 171, 187, 0.32);
}

.inline-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: rgba(139, 224, 179, 0.31);
}

.lookup-field {
    position: relative;
}

.lookup-shell {
    position: relative;
}

.lookup-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
}

.lookup-actions {
    display: flex;
    gap: 6px;
}

.lookup-btn {
    min-width: 40px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: var(--bg-input);
    color: var(--text-muted);
    cursor: pointer;
    font-weight: 700;
}

.lookup-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-soft);
    color: var(--text-main);
}

.lookup-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.lookup-input-invalid {
    border-color: rgba(255, 171, 187, 0.72);
    box-shadow: 0 0 0 3px rgba(217, 87, 108, 0.2);
}

.lookup-validation-error {
    margin-top: 6px;
    color: var(--danger-text);
    font-size: 12px;
    font-weight: 600;
}

.lookup-popup-backdrop {
    position: fixed;
    inset: 0;
    border: none;
    margin: 0;
    padding: 0;
    background: transparent;
    z-index: 1180;
}

.lookup-popup {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1190;
    border: 1px solid var(--border-soft);
    border-radius: 12px;
    background: var(--bg-editor);
    overflow: hidden;
    max-height: 340px;
    overflow-y: auto;
    box-shadow: 0 16px 30px rgba(6, 12, 27, 0.44);
}

.lookup-popup-item,
.boat-result-item {
    width: 100%;
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-main);
    text-align: left;
    padding: 11px 12px;
    cursor: pointer;
    display: grid;
    gap: 2px;
    font-family: inherit;
}

.lookup-popup-item:hover,
.lookup-popup-item.active,
.boat-result-item:hover {
    background: var(--bg-hover);
}

.lookup-popup-item small,
.boat-result-item small {
    color: var(--text-muted);
    font-size: 12px;
}

.lookup-popup-item:last-child,
.boat-result-item:last-child {
    border-bottom: none;
}

.lookup-create-item {
    width: 100%;
    border: none;
    border-top: 1px solid var(--border-subtle);
    background: var(--blue-soft);
    color: var(--text-main);
    text-align: left;
    padding: 11px 12px;
    cursor: pointer;
    font-weight: 700;
}

.lookup-create-item:hover {
    background: rgba(75, 121, 255, 0.28);
}

.lookup-preview-card,
.boat-summary-card {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 11px 12px;
    display: grid;
    gap: 4px;
}

.lookup-preview-title {
    color: var(--text-strong);
    font-size: 13px;
    font-weight: 800;
}

.lookup-preview-row,
.boat-summary-card span {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.lookup-full-modal {
    width: min(980px, 100%);
}

.lookup-full-results {
    max-height: 56vh;
}

.picker-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(7, 12, 24, 0.74);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1200;
    padding: 20px;
    backdrop-filter: blur(5px);
}

.picker-modal {
    width: min(860px, 100%);
    max-height: min(82vh, 760px);
    background: var(--bg-editor);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 16px;
    display: grid;
    gap: 10px;
    box-shadow: 0 24px 38px rgba(3, 8, 19, 0.5);
}

.picker-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.picker-modal-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.picker-results,
.lookup-full-results {
    max-height: 54vh;
    overflow: auto;
}

.picker-combo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    text-align: left;
}

.picker-value {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.picker-arrow {
    color: var(--text-muted);
    font-size: 12px;
}

.checklist-editor-shell {
    display: grid;
    gap: 12px;
}

.chip-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    min-height: 32px;
    padding-inline: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
}

.chip:hover {
    background: var(--bg-hover);
    border-color: var(--border-soft);
}

.inline-add-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

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

.checklist-item-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 8px;
    align-items: center;
}

.table-wrap {
    overflow: auto;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
}

.kit-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
    background: rgba(255, 255, 255, 0.01);
}

.kit-table th,
.kit-table td {
    border: 1px solid var(--border-subtle);
    padding: 8px;
    vertical-align: top;
}

.kit-table th {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: rgba(255, 255, 255, 0.02);
}

.kit-flags {
    display: grid;
    gap: 2px;
}

.kit-flags label {
    font-size: 12px;
    color: var(--text-muted);
}

.settings-card {
    background: var(--bg-editor);
    border: 1px solid var(--border-subtle);
    border-radius: 20px;
    padding: 20px;
    display: grid;
    gap: 14px;
    box-shadow: var(--surface-shadow);
}

.settings-list-editor {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.settings-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
}

.settings-list {
    max-height: 70vh;
    overflow: auto;
    display: grid;
    gap: 8px;
    background: var(--bg-list);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    padding: 12px;
}

.settings-list-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: start;
}

.settings-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.settings-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}

.backup-settings-panel {
    gap: 12px;
}

.backup-history-table td,
.backup-history-table th,
.backup-files-table td,
.backup-files-table th {
    font-size: 12px;
    white-space: nowrap;
}

.backup-history-table td:last-child,
.backup-history-table th:last-child {
    max-width: 340px;
    white-space: normal;
    word-break: break-word;
}

.backup-config-grid {
    display: grid;
    gap: 4px;
    margin-top: 4px;
}

.backup-edit-grid {
    display: grid;
    grid-template-columns: 260px minmax(280px, 1fr);
    gap: 8px 12px;
    align-items: center;
}

.backup-check-row {
    grid-column: 1 / span 2;
}

.backup-check-row label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-main);
    text-transform: none;
    letter-spacing: 0;
    font-size: 13px;
}

.backup-files-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.backup-files-grid h4 {
    margin: 4px 0 8px;
    font-size: 14px;
    color: var(--text-strong);
}

.users-layout {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    align-items: start;
}

.users-list {
    min-width: 0;
}

.users-table {
    min-width: 1000px;
}

.users-inline-input {
    min-width: 180px;
    min-height: 34px;
    padding: 0 10px;
    border-radius: 10px;
}

.users-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.auth-page-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: radial-gradient(circle at 20% 10%, rgba(74, 122, 255, 0.18), transparent 40%), var(--bg-app);
}

.auth-card {
    width: min(420px, 100%);
    background: var(--bg-editor);
    border: 1px solid var(--border-soft);
    border-radius: 18px;
    padding: 20px;
    display: grid;
    gap: 10px;
    box-shadow: var(--surface-shadow);
}

.auth-subtitle {
    margin: 0 0 6px;
    color: var(--text-muted);
}

.auth-form {
    display: grid;
    gap: 8px;
}

.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
    text-transform: none;
}

.inline-form {
    margin: 0;
}

.lead-row-wrap.no-actions {
    grid-template-columns: 1fr;
}

input[type="checkbox"] {
    accent-color: var(--blue-main);
}

#blazor-error-ui {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-top: 1px solid rgba(255, 171, 187, 0.35);
    bottom: 0;
    display: none;
    left: 0;
    padding: 0.7rem 1rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 1560px) {
    .editor-panel {
        padding: 20px;
    }
}

@media (max-width: 1399px) {
    .master-detail-layout,
    .two-pane-layout {
        grid-template-columns: minmax(300px, 320px) minmax(0, 1fr);
    }

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

    .lead-grid-client,
    .lead-grid-task,
    .lead-grid-comment {
        grid-column: 1 / -1;
    }

    .lead-grid-boat,
    .lead-grid-motor,
    .lead-grid-planning,
    .lead-grid-checklist {
        grid-column: auto;
    }

    .settings-grid,
    .settings-list-editor,
    .users-layout {
        grid-template-columns: 1fr;
    }

    .editor-panel {
        max-width: 100%;
    }
}

@media (max-width: 1023px) {
    .master-detail-layout,
    .two-pane-layout {
        grid-template-columns: 1fr;
    }

    .lead-editor-grid {
        grid-template-columns: 1fr;
    }

    .lead-grid-item,
    .lead-grid-notice {
        grid-column: 1 / -1;
    }

    .lead-mobile-toolbar {
        display: flex;
        width: 100%;
        margin-bottom: 12px;
    }

    .lead-list-toggle {
        min-height: 40px;
    }

    .lead-master-detail {
        position: relative;
    }

    .lead-master-detail>.list-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 360px);
        max-height: none;
        border-radius: 0 20px 20px 0;
        transform: translateX(-108%);
        transition: transform 0.22s ease;
        z-index: 1400;
        overflow: auto;
    }

    .lead-master-detail.lead-list-open>.list-panel {
        transform: translateX(0);
    }

    .lead-master-detail>.editor-stage {
        width: 100%;
    }

    .lead-master-detail>.editor-stage .editor-panel {
        width: 100%;
        max-width: 100%;
    }

    .lead-list-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1350;
        background: rgba(6, 11, 22, 0.48);
        border: none;
        margin: 0;
        padding: 0;
    }
}

@media (max-width: 1100px) {
    .editor-columns,
    .form-grid-2,
    .backup-files-grid,
    .inline-add-row,
    .checklist-item-row {
        grid-template-columns: 1fr;
    }

    .field-span-2,
    .backup-check-row {
        grid-column: auto;
    }

    .backup-edit-grid {
        grid-template-columns: 1fr;
    }

    .topbar-title {
        font-size: 22px;
    }
}

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

    .sidebar-shell {
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: 12px;
    }

    .sidebar-brand {
        min-height: 52px;
    }

    .topbar-shell {
        padding: 10px 12px;
        flex-direction: column;
        align-items: stretch;
        min-height: 0;
    }

    .topbar-left,
    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }

    .dashboard-content {
        padding: 14px;
    }

    .master-detail-layout,
    .two-pane-layout {
        gap: 14px;
        min-height: auto;
    }

    .lead-master-detail {
        gap: 24px;
    }

    .list-panel,
    .pane-left,
    .editor-panel,
    .settings-card {
        border-radius: 16px;
        padding: 14px;
    }

    .lead-master-detail>.list-panel {
        border-radius: 0 20px 20px 0;
        padding: 16px;
    }

    .lead-master-detail>.editor-stage .editor-panel {
        padding: 24px;
    }

    .editor-header-card {
        position: static;
    }

    .lead-search-row {
        grid-template-columns: 1fr;
    }

    .lead-floating-status-field {
        min-width: 180px;
        flex: 0 1 220px;
    }
}

/* Lead workspace responsive master-detail grid */
.workspace-container {
    width: 100%;
    min-width: 0;
}

.lead-workspace {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 0;
    min-width: 0;
}

.lead-workspace .lead-master-detail {
    display: grid;
    grid-template-columns: clamp(340px, 22vw, 380px) minmax(980px, 1fr);
    gap: 24px;
    align-items: start;
    min-height: calc(100vh - 72px - 48px);
    width: 100%;
}

.lead-workspace .editor-stage {
    width: 100%;
    align-items: stretch;
    min-width: 0;
}

.lead-workspace .editor-panel {
    width: 100%;
    max-width: none;
    min-width: 0;
    padding: 24px;
}

.lead-workspace .lead-mobile-toolbar,
.lead-workspace .lead-list-overlay {
    display: none;
}

.lead-workspace .lead-editor-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.lead-workspace .lead-grid-header,
.lead-workspace .lead-grid-notice,
.lead-workspace .lead-grid-client,
.lead-workspace .lead-grid-task,
.lead-workspace .lead-grid-comment,
.lead-workspace .lead-grid-checklist,
.lead-workspace .lead-grid-kit,
.lead-workspace .lead-grid-boat,
.lead-workspace .lead-grid-motor,
.lead-workspace .lead-grid-planning {
    grid-column: 1 / -1;
    grid-row: auto;
}

@media (min-width: 1200px) and (max-width: 1599px) {
    .lead-workspace .lead-master-detail {
        grid-template-columns: clamp(300px, 24vw, 320px) minmax(0, 1fr);
    }

    .lead-workspace .lead-editor-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lead-workspace .lead-grid-boat,
    .lead-workspace .lead-grid-motor,
    .lead-workspace .lead-grid-planning {
        grid-column: auto;
    }

    .lead-workspace .lead-grid-checklist {
        grid-column: 1 / -1;
    }
}

@media (min-width: 1600px) {
    .lead-workspace .lead-master-detail {
        grid-template-columns: clamp(340px, 22vw, 380px) minmax(980px, 1fr);
    }

    .lead-workspace .lead-editor-grid {
        grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.15fr) minmax(320px, 0.95fr);
    }

    .lead-workspace .lead-grid-client,
    .lead-workspace .lead-grid-task {
        grid-column: 1 / span 2;
    }

    .lead-workspace .lead-grid-boat,
    .lead-workspace .lead-grid-motor,
    .lead-workspace .lead-grid-planning,
    .lead-workspace .lead-grid-checklist {
        grid-column: 3;
    }

    .lead-workspace .lead-grid-comment {
        grid-column: 1 / span 2;
    }

    .lead-workspace .lead-grid-checklist .checklist-editor-shell {
        max-height: 640px;
        overflow: auto;
        padding-right: 4px;
    }
}

@media (max-width: 1199px) {
    .lead-workspace .lead-master-detail {
        grid-template-columns: 1fr;
        gap: 24px;
        position: relative;
        min-height: auto;
    }

    .lead-workspace .lead-editor-grid {
        grid-template-columns: 1fr;
    }

    .lead-workspace .lead-grid-item,
    .lead-workspace .lead-grid-notice {
        grid-column: 1 / -1;
    }

    .lead-workspace .lead-mobile-toolbar {
        display: flex;
        width: 100%;
        margin-bottom: 12px;
    }

    .lead-workspace .lead-list-toggle {
        min-height: 40px;
    }

    .lead-workspace .lead-master-detail > .list-panel {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(88vw, 360px);
        max-height: none;
        border-radius: 0 20px 20px 0;
        transform: translateX(-108%);
        transition: transform 0.22s ease;
        z-index: 1400;
        overflow: auto;
    }

    .lead-workspace .lead-master-detail.lead-list-open > .list-panel {
        transform: translateX(0);
    }

    .lead-workspace .lead-list-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1350;
        background: rgba(6, 11, 22, 0.48);
        border: none;
        margin: 0;
        padding: 0;
    }
}

/* Lead editor block type overrides */
.lead-workspace .lead-grid-summary,
.lead-workspace .lead-grid-kit {
    grid-column: 1 / -1;
}

.lead-workspace .lead-summary-grid {
    display: grid;
    grid-template-columns: minmax(0, 8fr) minmax(300px, 4fr);
    gap: 16px;
    align-items: start;
}

.lead-workspace .lead-summary-item {
    min-width: 0;
}

.lead-workspace .summary-wide {
    grid-column: 1;
}

.lead-workspace .summary-side {
    grid-column: 2;
}

.lead-workspace .summary-form-block {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 18px;
    padding: 18px;
    display: grid;
    gap: 12px;
    box-shadow: var(--section-shadow);
}

.lead-workspace .helper-block {
    background: color-mix(in oklab, var(--bg-card) 88%, rgba(75, 121, 255, 0.09));
    border: 1px solid color-mix(in oklab, var(--border-subtle) 72%, rgba(135, 166, 255, 0.36));
    border-radius: 16px;
    padding: 14px;
    display: grid;
    gap: 10px;
    box-shadow: var(--section-shadow);
}

.lead-workspace .summary-checklist-block {
    max-height: 560px;
    min-height: 0;
    overflow: hidden;
}

.lead-workspace .summary-checklist-block .helper-checklist-shell {
    max-height: 100%;
    overflow: auto;
    padding-right: 4px;
}

.lead-workspace .workspace-block {
    background: color-mix(in oklab, var(--bg-editor) 88%, rgba(75, 121, 255, 0.08));
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 16px;
    display: grid;
    gap: 14px;
    box-shadow: var(--surface-shadow);
}

.workspace-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 2px;
}

.checklist-editor-shell.helper-checklist-shell {
    display: grid;
    gap: 10px;
    align-content: start;
}

.helper-checklist-group {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.helper-checklist-group h4 {
    margin: 0;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--text-strong);
    text-transform: uppercase;
}

.helper-inline-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.helper-inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.helper-inline-add-row {
    grid-template-columns: minmax(0, 1fr) auto;
}

.compact-chip-wrap {
    gap: 6px;
}

.checklist-items-scroll {
    max-height: 270px;
    overflow: auto;
    padding-right: 4px;
}

.btn-compact {
    min-height: 34px;
    padding-inline: 10px;
    font-size: 12px;
}

.lookup-summary-block .lookup-field {
    gap: 6px;
}

.lookup-preview-empty {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border-subtle);
    border-radius: 14px;
    padding: 11px 12px;
    display: grid;
    gap: 4px;
}

.kit-workspace-shell {
    display: grid;
    gap: 12px;
}

.action-block {
    background: var(--bg-card);
    border: 1px solid color-mix(in oklab, var(--border-subtle) 70%, rgba(131, 170, 255, 0.35));
    border-radius: 16px;
    padding: 12px;
    display: grid;
    gap: 10px;
}

.kit-toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.kit-toolbar-row .form-input {
    flex: 1 1 300px;
    min-width: 230px;
    max-width: 420px;
}

.kit-toolbar-search-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.workspace-segment-block {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 12px;
    display: grid;
    gap: 10px;
    min-width: 0;
}

.kit-tab-row {
    margin-bottom: 2px;
}

.data-grid-block {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 10px;
    display: grid;
    gap: 10px;
    min-width: 0;
}

.data-grid-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.data-grid-header-row h4,
.notes-header-row h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    color: var(--text-strong);
}

.data-grid-scroll {
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    overflow: auto;
    min-width: 0;
    max-width: 100%;
    max-height: 62vh;
    background: rgba(255, 255, 255, 0.01);
}

.kit-grid {
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
}

.kit-grid th,
.kit-grid td {
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px;
    vertical-align: top;
}

.kit-grid th {
    position: sticky;
    top: 0;
    z-index: 4;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: color-mix(in oklab, var(--bg-card) 85%, rgba(37, 51, 79, 0.4));
}

.kit-grid .col-name {
    min-width: 280px;
}

.kit-grid .col-quantity,
.kit-grid .col-planfact,
.kit-grid .col-price {
    min-width: 220px;
}

.kit-grid .col-flags {
    min-width: 270px;
}

.kit-grid .col-unit {
    min-width: 120px;
}

.kit-grid .col-notes {
    min-width: 260px;
}

.kit-grid .col-actions {
    min-width: 128px;
}

.kit-grid .actions-col {
    position: sticky;
    right: 0;
    z-index: 3;
    background: color-mix(in oklab, var(--bg-card) 87%, rgba(28, 42, 66, 0.3));
}

.kit-grid thead .actions-col {
    z-index: 6;
}

.kit-grid tbody tr:last-child td {
    border-bottom: none;
}

.grid-inline-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(120px, 1fr));
    gap: 8px;
}

.kit-grid .form-input {
    min-height: 40px;
}

.kit-flags {
    display: grid;
    gap: 6px;
}

.kit-flags label {
    font-size: 12px;
    color: var(--text-muted);
}

.notes-block {
    padding: 12px;
}

.notes-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.kit-notes-textarea {
    min-height: 210px;
    resize: vertical;
}

@media (max-width: 1499px) {
    .lead-workspace .lead-summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .lead-workspace .summary-wide {
        grid-column: 1 / -1;
    }

    .lead-workspace .summary-side {
        grid-column: auto;
    }
}

@media (max-width: 1023px) {
    .lead-workspace .lead-summary-grid {
        grid-template-columns: 1fr;
    }

    .lead-workspace .summary-wide,
    .lead-workspace .summary-side {
        grid-column: 1 / -1;
    }

    .kit-toolbar-search-row,
    .helper-inline-add-row,
    .grid-inline-fields {
        grid-template-columns: 1fr;
    }
}
