:root {
    --primary: #eb1414;
    --primary-dark: #c2410c;
    --ink: #14213d;
    --muted: #667085;
    --line: #f6e3d3;
    --soft: #fff7ed;
    --success: #12a36d;
    --warning: #f59e0b;
    --danger: #e5484d;
    --info: #2f80ed;
    --white: #fff;
    --shadow: 0 15px 45px rgba(249, 115, 22, .08)
}

* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    background: #f7f9fd;
    color: var(--ink);
    font-family: Inter, Arial, sans-serif;
    font-size: 14px
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 76px;
    display: flex;
    align-items: center;
    padding: 0 clamp(18px, 5vw, 72px);
    gap: 28px;
    background: rgba(255, 255, 255, .96);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px)
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 19px;
    text-decoration: none;
    white-space: nowrap
}

.brand strong {
    color: var(--primary)
}

.brand-mark {
    width: 39px;
    height: 39px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), #fb923c);
    color: #fff;
    border-radius: 12px;
    font-size: 19px
}

.brand-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto
}

.nav-link {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 11px 14px;
    border-radius: 10px;
    color: #556070;
    text-decoration: none;
    font-weight: 500
}

.nav-link:hover,
.nav-link.active {
    background: #fff3e0;
    color: var(--primary)
}

.profile-wrap {
    position: relative
}

.profile-button {
    display: flex;
    align-items: center;
    gap: 10px;
    border: 0;
    background: transparent;
    color: var(--ink);
    cursor: pointer;
    text-align: left
}

.avatar {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #fff3e0;
    color: var(--primary);
    font-weight: 700
}

.profile-copy {
    display: flex;
    flex-direction: column
}

.profile-copy small {
    color: var(--muted);
    margin-top: 2px
}

.profile-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    width: 190px;
    padding: 8px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow)
}

.profile-menu.open {
    display: block
}

.profile-menu a {
    display: flex;
    gap: 9px;
    padding: 10px;
    border-radius: 8px;
    color: var(--ink);
    text-decoration: none
}

.profile-menu a:hover {
    background: var(--soft)
}

.menu-toggle {
    display: none;
    margin-left: auto;
    border: 0;
    background: transparent;
    font-size: 26px;
    color: var(--ink)
}

main {
    min-height: calc(100vh - 140px)
}

.page {
    display: none;
    width: min(1420px, calc(100% - 36px));
    margin: 0 auto;
    padding: 34px 0 56px
}

.page.active {
    display: block
}

.hero {
    position: relative;
    overflow: hidden;
    min-height: 260px;
    padding: 46px 52px;
    display: flex;
    align-items: center;
    background: linear-gradient(120deg, #b91c1c 0%, #dc2626 52%, #f97316 100%);
    border-radius: 25px;
    color: #fff;
    box-shadow: 0 25px 50px rgba(185, 28, 28, .18)
}

.hero:after {
    content: "";
    position: absolute;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    right: -90px;
    top: -150px;
    border: 60px solid rgba(255, 255, 255, .08)
}

.hero>div:first-child {
    position: relative;
    z-index: 2;
    max-width: 720px
}

.eyebrow {
    display: inline-block;
    margin-bottom: 12px;
    font-size: 11px;
    letter-spacing: .14em;
    font-weight: 700
}

.hero h1,
.page-title h1 {
    font-size: clamp(27px, 3vw, 39px);
    line-height: 1.2;
    margin: 0 0 12px
}

.hero p {
    font-size: 16px;
    margin: 0 0 25px;
    color: rgba(255, 255, 255, .84)
}

.hero-visual {
    margin-left: auto;
    position: relative;
    width: 240px;
    height: 150px;
    z-index: 2
}

.hero-box,
.hero-truck {
    position: absolute;
    display: grid;
    place-items: center;
    border-radius: 25px;
    color: #fff
}

.hero-box {
    right: 80px;
    top: 2px;
    width: 105px;
    height: 105px;
    background: rgba(255, 255, 255, .15);
    font-size: 52px;
    transform: rotate(-8deg)
}

.hero-truck {
    right: 10px;
    bottom: 0;
    width: 105px;
    height: 74px;
    background: #fff;
    color: var(--primary);
    font-size: 43px;
    box-shadow: 0 18px 30px rgba(127, 29, 29, .2)
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 17px;
    border: 0;
    border-radius: 10px;
    font: 600 13px Inter;
    cursor: pointer;
    transition: .2s
}

.button:hover {
    transform: translateY(-1px)
}

.button-white {
    background: #fff;
    color: var(--primary)
}

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

.button-primary:hover {
    background: var(--primary-dark)
}

.button-light {
    background: #eef2f8;
    color: var(--ink)
}

.stat-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px
}

.stat-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
    min-height: 106px;
    overflow: hidden;
    padding: 17px 18px;
    color: #fff;
    border: 0;
    border-radius: 7px;
    box-shadow: 0 8px 14px rgba(26, 35, 50, .22)
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -31px;
    bottom: -44px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .1)
}

.stat-card:nth-child(1) { background: #cf5a2d }
.stat-card:nth-child(2) { background: #915aaa }
.stat-card:nth-child(3) { background: #176ab2 }
.stat-card:nth-child(4) { background: #25864e }

.stat-icon {
    position: relative;
    z-index: 1;
    flex: 0 0 54px;
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 25px
}

.stat-icon.blue,
.stat-icon.amber,
.stat-icon.green,
.stat-icon.red {
    color: #fff;
    background: rgba(255, 255, 255, .18)
}

.stat-card div {
    position: relative;
    z-index: 1;
    display: flex;
    min-width: 0;
    flex-direction: column
}

.stat-card small {
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase
}

.stat-card strong {
    margin: 3px 0;
    color: #fff;
    font-size: 30px;
    line-height: 1
}

.stat-card div > span {
    overflow: hidden;
    color: rgba(255, 255, 255, .92);
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr);
    gap: 18px;
    margin-top: 18px
}

.content-grid>* {
    min-width: 0
}

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 8px 25px rgba(120, 53, 15, .045)
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line)
}

.panel h2 {
    font-size: 16px;
    margin: 0 0 5px
}

.panel p {
    margin: 0;
    color: var(--muted);
    font-size: 12px
}

.text-button,
.back-button {
    border: 0;
    background: transparent;
    color: var(--primary);
    font-weight: 600;
    cursor: pointer
}

.table-wrap {
    overflow-x: auto
}

.dashboard-table-scroll {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch
}

.dashboard-table-scroll table {
    width: 100% !important;
    min-width: 720px
}

.dashboard-table-scroll th,
.dashboard-table-scroll td {
    white-space: nowrap
}

.dt-container {
    width: 100%;
    max-width: 100%;
    padding: 16px 18px 20px
}

.dashboard-table-scroll .dt-container {
    min-width: 720px
}

.dt-container .dt-layout-row:first-child {
    margin-top: 0
}

.dt-container .dt-search input,
.dt-container .dt-length select {
    min-height: 38px;
    border: 1px solid #dce3ef !important;
    border-radius: 9px !important;
    background: #fff !important;
    color: var(--ink)
}

.dt-container .dt-search input {
    margin-left: 8px;
    padding: 0 11px
}

.dt-container .dt-paging .dt-paging-button {
    border-radius: 8px !important
}

.dt-container .dt-paging .dt-paging-button.current {
    border-color: var(--primary) !important;
    background: var(--primary) !important;
    color: #fff !important
}

.dt-container table.dataTable {
    width: 100% !important;
    table-layout: fixed;
    margin: 14px 0 !important
}

#dashboard-po-table th:nth-child(1),#dashboard-po-table td:nth-child(1){width:25% !important}
#dashboard-po-table th:nth-child(2),#dashboard-po-table td:nth-child(2){width:25% !important}
#dashboard-po-table th:nth-child(3),#dashboard-po-table td:nth-child(3){width:25% !important}
#dashboard-po-table th:nth-child(4),#dashboard-po-table td:nth-child(4){width:25% !important}

#po-table th:nth-child(1),#po-table td:nth-child(1){width:18% !important}
#po-table th:nth-child(2),#po-table td:nth-child(2){width:14% !important}
#po-table th:nth-child(3),#po-table td:nth-child(3){width:16% !important}
#po-table th:nth-child(4),#po-table td:nth-child(4){width:12% !important}
#po-table th:nth-child(5),#po-table td:nth-child(5){width:14% !important}
#po-table th:nth-child(6),#po-table td:nth-child(6){width:26% !important}

#do-table th:nth-child(1),#do-table td:nth-child(1){width:20% !important}
#do-table th:nth-child(2),#do-table td:nth-child(2){width:15% !important}
#do-table th:nth-child(3),#do-table td:nth-child(3){width:13% !important}
#do-table th:nth-child(4),#do-table td:nth-child(4){width:13% !important}
#do-table th:nth-child(5),#do-table td:nth-child(5){width:9% !important}
#do-table th:nth-child(6),#do-table td:nth-child(6){width:30% !important}

#po-table td,#do-table td,#dashboard-po-table td {
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle
}

#dashboard-po-table th:first-child,
#dashboard-po-table td:first-child,
#po-table th:first-child,
#po-table td:first-child,
#do-table th:nth-child(2),
#do-table td:nth-child(2) {
    text-align: left !important
}

.dt-container table.dataTable thead th {
    position: relative;
    padding-right: 34px !important;
    text-align: left !important
}

.dt-container table.dataTable thead th .dt-column-header {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    text-align: left
}

.dt-container table.dataTable thead th .dt-column-title {
    flex: 1 1 auto;
    text-align: left
}

.dt-container table.dataTable thead th .dt-column-order {
    position: absolute !important;
    right: -22px !important;
    left: auto !important;
    flex: 0 0 12px
}

.dt-container table.dataTable thead th:last-child:not(.dt-orderable-asc):not(.dt-orderable-desc) {
    padding-right: 18px !important
}

.filter-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid #dce3ef;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: 600 12px Inter;
    cursor: pointer
}

.page-title-actions {
    display: flex;
    align-items: center;
    gap: 9px
}

.filter-page-button {
    border: 1px solid #f3c5bd;
    background: #fff;
    color: var(--primary)
}

.filter-page-button.active {
    border-color: var(--primary);
    background: #fff0ed
}

.filter-reset {
    margin-bottom: 1px;
    color: var(--muted)
}

body.modal-open {
    overflow: hidden
}

.filter-modal[hidden] {
    display: none
}

.filter-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 20px
}

.filter-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 33, 61, .55);
    backdrop-filter: blur(4px)
}

.filter-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 540px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 30px 80px rgba(20, 33, 61, .22)
}

.filter-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line)
}

.filter-modal-head h2 {
    margin: 5px 0 0;
    font-size: 20px
}

.modal-eyebrow {
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .13em
}

.modal-close {
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 9px;
    background: #f4f6fa;
    color: var(--muted);
    cursor: pointer
}

.filter-modal-body {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 24px
}

.filter-date-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px
}

.filter-modal-body label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 600
}

.filter-modal-body label small {
    color: var(--muted);
    font-weight: 400
}

.filter-modal-body input,
.filter-modal-body select {
    width: 100%;
    min-height: 43px;
    padding: 9px 11px;
    border: 1px solid #dce3ef;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: 400 12px Inter;
    outline: none
}

.filter-modal-body input:focus,
.filter-modal-body select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(235, 20, 20, .08)
}

.multi-select {
    position: relative
}

.multi-select-toggle {
    width: 100%;
    min-height: 43px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border: 1px solid #dce3ef;
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    font: 400 12px Inter;
    cursor: pointer
}

.multi-select-toggle.open {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(235, 20, 20, .08)
}

.multi-select-toggle i {
    color: var(--muted);
    transition: transform .2s
}

.multi-select-toggle.open i {
    transform: rotate(180deg)
}

.multi-select-menu {
    position: absolute;
    z-index: 5;
    left: 0;
    right: 0;
    top: calc(100% + 6px);
    padding: 7px;
    border: 1px solid #dce3ef;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 14px 35px rgba(20, 33, 61, .14)
}

.multi-select-menu[hidden] {
    display: none
}

.multi-select-menu label {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 9px;
    min-height: 36px;
    padding: 7px 9px;
    border-radius: 7px;
    font-weight: 500;
    cursor: pointer
}

.multi-select-menu label:hover {
    background: #fff3f0
}

.multi-select-menu input {
    width: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    accent-color: var(--primary)
}

.filter-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    padding: 16px 24px 22px;
    border-top: 1px solid var(--line)
}

.profile-form-panel {
    width: 100%;
    max-width: none;
    min-height: 318px;
    display: flex;
    flex-direction: column;
    margin-left: auto;
    margin-right: auto
}

.profile-form-panel .form-grid {
    flex: 1
}

.profile-form-panel input:disabled,
.profile-form-panel textarea:disabled {
    background: #f3f6fa;
    color: #697586;
    cursor: not-allowed;
    opacity: 1
}

.profile-form-actions {
    width: 100%;
    max-width: none;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin: 0 auto;
    padding: 4px 0 20px
}

.field-error {
    color: var(--danger);
    font-size: 11px
}

.delivery-booking {
    padding: 18px;
    border: 1px solid #eadfd9;
    border-radius: 15px;
    background: #fffaf7
}

.booking-date-field {
    width: 320px;
    flex: 0 0 320px
}

.booking-schedule-head {
    display: flex;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 16px
}

.booking-head {
    display: flex;
    flex: 1;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    min-width: 0
}

.booking-head>div:first-child {
    display: flex;
    flex-direction: column;
    gap: 5px
}

.booking-label {
    font-size: 13px;
    font-weight: 700
}

.booking-head small {
    color: var(--muted);
    font-size: 11px
}

.booking-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    color: var(--muted);
    font-size: 10px
}

.booking-legend span {
    display: flex;
    align-items: center;
    gap: 5px
}

.booking-legend i {
    width: 9px;
    height: 9px;
    border-radius: 50%
}

.booking-legend .available {background:#e6f8f1;border:1px solid var(--success)}
.booking-legend .booked {background:#edf0f4;border:1px solid #98a2b3}
.booking-legend .selected {background:var(--primary);border:1px solid var(--primary)}

.booking-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 16px
}

.time-slot-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(130px, 1fr));
    gap: 10px
}

.time-slot {
    min-height: 66px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #cfe8dc;
    border-radius: 11px;
    background: #f5fcf8;
    color: var(--success);
    text-align: left;
    cursor: pointer;
    transition: .18s
}

.time-slot:hover:not(:disabled) {
    border-color: var(--success);
    transform: translateY(-1px)
}

.time-slot>i {font-size:16px}
.time-slot>span {display:flex;flex-direction:column;gap:4px}
.time-slot strong {color:var(--ink);font-size:11px;white-space:nowrap}
.time-slot small {font-size:9px}
.time-slot.booked {border-color:#e1e5eb;background:#f3f5f7;color:#98a2b3;cursor:not-allowed}
.time-slot.booked strong {color:#8a94a4}
.time-slot.selected {border-color:var(--primary);background:#fff0ed;color:var(--primary);box-shadow:0 0 0 2px rgba(235,20,20,.08)}

.booking-summary {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    min-height: 142px;
    padding: 18px;
    border-radius: 12px;
    background: linear-gradient(135deg,#b91c1c,#ef4444 58%,#f97316);
    color: #fff
}

.booking-summary span {font-size:9px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;opacity:.75}
.booking-summary strong {font-size:14px;line-height:1.45}
.booking-summary small {font-size:12px;color:rgba(255,255,255,.78)}
.booking-error {display:flex;align-items:center;gap:7px;margin:12px 0 0;color:var(--danger);font-size:11px}
.booking-error[hidden] {display:none}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left
}

th {
    padding: 13px 18px;
    background: #fafbfe;
    color: #667085;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .035em;
    white-space: nowrap
}

td {
    padding: 15px 18px;
    border-top: 1px solid var(--line);
    color: #495468;
    white-space: nowrap
}

tbody tr:hover {
    background: #fbfcff
}

.link-text,
.success-text {
    color: var(--primary)
}

.success-text {
    color: var(--success)
}

.block {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-weight: 400
}

.activity-panel {
    padding-bottom: 8px;
    min-height: 0
}

.activity-panel .timeline {
    max-height: 270px;
    overflow-y: auto;
    overscroll-behavior: contain
}

.status-history-panel {
    min-height: 0
}

.status-history-panel .timeline {
    max-height: 230px;
    overflow-y: auto;
    overscroll-behavior: contain
}

.activity-panel .timeline,
.status-history-panel .timeline {
    scrollbar-width: thin;
    scrollbar-color: #c9d5e3 transparent
}

.activity-panel .timeline::-webkit-scrollbar,
.status-history-panel .timeline::-webkit-scrollbar {
    width: 6px
}

.activity-panel .timeline::-webkit-scrollbar-thumb,
.status-history-panel .timeline::-webkit-scrollbar-thumb {
    background: #c9d5e3;
    border-radius: 999px
}

.timeline {
    padding: 12px 20px
}

.timeline-item {
    position: relative;
    display: flex;
    gap: 12px;
    padding: 10px 0
}

.timeline-item:not(:last-child):before {
    content: "";
    position: absolute;
    left: 14px;
    top: 38px;
    bottom: -7px;
    width: 1px;
    background: var(--line)
}

.dot {
    flex: 0 0 29px;
    width: 29px;
    height: 29px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #edf1f7;
    color: #8792a3;
    font-size: 12px
}

.dot.success {
    background: #e4f7ef;
    color: var(--success)
}

.dot.process {
    background: #e7f0ff;
    color: var(--primary)
}

.dot.warning {
    background: #fff1df;
    color: var(--warning)
}

.timeline-item strong {
    font-size: 12px
}

.timeline-item p {
    margin-top: 5px
}

.page-title {
    padding: 8px 2px 23px
}

.page-title p {
    color: var(--muted);
    margin: 0
}

.primary-text {
    color: var(--primary)
}

.row-title {
    display: flex;
    align-items: center;
    justify-content: space-between
}

.badge {
    display: inline-flex;
    padding: 6px 9px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600
}

.badge.large {
    padding: 9px 14px
}

.badge-success {
    background: #e6f8f1;
    color: #078454
}

.badge-warning {
    background: #fff4df;
    color: #b87500
}

.badge-danger {
    background: #ffebec;
    color: #c8343a
}

.badge-info {
    background: #eaf1ff;
    color: #155eef
}

.badge-draft {
    background: #eef1f6;
    color: #596579
}

.back-button {
    margin: 3px 0 20px;
    padding: 0
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin-bottom: 18px
}

.info-grid>div {
    display: flex;
    flex-direction: column;
    padding: 18px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px
}

.info-grid small,
.detail-list span {
    color: var(--muted);
    font-size: 11px
}

.info-grid strong {
    margin: 7px 0;
    font-size: 15px
}

.info-grid span {
    color: var(--muted);
    font-size: 11px
}

.panel-footer {
    display: flex;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid var(--line)
}

.form-panel {
    margin-bottom: 16px
}

.section-title {
    display: flex;
    gap: 13px;
    align-items: center;
    padding: 20px 22px;
    border-bottom: 1px solid var(--line)
}

.section-title>span {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    background: #eaf1ff;
    color: var(--primary);
    font-weight: 700
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 17px;
    padding: 22px
}

.form-grid label {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.form-grid label>span {
    font-weight: 600;
    font-size: 12px
}

.form-grid b {
    color: var(--danger)
}

.form-grid input,
.form-grid select,
.form-grid textarea {
    width: 100%;
    border: 1px solid #dce3ef;
    border-radius: 10px;
    padding: 11px 13px;
    font: 400 13px Inter;
    color: var(--ink);
    background: #fff;
    outline: none
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px #e7efff
}

.form-grid input[readonly] {
    background: #f4f6fa;
    color: #677386
}

.wide {
    grid-column: 1/-1
}

.qty-input,
.table-input {
    height: 36px;
    border: 1px solid #dce3ef;
    border-radius: 8px;
    padding: 0 9px
}

.qty-input {
    width: 90px
}

.table-input {
    width: 130px
}

.form-table input[type=checkbox],
.po-select-table input[type=checkbox],
.group-select-all input[type=checkbox] {
    accent-color: var(--primary);
    width: 16px;
    height: 16px
}

.po-select-table td {
    vertical-align: middle
}

.po-item-group {
    border-bottom: 1px solid var(--line);
    padding: 16px 0 4px
}

.po-item-group:last-child {
    border-bottom: 0
}

.po-item-group-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 0 22px 14px
}

.po-item-group-head strong {
    font-size: 13px
}

.po-group-avail {
    color: var(--muted);
    font-size: 11px
}

.group-select-all {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-left: auto;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer
}

.item-unavailable td {
    opacity: .55
}

.item-unavailable input[type=checkbox],
.item-unavailable .qty-input,
.item-unavailable .table-input {
    cursor: not-allowed
}

.empty-items {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 42px 20px;
    color: var(--muted);
    text-align: center
}

.empty-items i {
    font-size: 34px;
    color: #cdd6e6
}

.empty-items p {
    margin: 0;
    font-size: 12px
}

.empty-items.compact {padding:32px 20px}
.empty-items.compact .button {margin-top:6px}
.selection-title {align-items:center}
.selection-title .select-items-button {margin-left:auto;flex:none}
.selected-items-summary {display:flex;align-items:center;gap:8px;padding:14px 22px;background:#f8faff;border-top:1px solid var(--line);font-size:12px}
.selected-items-summary span {color:var(--muted)}
.po-chip {display:inline-flex;padding:5px 8px;border-radius:7px;background:#eef3ff;color:var(--primary);font-size:11px;font-weight:700}
.remove-selected-item {width:32px;height:32px;border:0;border-radius:8px;background:#fff0f0;color:var(--danger);cursor:pointer}
.remove-selected-item:hover {background:#ffe1e1}

.item-picker-modal[hidden] {display:none}
.item-picker-modal {position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:24px}
.item-picker-backdrop {position:absolute;inset:0;border:0;background:rgba(15,27,50,.55);cursor:default}
.item-picker-dialog {position:relative;width:min(1040px,96vw);height:min(720px,90vh);display:flex;flex-direction:column;overflow:hidden;background:#fff;border-radius:18px;box-shadow:0 24px 70px rgba(8,24,53,.28)}
.item-picker-head {display:flex;justify-content:space-between;gap:20px;padding:22px 24px;border-bottom:1px solid var(--line)}
.item-picker-head h2 {margin:3px 0 5px;font-size:20px}
.item-picker-head p {margin:0;color:var(--muted);font-size:12px}
.item-picker-body {display:grid;grid-template-columns:300px 1fr;min-height:0;flex:1}
.picker-po-list {padding:18px;border-right:1px solid var(--line);overflow:auto;background:#f8faff}
.picker-search {height:40px;display:flex;align-items:center;gap:8px;padding:0 11px;margin-bottom:12px;border:1px solid #dce3ef;border-radius:10px;background:#fff;color:var(--muted)}
.picker-search input {width:100%;border:0;outline:0;font:400 12px Inter;color:var(--ink)}
.picker-po-option {display:flex;align-items:center;gap:10px;padding:13px 10px;margin-bottom:7px;border:1px solid transparent;border-radius:10px;background:#fff;cursor:pointer}
.picker-po-option:has(input:checked) {border-color:#a9c2f5;background:#edf3ff}
.picker-po-option input,.picker-item-row>input[type=checkbox] {width:16px;height:16px;accent-color:var(--primary)}
.picker-po-option span {display:flex;flex:1;flex-direction:column;gap:4px}
.picker-po-option small,.picker-item-name small {color:var(--muted);font-size:10px}
.picker-po-option>i {color:#9aa8bc}
.picker-items-area {padding:18px 20px;overflow:auto}
.picker-empty {height:100%;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;color:var(--muted);text-align:center}
.picker-empty i {font-size:34px;color:#c5d2e6}
.picker-empty strong {color:var(--ink)}
.picker-empty span {font-size:11px}
.picker-item-group {margin-bottom:18px;border:1px solid var(--line);border-radius:12px;overflow:hidden}
.picker-item-head {display:flex;justify-content:space-between;align-items:center;padding:11px 14px;background:#f7f9fd}
.picker-item-head strong {font-size:12px}
.picker-item-head button {border:0;background:none;color:var(--primary);font:600 11px Inter;cursor:pointer}
.picker-item-row {display:grid;grid-template-columns:20px minmax(170px,1fr) 125px 90px;align-items:center;gap:10px;padding:12px 14px;border-top:1px solid var(--line);cursor:pointer}
.picker-item-row:has(.picker-item-check:checked) {background:#f6f9ff}
.picker-item-row.disabled {opacity:.45;cursor:not-allowed}
.picker-item-name {display:flex;flex-direction:column;gap:3px}
.picker-available {display:flex;flex-direction:column;color:var(--muted);font-size:9px}
.picker-available b {margin-top:2px;color:var(--ink);font-size:11px}
.picker-qty {width:82px;height:34px;padding:0 8px;border:1px solid #dce3ef;border-radius:8px}
.item-picker-actions {display:flex;align-items:center;gap:10px;padding:15px 22px;border-top:1px solid var(--line);background:#fff}
.item-picker-actions>span {margin-right:auto;color:var(--muted);font-size:11px}
.picker-no-result {padding:25px 8px;color:var(--muted);font-size:11px;text-align:center}

@media (max-width:700px) {
    .section-title.selection-title {
        display:grid;
        grid-template-columns:32px minmax(0,1fr);
        align-items:start
    }
    .selection-title>div {min-width:0}
    .selection-title>div h2 {white-space:normal}
    .selection-title>div p {max-width:none}
    .selection-title .select-items-button {
        grid-column:1/-1;
        width:100%;
        max-width:100%;
        margin:4px 0 0;
        box-sizing:border-box;
        justify-content:center
    }
    .item-picker-modal {padding:0}
    .item-picker-dialog {width:100%;height:100%;max-height:none;border-radius:0}
    .item-picker-body {
        grid-template-columns:1fr;
        grid-template-rows:minmax(0,1fr) minmax(0,1fr);
        overflow:hidden
    }
    .picker-po-list {
        min-height:0;
        max-height:none;
        overflow-y:auto;
        border-right:0;
        border-bottom:1px solid var(--line)
    }
    .picker-items-area {min-height:0;overflow-y:auto}
    .picker-item-row {grid-template-columns:20px 1fr 82px}
    .picker-available {display:none}
    .item-picker-actions>span {display:none}
}

.form-error {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 4px 60px 18px;
    color: var(--danger);
    font-size: 11px
}

#po-select-error {
    margin: 4px 0 0
}

.form-error[hidden] {
    display: none
}

.upload-box {
    margin: 22px;
    min-height: 145px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 2px dashed #cdd9ed;
    border-radius: 14px;
    background: #f9fbff;
    color: var(--muted);
    cursor: pointer
}

.upload-box.has-upload {
    padding: 18px
}

.upload-preview {
    width: min(100%, 360px);
    height: 180px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #f7f9fc
}

.attachment-error {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 0 0;
    padding: 10px 12px;
    border: 1px solid #fecaca;
    border-radius: 10px;
    background: #fef2f2;
    color: #dc2626;
    font-size: 13px;
    font-weight: 600
}

.attachment-error i {
    color: #dc2626;
    font-size: 16px
}

.upload-box i {
    font-size: 30px;
    color: var(--primary);
    margin-bottom: 7px
}

.upload-box strong {
    color: var(--ink)
}

.upload-box span {
    font-size: 11px;
    margin-top: 4px
}

.upload-box input {
    display: none
}

.upload-box.upload-error {
    border-color: var(--danger);
    background: #fff7f7
}

.upload-box.upload-error i,
.upload-box.upload-error strong {
    color: var(--danger)
}

.sticky-actions {
    position: sticky;
    bottom: 14px;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 17px;
    background: rgba(255, 255, 255, .96);
    border: 1px solid var(--line);
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(33, 48, 81, .12);
    backdrop-filter: blur(10px)
}

.sticky-actions>div {
    margin-right: auto;
    color: var(--muted);
    font-size: 12px
}

.detail-layout {
    display: grid;
    grid-template-columns: 1.15fr .85fr;
    gap: 18px;
    margin-bottom: 18px
}

.detail-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 8px 22px 20px
}

.detail-list div {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line)
}

.toast {
    position: fixed;
    z-index: 100;
    right: 24px;
    bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    padding: 16px 18px;
    background: #153e2f;
    color: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .2);
    transform: translateY(120px);
    opacity: 0;
    transition: .3s
}

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

.toast>i {
    font-size: 22px;
    color: #71e2b5
}

.toast div {
    display: flex;
    flex-direction: column
}

.toast span {
    font-size: 11px;
    margin-top: 3px;
    color: #cbeadd
}

.context-menu {
    position: fixed;
    z-index: 300;
    min-width: 200px;
    padding: 7px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 18px 45px rgba(20, 33, 61, .18)
}

.context-menu[hidden] {
    display: none
}

.context-menu button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink);
    font: 500 12px Inter;
    text-align: left;
    cursor: pointer
}

.context-menu button:hover {
    background: #fff3f0;
    color: var(--primary)
}

.context-menu button i {
    width: 16px;
    color: var(--primary);
    font-size: 13px
}

.actions {
    display: flex;
    align-items: center;
    gap: 7px;
    white-space: nowrap
}

.icon-button {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid #dbe5f5;
    border-radius: 9px;
    background: #f6f9ff;
    color: var(--primary);
    font-size: 14px;
    cursor: pointer
}

.icon-button:hover {
    border-color: #b9ccef;
    background: #eaf1ff
}

.mini-button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 11px;
    border: 0;
    border-radius: 9px;
    font: 600 11px Inter, sans-serif;
    cursor: pointer
}

.mini-button.primary {
    background: var(--primary);
    color: #fff
}

#po-table tbody tr,
#do-table tbody tr,
#dashboard-po-table tbody tr {
    cursor: context-menu;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none
}

#po-table tbody tr.context-row-active td,
#do-table tbody tr.context-row-active td,
#dashboard-po-table tbody tr.context-row-active td {
    background: #fff3f0 !important
}

footer {
    text-align: center;
    padding: 25px;
    color: #8a94a4;
    font-size: 11px
}

footer a {
    color: var(--primary);
    text-decoration: none
}

@media(max-width:1050px) {
    .profile-copy {
        display: none
    }

    .stat-grid {
        margin-top: 18px;
        grid-template-columns: repeat(2, 1fr)
    }

    .content-grid {
        grid-template-columns: 1fr
    }

    .hero-visual {
        display: none
    }
}

@media(max-width:780px) {
    .topbar {
        height: 66px;
        padding: 0 16px
    }

    .menu-toggle {
        display: block
    }

    .main-nav {
        display: none;
        position: absolute;
        left: 14px;
        right: 14px;
        top: 66px;
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
        background: #fff;
        border: 1px solid var(--line);
        border-radius: 13px;
        box-shadow: var(--shadow)
    }

    .main-nav.open {
        display: flex
    }

    .profile-wrap {
        margin-left: 0
    }

    .profile-button>i {
        display: none
    }

    .page {
        width: min(100% - 24px, 1420px);
        padding-top: 20px
    }

    .hero {
        padding: 30px 24px;
        min-height: 240px
    }

    .info-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .detail-layout {
        grid-template-columns: 1fr
    }

    .sticky-actions {
        flex-wrap: wrap
    }

    .sticky-actions>div {
        width: 100%;
        margin: 0 0 4px
    }

    .form-grid {
        grid-template-columns: 1fr
    }

    .wide {
        grid-column: auto
    }
}

@media(max-width:520px) {
    .brand span:last-child {
        display: none
    }

    .stat-grid {
        margin-top: 18px;
        grid-template-columns: 1fr
    }

    .row-title {
        align-items: flex-start;
        gap: 12px;
        flex-direction: column
    }

    .info-grid {
        grid-template-columns: 1fr
    }

    .form-grid {
        padding: 17px
    }

    .section-title {
        padding: 17px
    }

    .sticky-actions .button {
        flex: 1
    }

    .profile-button {
        padding: 0
    }

    .toast {
        left: 14px;
        right: 14px;
        bottom: 14px;
        min-width: 0
    }
}

/* Navbar logo uses its original transparent background. */
.brand-mark {
    background: transparent;
    border-radius: 0;
    color: inherit
}

@media(max-width:780px) {
    #po-table_wrapper,
    #do-table_wrapper {
        min-width: 900px
    }
}

@media(max-width:1050px) {
    .time-slot-grid {
        grid-template-columns: repeat(2, minmax(130px, 1fr))
    }
}

@media(max-width:780px) {
    .booking-schedule-head {
        flex-direction: column
    }

    .booking-date-field {
        width: 100%;
        flex-basis: auto
    }

    .booking-head {
        width: 100%;
        flex-direction: column
    }

    .booking-legend {
        justify-content: flex-start
    }

    .booking-layout {
        grid-template-columns: 1fr
    }

    .booking-summary {
        min-height: 110px
    }
}

@media(max-width:520px) {
    .time-slot-grid {
        grid-template-columns: 1fr
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto
    }

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important
    }
}
