:root {
    --bg: #f4f5f1;
    --surface: #ffffff;
    --surface-muted: #f7f9f7;
    --border: #d8ddd6;
    --border-strong: #b7c0b5;
    --text: #1f2a22;
    --text-soft: #5f6b62;
    --accent: #1d7b61;
    --accent-strong: #155a47;
    --accent-soft: #e3f4ed;
    --danger: #a83c3c;
    --danger-soft: #fdeaea;
    --shadow: 0 18px 48px rgba(31, 42, 34, 0.08);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
    --font-sans: "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font-sans);
    background:
        radial-gradient(circle at top right, rgba(29, 123, 97, 0.08), transparent 26rem),
        linear-gradient(180deg, #f6f6f2 0%, #eef1ed 100%);
    color: var(--text);
}

body {
    line-height: 1.5;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button {
    cursor: pointer;
}

[hidden] {
    display: none !important;
}

.auth-body {
    display: grid;
    place-items: center;
    padding: 32px;
}

.auth-shell {
    width: min(960px, 100%);
}

.auth-panel {
    display: grid;
    gap: 24px;
    padding: 36px;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(183, 192, 181, 0.55);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.auth-copy h1 {
    margin: 0 0 12px;
    font-size: clamp(2rem, 4vw, 3.2rem);
    line-height: 1.05;
}

.auth-copy p:last-child {
    margin: 0;
    color: var(--text-soft);
    max-width: 48rem;
}

.auth-form {
    max-width: 420px;
}

.auth-note {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 14px 16px;
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    color: var(--text-soft);
    border: 1px solid var(--border);
}

.app-body {
    padding: 18px;
}

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

.sidebar,
.section-card,
.hero-strip {
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(183, 192, 181, 0.6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 22px;
    gap: 28px;
}

.brand-mark {
    display: flex;
    gap: 12px;
    align-items: center;
    font-weight: 700;
}

.brand-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent), #76b89e);
    box-shadow: 0 0 0 6px rgba(29, 123, 97, 0.12);
}

.brand-title {
    font-size: 1.1rem;
}

.brand-subtitle,
.table-note,
.section-text,
.page-header p,
.user-chip span,
.stat-card small {
    color: var(--text-soft);
}

.nav-links {
    display: grid;
    gap: 8px;
    margin-top: 28px;
}

.nav-links a {
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--text-soft);
    transition: 0.2s ease;
}

.nav-links a:hover,
.nav-links a.is-active {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

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

.user-chip {
    padding: 14px;
    border-radius: var(--radius-md);
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.user-chip strong,
.user-chip span {
    display: block;
}

.ghost-link {
    color: var(--accent-strong);
    font-weight: 600;
}

.main-content {
    display: grid;
    gap: 18px;
    align-content: start;
    min-width: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 16px;
    padding: 8px 4px;
}

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

.page-header h1,
.section-head h3,
.hero-strip h2 {
    margin: 0;
}

.page-header p {
    margin: 8px 0 0;
    max-width: 60rem;
}

.page-header-meta {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    color: var(--text-soft);
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent-strong);
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
}

.hero-strip {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    align-items: center;
    padding: 26px 28px;
}

.hero-strip p:last-child {
    margin: 10px 0 0;
    color: var(--text-soft);
    max-width: 44rem;
}

.hero-actions,
.toolbar,
.row-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    min-width: 0;
}

.row-actions form {
    margin: 0;
}

.choice-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.btn,
.link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-weight: 700;
    background: transparent;
}

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

.btn-primary:hover {
    background: var(--accent-strong);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
}

.btn-secondary:hover {
    background: var(--surface-muted);
}

.btn-block {
    width: 100%;
}

.link-button {
    min-height: auto;
    padding: 0;
    color: var(--accent-strong);
}

.link-button.danger {
    color: var(--danger);
}

.action-item-list,
.option-groups,
.checkbox-grid {
    display: grid;
    gap: 14px;
}

.stat-grid,
.content-grid,
.filter-grid,
.form-grid {
    display: grid;
    gap: 18px;
    align-items: start;
}

.stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
    padding: 22px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(183, 192, 181, 0.55);
    box-shadow: var(--shadow);
}

.stat-card span {
    display: block;
    color: var(--text-soft);
    margin-bottom: 8px;
}

.stat-card strong {
    display: block;
    font-size: clamp(1.8rem, 3vw, 2.4rem);
    line-height: 1;
    margin-bottom: 8px;
}

.content-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
}

.content-grid > *,
.filter-grid > *,
.form-grid > * {
    min-width: 0;
}

.agent-form-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
}

.section-card {
    padding: 24px;
    display: grid;
    gap: 18px;
    align-content: start;
    min-width: 0;
}

.action-builder-item,
.action-item-card,
.option-group {
    padding: 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-muted);
    min-width: 0;
}

.section-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
    flex-wrap: wrap;
}

.section-head.slim {
    align-items: center;
    margin-top: 12px;
}

.quick-links {
    display: grid;
    gap: 12px;
}

.quick-links a {
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface-muted);
}

.quick-links strong,
.checklist strong {
    display: inline-block;
    margin-right: 6px;
}

.quick-links span {
    display: block;
    color: var(--text-soft);
    margin-top: 4px;
}

.stack-form {
    display: grid;
    gap: 16px;
    min-width: 0;
}

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

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

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

.uniform-choice {
    display: grid;
    gap: 10px;
}

.field span {
    font-weight: 700;
    font-size: 0.95rem;
}

.checkbox-grid .checkbox {
    margin: 0;
}

.field small {
    color: var(--text-soft);
}

input,
select,
textarea {
    width: 100%;
    max-width: 100%;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid var(--border-strong);
    background: #fff;
    color: var(--text);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(29, 123, 97, 0.12);
}

.date-picker-panel {
    position: absolute;
    z-index: 50;
    padding: 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.date-picker-head,
.date-picker-weekdays,
.date-picker-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.date-picker-head {
    grid-template-columns: 34px 1fr 34px;
    align-items: center;
    margin-bottom: 10px;
}

.date-picker-head strong {
    text-align: center;
    text-transform: capitalize;
}

.date-picker-head button,
.date-picker-grid button {
    min-height: 34px;
    padding: 0;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    color: var(--text);
}

.date-picker-weekdays {
    margin-bottom: 6px;
    color: var(--text-soft);
    font-size: 0.8rem;
    font-weight: 700;
    text-align: center;
}

.date-picker-grid button.is-muted {
    color: var(--text-soft);
    opacity: 0.55;
}

.date-picker-grid button.is-selected {
    background: var(--accent);
    border-color: var(--accent-strong);
    color: #fff;
}

.checkbox {
    display: flex;
    gap: 10px;
    align-items: center;
}

.checkbox input {
    width: auto;
    margin: 0;
}

.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
}

.table-scroll-top {
    position: sticky;
    top: 0;
    z-index: 6;
    width: 100%;
    max-width: 100%;
    height: 18px;
    margin-bottom: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-muted);
}

.table-scroll-top [data-scroll-proxy-inner] {
    height: 1px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 720px;
}

.table.guide-actions-table {
    min-width: 1080px;
}

.table th,
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    text-align: left;
}

.table thead th {
    background: var(--surface-muted);
    color: var(--text-soft);
    font-size: 0.88rem;
}

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

.compact-table {
    min-width: 560px;
}

.calendar-table {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.calendar-table th,
.calendar-table td {
    vertical-align: top;
    min-width: 150px;
}

.calendar-table td {
    height: 132px;
    padding: 12px 0;
}

.calendar-table td.is-muted {
    background: rgba(242, 241, 239, 0.55);
}

.calendar-day-number {
    font-weight: 800;
    margin-bottom: 8px;
    padding: 0 12px;
}

.calendar-event-list {
    display: grid;
    gap: 7px;
    grid-auto-rows: minmax(42px, auto);
}

.calendar-event {
    display: grid;
    gap: 6px;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #fff;
    grid-row: var(--calendar-lane, auto);
    min-width: 0;
}

.calendar-event.is-single-day {
    margin: 0 8px;
}

.calendar-event.is-multi-day {
    margin: 0 -1px;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    background: linear-gradient(90deg, rgba(47, 111, 86, 0.12), rgba(47, 111, 86, 0.18));
}

.calendar-event.is-multi-day.starts-segment {
    margin-left: 8px;
    border-left: 1px solid var(--border);
    border-radius: 12px 0 0 12px;
}

.calendar-event.is-multi-day.ends-segment {
    margin-right: 8px;
    border-right: 1px solid var(--border);
    border-radius: 0 12px 12px 0;
}

.calendar-event.is-multi-day.starts-segment.ends-segment {
    border-radius: 12px;
}

.calendar-event.continues-label {
    min-height: 42px;
}

.calendar-event .link-button {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: left;
}

.calendar-event.has-warning {
    border-color: #d3a8e4;
    background: linear-gradient(90deg, rgba(211, 168, 228, 0.18), rgba(211, 168, 228, 0.26));
}

.calendar-event span {
    color: var(--text-soft);
    font-size: 12px;
}

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

.calendar-detail-close {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 999px;
}

.warehouse-kit-summary {
    display: grid;
    gap: 18px;
}

.warehouse-kit-card {
    gap: 16px;
}

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

.warehouse-kit-metric {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #fff;
}

.warehouse-kit-metric span {
    display: block;
    color: var(--text-soft);
    font-weight: 700;
    margin-bottom: 8px;
}

.warehouse-kit-metric strong {
    display: block;
    font-size: clamp(1.35rem, 2vw, 2rem);
    line-height: 1.1;
}

.warehouse-kit-details {
    display: grid;
    gap: 18px;
    margin-top: 4px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.warehouse-detail-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.warehouse-detail-head h4,
.warehouse-actions-included h4 {
    margin: 0;
}

.explorer-kit-summary {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.explorer-kit-line,
.explorer-kit-details {
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

.explorer-kit-line,
.explorer-kit-details summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
}

.explorer-kit-details summary {
    cursor: pointer;
}

.explorer-kit-details summary em {
    color: var(--text-soft);
    font-style: normal;
    font-weight: 700;
}

.explorer-kit-details .item-list {
    padding: 0 12px 12px;
}

.badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
}

.badge {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.status-badge.is-on {
    background: var(--accent-soft);
    color: var(--accent-strong);
}

.status-badge.is-off {
    background: #f2f1ef;
    color: #7a6e65;
}

.status-badge.is-mov {
    background: #efe6f7;
    color: #7a3f95;
}

.section-mov {
    border-color: rgba(122, 63, 149, 0.18);
    background: linear-gradient(180deg, rgba(239, 230, 247, 0.78) 0%, #ffffff 24%);
}

.section-mov .badge {
    background: #efe6f7;
    color: #7a3f95;
}

.filter-bar {
    align-items: stretch;
}

.filter-bar input {
    min-width: min(240px, 100%);
}

.filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: end;
}

.empty-state {
    margin: 0;
    padding: 18px;
    border-radius: 16px;
    background: var(--surface-muted);
    border: 1px dashed var(--border-strong);
    color: var(--text-soft);
}

.empty-state.compact {
    padding: 12px 14px;
}

.availability-panel {
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
    min-width: 0;
}

.agent-form-side-panel {
    position: sticky;
    top: 18px;
}

.availability-panel strong {
    display: block;
    margin-bottom: 6px;
}

.availability-panel p {
    margin: 0;
    color: var(--text-soft);
}

.availability-panel.is-ok {
    background: var(--accent-soft);
    border-color: rgba(29, 123, 97, 0.18);
}

.availability-panel.is-ok strong {
    color: var(--accent-strong);
}

.availability-panel.is-warning {
    background: #efe6f7;
    border-color: rgba(122, 63, 149, 0.18);
}

.availability-panel.is-warning strong {
    color: #7a3f95;
}

.material-stack,
.checklist {
    display: grid;
    gap: 12px;
}

.material-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: 18px;
    background: var(--surface-muted);
    border: 1px solid var(--border);
}

.inline-delete-form {
    margin-top: -4px;
    margin-bottom: 12px;
}

.table-input {
    min-width: 120px;
    padding: 10px 12px;
}

.table-highlight {
    background: rgba(29, 123, 97, 0.08);
}

.table tbody tr.record-pending td {
    background: rgba(201, 79, 79, 0.09);
}

.table tbody tr.record-pending td:first-child {
    box-shadow: inset 4px 0 0 #c94f4f;
}

.table tbody tr.record-prepared td {
    background: rgba(29, 123, 97, 0.08);
}

.table tbody tr.record-prepared td:first-child {
    box-shadow: inset 4px 0 0 #1d7b61;
}

.table tbody tr.record-mov td {
    background: rgba(239, 230, 247, 0.92);
}

.table tbody tr.record-mov td:first-child {
    box-shadow: inset 4px 0 0 #7a3f95;
}

.table tbody tr.record-mov + tr .detail-cell,
.detail-cell.is-mov {
    background: rgba(239, 230, 247, 0.72);
}

.detail-cell {
    background: var(--surface-muted);
}

.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(22, 31, 38, 0.45);
}

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

.confirm-modal {
    width: min(460px, 100%);
    padding: 22px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.confirm-modal p {
    color: var(--text-soft);
}

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

.detail-grid h4 {
    margin: 0 0 12px;
}

.item-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 10px;
}

.item-list li {
    padding: 12px 14px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border);
}

.item-list span,
.item-list em {
    display: block;
    color: var(--text-soft);
}

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.flash-success {
    background: var(--accent-soft);
    color: var(--accent-strong);
    border-color: rgba(29, 123, 97, 0.22);
}

.flash-error {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: rgba(168, 60, 60, 0.2);
}

.flash.is-hiding {
    opacity: 0;
    transform: translateY(-4px);
    transition: 0.25s ease;
}

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

    .content-grid,
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .agent-form-side-panel {
        position: static;
    }
}

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

    .sidebar {
        gap: 18px;
    }

    .nav-links {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 12px;
    }

    .page-header,
    .hero-strip {
        flex-direction: column;
        align-items: start;
    }
}

@media (max-width: 720px) {
    .auth-body,
    .app-body {
        padding: 12px;
    }

    .auth-panel,
    .sidebar,
    .section-card,
    .hero-strip {
        padding: 18px;
        border-radius: 20px;
    }

    .form-grid,
    .stat-grid,
    .nav-links,
    .detail-grid,
    .warehouse-kit-metrics {
        grid-template-columns: 1fr;
    }

.table {
        min-width: 640px;
    }
}

.bot-field {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}
