:root {
    --brand: #f97316;
    --brand-dark: #ea580c;
    --brand-soft: #fff7ed;
    --brand-line: #fed7aa;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --surface: #ffffff;
    --app-bg: #f8fafc;
    --success: #16a34a;
    --danger: #dc2626;
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    background: var(--app-bg);
    font-family: "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

body {
    margin: 0;
}

button,
a,
input {
    -webkit-tap-highlight-color: transparent;
}

.app-page {
    min-height: 100vh;
    background:
        radial-gradient(circle at 18% 10%, rgba(249, 115, 22, .22), transparent 34%),
        radial-gradient(circle at 88% 0%, rgba(15, 23, 42, .14), transparent 38%),
        linear-gradient(180deg, #fff7ed 0%, #f8fafc 46%, #eef2f7 100%);
    padding: 24px;
}

.app-shell {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
}

.phone-frame {
    position: relative;
    overflow: hidden;
    min-height: calc(100vh - 48px);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .96) 0%, rgba(255, 255, 255, .9) 100%);
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 38px;
    box-shadow:
        0 32px 90px rgba(15, 23, 42, .18),
        0 4px 12px rgba(15, 23, 42, .06);
}

.phone-frame::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 80% 18%, rgba(249, 115, 22, .10), transparent 24%),
        linear-gradient(180deg, rgba(255, 247, 237, .55), transparent 30%);
    pointer-events: none;
}

.app-statusbar {
    position: relative;
    z-index: 2;
    height: 42px;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 0 30px;
    color: rgba(255, 255, 255, .72);
    background: #0f172a;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--brand);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, .18);
}

.app-hero {
    position: relative;
    z-index: 2;
    padding: 28px 30px 32px;
    background:
        linear-gradient(135deg, #0f172a 0%, #1e293b 55%, #f97316 140%);
    color: white;
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
}

.app-hero::after {
    content: "";
    position: absolute;
    right: -80px;
    top: -90px;
    width: 240px;
    height: 240px;
    border-radius: 999px;
    background: rgba(249, 115, 22, .35);
    filter: blur(6px);
}

.compact-hero {
    padding-bottom: 28px;
}

.hero-content {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.eyebrow,
.mini-label {
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.eyebrow {
    color: rgba(255, 255, 255, .72);
    margin-bottom: 7px;
}

.app-hero h1 {
    margin: 0;
    font-size: clamp(28px, 4vw, 42px);
    font-weight: 900;
    letter-spacing: -.04em;
}

.app-hero p {
    margin: 6px 0 0;
    color: rgba(255, 255, 255, .76);
    font-weight: 500;
}

.hero-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: #0f172a;
    text-decoration: none;
    font-weight: 900;
    box-shadow: 0 14px 30px rgba(15, 23, 42, .24);
    white-space: nowrap;
}

.hero-action:hover {
    color: #0f172a;
    background: #ffffff;
}

.app-body {
    position: relative;
    z-index: 2;
    padding: 26px;
}

.capture-form {
    display: grid;
    grid-template-columns: minmax(310px, 420px) 1fr;
    gap: 22px;
    align-items: start;
}

.glass-card {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(226, 232, 240, .95);
    border-radius: 30px;
    box-shadow:
        0 22px 50px rgba(15, 23, 42, .08),
        inset 0 1px 0 rgba(255, 255, 255, .75);
    backdrop-filter: blur(12px);
}

.info-card,
.camera-panel,
.search-panel,
.records-panel {
    padding: 22px;
}

.camera-panel {
    border-color: rgba(254, 215, 170, .95);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 247, 237, .9));
}

.card-title-row,
.search-title-row,
.records-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.mini-label {
    color: var(--brand-dark);
}

.glass-card h2 {
    margin: 4px 0 0;
    font-size: 20px;
    font-weight: 900;
    letter-spacing: -.03em;
}

.mini-chip,
.status-pill,
.soft-pill,
.count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 900;
    white-space: nowrap;
}

.mini-chip,
.status-pill,
.soft-pill,
.count-badge {
    background: var(--brand-soft);
    color: #c2410c;
    border: 1px solid var(--brand-line);
}

.field-stack {
    display: grid;
    gap: 16px;
}

.floating-field label {
    display: block;
    margin: 0 0 8px;
    color: #334155;
    font-weight: 800;
    font-size: 13px;
}

.app-input {
    min-height: 56px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
    font-weight: 700;
    padding: 14px 16px;
    box-shadow: inset 0 1px 0 rgba(15, 23, 42, .02);
}

.app-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 .24rem rgba(249, 115, 22, .14);
}

.field-status {
    min-height: 22px;
    margin-top: 7px;
    font-size: 13px;
}

.status-success {
    color: #15803d;
    font-weight: 800;
}

.status-error {
    color: #b91c1c;
    font-weight: 800;
}

.status-warning {
    color: #b45309;
    font-weight: 800;
}

.camera-title-row {
    margin-bottom: 16px;
}

.camera-stage {
    overflow: hidden;
    border-radius: 28px;
    background: #0f172a;
    border: 1px solid rgba(15, 23, 42, .1);
    box-shadow: 0 24px 50px rgba(15, 23, 42, .15);
}

.stage-topbar {
    height: 38px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 16px;
    color: rgba(255, 255, 255, .68);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
    background: rgba(2, 6, 23, .86);
}

.stage-topbar span:first-child,
.stage-topbar span:last-child {
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .16);
}

.camera-box {
    position: relative;
    overflow: hidden;
    background: #0f172a;
}

.camera-box-hd {
    height: 430px;
}

.captured-box {
    height: 280px;
    border: 1px solid var(--line);
    border-radius: 24px;
    background: #0f172a;
}

.camera-box video,
.camera-box canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    background: #0f172a;
}

.camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: rgba(255, 255, 255, .76);
    text-align: center;
    font-weight: 800;
    background:
        radial-gradient(circle at center, rgba(249, 115, 22, .12), transparent 36%),
        linear-gradient(180deg, #111827, #020617);
}

.placeholder-icon {
    width: 52px;
    height: 52px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .09);
    border: 1px solid rgba(255, 255, 255, .14);
    font-size: 24px;
}

.capture-control-bar {
    display: grid;
    grid-template-columns: .8fr 1.2fr;
    gap: 12px;
    margin: 16px 0 20px;
}

.control-btn {
    min-height: 58px;
    border: 0;
    border-radius: 22px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    box-shadow: 0 14px 28px rgba(15, 23, 42, .12);
    transition: transform .16s ease, box-shadow .16s ease, opacity .16s ease;
}

.control-btn:active,
.save-fab:active,
.search-button:active,
.hero-action:active {
    transform: translateY(1px) scale(.99);
}

.control-btn:disabled,
.save-fab:disabled,
.search-button:disabled {
    opacity: .52;
    box-shadow: none;
}

.secondary-control {
    background: #0f172a;
    color: #ffffff;
}

.primary-control {
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #ffffff;
}

.control-icon {
    font-size: 19px;
}

.shutter-dot {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    background: #ffffff;
    border: 5px solid rgba(255, 255, 255, .42);
    box-shadow: inset 0 0 0 2px var(--brand-dark);
}

.captured-section {
    margin-top: 2px;
}

.captured-title {
    margin-bottom: 10px;
    color: #334155;
    font-weight: 900;
    font-size: 13px;
}

.save-fab {
    width: 100%;
    min-height: 60px;
    border: 0;
    border-radius: 22px;
    margin-top: 16px;
    background: linear-gradient(135deg, #16a34a, #15803d);
    color: #ffffff;
    font-weight: 900;
    letter-spacing: -.01em;
    box-shadow: 0 20px 36px rgba(22, 163, 74, .24);
}

.app-alert {
    border-radius: 20px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid transparent;
    font-weight: 800;
    box-shadow: 0 12px 25px rgba(15, 23, 42, .08);
}

.success-alert {
    color: #166534;
    background: #dcfce7;
    border-color: #bbf7d0;
}

.error-alert {
    color: #991b1b;
    background: #fee2e2;
    border-color: #fecaca;
}

.powered-footer {
    margin-top: 24px;
    padding: 18px 0 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    border-top: 1px solid rgba(226, 232, 240, .86);
}

.powered-footer span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.powered-footer img {
    width: 280px;
    max-width: 86%;
    height: auto;
    filter: drop-shadow(0 10px 18px rgba(15, 23, 42, .08));
}

.btn-orange {
    background: var(--brand);
    color: #ffffff;
    border-color: var(--brand);
    font-weight: 800;
}

.btn-orange:hover {
    background: var(--brand-dark);
    color: #ffffff;
    border-color: var(--brand-dark);
}

/* List page */
.list-frame .app-body {
    padding-top: 22px;
}

.search-panel {
    margin-bottom: 18px;
}

.search-title-row,
.records-header {
    margin-bottom: 14px;
}

.search-input-wrap {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}

.search-button {
    min-height: 56px;
    border: 0;
    border-radius: 18px;
    padding: 0 20px;
    background: linear-gradient(135deg, var(--brand), var(--brand-dark));
    color: #ffffff;
    font-weight: 900;
    box-shadow: 0 14px 28px rgba(249, 115, 22, .2);
}

.clear-link {
    display: inline-flex;
    margin-top: 12px;
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 900;
}

.records-panel {
    overflow: hidden;
}

.premium-table {
    margin: 0;
}

.premium-table thead th {
    background: var(--brand-soft);
    color: #7c2d12;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .06em;
    border-bottom: 1px solid var(--brand-line);
    padding: 14px 12px;
}

.premium-table tbody td {
    border-bottom: 1px solid #f1f5f9;
    padding: 14px 12px;
}

.student-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid var(--brand-line);
    background: #f8fafc;
    box-shadow: 0 12px 22px rgba(15, 23, 42, .10);
}

.mobile-record-list {
    display: none;
}

.photo-record-card {
    display: grid;
    grid-template-columns: 72px 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px;
    border: 1px solid #edf2f7;
    border-radius: 22px;
    background: #ffffff;
    box-shadow: 0 12px 28px rgba(15, 23, 42, .06);
}

.record-photo {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 20px;
    border: 1px solid var(--brand-line);
}

.record-student-no {
    font-weight: 900;
    color: var(--ink);
}

.record-name {
    font-weight: 800;
    color: #334155;
    margin-top: 2px;
}

.record-date {
    font-size: 12px;
    color: var(--muted);
    margin-top: 4px;
}

.record-view-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 14px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    text-decoration: none;
    font-weight: 900;
    border: 1px solid var(--brand-line);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 50px 18px;
    border: 1px dashed #cbd5e1;
    border-radius: 26px;
    background: #f8fafc;
}

.empty-icon {
    width: 62px;
    height: 62px;
    display: grid;
    place-items: center;
    border-radius: 22px;
    background: var(--brand-soft);
    border: 1px solid var(--brand-line);
    font-size: 28px;
    margin-bottom: 14px;
}

.empty-state h3 {
    margin: 0 0 6px;
    font-size: 20px;
    font-weight: 900;
}

.empty-state p {
    color: var(--muted);
    margin-bottom: 18px;
}

/* Mobile app behavior */
@media (max-width: 991.98px) {
    .capture-form {
        grid-template-columns: 1fr;
    }

    .camera-box-hd {
        height: 52vh;
        min-height: 330px;
        max-height: 560px;
    }
}

@media (max-width: 767.98px) {
    html,
    body {
        background: #ffffff;
    }

    .app-page {
        min-height: 100svh;
        padding: 0;
        background: #ffffff;
    }

    .app-shell {
        max-width: none;
    }

    .phone-frame {
        min-height: 100svh;
        border-radius: 0;
        border: 0;
        box-shadow: none;
    }

    .app-statusbar {
        height: calc(30px + env(safe-area-inset-top));
        padding: env(safe-area-inset-top) 18px 0;
    }

    .app-hero {
        position: sticky;
        top: 0;
        z-index: 50;
        padding: 18px 18px 20px;
        border-bottom-left-radius: 28px;
        border-bottom-right-radius: 28px;
        box-shadow: 0 18px 35px rgba(15, 23, 42, .18);
    }

    .app-hero h1 {
        font-size: 26px;
    }

    .app-hero p {
        font-size: 13px;
    }

    .hero-action {
        min-height: 40px;
        padding: 0 14px;
        font-size: 13px;
    }

    .app-body {
        padding: 16px;
        padding-bottom: calc(20px + env(safe-area-inset-bottom));
    }

    .info-card,
    .camera-panel,
    .search-panel,
    .records-panel {
        padding: 16px;
        border-radius: 26px;
    }

    .glass-card h2 {
        font-size: 18px;
    }

    .app-input {
        min-height: 54px;
        border-radius: 17px;
        font-size: 16px;
    }

    .camera-stage {
        border-radius: 26px;
    }

    .camera-box-hd {
        height: 48svh;
        min-height: 315px;
        max-height: 520px;
    }

    .capture-control-bar {
        position: sticky;
        bottom: calc(12px + env(safe-area-inset-bottom));
        z-index: 40;
        grid-template-columns: .82fr 1.18fr;
        padding: 10px;
        margin: 14px -2px 18px;
        border-radius: 26px;
        background: rgba(255, 255, 255, .88);
        border: 1px solid rgba(254, 215, 170, .98);
        box-shadow: 0 22px 44px rgba(15, 23, 42, .20);
        backdrop-filter: blur(16px);
    }

    .control-btn {
        min-height: 56px;
        border-radius: 20px;
        font-size: 15px;
    }

    .captured-box {
        height: 32svh;
        min-height: 230px;
        max-height: 340px;
        border-radius: 24px;
    }

    .save-fab {
        min-height: 58px;
        border-radius: 21px;
    }

    .powered-footer {
        margin-top: 18px;
        padding-bottom: 8px;
    }

    .powered-footer img {
        width: 238px;
    }

    .search-input-wrap {
        grid-template-columns: 1fr;
    }

    .search-button {
        width: 100%;
    }

    .desktop-table-wrap {
        display: none;
    }

    .mobile-record-list {
        display: grid;
        gap: 12px;
    }

    .records-header {
        align-items: flex-start;
    }
}

@media (max-width: 390px) {
    .capture-control-bar {
        grid-template-columns: 1fr;
    }

    .camera-box-hd {
        min-height: 280px;
    }

    .photo-record-card {
        grid-template-columns: 62px 1fr;
    }

    .record-photo {
        width: 62px;
        height: 62px;
        border-radius: 18px;
    }

    .record-view-btn {
        grid-column: 1 / -1;
        width: 100%;
    }
}



.saving-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.saving-card {
    width: 100%;
    max-width: 330px;
    background: #ffffff;
    border-radius: 28px;
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 28px 80px rgba(15, 23, 42, 0.35);
    border: 1px solid rgba(249, 115, 22, 0.18);
}

.saving-spinner {
    width: 58px;
    height: 58px;
    border-radius: 999px;
    border: 5px solid #fed7aa;
    border-top-color: #f97316;
    margin: 0 auto 18px auto;
    animation: savingSpin 0.85s linear infinite;
}

.saving-title {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 6px;
}

.saving-text {
    font-size: 14px;
    color: #64748b;
    line-height: 1.5;
}

@keyframes savingSpin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}