/* SCKTV Console UI */
:root {
    --bg: #f6f5ff;
    --surface: #ffffff;
    --surface-soft: #f8faff;
    --line: #e6eaf2;
    --ink: #0f172a;
    --ink-2: #334155;
    --muted: #64748b;
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-soft: #eef2ff;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar: #0b1224;
    --sidebar-2: #111c36;
    --radius: 16px;
    --radius-sm: 12px;
    --shadow: 0 10px 30px rgba(15, 23, 42, .06);
    --shadow-lg: 0 24px 60px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(1100px 600px at 85% -10%, rgba(99, 102, 241, .14), transparent 55%),
        radial-gradient(800px 500px at -10% 100%, rgba(118, 75, 162, .09), transparent 50%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; }

.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 252px;
    z-index: 50;
    display: flex;
    flex-direction: column;
    padding: 20px 14px;
    overflow-y: auto;
    color: #cbd5e1;
    background: linear-gradient(180deg, var(--sidebar) 0%, #0f1a33 55%, var(--sidebar-2) 100%);
    box-shadow: 18px 0 40px rgba(15, 23, 42, .08);
}

.sidebar::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(420px 260px at 20% 0%, rgba(79, 110, 247, .28), transparent 65%);
    pointer-events: none;
}

.sidebar > * { position: relative; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px 22px;
}

.brand-link { display: flex; align-items: center; gap: 12px; min-width: 0; }

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 900;
    color: #fff;
    background: linear-gradient(135deg, #6d8bff, #4f6ef7);
    box-shadow: 0 10px 20px rgba(79, 110, 247, .35);
}

.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy strong { color: #fff; font-size: 17px; letter-spacing: .4px; }
.brand-copy small { color: #94a3b8; font-size: 12px; margin-top: 4px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 4px; padding: 4px 0; }

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: 12px;
    color: #b6c2d9;
    font-size: 14px;
    font-weight: 600;
    transition: background .18s, color .18s;
}

.nav-item svg { width: 20px; height: 20px; opacity: .9; }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }

.nav-item.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(79, 110, 247, .32), rgba(79, 110, 247, .10));
    box-shadow: inset 0 0 0 1px rgba(129, 150, 255, .22);
}

.nav-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 11px;
    bottom: 11px;
    width: 3px;
    border-radius: 999px;
    background: #7d95ff;
    box-shadow: 0 0 12px rgba(125, 149, 255, .8);
}

.sidebar-footer {
    margin-top: auto;
    padding: 18px 10px 6px;
    border-top: 1px solid rgba(148, 163, 184, .14);
}

.system-status { display: flex; align-items: center; gap: 8px; color: #9fb0c9; font-size: 12px; font-weight: 600; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, .12); }
.version { margin-top: 10px; color: #64748b; font-size: 11px; letter-spacing: .3px; }

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(15, 23, 42, .48);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
}

.main-area { margin-left: 252px; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 40;
    min-height: 74px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.icon-btn {
    width: 42px;
    height: 42px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--ink-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: none;
    transition: .18s;
}

.icon-btn:hover { background: var(--surface-soft); border-color: var(--line); color: var(--primary); }
.menu-toggle { display: none; }
.topbar-heading { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topbar-sub { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .6px; text-transform: uppercase; }

.topbar-title {
    margin: 0;
    font-size: 19px;
    line-height: 1.2;
    font-weight: 800;
    color: var(--ink);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-date { font-size: 13px; font-weight: 600; color: var(--muted); padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }

.user-pill {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 5px 12px 5px 6px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #6d8bff, #4f6ef7);
    color: #fff;
    font-size: 13px;
    font-weight: 800;
}

.user-name { font-size: 13px; font-weight: 700; color: var(--ink-2); }

.page-content { width: 100%; max-width: 1440px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin: 0 0 22px; }
.page-head h2 { margin: 0; font-size: 26px; line-height: 1.25; font-weight: 850; letter-spacing: -.3px; }
.page-head .sub { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.65; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }

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

.stat-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform .18s, box-shadow .18s, border-color .18s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(15, 23, 42, .09); border-color: #d5def8; }
.stat-icon { width: 44px; height: 44px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tone-blue { background: #eaf0ff; color: #4f6ef7; }
.tone-violet { background: #f1ecff; color: #7c5cf0; }
.tone-green { background: #e8fbf2; color: #0ea472; }
.tone-amber { background: #fff6e5; color: #d97706; }
.tone-rose { background: #ffedf2; color: #e11d63; }
.stat-meta { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.stat-num { font-size: 30px; line-height: 1.1; font-weight: 900; letter-spacing: -.6px; color: var(--ink); margin: 6px 0 3px; }
.stat-hint { font-size: 12px; color: #94a3b8; }

.dashboard-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: 16px; margin-top: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-title { margin: 0; font-size: 16px; font-weight: 800; color: var(--ink); }
.panel-head .btn { min-height: 36px; padding: 8px 12px; font-size: 13px; box-shadow: none; }

.quick-list { display: grid; gap: 10px; }
.quick-item { display: flex; align-items: center; gap: 13px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); transition: .18s; }
.quick-item:hover { border-color: #cfd9fb; background: #fff; transform: translateX(2px); }
.quick-icon { width: 38px; height: 38px; border-radius: 11px; background: #eaf0ff; color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.quick-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.quick-copy strong { font-size: 14px; color: var(--ink); }
.quick-copy span { font-size: 12px; color: var(--muted); }
.quick-arrow { margin-left: auto; color: #b6c2d9; }

.overview-list { display: grid; gap: 0; }
.overview-row { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid #eef2f7; font-size: 14px; }
.overview-row:last-child { border-bottom: 0; }
.overview-row .k { color: var(--muted); }
.overview-row .v { font-weight: 800; color: var(--ink); }

/* Buttons */
.btn,
button,
input[type=submit] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 10px 16px;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #818cf8, #6366f1);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(99, 102, 241, .24);
    transition: transform .15s, box-shadow .15s, background .15s;
}

.btn:hover,
button:hover { transform: translateY(-1px); box-shadow: 0 12px 24px rgba(99, 102, 241, .3); }
.btn:active,
button:active { transform: translateY(0); }
.btn.secondary { background: #fff; color: var(--primary-dark); border: 1px solid #d9e1fb; box-shadow: 0 4px 10px rgba(15, 23, 42, .03); }
.btn.secondary:hover { background: var(--primary-soft); border-color: #c7d3ff; }

.btn.danger,
.danger {
    background: linear-gradient(135deg, #fb7185, #ef4444) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(239, 68, 68, .20) !important;
}

.btn.block { width: 100%; }

/* Forms */
.form-card,
.search-card,
.bulkbar {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.form-card {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    padding: 22px;
    margin-bottom: 18px;
}

.form-card .field,
.field { display: flex; flex-direction: column; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }

input:not([type=checkbox]):not([type=radio]),
select,
textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid #d9dfeb;
    border-radius: 12px;
    background: var(--surface-soft);
    color: var(--ink);
    font-size: 14px;
    outline: none;
    transition: background .15s, border-color .15s, box-shadow .15s;
}

input:not([type=checkbox]):not([type=radio]):focus,
select:focus,
textarea:focus {
    background: #fff;
    border-color: #93a7ff;
    box-shadow: 0 0 0 4px rgba(79, 110, 247, .12);
}

textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.textarea-codes { min-height: 140px; font-family: Consolas, Monaco, monospace; font-size: 13px; }
.form-card > button { align-self: end; justify-self: start; }

.search-card {
    display: block;
    padding: 14px;
    margin-bottom: 16px;
}

.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filter-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    transition: .18s;
}
.filter-tab:hover { border-color: #c7d3ff; background: var(--primary-soft); color: var(--primary-dark); }
.filter-tab.active { border-color: #c7d3ff; background: var(--primary-soft); color: var(--primary-dark); box-shadow: inset 0 0 0 1px rgba(79, 110, 247, .08); }

.search-row { display: flex; align-items: center; gap: 10px; }
.search-row .status-select {
    width: 80px;
    min-width: 80px;
    height: 42px;
    min-height: 42px;
    flex: 0 0 80px;
    padding: 0 22px 0 10px;
    border: 1px solid #d9dfeb;
    border-radius: 12px;
    background-color: var(--surface-soft);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px 12px;
    color: #334155;
    font-size: 13.5px;
    font-weight: 600;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}
.search-row input[name="q"] { flex: 1; min-width: 0; }
.search-row .btn,
.search-row button { flex-shrink: 0; }

.bulkbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    padding: 12px 16px;
    margin-bottom: 14px;
}

.bulkbar .btn {
    min-height: 34px;
    height: 34px;
    padding: 0 12px;
    border-radius: 10px;
    font-size: 13px;
    gap: 5px;
    box-shadow: none;
}
.bulkbar .btn svg { width: 14px !important; height: 14px !important; }
.bulkbar .check-all { flex-shrink: 0; font-size: 13px; }
.bulkbar .btn { flex-shrink: 0; }
.bulkbar .result-tip {
    flex: 1;
    min-width: 0;
    margin: 0;
    font-size: 12.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: right;
}

.check-all { display: inline-flex; align-items: center; gap: 8px; height: 34px; line-height: 1; font-weight: 700; color: var(--primary-dark); font-size: 13px; }
.check-all input[type=checkbox] { margin: 0; vertical-align: middle; }
input[type=checkbox],
.code-check { width: 18px; height: 18px; accent-color: var(--primary); }
.result-tip { color: var(--muted); font-size: 13px; margin: 8px 2px 10px; }

/* Tables */
.table-wrap {
    overflow: auto;
    margin-bottom: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    -webkit-overflow-scrolling: touch;
}

.table-wrap table { width: 100%; min-width: 760px; border-collapse: collapse; }

.table-wrap th {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    background: #f8faff;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
    text-align: left;
    text-transform: uppercase;
    white-space: nowrap;
}

.table-wrap td {
    padding: 14px 16px;
    border-bottom: 1px solid #eef2f7;
    color: var(--ink-2);
    font-size: 14.5px;
    vertical-align: middle;
}

.table-wrap tr:last-child td { border-bottom: 0; }
.table-wrap tr:hover td { background: #f8faff; }
.pc-table { display: block; }
.pc-table table { min-width: 900px; }

.code-cell,
.code-badge {
    display: inline-flex;
    padding: 7px 10px;
    border: 1px solid #dbe2ff;
    border-radius: 10px;
    background: var(--primary-soft);
    color: #111827;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #4f5ed8;
    font-size: 12.5px;
    font-weight: 800;
    white-space: nowrap;
}

.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.active { background: #e8fbf2; color: #0ea472; }
.pill.unused { background: #e8f2ff; color: #3b82f6; }
.pill.disabled { background: #ffedf2; color: #e11d63; }
.pill.expired { background: #f1f5f9; color: #64748b; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.msg {
    padding: 13px 15px;
    margin: 0 0 16px;
    border: 1px solid #bfdbfe;
    border-radius: 12px;
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 14px;
    line-height: 1.6;
}

.msg.error { border-color: #fecaca; background: #fff1f2; color: #be123c; }

/* Codes page */
.mobile-list { display: none; }
.mobile-code-line {
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) 52px 52px;
    gap: 7px;
    align-items: center;
    padding: 9px;
    margin: 8px 0;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.mobile-code-main {
    display: block;
    padding: 8px;
    border: 1px solid #dce4ff;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-family: Consolas, Monaco, monospace;
    font-size: 12.5px;
    font-weight: 800;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.mobile-check { width: 18px; height: 18px; accent-color: var(--primary); }

.mini-btn {
    min-height: 34px;
    padding: 0 9px;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-dark) !important;
    font-size: 12px;
    font-weight: 700;
    box-shadow: none;
}

.mini-btn.danger { background: #ffedf2 !important; color: #e11d63 !important; box-shadow: none !important; }

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    z-index: 99;
    transform: translateX(-50%);
    padding: 11px 18px;
    border-radius: 999px;
    background: #182033;
    color: #fff;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .2);
    opacity: 0;
    pointer-events: none;
    transition: .2s;
}

.toast.show { opacity: 1; }
input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--primary); }

/* Login */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    background:
        radial-gradient(900px 500px at 12% 8%, rgba(79, 110, 247, .18), transparent 55%),
        radial-gradient(800px 500px at 90% 90%, rgba(16, 185, 129, .10), transparent 55%),
        #eef2fb;
}

.login-shell {
    width: min(1060px, 100%);
    min-height: 620px;
    display: grid;
    grid-template-columns: 1.02fr .98fr;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .7);
    border-radius: 28px;
    background: #fff;
    box-shadow: var(--shadow-lg);
}

.login-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 46px;
    overflow: hidden;
    color: #fff;
    background: linear-gradient(150deg, #0b1224 0%, #14224a 55%, #3f5be0 100%);
}

.login-brand::before {
    content: "";
    position: absolute;
    width: 460px;
    height: 460px;
    right: -190px;
    top: -160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(109, 139, 255, .38), transparent 65%);
}

.login-brand::after {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    left: -150px;
    bottom: -140px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
}

.login-brand > * { position: relative; }
.brand-top { display: flex; align-items: center; gap: 12px; }

.brand-badge {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: linear-gradient(135deg, #7d95ff, #4f6ef7);
    color: #fff;
    font-size: 21px;
    font-weight: 900;
    box-shadow: 0 12px 26px rgba(79, 110, 247, .4);
}

.brand-word { font-size: 18px; font-weight: 800; letter-spacing: 1px; }
.brand-main { margin: 44px 0 34px; }
.brand-kicker { font-size: 11px; font-weight: 800; letter-spacing: 2.2px; color: #9fb6ff; }

.login-brand h1 {
    margin: 16px 0 14px;
    font-size: 36px;
    line-height: 1.22;
    font-weight: 850;
    letter-spacing: -.8px;
}

.login-brand p { margin: 0; max-width: 360px; color: #c7d4f5; font-size: 14px; line-height: 1.75; }
.features { display: grid; gap: 13px; margin: 28px 0 0; padding: 0; list-style: none; }
.features li { display: flex; align-items: center; gap: 10px; color: #dbe5ff; font-size: 13.5px; }
.features svg { flex-shrink: 0; color: #8ea6ff; }
.brand-foot { color: #8fa3cc; font-size: 12px; letter-spacing: 1.2px; }

.login-panel { display: flex; align-items: center; justify-content: center; padding: 46px; }
.login-card { width: 100%; max-width: 380px; }
.login-kicker { font-size: 11px; font-weight: 800; letter-spacing: 1.8px; color: var(--primary); }
.login-card h2 { margin: 10px 0 6px; font-size: 28px; font-weight: 850; letter-spacing: -.5px; }
.login-sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.login-form { display: grid; gap: 16px; }
.login-field { display: grid; gap: 7px; }
.login-field span { font-size: 13px; font-weight: 700; color: var(--ink-2); }

.login-field input {
    min-height: 46px;
    padding: 12px 14px;
    border: 1px solid #d9dfeb;
    border-radius: 12px;
    background: var(--surface-soft);
    font-size: 15px;
    outline: none;
    transition: background .15s, border-color .15s, box-shadow .15s;
}

.login-field input:focus { background: #fff; border-color: #93a7ff; box-shadow: 0 0 0 4px rgba(79, 110, 247, .12); }
.login-form .btn.block { width: 100%; min-height: 46px; margin-top: 4px; font-size: 15px; }
.login-foot { margin: 22px 0 0; color: #94a3b8; font-size: 12px; text-align: center; }

.sidebar-close { display: none; margin-left: auto; color: #cbd5e1; background: rgba(255, 255, 255, .06); }
.sidebar-close:hover { color: #fff; background: rgba(255, 255, 255, .12); }

/* Responsive */
@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-grid { grid-template-columns: 1fr; }
    .sidebar { width: 232px; }
    .main-area { margin-left: 232px; }
}

@media (max-width: 980px) {
    .sidebar { transform: translateX(-100%); transition: transform .22s ease; }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    .sidebar-close { display: inline-flex; }
    .main-area { margin-left: 0; }
    .menu-toggle { display: inline-flex; }
    .topbar { padding: 0 18px; }
    .page-content { padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .user-name { display: none; }
    .user-pill { padding: 4px; }
    .topbar-date { display: none; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .page-actions { width: 100%; }
}

@media (max-width: 760px) {
    .topbar { min-height: 66px; }
    .topbar-title { font-size: 17px; }
    .page-content { padding: 16px; }
    .page-head h2 { font-size: 22px; }
    .form-card { gap: 12px; padding: 16px; }
    .form-card button,
    .form-card > button { grid-column: 1 / -1; width: 100%; }
    .pc-table { display: none !important; }
    .mobile-list { display: block !important; }
    .table-wrap table { min-width: 720px; }
    .bulkbar { align-items: center; }
    .page-actions .btn { flex: 1; }
    .login-page { padding: 18px; }
    .login-shell { grid-template-columns: 1fr; min-height: auto; border-radius: 22px; }
    .login-brand { padding: 26px 26px 22px; }
    .login-brand h1 { font-size: 26px; }
    .login-brand .features,
    .login-brand .brand-foot { display: none; }
    .login-panel { padding: 26px; }
    .login-card { max-width: none; }
}

@media (max-width: 520px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .form-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .topbar-sub { display: none; }
    .topbar { padding: 0 12px; gap: 8px; }
    .page-content { padding: 12px; }
    .page-head { margin-bottom: 16px; }
    .panel { padding: 16px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-icon { width: 38px; height: 38px; border-radius: 11px; }
    .stat-num { font-size: 26px; }
    .stat-label, .stat-hint { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
    .login-page { padding: 10px; }
    .login-shell { border-radius: 18px; }
    .login-brand { padding: 22px; }
    .login-panel { padding: 20px; }
    .mobile-code-line { grid-template-columns: 20px minmax(0, 1fr) 46px 46px; gap: 5px; padding: 7px; }
    .mobile-code-main { font-size: 11.5px; padding: 7px; }
    .mini-btn { font-size: 11px; min-height: 32px; padding: 0 6px; }
}

@media (max-width: 360px) {
    .stats-grid,
    .form-card { grid-template-columns: 1fr; }
}

/* 卡密管理移动端：搜索优先并吸顶，列表其次，生成表单置底 */
@media (max-width: 760px) {
    .codes-layout { display: flex; flex-direction: column; }
    .codes-layout .search-card {
        order: 1;
        position: sticky;
        top: 66px;
        z-index: 20;
        display: block;
    }
    .codes-layout .search-card .search-row { display: flex; }
    .codes-layout .search-card .btn,
    .codes-layout .search-card button { width: auto; flex-shrink: 0; }
    .codes-layout .list-form { order: 2; }
    .codes-layout .generate-card { order: 3; margin-top: 4px; }
    #generate-card { scroll-margin-top: 150px; }
}

/* yunge 风格：手机端卡密卡片 */
.mobile-code-card {
    padding: 14px;
    margin: 10px 0;
    border: 1px solid #e8e6f5;
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 6px 18px rgba(99, 102, 241, .08);
}

.mobile-code-head { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.mobile-code-head .mobile-check { width: 20px; height: 20px; flex-shrink: 0; }
.mobile-code-head .mobile-code-main {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #ddd6fe;
    border-radius: 12px;
    background: #f5f3ff;
    color: #111827;
    font-family: Consolas, Monaco, monospace;
    font-size: 17px;
    font-weight: 800;
    white-space: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}
.mobile-code-head .pill {
    flex-shrink: 0;
    height: 40px;
    min-height: 40px;
    padding: 0 11px;
    justify-content: center;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 800;
    color: #312e81 !important;
}
.mobile-code-head .pill::before { display: none; }
.mobile-code-head .pill.active { background: #a7f3d0; }
.mobile-code-head .pill.unused { background: #bfdbfe; }
.mobile-code-head .pill.disabled { background: #fecdd3; }
.mobile-code-head .pill.expired { background: #e2e8f0; }
.mobile-code-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-top: 10px;
    color: #64748b;
    font-size: 13.5px;
    line-height: 1.5;
}
.mobile-code-meta .dot { width: 3px; height: 3px; border-radius: 50%; background: #cbd5e1; }

.mobile-code-actions-inline { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.mobile-code-actions-inline .mini-btn {
    min-height: 40px;
    height: 40px;
    padding: 0 11px;
    border-radius: 9px;
    font-size: 13.5px;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: #c7d2fe;
    color: #312e81 !important;
}
.mobile-code-actions-inline .mini-btn.secondary { background: #c7d2fe; }
.mobile-code-actions-inline .mini-btn.danger { background: #fecdd3 !important; }

@media (max-width: 760px) {
    .bulkbar { padding: 10px 12px; gap: 6px; align-items: center; flex-wrap: nowrap; }
    .bulkbar .check-all { height: 32px; }
    .bulkbar .btn { height: 32px; min-height: 32px; padding: 0 10px; font-size: 12.5px; }
    .bulkbar .btn svg { width: 13px !important; height: 13px !important; }
    .bulkbar .result-tip { font-size: 12px; }
    .mobile-code-card { padding: 12px; margin: 9px 0; }
    .mobile-code-head .mobile-code-main { padding: 9px 10px; font-size: 17px; }
    .mobile-code-actions-inline { gap: 10px; }
    .mobile-code-actions-inline .mini-btn { min-height: 40px; height: 40px; padding: 0 10px; font-size: 13.5px; }
}
