:root {
    --bg: #f4f7fb;
    --bg-soft: #eef6f8;
    --ink: #121826;
    --muted: #64748b;
    --line: #dbe4ee;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-solid: #ffffff;
    --primary: #1477d4;
    --primary-dark: #0f4f93;
    --primary-soft: #e4f2ff;
    --accent: #11a59b;
    --warning: #b7791f;
    --danger: #b42318;
    --success: #087443;
    --shadow: 0 18px 50px rgba(15, 35, 65, 0.12);
    --shadow-soft: 0 10px 30px rgba(15, 35, 65, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    background:
        radial-gradient(circle at 14% 10%, rgba(20, 119, 212, 0.13), transparent 32%),
        radial-gradient(circle at 86% 8%, rgba(17, 165, 155, 0.12), transparent 30%),
        linear-gradient(180deg, #fbfdff 0%, var(--bg) 46%, #eef3f8 100%);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
    line-height: 1.5;
    min-height: 100%;
}

a {
    color: inherit;
}

.topbar {
    align-items: center;
    backdrop-filter: blur(18px);
    background: rgba(255, 255, 255, 0.78);
    border-bottom: 1px solid rgba(219, 228, 238, 0.8);
    display: flex;
    justify-content: space-between;
    min-height: 72px;
    padding: 0 clamp(16px, 4vw, 36px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    align-items: center;
    color: var(--ink);
    display: inline-flex;
    font-size: 18px;
    font-weight: 900;
    gap: 12px;
    letter-spacing: 0;
    text-decoration: none;
}

.brand img {
    background: #ffffff;
    border: 1px solid rgba(219, 228, 238, 0.9);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    height: 44px;
    object-fit: contain;
    padding: 5px;
    width: 44px;
}

.brand-full-logo {
    background-position: left center;
    background-repeat: no-repeat;
    background-size: auto 72px;
    display: inline-block;
    height: 72px;
    width: min(360px, 72vw);
}

.topbar-scan {
    min-height: 72px;
    padding-bottom: 0;
    padding-top: 0;
}

.brand span {
    display: inline-block;
}

nav {
    align-items: center;
    display: flex;
    gap: 8px;
}

nav a {
    border-radius: 7px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
    padding: 9px 11px;
    text-decoration: none;
}

nav a:hover {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.shell {
    margin: 0 auto;
    max-width: 1180px;
    padding: 34px 20px 88px;
}

.hero {
    align-items: center;
    display: grid;
    gap: clamp(28px, 6vw, 72px);
    grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
    min-height: calc(100vh - 120px);
}

.hero-copy {
    max-width: 680px;
    text-align: center;
}

.hero-logo {
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(219, 228, 238, 0.9);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    display: block;
    height: auto;
    margin: 0 auto 26px;
    max-width: 390px;
    padding: 12px;
    width: min(82vw, 390px);
}

.hero h1,
.page-head h1,
.panel h1,
.scan-card h1 {
    font-size: clamp(34px, 6vw, 68px);
    letter-spacing: 0;
    line-height: 0.98;
    margin: 0 0 14px;
}

.hero p {
    color: var(--muted);
    font-size: clamp(18px, 2.4vw, 23px);
    margin-left: auto;
    margin-right: auto;
    max-width: 620px;
}

.hero-device {
    display: grid;
    justify-items: center;
}

.phone-card {
    background: linear-gradient(180deg, #ffffff, #f6faff);
    border: 1px solid rgba(219, 228, 238, 0.92);
    border-radius: 28px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 20px;
    max-width: 340px;
    min-height: 520px;
    padding: 22px;
    place-items: center;
    position: relative;
    width: 100%;
}

.phone-pill {
    background: #dbe4ee;
    border-radius: 99px;
    height: 6px;
    position: absolute;
    top: 14px;
    width: 72px;
}

.phone-card img {
    max-width: 132px;
    width: 82%;
}

.scan-preview {
    background: var(--ink);
    border-radius: 8px;
    color: #ffffff;
    display: grid;
    gap: 6px;
    padding: 18px;
    text-align: center;
    width: 100%;
}

.scan-preview span {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 7px;
    height: 120px;
}

.scan-preview small {
    color: #cbd5e1;
}

.eyebrow {
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    margin: 0 0 8px;
    text-transform: uppercase;
}

.actions,
.section-head,
.page-head {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
}

.actions {
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 24px;
}

.button {
    align-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: 0;
    border-radius: 7px;
    box-shadow: 0 12px 24px rgba(20, 119, 212, 0.22);
    color: #ffffff;
    cursor: pointer;
    display: inline-flex;
    font-size: 15px;
    font-weight: 900;
    justify-content: center;
    min-height: 44px;
    padding: 10px 16px;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.button:hover {
    box-shadow: 0 16px 32px rgba(20, 119, 212, 0.28);
    transform: translateY(-1px);
}

.button.secondary {
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
    color: var(--ink);
}

.button.small {
    box-shadow: none;
    min-height: 34px;
    padding: 7px 11px;
}

.panel,
.card,
.empty,
.scan-card,
.stat-card {
    background: var(--panel);
    border: 1px solid rgba(219, 228, 238, 0.92);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
}

.panel,
.empty,
.scan-card {
    padding: clamp(18px, 3vw, 28px);
}

.panel + .panel,
.grid + .panel,
.empty + .panel {
    margin-top: 22px;
}

.narrow {
    margin: 32px auto;
    max-width: 460px;
}

.narrow h1 {
    text-align: center;
}

.auth-logo {
    display: block;
    height: 74px;
    margin: 0 auto 14px;
    object-fit: contain;
    width: 74px;
}

.demo-logins {
    background: #f8fbfd;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 18px;
    padding: 14px;
}

.demo-logins h2 {
    font-size: 16px;
    margin: 0 0 10px;
}

.demo-logins p {
    margin: 8px 0;
}

.notice {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    color: #065f46;
    font-weight: 800;
    margin-bottom: 18px;
    padding: 13px 15px;
}

.muted {
    color: var(--muted);
}

form {
    display: grid;
    gap: 16px;
}

label {
    color: var(--muted);
    display: grid;
    font-size: 14px;
    font-weight: 800;
    gap: 7px;
}

input,
select,
textarea {
    background: #ffffff;
    border: 1px solid #cfd9e5;
    border-radius: 7px;
    color: var(--ink);
    font: inherit;
    min-height: 44px;
    outline: none;
    padding: 9px 11px;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(20, 119, 212, 0.13);
}

.two-col,
.admin-grid,
.stats-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0 0 18px;
}

.stat-card {
    overflow: hidden;
    padding: 18px;
    position: relative;
}

.stat-card::before {
    background: linear-gradient(180deg, var(--primary), var(--accent));
    content: "";
    height: 100%;
    left: 0;
    position: absolute;
    top: 0;
    width: 4px;
}

.stat-card span {
    color: var(--muted);
    display: block;
    font-size: 13px;
    font-weight: 900;
    margin-bottom: 8px;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    font-size: 34px;
    line-height: 1;
}

.grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    margin-bottom: 22px;
}

.menu-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    margin: 0 0 22px;
}

.menu-card {
    background: var(--panel);
    border: 1px solid rgba(219, 228, 238, 0.92);
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    display: grid;
    gap: 6px;
    padding: 18px;
    text-decoration: none;
}

.menu-card strong {
    font-size: 20px;
}

.menu-card span {
    color: var(--muted);
    font-weight: 700;
}

.card {
    overflow: hidden;
    padding: 18px;
    position: relative;
}

.card-topline {
    background: linear-gradient(90deg, var(--primary), var(--accent));
    height: 4px;
    left: 0;
    position: absolute;
    right: 0;
    top: 0;
}

.card h2 {
    font-size: 20px;
    line-height: 1.15;
    margin: 14px 0 10px;
}

.card p {
    color: var(--muted);
    margin: 4px 0;
}

.avatar,
.scan-photo {
    aspect-ratio: 1;
    border: 3px solid #ffffff;
    border-radius: 8px;
    box-shadow: var(--shadow-soft);
    object-fit: cover;
    width: 104px;
}

.scan-photo {
    display: block;
    margin: 0 auto 18px;
    width: 156px;
}

.placeholder {
    background: linear-gradient(135deg, var(--primary-soft), #d8fbf7);
}

.table-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow-x: auto;
}

table {
    border-collapse: collapse;
    min-width: 780px;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 13px 12px;
    text-align: left;
    vertical-align: middle;
}

tr:last-child td {
    border-bottom: 0;
}

th {
    background: #f8fbfd;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

form.inline {
    align-items: center;
    display: flex;
    gap: 8px;
}

form.inline.compact {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: 120px 140px auto;
}

.form-link,
.card-link,
.table-link {
    color: var(--primary-dark);
    font-weight: 900;
    text-decoration: none;
}

.filter-bar {
    align-items: end;
    display: flex;
    gap: 10px;
    min-width: min(100%, 280px);
}

.filter-bar label {
    min-width: 220px;
}

.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.row-actions form {
    display: inline-flex;
}

.status {
    background: #eef2f7;
    border-radius: 999px;
    color: #334155;
    display: inline-flex;
    font-size: 11px;
    font-weight: 900;
    padding: 5px 9px;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-pending-payment {
    background: #fff7ed;
    color: var(--warning);
}

.status-paid,
.status-packed {
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.status-delivered,
.status-active {
    background: #ecfdf5;
    color: var(--success);
}

.status-cancelled,
.status-disabled {
    background: #fef3f2;
    color: var(--danger);
}

.price-banner {
    align-items: center;
    background: linear-gradient(135deg, var(--ink), #24364f);
    border-radius: 8px;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    padding: 18px;
}

.price-banner span {
    color: #cbd5e1;
    font-weight: 800;
}

.price-banner strong {
    font-size: 26px;
}

.order-lines {
    display: grid;
    gap: 10px;
}

.order-line {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--ink);
    display: grid;
    gap: 12px;
    grid-template-columns: 1fr 110px;
    padding: 14px;
}

.order-line small {
    color: var(--muted);
    display: block;
    font-weight: 700;
}

.labels {
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}

.label {
    align-items: center;
    background: #ffffff;
    border: 1px dashed #94a3b8;
    border-radius: 8px;
    display: grid;
    justify-items: center;
    min-height: 252px;
    padding: 14px 12px;
    text-align: center;
}

.label-mark {
    height: 24px;
    margin: 0 0 6px;
    object-fit: contain;
    width: 24px;
}

.label strong {
    font-size: 15px;
    line-height: 1.2;
    margin-top: 6px;
}

.label span,
.label small {
    color: var(--muted);
    font-size: 11px;
    overflow-wrap: anywhere;
}

.label-qr {
    height: 160px;
    margin: 6px 0;
    width: 160px;
}

.scan-card {
    margin: 32px auto;
    max-width: 540px;
    text-align: center;
}

.scan-page-logo {
    display: block;
    height: 60px;
    margin: 0 auto 22px;
    object-fit: contain;
    width: auto;
}

.scan-logo {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: block;
    height: auto;
    margin: 0 auto 18px;
    max-width: 96px;
    padding: 8px;
    width: 28%;
}

.scan-card dl {
    display: grid;
    gap: 10px;
    margin: 22px 0;
    text-align: left;
}

.scan-card dl div {
    background: #f8fbfd;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
}

dt {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
}

dd {
    margin: 0;
}

.return-note {
    color: var(--primary-dark);
    font-weight: 900;
}

.mobile-nav {
    display: none;
}

@media (max-width: 900px) {
    .hero {
        grid-template-columns: 1fr;
        min-height: auto;
        padding: 22px 0;
    }

    .hero-device {
        display: none;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .topbar {
        min-height: 64px;
    }

    .topbar nav {
        display: none;
    }

    .shell {
        padding: 22px 14px 96px;
    }

    .page-head,
    .actions,
    .section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .button {
        width: 100%;
    }

    .filter-bar,
    .filter-bar label {
        min-width: 0;
        width: 100%;
    }

    .two-col,
    .admin-grid,
    .stats-grid,
    .order-line {
        grid-template-columns: 1fr;
    }

    .stat-card strong {
        font-size: 30px;
    }

    .mobile-nav {
        align-items: center;
        backdrop-filter: blur(18px);
        background: rgba(255, 255, 255, 0.88);
        border: 1px solid rgba(219, 228, 238, 0.95);
        border-radius: 24px;
        bottom: 14px;
        box-shadow: 0 14px 34px rgba(15, 35, 65, 0.18);
        display: grid;
        gap: 4px;
        grid-template-columns: repeat(var(--dock-count, 5), minmax(0, 1fr));
        left: 12px;
        padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
        position: fixed;
        right: 12px;
        z-index: 20;
    }

    .mobile-nav-admin {
        --dock-count: 7;
    }

    .mobile-nav-parent {
        --dock-count: 6;
    }

    .mobile-nav a {
        align-items: center;
        background: transparent;
        border: 0;
        border-radius: 14px;
        color: var(--ink);
        display: grid;
        font-size: 10px;
        font-weight: 900;
        gap: 2px;
        min-height: 48px;
        padding: 5px 4px;
        place-items: center;
        text-align: center;
        text-decoration: none;
    }

    .mobile-nav a span {
        color: var(--primary-dark);
        display: block;
        font-size: 18px;
        line-height: 1;
    }

    .dock-icon {
        border: 2px solid var(--primary-dark);
        border-radius: 6px;
        height: 18px;
        position: relative;
        width: 18px;
    }

    .dock-dashboard::before,
    .dock-orders::before,
    .dock-students::before,
.dock-labels::before,
.dock-tags::before,
.dock-school::before,
.dock-scans::before,
.dock-add::before,
.dock-logout::before {
        content: "";
        position: absolute;
    }

    .dock-dashboard {
        border-top: 0;
        transform: rotate(45deg);
    }

    .dock-dashboard::before {
        background: var(--primary-dark);
        bottom: -5px;
        height: 8px;
        left: 2px;
        transform: rotate(-45deg);
        width: 10px;
    }

    .dock-orders::before {
        background: var(--primary-dark);
        height: 2px;
        left: 3px;
        top: 4px;
        width: 8px;
        box-shadow: 0 5px 0 var(--primary-dark), 0 10px 0 var(--primary-dark);
    }

    .dock-students {
        border-radius: 999px 999px 6px 6px;
    }

    .dock-students::before {
        border: 2px solid var(--primary-dark);
        border-radius: 999px;
        height: 6px;
        left: 4px;
        top: -9px;
        width: 6px;
    }

    .dock-labels::before {
        border: 2px solid var(--primary-dark);
        height: 6px;
        left: 4px;
        top: 4px;
        width: 6px;
    }

    .dock-tags {
        border-radius: 3px;
        transform: rotate(-14deg);
    }

    .dock-tags::before {
        background: var(--primary-dark);
        border-radius: 999px;
        height: 4px;
        right: 2px;
        top: 2px;
        width: 4px;
    }

    .dock-school::before {
        border-bottom: 2px solid var(--primary-dark);
        border-left: 2px solid var(--primary-dark);
        height: 7px;
        left: 3px;
        top: 3px;
        transform: rotate(-45deg);
        width: 9px;
    }

    .dock-scans::before {
        border: 2px solid var(--primary-dark);
        border-radius: 999px;
        height: 6px;
        left: 3px;
        top: 3px;
        width: 6px;
        box-shadow: 7px 7px 0 -2px var(--panel), 7px 7px 0 0 var(--primary-dark);
    }

    .dock-add::before {
        background: var(--primary-dark);
        height: 2px;
        left: 3px;
        top: 6px;
        width: 8px;
        box-shadow: 0 0 0 var(--primary-dark);
    }

    .dock-add::after {
        background: var(--primary-dark);
        content: "";
        height: 8px;
        left: 6px;
        position: absolute;
        top: 3px;
        width: 2px;
    }

    .dock-logout {
        border-left: 0;
        border-radius: 3px;
    }

    .dock-logout::before {
        border-right: 2px solid var(--primary-dark);
        border-top: 2px solid var(--primary-dark);
        height: 7px;
        right: -4px;
        top: 4px;
        transform: rotate(45deg);
        width: 7px;
    }

    form.inline.compact {
        grid-template-columns: 1fr;
    }
}

@media print {
    .topbar,
    .mobile-nav,
    .page-head,
    .stats-grid,
    .admin-grid,
    .panel:has(table),
    .section-head .button {
        display: none;
    }

    body {
        background: #ffffff;
    }

    .shell {
        max-width: none;
        padding: 0;
    }

    .panel {
        border: 0;
        box-shadow: none;
        padding: 0;
    }

    .labels {
        grid-template-columns: repeat(3, 1fr);
    }
}
