/* =============================================================
   基础样式：变量、重置、通用组件
   ============================================================= */

:root {
    --bg: #f4f6fa;
    --bg-soft: #eef1f7;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e3e8f0;
    --border-strong: #cfd6e4;
    --text: #1a2233;
    --text-soft: #5a6478;
    --text-muted: #8a94a8;
    --primary: #3d5afe;
    --primary-dark: #2f47d6;
    --primary-soft: #eef1ff;
    --success: #12a675;
    --success-soft: #e6f7f0;
    --warn: #d98b00;
    --warn-soft: #fff6e3;
    --danger: #e04a4a;
    --danger-soft: #fdeceb;
    --seat-empty: #ffffff;
    --seat-taken: #eef2fb;
    --seat-mine: #3d5afe;
    --seat-locked: #f0f1f4;
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --shadow-sm: 0 1px 2px rgba(23, 33, 54, .06);
    --shadow: 0 10px 30px -12px rgba(23, 33, 54, .18);
    --shadow-lg: 0 30px 60px -24px rgba(23, 33, 54, .28);
    --font: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    line-height: 1.6;
    font-size: 15px;
}

h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; }
img { max-width: 100%; display: block; }

.icon { flex: 0 0 auto; vertical-align: -2px; }

.muted { color: var(--text-muted); }
.hidden, .is-hidden { display: none !important; }
[hidden] { display: none !important; }

/* -------------------------------------------------------------
   按钮
   ---------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 20px;
    border-radius: 11px;
    border: 1px solid transparent;
    background: var(--surface-2);
    color: var(--text);
    font-size: 14.5px;
    font-weight: 600;
    cursor: pointer;
    transition: transform .16s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease, opacity .18s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.985); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(135deg, #4c66ff, #3550e8);
    color: #fff;
    box-shadow: 0 10px 24px -12px rgba(61, 90, 254, .85);
}
.btn-primary:hover { box-shadow: 0 14px 28px -12px rgba(61, 90, 254, .9); }
.btn-ghost {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-soft);
}
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); border-color: #f7d4d1; }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-icon-only { padding: 9px; }

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-soft);
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }

/* -------------------------------------------------------------
   表单
   ---------------------------------------------------------- */
.field { display: block; margin-bottom: 16px; }
.field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-soft);
    margin-bottom: 7px;
}
input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 11px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(61, 90, 254, .12);
}
input::placeholder { color: #b3bacb; }
textarea { min-height: 92px; resize: vertical; }

.select-wrap { position: relative; }
.select-wrap select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 40px;
    cursor: pointer;
}
.select-arrow {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.stack-form { display: flex; flex-direction: column; gap: 4px; max-width: 460px; }
.stack-form.compact { max-width: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.form-hint { font-size: 13px; color: var(--text-muted); margin: 6px 0 16px; line-height: 1.75; }

/* -------------------------------------------------------------
   提示条 / 徽标 / 卡片
   ---------------------------------------------------------- */
.notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.6;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.notice .icon { margin-top: 2px; }
.notice-info { background: var(--primary-soft); color: #2c3fa8; border-color: #dfe4ff; }
.notice-warn { background: var(--warn-soft); color: #8a5c00; border-color: #f7e3b8; }
.notice-danger { background: var(--danger-soft); color: #a52a2a; border-color: #f8d5d3; }
.notice-success { background: var(--success-soft); color: #0b7a56; border-color: #cdeee1; }
.notice-action {
    align-items: center;
    background: #fff;
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    transition: border-color .18s ease, transform .18s ease;
}
.notice-action:hover { border-color: var(--primary); transform: translateY(-1px); }
.notice-link { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; color: var(--primary); font-weight: 600; }

.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-soft);
    color: var(--text-soft);
    white-space: nowrap;
}
.pill-success { background: var(--success-soft); color: #0b7a56; }
.pill-warn { background: var(--warn-soft); color: #8a5c00; }
.pill-danger { background: var(--danger-soft); color: #a52a2a; }
.pill-muted { background: var(--bg-soft); color: var(--text-muted); }
.pill-primary { background: var(--primary-soft); color: var(--primary-dark); }

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-style: normal;
    font-weight: 700;
    line-height: 1;
}

.count-pill {
    font-size: 12px;
    color: var(--text-muted);
    background: var(--bg-soft);
    padding: 3px 10px;
    border-radius: 999px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    color: var(--text-muted);
}
.card-label { font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.card-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 4px; }
.card-value { font-size: 20px; font-weight: 700; margin: 2px 0; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.head-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; }

/* -------------------------------------------------------------
   空状态 / 时间线 / 分页
   ---------------------------------------------------------- */
.empty-state {
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
}
.empty-state .icon { color: var(--border-strong); margin-bottom: 10px; }
.empty-state h3 { font-size: 16px; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 13px; margin-bottom: 18px; }

.timeline { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.timeline-item { display: flex; gap: 12px; }
.timeline-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--primary);
    margin-top: 8px;
    flex: 0 0 auto;
    box-shadow: 0 0 0 4px var(--primary-soft);
}
.timeline-title { font-size: 13.5px; font-weight: 600; }
.timeline-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

.pager { display: flex; gap: 8px; justify-content: center; margin-top: 22px; }
.pager-link {
    min-width: 34px; height: 34px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 9px;
    border: 1px solid var(--border);
    color: var(--text-soft);
    font-size: 13px;
    background: var(--surface);
}
.pager-link.is-active { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 700; }

/* -------------------------------------------------------------
   加载动画 / Toast / 弹窗
   ---------------------------------------------------------- */
.spinner {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast-stack {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
    pointer-events: none;
    width: min(92vw, 420px);
}
.toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    background: #1f2a3d;
    color: #fff;
    font-size: 13.5px;
    box-shadow: var(--shadow-lg);
    animation: toastIn .26s ease both;
    pointer-events: auto;
}
.toast.is-out { animation: toastOut .22s ease both; }
.toast-success { background: #0f8f66; }
.toast-error { background: #c53a3a; }
.toast-warn { background: #a8700a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px) scale(.98); } }

.modal-root { position: fixed; inset: 0; z-index: 1500; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-mask { position: absolute; inset: 0; background: rgba(18, 25, 40, .48); backdrop-filter: blur(3px); animation: fadeIn .18s ease both; }
.modal {
    position: relative;
    width: min(100%, 460px);
    max-height: 88vh;
    overflow: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: modalIn .24s cubic-bezier(.2, .9, .3, 1.1) both;
}
.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 6px;
}
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 6px 20px 4px; }
.modal-foot {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 20px 20px;
    flex-wrap: wrap;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------
   响应式
   ---------------------------------------------------------- */
@media (max-width: 640px) {
    body { font-size: 14.5px; }
    .card { padding: 16px; border-radius: 13px; }
    .btn { padding: 10px 16px; }
    .toast-stack { bottom: 18px; }
    .modal { border-radius: 18px; }
    .modal-foot { padding: 14px 16px 18px; }
}
