:root {
    --red: #e63946;
    --red-dark: #c1121f;
    --red-light: #fde8ea;
    --green: #2d6a4f;
    --green-light: #d8f3dc;
    --yellow: #f4a261;
    --yellow-light: #fff3e0;
    --gray: #6c757d;
    --gray-light: #f8f9fa;
    --border: #dee2e6;
    --shadow: 0 2px 8px rgba(0,0,0,.08);
    --radius: 10px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font);
    background: #f5f5f5;
    color: #222;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
body > .container,
body > .container-wide {
    flex-grow: 1;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header ── */
.site-header {
    background: var(--red);
    color: white;
    padding: 0 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.site-header .logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: white;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.site-header .logo span { font-size: 1.5rem; }
.site-header nav a {
    color: rgba(255,255,255,.85);
    font-size: .9rem;
    margin-left: 1rem;
}
.site-header nav a:hover { color: white; text-decoration: none; }

/* ── Container ── */
.container { width: 100%; max-width: 960px; margin: 0 auto; padding: 2rem 1.5rem; }
.container-wide { width: 100%; max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ── Cards ── */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.2rem;
    padding-bottom: .8rem;
    border-bottom: 1px solid var(--border);
}
.card-header h2 { font-size: 1.1rem; font-weight: 600; }

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem 1.1rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: .88rem;
    font-weight: 500;
    transition: filter .15s, transform .1s;
    text-decoration: none;
}
.btn:hover { filter: brightness(.92); text-decoration: none; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: grayscale(.4); transform: none; }
.btn-primary { background: var(--red); color: white; }
.btn-success { background: var(--green); color: white; }
.btn-warning { background: var(--yellow); color: white; }
.btn-secondary { background: var(--gray); color: white; }
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: #444;
}
.btn-sm { padding: .3rem .7rem; font-size: .8rem; }
.btn-danger { background: #dc3545; color: white; }

/* ── Forms ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: .35rem;
    color: #444;
}
.form-control {
    width: 100%;
    padding: .55rem .75rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    font-size: .93rem;
    font-family: var(--font);
    transition: border-color .15s;
    background: white;
}
.form-control:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(230,57,70,.12);
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}
@media (max-width: 600px) { .form-row { grid-template-columns: 1fr; } }

/* ── Badges ── */
.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-pending  { background: var(--yellow-light); color: #c07000; }
.badge-accepted { background: var(--green-light);  color: var(--green); }
.badge-rejected { background: var(--red-light);    color: var(--red-dark); }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th { text-align: left; padding: .7rem .8rem; border-bottom: 2px solid var(--border); color: #555; font-weight: 600; white-space: nowrap; }
td { padding: .65rem .8rem; border-bottom: 1px solid #f0f0f0; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* ── Products grid ── */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 768px) {
    .products-grid {
        grid-template-columns: 1fr;
        gap: .75rem;
    }
}
.product-card {
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.2rem;
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s;
    position: relative;
}
.product-card:hover { border-color: var(--red); box-shadow: 0 4px 12px rgba(230,57,70,.15); }
.product-card.selected { border-color: var(--red); background: var(--red-light); }
.product-card .emoji { font-size: 2rem; margin-bottom: .5rem; }
.product-card .prod-name { font-weight: 600; font-size: 1rem; }
.product-card .prod-price { color: var(--red); font-weight: 700; font-size: 1.05rem; margin-top: .2rem; }
.product-card .prod-desc { font-size: .8rem; color: var(--gray); margin-top: .3rem; }
.product-card .prod-desc-img {
    display: block; width: 100%; max-width: 100%; height: auto; min-height: 80px;
    margin-top: .5rem; border: 2px solid #e0e0e0; border-radius: 10px; object-fit: cover;
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: img-shimmer 1.4s infinite;
    opacity: 0;
    transition: opacity .3s ease;
}
.product-card .prod-desc-img.loaded { opacity: 1; animation: none; background: none; }
@keyframes img-shimmer { 0% { background-position: 200% 0 } 100% { background-position: -200% 0 } }
.product-card.unavailable {
    opacity: .5;
    cursor: default;
    background: #fafafa;
}
.product-card.unavailable:hover {
    border-color: var(--border);
    box-shadow: none;
}
.unavailable-badge {
    display: inline-block;
    margin-top: .4rem;
    background: #ddd;
    color: #888;
    border-radius: 4px;
    padding: .1rem .5rem;
    font-size: .75rem;
    font-weight: 600;
}
.product-card .qty-control {
    display: none;
    margin-top: .8rem;
    align-items: center;
    gap: .5rem;
}
.product-card.selected .qty-control { display: flex; }
.qty-control button {
    width: 28px; height: 28px;
    border: none; border-radius: 50%;
    background: var(--red); color: white;
    font-size: 1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.qty-input {
    width: 60px;
    padding: .25rem .4rem;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    text-align: center;
    font-size: .9rem;
}

/* ── Order summary ── */
.order-summary {
    background: var(--red-light);
    border: 1.5px solid var(--red);
    border-radius: var(--radius);
    padding: 1rem 1.2rem;
    margin-bottom: 1rem;
}
.order-summary .summary-row {
    display: flex;
    justify-content: space-between;
    padding: .2rem 0;
    font-size: .9rem;
}
.order-summary .total {
    font-weight: 700;
    font-size: 1.05rem;
    border-top: 1px solid var(--red);
    margin-top: .5rem;
    padding-top: .5rem;
}

/* ── Alert ── */
.alert {
    padding: .85rem 1.1rem;
    border-radius: 7px;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert-success { background: var(--green-light); color: var(--green); border-left: 4px solid var(--green); }
.alert-error   { background: var(--red-light);   color: var(--red-dark); border-left: 4px solid var(--red); }
.alert-info    { background: var(--yellow-light); color: #7a4f00; border-left: 4px solid var(--yellow); }

/* ── Calendar ── */
.calendar { width: 100%; border-collapse: collapse; }
.calendar th {
    background: var(--red);
    color: white;
    text-align: center;
    padding: .6rem;
    font-weight: 600;
    font-size: .85rem;
    border: none;
}
.calendar td {
    border: 1px solid var(--border);
    vertical-align: top;
    width: calc(100%/7);
    min-height: 80px;
    padding: .4rem;
}
.cal-day-num {
    font-size: .8rem;
    font-weight: 700;
    color: #555;
    margin-bottom: .3rem;
}
.cal-day-num.today {
    background: var(--red);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cal-day-link {
    display: block;
    text-decoration: none;
    color: inherit;
}
.calendar td { cursor: pointer; }
.calendar td:hover { background: #f0f4ff; }
.cal-selected { background: #eef2ff !important; outline: 1.5px solid #99aaee; }
.cal-event {
    background: var(--green);
    color: white;
    border-radius: 4px;
    padding: .15rem .4rem;
    font-size: .72rem;
    margin-top: .2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}
.cal-event-done { background: #888; }
.cal-event:hover { filter: brightness(1.1); }
.cal-empty { background: #fafafa; }
.cal-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.cal-nav h3 { flex: 1; text-align: center; font-size: 1.1rem; }

/* ── Admin tabs ── */
.tabs {
    display: flex;
    gap: .2rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}
.tab-btn {
    padding: .6rem 1.2rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: .9rem;
    color: var(--gray);
    font-family: var(--font);
    font-weight: 500;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: color .15s;
    text-decoration: none;
    display: inline-block;
}
.tab-btn:hover { color: var(--red); text-decoration: none; }
.tab-btn.active { color: var(--red); border-bottom-color: var(--red); }

/* ── Admin order cards ── */
.order-card {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: .9rem;
    overflow: hidden;
    transition: border-color .15s, box-shadow .15s;
}
.order-card:hover { border-color: #bbb; box-shadow: 0 3px 10px rgba(0,0,0,.07); }

.oc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .4rem;
    padding: .65rem 1rem;
    background: var(--gray-light);
    border-bottom: 1px solid var(--border);
}
.oc-head-left  { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.oc-head-right { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.oc-num  { font-weight: 700; color: var(--gray); font-size: .85rem; }
.oc-name { font-weight: 600; font-size: .95rem; }

.oc-body { padding: .75rem 1rem; }

.oc-items { list-style: none; font-size: .88rem; margin: 0 0 .5rem; }
.oc-items li {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .25rem 0;
    border-bottom: 1px solid #f3f3f3;
}
.oc-items li:last-child { border-bottom: none; }
.oc-items li > span:first-child { flex: 1; font-weight: 500; }
.oc-item-mid { color: var(--gray); font-size: .83rem; }
.oc-item-sub { font-weight: 600; min-width: 70px; text-align: right; }

.oc-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 700;
    font-size: .95rem;
    padding-top: .3rem;
    border-top: 1.5px solid var(--border);
}
.oc-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: .5rem;
    font-size: .78rem;
    color: var(--gray);
}

.oc-foot {
    display: flex;
    align-items: center;
    gap: .4rem;
    flex-wrap: wrap;
    padding: .55rem 1rem;
    background: #fafafa;
    border-top: 1px solid var(--border);
}

.action-panel {
    padding: .85rem 1rem;
    background: #fffdf0;
    border-top: 1px solid #e8e0c0;
    animation: slideDown .15s ease;
}
.action-panel form {
    display: flex;
    gap: .6rem;
    align-items: flex-end;
    flex-wrap: wrap;
}
.action-panel .btn {
    padding: .55rem 1rem;
    font-size: .93rem;
    margin-bottom: 2px;
}
@keyframes slideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.badge-paid      { background: #e8f5e9; color: #2e7d32; }
.badge-delivered { background: #e3f2fd; color: #1565c0; }
.badge-all       { background: #e9ecef; color: #495057; }

/* ── Stats ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.2rem;
    text-align: center;
}
.stat-card .stat-num { font-size: 1.8rem; font-weight: 700; color: var(--red); }
.stat-card .stat-label { font-size: .8rem; color: var(--gray); margin-top: .2rem; }

/* ── Login ── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}
.login-box {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2.5rem;
    width: 340px;
}
.login-box h1 { font-size: 1.4rem; margin-bottom: 1.5rem; text-align: center; }

/* ── Misc ── */
.text-muted { color: var(--gray); font-size: .85rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.tag {
    display: inline-block;
    background: var(--gray-light);
    border-radius: 4px;
    padding: .15rem .5rem;
    font-size: .78rem;
    color: #555;
}
hr { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

.success-box {
    text-align: center;
    padding: 2rem;
}
.success-box .big-icon { font-size: 3.5rem; margin-bottom: .5rem; }
.success-box h2 { font-size: 1.4rem; margin-bottom: .5rem; }
.success-box .order-id {
    font-size: 2rem;
    font-weight: 700;
    color: var(--red);
    margin: .5rem 0;
}

@media (max-width: 600px) {
    .container, .container-wide { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .tabs { flex-wrap: wrap; }
}

/* ── Demo footer ── */
.demo-footer {
    margin-top: auto;
    padding: .6rem 1.5rem;
    background: #f0f0f0;
    border-top: 1px solid #ddd;
    text-align: center;
    font-size: .75rem;
    color: #aaa;
    letter-spacing: .02em;
}
.demo-footer a { color: #bbb; text-decoration: underline; }
