* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; font-family: system-ui, -apple-system, Segoe UI, sans-serif; }

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1c1917;
    color: #fff;
}
.login-card {
    width: min(400px, 92vw);
    padding: 2rem;
    background: #292524;
    border-radius: 16px;
}
.login-card h1 { margin: 0 0 0.5rem; font-size: 1.5rem; }
.login-sub { opacity: 0.75; font-size: 0.9rem; margin-bottom: 1.5rem; }
.login-input {
    width: 100%;
    padding: 0.75rem;
    margin: 0.35rem 0 1rem;
    border-radius: 8px;
    border: 1px solid #44403c;
    background: #1c1917;
    color: #fff;
    font-size: 1.1rem;
}
.login-btn {
    width: 100%;
    padding: 0.85rem;
    border: none;
    border-radius: 10px;
    background: #ea580c;
    color: #fff;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
}
.login-error { color: #fca5a5; margin-bottom: 1rem; font-size: 0.9rem; }

.kitchen-board {
    min-height: 100vh;
    background: #1c1917;
    color: #e7e5e4;
    display: flex;
    flex-direction: column;
}

.kitchen-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem 0.75rem;
    padding: 0.75rem 1rem;
    background: #292524;
    border-bottom: 1px solid #44403c;
    flex-shrink: 0;
}
.kitchen-header h1 { margin: 0; font-size: 1.15rem; }
.kitchen-header__sub { margin: 0.15rem 0 0; font-size: 0.8rem; opacity: 0.7; }
.kitchen-header__right { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin-left: auto; }

.kitchen-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    order: 3;
    width: 100%;
}
@media (min-width: 900px) {
    .kitchen-nav { order: 0; width: auto; flex: 1; justify-content: center; }
}
.kitchen-nav__link {
    padding: 0.4rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    color: #d6d3d1;
    border: 1px solid #57534e;
    background: #1c1917;
}
.kitchen-nav__link--active {
    background: #ea580c;
    border-color: #ea580c;
    color: #fff;
}

.kitchen-page .kitchen-columns { flex: 1; min-height: 0; }
.kitchen-catalog {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem 1rem 1.5rem;
}
.kitchen-catalog__hint {
    margin: 0 0 0.75rem;
    font-size: 0.85rem;
    opacity: 0.85;
    line-height: 1.45;
}
.kitchen-catalog__list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.catalog-row {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.65rem 0.75rem;
    background: #292524;
    border: 1px solid #44403c;
    border-radius: 10px;
}
.catalog-row__img {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.catalog-row__img--empty,
.catalog-row__icon {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: #1c1917;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}
.catalog-row__body { flex: 1; min-width: 0; }
.catalog-row__name { font-weight: 700; font-size: 0.95rem; }
.catalog-row__meta { font-size: 0.78rem; opacity: 0.75; margin-top: 0.15rem; }

.catalog-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 30px;
    flex-shrink: 0;
}
.catalog-switch__input {
    opacity: 0;
    width: 0;
    height: 0;
}
.catalog-switch__slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #57534e;
    border-radius: 999px;
    transition: 0.2s;
}
.catalog-switch__slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 4px;
    bottom: 4px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}
.catalog-switch__input:checked + .catalog-switch__slider {
    background: #16a34a;
}
.catalog-switch__input:checked + .catalog-switch__slider::before {
    transform: translateX(22px);
}
.catalog-switch__input:disabled + .catalog-switch__slider {
    opacity: 0.5;
    cursor: wait;
}

.kitchen-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.kitchen-modal[hidden] { display: none !important; }
.kitchen-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}
.kitchen-modal__dialog {
    position: relative;
    z-index: 1;
    width: min(480px, 100%);
    max-height: 85vh;
    overflow-y: auto;
    background: #292524;
    border: 1px solid #44403c;
    border-radius: 14px;
    padding: 1.25rem;
}
.kitchen-modal__dialog h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.kitchen-modal__dialog p { margin: 0 0 0.75rem; font-size: 0.88rem; line-height: 1.45; opacity: 0.9; }
.kitchen-modal__list {
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
    max-height: 240px;
    overflow-y: auto;
}
.kitchen-modal__list li {
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid #44403c;
    font-size: 0.88rem;
}
.kitchen-modal__list li strong { display: block; }
.kitchen-modal__list li small { opacity: 0.75; }
.kitchen-modal__actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}
.btn-modal {
    padding: 0.55rem 0.9rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.88rem;
}
.btn-modal--cancel { background: #57534e; color: #fff; }
.btn-modal--danger { background: #dc2626; color: #fff; }
.conn-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-weight: 600;
}
.conn-badge--ok { background: #166534; color: #bbf7d0; }
.conn-badge--warn { background: #854d0e; color: #fef08a; }
.conn-badge--error { background: #991b1b; color: #fecaca; }
.conn-badge--connecting { background: #1e40af; color: #bfdbfe; }
.sync-time { font-size: 0.75rem; opacity: 0.6; }
.btn-logout {
    background: transparent;
    border: 1px solid #57534e;
    color: #d6d3d1;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
}

.kitchen-columns {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding: 0.5rem;
    overflow: hidden;
}
@media (max-width: 900px) {
    .kitchen-columns { grid-template-columns: 1fr; }
}

.kitchen-col {
    background: #292524;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
.kitchen-col h2 {
    margin: 0;
    padding: 0.65rem 0.75rem;
    font-size: 0.9rem;
    border-bottom: 1px solid #44403c;
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
}
.col-count {
    background: #44403c;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.kitchen-col__list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.order-card {
    background: #1c1917;
    border: 2px solid #44403c;
    border-radius: 10px;
    padding: 0.65rem;
    margin-bottom: 0.5rem;
}
.order-card--alert {
    border-color: #f97316;
    animation: order-blink 1s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(249, 115, 22, 0.45);
}
@keyframes order-blink {
    0%, 100% { background: #1c1917; }
    50% { background: #431407; }
}
.order-card__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}
.order-card__table { font-weight: 700; font-size: 1rem; }
.order-card__no { font-size: 0.75rem; opacity: 0.7; }
.order-card__time { font-size: 0.8rem; color: #fb923c; }
.order-card__items {
    margin: 0.35rem 0;
    padding-left: 1rem;
    font-size: 0.85rem;
    line-height: 1.4;
}
.order-card__total { font-weight: 600; font-size: 0.9rem; margin-bottom: 0.5rem; }
.order-card__actions { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.order-btn {
    flex: 1;
    min-width: 100%;
    padding: 0.55rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    touch-action: manipulation;
}
.order-btn--prep { background: #7c3aed; color: #fff; }
.order-btn--ready { background: #16a34a; color: #fff; }
