:root {
    color-scheme: light;
    --ink: #17211d;
    --muted: #64726c;
    --line: #d9e3dc;
    --surface: #ffffff;
    --soft: #eef5f1;
    --accent: #0f8f61;
    --accent-dark: #087449;
    --warning: #c96f10;
    --danger: #b43131;
    --shadow: 0 18px 60px rgba(16, 39, 30, 0.14);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    color: var(--ink);
    background: #f4f8f5;
}

button,
input {
    font: inherit;
}

.front-body {
    min-height: 100vh;
    color: #f8ddb0;
    background:
        linear-gradient(180deg, #111111 0%, #050505 54%, #090704 100%);
    overflow-x: hidden;
}

.front-body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(90deg, transparent 0, transparent calc(100% - 1px), rgba(214, 158, 61, 0.12) calc(100% - 1px)),
        linear-gradient(180deg, transparent 0, transparent calc(100% - 1px), rgba(214, 158, 61, 0.08) calc(100% - 1px));
    background-size: 42px 42px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 74%);
    opacity: 0.8;
}

.front-body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(135deg, rgba(231, 184, 91, 0.22) 0%, transparent 24%),
        linear-gradient(315deg, rgba(231, 184, 91, 0.12) 0%, transparent 30%),
        linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.72) 100%);
}

.front-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: max(16px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom));
    position: relative;
    z-index: 1;
}

.qr-panel {
    position: relative;
    width: min(100%, 424px);
    min-height: calc(100vh - 38px);
    display: grid;
    align-content: start;
    gap: 16px;
    padding: 18px 18px 16px;
    border: 1px solid transparent;
    border-radius: 30px;
    background:
        linear-gradient(180deg, #101010 0%, #050505 58%, #0b0906 100%) padding-box,
        linear-gradient(145deg, #6b4210 0%, #ffd778 22%, #9b681d 45%, #fff1bd 62%, #7a4d13 100%) border-box;
    box-shadow:
        0 30px 90px rgba(0, 0, 0, 0.72),
        inset 0 0 0 1px rgba(255, 224, 150, 0.12);
    text-align: left;
}

.qr-panel::before {
    content: "";
    position: absolute;
    inset: 8px;
    border: 1px solid rgba(222, 174, 82, 0.23);
    border-radius: 24px;
    pointer-events: none;
}

.qr-panel::after {
    content: "";
    position: absolute;
    left: 26px;
    right: 26px;
    top: 64px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 217, 132, 0.85), transparent);
    pointer-events: none;
}

.front-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 38px;
}

.front-mark {
    display: inline-grid;
    place-items: center;
    min-width: 82px;
    height: 34px;
    padding: 0 12px;
    border: 1px solid #ffe5a0;
    border-radius: 999px;
    color: #080604;
    background: linear-gradient(135deg, #fff4bf 0%, #d89b33 42%, #8d5a16 100%);
    box-shadow:
        0 10px 24px rgba(214, 154, 53, 0.34),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.04em;
}

.front-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 13px;
    border: 1px solid rgba(255, 221, 146, 0.42);
    border-radius: 999px;
    color: #ffd87a;
    background: rgba(0, 0, 0, 0.42);
    font-size: 13px;
    font-weight: 850;
}

.admin-kicker {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    color: var(--accent-dark);
    background: #e0f3e9;
    font-size: 13px;
    font-weight: 700;
}

.front-hero {
    padding: 12px 2px 0;
    text-align: center;
}

.front-eyebrow {
    margin: 0 0 8px;
    color: #b9852a;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.22em;
}

.qr-panel h1 {
    margin: 0;
    color: #f2bf5c;
    background: linear-gradient(180deg, #fff3bd 0%, #e8b44e 36%, #9b6318 72%, #ffe5a0 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 40px;
    line-height: 1.1;
    letter-spacing: 0;
    text-shadow: 0 18px 32px rgba(0, 0, 0, 0.76);
}

.front-lead {
    margin: 12px auto 0;
    max-width: 342px;
    color: rgba(255, 236, 194, 0.72);
    font-size: 15px;
    line-height: 1.66;
}

.qr-stage {
    position: relative;
    margin-top: 0;
    padding: 15px 15px 14px;
    border: 1px solid transparent;
    border-radius: 24px;
    background:
        linear-gradient(180deg, #15120b 0%, #050505 100%) padding-box,
        linear-gradient(135deg, #70450e, #f3c66b 30%, #805315 50%, #ffe7a5 70%, #6d430d) border-box;
    box-shadow:
        inset 0 0 0 1px rgba(255, 226, 154, 0.12),
        0 22px 58px rgba(0, 0, 0, 0.62);
    text-align: center;
}

.qr-stage::before,
.qr-stage::after {
    content: "";
    position: absolute;
    width: 44px;
    height: 44px;
    pointer-events: none;
}

.qr-stage::before {
    top: 9px;
    left: 9px;
    border-top: 2px solid rgba(255, 224, 148, 0.78);
    border-left: 2px solid rgba(255, 224, 148, 0.78);
    border-top-left-radius: 15px;
}

.qr-stage::after {
    right: 9px;
    bottom: 9px;
    border-right: 2px solid rgba(255, 224, 148, 0.78);
    border-bottom: 2px solid rgba(255, 224, 148, 0.78);
    border-bottom-right-radius: 15px;
}

.qr-caption {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    margin-bottom: 12px;
    padding: 0 14px;
    border: 1px solid rgba(255, 220, 142, 0.38);
    border-radius: 999px;
    color: #ffda82;
    background: #050505;
    font-size: 12px;
    font-weight: 950;
    letter-spacing: 0.22em;
}

.qr-wrap {
    width: min(72vw, 276px);
    aspect-ratio: 1;
    margin: 0 auto;
    padding: 10px;
    border-radius: 22px;
    background: #fff;
    border: 10px solid #d7a340;
    box-shadow:
        0 0 0 1px #fff0bd,
        0 16px 34px rgba(0, 0, 0, 0.62),
        0 0 30px rgba(214, 155, 53, 0.22);
}

.qr-wrap img,
.qr-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.assign-line {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 40px;
    margin: 14px auto 0;
    padding: 0 18px;
    border: 1px solid rgba(255, 232, 171, 0.48);
    border-radius: 999px;
    color: #15100a;
    background: linear-gradient(135deg, #fff2bd 0%, #d3952f 48%, #9b651b 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
    font-weight: 850;
}

.assign-line strong {
    color: #080604;
    font-size: 18px;
}

.step-list {
    display: grid;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
    text-align: left;
}

.step-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 56px;
    padding: 11px 12px;
    border: 1px solid rgba(214, 158, 61, 0.5);
    border-radius: 14px;
    background: linear-gradient(180deg, rgba(36, 27, 12, 0.78), rgba(4, 4, 4, 0.88));
    color: #fff0c5;
    box-shadow: inset 0 1px 0 rgba(255, 229, 163, 0.1);
}

.step-list span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    border-radius: 50%;
    color: #080604;
    background: linear-gradient(135deg, #fff1b8 0%, #d3952f 55%, #815011 100%);
    box-shadow: 0 7px 16px rgba(214, 154, 53, 0.25);
    font-size: 12px;
    font-weight: 950;
}

.step-list strong {
    display: block;
    margin-top: 1px;
    color: #ffe19a;
    font-size: 15px;
}

.step-list em {
    display: block;
    margin-top: 4px;
    color: rgba(255, 236, 194, 0.64);
    font-size: 13px;
    font-style: normal;
    line-height: 1.35;
}

.front-note {
    margin: 0;
    padding: 0 2px;
    color: rgba(255, 224, 157, 0.62);
    font-size: 12px;
    line-height: 1.6;
    text-align: center;
}

.empty-panel {
    justify-content: center;
    padding-top: 18vh;
    min-height: 72vh;
}

.admin-body {
    min-height: 100vh;
    background: #f5f7f4;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.login-card {
    width: min(100%, 380px);
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-card h1 {
    margin: 0 0 8px;
    font-size: 26px;
}

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

.login-card label,
.file-field {
    display: grid;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
}

.login-card input[type="text"],
.login-card input[type="password"],
.file-field input {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--ink);
    padding: 10px 12px;
}

.login-card button,
.sticky-actions button {
    width: 100%;
    min-height: 48px;
    border: 0;
    border-radius: 10px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    cursor: pointer;
}

.login-card button:hover,
.sticky-actions button:hover {
    background: var(--accent-dark);
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 24px clamp(16px, 4vw, 44px);
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.86);
    position: sticky;
    top: 0;
    z-index: 5;
    backdrop-filter: blur(14px);
}

.admin-header h1 {
    margin: 9px 0 0;
    font-size: clamp(24px, 4vw, 34px);
    letter-spacing: 0;
}

.logout-link,
.summary-bar a {
    color: var(--accent-dark);
    font-weight: 800;
    text-decoration: none;
}

.admin-shell {
    width: min(1180px, 100%);
    margin: 0 auto;
    padding: 22px clamp(14px, 4vw, 32px) 96px;
}

.alert {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    font-weight: 700;
}

.alert-success {
    color: #075a3c;
    background: #dff4e9;
    border: 1px solid #b8e5ce;
}

.alert-error {
    color: #8d1f1f;
    background: #ffe8e8;
    border: 1px solid #f4c4c4;
}

.summary-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.summary-bar div {
    display: grid;
    gap: 4px;
}

.summary-bar span {
    color: var(--muted);
    font-size: 13px;
}

.summary-bar strong {
    font-size: 20px;
}

.sales-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 14px;
}

.sale-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 12px 30px rgba(16, 39, 30, 0.07);
}

.sale-card-head {
    display: grid;
    gap: 12px;
    margin-bottom: 14px;
}

.sale-card h2 {
    margin: 0 0 6px;
    font-size: 21px;
}

.sale-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.switch,
.remove-field {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.switch input,
.remove-field input,
.weekday-grid input {
    width: 17px;
    height: 17px;
    accent-color: var(--accent);
}

.qr-preview {
    display: grid;
    place-items: center;
    width: 100%;
    aspect-ratio: 1;
    margin-bottom: 14px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.qr-missing {
    color: var(--muted);
    background: var(--soft);
    font-weight: 700;
    text-align: center;
}

.weekday-fieldset {
    min-width: 0;
    margin: 4px 0 14px;
    padding: 0;
    border: 0;
}

.weekday-fieldset legend {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 800;
}

.weekday-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.weekday-grid label {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 36px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: #3d4944;
    font-size: 13px;
    font-weight: 700;
}

.weekday-grid .checked-day {
    border-color: #e6bf7a;
    background: #fff5e1;
    color: #7c4a05;
}

.status-pill {
    margin-top: auto;
    padding: 9px 10px;
    border-radius: 999px;
    text-align: center;
    font-size: 13px;
    font-weight: 850;
}

.status-pill.online {
    color: #075a3c;
    background: #dff4e9;
}

.status-pill.offline {
    color: #7c4a05;
    background: #fff1d6;
}

.sticky-actions {
    position: sticky;
    bottom: 0;
    padding: 14px 0 max(14px, env(safe-area-inset-bottom));
    background: linear-gradient(180deg, rgba(245, 247, 244, 0), #f5f7f4 36%);
}

@media (max-width: 1120px) {
    .sales-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .admin-header {
        align-items: flex-start;
    }

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

    .summary-bar a {
        grid-column: 1 / -1;
    }

    .sales-grid {
        grid-template-columns: 1fr;
    }

    .sale-card {
        border-radius: 14px;
    }
}

@media (max-width: 380px) {
    .qr-panel {
        gap: 14px;
        padding-top: 6px;
    }

    .qr-panel h1 {
        font-size: 32px;
    }

    .front-lead {
        font-size: 14px;
        line-height: 1.62;
    }

    .qr-wrap {
        width: min(68vw, 250px);
    }

    .step-list li {
        min-height: 54px;
        padding: 10px 12px;
    }
}
