/* ============================================================
   设计说明
   这是一个"签到+抽奖"活动管理后台,核心动作是办理一张张"入场票"。
   所以整个视觉语言围绕"票根"展开:内容卡片带票根缺口,
   卡片标题下用虚线分割线(像撕票线),活动编号用等宽字体
   排成条形码质感的小票号。除此之外保持克制,不做多余装饰。

   色板:
   --ink      #16202B  侧边栏 / 深色文字
   --surface  #F5F6F8  页面底色
   --card     #FFFFFF  卡片
   --line     #E4E7EC  描边
   --text     #1B2430  正文
   --text-mute#6B7686  次要文字
   --accent   #C8933A  唯一的强调色(奖品金/黄铜),仅用于关键动作
   ============================================================ */

:root {
    --ink: #16202b;
    --ink-soft: #212e3c;
    --surface: #f5f6f8;
    --card: #ffffff;
    --line: #e4e7ec;
    --text: #1b2430;
    --text-mute: #6b7686;
    --accent: #c8933a;
    --accent-hover: #ad7c2c;
    --accent-soft: #f6ead2;
    --success: #2f9e68;
    --danger: #d14343;
    --danger-soft: #fbe9e9;
    --radius: 12px;
    --font-body: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
}

* {
    box-sizing: border-box;
}

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

body {
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
}

a {
    color: var(--accent);
    text-decoration: none;
}
a:hover {
    color: var(--accent-hover);
}

button, input, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
}

/* ---------------- 整体布局 ---------------- */

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

.sidebar {
    width: 220px;
    flex-shrink: 0;
    background: var(--ink);
    color: #cdd4dc;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
}

.sidebar-brand {
    padding: 0 20px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.08);
    margin-bottom: 8px;
}

.sidebar-brand small {
    display: block;
    font-weight: 400;
    font-size: 12px;
    color: #8993a1;
    margin-top: 4px;
    font-family: var(--font-mono);
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-nav li + li {
    border-top: 1px dashed rgba(255,255,255,.06);
}

.sidebar-nav a, .sidebar-nav .nav-disabled {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: #cdd4dc;
    font-size: 13.5px;
}

.sidebar-nav a:hover {
    background: var(--ink-soft);
    color: #fff;
}

.sidebar-nav a.active {
    background: var(--ink-soft);
    color: var(--accent);
    box-shadow: inset 3px 0 0 var(--accent);
}

.sidebar-nav .nav-disabled {
    color: #565f6c;
    cursor: not-allowed;
    justify-content: space-between;
}

.badge-soon {
    font-size: 10px;
    background: rgba(255,255,255,.08);
    color: #9aa3ad;
    padding: 2px 6px;
    border-radius: 999px;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px 0;
    border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer a {
    color: #9aa3ad;
    font-size: 12.5px;
}
.sidebar-footer a:hover { color: #fff; }

.main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.topbar-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.topbar-title h1 {
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}

.activity-code {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-mute);
    background: var(--surface);
    border: 1px solid var(--line);
    padding: 2px 8px;
    border-radius: 999px;
    letter-spacing: .5px;
}

.content {
    padding: 24px 28px 60px;
}

/* ---------------- 按钮 ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-outline {
    background: #fff;
    border-color: var(--line);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent-hover); }

.btn-danger-text {
    background: none;
    border: none;
    color: var(--danger);
    padding: 4px 6px;
}
.btn-danger-text:hover { text-decoration: underline; }

.btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}

/* ---------------- 票根卡片(签名组件) ---------------- */

.ticket-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.ticket-card::before,
.ticket-card::after {
    content: "";
    position: absolute;
    top: 45px;
    width: 18px;
    height: 18px;
    background: var(--surface);
    border-radius: 50%;
    border: 1px solid var(--line);
}
.ticket-card::before { left: -10px; border-right: none; }
.ticket-card::after  { right: -10px; border-left: none; }

.ticket-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
}

.ticket-card-header h2 {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ticket-card-header h2::before {
    content: "";
    width: 3px;
    height: 14px;
    background: var(--accent);
    border-radius: 2px;
}

.ticket-divider {
    border: none;
    border-top: 1px dashed var(--line);
    margin: 0;
}

.ticket-card-body {
    padding: 20px 24px 24px;
}

/* ---------------- 表单 ---------------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 28px;
}

@media (max-width: 760px) {
    .form-grid { grid-template-columns: 1fr; }
}

.field label {
    display: block;
    font-size: 12.5px;
    color: var(--text-mute);
    margin-bottom: 6px;
}

.field input[type=text],
.field input[type=number],
.field input[type=datetime-local],
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 9px 12px;
    background: #fff;
    color: var(--text);
}

.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--accent);
}

.field-hint {
    font-size: 11.5px;
    color: var(--text-mute);
    margin-top: 4px;
}

.char-counter {
    font-family: var(--font-mono);
    font-size: 11.5px;
    color: var(--text-mute);
}

/* ---------------- 开关组 ---------------- */

.switch-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

@media (max-width: 900px) {
    .switch-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .switch-grid { grid-template-columns: 1fr; }
}

.switch-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 16px;
    background: var(--surface);
}

.switch-row .switch-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.switch .slider {
    position: absolute;
    inset: 0;
    background: #d7dce2;
    border-radius: 999px;
    cursor: pointer;
    transition: background .15s ease;
}
.switch .slider::before {
    content: "";
    position: absolute;
    width: 18px;
    height: 18px;
    left: 2px;
    top: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform .15s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.switch input:checked + .slider {
    background: var(--accent);
}
.switch input:checked + .slider::before {
    transform: translateX(18px);
}

/* ---------------- 标签页 ---------------- */

.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 1px solid var(--line);
    background: #fff;
    padding: 0 28px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 14px 6px;
    margin-right: 24px;
    font-size: 14px;
    color: var(--text-mute);
    cursor: pointer;
    position: relative;
    top: 1px;
}

.tab-btn.active {
    color: var(--text);
    font-weight: 600;
    border-bottom: 2px solid var(--accent);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------------- 表格 ---------------- */

table.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th, .data-table td {
    text-align: left;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    font-size: 13.5px;
}
.data-table th {
    color: var(--text-mute);
    font-weight: 500;
    font-size: 12.5px;
}
.data-table tr:last-child td { border-bottom: none; }

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-mute);
}

/* ---------------- 提示条 / toast ---------------- */

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translate(-50%, -12px);
    background: #1b2430;
    color: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
    z-index: 999;
}
.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}
.toast.toast-ok::before { content: "\2713"; color: #4ade80; }
.toast.toast-error::before { content: "\2715"; color: #f87171; }

/* ---------------- 占位页(未开发模块) ---------------- */

.placeholder-box {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-mute);
}
.placeholder-box .badge-soon {
    display: inline-block;
    margin-bottom: 12px;
    padding: 4px 12px;
    font-size: 12px;
}

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

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ink);
    background-image: radial-gradient(circle at 20% 20%, rgba(200,147,58,.12), transparent 40%),
                       radial-gradient(circle at 80% 80%, rgba(200,147,58,.10), transparent 40%);
}

.login-card {
    width: 340px;
    background: #fff;
    border-radius: 14px;
    padding: 32px 28px;
    position: relative;
}

.login-card::before, .login-card::after {
    content: "";
    position: absolute;
    top: 96px;
    width: 20px;
    height: 20px;
    background: var(--ink);
    border-radius: 50%;
}
.login-card::before { left: -10px; }
.login-card::after { right: -10px; }

.login-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 4px;
}
.login-sub {
    font-size: 12.5px;
    color: var(--text-mute);
    margin-bottom: 24px;
}
.login-card .field { margin-bottom: 14px; }
.login-error {
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 12.5px;
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 14px;
}

/* ---------------- 活动列表 ---------------- */

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

.activity-tile {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    transition: border-color .15s ease, transform .15s ease;
}
.activity-tile:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}
.activity-tile::before, .activity-tile::after {
    content: "";
    position: absolute;
    top: 40px;
    width: 16px;
    height: 16px;
    background: var(--surface);
    border-radius: 50%;
    border: 1px solid var(--line);
}
.activity-tile::before { left: -9px; border-right: none; }
.activity-tile::after { right: -9px; border-left: none; }

.activity-tile h3 {
    font-size: 15px;
    margin: 0 0 6px;
}
.activity-tile .activity-code {
    margin-bottom: 10px;
    display: inline-block;
}
.activity-tile .meta {
    font-size: 12.5px;
    color: var(--text-mute);
    line-height: 1.8;
}
.activity-tile .status-dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    margin-right: 5px;
}
.activity-tile.disabled .status-dot { background: #b8bec6; }

.new-activity-tile {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-mute);
    font-size: 13.5px;
    cursor: pointer;
    min-height: 96px;
    background: transparent;
}
.new-activity-tile:hover {
    border-color: var(--accent);
    color: var(--accent-hover);
}

/* ---------------- 上传区 ---------------- */

.upload-zone {
    border: 1px dashed var(--line);
    border-radius: var(--radius);
    text-align: center;
    padding: 32px 20px;
    color: var(--text-mute);
    font-size: 13px;
    cursor: pointer;
    background: var(--surface);
}
.upload-zone:hover { border-color: var(--accent); color: var(--accent-hover); }

.bg-preview-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}
@media (max-width: 760px) {
    .bg-preview-pair { grid-template-columns: 1fr; }
}

.bg-preview {
    aspect-ratio: 16 / 9;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    background-color: var(--surface);
    border: 1px solid var(--line);
    position: relative;
    overflow: hidden;
    margin-bottom: 10px;
}
.bg-preview .bg-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-mute);
    font-size: 12.5px;
}
