/* =============================================
   Recycle Object — Calculator Styles
   ============================================= */

:root {
    --bg: #f5f5f5;
    --bg-card: #ffffff;
    --card-bg: #ffffff;
    --bg-dark: #1a1a1a;
    --text: #1a1a1a;
    --text-secondary: #666;
    --text-muted: #999;
    --border: #e0e0e0;
    --primary: #2563eb;
    --accent: #2563eb;
    --accent-light: #dbeafe;
    --green: #16a34a;
    --green-light: #dcfce7;
    --red: #dc2626;
    --red-light: #fee2e2;
    --yellow: #ca8a04;
    --yellow-light: #fef9c3;
    --orange: #ea580c;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --transition: 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

/* =============================================
   AUTH SCREEN
   ============================================= */

.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg-dark);
}

.auth-box {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 40px;
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.auth-box h1 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 4px;
}

.auth-box p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 13px;
}

.auth-box input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 12px;
    outline: none;
    transition: border var(--transition);
}

.auth-box input:focus {
    border-color: var(--accent);
}

.auth-error {
    color: var(--red);
    font-size: 13px;
    margin-bottom: 12px;
    display: none;
}

/* =============================================
   LAYOUT
   ============================================= */

.app-layout {
    display: none;
    min-height: 100vh;
}

.app-layout.active { display: flex; }

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--bg-dark);
    color: #fff;
    padding: 20px 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-brand {
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 12px;
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 700;
}

.sidebar-brand span {
    font-size: 11px;
    color: rgba(255,255,255,0.5);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}

.sidebar-nav a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-left-color: var(--accent);
}

.sidebar-nav a .nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Main content */
.main-content {
    margin-left: 240px;
    padding: 24px;
    flex: 1;
    min-height: 100vh;
    max-width: calc(100vw - 240px);
    overflow-x: hidden;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
}

/* =============================================
   BUTTONS
   ============================================= */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text);
}
.btn-outline:hover { background: var(--bg); }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

/* =============================================
   CARDS
   ============================================= */

.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.card-header .badge {
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.badge-blue { background: var(--accent-light); color: var(--accent); }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-yellow { background: var(--yellow-light); color: var(--yellow); }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 16px 20px;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
}

.stat-card .stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.stat-card .stat-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
    font-weight: 400;
}
.stat-positive { color: var(--green); }
.stat-negative { color: var(--red); }

/* =============================================
   FORMS
   ============================================= */

.form-group {
    margin-bottom: 12px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border var(--transition);
    font-family: var(--font);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
}

.form-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Mold type toggle (Blank/Custom) */
.mold-type-toggle {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.mold-type-btn {
    flex: 1;
    padding: 6px 12px;
    border: none;
    background: var(--bg);
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
}

.mold-type-btn + .mold-type-btn {
    border-left: 1px solid var(--border);
}

.mold-type-btn.active {
    background: var(--accent);
    color: #fff;
    font-weight: 500;
}

.mold-type-btn:hover:not(.active) {
    background: var(--accent-light);
}

/* Tab buttons (molds page tabs) */
.molds-tabs .tab-btn {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 6px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.15s;
}
.molds-tabs .tab-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}
.molds-tabs .tab-btn:hover:not(.active) {
    background: var(--accent-light);
    color: var(--accent);
}

/* Mold picker (photo-based dropdown for calculator) */
.mold-picker {
    position: relative;
    width: 100%;
}

.mold-picker-selected {
    transition: border-color var(--transition);
}

.mold-picker-selected:hover {
    border-color: var(--accent) !important;
}

.mold-picker-dropdown {
    margin-top: 4px;
    left: 0;
    right: 0;
}

.mold-picker-item {
    transition: background var(--transition);
}

.mold-picker-item:hover {
    background: var(--accent-light) !important;
}

.mold-picker-item.selected {
    background: var(--accent-light);
    border: 1px solid var(--accent);
}

/* Mold thumbnail in molds table */
.mold-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.mold-thumb-placeholder {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    flex-shrink: 0;
}

/* Mold photo preview in form */
.mold-photo-preview {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}

/* ==========================================
   COLORS — Color picker & page
   ========================================== */

.color-picker {
    position: relative;
    width: 100%;
}

.color-picker-selected {
    transition: border-color var(--transition);
}

.color-picker-selected:hover {
    border-color: var(--accent) !important;
}

.color-picker-dropdown {
    margin-top: 4px;
    left: 0;
    right: 0;
}

.color-picker-item {
    transition: background var(--transition);
}

.color-picker-item:hover {
    background: var(--accent-light) !important;
}

.color-picker-item.selected {
    background: var(--accent-light);
    border: 1px solid var(--accent);
}

/* Color page — grid of color cards */
.colors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    padding: 12px 0;
}

.color-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.color-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.color-card .btn-remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    min-width: 20px;
    font-size: 10px;
    opacity: 0;
    transition: opacity var(--transition);
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    z-index: 2;
}

.color-card:hover .btn-remove {
    opacity: 1;
}

.color-card-photo {
    width: 100%;
    aspect-ratio: 1 / 1.6;
    overflow: hidden;
    background: var(--bg);
}

.color-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.color-thumb-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.color-card-info {
    text-align: center;
    padding: 6px 6px 8px;
    width: 100%;
}

.color-card-number {
    display: block;
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.color-card-name {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.color-photo-preview {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--border);
    border-radius: 8px;
    flex-shrink: 0;
    overflow: hidden;
}

/* Remove button (red X for inline rows) */
.btn-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    border: none;
    background: var(--red-light);
    color: var(--red);
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition);
    margin-bottom: 4px;
    align-self: end;
}

.btn-remove:hover {
    background: var(--red);
    color: #fff;
}

/* Toggle switch */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.toggle-row label {
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    margin: 0;
}

.toggle {
    position: relative;
    width: 36px;
    height: 20px;
    appearance: none;
    background: var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: background var(--transition);
    flex-shrink: 0;
    border: none;
    padding: 0;
}

.toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
}

.toggle:checked {
    background: var(--accent);
}

.toggle:checked::after {
    transform: translateX(16px);
}

/* =============================================
   CALCULATOR SPECIFIC
   ============================================= */

.item-block {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
    background: var(--bg-card);
    position: relative;
}

.item-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.item-block-header .item-num {
    background: var(--accent);
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.item-block-header .item-title {
    flex: 1;
    margin-left: 10px;
    font-weight: 600;
    font-size: 15px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin: 16px 0 8px;
}

/* Cost breakdown */
.cost-breakdown {
    background: var(--bg);
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
}

.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 3px 0;
    font-size: 13px;
}

.cost-row .cost-label {
    color: var(--text-secondary);
}

.cost-row .cost-value {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.cost-row.cost-total {
    border-top: 1px solid var(--border);
    margin-top: 4px;
    padding-top: 8px;
    font-size: 14px;
    font-weight: 700;
}

/* Target price block */
.target-block {
    background: var(--green-light);
    border-radius: 6px;
    padding: 12px;
    margin-top: 12px;
}

.target-block h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--green);
    margin-bottom: 8px;
}

/* Production load */
.load-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
    margin: 4px 0;
}

.load-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.load-bar-fill.green { background: var(--green); }
.load-bar-fill.yellow { background: var(--yellow); }
.load-bar-fill.red { background: var(--red); }

/* =============================================
   TABLES
   ============================================= */

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th, table td {
    text-align: left;
    padding: 10px 12px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

table tr:hover td {
    background: var(--bg);
}

table .text-right { text-align: right; }
table .text-center { text-align: center; }

.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-dot.draft { background: var(--text-muted); }
.status-dot.calculated { background: var(--accent); }
.status-dot.in_production { background: var(--yellow); }
.status-dot.completed { background: var(--green); }
.status-dot.cancelled { background: var(--red); }

/* Status select dropdown in orders table */
.status-select {
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    transition: var(--transition);
    font-family: var(--font);
}
.status-select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.status-select.status-draft { color: var(--text-muted); }
.status-select.status-calculated { color: var(--accent); }
.status-select.status-in_production { color: var(--yellow); font-weight: 600; }
.status-select.status-completed { color: var(--green); font-weight: 600; }
.status-select.status-cancelled { color: var(--red); }

/* =============================================
   PAGES
   ============================================= */

.page {
    display: none;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
}
.page.active { display: block; }

/* =============================================
   TEMPLATE SELECTOR DROPDOWN
   ============================================= */

.template-select {
    position: relative;
}

.template-select select {
    padding-right: 32px;
}

/* =============================================
   SUMMARY FOOTER
   ============================================= */

.summary-footer {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    border-top: 2px solid var(--accent);
    padding: 16px 24px;
    margin: 0;
    width: 100%;
    max-width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
    z-index: 50;
}

#page-calculator {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

#page-calculator > * {
    max-width: 100%;
    min-width: 0;
}

.summary-stats {
    display: flex;
    gap: 24px;
}

.summary-stat-item {
    text-align: center;
}

.summary-stat-item .label {
    font-size: 11px;
    color: var(--text-secondary);
}

.summary-stat-item .value {
    font-size: 18px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* Pricing grid: scroll only for the top pricing table */
.pricing-grid-scroll {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: block;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.pricing-grid-scroll .pricing-grid {
    width: max-content;
    min-width: 0;
}

.pricing-grid-scroll .pricing-grid.pricing-grid-compact {
    align-items: stretch;
}

.pricing-grid-scroll .pricing-grid.pricing-grid-compact input {
    min-width: 0;
}

/* =============================================
   RESPONSIVE
   ============================================= */

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }
    .sidebar-brand h2, .sidebar-brand span, .sidebar-nav a span:not(.nav-icon) {
        display: none;
    }
    .sidebar-nav a {
        justify-content: center;
        padding: 12px;
    }
    .main-content {
        margin-left: 60px;
        padding: 16px;
        max-width: calc(100vw - 60px);
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .summary-footer {
        flex-direction: column;
        gap: 12px;
    }
}

/* =============================================
   MISC
   ============================================= */

.hidden { display: none !important; }

.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }

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

/* Divider */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 16px 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state p {
    font-size: 14px;
    margin-bottom: 16px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
}

.tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition);
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Toast / notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-dark);
    color: #fff;
    padding: 12px 20px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.update-banner {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1100;
    border: 1px solid #1d4ed8;
    background: var(--accent);
    color: #fff;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

.update-banner:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.update-banner:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .update-banner {
        top: 10px;
        right: 10px;
        font-size: 11px;
        padding: 7px 10px;
    }
}

/* =============================================
   PRINTING ROWS (inside item blocks)
   ============================================= */

.printing-row {
    margin-bottom: 8px;
    padding: 8px;
    background: var(--bg);
    border-radius: 6px;
}

/* =============================================
   HARDWARE & PACKAGING ROWS
   ============================================= */

.hw-row, .pkg-row {
    padding: 10px;
    background: var(--bg);
    border-radius: 6px;
    margin-bottom: 8px;
}

.hw-result, .pkg-result {
    padding: 4px 0;
}

/* Hardware source toggle (warehouse vs custom) */
.hw-source-toggle {
    display: flex;
    gap: 4px;
}

.hw-src-btn {
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    border: 1px solid var(--border);
    transition: all 0.15s;
    user-select: none;
}

.hw-src-btn:hover {
    border-color: var(--primary);
}

.hw-src-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

.hw-wh-info {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 4px 8px;
    background: var(--bg);
    border-radius: 4px;
}

.hw-row select {
    width: 100%;
    padding: 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    background: var(--card-bg);
    color: var(--text);
}

.hw-row select:focus {
    border-color: var(--accent);
    outline: none;
}

/* =============================================
   KANBAN BOARD (Task Tracker)
   ============================================= */

/* Task Drawer (slide-over panel) */
.task-drawer-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    justify-content: flex-end;
    pointer-events: none;
}
.task-drawer-overlay.is-open {
    pointer-events: auto;
}
.task-drawer-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    transition: opacity 0.25s ease;
}
.task-drawer-overlay.is-open .task-drawer-backdrop {
    opacity: 1;
}
.task-drawer-panel {
    position: relative;
    width: 520px;
    max-width: 90vw;
    height: 100%;
    background: var(--bg);
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    transform: translateX(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.task-drawer-overlay.is-open .task-drawer-panel {
    transform: translateX(0);
}
.task-drawer-content {
    padding: 20px 24px 32px;
}
.task-drawer-content .card {
    box-shadow: none;
    border: 1px solid var(--border);
    margin-bottom: 16px;
}
.task-drawer-content .card-header h3 {
    font-size: 15px;
}
.task-drawer-overlay.is-saving .task-drawer-panel {
    cursor: progress;
}
.task-editor-save-progress {
    display: none;
    margin-bottom: 16px;
    padding: 12px 14px;
    border: 1px solid rgba(37, 99, 235, 0.18);
    background: rgba(37, 99, 235, 0.06);
    border-radius: 12px;
}
.task-editor-save-progress.is-active {
    display: block;
}
.task-editor-save-progress-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    color: var(--text);
    font-size: 13px;
}
.task-editor-save-progress-row strong {
    font-weight: 600;
}
.task-editor-save-progress-row span {
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}
.task-editor-save-progress-bar {
    height: 8px;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.14);
    overflow: hidden;
}
.task-editor-save-progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: linear-gradient(90deg, #2563eb 0%, #60a5fa 100%);
    transition: width 0.18s ease;
}
.task-editor-actions .btn[disabled],
.task-drawer-content .card-header .btn[disabled] {
    opacity: 0.6;
    cursor: not-allowed;
}
.task-template-overlay {
    z-index: 1010;
}
.task-template-panel {
    width: 760px;
    max-width: 96vw;
}
.task-template-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 16px;
}
.task-template-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.task-template-list-item {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: left;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    cursor: pointer;
}
.task-template-list-item span {
    font-size: 12px;
    color: var(--text-muted);
}
.task-template-list-item.active {
    border-color: var(--accent);
    background: var(--accent-light);
}
.task-template-form {
    min-width: 0;
}
.task-draft-banner {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1d4ed8;
    font-size: 13px;
}
.task-template-picker-row,
.task-context-select-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.task-template-picker-row select,
.task-context-select-row select {
    flex: 1;
}
.task-context-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.task-context-toggle {
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 7px 12px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
}
.task-context-toggle.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}
.task-context-grid {
    align-items: flex-start;
}
.task-context-field.is-hidden {
    display: none;
}

/* Tasks page header */
.tasks-page-header { margin-bottom: 20px; }
.tasks-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}
.tasks-page-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}
.tasks-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}
.tasks-header-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.tasks-header-scope-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
}

/* Scope tabs (Мои задачи / Все / Просроченные) */
.tasks-scope-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg);
    border-radius: 8px;
    padding: 3px;
}
.tasks-scope-btn {
    padding: 6px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.15s;
    white-space: nowrap;
}
.tasks-scope-btn:hover { color: var(--text); }
.tasks-scope-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 1px 3px rgba(37,99,235,0.3);
}
.tasks-scope-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: rgba(255,255,255,0.25);
    font-size: 11px;
    font-weight: 700;
    margin-left: 4px;
}
.tasks-subscope-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.tasks-subscope-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    transition: all 0.15s;
}
.tasks-subscope-btn:hover {
    border-color: var(--accent);
    color: var(--text);
}
.tasks-subscope-btn.active {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

/* View toggle (Список / Канбан / Календарь) */
.tasks-view-toggle {
    display: flex;
    background: var(--bg);
    border-radius: 8px;
    padding: 3px;
    gap: 2px;
}

/* Stats row */
.tasks-stats {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.task-stat-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    transition: box-shadow 0.15s;
}
.task-stat-card:hover { box-shadow: var(--shadow); }
.task-stat-icon {
    font-size: 18px;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.task-stat-total .task-stat-icon { background: var(--accent-light); }
.task-stat-mine .task-stat-icon { background: #ede9fe; }
.task-stat-review .task-stat-icon { background: #dbeafe; }
.task-stat-overdue .task-stat-icon { background: var(--green-light); }
.task-stat-overdue-active .task-stat-icon { background: var(--red-light); }
.task-stat-overdue-active .stat-value { color: var(--red); }
.task-stat-waiting .task-stat-icon { background: var(--yellow-light); }
.task-stat-info { display: flex; flex-direction: column; }
.task-stat-info .stat-value { font-size: 20px; font-weight: 700; line-height: 1.1; }
.task-stat-info .stat-label { font-size: 11px; color: var(--text-muted); font-weight: 500; }

/* Search toolbar */
.tasks-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
}
.tasks-search-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}
.tasks-search-wrap svg {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    pointer-events: none;
}
.tasks-search-wrap input {
    width: 100%;
    padding: 9px 12px 9px 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 13px;
    background: var(--bg-card);
    transition: border-color 0.15s;
}
.tasks-search-wrap input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.tasks-filter-toggle {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}
.tasks-filter-toggle.is-open,
.tasks-filter-toggle.has-active {
    background: var(--accent-light);
    color: var(--accent);
    border-color: var(--accent);
}

/* Collapsible filters panel */
.tasks-filters-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    margin-bottom: 12px;
    animation: tasksSlideDown 0.15s ease;
}
@keyframes tasksSlideDown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.tasks-checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    color: var(--text-secondary);
}
.tasks-checkbox-label:hover { color: var(--text); }

.tasks-feed-section,
.tasks-completed-section {
    margin-bottom: 16px;
}

.tasks-feed-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.tasks-feed-header h3,
.tasks-completed-title {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
}

.tasks-feed-header p,
.tasks-completed-subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.tasks-feed-badge,
.tasks-completed-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 34px;
    height: 34px;
    padding: 0 12px;
    border-radius: 999px;
    background: var(--accent-light);
    color: var(--accent);
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
}

.tasks-completed-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--bg-card);
    cursor: pointer;
    text-align: left;
}

.tasks-completed-toggle.is-open {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}

.tasks-completed-meta {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tasks-completed-chevron {
    color: var(--text-muted);
    font-size: 12px;
}

.tasks-completed-body {
    margin-top: 10px;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 12px;
    min-height: 400px;
}

.wm-two-column {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.95fr);
    gap: 16px;
    align-items: start;
}

.wm-main-column,
.wm-side-column {
    min-width: 0;
}

.wm-assets-list,
.wm-comments-list,
.wm-activity-list,
.wm-subtasks-list,
.wm-checklist-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.wm-asset-row,
.wm-comment-row,
.wm-activity-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}

.wm-checklist-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
}

.wm-checklist-row .btn {
    margin-left: auto;
}

.wm-subtask-row {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
    text-align: left;
}

.wm-watchers-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.wm-watcher-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    font-size: 12px;
    cursor: pointer;
}

.wm-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
}

.wm-calendar-head > div {
    padding: 4px 0;
    text-align: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
}

.wm-calendar-cell {
    min-height: 120px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-card);
}

.wm-calendar-cell.is-empty {
    background: transparent;
    border-style: dashed;
}

.wm-calendar-day {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
}

.wm-calendar-tasks {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wm-calendar-task {
    width: 100%;
    padding: 6px 8px;
    border: 0;
    border-radius: 6px;
    background: var(--accent-light);
    color: var(--accent);
    font-size: 12px;
    text-align: left;
    cursor: pointer;
}

.wm-calendar-task.is-overdue {
    background: var(--red-light);
    color: var(--red);
}

.od-project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.od-project-card {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    text-align: left;
    cursor: pointer;
}

.od-project-card:hover,
.wm-subtask-row:hover,
.wm-calendar-task:hover {
    filter: brightness(0.98);
}

.kanban-column {
    background: var(--bg);
    border-radius: 10px;
    padding: 0;
    min-height: 200px;
}

.kanban-header {
    padding: 12px 14px 8px;
    font-weight: 700;
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 10px 10px 0 0;
}

.kanban-count {
    background: var(--border);
    color: var(--text-secondary);
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.kanban-cards {
    padding: 6px 10px 10px;
    min-height: 80px;
}

.kanban-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: box-shadow 0.15s, transform 0.15s;
    user-select: none;
}

.kanban-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    border-color: var(--accent);
}

.kanban-card[draggable="true"] {
    cursor: grab;
}

.kanban-card[draggable="true"]:active {
    cursor: grabbing;
    opacity: 0.7;
}

.task-card-title {
    font-size: 13px;
    font-weight: 600;
    line-height: 1.35;
    margin-bottom: 6px;
    color: var(--text);
}

.task-card-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 4px;
}

.task-project-tag {
    font-size: 10px;
    background: var(--accent-alpha, rgba(74, 144, 226, 0.1));
    color: var(--accent);
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.task-deadline {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

.task-deadline.overdue {
    color: var(--red);
    font-weight: 700;
}

.task-assignees {
    display: flex;
    gap: 3px;
    margin-top: 4px;
}

.task-avatar {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--border);
    color: var(--text-secondary);
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    letter-spacing: -0.5px;
}

.tasks-view-btn {
    padding: 5px 14px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.15s;
}
.tasks-view-btn:hover { color: var(--text); }
.tasks-view-btn.active {
    background: var(--bg-card);
    color: var(--text);
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Badges for statuses */
.badge-gray { background: #e5e7eb; color: #6b7280; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-green { background: #d1fae5; color: #065f46; }
.badge-red { background: #fee2e2; color: #991b1b; }

@media (max-width: 1100px) {
    .tasks-stats { grid-template-columns: repeat(3, 1fr); }
    .tasks-header-controls { flex-direction: column; align-items: flex-start; gap: 8px; }
    .task-template-layout { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .kanban-board { grid-template-columns: 1fr; }
    .wm-two-column { grid-template-columns: 1fr; }
    .tasks-stats { grid-template-columns: repeat(2, 1fr); }
    .tasks-toolbar { flex-direction: column; }
    .tasks-header-top { flex-direction: column; gap: 12px; }
    .task-template-picker-row,
    .task-context-select-row { flex-direction: column; align-items: stretch; }
    .tasks-feed-header,
    .tasks-completed-toggle {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* =============================================
   Warehouse (Склад)
   ============================================= */

.wh-photo {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid var(--border);
}

.wh-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: 700;
}

.wh-cat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.wh-qty-ok {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    background: #d1fae5;
    color: #065f46;
}

.wh-qty-low {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    background: #fef3c7;
    color: #92400e;
}

.wh-qty-out {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 700;
    background: #fee2e2;
    color: #991b1b;
}

/* Inline editing in warehouse table */
.wh-inline-input {
    width: 70px;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    transition: border-color 0.15s, background 0.15s;
    -moz-appearance: textfield;
}
.wh-inline-input::-webkit-outer-spin-button,
.wh-inline-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.wh-inline-input:hover {
    border-color: var(--border);
    background: var(--bg-card);
}
.wh-inline-input:focus {
    border-color: var(--blue);
    background: var(--bg-card);
    outline: none;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}
.wh-inline-input.wh-qty-ok { color: #065f46; }
.wh-inline-input.wh-qty-low { color: #92400e; background: #fef3c7; }
.wh-inline-input.wh-qty-out { color: #991b1b; background: #fee2e2; }

.wh-inline-select {
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 6px;
    font-size: 12px;
    background: transparent;
    cursor: pointer;
    max-width: 120px;
    transition: border-color 0.15s, background 0.15s;
}
.wh-inline-select:hover {
    border-color: var(--border);
    background: var(--bg-card);
}
.wh-inline-select:focus {
    border-color: var(--blue);
    background: var(--bg-card);
    outline: none;
}

.wh-stock-truth {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wh-stock-truth-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.wh-stock-truth-card {
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
}

.wh-stock-truth-card-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.wh-stock-truth-card-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.wh-stock-truth-card-subtle {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
}

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

.wh-stock-truth-panel {
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg-card);
}

.wh-stock-truth-panel h4 {
    margin: 0 0 10px;
    font-size: 13px;
}

.wh-stock-truth-empty {
    font-size: 12px;
    color: var(--text-muted);
}

.wh-stock-truth-note {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.06);
    border: 1px solid rgba(37, 99, 235, 0.14);
    font-size: 12px;
    color: var(--text);
}

.wh-stock-truth-note strong {
    color: var(--blue);
}

.wh-stock-truth-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wh-stock-truth-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.wh-stock-truth-row:last-child {
    padding-bottom: 0;
    border-bottom: none;
}

.wh-stock-truth-row-main {
    min-width: 0;
}

.wh-stock-truth-row-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.wh-stock-truth-row-meta {
    margin-top: 2px;
    font-size: 11px;
    color: var(--text-muted);
}

.wh-stock-truth-row-value {
    flex-shrink: 0;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.wh-stock-truth-row-value.is-positive {
    color: var(--green);
}

.wh-stock-truth-row-value.is-negative {
    color: var(--red);
}

@media (max-width: 900px) {
    .wh-stock-truth-grid,
    .wh-stock-truth-panels {
        grid-template-columns: 1fr;
    }
}

/* Audit diff colors */
.audit-positive { color: var(--green); font-weight: 700; }
.audit-negative { color: var(--red); font-weight: 700; }
.audit-zero { color: var(--text-muted); }

.audit-input {
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 12px;
    background: var(--bg);
    color: var(--text);
}

.audit-input:focus {
    border-color: var(--accent);
    outline: none;
}

.wh-audit-modal {
    position: fixed;
    inset: 24px;
    z-index: 1200;
    margin-top: 0 !important;
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.22);
}

.wh-audit-dialog {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 48px);
}

.wh-audit-summary-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.wh-audit-draft-status,
.wh-audit-summary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text);
}

.wh-audit-summary {
    font-weight: 600;
}

.wh-audit-table-wrap {
    flex: 1 1 auto;
    min-height: 0;
    max-height: calc(100vh - 280px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.wh-audit-photo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--border);
    display: block;
}

.wh-audit-photo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    font-size: 16px;
}

.wh-audit-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.wh-inventory-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wh-inventory-card {
    padding: 16px 20px;
}

.wh-inventory-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.wh-inventory-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.wh-inventory-card-title {
    margin: 0;
    font-size: 18px;
}

.wh-inventory-card-subtitle {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

.wh-inventory-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
    font-size: 12px;
    font-weight: 700;
}

.wh-inventory-chip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.wh-inventory-chip {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
}

.wh-inventory-chip-label {
    font-size: 11px;
    color: var(--text-muted);
}

.wh-inventory-note {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text);
}

.wh-inventory-details {
    margin-top: 12px;
}

.wh-inventory-details summary {
    cursor: pointer;
    color: var(--accent);
    font-weight: 600;
}

.wh-inventory-table-wrap {
    margin-top: 10px;
    max-height: 420px;
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.wh-inventory-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 4px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.wh-inventory-status-ok {
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
}

.wh-inventory-status-warn {
    background: rgba(245, 158, 11, 0.14);
    color: #92400e;
}

.wh-inventory-status-muted {
    background: rgba(148, 163, 184, 0.16);
    color: #475569;
}

/* Warehouse tabs */
#wh-tabs .tab {
    transition: all 0.15s;
}
#wh-tabs .tab:hover {
    color: var(--text);
}
#wh-tabs .tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent) !important;
}

/* Photo upload preview */
#wh-f-photo-preview img {
    border-radius: 6px;
}
#wh-f-photo-file {
    font-size: 12px;
}

/* Shipment form */
#wh-shipment-form select {
    background: var(--card-bg);
    color: var(--text);
}
#wh-sh-items-table table {
    width: 100%;
}
#wh-sh-items-table input[type="number"] {
    background: var(--card-bg);
    color: var(--text);
}
#wh-sh-items-table select {
    background: var(--card-bg);
    color: var(--text);
    max-width: 240px;
}
#wh-shipment-form textarea {
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
}

/* Image picker for calculator */
.wh-img-picker { position: relative; z-index: 10; }
.wh-img-picker:focus-within { z-index: 300; }
.wh-picker-selected {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; min-height: 56px;
    border: 2px solid var(--border); border-radius: 8px;
    cursor: pointer; background: #ffffff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.wh-picker-selected:hover { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.wh-picker-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 9999;
    background: #ffffff; border: 2px solid var(--accent);
    border-radius: 10px; box-shadow: 0 16px 48px rgba(0,0,0,0.25);
    max-height: 420px; overflow: hidden; margin-top: 4px;
}
.wh-picker-list { max-height: 360px; overflow-y: auto; background: #ffffff; }
.wh-picker-item { transition: background 0.1s; background: #ffffff; }
.wh-picker-item:hover { background: #eff6ff !important; }
.wh-picker-cat-header { user-select: none; }
.wh-picker-search { box-sizing: border-box; background: #ffffff; }

/* Source toggle (Со склада / Кастомная) */
.hw-source-toggle,
.pkg-source-toggle {
    display: flex; gap: 0;
    border: 2px solid var(--border); border-radius: 8px; overflow: hidden;
}
.hw-source-toggle label,
.pkg-source-toggle label {
    cursor: pointer; padding: 6px 16px; font-size: 13px; font-weight: 600;
    background: #ffffff; color: #666; transition: all 0.15s;
}
.hw-source-toggle label:not(:first-child),
.pkg-source-toggle label:not(:first-child) {
    border-left: 2px solid var(--border);
}
.hw-source-toggle label.src-active,
.pkg-source-toggle label.src-active {
    background: #2563eb; color: #ffffff;
}

/* =============================================
   CHINA PURCHASES PAGE
   ============================================= */

/* Tab buttons */
.china-tab { padding:6px 14px; border:1px solid var(--border); border-radius:6px; background:transparent; font-size:13px; font-weight:600; color:var(--text-muted); cursor:pointer; transition:all 0.15s; }
.china-tab:hover { background:var(--bg); }
.china-tab.active { background:var(--accent); color:#fff; border-color:var(--accent); }

/* Pipeline */
.china-pipe { display:flex; align-items:center; justify-content:center; gap:4px; flex-wrap:wrap; padding:20px; }
.china-pipe-step { display:flex; flex-direction:column; align-items:center; padding:8px 12px; border-radius:6px; cursor:pointer; min-width:80px; transition:background 0.15s; }
.china-pipe-step:hover { background:var(--bg); }
.china-pipe-step.has-items { font-weight:600; }
.china-pipe-count { font-size:24px; font-weight:700; }
.china-pipe-label { font-size:11px; color:var(--text-muted); text-align:center; margin-top:2px; }
.china-pipe-arrow { font-size:18px; color:var(--text-muted); margin:0 2px; }

/* Status dots */
.china-dot { display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; vertical-align:middle; }
.china-dot.ordered { background:var(--accent); }
.china-dot.in_china_warehouse { background:#eab308; }
.china-dot.consolidating { background:#f97316; }
.china-dot.in_transit { background:#3b82f6; }
.china-dot.delivered { background:var(--green); }
.china-dot.received { background:var(--green); }

/* Badges */
.china-badge { display:inline-block; padding:4px 12px; border-radius:12px; font-size:12px; font-weight:600; }
.china-badge-accent { background:rgba(59,130,246,0.1); color:var(--accent); }
.china-badge-yellow { background:rgba(234,179,8,0.15); color:#92400e; }
.china-badge-orange { background:rgba(249,115,22,0.15); color:#c2410c; }
.china-badge-blue { background:rgba(59,130,246,0.1); color:#1d4ed8; }
.china-badge-green { background:rgba(34,197,94,0.1); color:#166534; }
.china-badge-muted { background:#f3f4f6; color:var(--text-muted); }

/* Timeline (vertical) */
.china-tl { display:flex; flex-direction:column; padding-left:16px; }
.china-tl-step { display:flex; align-items:flex-start; gap:12px; padding:8px 0; position:relative; }
.china-tl-step::before { content:''; position:absolute; left:4px; top:24px; bottom:-8px; width:2px; background:var(--border); }
.china-tl-step:last-child::before { display:none; }
.china-tl-dot { width:10px; height:10px; border-radius:50%; background:var(--border); margin-top:4px; flex-shrink:0; position:relative; z-index:1; }
.china-tl-step.passed .china-tl-dot { background:var(--green); }
.china-tl-step.current .china-tl-dot { background:var(--accent); box-shadow:0 0 0 3px rgba(59,130,246,0.2); }
.china-tl-info { flex:1; }
.china-tl-label { font-size:13px; font-weight:600; color:var(--text-muted); }
.china-tl-step.passed .china-tl-label { color:var(--text); }
.china-tl-step.current .china-tl-label { color:var(--accent); }
.china-tl-date { font-size:12px; color:var(--text-muted); }
.china-tl-note { font-size:12px; color:var(--text-muted); font-style:italic; margin-top:2px; }

/* Item row in form */
.china-item-row { border:1px solid var(--border); border-radius:6px; padding:12px; margin-bottom:8px; background:var(--bg); }

/* =============================================
   ORDER DETAIL PAGE
   ============================================= */

/* Tab bar */
.od-tabs { display:flex; gap:0; border-bottom:2px solid var(--border); margin-bottom:16px; overflow-x:auto; }
.od-tab-btn {
    padding:10px 20px; font-size:13px; font-weight:600; cursor:pointer;
    color:var(--text-muted); border:none; background:none;
    border-bottom:2px solid transparent; margin-bottom:-2px; white-space:nowrap;
    transition: color .15s, border-color .15s;
}
.od-tab-btn:hover { color:var(--text); }
.od-tab-btn.active { color:var(--accent); border-bottom-color:var(--accent); }

/* Two-column detail grid */
.od-detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
@media (max-width: 768px) { .od-detail-grid { grid-template-columns:1fr; } }

/* Field row */
.od-field-row {
    display:flex; justify-content:space-between; align-items:center;
    padding:10px 16px; border-bottom:1px solid var(--border);
    transition: background .1s;
}
.od-field-row:hover { background:var(--bg); }
.od-field-row:last-child { border-bottom:none; }
.od-field-label { font-size:12px; font-weight:600; color:var(--text-muted); min-width:130px; flex-shrink:0; }
.od-field-value { font-size:14px; flex:1; text-align:right; word-break:break-word; }
.od-field-value a { color:var(--accent); text-decoration:none; }
.od-field-value a:hover { text-decoration:underline; }

/* URL link */
.od-url-link {
    display:inline-flex; align-items:center; gap:4px;
    color:var(--accent); text-decoration:none; font-size:13px;
    max-width:300px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.od-url-link:hover { text-decoration:underline; }

/* Status select */
.od-status-select {
    padding:4px 10px; border:1px solid var(--border); border-radius:6px;
    font-size:13px; background:var(--card-bg); cursor:pointer;
}

/* Item card */
.od-item-card {
    border:1px solid var(--border); border-radius:var(--radius, 10px);
    padding:16px; margin-bottom:12px; background:var(--card-bg);
}
.od-item-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:8px; }

.od-hardware-truth {
    margin-top: 8px;
}

.od-hardware-truth-summary {
    font-size: 11px;
    line-height: 1.35;
    color: var(--text-muted);
}

.od-hardware-truth-details {
    margin-top: 4px;
}

.od-hardware-truth-details summary {
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    list-style: none;
}

.od-hardware-truth-details summary::-webkit-details-marker {
    display: none;
}

.od-hardware-truth-details summary::before {
    content: '▸';
    display: inline-block;
    margin-right: 6px;
    color: var(--text-muted);
    transition: transform 0.15s ease;
}

.od-hardware-truth-details[open] summary::before {
    transform: rotate(90deg);
}

.od-hardware-truth-details-body {
    margin-top: 6px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    font-size: 11px;
    line-height: 1.45;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Badge colors for payment */
.badge-orange { background:#fff7ed; color:#ea580c; }

/* Inline edit state */
.od-editing { padding:0 !important; }
.od-inline-input { font-family:inherit; }

/* =============================================
   PRODUCTION CALENDAR (v42)
   ============================================= */

.gantt-zoom-btn.active { background:var(--accent); color:#fff; border-color:var(--accent); }

/* Legend */
.gantt-legend {
    display: flex;
    gap: 16px;
    padding: 8px 0;
    font-size: 12px;
    color: var(--text-muted);
}
.gantt-legend-item { display: flex; align-items: center; gap: 4px; }
.gantt-legend-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ── Capacity Chart ── */
.gantt-cap-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}
.gantt-cap-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    padding-bottom: 4px;
    min-width: 50px;
}
.gantt-cap-chart {
    position: relative;
    border-bottom: 1px solid var(--border);
    border-radius: 4px 4px 0 0;
    background: var(--bg);
}
.gantt-cap-line {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    border-top: 2px dashed var(--red);
    opacity: 0.5;
    z-index: 2;
    pointer-events: none;
}
.gantt-cap-day {
    position: absolute;
    bottom: 0;
}
.gantt-cap-seg {
    position: absolute;
    left: 1px;
    right: 1px;
    border-radius: 2px 2px 0 0;
    min-height: 1px;
}
.gantt-cap-overload {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 900;
    color: var(--red);
    z-index: 3;
}
#gantt-capacity-chart {
    margin-bottom: 8px;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}
#gantt-capacity-chart::-webkit-scrollbar { display: none; }

/* ── Timeline wrapper ── */
.gantt-wrapper {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.gantt-sidebar {
    min-width: 160px;
    max-width: 160px;
    border-right: 2px solid var(--border);
    flex-shrink: 0;
    background: var(--bg);
}

.gantt-sidebar-header {
    height: 36px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--card-bg);
}

.gantt-sidebar-row {
    height: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 10px;
    border-bottom: 1px solid var(--border);
    overflow: hidden;
    transition: background 0.1s;
}
.gantt-sidebar-row:hover { background: var(--accent-light); }
.gantt-order-name { font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-order-meta { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.gantt-timeline {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
}

.gantt-timeline-inner { position: relative; min-height: 100%; }

.gantt-header {
    height: 36px;
    position: relative;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.gantt-header-cell {
    position: absolute;
    top: 0;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    border-right: 1px solid var(--border);
    white-space: nowrap;
}
.gantt-weekend { background: #fef2f2; }

.gantt-body { position: relative; }

.gantt-row {
    height: 40px;
    position: relative;
    border-bottom: 1px solid var(--border);
}

/* Phase bars (replaces old gantt-bar) */
.gantt-phase-bar {
    position: absolute;
    top: 6px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 6px;
    cursor: default;
    overflow: hidden;
    transition: opacity 0.15s;
}
.gantt-phase-bar:hover { opacity: 0.85; }

.gantt-bar-text {
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Deadline marker */
.gantt-deadline-marker {
    position: absolute;
    top: 2px;
    font-size: 14px;
    color: #6b7280;
    z-index: 4;
    transform: translateX(-50%);
    cursor: default;
    line-height: 1;
}
.gantt-deadline-marker.overdue {
    color: var(--red);
    animation: pulse-red 1.5s infinite;
}

.gantt-deadline-marker.tight {
    color: #f59e0b;
}
@keyframes pulse-red {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Today line */
.gantt-today-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--red);
    z-index: 5;
    pointer-events: none;
}
.gantt-today-line::before {
    content: 'Сегодня';
    position: absolute;
    top: -18px;
    left: -20px;
    font-size: 9px;
    font-weight: 700;
    color: var(--red);
    white-space: nowrap;
}

@media (max-width: 768px) {
    .gantt-sidebar { min-width: 120px; max-width: 120px; }
    #gantt-capacity-chart { margin-left: 120px !important; }
}

/* =============================================
   ORDERS KANBAN BOARD (v35)
   ============================================= */

.orders-view-toggle { display: flex; flex-wrap: wrap; gap: 8px; }
.orders-view-btn { padding: 7px 14px; font-size: 12px; font-weight: 600; cursor: pointer; background: var(--card-bg); color: var(--text-muted); border: 1px solid var(--border); border-radius: 999px; transition: all 0.15s; }
.orders-view-btn:not(:last-child) { border-right: none; }
.orders-view-btn.active { background: var(--accent); color: #fff; }

.orders-summary-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.orders-mode-note {
    flex: 1 1 280px;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px dashed var(--border);
    background: var(--bg);
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.45;
}

.orders-inline-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.orders-order-link {
    color: var(--accent);
    font-weight: 600;
    text-decoration: none;
}

.orders-order-link:hover {
    text-decoration: underline;
}

.orders-order-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.orders-cell-muted {
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.orders-status-cell .inline-status-select {
    min-width: 180px;
}

.orders-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.orders-mini-date {
    white-space: nowrap;
    font-size: 12px;
}

.orders-board {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    padding: 4px 0;
}

.orders-board-col {
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    min-height: 200px;
    padding: 0;
    overflow: hidden;
}

.orders-board-col-header {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    background: var(--card-bg);
}

.orders-board-col-body {
    padding: 8px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.order-board-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 10px 12px;
    cursor: grab;
    transition: box-shadow 0.15s, transform 0.1s;
}
.order-board-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.order-board-card.dragging { opacity: 0.5; }
.order-board-card-title { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.order-board-card-client { font-size: 11px; color: var(--text-muted); margin-bottom: 6px; }
.order-board-card-footer { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }

.orders-board-col.drag-over { background: var(--accent-light); border-color: var(--accent); }

/* Inline status select in orders table */
.inline-status-select {
    font-size: 11px;
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    cursor: pointer;
    font-weight: 600;
    outline: none;
}
.inline-status-select:hover { border-color: var(--accent); }
.inline-status-select.status-draft { color: #6b7280; }
.inline-status-select.status-calculated { color: #6b7280; }
.inline-status-select.status-sample { color: #3b82f6; font-weight: 700; }
.inline-status-select.status-production_casting,
.inline-status-select.status-production_printing,
.inline-status-select.status-production_hardware,
.inline-status-select.status-production_packaging,
.inline-status-select.status-in_production,
.inline-status-select.status-delivery { color: #f59e0b; font-weight: 700; }
.inline-status-select.status-incoming,
.inline-status-select.status-planned { color: #6b7280; }
.inline-status-select.status-in_progress { color: #2563eb; font-weight: 700; }
.inline-status-select.status-review { color: #0f766e; font-weight: 700; }
.inline-status-select.status-waiting { color: #f59e0b; font-weight: 700; }
.inline-status-select.status-done { color: #22c55e; font-weight: 700; }
.inline-status-select.status-completed { color: #22c55e; font-weight: 700; }
.inline-status-select.status-cancelled { color: #ef4444; }
.task-row-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    flex-wrap: nowrap;
}
.task-row-icon-btn {
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 16px;
}
.task-row-icon-btn:disabled {
    opacity: 0.6;
    cursor: wait;
}
.task-row-delete-btn.is-busy {
    color: var(--text-muted);
}
.task-row-delete-btn {
    color: #ef4444;
}
.task-row-delete-btn:hover {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

@media (max-width: 1280px) {
    .orders-board { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
    .orders-board { grid-template-columns: repeat(2, 1fr); }
    .orders-view-btn { flex: 1 1 calc(50% - 8px); text-align: center; justify-content: center; }
    .orders-status-cell .inline-status-select { min-width: 0; width: 100%; }
}
@media (max-width: 600px) {
    .orders-board { grid-template-columns: 1fr; }
    .orders-view-btn { flex-basis: 100%; }
}

/* =============================================
   Dashboard Cards
   ============================================= */

.dash-cards-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.dash-card {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.15s;
}
.dash-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.dash-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.dash-card-status {
    font-size: 10px;
    font-weight: 600;
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dash-card-date {
    font-size: 11px;
    color: var(--text-muted);
}

.dash-card-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-card-client {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dash-card-revenue {
    font-size: 12px;
    font-weight: 600;
}

.dash-card-margin {
    font-size: 12px;
    font-weight: 600;
}

.dash-card-more {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    border-style: dashed;
}
.dash-card-more:hover {
    background: var(--accent-light);
}

@media (max-width: 600px) {
    .dash-cards-row {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* Production plan */
.pp-table th,
.pp-table td {
    vertical-align: top;
    font-size: 12px;
}
.pp-order-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
}
.pp-sub {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
}
.pp-cell-block {
    min-width: 180px;
}
.pp-block-title {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #475569;
    font-weight: 700;
    margin-bottom: 4px;
}
.pp-duo-block {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}
.pp-mini-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px;
}
.pp-lines {
    max-height: 120px;
    overflow: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 2px;
}
.pp-line-item {
    font-size: 11px;
    line-height: 1.3;
    color: #334155;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 4px 6px;
}
.pp-line-color {
    border-left: 3px solid #60a5fa;
}
.pp-rank {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pp-files {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}
.pp-attachment {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-size: 10px;
    max-width: 180px;
}
.pp-attachment img {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 6px;
}
.pp-file-link {
    text-decoration: none;
    font-size: 10px;
    color: var(--accent);
}
.pp-color-images {
    margin-top: 6px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.pp-color-image-link {
    display: inline-block;
    cursor: pointer;
}
.pp-color-image {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: opacity 0.15s;
}
.pp-color-image:hover {
    opacity: 0.8;
}

/* Photo lightbox */
.pp-lightbox-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.75);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.pp-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}
.pp-lightbox-img {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.5);
    cursor: default;
}
.pp-lightbox-close {
    position: absolute;
    top: -16px;
    right: -16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #fff;
    color: #333;
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.pp-lightbox-close:hover {
    background: #f0f0f0;
}
#pp-mobile-list { display: none; }

@media (max-width: 900px) {
    #pp-table-wrap { display: none; }
    #pp-mobile-list { display: block; }
}

/* Indirect Costs page */
.ic-inline-input {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 8px;
    font-size: 14px;
    color: var(--text);
    transition: border-color 0.2s;
}
.ic-inline-input:focus {
    outline: none;
    border-color: var(--primary);
}
.ic-cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.ic-cost-row:last-child { border-bottom: none; }
.ic-cost-label { flex: 1; font-size: 14px; }
.ic-cost-input-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ic-cost-input-wrap .ic-inline-input {
    width: 120px;
    text-align: right;
}

/* =============================================
   PLAN-FACT PAGE (v2 — multi-order table)
   ============================================= */

/* Period filter buttons */
.fact-filter-btn {
    padding: 5px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--card-bg);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
}
.fact-filter-btn:hover {
    background: var(--bg);
    color: var(--text);
}
.fact-filter-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Order rows in main table */
.fact-order-row {
    transition: background 0.1s;
}
.fact-order-row:hover {
    background: var(--accent-light);
}
.fact-order-row td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.fact-row-open {
    background: var(--bg);
}
.fact-row-open td {
    border-bottom-color: transparent;
}

/* Detail accordion row */
.fact-detail-row td {
    border-bottom: 2px solid var(--border);
}

/* Status badge */
.fact-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    background: var(--bg);
    white-space: nowrap;
}

/* Mini stat cards inside detail accordion */
.fact-mini-stat {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    line-height: 1.4;
}

/* Fact input fields inside detail table */
.fact-input {
    width: 100%;
    max-width: 120px;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 12px;
    font-family: inherit;
    text-align: right;
    background: var(--card-bg);
    color: var(--text);
    transition: border-color 0.15s, background 0.15s;
}
.fact-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.1);
}
.fact-input-auto {
    background: #f0f7ff;
    border-color: #bfdbfe;
    color: var(--accent);
    font-style: italic;
}
.fact-input-auto:focus {
    background: var(--card-bg);
    color: var(--text);
    font-style: normal;
}

/* Section headers in orders table */
.fact-section-header td {
    user-select: none;
    cursor: default;
}

/* Responsive for fact table */
@media (max-width: 768px) {
    #page-factual .table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .fact-mini-stat {
        padding: 6px 8px;
        font-size: 12px;
    }
}

/* FinTablo page */
.ft-deal-row:hover { background: var(--bg); }
.ft-unmatched { opacity: 0.6; }
.ft-unmatched:hover { opacity: 1; }

/* Finance workspace */
.finance-tabbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 12px 0;
}

.finance-shell {
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
}

.finance-sidebar {
    position: sticky;
    top: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.10), transparent 42%),
        linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
}

.finance-sidebar-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text);
}

.finance-sidebar-note {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.55;
    color: var(--text-muted);
}

.finance-nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 14px;
}

.finance-tab-btn {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.finance-tab-btn:hover {
    background: rgba(148, 163, 184, 0.10);
    color: var(--text);
}

.finance-tab-btn.active {
    background: #ffffff;
    border-color: rgba(15, 23, 42, 0.10);
    color: #0f172a;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    transform: translateX(2px);
}

.finance-main {
    min-width: 0;
}

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

.finance-section-card {
    padding: 10px 14px;
}

.finance-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.finance-list-row {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    font-size: 13px;
    line-height: 1.55;
}

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

.finance-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.10);
    color: #115e59;
    font-size: 12px;
    font-weight: 600;
}

.finance-divider {
    height: 1px;
    background: var(--border);
    margin: 12px 0;
}

.finance-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.finance-chip--ok {
    background: rgba(34, 197, 94, 0.12);
    color: #166534;
}

.finance-chip--warn {
    background: rgba(245, 158, 11, 0.16);
    color: #92400e;
}

.finance-chip--muted {
    background: rgba(100, 116, 139, 0.14);
    color: #475569;
}

.finance-chip--accent {
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
}

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

.finance-coverage-item {
    padding: 12px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.finance-coverage-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.finance-coverage-range {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.finance-coverage-note {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text-muted);
}

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

.finance-structure-card {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.06), rgba(255,255,255,0));
}

.finance-structure-title {
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 6px;
}

.finance-structure-text {
    font-size: 13px;
    line-height: 1.55;
    color: var(--text-muted);
}

.finance-hint {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.55;
}

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

.finance-toolbar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.finance-toolbar-actions .btn-outline.is-active {
    background: rgba(15, 118, 110, 0.10);
    border-color: rgba(15, 118, 110, 0.35);
    color: #115e59;
}

.finance-filterbar {
    display: grid;
    grid-template-columns: minmax(240px, 1.45fr) repeat(3, minmax(150px, 1fr)) repeat(2, auto);
    gap: 8px;
    margin-top: 12px;
}

.finance-periodbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.finance-periodbar__label {
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.finance-ops-context {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.finance-datebar {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 220px));
    gap: 8px;
    margin-top: 8px;
}

.finance-quick-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.finance-quick-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: #ffffff;
    color: var(--text-muted);
    font: inherit;
    font-size: 11px;
    cursor: pointer;
}

.finance-quick-tab strong {
    color: var(--text);
}

.finance-quick-tab.active {
    border-color: rgba(37, 99, 235, 0.22);
    background: rgba(37, 99, 235, 0.08);
    color: #1d4ed8;
}

.finance-quick-tabs--period {
    margin-top: 0;
}

.finance-quick-tab--period {
    padding-inline: 12px;
}

.finance-inline-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.finance-context-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.finance-context-pill {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
}

.finance-context-pill--action {
    gap: 6px;
    padding-right: 4px;
}

.finance-context-pill--strong {
    background: rgba(37, 99, 235, 0.10);
    color: #1d4ed8;
}

.finance-context-pill--search {
    background: rgba(15, 118, 110, 0.10);
    color: #115e59;
}

.finance-context-pill__clear {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.08);
    color: inherit;
    font: inherit;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
}

.finance-context-pill__clear:hover {
    background: rgba(15, 23, 42, 0.14);
}

.finance-context-reset {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 6px 10px;
    border: 1px dashed rgba(15, 23, 42, 0.14);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
}

.finance-context-reset:hover {
    border-color: rgba(15, 23, 42, 0.24);
    color: var(--text);
}

.finance-ops-toolbarline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.finance-ops-toolbarline-copy {
    font-size: 12px;
    color: var(--text-muted);
}

.finance-ops-toolbarline-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.finance-batchbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(37, 99, 235, 0.14);
    border-radius: 12px;
    background: rgba(37, 99, 235, 0.05);
}

.finance-batchbar-copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.finance-batchbar-copy span,
.finance-batchbar__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.finance-batchbar-copy strong {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text);
}

.finance-batchbar__section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1 1 320px;
}

.finance-batchbar__section--compact {
    flex: 1 1 260px;
}

.finance-batchbar__label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.finance-batchbar-fields {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    flex: 1 1 520px;
}

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

.finance-batchbar-actions--reset {
    gap: 6px;
}

.finance-quick-presets {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    width: 100%;
    padding-top: 10px;
    border-top: 1px dashed rgba(37, 99, 235, 0.18);
}

.finance-quick-presets__section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

.finance-quick-presets__section--custom {
    padding-top: 10px;
    border-top: 1px dashed rgba(15, 23, 42, 0.08);
}

.finance-quick-presets__copy {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.finance-quick-presets__copy span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.finance-quick-presets__copy strong {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text);
}

.finance-quick-presets__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.finance-quick-presets__actions--templates {
    justify-content: flex-start;
}

.finance-quick-presets__builder {
    display: grid;
    grid-template-columns: minmax(240px, 320px) auto;
    gap: 8px;
    align-items: center;
}

.finance-template-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.finance-template-chip--custom .btn:first-child {
    border-color: rgba(37, 99, 235, 0.26);
}

.finance-template-chip__remove {
    min-width: 0;
    padding-inline: 10px;
}

.finance-inline-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
    font-size: 11px;
    color: var(--text-muted);
}

.finance-compose-card {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid rgba(15, 23, 42, 0.10);
    border-radius: 14px;
    background:
        linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(255, 255, 255, 0.92)),
        #ffffff;
}

.finance-compose-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.finance-compose-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text);
}

.finance-compose-sub {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}

.finance-compose-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.finance-compose-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 12px;
}

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

.finance-setting-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--bg);
}

.finance-setting-card--wide {
    grid-column: 1 / -1;
}

.finance-setting-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.finance-setting-note {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
}

.finance-tx-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.finance-tx-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.finance-tx-sub {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.45;
    color: var(--text-muted);
}

.finance-link-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.finance-link-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 118, 110, 0.10);
    color: #115e59;
    font-size: 11px;
    font-weight: 700;
}

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

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

.finance-mini-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.finance-mini-field--wide {
    grid-column: 1 / -1;
}

.finance-mini-field > span {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.finance-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.finance-ops-layout-card {
    padding: 12px;
}

.finance-ops-workspace {
    display: grid;
    grid-template-columns: minmax(460px, 1.08fr) minmax(420px, 0.92fr);
    gap: 14px;
    align-items: start;
}

.finance-ops-listpane,
.finance-ops-detailpane {
    min-width: 0;
}

.finance-ops-listhead {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.finance-ops-listtitle {
    font-size: 16px;
    font-weight: 900;
    color: var(--text);
}

.finance-ops-listsub {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
}

.finance-ops-listmeta {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 700;
}

.finance-ops-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: calc(100vh - 340px);
    overflow: auto;
    padding-right: 4px;
}

.finance-op-day {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.finance-op-day + .finance-op-day {
    margin-top: 4px;
}

.finance-op-day__head {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.05);
}

.finance-op-day__copy {
    min-width: 0;
}

.finance-op-day__aside {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.finance-op-day__title-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.finance-op-day__title {
    font-size: 15px;
    font-weight: 900;
    color: var(--text);
}

.finance-op-day__count {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.finance-op-day__selection {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1d4ed8;
}

.finance-op-day__sub {
    margin-top: 3px;
    font-size: 12px;
    color: var(--text-muted);
}

.finance-op-day__totals {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.finance-op-day__metric {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    min-width: 88px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.05);
}

.finance-op-day__metric em {
    font-size: 10px;
    font-style: normal;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.finance-op-day__metric strong {
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
    color: var(--text);
}

.finance-op-day__metric--in strong {
    color: #0f766e;
}

.finance-op-day__metric--out strong {
    color: #b45309;
}

.finance-op-day__items {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.finance-op-day__toggle {
    white-space: nowrap;
}

.finance-op-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    padding: 10px 12px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94));
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.finance-op-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.07);
}

.finance-op-item--active {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.10);
}

.finance-op-item--selected {
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.96), rgba(255, 255, 255, 0.98));
}

.finance-op-item--ok {
    box-shadow: inset 3px 0 0 rgba(34, 197, 94, 0.85), 0 8px 20px rgba(15, 23, 42, 0.04);
}

.finance-op-item--warn {
    box-shadow: inset 3px 0 0 rgba(245, 158, 11, 0.92), 0 8px 20px rgba(15, 23, 42, 0.04);
}

.finance-op-item--muted {
    box-shadow: inset 3px 0 0 rgba(148, 163, 184, 0.85), 0 8px 20px rgba(15, 23, 42, 0.04);
}

.finance-op-item__check {
    padding-top: 2px;
}

.finance-op-item__main,
.finance-op-item__summary,
.finance-op-item__side {
    min-width: 0;
}

.finance-op-item__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.finance-op-item__date,
.finance-op-item__account {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.finance-op-item__account {
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.finance-op-item__title {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
    color: var(--text);
}

.finance-op-item__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
    margin-top: 2px;
}

.finance-op-item__desc {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.finance-op-item__facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.finance-op-item__fact {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 8px 10px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.04);
}

.finance-op-item__fact span {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.finance-op-item__fact strong {
    font-size: 12px;
    line-height: 1.35;
    color: var(--text);
}

.finance-op-item__fact strong.is-missing {
    color: #9a3412;
}

.finance-op-item__side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
    text-align: right;
}

.finance-op-item__amount {
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.02em;
    white-space: nowrap;
}

.finance-op-item__side-sub {
    font-size: 11px;
    color: var(--text-muted);
}

.finance-op-item__amount--in {
    color: #0f766e;
}

.finance-op-item__amount--out {
    color: #b45309;
}

.finance-ops-detailpane {
    position: sticky;
    top: 14px;
    align-self: start;
}

.finance-op-panel {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 250, 252, 0.95));
    box-shadow: 0 18px 42px rgba(15, 23, 42, 0.08);
}

.finance-op-panel--ok {
    box-shadow: inset 0 4px 0 rgba(34, 197, 94, 0.88), 0 18px 42px rgba(15, 23, 42, 0.08);
}

.finance-op-panel--warn {
    box-shadow: inset 0 4px 0 rgba(245, 158, 11, 0.92), 0 18px 42px rgba(15, 23, 42, 0.08);
}

.finance-op-panel--muted {
    box-shadow: inset 0 4px 0 rgba(148, 163, 184, 0.88), 0 18px 42px rgba(15, 23, 42, 0.08);
}

.finance-op-panel__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.finance-op-panel__intro,
.finance-op-panel__money {
    min-width: 0;
}

.finance-op-panel__eyebrow {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.finance-op-panel__title {
    margin-top: 10px;
    font-size: 22px;
    font-weight: 900;
    line-height: 1.2;
    color: var(--text);
}

.finance-op-panel__desc {
    margin-top: 6px;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
}

.finance-op-panel__money {
    text-align: right;
}

.finance-op-panel__amount {
    font-size: 28px;
    font-weight: 900;
    letter-spacing: -0.03em;
    white-space: nowrap;
}

.finance-op-panel__amount--in {
    color: #0f766e;
}

.finance-op-panel__amount--out {
    color: #b45309;
}

.finance-op-panel__amount-sub {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

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

.finance-op-panel__summary-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.04);
}

.finance-op-panel__summary-card span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.finance-op-panel__summary-card strong {
    font-size: 14px;
    line-height: 1.4;
    color: var(--text);
}

.finance-op-panel__links {
    margin-top: -2px;
}

.finance-op-panel__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.04);
}

.finance-op-panel__nav-copy {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
}

.finance-op-panel__assist {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.08), rgba(15, 118, 110, 0.07));
    border: 1px solid rgba(37, 99, 235, 0.10);
}

.finance-op-panel__assist--muted {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.06);
}

.finance-op-panel__assist-copy {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.finance-op-panel__assist-copy span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.finance-op-panel__assist-copy strong {
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
}

.finance-op-panel__assist-copy em {
    font-style: normal;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
}

.finance-op-panel__assist-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.finance-op-panel .finance-quick-presets {
    padding: 12px 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.82);
}

.finance-op-panel__section-head {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.finance-op-panel__section-head span {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.finance-op-panel__section-head strong {
    font-size: 13px;
    line-height: 1.45;
    color: var(--text);
}

.finance-op-panel__manual {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.92);
}

.finance-op-panel__manual-summary,
.finance-op-panel__manual-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.finance-op-panel__manual-summary {
    cursor: pointer;
    list-style: none;
}

.finance-op-panel__manual-summary::-webkit-details-marker {
    display: none;
}

.finance-op-panel__manual-summary span,
.finance-op-panel__manual-head span {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.finance-op-panel__manual-summary strong,
.finance-op-panel__manual-head strong {
    display: block;
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text);
}

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

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

.finance-op-panel__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
}

.finance-op-panel__actions .finance-inline-check {
    margin-top: 0;
    margin-right: 6px;
}

.finance-operations-stack {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.finance-empty-state {
    padding: 28px 18px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0.96));
}

.finance-op-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    padding: 14px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94)),
        #ffffff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}

.finance-op-card--selected {
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: 0 14px 34px rgba(37, 99, 235, 0.10);
}

.finance-op-card--ok {
    border-left: 4px solid rgba(34, 197, 94, 0.85);
}

.finance-op-card--warn {
    border-left: 4px solid rgba(245, 158, 11, 0.90);
}

.finance-op-card--muted {
    border-left: 4px solid rgba(148, 163, 184, 0.85);
}

.finance-op-card__head,
.finance-op-card__body,
.finance-op-card__footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.finance-op-card__head {
    margin-bottom: 12px;
}

.finance-op-card__head-left,
.finance-op-card__head-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.finance-op-card__select {
    display: inline-flex;
    align-items: center;
}

.finance-op-card__date,
.finance-op-card__kind,
.finance-op-card__account {
    font-size: 12px;
    color: var(--text-muted);
}

.finance-op-card__body {
    align-items: center;
}

.finance-op-card__summary {
    min-width: 0;
    flex: 1 1 auto;
}

.finance-op-card__title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.3;
}

.finance-op-card__desc {
    margin-top: 4px;
    font-size: 13px;
    line-height: 1.5;
    color: var(--text);
}

.finance-op-card__meta {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
}

.finance-op-card__amount {
    flex: 0 0 auto;
    min-width: 148px;
    text-align: right;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: -0.02em;
}

.finance-op-card__amount--in {
    color: #0f766e;
}

.finance-op-card__amount--out {
    color: #b45309;
}

.finance-op-card__editor {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
}

.finance-op-card__footer {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    flex-wrap: wrap;
}

.finance-op-card__signals {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1 1 320px;
}

.finance-op-card__signal {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.04);
    color: var(--text-muted);
    font-size: 11px;
}

.finance-op-card__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
}

.finance-inline-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    font-size: 12px;
    color: var(--text);
}

.finance-footer-actions {
    display: flex;
    justify-content: center;
    padding-top: 12px;
}

.finance-main .table-wrap {
    overflow-x: auto;
}

.finance-main table {
    min-width: 980px;
}

.finance-main td .input,
.finance-main th .input,
.finance-compose-grid .input {
    width: 100%;
}

.finance-main thead th {
    font-size: 11px;
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 1;
    background: #ffffff;
}

.finance-main tbody td {
    padding-top: 10px;
    padding-bottom: 10px;
}

.finance-main table td {
    vertical-align: top;
}

.finance-main tbody tr:hover {
    background: rgba(148, 163, 184, 0.06);
}

.finance-tx-row--selected {
    background: rgba(37, 99, 235, 0.06);
}

.finance-tx-row--warn {
    border-left: 2px solid rgba(245, 158, 11, 0.55);
}

.finance-tx-row--ok {
    border-left: 2px solid rgba(34, 197, 94, 0.45);
}

.finance-tx-row--muted {
    border-left: 2px solid rgba(148, 163, 184, 0.3);
}

@media (max-width: 1280px) {
    .finance-ops-workspace {
        grid-template-columns: 1fr;
    }

    .finance-ops-list {
        max-height: none;
        overflow: visible;
        padding-right: 0;
    }

    .finance-ops-detailpane {
        position: static;
    }
}

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

    .finance-sidebar {
        position: static;
    }

    .finance-nav {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .finance-toolbar,
    .finance-compose-head {
        flex-direction: column;
    }

    .finance-batchbar {
        align-items: flex-start;
    }

    .finance-op-card__head,
    .finance-op-card__body,
    .finance-op-card__footer {
        flex-direction: column;
        align-items: stretch;
    }

    .finance-op-card__amount {
        min-width: 0;
        text-align: left;
    }

    .finance-op-day__head {
        flex-direction: column;
        align-items: stretch;
    }

    .finance-op-day__totals {
        justify-content: flex-start;
    }

    .finance-op-item {
        grid-template-columns: auto 1fr;
    }

    .finance-op-item__body,
    .finance-op-item__facts {
        grid-template-columns: 1fr;
    }

    .finance-op-item__side {
        grid-column: 2;
        align-items: flex-start;
        text-align: left;
    }

    .finance-op-panel__head {
        flex-direction: column;
    }

    .finance-batchbar-fields {
        grid-template-columns: 1fr;
        width: 100%;
    }

    .finance-filterbar,
    .finance-datebar,
    .finance-compose-grid,
    .finance-grid-2,
    .finance-coverage-grid,
    .finance-structure-grid,
    .finance-settings-grid {
        grid-template-columns: 1fr;
    }

    .finance-setting-card--wide {
        grid-column: auto;
    }

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

    .finance-mini-field--wide {
        grid-column: auto;
    }
}

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

    .finance-sidebar {
        position: static;
    }

    .finance-nav {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

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

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

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

    .finance-batchbar-fields {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .finance-op-panel__summary,
    .finance-op-panel__manual-grid,
    .finance-op-panel__form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .finance-op-card__editor {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .finance-nav {
        grid-template-columns: 1fr;
    }

    .finance-ops-toolbarline,
    .finance-ops-listhead,
    .finance-op-card__signals,
    .finance-op-card__actions,
    .finance-op-panel__actions,
    .finance-op-panel__nav,
    .finance-op-panel__assist,
    .finance-op-panel__assist-actions,
    .finance-batchbar__label-row,
    .finance-op-panel__section-head,
    .finance-op-panel__manual-head,
    .finance-op-panel__manual-summary,
    .finance-quick-presets__section,
    .finance-quick-presets,
    .finance-quick-presets__actions,
    .finance-quick-presets__builder {
        flex-direction: column;
        align-items: stretch;
    }

    .finance-quick-presets__builder {
        display: grid;
        grid-template-columns: 1fr;
    }

    .finance-op-day__metric {
        min-width: 0;
        align-items: flex-start;
    }

    .finance-op-item {
        grid-template-columns: 1fr;
    }

    .finance-op-item__check {
        padding-top: 0;
    }

    .finance-op-item__side {
        align-items: flex-start;
        text-align: left;
    }

    .finance-op-panel {
        padding: 16px;
    }

    .finance-op-panel__summary,
    .finance-op-panel__manual-grid,
    .finance-op-panel__form {
        grid-template-columns: 1fr;
    }

    .finance-op-card__editor {
        grid-template-columns: 1fr;
    }
}

/* ==========================================
   PENDANT CONFIGURATOR
   ========================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.pendant-wizard-overlay {
    align-items: flex-start;
    overflow-y: auto;
    padding: 24px 12px;
}

.pendant-card {
    border-left: 3px solid var(--accent);
}

.pendant-wizard {
    background: var(--bg);
    border-radius: 12px;
    width: min(840px, calc(100vw - 24px));
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
    margin: 0 auto;
}

.pendant-wizard-step-4,
.pendant-wizard-step-5 {
    width: min(1240px, calc(100vw - 24px));
}

.pendant-wizard-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.pendant-wizard-header h2 {
    margin: 0;
    font-size: 18px;
}

.pendant-wizard-steps {
    display: flex;
    gap: 4px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
}

.pendant-step-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: none;
    cursor: pointer;
    font-size: 12px;
    white-space: nowrap;
    color: var(--text-muted);
}

.pendant-step-btn.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.pendant-step-btn.done {
    border-color: var(--green);
    color: var(--green);
}

.pendant-step-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pendant-wizard-body {
    padding: 24px;
    min-height: 200px;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.pendant-wizard-step-4 .pendant-wizard-body {
    padding-bottom: 120px;
}

.pendant-wizard-step-4 .pendant-wh-picker:focus-within {
    margin-bottom: 320px;
}

.pendant-wizard-footer {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
}

.pendant-field-group {
    margin-bottom: 12px;
}

.pendant-step4-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
    gap: 24px;
    align-items: start;
}

.pendant-attachment-section {
    min-width: 0;
}

.pendant-attachment-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 8px;
    flex-wrap: wrap;
}

.pendant-attachment-section-header h4 {
    margin: 0;
    font-size: 20px;
}

.pendant-allocation-summary {
    margin: 0 0 12px;
    font-size: 13px;
    line-height: 1.5;
}

.pendant-attachment-rows {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

.pendant-attachment-row {
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
    min-width: 0;
}

.pendant-attachment-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.pendant-attachment-row-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.pendant-attachment-row-summary {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    word-break: break-word;
}

.pendant-attachment-field {
    margin-top: 10px;
}

.pendant-attachment-field .input {
    width: min(100%, 220px);
    max-width: 100%;
}

.pendant-attachment-helper {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    word-break: break-word;
}

.pendant-attachment-warning {
    margin-top: 6px;
    font-size: 12px;
    color: var(--red);
    font-weight: 600;
    line-height: 1.45;
    word-break: break-word;
}

.pendant-field-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.pendant-beads-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: var(--bg-muted);
    border-radius: 8px;
    min-height: 50px;
    align-items: flex-start;
}

.pendant-bead {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 44px;
    padding: 8px 6px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--bg);
    cursor: default;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.pendant-beads-selectable .pendant-bead {
    cursor: pointer;
}

.pendant-beads-selectable .pendant-bead:hover {
    border-color: var(--accent);
}

.pendant-bead.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
    background: var(--accent-light);
}

.pendant-bead-char {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.pendant-bead-color {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    max-width: 60px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pendant-summary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    min-width: 860px;
}

.pendant-summary-table-wrap {
    overflow-x: auto;
}

.pendant-summary-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}

.pendant-summary-table .pendant-summary-header td {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
}

.pendant-summary-table .pendant-summary-total td {
    border-top: 2px solid var(--text);
    border-bottom: none;
}

@media (max-width: 900px) {
    .pendant-wizard {
        width: calc(100vw - 16px);
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 16px);
    }

    .pendant-wizard-body {
        padding: 16px;
    }

    .pendant-wizard-footer,
    .pendant-wizard-header,
    .pendant-wizard-steps {
        padding-left: 16px;
        padding-right: 16px;
    }

    .pendant-step4-layout {
        grid-template-columns: 1fr;
        gap: 18px;
    }
}

.pendant-wh-item:hover {
    background: var(--accent-light);
}


/* =============================================
   PRODUCTION CALENDAR (v105)
   ============================================= */

.gantt-header-note {
    margin-top: 4px;
    font-size: 13px;
    max-width: 700px;
}

.gantt-intro-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 55%, #f8fafc 100%);
    box-shadow: var(--shadow);
}

#gantt-toolbar {
    margin-bottom: 16px;
}

.gantt-toolbar-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow);
}

.gantt-toolbar-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gantt-toolbar-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.gantt-toolbar-inline,
.gantt-toolbar-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.gantt-toolbar-input {
    width: 92px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font: inherit;
    font-weight: 700;
    background: var(--bg);
    color: var(--text);
}

.gantt-toolbar-hint {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.gantt-intro-card > div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
}

.gantt-intro-card strong {
    color: var(--text);
    font-size: 14px;
}

#gantt-queue {
    margin-bottom: 16px;
}

.gantt-queue-card-wrap {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow);
}

.gantt-queue-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.gantt-queue-head h3 {
    margin: 0 0 4px;
    font-size: 20px;
}

.gantt-queue-head p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    max-width: 720px;
}

.gantt-queue-summary {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
}

.gantt-queue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
}

.gantt-queue-section + .gantt-queue-section {
    margin-top: 18px;
}

.gantt-queue-subhead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.gantt-queue-subhead h4 {
    margin: 0 0 4px;
    font-size: 16px;
}

.gantt-queue-subhead p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    max-width: 720px;
}

.gantt-queue-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--bg);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}

.gantt-queue-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.08);
}

.gantt-queue-card[draggable="true"] {
    cursor: grab;
}

.gantt-queue-card.dragging {
    opacity: 0.45;
}

.gantt-queue-card.drag-over {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent);
    background: color-mix(in srgb, var(--accent) 6%, white);
}

.gantt-queue-card.risk {
    border-color: #fecaca;
    background: #fff8f8;
}

.gantt-queue-card.tight {
    border-color: #fde68a;
    background: #fffdf5;
}

.gantt-queue-card.blocked {
    border-color: #fed7aa;
    background: #fffaf3;
}

.gantt-queue-card.review {
    border-color: #dbeafe;
    background: #f8fbff;
}

.gantt-queue-card-top,
.gantt-queue-footer {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.gantt-queue-title {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

.gantt-queue-meta,
.gantt-queue-dates {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.gantt-queue-progress {
    font-size: 12px;
    color: var(--text);
    line-height: 1.45;
    font-weight: 600;
}

.gantt-queue-risk-line {
    font-size: 12px;
    line-height: 1.45;
    color: #166534;
}

.gantt-queue-risk-line.tight {
    color: #a16207;
}

.gantt-queue-risk-line.risk {
    color: #b91c1c;
}

.gantt-queue-controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.gantt-worker-stepper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.gantt-worker-stepper-label {
    min-width: 74px;
}

.gantt-queue-phases {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.gantt-queue-phase-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--phase-color) 14%, white);
    color: var(--text);
    font-size: 12px;
    font-weight: 600;
}

.gantt-queue-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.gantt-queue-badge.ok {
    background: #dcfce7;
    color: #166534;
}

.gantt-queue-badge.risk {
    background: #fee2e2;
    color: #b91c1c;
}

.gantt-queue-badge.tight {
    background: #fef3c7;
    color: #a16207;
}

.gantt-queue-badge.blocked {
    background: #ffedd5;
    color: #c2410c;
}

.gantt-queue-badge.review {
    background: #dbeafe;
    color: #1d4ed8;
}

.gantt-queue-open {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
}

#gantt-capacity-chart {
    margin-bottom: 14px;
    margin-left: 240px;
    border-radius: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
}

#gantt-capacity-chart::-webkit-scrollbar {
    display: none;
}

.gantt-cap-wrap {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.gantt-cap-label {
    min-width: 72px;
    padding-bottom: 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
}

.gantt-sidebar {
    min-width: 240px;
    max-width: 240px;
}

.gantt-sidebar-header {
    height: 48px;
    padding: 0 16px;
    font-size: 12px;
}

.gantt-sidebar-row {
    height: 56px;
    padding: 0 14px;
}

.gantt-order-name {
    font-size: 13px;
}

.gantt-order-meta {
    font-size: 11px;
}

.gantt-header {
    height: 48px;
}

.gantt-header-cell {
    height: 48px;
    flex-direction: column;
    gap: 2px;
    padding-top: 6px;
}

.gantt-header-primary {
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    text-transform: capitalize;
    color: var(--text);
}

.gantt-header-secondary {
    font-size: 11px;
    line-height: 1;
    color: var(--text-muted);
}

.gantt-header-tertiary {
    font-size: 10px;
    line-height: 1;
    color: var(--accent);
    text-transform: lowercase;
}

.gantt-month-break {
    box-shadow: inset 2px 0 0 #dbeafe;
}

.gantt-row {
    height: 56px;
}

.gantt-phase-bar {
    top: 10px;
    height: 36px;
    padding: 0 10px;
    border-radius: 10px;
}

.gantt-bar-text {
    font-size: 11px;
}

.gantt-deadline-marker {
    top: 7px;
    font-size: 16px;
}

.gantt-today-line::before {
    top: -20px;
    left: -14px;
    padding: 2px 5px;
    border-radius: 999px;
    background: var(--card-bg);
    font-size: 10px;
}

@media (max-width: 1024px) {
    .gantt-toolbar-card,
    .gantt-intro-card {
        grid-template-columns: 1fr;
    }

    .gantt-queue-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }
}

@media (max-width: 768px) {
    .gantt-sidebar {
        min-width: 180px;
        max-width: 180px;
    }

    #gantt-capacity-chart {
        margin-left: 180px;
    }

    .gantt-queue-card-top,
    .gantt-queue-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .gantt-queue-summary {
        white-space: normal;
    }
}

.wiki-page-subtitle {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.65;
    max-width: 920px;
}

.wiki-source-title {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wiki-source-note,
.wiki-list-subtitle {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

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

.wiki-nav-panel {
    position: sticky;
    top: 12px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 20px;
    background: #fbfbfa;
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.05);
}

.wiki-nav-top {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wiki-toolbar-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.wiki-toolbar-search {
    flex: 1;
    min-width: 260px;
}

.wiki-toolbar-search input {
    width: 100%;
    border-radius: 12px;
    background: white;
    border: 1px solid rgba(15, 23, 42, 0.1);
}

.wiki-meta-pill {
    padding: 6px 10px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.wiki-nav-tree {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: calc(100vh - 220px);
    overflow: auto;
    padding-right: 4px;
}

.wiki-nav-home,
.wiki-tree-section-button,
.wiki-tree-page {
    width: 100%;
    text-align: left;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.wiki-nav-home {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.wiki-nav-home:hover,
.wiki-nav-home.active {
    background: rgba(15, 23, 42, 0.06);
}

.wiki-tree-section {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
}

.wiki-tree-section-button {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
    padding: 8px 12px;
    border-radius: 12px;
    color: var(--text);
}

.wiki-tree-section-button:hover,
.wiki-tree-section.active .wiki-tree-section-button {
    background: rgba(15, 23, 42, 0.06);
}

.wiki-tree-section-title {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--text);
}

.wiki-tree-section-desc {
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 11px;
    line-height: 1.45;
}

.wiki-tree-pages {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-left: 10px;
    padding-left: 10px;
    border-left: 1px solid rgba(15, 23, 42, 0.08);
}

.wiki-tree-page {
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-muted);
}

.wiki-tree-page:hover,
.wiki-tree-page.active {
    background: rgba(15, 23, 42, 0.06);
    color: var(--text);
}

.wiki-tree-page-title {
    display: block;
    line-height: 1.4;
}

.wiki-tree-empty {
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.wiki-section-count {
    min-width: 30px;
    padding: 6px 8px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    text-align: center;
    font-size: 11px;
    font-weight: 700;
}

.wiki-document-panel {
    min-height: 70vh;
    padding: 20px 22px 28px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, 0.05);
}

.wiki-document-topbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.wiki-breadcrumbs {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.wiki-inline-panel {
    margin-bottom: 18px;
    padding: 18px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: #fafaf8;
}

.wiki-document {
    max-width: 860px;
}

.wiki-document-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.wiki-article-section {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.06);
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
}

.wiki-document-title {
    font-size: 42px;
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text);
}

.wiki-document-summary {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.7;
    max-width: 760px;
}

.wiki-article-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 14px;
}

.wiki-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.05);
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
}

.wiki-source-inline {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 16px;
    padding: 14px 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: #fafaf8;
}

.wiki-document-body {
    margin-top: 22px;
    color: var(--text);
}

.wiki-document-body h3,
.wiki-document-body h4,
.wiki-document-body p,
.wiki-document-body ul,
.wiki-document-body ol {
    margin: 0 0 14px;
}

.wiki-document-body h3 {
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
    margin-top: 30px;
}

.wiki-document-body h4 {
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    margin-top: 24px;
}

.wiki-document-body p,
.wiki-document-body li {
    font-size: 15px;
    line-height: 1.8;
}

.wiki-document-body ul,
.wiki-document-body ol {
    padding-left: 24px;
}

.wiki-document-index {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 22px;
}

.wiki-document-index-item {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 16px;
    background: #fafaf8;
    padding: 14px 16px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.wiki-document-index-item:hover {
    background: #f4f4f1;
    border-color: rgba(15, 23, 42, 0.14);
    transform: translateY(-1px);
}

.wiki-document-index-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}

.wiki-document-index-note {
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.6;
}

.wiki-empty-state {
    padding: 24px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0.95));
}

.wiki-empty-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.wiki-empty-note {
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}

.wiki-document-edit .card-header {
    margin-bottom: 18px;
}

.wiki-editor-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wiki-preview-card {
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 18px;
    background: #fafaf8;
    padding: 18px;
}

.wiki-preview-card-inline {
    margin-top: 8px;
}

.wiki-preview-header {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.wiki-preview-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.wiki-preview-meta-note {
    font-size: 12px;
    color: var(--text-muted);
}

.wiki-preview-title {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
}

.wiki-preview-summary {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
}

.wiki-preview-tags {
    margin-top: 12px;
}

.wiki-preview-body {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    color: var(--text);
}

.wiki-preview-body h3,
.wiki-preview-body h4,
.wiki-preview-body p,
.wiki-preview-body ul,
.wiki-preview-body ol {
    margin: 0 0 12px;
}

.wiki-preview-body h3 {
    font-size: 19px;
    font-weight: 800;
    line-height: 1.3;
}

.wiki-preview-body h4 {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
}

.wiki-preview-body p,
.wiki-preview-body li {
    font-size: 14px;
    line-height: 1.7;
}

.wiki-preview-body ul,
.wiki-preview-body ol {
    padding-left: 22px;
}

.wiki-preview-body li + li {
    margin-top: 6px;
}

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

    .wiki-nav-panel {
        position: static;
    }
}

@media (max-width: 1100px) {
    .wiki-document-panel {
        padding: 16px;
        border-radius: 18px;
    }

    .wiki-document-title {
        font-size: 30px;
    }

    .wiki-document-meta,
    .wiki-source-inline,
    .wiki-document-topbar {
        align-items: flex-start;
    }
}

.quick-bug-report-btn {
    position: fixed;
    right: max(20px, env(safe-area-inset-right, 0px) + 20px);
    bottom: max(20px, env(safe-area-inset-bottom, 0px) + 20px);
    z-index: 1450;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    border: 0;
    border-radius: 999px;
    background: #111827;
    color: #fff;
    font-weight: 700;
    box-shadow: 0 14px 28px rgba(17, 24, 39, 0.24);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease;
}

.quick-bug-report-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(17, 24, 39, 0.26);
}

.quick-bug-report-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    font-size: 16px;
    line-height: 1;
}

.quick-bug-report-btn__label {
    font-size: 13px;
    line-height: 1;
}

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

.bug-page-subtitle {
    margin-top: 4px;
    font-size: 13px;
    color: var(--text-muted);
}

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

.bug-layout {
    display: grid;
    grid-template-columns: minmax(340px, 0.95fr) minmax(420px, 1.25fr);
    gap: 16px;
}

.bug-form-card {
    position: sticky;
    top: 24px;
}

.bug-form-card-compact {
    position: static;
}

.bug-file-summary {
    margin-top: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

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

.bug-report-feed {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.bug-report-card {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    padding: 16px;
}

.bug-report-card.is-closed {
    opacity: 0.72;
}

.bug-report-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.bug-report-card h4 {
    margin: 0;
    font-size: 15px;
}

.bug-report-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.bug-report-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.bug-report-description {
    margin: 0 0 12px;
    color: var(--text);
    white-space: pre-wrap;
}

.bug-report-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.bug-report-footer-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

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

.bug-report-done-btn {
    border: 1px solid #16a34a;
    background: #dcfce7;
    color: #166534;
    font-weight: 700;
}

.bug-report-done-btn:hover {
    background: #bbf7d0;
    border-color: #15803d;
}

.bug-report-prompt-box {
    margin-top: 12px;
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.bug-report-prompt-box summary {
    cursor: pointer;
    font-weight: 600;
}

.bug-report-prompt-box pre {
    margin-top: 10px;
    padding: 12px;
    border-radius: 12px;
    background: #111827;
    color: #e5e7eb;
    overflow: auto;
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
}

.bug-overlay .task-drawer-panel {
    width: 560px;
}

@media (max-width: 1100px) {
    .bug-layout {
        grid-template-columns: 1fr;
    }

    .bug-form-card {
        position: static;
    }
}

@media (max-width: 768px) {
    .bug-page-header,
    .bug-report-card-top,
    .bug-report-footer {
        flex-direction: column;
        align-items: flex-start;
    }

    .quick-bug-report-btn {
        right: max(16px, env(safe-area-inset-right, 0px) + 16px);
        bottom: max(16px, env(safe-area-inset-bottom, 0px) + 16px);
        padding: 10px 12px;
    }
}

/* =============================================
   CALCULATOR SECTIONS — UX redesign 2026-04
   ============================================= */

.calc-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
    overflow: hidden;
}

.calc-section-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.calc-section-number {
    background: var(--accent);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
}

.calc-section-title {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    flex: 1;
}

.calc-section-body {
    padding: 16px;
}

/* Section 2 (Изделия) gets a blue border — it's the main action */
.calc-section-main {
    border: 2px solid var(--accent);
}

.calc-section-main .calc-section-header {
    background: #eff6ff;
    border-bottom-color: #dbeafe;
}

.calc-section-main .calc-section-title {
    color: #1e40af;
}

/* Empty state shown when no items added yet */
.calc-empty-state {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
}

.calc-empty-state-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.calc-empty-state p {
    font-size: 13px;
    margin: 0 0 14px;
}

/* Item card collapse support */
.item-body {
    /* content is always block; toggled to none when collapsed */
}

.item-block.is-collapsed .item-body {
    display: none;
}

/* Summary row: visible only when collapsed */
.item-card-summary {
    display: none;
    padding: 8px 0 4px;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

.item-block.is-collapsed .item-card-summary {
    display: flex;
}

.item-summary-stat {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.item-summary-label {
    font-size: 10px;
    color: var(--text-muted);
}

.item-summary-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

/* Collapse toggle button in item header */
.item-collapse-btn {
    font-size: 11px !important;
    padding: 3px 8px !important;
    margin-right: 4px;
    flex-shrink: 0;
}

/* Delete button in item header — make it clearly destructive */
.item-block-header .btn-danger-sm {
    font-size: 12px;
    padding: 4px 8px;
    background: none;
    border: 1px solid var(--red);
    color: var(--red);
    border-radius: var(--radius);
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--transition);
}

.item-block-header .btn-danger-sm:hover {
    background: var(--red-light);
}

/* "Дополнительно" collapsible inside item card */
.item-advanced-details {
    border-top: 1px dashed var(--border);
    margin-top: 12px;
    padding-top: 4px;
}

.item-advanced-summary {
    cursor: pointer;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 6px 0;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.item-advanced-summary::before {
    content: '▸';
    font-size: 10px;
    transition: transform 0.15s;
}

.item-advanced-details[open] .item-advanced-summary::before {
    transform: rotate(90deg);
}

/* =============================================
   TPA PAGE
   ============================================= */

.tpa-page {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tpa-hero {
    position: relative;
    overflow: hidden;
    padding: 28px;
    border-radius: 18px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.18), transparent 38%),
        linear-gradient(135deg, #0f172a 0%, #132239 58%, #1e3a5f 100%);
    color: #fff;
    margin-bottom: 16px;
}

.tpa-hero::after {
    content: '';
    position: absolute;
    inset: auto -80px -120px auto;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    background: rgba(255,255,255,0.06);
    filter: blur(2px);
}

.tpa-hero-top {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.85fr);
    gap: 24px;
}

.tpa-hero h1 {
    font-size: 32px;
    line-height: 1.05;
    margin-bottom: 10px;
}

.tpa-hero p {
    font-size: 15px;
    color: rgba(255,255,255,0.82);
    max-width: 760px;
}

.tpa-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.tpa-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: rgba(255,255,255,0.09);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
}

.tpa-hero-side {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-content: start;
}

.tpa-hero-stat {
    padding: 16px;
    border-radius: 14px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    backdrop-filter: blur(6px);
}

.tpa-hero-stat-label {
    font-size: 11px;
    color: rgba(255,255,255,0.62);
    margin-bottom: 6px;
}

.tpa-hero-stat-value {
    font-size: 24px;
    line-height: 1.05;
    font-weight: 700;
}

.tpa-hero-stat-sub {
    margin-top: 6px;
    font-size: 11px;
    color: rgba(255,255,255,0.68);
}

.tpa-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(290px, 0.85fr);
    gap: 16px;
}

.tpa-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.tpa-copy {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.tpa-copy strong {
    color: var(--text);
}

.tpa-key-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.tpa-key-card {
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
}

.tpa-key-card strong {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
}

.tpa-key-card p {
    font-size: 12px;
    color: var(--text-secondary);
}

.tpa-note-box {
    padding: 14px 16px;
    border-radius: 12px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    font-size: 12px;
    line-height: 1.5;
}

.tpa-note-box strong {
    color: #1e3a8a;
}

.tpa-preset-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.tpa-preset-btn {
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg);
    color: var(--text-secondary);
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tpa-preset-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.tpa-preset-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.tpa-formula {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #111827;
    color: #e5e7eb;
    font-size: 12px;
    line-height: 1.5;
}

.tpa-formula strong {
    color: #fff;
}

.tpa-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.tpa-result-card {
    padding: 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: linear-gradient(180deg, #fff 0%, #f8fafc 100%);
}

.tpa-result-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.tpa-result-value {
    font-size: 24px;
    line-height: 1.05;
    font-weight: 700;
}

.tpa-result-sub {
    margin-top: 6px;
    font-size: 11px;
    color: var(--text-secondary);
}

.tpa-alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 14px;
}

.tpa-alert {
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.5;
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.tpa-alert.good {
    background: var(--green-light);
    border-color: #86efac;
    color: #166534;
}

.tpa-alert.warn {
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

.tpa-alert.bad {
    background: var(--red-light);
    border-color: #fca5a5;
    color: #991b1b;
}

.tpa-meta-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tpa-meta-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--border);
    font-size: 12px;
}

.tpa-meta-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.tpa-meta-item strong {
    color: var(--text);
}

.tpa-side-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.tpa-side-list-item {
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-secondary);
}

.tpa-side-list-item strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text);
}

.tpa-blank-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

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

.tpa-filter-row select {
    min-width: 180px;
}

.tpa-blanks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}

.tpa-blank-card {
    display: grid;
    grid-template-columns: 88px minmax(0, 1fr);
    gap: 14px;
    align-items: start;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.tpa-blank-card.is-selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.tpa-blank-media {
    width: 88px;
    height: 88px;
    border-radius: 14px;
    background: linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
    border: 1px solid #bfdbfe;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--accent);
    font-weight: 700;
}

.tpa-blank-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tpa-blank-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.tpa-blank-title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
}

.tpa-blank-meta {
    margin-top: 3px;
    font-size: 11px;
    color: var(--text-muted);
}

.tpa-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.tpa-badge.injector {
    background: var(--red-light);
    color: var(--red);
}

.tpa-badge.transition {
    background: #fef3c7;
    color: #92400e;
}

.tpa-badge.tpa {
    background: var(--green-light);
    color: var(--green);
}

.tpa-blank-copy {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.55;
    margin-bottom: 12px;
}

.tpa-blank-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    margin-bottom: 12px;
}

.tpa-blank-fact {
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid var(--border);
}

.tpa-blank-fact-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tpa-blank-fact-value {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.tpa-blank-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.tpa-blank-actions span {
    font-size: 11px;
    color: var(--text-muted);
}

.tpa-empty-state {
    padding: 28px;
    border: 1px dashed var(--border);
    border-radius: 16px;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg);
}

@media (max-width: 1200px) {
    .tpa-layout,
    .tpa-hero-top {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .tpa-hero {
        padding: 22px;
    }

    .tpa-hero h1 {
        font-size: 27px;
    }

    .tpa-hero-side {
        grid-template-columns: 1fr 1fr;
    }

    .tpa-blank-card {
        grid-template-columns: 1fr;
    }

    .tpa-blank-media {
        width: 100%;
        height: 160px;
    }

    .tpa-blank-facts {
        grid-template-columns: 1fr;
    }

    .tpa-filter-row,
    .tpa-preset-row {
        width: 100%;
    }

    .tpa-filter-row select {
        min-width: 0;
        width: 100%;
    }
}
