:root {
    --brand: #14532d;
    --brand-light: #166534;
    --brand-accent: #22c55e;
    --ink: #0f172a;
    --muted: #64748b;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --danger: #dc2626;
    --warning: #d97706;
}

html, body {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--ink);
}

a, .btn-link {
    color: var(--brand-light);
}

h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 650; margin-bottom: .75rem; }

.btn-primary {
    color: #fff;
    background-color: var(--brand);
    border-color: var(--brand);
}
.btn-primary:hover { background-color: var(--brand-light); border-color: var(--brand-light); }

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #fff, 0 0 0 0.25rem var(--brand-accent);
}

.content { padding-top: 1.1rem; }
h1:focus { outline: none; }

/* ---------- Auth screens ---------- */
.auth-shell {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--brand) 0%, #052e16 100%);
    padding: 1rem;
}
.auth-card {
    background: var(--surface);
    width: 100%;
    max-width: 380px;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 20px 45px rgba(0,0,0,.25);
}
.auth-brand { text-align: center; margin-bottom: 1.5rem; }
.auth-logo {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 14px;
    background: var(--brand); color: #fff; font-weight: 800; letter-spacing: 1px;
    margin-bottom: .75rem;
}
.auth-brand h1 { font-size: 1.35rem; margin: 0; }
.auth-help { margin-top: 1rem; text-align: center; }

/* ---------- Top bar ---------- */
.top-row.px-4 { justify-content: flex-end; }
.topbar-user { display: flex; align-items: center; gap: 1rem; }
.user-block { display: flex; flex-direction: column; line-height: 1.1; text-align: right; }
.user-name { font-weight: 600; font-size: .9rem; }
.badge-role {
    font-size: .68rem; text-transform: uppercase; letter-spacing: .04em;
    color: var(--brand-light); font-weight: 700;
}
.notif-bell {
    position: relative; border: none; background: transparent; font-size: 1.2rem; cursor: pointer;
}
.notif-badge {
    position: absolute; top: -4px; right: -6px;
    background: var(--danger); color: #fff; border-radius: 999px;
    font-size: .62rem; padding: 1px 5px; font-weight: 700;
}

/* ---------- Page header ---------- */
.page-header { margin-bottom: 1.25rem; }
.page-header p { margin: 0; }

/* ---------- Stat cards ---------- */
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 1.1rem 1.25rem; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.stat-label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--brand); line-height: 1.1; margin: .25rem 0; }
.stat-sub { color: var(--muted); font-size: .82rem; }

/* ---------- Panels ---------- */
.card-panel {
    background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
    padding: 1.25rem; margin-bottom: 1rem;
}
.dash-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 900px) { .dash-row { grid-template-columns: 1fr; } }

/* ---------- Quick actions ---------- */
.quick-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: .5rem; }
.action-tile {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: .5rem; width: 160px; height: 110px; border-radius: 12px; text-decoration: none;
    background: var(--surface); border: 1px solid var(--border); color: var(--ink); font-weight: 600;
    transition: transform .08s ease, box-shadow .08s ease;
}
.action-tile:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.08); color: var(--brand); }
.action-ic { font-size: 1.8rem; }

/* ---------- Tables ---------- */
.table { background: var(--surface); }
.table thead th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; }

/* ---------- Status badges ---------- */
.badge-status { padding: .25em .6em; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.badge-instock { background: #dcfce7; color: #166534; }
.badge-sold { background: #e0e7ff; color: #3730a3; }
.badge-reserved { background: #fef9c3; color: #854d0e; }
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-scheduled { background: #dbeafe; color: #1e40af; }
.badge-outfordelivery { background: #ede9fe; color: #5b21b6; }
.badge-completed { background: #dcfce7; color: #166534; }
.badge-delivered { background: #dcfce7; color: #166534; }
.badge-cancelled, .badge-removed { background: #fee2e2; color: #991b1b; }

/* ---------- Forms ---------- */
.form-narrow { max-width: 640px; }
.toolbar { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.toolbar .spacer { flex: 1; }

/* ---------- Nav brand ---------- */
.brand-logo {
    background: rgba(255,255,255,.15); padding: 2px 8px; border-radius: 6px;
    font-weight: 800; margin-right: .5rem;
}
.brand-text { font-weight: 600; }
.nav-section {
    color: rgba(255,255,255,.55); font-size: .72rem; text-transform: uppercase;
    letter-spacing: .06em; padding: .75rem 1.5rem .25rem;
}
.nav-ic { display: inline-block; width: 1.4rem; }

/* ---------- POS ---------- */
.pos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 992px) { .pos-grid { grid-template-columns: 1fr; } }
.pos-list { display: flex; flex-direction: column; gap: .5rem; max-height: 60vh; overflow-y: auto; }
.pos-item {
    display: flex; justify-content: space-between; align-items: center; text-align: left;
    border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: .65rem .9rem; cursor: pointer;
}
.pos-item:hover { border-color: var(--brand-accent); }
.pos-item.selected { border-color: var(--brand); box-shadow: 0 0 0 2px rgba(20,83,45,.15); }
.pos-item-price { font-weight: 700; color: var(--brand); }
.selected-banner { background: #ecfdf5; border: 1px solid #a7f3d0; padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; }
.delivery-box { background: #f8fafc; border: 1px dashed var(--border); border-radius: 8px; padding: .75rem; margin-bottom: .5rem; }

/* ---------- Delivery queue ---------- */
.delivery-row { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.delivery-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; justify-content: flex-end; max-width: 320px; }
.delivery-actions .form-control-sm { max-width: 150px; }
@media (max-width: 768px) { .delivery-row { flex-direction: column; } .delivery-actions { justify-content: flex-start; } }

/* ---------- Notifications feed ---------- */
.notif-feed { list-style: none; margin: 0; padding: 0; }
.notif-feed-item { display: flex; gap: .75rem; padding: .85rem 1rem; border-bottom: 1px solid var(--border); cursor: pointer; }
.notif-feed-item:last-child { border-bottom: none; }
.notif-feed-item:hover { background: #f8fafc; }
.notif-feed-item.unread { background: #f0fdf4; }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; background: transparent; margin-top: .35rem; flex: 0 0 auto; }
.notif-feed-item.unread .notif-dot { background: var(--brand-accent); }
.notif-body { flex: 1; }

/* ---------- Bar chart ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: .5rem; height: 180px; padding-top: .5rem; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; }
.bar { width: 70%; background: var(--brand-accent); border-radius: 4px 4px 0 0; min-height: 2px; transition: height .2s ease; }
.bar-col:hover .bar { background: var(--brand); }
.bar-label { font-size: .68rem; color: var(--muted); margin-top: .25rem; }

/* ---------- Settings ---------- */
.settings-list { display: grid; grid-template-columns: 220px 1fr; gap: .35rem 1rem; margin: 0; }
.settings-list dt { color: var(--muted); font-weight: 600; }
.settings-list dd { margin: 0; }
.code-block { background: #0f172a; color: #e2e8f0; padding: 1rem; border-radius: 8px; font-size: .8rem; overflow-x: auto; }
.edit-row { background: #f8fafc; }

/* ---------- Validation ---------- */
.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; font-size: .85rem; }

.blazor-error-boundary {
    background: #b32121; padding: 1rem; color: white; border-radius: 8px;
}
.blazor-error-boundary::after { content: "An error has occurred."; }

.darker-border-checkbox.form-check-input { border-color: #929292; }
