:root {
    --color-primary: #4f46e5;
    --color-primary-dark: #3730a3;
    --color-accent: #f97316;
    --color-success: #16a34a;
    --color-danger: #dc2626;
    --color-surface: #ffffff;
    --color-surface-alt: #f3f4f6;
    --color-muted: #6b7280;
    --color-border: rgba(15, 23, 42, 0.12);
    --color-text: #0f172a;
    --color-text-soft: #334155;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 10px 30px rgba(15, 23, 42, 0.08);
    --radius-sm: 0.5rem;
    --radius-lg: 1rem;
    --sidebar-width: 245px;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Nunito', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(180deg, #eef1fb 0%, #f8fafc 40%, #ffffff 100%);
    color: var(--color-text);
    min-height: 100vh;
}

a {
    color: var(--color-primary);
    text-decoration: none;
}

a:hover,
a:focus {
    color: var(--color-primary-dark);
    text-decoration: none;
}

.btn {
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:focus {
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.25);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
    border: none;
}

.btn-outline-dark {
    color: var(--color-text);
    border-color: rgba(15, 23, 42, 0.16);
}

.btn-outline-dark.active,
.btn-outline-dark:active,
.btn-outline-dark:focus {
    background: var(--color-text);
    color: #fff;
}

.btn-outline-secondary,
.btn-outline-primary,
.btn-outline-success {
    border-width: 2px;
}

.badge {
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    font-weight: 600;
}

.card,
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
}

.card > .card-header,
.modal-header {
    border: none;
    background: transparent;
    font-weight: 700;
    color: var(--color-text);
}

.table thead th {
    border-bottom: 2px solid rgba(15, 23, 42, 0.06);
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--color-muted);
}

.table tbody td {
    vertical-align: middle;
    color: var(--color-text-soft);
}

.table-hover tbody tr:hover {
    background: rgba(79, 70, 229, 0.06);
}

.form-control,
.form-select {
    border-radius: var(--radius-sm);
    border-color: rgba(79, 70, 229, 0.25);
    padding: 0.65rem 0.85rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 0.2rem rgba(79, 70, 229, 0.15);
}

select.form-control,
select.form-select,
.custom-select {
    height: calc(1.5em + 1.3rem + 2px);
    min-height: calc(1.5em + 1.3rem + 2px);
    line-height: 1.5;
    padding-top: 0.375rem;
    padding-bottom: 0.375rem;
    background-position: right 0.75rem center;
}

.sticky-footer {
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    background: rgba(255, 255, 255, 0.86);
    backdrop-filter: blur(10px);
}

/* Sidebar tweaks */
.sidebar {
    width: var(--sidebar-width);
    background: radial-gradient(circle at top, #4c51bf, #312e81);
}

.sidebar .nav-item {
    margin: 0.4rem 0;
}

.sidebar .nav-link {
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    font-weight: 600;
}

.sidebar .nav-link.active,
.sidebar .nav-link:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.sidebar .sidebar-brand {
    height: 4.5rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.sidebar-user-panel {
    margin-top: auto;
    margin-bottom: 0;
}

.sidebar-user-content {
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-user-identity {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    color: #fff;
}

.sidebar-user-identity [data-session-user] {
    color: #fff;
}

.sidebar-user-identity .img-profile {
    width: 1.5rem;
    height: 1.5rem;
}

/* Topbar */
.topbar {
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
}


.topbar .section-heading {
    width: 100%;
    margin-bottom: 0;
}

/* Filters toolbar */
.filters-toolbar {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    position: sticky;
    top: 1.5rem;
    z-index: 10;
}

.filters-toolbar .btn {
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.filters-toolbar input[type="date"] {
    min-width: 160px;
}

/* Orders grid */
#orders {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.order-card {
    display: flex;
    flex-direction: column;
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    min-height: 100%;
    border: 1px solid transparent;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.order-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.12);
}

.order-card.completed {
    border-color: rgba(22, 163, 74, 0.3);
    opacity: 0.85;
}

.order-header {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.85rem 1.25rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #fff;
}

.order-header.pickup {
    background: linear-gradient(135deg, #0ea5e9, #0369a1);
}

.order-header.delivery {
    background: linear-gradient(135deg, #22c55e, #15803d);
}

.order-header.unknown {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
}

.order-header-datetime {
    font-weight: 900;
}

.customer-name {
    font-weight: 800;
    color: var(--color-text);
}

.order-details {
    padding: 1.25rem;
    line-height: 1.6;
    color: var(--color-text-soft);
}

.order-details p {
    margin-bottom: 0.5rem;
}

.order-body .line-item {
    display: block;
    width: calc(100% - 2.5rem);
    margin: 0 1.25rem 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(15, 23, 42, 0.08);
    background: var(--color-surface-alt);
    text-align: left;
    font-weight: 600;
    color: var(--color-text);
    transition: background 0.15s ease, transform 0.15s ease;
}

.order-body .line-item:hover {
    background: rgba(79, 70, 229, 0.1);
    transform: translateX(3px);
}


.order-body .line-item.completed {
    border-color: rgba(22, 163, 74, 0.4);
    background: rgba(22, 163, 74, 0.1);
    text-decoration: line-through;
}

.order-body .line-item.line-status-ordered {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.08);
}

.order-body .line-item.line-status-in-progress {
    border-color: rgba(249, 115, 22, 0.4);
    background: rgba(249, 115, 22, 0.12);
}

.order-body .line-item.line-status-completed {
    border-color: rgba(22, 163, 74, 0.45);
    background: rgba(22, 163, 74, 0.14);
}


.order-footer {
    margin-top: auto;
    padding: 1.15rem 1.25rem 1.4rem;
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    background: linear-gradient(180deg, rgba(79, 70, 229, 0.04), rgba(79, 70, 229, 0.08));
}

.order-footer button {
    flex: 1 1 0;
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
}

.order-footer .btn-acknowledge {
    background: linear-gradient(135deg, #facc15, #ca8a04);
    color: #1f2937;
}

.order-footer .btn-progress {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: #fff;
}

.order-footer .btn-complete {
    background: linear-gradient(135deg, #22c55e, #15803d);
    color: #fff;
}

.order-footer button:first-child {
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    color: var(--color-text);
}

.empty,
.error {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-sm);
    text-align: center;
    font-weight: 600;
    color: var(--color-muted);
}

.error {
    color: var(--color-danger);
}

/* Notification dropdown */
.notif-dropdown {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    width: min(360px, calc(100% - 3rem));
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, 0.06);
}

.notif-header {
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    font-weight: 700;
}

.notif-dropdown ul {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
}

.notif-dropdown li {
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.05);
    font-size: 0.95rem;
}

/* Dashboard expanding line items */
.dashboard-line-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0 1.25rem 0.75rem;
}

.dashboard-line-item-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.order-body .dashboard-line-item-btn {
    width: 100%;
    margin: 0;
}

.order-body .dashboard-line-item-btn strong,
.order-body .dashboard-line-item-btn span {
    display: block;
}

.order-body .dashboard-line-item-btn span {
    margin-top: 0.25rem;
    font-size: 0.95rem;
    color: var(--color-text-soft);
    font-weight: 500;
}

.order-body .dashboard-line-item-btn.active {
    border-color: #1d4ed8;
    background: #eaf2ff;
    color: #0f172a;
}

.dashboard-item-expand {
    border: 1px solid rgba(37, 99, 235, 0.28);
    background: #f8fbff;
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
}

.dashboard-item-expand p {
    margin-bottom: 0.35rem;
    font-size: 0.96rem;
}

.dashboard-item-expand label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.92rem;
}

.dashboard-item-expand input[type="number"] {
    max-width: 140px;
}

.dashboard-item-expand-actions {
    margin-top: 0.55rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.55rem;
}

/* Auth pages */
.auth-bg {
    background: radial-gradient(circle at top left, rgba(79, 70, 229, 0.18), transparent 55%),
                radial-gradient(circle at bottom right, rgba(22, 163, 74, 0.16), transparent 45%),
                #f4f6fb;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-shell {
    max-width: 420px;
    width: 100%;
}

.auth-card {
    background: rgba(255, 255, 255, 0.96);
    padding: 2.5rem;
    border-radius: 1.25rem;
    box-shadow: 0 25px 45px rgba(15, 23, 42, 0.12);
    text-align: center;
}

.auth-card__logo {
    width: 86px;
    height: 86px;
    margin: 0 auto 1rem;
    display: grid;
    place-items: center;
    border-radius: 24px;
    background: linear-gradient(135deg, #4f46e5, #22c55e);
    color: #fff;
    font-size: 2rem;
    font-weight: 800;
}

.auth-card h1 {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.auth-card p {
    color: var(--color-muted);
    margin-bottom: 2rem;
}

.auth-card .form-control {
    margin-bottom: 1rem;
}

.auth-card button {
    width: 100%;
    padding: 0.85rem 1rem;
    font-size: 1rem;
}

.auth-card .form-text {
    font-size: 0.9rem;
    color: var(--color-muted);
}

.auth-card .state-message {
    margin-top: 1rem;
    font-weight: 600;
}

.state-message[data-type="error"] {
    color: var(--color-danger);
}

.state-message[data-type="success"] {
    color: var(--color-success);
}

.state-message[data-type="info"] {
    color: var(--color-text-soft);
}

/* Utility helpers */
[data-visible-for][hidden] {
    display: none !important;
}

[data-visible-for].d-none {
    display: none !important;
}

[data-admin-only] {
    display: none;
}

body[data-user-role="admin"] [data-admin-only] {
    display: block;
}

main {
    padding-bottom: 2rem;
}

.section-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-heading h1,
.section-heading h2 {
    font-weight: 800;
    margin: 0;
    color: var(--color-text);
}

.text-muted-soft {
    color: var(--color-muted) !important;
}

/* Responsive tweaks */
@media (max-width: 1199px) {
    .filters-toolbar {
        position: static;
    }
}

@media (max-width: 991px) {
    .sidebar {
        width: 100%;
    }

    #orders {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    }

    .order-footer {
        flex-direction: column;
        align-items: stretch;
    }
}

@media (max-width: 575px) {
    .filters-toolbar {
        padding: 1rem;
    }

    .order-details {
        padding: 1rem;
    }

    .order-body .line-item {
        width: calc(100% - 2rem);
        margin: 0 1rem 0.65rem;
    }
}

/* Tablet KDS screen */
.tablet-kds-page {
    background: #eef1f6;
}

.tablet-shell {
    padding: 1rem;
}

.tablet-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    background: #fff;
    border-radius: 0.75rem;
    padding: 0.8rem 1rem;
    box-shadow: var(--shadow-sm);
}

.tablet-topbar-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.tablet-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.tablet-orders-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 1.5rem;
}

.tablet-order-card {
    background: #fff;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 620px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.tablet-order-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(15, 23, 42, 0.12);
}

.tablet-order-header {
    background: #2563eb;
    color: #fff;
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.85rem 0.9rem;
}

.tablet-order-header h2 {
    font-size: 1.45rem;
    margin: 0;
}

.tablet-header-datetime {
    font-weight: 900;
}

.tablet-order-header p {
    margin: 0;
    font-size: 1rem;
    opacity: 0.95;
}

.tablet-order-header h2,
.tablet-order-header p,
.tablet-order-header small {
    color: #fff !important;
}

.tablet-order-header.status-proposed { background: #f59e0b; color: #fff; }
.tablet-order-header.status-reserved { background: #2563eb; color: #fff; }
.tablet-order-header.status-prepared { background: #ea580c; color: #fff; }
.tablet-order-header.status-completed { background: #16a34a; color: #fff; }
.tablet-order-header.status-unknown { background: #475569; color: #fff; }

.tablet-order-meta {
    display: flex;
    justify-content: space-between;
    font-size: 1rem;
    color: #4b5563;
    padding: 0.65rem 0.9rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.tablet-line-items {
    list-style: none;
    padding: 0.5rem 0.65rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
}

.tablet-line-items button {
    width: 100%;
    text-align: left;
    border: 1px solid rgba(15, 23, 42, 0.09);
    background: #f9fafb;
    color: #0f172a;
    border-radius: 0.45rem;
    padding: 0.8rem 0.9rem;
}

.tablet-line-items button.line-status-ordered {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.12);
}

.tablet-line-items button.line-status-in-progress {
    border-color: rgba(249, 115, 22, 0.45);
    background: rgba(249, 115, 22, 0.15);
}

.tablet-line-items button.line-status-completed {
    border-color: rgba(22, 163, 74, 0.45);
    background: rgba(22, 163, 74, 0.16);
}



.tablet-card-kitchen-description {
    display: block;
    margin-top: 0.25rem;
    margin-bottom: 0.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e3a8a;
}

.tablet-line-items button span {
    display: block;
    font-size: 1rem;
    color: #64748b;
}



.tablet-line-item-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.tablet-line-item-btn.active {
    border-color: #1d4ed8;
    background: #eaf2ff;
    color: #0f172a !important;
}

.tablet-line-item-btn.active strong {
    color: #0f172a !important;
}

.tablet-line-item-btn.active span {
    color: #64748b !important;
}


.tablet-expand-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.75rem;
}

.tablet-expand-section {
    margin-top: 0.75rem;
}

.tablet-expand-section-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e3a8a;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.tablet-kitchen-line {
    border: 1px solid rgba(15, 23, 42, 0.09);
    background: #fff;
    border-radius: 0.4rem;
    padding: 0.5rem 0.65rem;
    margin-bottom: 0.45rem;
}

.tablet-kitchen-line-main {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.tablet-kitchen-line-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 700;
}

.tablet-kitchen-line-meta {
    color: #475569;
    font-size: 0.85rem;
}

.tablet-kitchen-line-note {
    margin-top: 0.35rem;
    color: #475569;
    font-size: 0.88rem;
}


.tablet-derived-line-item {
    width: 100%;
    border: 1px dashed rgba(37, 99, 235, 0.35);
    background: rgba(219, 234, 254, 0.45);
    color: #0f172a;
    border-radius: 0.45rem;
    padding: 0.8rem 0.9rem;
}

.tablet-derived-line-item strong {
    display: block;
}

.tablet-derived-line-item span {
    display: block;
    font-size: 1rem;
    color: #64748b;
}

.tablet-item-expand {
    border: 1px solid rgba(37, 99, 235, 0.3);
    background: #f8fbff;
    border-radius: 0.45rem;
    padding: 0.8rem;
}

.tablet-item-expand p {
    margin-bottom: 0.35rem;
    font-size: 0.98rem;
}

.tablet-item-expand label {
    display: block;
    margin-bottom: 0.3rem;
    font-size: 0.92rem;
}

.tablet-item-expand-actions {
    margin-top: 0.45rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}


.tablet-order-actions {
    margin-top: auto;
    padding: 0.95rem;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
}

.tablet-order-actions .btn {
    min-height: 42px;
    font-size: 0.9rem;
    font-weight: 700;
}

.btn-tablet-proposed {
    background: #f59e0b;
    border-color: #d97706;
    color: #111827;
}

.btn-tablet-reserved {
    background: #2563eb;
    border-color: #1d4ed8;
    color: #fff;
}

.btn-tablet-prepared {
    background: #ea580c;
    border-color: #c2410c;
    color: #fff;
}

.btn-tablet-completed {
    background: #16a34a;
    border-color: #15803d;
    color: #fff;
}

.btn-tablet-unknown {
    background: #475569;
    border-color: #334155;
    color: #fff;
}

@media (min-width: 900px) {
    .tablet-shell {
        padding: 1.25rem;
    }
}


.btn-inactive {
    opacity: 0.65 !important;
    cursor: not-allowed !important;
    filter: grayscale(0.1);
}


.live-status-bar {
    margin: 0 0 0.75rem 0;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #1e3a8a;
    font-weight: 700;
    font-size: 1rem;
}



.header-bar-layout {
    display: grid !important;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.header-status-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.header-action-buttons {
    justify-self: end;
}

.header-action-buttons .btn {
    min-height: 50px;
    font-size: 1rem;
    font-weight: 700;
    padding: 0.65rem 1rem;
}

.header-bar-layout .live-status-bar {
    margin: 0;
    min-width: 330px;
    text-align: center;
}

@media (max-width: 992px) {
    .header-bar-layout {
        grid-template-columns: 1fr;
    }

    .header-status-center,
    .header-action-buttons {
        justify-self: start;
    }
}


.report-toolbar .btn-group .btn { flex: 1 1 auto; }
.printable-report-shell { display: grid; gap: 1.5rem; }
.print-report-header { display:flex; justify-content:space-between; align-items:end; gap:1rem; }
.supply-check-cell, .supply-order-cell { min-width: 120px; height: 42px; }
.supply-check-cell::before { content: ""; display:inline-block; width:20px; height:20px; border:2px solid #94a3b8; border-radius:4px; }
.supply-order-cell { border-bottom: 2px solid #cbd5e1; }
@media print { body { background:#fff !important; } #accordionSidebar, .topbar, #documentsAlert, #suppliesAlert, #refreshDocumentsBtn, #printDocumentsBtn, #refreshSuppliesBtn, #printSuppliesBtn, .sidebar, .sidebar-brand, .sticky-footer { display:none !important; } #content-wrapper, #content, main.container-fluid { margin:0 !important; padding:0 !important; width:100% !important; } .card { border:none !important; box-shadow:none !important; } .printable-report-shell { gap: 1rem; } }
