/* =============================================================================
   HortiFlow — Dashboard Layout & Navigation CSS
   ============================================================================= */

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

:root {
    --brand:           #1a56db;
    --brand-dark:      #1648c0;
    --brand-light:     #e8f0fe;
    --nav-bg:          #ffffff;
    --nav-border:      #e5e7eb;
    --topbar-bg:       #1a1f2e;
    --topbar-text:     #e2e8f0;
    --topbar-muted:    #94a3b8;
    --dropdown-bg:     #ffffff;
    --dropdown-hover:  #f3f4f6;
    --dropdown-active: #e8f0fe;
    --text-primary:    #111827;
    --text-secondary:  #6b7280;
    --text-muted:      #9ca3af;
    --bg-page:         #f3f4f6;
    --bg-card:         #ffffff;
    --border:          #e5e7eb;
    --shadow-nav:      0 1px 3px rgba(0,0,0,.08);
    --shadow-dropdown: 0 8px 24px rgba(0,0,0,.12);
    --radius:          8px;
    --transition:      0.15s ease;
}

html, body { height: 100%; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--bg-page);
    min-height: 100vh;
}

/* ── App Shell ───────────────────────────────────────────────────────────────── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.app-content {
    flex: 1;
    padding: 28px 24px;
    width: 100%;
}

/* ── Topbar ──────────────────────────────────────────────────────────────────── */
.topbar {
    background: var(--topbar-bg);
    height: 52px;
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    flex-shrink: 0;
}

.topbar__logo {
    width: 30px;
    height: 30px;
    background: var(--brand);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.topbar__logo svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

.topbar__app-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.2px;
}

.topbar__tenant {
    font-size: 12px;
    color: var(--topbar-muted);
    padding-left: 12px;
    border-left: 1px solid #2d3748;
}

.topbar__spacer { flex: 1; }

.topbar__user {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--topbar-text);
    font-size: 13px;
}

.topbar__user-name {
    font-weight: 500;
}

.topbar__user-role {
    font-size: 11px;
    color: var(--topbar-muted);
    background: #2d3748;
    padding: 2px 8px;
    border-radius: 99px;
    text-transform: capitalize;
}

.topbar__logout {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--topbar-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #2d3748;
    transition: all var(--transition);
    margin-left: 4px;
}

.topbar__logout:hover {
    color: #fff;
    border-color: #4a5568;
    background: #2d3748;
}

.topbar__logout svg {
    width: 14px;
    height: 14px;
}

/* ── Navigation Bar ──────────────────────────────────────────────────────────── */
.navbar {
    background: var(--nav-bg);
    border-bottom: 1px solid var(--nav-border);
    box-shadow: var(--shadow-nav);
    position: sticky;
    top: 52px;
    z-index: 999;
}

.navbar__inner {
    display: flex;
    align-items: stretch;
    padding: 0 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── Nav Items ───────────────────────────────────────────────────────────────── */
.nav-item {
    position: relative;
    flex-shrink: 0;
}

.nav-item__trigger {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0 14px;
    height: 44px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
    white-space: nowrap;
    transition: color var(--transition);
    border-bottom: 2px solid transparent;
    user-select: none;
}

.nav-item__trigger svg {
    width: 12px;
    height: 12px;
    transition: transform var(--transition);
    flex-shrink: 0;
}

.nav-item:hover .nav-item__trigger,
.nav-item.is-open .nav-item__trigger {
    color: var(--brand);
}

.nav-item.is-active .nav-item__trigger {
    color: var(--brand);
    border-bottom-color: var(--brand);
}

.nav-item.is-open .nav-item__trigger svg {
    transform: rotate(180deg);
}

/* ── Dropdown ────────────────────────────────────────────────────────────────── */
.nav-dropdown {
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    background: var(--dropdown-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-dropdown);
    min-width: 210px;
    padding: 6px 0;
    display: none;
    z-index: 1000;
}

.nav-item.is-open .nav-dropdown {
    display: block;
    animation: dropIn 0.12s ease;
}

@keyframes dropIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.nav-dropdown__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    font-size: 13px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background var(--transition);
    white-space: nowrap;
}

.nav-dropdown__item:hover {
    background: var(--dropdown-hover);
    color: var(--brand);
}

.nav-dropdown__item.is-active {
    background: var(--dropdown-active);
    color: var(--brand);
    font-weight: 600;
}

.nav-dropdown__item svg {
    width: 15px;
    height: 15px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.nav-dropdown__item:hover svg,
.nav-dropdown__item.is-active svg {
    color: var(--brand);
}

.nav-dropdown__divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* ── Nested sub-menu group within a dropdown ─────────────────────────────────── */
.nav-dropdown__group-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 9px 16px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
    text-align: left;
    white-space: nowrap;
    transition: background var(--transition);
}
.nav-dropdown__group-trigger:hover {
    background: var(--dropdown-hover);
    color: var(--brand);
}
.nav-dropdown__group-trigger svg.icon {
    width: 15px;
    height: 15px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.nav-dropdown__group-trigger:hover svg.icon { color: var(--brand); }
.nav-dropdown__group-trigger .group-arrow {
    margin-left: auto;
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    flex-shrink: 0;
    transition: transform 0.15s;
}
.nav-dropdown__group.is-open .group-arrow { transform: rotate(180deg); }

.nav-dropdown__sub {
    display: none;
    background: var(--dropdown-hover, #f1f5f9);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}
.nav-dropdown__group.is-open .nav-dropdown__sub { display: block; }
.nav-dropdown__sub .nav-dropdown__item { padding-left: 32px; }

/* ── Mobile hamburger ────────────────────────────────────────────────────────── */
.navbar__hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    margin-left: auto;
}

.navbar__hamburger svg { width: 20px; height: 20px; }

/* ── Page Header ─────────────────────────────────────────────────────────────── */
.page-header {
    margin-bottom: 24px;
}

.page-header__title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
}

.page-header__subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* ── Card ────────────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

/* ── Coming Soon placeholder ────────────────────────────────────────────────── */
.coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 64px 24px;
    color: var(--text-muted);
    gap: 16px;
}

.coming-soon__icon {
    width: 56px;
    height: 56px;
    background: var(--brand-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coming-soon__icon svg {
    width: 28px;
    height: 28px;
    color: var(--brand);
}

.coming-soon__title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
}

.coming-soon__text {
    font-size: 14px;
    max-width: 320px;
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

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

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

.btn--danger {
    background: #fff;
    color: #dc2626;
    border-color: #fca5a5;
}

.btn--danger:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

.btn--ghost {
    background: #fff;
    color: var(--text-secondary);
    border-color: var(--border);
}

.btn--ghost:hover {
    background: var(--bg-page);
    color: var(--text-primary);
}

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

.btn--sm svg { width: 13px; height: 13px; }

/* ── Card Header ─────────────────────────────────────────────────────────────── */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-header__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-header__subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* ── Alerts ──────────────────────────────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 20px;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.alert--success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.alert--error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    color: #991b1b;
}

.alert--info {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    color: #1e40af;
}

/* ── Table Search Bar ────────────────────────────────────────────────────────── */
.table-search {
    margin-bottom: 16px;
}

.table-search__wrapper {
    position: relative;
    max-width: 360px;
}

.table-search__icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 15px;
    height: 15px;
    color: var(--text-muted);
    pointer-events: none;
    flex-shrink: 0;
}

.table-search__input {
    display: block;
    width: 100%;
    padding: 8px 34px 8px 34px;
    font-size: 13px;
    font-family: inherit;
    color: var(--text-primary);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.table-search__input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-light);
}

.table-search__input::placeholder {
    color: var(--text-muted);
}

.table-search__clear {
    position: absolute;
    right: 7px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    padding: 0;
    transition: all var(--transition);
}

.table-search__clear svg { width: 13px; height: 13px; }

.table-search__clear:hover {
    color: var(--text-primary);
    background: var(--border);
}

.table-search__clear.is-visible {
    display: flex;
}

/* ── Data Table ──────────────────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    margin: 0 -1px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 10px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg-page);
}

.data-table td {
    padding: 12px 16px;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody tr:hover td {
    background: #fafafa;
}

.table-actions {
    text-align: right;
    width: 1%;
    white-space: nowrap;
}

/* ── Empty State ─────────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 40px 24px;
}

.empty-state__icon {
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
    color: var(--text-muted);
}

.empty-state__icon svg { width: 40px; height: 40px; }

.empty-state__text {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ── Forms ───────────────────────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 16px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-control:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-light);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

/* ── Modal ───────────────────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition);
}

.modal-backdrop.is-open {
    opacity: 1;
    pointer-events: all;
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
    width: 100%;
    max-width: 420px;
    margin: 16px;
    transform: translateY(-8px);
    transition: transform var(--transition);
}

.modal-backdrop.is-open .modal {
    transform: translateY(0);
}

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal__title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.modal__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 6px;
    transition: all var(--transition);
}

.modal__close:hover {
    background: var(--bg-page);
    color: var(--text-primary);
}

.modal__close svg { width: 16px; height: 16px; }

.modal__body {
    padding: 20px 24px 24px;
}

/* ── Client Code Badge ───────────────────────────────────────────────────────── */
.client-code-badge {
    display: inline-block;
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    font-weight: 700;
    color: var(--brand);
    background: var(--brand-light);
    padding: 2px 8px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

/* ── Client code readonly input ──────────────────────────────────────────────── */
.client-code-readonly {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    font-weight: 700;
    color: var(--brand);
    background: var(--brand-light);
    border-color: var(--brand-light);
    cursor: default;
}

/* ── Form hint ────────────────────────────────────────────────────────────────── */
.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ── Optional (removable) field ──────────────────────────────────────────────── */
.optional-field {
    margin-bottom: 16px;
}

.optional-field-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.optional-field-header .form-label {
    margin-bottom: 0;
}

.optional-field-remove {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--text-muted);
    border-radius: 4px;
    padding: 0;
    transition: all var(--transition);
}

.optional-field-remove:hover {
    color: #dc2626;
    background: #fef2f2;
}

.optional-field-remove svg {
    width: 12px;
    height: 12px;
}

/* ── Field adder ──────────────────────────────────────────────────────────────── */
.field-adder {
    margin-top: 4px;
}

.field-adder-panel {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-top: 8px;
    display: none;
}

.field-adder-panel.is-open {
    display: block;
}

.field-adder-panel__title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.field-adder-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.field-adder-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 99px;
    cursor: pointer;
    color: var(--text-primary);
    transition: all var(--transition);
}

.field-adder-chip:hover {
    background: var(--brand-light);
    border-color: var(--brand);
    color: var(--brand);
}

.field-adder-custom-row {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.field-adder-custom-row .form-control {
    font-size: 13px;
    padding: 7px 10px;
}

/* ── Modal wide variant ──────────────────────────────────────────────────────── */
.modal--wide {
    max-width: 760px;
}

/* ── Two-column form grid inside modals ──────────────────────────────────────── */
.modal-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
}

.modal-form-grid .form-group {
    min-width: 0;
}

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

@media (max-width: 600px) {
    .modal-form-grid {
        grid-template-columns: 1fr;
    }
    .form-col-span-2 {
        grid-column: 1;
    }
    .modal--wide {
        max-width: 100%;
    }
}

/* ── Responsive ──────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .topbar__tenant,
    .topbar__user-role { display: none; }

    .navbar__hamburger { display: flex; }

    .navbar__inner {
        flex-wrap: wrap;
        padding: 0;
    }

    .navbar__inner > .nav-item {
        display: none;
        width: 100%;
    }

    .navbar__inner.is-open > .nav-item {
        display: block;
    }

    .nav-item__trigger {
        width: 100%;
        padding: 0 20px;
        border-bottom: 1px solid var(--border);
        border-right: none;
    }

    .nav-dropdown {
        position: static;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding: 0;
        background: var(--bg-page);
    }

    .app-content { padding: 20px 16px; }
}

/* ── Inline sow-date in table ────────────────────────────────────────────── */
.sow-date-input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: 0;
    padding: 0;
    margin: 0;
}
.sow-date-trigger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 3px;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.sow-date-trigger:hover {
    color: var(--brand);
    background: var(--brand-light);
}

/* ── Week navigator (Sow List) ───────────────────────────────────────────── */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 20px;
    margin-bottom: 16px;
}
.week-nav__label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.week-nav__week {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.week-nav__current-badge {
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--brand);
    color: #fff;
    padding: 1px 7px;
    border-radius: 99px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}
.week-nav__range {
    font-size: 0.82rem;
    color: var(--text-muted);
}
.week-nav__arrow {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ── Week picker panel ───────────────────────────────────────────────────── */
.week-picker-wrap {
    position: relative;
    display: inline-block;
}
.week-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--brand-light);
    color: var(--brand);
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
}
.week-picker-btn:hover { background: #dbeafe; }
.week-picker-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,.15);
    width: 400px;
    z-index: 200;
    overflow: hidden;
}
.week-picker-panel.wpp--open { display: block; }
.wpp-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
}
.wpp-year-nav { display: flex; align-items: center; gap: 10px; }
.wpp-year-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
    color: var(--text);
    font-size: 13px;
    text-decoration: none;
    line-height: 1;
}
.wpp-year-btn:hover { background: var(--brand-light); color: var(--brand); border-color: #bfdbfe; }
.wpp-year  { font-weight: 700; font-size: 15px; color: var(--text); }
.wpp-hint  { font-size: 11px; color: var(--text-muted); }
.wpp-body  { padding: 12px; max-height: 320px; overflow-y: auto; }
.wpp-grid  { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.wpp-month {
    grid-column: 1 / -1;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    padding: 6px 2px 2px;
}
.wpp-card {
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 4px;
    text-align: center;
    text-decoration: none;
    display: block;
    transition: border-color .12s, background .12s;
}
.wpp-card:hover            { border-color: #93c5fd; background: var(--brand-light); }
.wpp-card--current         { border-color: var(--brand); background: var(--brand-light); }
.wpp-card--current .wpp-wk { color: var(--brand); }
.wpp-card--viewing         { border-color: var(--brand); background: var(--brand); }
.wpp-card--viewing .wpp-wk,
.wpp-card--viewing .wpp-range { color: #fff; }
.wpp-wk    { display: block; font-weight: 700; font-size: 12px; color: var(--text); }
.wpp-range { display: block; font-size: 10px; color: var(--text-muted); margin-top: 2px; line-height: 1.3; }

/* ── Sow List — inline notes textarea ───────────────────────────────────── */
.sow-notes-input {
    width: 100%;
    min-width: 180px;
    padding: 5px 8px;
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    resize: vertical;
    transition: border-color var(--transition), background var(--transition);
    line-height: 1.4;
}
.sow-notes-input:hover {
    border-color: var(--border);
    background: var(--bg-page);
}
.sow-notes-input:focus {
    outline: none;
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}

/* ── Weekly Summary ──────────────────────────────────────────────────────── */
.ws-tray-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.ws-tray-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}
.ws-tray-select {
    min-width: 200px;
}
.ws-tray-badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    background: var(--brand-light);
    color: var(--brand);
    padding: 1px 7px;
    border-radius: 20px;
    margin-left: 6px;
    vertical-align: middle;
}
.ws-category {
    font-size: 0.8em;
    color: var(--text-muted);
    margin-left: 4px;
}
.ws-totals-row td {
    border-top: 2px solid var(--border);
    background: var(--bg-page);
    padding-top: 10px;
    padding-bottom: 10px;
}
.lot-no-input {
    width: 130px;
    padding: 5px 8px;
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.lot-no-input:hover {
    border-color: var(--border);
    background: var(--bg-page);
}
.lot-no-input:focus {
    outline: none;
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26,86,219,.12);
}
.lot-no-input.lot-no-saved {
    border-color: #16a34a;
    background: #f0fdf4;
}

/* ── Sow List Report page ────────────────────────────────────────────────── */
.report-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
@media (max-width: 700px) {
    .report-grid { grid-template-columns: 1fr; }
}
.report-option {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 28px;
}
.report-option__icon {
    width: 52px;
    height: 52px;
    background: var(--brand-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--brand);
    flex-shrink: 0;
}
.report-option__icon svg { width: 26px; height: 26px; }
.report-option__title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}
.report-option__desc {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.55;
    flex: 1;
}
.report-option__meta {
    font-size: 0.8rem;
}
.report-option__count {
    display: inline-block;
    background: var(--brand-light);
    color: var(--brand);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
}
.report-option__none {
    color: var(--text-muted);
}
.report-option__tray {
    display: flex;
    align-items: center;
    gap: 10px;
}
.report-option__action { margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Weekly Summary — Sown checkbox ─────────────────────────────────────── */
.sown-checkbox {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: #16a34a;
}
.ws-row--sown td {
    opacity: 0.45;
    text-decoration: line-through;
    text-decoration-color: rgba(0,0,0,0.25);
}
.ws-row--sown .lot-no-input,
.ws-row--sown .sown-checkbox {
    opacity: 1;
    text-decoration: none;
}

.completed-checkbox {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: #2563eb;
}

/* ── Process page ────────────────────────────────────────────────────────── */
.process-week-header td {
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 7px 14px;
}
.process-notes {
    max-width: 200px;
    white-space: pre-wrap;
    font-size: 0.85rem;
    color: var(--text-secondary);
}
.process-allocation {
    display: inline-block;
    background: var(--brand-light);
    color: var(--brand);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 2px 8px;
    border-radius: 10px;
}

/* ── Allocation status badge ─────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}
.badge--success { background: #dcfce7; color: #15803d; }
.badge--muted   { background: var(--bg-page); color: var(--text-muted); }

/* ── Allocation modal info bar ───────────────────────────────────────────── */
.modal-info-bar {
    background: var(--bg-page);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 20px;
}

/* ── Table: no-wrap default + wrapping exceptions ────────────────────────── */
.data-table td { white-space: nowrap; }
.data-table td.process-notes,
.data-table td.cancel-reason,
.data-table td.del-reason { white-space: normal; }

/* ── Packaging-bags / invoice dot-button trigger ─────────────────────────── */
.pkg-bags-trigger {
    display: inline-flex; align-items: center; gap: 5px;
    background: none; border: none; cursor: pointer;
    color: var(--text-primary); font-size: 0.85rem; padding: 2px 4px;
    border-radius: 4px; white-space: nowrap;
}
.pkg-bags-trigger:hover { background: var(--bg-hover, #f3f4f6); }
.pkg-bags-trigger .pkg-bags-dot {
    width: 14px; height: 14px; border-radius: 50%;
    border: 2px solid var(--primary, #1a56db);
    background: none; flex-shrink: 0; display: block;
}
.pkg-bags-trigger.has-value .pkg-bags-dot { background: var(--primary, #1a56db); }
.pkg-bags-label { color: var(--text-muted); font-size: 0.8rem; }
.pkg-bags-trigger.has-value .pkg-bags-label { color: var(--text-primary); }
.dn-invoice-no { width: 80px; }

/* ── Surplus sell/delete sticky action bar ───────────────────────────────── */
.surplus-sell-bar {
    position: sticky;
    bottom: 0;
    background: var(--bg-card);
    border-top: 2px solid var(--brand);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
}
.surplus-sell-bar__count {
    font-size: 0.9rem;
    color: var(--text-primary);
    font-weight: 600;
    flex: 1;
}
.sell-modal-table { width: 100%; border-collapse: collapse; margin-top: 4px; }
.sell-modal-table th {
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border);
}
.sell-modal-table td { padding: 8px; border-bottom: 1px solid var(--border); font-size: 14px; }
.sell-modal-table input[type=number] { width: 90px; }

/* ── Stock status badges ─────────────────────────────────────────────────── */
.stock-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.stock-badge--in  { background: #dcfce7; color: #15803d; }
.stock-badge--low { background: #fef9c3; color: #854d0e; }
.stock-badge--out { background: #fee2e2; color: #b91c1c; }

/* ── View-scope toggle (all-time vs. rolling window) ─────────────────────── */
.view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--brand);
    background: var(--brand-light);
    border: 1px solid var(--brand);
    border-radius: var(--radius);
    padding: 5px 12px;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
}
.view-toggle:hover { background: var(--brand); color: #fff; }

/* ── Dashboard KPI Stats ─────────────────────────────────────────────────── */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}
@media (max-width: 900px) { .dash-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 540px) { .dash-stats { grid-template-columns: 1fr; } }

.dash-stat {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-nav);
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-left: 4px solid transparent;
}
.dash-stat--blue   { border-left-color: #1a56db; }
.dash-stat--green  { border-left-color: #16a34a; }
.dash-stat--orange { border-left-color: #d97706; }
.dash-stat--purple { border-left-color: #7c3aed; }

.dash-stat__body { min-width: 0; }

.dash-stat__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}
.dash-stat__label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 4px;
}
.dash-stat__icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--bg-page);
    color: var(--text-muted);
}
.dash-stat__icon svg { width: 20px; height: 20px; }

/* ── Dashboard Section Grid ──────────────────────────────────────────────── */
.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
@media (max-width: 1100px) { .dash-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px)  { .dash-grid { grid-template-columns: 1fr; } }

.dash-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow-nav);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.dash-card__header {
    display: flex;
    align-items: center;
    gap: 14px;
}
.dash-card__icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-card__icon svg { width: 22px; height: 22px; }

.dash-card__icon--blue   { background: #e8f0fe; color: #1a56db; }
.dash-card__icon--green  { background: #dcfce7; color: #16a34a; }
.dash-card__icon--teal   { background: #ccfbf1; color: #0f766e; }
.dash-card__icon--orange { background: #fef3c7; color: #d97706; }
.dash-card__icon--red    { background: #fee2e2; color: #b91c1c; }
.dash-card__icon--purple { background: #ede9fe; color: #7c3aed; }
.dash-card__icon--gray   { background: var(--bg-page); color: var(--text-muted); }

.dash-card__title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}
.dash-card__number {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--brand);
    margin-top: 2px;
}
.dash-card__number--sm {
    color: var(--text-muted);
    font-weight: 500;
}
.dash-card__links {
    list-style: none;
    border-top: 1px solid var(--border);
    padding-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.dash-card__link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
}
.dash-card__link:hover {
    background: var(--brand-light);
    color: var(--brand);
}
.dash-card__link svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
    color: var(--text-muted);
}
.dash-card__link:hover svg { color: var(--brand); }

/* ── Floor Plan Canvas (tunnels setup page) ──────────────────────────────── */
.floor-plan-canvas {
    position: relative;
    min-height: 500px;
    background: #f8fafc;
    border: 2px dashed var(--border);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow: hidden;
    margin: 0 20px 0;
}
.canvas-resize-handle {
    height: 10px;
    margin: 0 20px 20px;
    background: var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.canvas-resize-handle:hover,
.canvas-resize-handle.is-dragging {
    background: var(--primary);
}
.canvas-resize-handle::before {
    content: '';
    width: 32px;
    height: 2px;
    background: white;
    border-radius: 1px;
    opacity: 0.7;
}
.tunnel-block {
    position: absolute;
    background: white;
    border: 2px solid var(--border);
    border-radius: 6px;
    padding: 8px 10px 10px;
    cursor: grab;
    user-select: none;
    box-shadow: var(--shadow-nav);
    touch-action: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
}
.tunnel-block:active  { cursor: grabbing; }
/* Resize handle indicator — bottom-right corner */
.tunnel-block::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--border);
    border-bottom: 2px solid var(--border);
    pointer-events: none;
    border-radius: 1px;
}
.tunnel-block__name {
    font-weight: 600;
    font-size: 12px;
    color: var(--text);
    white-space: nowrap;
    padding-bottom: 6px;
    margin-bottom: 8px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--border);
}

/* Vertical tunnel: shelves stacked as rows */
.tunnel-block--vertical .tb-rows-wrap {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.tunnel-block--vertical .tb-shelf-row {
    display: flex;
    flex-direction: row;
    gap: 2px;
}

/* Horizontal tunnel: shelves arranged as columns */
.tunnel-block--horizontal .tb-cols-wrap {
    display: flex;
    flex-direction: row;
    gap: 3px;
}
.tunnel-block--horizontal .tb-shelf-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Canvas tray slots (smaller than floor plan slots) */
.tb-slot {
    width: 14px;
    height: 10px;
    border-radius: 2px;
    flex-shrink: 0;
}
.tb-slot--empty  { background: #e5e7eb; }
.tb-slot--filled { background: var(--brand); }
.tb-slot--filled.fill--warn { background: var(--fill-warn); }
.tb-slot--filled.fill--full { background: var(--fill-full); }

/* ── Fill status colours ──────────────────────────────────────────────────── */
:root {
    --fill-empty: #9ca3af;
    --fill-ok:    #16a34a;
    --fill-warn:  #d97706;
    --fill-full:  #dc2626;
}

/* ── Floor Plan list view (floor-plan/index.php) ─────────────────────────── */
.tunnel-card { border-top: 3px solid var(--border); }
.tunnel-card.fill--ok   { border-top-color: var(--fill-ok); }
.tunnel-card.fill--warn { border-top-color: var(--fill-warn); }
.tunnel-card.fill--full { border-top-color: var(--fill-full); }

.tunnel-card__header { flex-wrap: wrap; gap: 12px; }

.tunnel-fill-bar-wrap {
    width: 120px;
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.tunnel-fill-bar {
    height: 100%;
    border-radius: 4px;
    background: var(--fill-empty);
    transition: width 0.3s;
}
.tunnel-fill-bar.fill--ok   { background: var(--fill-ok); }
.tunnel-fill-bar.fill--warn { background: var(--fill-warn); }
.tunnel-fill-bar.fill--full { background: var(--fill-full); }

.fill-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--fill-empty);
}
.fill-dot--fill--ok   { background: var(--fill-ok); }
.fill-dot--fill--warn { background: var(--fill-warn); }
.fill-dot--fill--full { background: var(--fill-full); }

/* Shelf list */
.shelf-list {
    border-top: 1px solid var(--border);
    padding: 0;
}
.shelf-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    flex-wrap: wrap;
}
.shelf-row:last-child { border-bottom: none; }

.shelf-row__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 56px;
    flex-shrink: 0;
}
.shelf-row__slots {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
    flex: 0 0 auto;
}
.tray-slot {
    width: 20px;
    height: 16px;
    border-radius: 3px;
    flex-shrink: 0;
}
.tray-slot.empty  { background: #e5e7eb; }
.tray-slot.filled { background: var(--brand); }
.tray-slot.filled.fill--warn { background: var(--fill-warn); }
.tray-slot.filled.fill--full { background: var(--fill-full); }

.shelf-row__info { flex-shrink: 0; }
.shelf-row__allocs {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}
.badge--full    { background: #fee2e2; color: var(--fill-full); }
.badge--empty   { background: #f3f4f6; color: var(--text-muted); }
.badge--partial { background: #dcfce7; color: var(--fill-ok); }

/* Allocation tags */
.shelf-alloc-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    padding: 2px 6px 2px 8px;
    font-size: 12px;
    font-weight: 500;
}
.shelf-alloc-tag__detail { color: #6b7280; font-weight: 400; }
.shelf-alloc-tag__remove {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0 1px;
    color: #6b7280;
    line-height: 1;
}
.shelf-alloc-tag__remove svg { width: 12px; height: 12px; }
.shelf-alloc-tag__remove:hover { color: var(--danger); }

/* ── Tunnel block canvas — shelf representation ───────────────────────────── */

/* Vertical tunnel: shelf bars side-by-side, each fills equal width and all height */
.tunnel-block--vertical .tunnel-block__shelves {
    display: flex;
    flex-direction: row;
    gap: 3px;
    flex: 1;
    min-height: 0;
}
.tunnel-block--vertical .tunnel-block__shelf {
    flex: 1;
    min-width: 8px;
    background: #cbd5e1;
    border-radius: 2px;
}

/* Horizontal tunnel: shelf bars stacked, each fills full width and equal height */
.tunnel-block--horizontal .tunnel-block__shelves {
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 1;
    min-height: 0;
}
.tunnel-block--horizontal .tunnel-block__shelf {
    flex: 1;
    min-height: 6px;
    width: 100%;
    background: #cbd5e1;
    border-radius: 2px;
}

/* ── Shelf config collapsible row ────────────────────────────────────────── */
.shelf-config-row { display: none; }
.shelf-config-row.is-open { display: table-row; }

.shelf-config-cell {
    padding: 0 !important;
    background: #f8fafc;
    border-top: none !important;
}
.shelf-config-cell .data-table {
    border-radius: 0;
    border-top: 1px solid var(--border);
}
.shelf-config-cell .data-table thead th {
    background: #f1f5f9;
}

/* Chevron toggle icon */
.shelf-toggle-btn .chevron-icon {
    transition: transform 0.2s ease;
}
.shelf-toggle-btn.is-open .chevron-icon {
    transform: rotate(180deg);
}

/* Shelf save feedback */
.shelf-save-status {
    font-size: 12px;
    font-weight: 500;
    margin-left: 6px;
}
.shelf-save-status--ok  { color: var(--fill-ok); }
.shelf-save-status--err { color: var(--danger); }

/* =============================================================================
   Nursery allocation modal (weekly-summary + process change-location)
   ============================================================================= */

/* Shared modal overlay/box (used by nursery + shelf detail modals) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 32px 16px;
    overflow-y: auto;
}
.modal-box {
    background: var(--surface);
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 100%;
    max-width: 680px;
    display: flex;
    flex-direction: column;
}
.modal-box--wide { max-width: 900px; }
.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
}
.modal-title  { font-size: 1.1rem; font-weight: 700; color: var(--text); margin: 0; }
.modal-subtitle { font-size: 13px; color: var(--text-muted); margin: 2px 0 0; }
.modal-close {
    background: none; border: none; cursor: pointer; padding: 2px 6px;
    font-size: 22px; line-height: 1; color: var(--text-muted);
}
.modal-close:hover { color: var(--text); }
.modal-body {
    padding: 18px 22px;
    overflow-y: auto;
    max-height: calc(80vh - 130px);
}
.modal-footer {
    padding: 14px 22px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

/* ── Tray progress bar ── */
.alloc-progress-wrap { margin-bottom: 16px; }
.alloc-progress-label { font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.alloc-progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}
.alloc-progress-fill {
    height: 100%;
    background: var(--brand);
    border-radius: 4px;
    transition: width 0.2s ease;
}

/* ── Segment list ── */
.alloc-segment-list {
    background: #f0f7ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    padding: 10px 14px;
    margin-bottom: 16px;
    font-size: 13px;
}
.alloc-segment-list ul { margin: 6px 0 0; padding-left: 18px; }
.alloc-segment-list li { margin-bottom: 4px; }

/* ── Note / error ── */
.alloc-note {
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 5px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
    flex: 1;
}
.alloc-note--error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

/* ── Nursery tunnel accordion ── */
.nursery-tunnel-list { display: flex; flex-direction: column; gap: 8px; }
.nursery-tunnel {
    border: 1px solid var(--border);
    border-radius: 7px;
    overflow: hidden;
}
.nursery-tunnel__header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg);
    border: none;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
    text-align: left;
    gap: 8px;
}
.nursery-tunnel__header:hover { background: #f1f5f9; }
.nursery-tunnel__header--open { background: #eff6ff; }
.nursery-tunnel__header--open .nursery-tunnel__chevron { transform: rotate(180deg); }
.nursery-tunnel__chevron { transition: transform .2s; flex-shrink: 0; }
.nursery-tunnel__name { flex: 1; }
.nursery-tunnel__body { padding: 12px 14px; background: var(--surface); }
.nursery-tunnel__loading { color: var(--text-muted); font-size: 13px; }

/* ── Shelf within nursery modal ── */
.nursery-shelf-grid-wrap { display: flex; flex-direction: column; gap: 14px; }
.nursery-shelf { }
.nursery-shelf__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}
.nursery-shelf__name { font-weight: 600; font-size: 13px; }
.nursery-shelf__meta { font-size: 12px; color: var(--text-muted); }

/* ── Slot grid ── */
.slot-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 3px;
}
.slot {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: border-color .1s, transform .1s;
    position: relative;
}
.slot--free {
    background: #f1f5f9;
    border-color: #cbd5e1;
}
.slot--free:hover { border-color: var(--brand); transform: scale(1.1); }
.slot--occupied { cursor: not-allowed; opacity: .8; }
.slot--selected {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.slot--selecting { border-color: var(--brand); background: #dbeafe; }
.slot__num { font-size: 9px; line-height: 1; color: inherit; pointer-events: none; }

/* ── Floor plan: client-coloured tray slots ── */
.tray-slot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin: 1px;
    border: 1px solid rgba(0,0,0,.1);
}
.tray-slot.empty      { background: #e5e7eb; }
.tray-slot--tracked   { }
.tray-slot--legacy    { }

/* Client legend */
.client-legend-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text);
}
.client-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Shelf row clickable */
.shelf-row--clickable { cursor: pointer; }
.shelf-row--clickable:hover { background: #f8fafc; }

/* Shelf detail modal */
.detail-slot-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 18px;
    padding: 12px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 7px;
}
.detail-slot {
    width: 36px;
    height: 36px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    border: 1.5px solid transparent;
}
.detail-slot--free {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--text-muted);
}
.detail-slot--filled {
    color: #fff;
    border-color: rgba(0,0,0,.15);
}
.detail-slot__num { font-size: 9px; }

.shelf-detail-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

/* Allocation summary table inside shelf detail */
.detail-alloc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin-top: 4px;
}
.detail-alloc-table th {
    background: #f1f5f9;
    padding: 6px 10px;
    text-align: left;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}
.detail-alloc-table td {
    padding: 6px 10px;
    border-bottom: 1px solid #f1f5f9;
}
.detail-client-dot {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}

/* Process page location cell */
.process-location-cell { white-space: nowrap; vertical-align: middle; }
.process-location-text { white-space: normal; line-height: 1.4; }

/* ── Nursery button ── */
.nursery-btn { gap: 4px; }

/* Shelf alloc tag with client dot */
.shelf-alloc-tag { display: inline-flex; align-items: center; gap: 4px; }
.shelf-alloc-tag__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* =============================================================================
   Nursery Allocation Wizard
   ============================================================================= */

/* Modal background fix */
.modal-box { background: #ffffff; }

/* Step label */
.nrs-step-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--brand);
    margin-bottom: 10px;
}

/* Order list (Step 1) */
.nrs-order-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background var(--transition), border-color var(--transition);
}
.nrs-order-item:hover { background: var(--bg-page); border-color: var(--brand); }
.nrs-order-item--done { opacity: .55; cursor: default; }
.nrs-badge {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 6px;
}
.nrs-badge--partial { background: #fef3c7; color: #92400e; }
.nrs-badge--done    { background: #d1fae5; color: #065f46; }

/* Shelf list (Step 3) */
.nrs-shelf-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}
.nrs-shelf-item:hover         { border-color: var(--brand); background: var(--brand-light); }
.nrs-shelf-item--selected     { border-color: var(--brand); background: var(--brand-light); }
.nrs-shelf-item--warn         { border-color: #fbbf24; }
.nrs-shelf-item__info         { flex: 1; }
.nrs-shelf-item__name         { display: block; font-weight: 600; font-size: 14px; }
.nrs-shelf-item__meta         { font-size: 12px; color: var(--text-muted); }

/* Mini fill bar (Step 3) */
.nrs-shelf-mini-bar {
    width: 140px;
    height: 10px;
    background: #e9eef5;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    flex-shrink: 0;
}
.nrs-shelf-mini-used { background: #94a3b8; height: 100%; }
.nrs-shelf-mini-mine { background: var(--brand); height: 100%; }

/* Shelf bar (Step 4) */
.nrs-shelf-bar {
    display: flex;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #f8fafc;
}
.nrs-bar-seg          { height: 100%; transition: filter .1s; }
.nrs-bar-seg--free    { background: #e9eef5; border-right: 1px solid #d1d9e6; }
.nrs-bar-seg--placed  { background: #6366f1; }
.nrs-bar-seg--proposed{ background: #22c55e; border: 1px dashed #16a34a; }

/* Allocation preview (Step 4) */
.nrs-preview {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
}
.nrs-preview--ok   { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.nrs-preview--warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ── Nursery wizard — direction picker cards ─────────────────────────────── */
.nrs-dir-cards {
    display: flex;
    gap: 16px;
}
.nrs-dir-card {
    flex: 1;
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    user-select: none;
}
.nrs-dir-card:hover {
    border-color: var(--brand);
    background: #f0f7ff;
}
.nrs-dir-card--selected {
    border-color: var(--brand);
    background: #eff6ff;
}
.nrs-dir-card__icon {
    font-size: 26px;
    margin-bottom: 6px;
    color: var(--brand);
    text-align: center;
}
.nrs-dir-card__label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 10px;
    text-align: center;
}
.nrs-dir-card__tray1 {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.nrs-dir-card__bar .nrs-shelf-bar {
    height: 18px;
}

/* =============================================================================
   Floor Plan — Full-screen drill-down modal
   ============================================================================= */

/* Full-screen overrides on top of existing .modal-overlay / .modal-box */
.modal-overlay--fs {
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
}
.modal-box--fs {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-box--fs > div {          /* fpPanelA / fpPanelB */
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}
.modal-box--fs .modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    max-height: none;
}
.fp-alloc-section {
    margin-top: 12px;
}
.modal-box--fs .modal-footer {
    padding: 6px 22px;
}
.modal-box--fs .modal-footer .btn {
    padding-top: 5px;
    padding-bottom: 5px;
}

/* ── Summary pills in Panel A subtitle ──────────────────────────────────────── */
.fp-summary-item  { color: var(--text-secondary); font-size: 13px; }
.fp-summary-sep   { color: var(--text-muted); margin: 0 6px; font-size: 13px; }
.fp-summary-pct   { font-weight: 600; color: var(--brand); }

/* ── Breadcrumb in Panel B ───────────────────────────────────────────────────── */
.fp-breadcrumb    { font-size: 15px; font-weight: 600; line-height: 1.4; }
.fp-bc-tunnel     { color: var(--text-muted); }
.fp-bc-shelf      { color: var(--text-primary); }

/* =============================================================================
   Floor Plan — Vertical tunnel: horizontal shelf bars stacked
   ============================================================================= */
.fp-shelf-bars--vertical {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 4px 0;
}

/* Each shelf row */
.fp-bar-row {
    display: grid;
    grid-template-columns: 140px 1fr 60px;
    align-items: center;
    gap: 10px;
    min-height: 48px;
    cursor: pointer;
    border-radius: 6px;
    padding: 4px 6px;
    transition: background var(--transition);
}
.fp-bar-row:hover { background: var(--dropdown-hover); }

.fp-bar-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fp-bar-track {
    display: flex;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #f8fafc;
}

.fp-bar-seg {
    height: 100%;
    transition: filter 0.1s;
}
.fp-bar-seg:hover { filter: brightness(0.9); }
.fp-bar-seg--free {
    background: #f1f5f9;
    border-right: 1px solid #e2e8f0;
}

.fp-bar-meta {
    font-size: 12px;
    color: var(--text-muted);
    text-align: right;
    white-space: nowrap;
}
.fp-bar-pct { font-weight: 600; color: var(--text-secondary); }

/* =============================================================================
   Floor Plan — Horizontal tunnel: vertical shelf columns side by side
   ============================================================================= */
.fp-shelf-bars--horizontal {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 8px;
    padding: 4px 0;
    overflow-x: auto;
    height: 360px;
}

/* Each shelf column */
.fp-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 60px;
    max-width: 120px;
    height: 100%;
    cursor: pointer;
    border-radius: 6px;
    padding: 4px;
    transition: background var(--transition);
    gap: 4px;
}
.fp-col:hover { background: var(--dropdown-hover); }

.fp-col-track {
    flex: 1;
    width: 100%;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.fp-col-seg {
    width: 100%;
    transition: filter 0.1s;
}
.fp-col-seg:hover { filter: brightness(0.9); }
.fp-col-seg--free {
    background: #f1f5f9;
    border-top: 1px solid #e2e8f0;
}

.fp-col-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
.fp-col-meta {
    font-size: 11px;
    color: var(--text-muted);
    text-align: center;
}

/* =============================================================================
   Floor Plan — Panel B: 2-D tray grid
   ============================================================================= */
.tray-grid-wrap {
    display: flex;
    justify-content: center;
    padding: 8px 0 16px;
}
.tray-grid {
    display: inline-grid;
    grid-template-columns: repeat(var(--tray-cols, 1), var(--cell-size, 10px));
    grid-auto-rows: var(--cell-size, 10px);
    gap: 2px;
}
.tray-cell {
    width: var(--cell-size, 10px);
    height: var(--cell-size, 10px);
    border-radius: 2px;
    cursor: default;
    transition: filter 0.1s, transform 0.1s;
}
.tray-cell:hover {
    filter: brightness(0.8);
    transform: scale(1.4);
    z-index: 1;
    position: relative;
}
.tray-cell--free {
    background: #e2e8f0;
    border: 1px solid #cbd5e1;
}
.tray-cell--filled {
    border: 1px solid rgba(0,0,0,.12);
}
