/* ===================================================================
   后台样式
   =================================================================== */

:root {
  --bg: #12101a;
  --panel: #1a1622;
  --panel-2: #211a2b;
  --ink: #f4eef8;
  --muted: #a79fb4;
  --line: #33293f;
  --pink: #f64aab;
  --ok: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body.admin-body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.65 "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

a { color: var(--pink); }

/* --------------------------------------------------------------- 顶栏 */

.admin-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 22px; min-height: 58px;
  background: #171320f2; border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.admin-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; }
.admin-brand img { border-radius: 7px; }
.admin-brand em { font-style: normal; font-size: 11px; color: var(--muted); padding: 2px 7px; border: 1px solid var(--line); border-radius: 999px; }
.admin-topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.admin-topbar-right form { margin: 0; }
.admin-user { color: var(--muted); }
.ghost-link { color: var(--muted); text-decoration: none; }
.ghost-link:hover { color: var(--ink); }
.ghost-button {
  padding: 6px 12px; border-radius: 7px; cursor: pointer;
  background: transparent; border: 1px solid var(--line); color: var(--ink);
  font: inherit; font-size: 13px;
}
.ghost-button:hover { border-color: var(--pink); color: var(--pink); }

/* --------------------------------------------------------------- 布局 */

.admin-shell { display: flex; align-items: flex-start; min-height: calc(100vh - 58px); }
.admin-sidebar {
  position: sticky; top: 58px; flex: 0 0 208px;
  display: grid; gap: 2px; align-content: start;
  padding: 18px 12px; border-right: 1px solid var(--line); min-height: calc(100vh - 58px);
}
.admin-sidebar a {
  display: block; padding: 9px 13px; border-radius: 8px;
  text-decoration: none; color: var(--muted); font-size: 14px; font-weight: 600;
}
.admin-sidebar a:hover { background: #ffffff0d; color: var(--ink); }
.admin-sidebar a.is-active { background: #f64aab1f; color: #ffd0ea; }

.admin-main { flex: 1 1 auto; min-width: 0; padding: 26px clamp(16px, 3vw, 36px) 70px; }
.admin-main.is-full { max-width: 1100px; margin: 0 auto; width: 100%; }
.admin-title { font-size: 24px; margin: 0 0 20px; letter-spacing: -0.3px; }

/* --------------------------------------------------------------- 通用组件 */

.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 20px 22px; margin-bottom: 20px;
}
.panel > h2 { font-size: 16px; margin: 0 0 14px; }
.panel > h2 small { font-weight: 400; color: var(--muted); font-size: 12px; margin-left: 8px; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }

.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; }
.stat b { display: block; font-size: 26px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }

.notice { padding: 11px 16px; border-radius: 10px; margin-bottom: 18px; font-size: 14px; }
.notice-ok { background: #34d3991f; border: 1px solid #34d39955; color: #c7f7e2; }
.notice-error { background: #f871711f; border: 1px solid #f8717155; color: #ffd3d3; }
.notice-info { background: #60a5fa1f; border: 1px solid #60a5fa55; color: #d6e8ff; }

label.field { display: grid; gap: 6px; font-size: 13px; font-weight: 650; color: #e7dced; margin-bottom: 14px; }
label.field > span.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="datetime-local"], input[type="url"], input[type="email"], select, textarea {
  width: 100%; min-width: 0; padding: 9px 11px; border-radius: 8px;
  border: 1px solid var(--line); background: #0e0b14; color: var(--ink);
  font: inherit; font-size: 14px;
}
textarea { resize: vertical; min-height: 90px; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid #ffc4e6; outline-offset: 1px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--pink); }

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  min-height: 38px; padding: 0 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--line); background: #241c2e; color: var(--ink);
  font: inherit; font-size: 14px; font-weight: 700; text-decoration: none;
}
.btn:hover { border-color: var(--pink); }
.btn-primary { background: linear-gradient(105deg, #ed83cb, #f2a28f); color: #241020; border: 0; }
.btn-danger { border-color: #f8717166; color: #ffc9c9; }
.btn-danger:hover { background: #f8717122; border-color: #f87171; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th, table.data td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data th { color: var(--muted); font-size: 12px; letter-spacing: .08em; font-weight: 700; white-space: nowrap; }
table.data tr:hover td { background: #ffffff06; }
table.data td.actions { white-space: nowrap; text-align: right; }
.table-wrap { overflow-x: auto; }

.tag {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11.5px;
  font-weight: 700; background: #ffffff14; border: 1px solid #ffffff1f; color: #efe4f5;
}
.tag-on { background: #34d39922; border-color: #34d39955; color: #b9f5da; }
.tag-off { background: #f8717122; border-color: #f8717155; color: #ffcdcd; }
.tag-warn { background: #fbbf2422; border-color: #fbbf2455; color: #fde8b0; }

.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12.5px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1 1 auto; }

/* --------------------------------------------------------------- 登录 */

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(ellipse at 30% 0, #33213f 0, #14101b 55%, #0e0b13 100%);
}
.login-card {
  width: min(420px, 100%); background: #1b1524; border: 1px solid #3a2f47;
  border-radius: 18px; padding: 30px 28px 26px; box-shadow: 0 30px 60px -30px #000;
}
.login-card h1 { font-size: 22px; margin: 0 0 6px; }
.login-card p.sub { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; }
.login-card .btn { width: 100%; margin-top: 6px; }
.login-foot { margin-top: 18px; font-size: 12.5px; color: var(--muted); text-align: center; }

/* --------------------------------------------------------------- 机票编辑器 */

.ticket-editor { display: grid; grid-template-columns: minmax(0, 1fr) 460px; gap: 20px; align-items: start; }
.ticket-preview-pane { position: sticky; top: 74px; }
.ticket-preview-pane iframe { width: 100%; height: 560px; border: 1px solid var(--line); border-radius: 12px; background: #171021; }
.slot-row { display: grid; grid-template-columns: 130px repeat(6, minmax(0, 1fr)) 64px; gap: 8px; align-items: end; font-size: 12px; }
.slot-row input, .slot-row select { padding: 6px 8px; font-size: 12.5px; }
.slot-row label { display: grid; gap: 3px; font-size: 11px; color: var(--muted); }
.slot-head { display: grid; grid-template-columns: 130px repeat(6, minmax(0, 1fr)) 64px; gap: 8px; font-size: 11px; color: var(--muted); letter-spacing: .06em; padding-bottom: 6px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.field-row { display: grid; grid-template-columns: 90px 1fr 1fr 80px 64px; gap: 8px; align-items: end; margin-bottom: 8px; }

@media (max-width: 980px) {
  .admin-shell { display: block; }
  .admin-sidebar { position: static; display: flex; overflow-x: auto; min-height: 0; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px 12px; }
  .admin-sidebar a { white-space: nowrap; }
  .ticket-editor { grid-template-columns: 1fr; }
  .ticket-preview-pane { position: static; }
  .slot-row, .slot-head { grid-template-columns: 1fr 1fr; }
}
