:root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1f2430;
    --muted: #6b7380;
    --line: #e8ecf1;
    --blue: #448eff;
    --blue-soft: #eaf2ff;
    --navy: #1c2433;
    --ok: #2f9d6a;
    --ok-soft: #e8f7ef;
    --warn: #d97706;
    --danger: #e25555;
    --shadow: 0 10px 30px rgba(28, 36, 51, 0.06);
    --radius: 18px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

a { color: inherit; text-decoration: none; }

.shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--navy);
    color: #fff;
    padding: 28px 18px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 28px;
}

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    background: var(--blue);
    display: grid;
    place-items: center;
    font-weight: 700;
}

.brand small {
    display: block;
    color: #9aa3b2;
    margin-top: 2px;
}

.nav a {
    display: block;
    padding: 12px 14px;
    border-radius: 12px;
    color: #c5ccd8;
    margin-bottom: 6px;
}

.nav a.active,
.nav a:hover {
    background: rgba(68, 142, 255, 0.18);
    color: #fff;
}

.main {
    padding: 28px 36px 48px;
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 24px;
}

h1 {
    margin: 0 0 6px;
    font-size: 26px;
}

.sub { color: var(--muted); margin: 0; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    background: var(--blue);
    color: #fff;
}

.btn.ghost {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}

.btn.danger {
    background: #fff;
    color: var(--danger);
    border: 1px solid #f3c7c7;
}

.flash {
    padding: 12px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
}

.flash.ok { background: var(--ok-soft); color: var(--ok); }
.flash.err { background: #fdecec; color: var(--danger); }

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

.card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

.card h3 { margin: 0 0 6px; }
.meta { color: var(--muted); font-size: 13px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.chip {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    background: var(--blue-soft);
    color: var(--blue);
}
.chip.off { background: #f1f3f6; color: var(--muted); }

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table th, .table td {
    text-align: left;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}

.table th { color: var(--muted); font-weight: 600; background: #fbfcfd; }
.table tr:last-child td { border-bottom: 0; }
.mono { font-family: Consolas, "Courier New", monospace; }

.form-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.9fr;
    gap: 20px;
}

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password], select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

.seat-picks { display: flex; gap: 10px; }
.seat-picks label {
    flex: 1;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    text-align: center;
    color: var(--text);
    cursor: pointer;
}
.seat-picks input { display: none; }
.seat-picks label:has(input:checked) {
    border-color: var(--blue);
    background: var(--blue-soft);
    color: var(--blue);
    font-weight: 700;
}

.level-legend {
    display: flex;
    gap: 16px;
    margin: 22px 0 12px;
    color: var(--muted);
    font-size: 12px;
}
.level-legend span:nth-child(1)::before,
.level-legend span:nth-child(2)::before,
.level-legend span:nth-child(3)::before {
    content: "";
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 99px;
    margin-right: 6px;
}
.level-legend span:nth-child(1)::before { background: var(--navy); }
.level-legend span:nth-child(2)::before { background: var(--blue); }
.level-legend span:nth-child(3)::before { background: #8aa0c2; }

.level1 {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 4px 14px 10px;
    margin-bottom: 14px;
    background: #fbfcfd;
}
.level1:has(> .level-head input:not(:checked)) .level-body {
    opacity: 0.38;
    pointer-events: none;
}
.level-head {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 0;
    margin: 0;
    color: var(--text);
    cursor: pointer;
}
.level-head.l1 b { font-size: 16px; }
.level-head.l2 { padding: 8px 0 6px; }
.level-head input { margin-top: 4px; }
.level-head span { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }

.level2 {
    margin-left: 8px;
    padding-left: 12px;
    border-left: 2px solid var(--line);
}
.level2:has(> div > .level-head input:not(:checked)) .level3 {
    opacity: 0.4;
    pointer-events: none;
}

.level3 {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 0 0 12px 26px;
}
.level3 label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #fff;
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
}
.level3 label:has(input:checked) {
    border-color: var(--blue);
    background: var(--blue-soft);
    color: var(--blue);
}
.level3 input { margin: 0; }

.feature-seat-count { padding-bottom: 10px; }
.feature-seat-count .seat-picks { margin-top: 4px; }

.hint {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
}

.pid-box {
    margin: 12px 0 4px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--blue-soft);
    display: grid;
    gap: 8px;
}
.pid-box span {
    font-size: 22px;
    font-weight: 700;
    color: var(--blue);
    letter-spacing: 1px;
}
.pid-box code {
    font-size: 12px;
    color: #35598c;
    word-break: break-all;
}

.preview-group {
    margin-top: 14px;
    padding-top: 4px;
    border-top: 1px solid var(--line);
}
.preview-mod {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 10px 0 6px;
}
.preview-mod b { font-size: 14px; }
.preview-mod span { font-size: 12px; white-space: nowrap; }
.preview-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0 8px 2px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}
.preview-row:last-child { border-bottom: 0; }
.preview-row > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}
.preview-row strong { font-weight: 600; }
.preview-row em {
    font-style: normal;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
}
.preview-row > span,
.preview-row > b {
    flex: 0 0 auto;
    padding-top: 1px;
}
.preview-row.dim { opacity: 0.45; }
.on { color: var(--ok); font-weight: 700; }
.off { color: var(--muted); }

.actions { display: flex; gap: 8px; margin-top: 16px; }
.empty { color: var(--muted); padding: 28px; text-align: center; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}
.stat {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}
.stat b {
    display: block;
    font-size: 28px;
    line-height: 1.1;
    margin-bottom: 6px;
}
.stat span { color: var(--muted); font-size: 13px; }
.stat select {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font: inherit;
    background: #fff;
    color: var(--text);
}

.search-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
}
.search-bar input[type=text] { max-width: 360px; }
.search-bar select {
    min-width: 140px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    font: inherit;
    background: #fff;
}

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

.login-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    width: min(760px, 100%);
    min-height: 460px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.login-brand {
    background: var(--navy);
    color: #fff;
    padding: 36px 22px;
    display: flex;
    flex-direction: column;
}

.login-brand .brand {
    padding: 0 8px 24px;
}

.login-brand p {
    margin: 0;
    padding: 0 10px;
    color: #9aa3b2;
    font-size: 13px;
    line-height: 1.6;
}

.login-main {
    padding: 48px 40px;
}

.login-main h1 {
    font-size: 24px;
}

.login-main .form-group {
    margin-bottom: 16px;
}

.login-main .btn {
    width: 100%;
    margin-top: 8px;
    padding: 12px 16px;
}

@media (max-width: 960px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { padding: 16px; }
    .form-grid { grid-template-columns: 1fr; }
    .main { padding: 20px; }
    .login-shell { grid-template-columns: 1fr; min-height: 0; }
    .login-brand { padding: 22px 18px 16px; }
    .login-brand .brand { padding-bottom: 8px; }
    .login-main { padding: 28px 22px 32px; }
}
