:root {
    color-scheme: light;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    --bg: #0f172a;
    --surface: #0b1220;
    --card: #111827;
    --muted: #94a3b8;
    --accent: #f97316;
    --accent-dark: #ea580c;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: #f8fafc;
}

.kitchen-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.kitchen-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, #111827, #0f172a);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.header-user-name {
    font-weight: 600;
    color: #f8fafc;
}

.logout-button {
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: transparent;
    color: #e2e8f0;
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: border 0.2s ease, color 0.2s ease;
}

.logout-button:hover {
    border-color: var(--accent);
    color: #fff;
}

.kitchen-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.kitchen-header .subtitle {
    margin: 0.35rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.status-dot {
    width: 0.6rem;
    height: 0.6rem;
    border-radius: 999px;
    background: var(--warning);
}

.kitchen-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg);
}

.login-card {
    width: min(420px, 100%);
    background: var(--surface);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.45);
}

.login-header h1 {
    margin: 0 0 0.4rem;
    font-size: 1.6rem;
}

.login-header p {
    margin: 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.login-alert {
    margin: 1rem 0;
    padding: 0.75rem 1rem;
    border-radius: 0.9rem;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.4);
    color: #fecaca;
    font-size: 0.9rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.2rem;
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.login-field input {
    border-radius: 0.85rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    background: #0f172a;
    color: #f8fafc;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

.login-field input:focus {
    outline: 2px solid rgba(249, 115, 22, 0.4);
    border-color: var(--accent);
}

.kitchen-main {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 2fr;
    gap: 1.5rem;
    padding: 1.5rem 2rem 6rem;
    flex: 1;
}

.orders-list {
    background: var(--surface);
    border-radius: 1.25rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 60vh;
}

.list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.list-header h2 {
    margin: 0;
    font-size: 1.1rem;
}

.list-count {
    background: rgba(148, 163, 184, 0.2);
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.85rem;
    color: #e2e8f0;
}

.orders-scroll {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.order-card {
    background: var(--card);
    border-radius: 1rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    border: 1px solid transparent;
    cursor: pointer;
    transition: border 0.2s ease, transform 0.2s ease;
}

.order-card:hover {
    transform: translateY(-2px);
    border-color: rgba(249, 115, 22, 0.4);
}

.order-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(249, 115, 22, 0.4);
}

.order-card .order-top {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
}

.order-number {
    font-weight: 600;
}

.order-meta {
    font-size: 0.8rem;
    color: var(--muted);
}

.order-status {
    font-size: 0.75rem;
    text-transform: uppercase;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
}

.status-pending { background: rgba(148, 163, 184, 0.2); color: #e2e8f0; }
.status-preparing { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.status-ready { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; }
.status-out_for_delivery { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }
.status-completed { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.status-cancelled { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

.order-items {
    font-size: 0.85rem;
    color: #e2e8f0;
}

.order-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--muted);
}

.order-details {
    background: var(--surface);
    border-radius: 1.25rem;
    padding: 1.5rem 1.5rem 6rem;
    position: relative;
    min-height: 60vh;
}

.details-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.details-header h2 {
    margin: 0;
    font-size: 1.25rem;
}

.details-meta {
    margin: 0.3rem 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.back-button {
    display: none;
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #e2e8f0;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
}

.details-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.details-card {
    background: var(--card);
    border-radius: 1rem;
    padding: 1rem;
}

.details-card h3 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.details-card dl {
    display: grid;
    grid-template-columns: minmax(120px, 1fr) 2fr;
    gap: 0.5rem 1rem;
    margin: 0;
    font-size: 0.9rem;
}

.details-card dt {
    color: var(--muted);
}

.details-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.details-item {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
}

.details-item small {
    color: var(--muted);
}

.details-totals {
    display: grid;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.details-total-row {
    display: flex;
    justify-content: space-between;
}

.details-notes {
    margin: 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.2);
    font-size: 0.85rem;
    text-transform: capitalize;
}

.status-bar {
    position: sticky;
    bottom: 1rem;
    margin-top: 1.5rem;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(6px);
    border-radius: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.status-bar-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    font-size: 0.85rem;
    color: var(--muted);
}

.status-actions {
    display: flex;
    gap: 0.6rem;
}

.btn {
    border: none;
    padding: 0.7rem 1.4rem;
    border-radius: 0.85rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.btn.full {
    width: 100%;
}

.btn.primary {
    background: var(--accent);
    color: #0f172a;
    font-weight: 600;
}

.btn.primary:disabled {
    background: rgba(249, 115, 22, 0.4);
    cursor: not-allowed;
}

.btn.secondary {
    background: rgba(148, 163, 184, 0.2);
    color: #f8fafc;
}

.btn.secondary:disabled {
    background: rgba(148, 163, 184, 0.1);
    color: rgba(248, 250, 252, 0.5);
    cursor: not-allowed;
}

.btn.ghost {
    background: transparent;
    border: 1px solid rgba(148, 163, 184, 0.4);
    color: #e2e8f0;
}

.btn.ghost:disabled {
    border-color: rgba(148, 163, 184, 0.15);
    color: rgba(226, 232, 240, 0.4);
    cursor: not-allowed;
}

.manual-panel {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    z-index: 20;
}

.manual-panel.active {
    display: flex;
}

.manual-panel-content {
    background: var(--surface);
    border-radius: 1.5rem;
    padding: 1.5rem;
    width: min(600px, 100%);
}

.manual-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.manual-panel-header h3 {
    margin: 0;
}

.manual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.manual-tile {
    background: var(--card);
    border-radius: 1rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    border: 1px solid transparent;
    font-weight: 600;
    text-transform: capitalize;
}

.manual-tile.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.manual-tile.active {
    border-color: var(--accent);
}

.empty-state {
    color: var(--muted);
    text-align: center;
    padding: 2rem 1rem;
}

.toast {
    position: fixed;
    right: 1.5rem;
    bottom: 1.5rem;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.2);
    color: #f8fafc;
    padding: 0.8rem 1.2rem;
    border-radius: 0.85rem;
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 30;
}

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

@media (max-width: 1199px) {
    .kitchen-main {
        grid-template-columns: 1fr 1.2fr;
    }
}

@media (max-width: 767px) {
    .kitchen-main {
        grid-template-columns: 1fr;
        padding: 1rem 1rem 6rem;
    }

    .orders-list {
        min-height: auto;
    }

    .order-details {
        position: fixed;
        inset: 0;
        border-radius: 0;
        padding: 1.5rem 1.2rem 6rem;
        background: var(--surface);
        transform: translateX(100%);
        transition: transform 0.3s ease;
        z-index: 10;
    }

    .kitchen-app.details-open .order-details {
        transform: translateX(0);
    }

    .back-button {
        display: inline-flex;
    }

    .status-bar {
        position: fixed;
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }
}
