@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans-400.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans-400-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans-500.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans-500-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans-600.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans-600-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans-700.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url("/fonts/plus-jakarta-sans-700-ext.woff2") format("woff2");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
    --bg: #f4f7fb;
    --bg-soft: #eef3f9;
    --panel: #ffffff;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --text: #0f172a;
    --muted: #64748b;
    --accent: #2563eb;
    --accent-soft: #dbeafe;
    --accent-strong: #1d4ed8;
    --success: #059669;
    --warning: #d97706;
    --danger: #dc2626;
    --shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
    --radius: 16px;
    --font: "Plus Jakarta Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.08), transparent 28%),
        linear-gradient(180deg, #f8fbff 0%, var(--bg) 40%, #edf2f7 100%);
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 {
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0;
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    padding: 1.5rem 1.15rem;
    border-right: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.brand {
    display: flex;
    gap: 0.85rem;
    align-items: center;
    padding: 0.25rem 0.4rem;
}

.brand-mark {
    width: 2.55rem;
    height: 2.55rem;
    border-radius: 0.85rem;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #3b82f6, #1d4ed8);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

.brand strong { display: block; font-size: 0.98rem; }
.brand small { color: var(--muted); font-size: 0.78rem; }

.nav { display: flex; flex-direction: column; gap: 0.3rem; }
.nav a {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.72rem 0.9rem;
    border-radius: 12px;
    color: var(--muted);
    font-weight: 500;
    transition: 0.15s ease;
}
.nav a svg {
    width: 1.1rem;
    height: 1.1rem;
    flex-shrink: 0;
    opacity: 0.9;
}
.nav a:hover, .nav a.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
}
.nav a:hover svg,
.nav a.active svg {
    opacity: 1;
}

.sync-form { margin-top: auto; }
.sidebar-note {
    margin: 0;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.4;
}
.sidebar-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--line);
}
.sidebar-user strong { display: block; font-size: 0.9rem; }
.sidebar-user small { color: var(--muted); font-size: 0.75rem; }

.auth-body {
    min-height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(37, 99, 235, 0.12), transparent 45%),
        radial-gradient(ellipse at 80% 90%, rgba(234, 88, 12, 0.08), transparent 40%),
        var(--bg);
}
.auth-card {
    width: min(320px, 100%);
    max-width: 320px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}
.auth-brand { margin-bottom: 1.25rem; }
.auth-form {
    display: grid;
    gap: 1rem;
    max-width: none;
}
.auth-form label { display: grid; gap: 0.4rem; font-size: 0.9rem; color: var(--muted); }
.auth-form input { width: 100%; box-sizing: border-box; }
.auth-submit {
    width: auto;
    justify-self: start;
    min-width: 7.5rem;
    padding-inline: 1.35rem;
}

.main { padding: 1.75rem 2rem 2.5rem; }

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.topbar h1 { font-size: clamp(1.55rem, 2vw, 2rem); }
.topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}
.btn-with-icon svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 0.65rem 1rem;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s ease;
}
.btn-primary {
    background: linear-gradient(145deg, #3b82f6, #2563eb);
    color: #fff;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.22);
}
.btn-primary:hover { filter: brightness(1.04); }
.btn-ghost {
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}
.btn-ghost:hover { background: var(--bg-soft); border-color: var(--line-strong); }
.btn-danger {
    background: #fef2f2;
    color: var(--danger);
    border-color: #fecaca;
}
.btn-sm { padding: 0.4rem 0.7rem; font-size: 0.85rem; }
.btn-block { width: 100%; }

.flash {
    margin-bottom: 1.25rem;
    padding: 0.9rem 1rem;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
}
.flash-success { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.flash-error { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.flash-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

.grid { display: grid; gap: 1rem; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.stat, .panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.stat { padding: 1.15rem 1.2rem; }
.stat .label { color: var(--muted); font-size: 0.84rem; margin-bottom: 0.45rem; font-weight: 500; }
.stat .value {
    font-size: 1.55rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}
.stat .hint { margin-top: 0.35rem; color: var(--muted); font-size: 0.8rem; }
.stat-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.stat-badges .badge {
    padding-top: 2px;
    padding-bottom: 3px;
    padding-left: 0.55rem;
    padding-right: 0.55rem;
}
.stat-badges .badge.badge-yield {
    background: #d1fae5;
    color: var(--success);
}
.stat-badges .badge.badge-accent {
    background: var(--accent-soft);
    color: var(--accent-strong);
}
.chart-mode-toggle {
    display: inline-flex;
    padding: 2px;
    border-radius: 999px;
    background: #e2e8f0;
    gap: 2px;
}
.chart-mode-btn {
    appearance: none;
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.28rem 0.7rem;
    border-radius: 999px;
    cursor: pointer;
    line-height: 1.2;
}
.chart-mode-btn:hover {
    color: var(--text);
}
.chart-mode-btn.is-active {
    background: #fff;
    color: var(--accent-strong);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}
.depot-chart-hint {
    margin: 0.55rem 0 0;
    font-size: 0.78rem;
    line-height: 1.35;
}

.panel { padding: 1.25rem; }
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.panel-header h2 { font-size: 1.1rem; }
.panel-title-row {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}
.panel-title-row h2 {
    margin: 0;
}
.filters .filter-year {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
}
.dash-drag-handle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    margin: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
    border-radius: 0;
    cursor: grab;
    color: #94a3b8;
    flex-shrink: 0;
    line-height: 0;
}
.dash-drag-handle svg {
    width: 1.35rem;
    height: 1.35rem;
    display: block;
}
.dash-drag-handle:hover { color: #64748b; }
.dash-drag-handle:active { cursor: grabbing; color: #475569; }
.dash-drag-handle:focus { outline: none; }
.dash-drag-handle:focus-visible {
    outline: 2px solid #93c5fd;
    outline-offset: 2px;
    border-radius: 6px;
}
.dash-widget {
    min-width: 0;
    transition: box-shadow 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}
.dash-widget.is-dragging {
    opacity: 0.55;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
}
.dash-widget.is-drop-target {
    outline: 2px dashed #93c5fd;
    outline-offset: 2px;
}

.stack { display: flex; flex-direction: column; gap: 1rem; }
.row { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; }
.trades-table {
    font-size: 0.88rem;
}
.trades-table th,
.trades-table td {
    padding: 0.55rem 0.75rem;
}
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.94rem;
}
th, td {
    text-align: left;
    padding: 0.8rem 0.6rem;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
}
th {
    color: var(--muted);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.accent { color: var(--accent); }
.mono { font-variant-numeric: tabular-nums; }
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 600;
    background: var(--accent-soft);
    color: var(--accent-strong);
}
.badge-est {
    background: #fff7ed;
    color: #c2410c;
}

.share-bar {
    display: flex;
    background: #eff6ff;
    border-radius: 999px;
    height: 10px;
    overflow: hidden;
    min-width: 80px;
}
.share-bar-actual {
    height: 100%;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    flex-shrink: 0;
}
.share-bar-est {
    height: 100%;
    background: linear-gradient(90deg, #ea580c, #fb923c);
    flex-shrink: 0;
}

.delta-up { color: #15803d; }
.delta-down { color: #b91c1c; }
.delta-pct {
    display: block;
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.85;
}

.chart-wrap {
    position: relative;
    height: 280px;
}
.chart-wrap-sm { height: 220px; }
.chart-wrap-donut { height: 300px; }
.chart-wrap-lg { height: 320px; }
.chart-footnote {
    margin: 0.55rem 0 0;
    font-size: 0.78rem;
}
.panel-header-wrap {
    flex-wrap: wrap;
    gap: 0.65rem;
}
.range-pills {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}
.range-pill {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    border-radius: 999px;
    padding: 0.22rem 0.55rem;
    font: inherit;
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
}
.range-pill:hover { border-color: var(--line-strong); color: var(--text); }
.range-pill.active {
    background: var(--accent-soft);
    border-color: #bfdbfe;
    color: var(--accent-strong);
}

.filters select, .form input, .form textarea, .form select {
    width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 12px;
    padding: 0.7rem 0.85rem;
    font: inherit;
}
.filters select { width: auto; min-width: 110px; }
.form {
    display: grid;
    gap: 1rem;
    max-width: 720px;
}
.auth-form.form {
    max-width: none;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
.form-row-equal {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    align-items: start;
}
.form-row-equal > * {
    min-width: 0;
}
.position-summary .summary-label {
    display: block;
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 500;
    margin-bottom: 0.35rem;
}
.position-summary .summary-value {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.35;
    min-height: 1.4em;
}
.form label {
    display: grid;
    gap: 0.4rem;
    font-size: 0.9rem;
    color: var(--muted);
    font-weight: 500;
}
.form label[hidden] {
    display: none !important;
}
.field-hint {
    font-size: 0.78rem;
    font-weight: 500;
    min-height: 1.1em;
}
.hint-ok { color: var(--success); }
.hint-warn { color: var(--warning); }
.form-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.55rem;
}
.cal-head {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0.4rem;
    font-weight: 600;
}
.cal-day {
    min-height: 110px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.55rem;
    background: #fff;
}
.cal-day.empty { opacity: 0.4; background: var(--bg-soft); }
.cal-day.has-div {
    background: #eff6ff;
    border-color: #bfdbfe;
}
.cal-day.has-est {
    background: #fffbeb;
    border-color: #fde68a;
}
.cal-day-num { font-weight: 700; margin-bottom: 0.35rem; }
.cal-item {
    font-size: 0.72rem;
    line-height: 1.25;
    margin-bottom: 0.3rem;
    color: var(--muted);
}
.cal-item strong { color: var(--accent-strong); display: block; }
.cal-item.is-estimate strong { color: #ea580c; }

.month-switcher {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}
.month-switcher a {
    display: inline-flex;
    align-items: baseline;
    gap: 0.3rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.85rem;
    background: #fff;
    white-space: nowrap;
}
.month-switcher .month-sep {
    color: var(--muted);
    opacity: 0.7;
}
.month-switcher .amount-est {
    color: #ea580c;
}
.month-switcher a.active {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: #93c5fd;
}

.actions { display: flex; gap: 0.35rem; flex-wrap: nowrap; justify-content: flex-end; }
.actions form { margin: 0; }
.btn-icon {
    width: 2rem;
    height: 2rem;
    padding: 0;
    border-radius: 10px;
}
.btn-icon svg {
    width: 1rem;
    height: 1rem;
    display: block;
}
.col-actions { width: 1%; white-space: nowrap; }
td.yield-pos, .yield-pos { color: var(--success); font-weight: 600; }
th.col-prev-year,
td.col-prev-year {
    background: #f1f5f9;
}
th.col-prev-year {
    background: #e8eef5;
}
.th-unit {
    display: block;
    font-size: 0.72em;
    font-weight: 500;
    color: var(--muted);
    margin-top: 0.15rem;
}
td.yield-neg, .yield-neg { color: var(--danger); font-weight: 600; }

@media (max-width: 1200px) {
    .grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1100px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }
    .nav { flex-direction: row; flex-wrap: wrap; }
    .form-row { grid-template-columns: 1fr; }
    .calendar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cal-head { display: none; }
    .main { padding: 1.25rem; }
}

/* Sync progress modal */
body.sync-modal-open,
body.app-modal-open { overflow: hidden; }
.sync-modal[hidden] { display: none !important; }
.sync-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}
.sync-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}
.sync-modal-card {
    position: relative;
    width: min(440px, 100%);
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1.35rem 1.4rem 1.2rem;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.2);
}
.sync-modal-card h2 {
    font-size: 1.15rem;
    margin-bottom: 0.45rem;
}
.sync-modal-status {
    margin: 0 0 0.9rem;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.4;
    min-height: 2.6em;
}
.sync-progress {
    height: 10px;
    border-radius: 999px;
    background: #e2e8f0;
    overflow: hidden;
}
.sync-progress-bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb, #60a5fa);
    transition: width 0.25s ease;
}
.sync-progress-bar.is-warn { background: linear-gradient(90deg, #d97706, #fbbf24); }
.sync-progress-bar.is-error { background: linear-gradient(90deg, #dc2626, #f87171); }
.sync-modal-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.55rem;
    font-size: 0.82rem;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.sync-modal-log {
    list-style: none;
    margin: 0.9rem 0 0;
    padding: 0;
    max-height: 160px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #f8fafc;
}
.sync-modal-log li {
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text);
}
.sync-modal-log li:last-child { border-bottom: 0; }
.sync-log-ok { color: #15803d; }
.sync-log-skip { color: #64748b; }
.sync-log-error { color: #b91c1c; }
.sync-modal-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.9rem;
}

/* Position create/edit modal */
.app-modal[hidden] { display: none !important; }
.app-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}
.app-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}
.app-modal-card {
    position: relative;
    width: min(560px, 100%);
    max-height: min(92vh, 900px);
    overflow: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 1.25rem 1.35rem 1.2rem;
    box-shadow: 0 24px 50px rgba(15, 23, 42, 0.2);
}
.app-modal-card-form {
    width: min(720px, 100%);
}
.app-modal-card-wide {
    width: min(1100px, 100%);
}
.import-lead {
    margin: 0 0 1rem;
    line-height: 1.45;
}
.import-meta {
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
}
.import-drop {
    display: grid;
    place-items: center;
    gap: 0.35rem;
    min-height: 160px;
    border: 1.5px dashed var(--line);
    border-radius: 14px;
    background: var(--bg-soft);
    cursor: pointer;
    padding: 1.25rem;
    text-align: center;
}
.import-drop.is-dragover {
    border-color: #93c5fd;
    background: #eff6ff;
}
.import-drop-title {
    font-weight: 600;
}
.import-drop.is-busy {
    pointer-events: none;
    opacity: 0.45;
}
.import-loading {
    display: grid;
    justify-items: center;
    gap: 0.45rem;
    margin-top: 1rem;
    padding: 1.1rem 1rem 1rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f8fafc;
    text-align: center;
}
.import-loading[hidden] {
    display: none !important;
}
.import-loading-spinner {
    width: 1.75rem;
    height: 1.75rem;
    border: 2.5px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: import-spin 0.75s linear infinite;
}
.import-loading-title {
    margin: 0.25rem 0 0;
    font-weight: 600;
}
.import-loading-hint,
.import-loading-elapsed {
    margin: 0;
    font-size: 0.86rem;
    line-height: 1.4;
}
.import-loading-bar {
    width: min(100%, 280px);
    margin-top: 0.35rem;
}
.sync-progress-bar.is-indeterminate {
    width: 40%;
    animation: import-progress-indeterminate 1.2s ease-in-out infinite;
}
@keyframes import-spin {
    to { transform: rotate(360deg); }
}
@keyframes import-progress-indeterminate {
    0% { transform: translateX(-120%); }
    100% { transform: translateX(280%); }
}
.import-table-wrap {
    max-height: min(55vh, 520px);
    overflow: auto;
    margin-bottom: 0.75rem;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.import-table {
    font-size: 0.86rem;
}
.import-table th {
    position: sticky;
    top: 0;
    background: var(--bg-soft);
    z-index: 1;
}
.import-table input,
.import-table select {
    width: 100%;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 8px;
    padding: 0.4rem 0.5rem;
    font: inherit;
}
.import-table .num input {
    text-align: right;
    max-width: 7.5rem;
}
.import-table input[type="date"] {
    min-width: 9.5rem;
}
.import-table input[type="checkbox"] {
    width: auto;
}
.import-name {
    font-weight: 600;
}
.import-note {
    font-size: 0.78rem;
    margin-top: 0.2rem;
}
.import-instr {
    display: grid;
    gap: 0.35rem;
    min-width: 7rem;
}
.import-instr.is-hidden {
    opacity: 0.35;
}
.import-table tr.is-muted-row {
    opacity: 0.72;
}
.import-actions {
    justify-content: flex-end;
}
.app-modal-card-form .form {
    max-width: none;
}
.lots-block {
    display: grid;
    gap: 0.55rem;
}
.lots-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}
.lots-header h3 {
    font-size: 0.95rem;
    margin: 0;
}
.lots-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}
.lots-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.lots-table th,
.lots-table td {
    padding: 0.55rem 0.5rem;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.lots-table th {
    background: var(--bg-soft);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.lots-table tr:last-child td { border-bottom: 0; }
.lots-table input {
    width: 100%;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font: inherit;
}
.lots-table select {
    width: 100%;
    min-width: 0;
    background: #fff;
    border: 1px solid var(--line);
    color: var(--text);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font: inherit;
}
.lots-table .lot-actions {
    width: 1%;
    white-space: nowrap;
}
.app-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.app-modal-header h2 {
    font-size: 1.15rem;
}
.field-emphasis small {
    color: var(--warning);
    font-weight: 600;
}
