/* ═══════════════════════════════════════════════════════════
   Theme — url-destroyer · Wax Seal
   Metaphor: each link is a sealed document — opening breaks the seal.
   Primary: #c9403a (wax seal red) | Accent: #4a5590 (indigo ink)
   ═══════════════════════════════════════════════════════════ */

:root {
    /* ── Brand ── */
    --primary: #c9403a;
    --primary-hover: #ac302a;
    --primary-light: rgba(201, 64, 58, 0.08);
    --primary-glow: rgba(201, 64, 58, 0.22);
    --accent: #4a5590;
    --accent-light: rgba(74, 85, 144, 0.08);

    /* ── Semantic ── */
    --success: #2d7d5f;
    --success-light: rgba(45, 125, 95, 0.07);
    --warning: #c8852e;
    --warning-light: rgba(200, 133, 46, 0.07);

    /* ── Background ── */
    --bg: #f6f7fa;
    --bg-alt: #fafbfd;
    --card-bg: #ffffff;
    --sidebar-bg: #141824;

    /* ── Text ── */
    --text: #1c1e26;
    --text-secondary: #5a5d6b;
    --text-muted: #9498a4;
    --text-light: #adb0ba;

    /* ── Border ── */
    --border: #e4e6ed;
    --border-light: #eff0f4;

    /* ── Shadow — layered, refined ── */
    --shadow-xs: 0 1px 2px rgba(20, 24, 36, 0.04);
    --shadow-sm: 0 1px 3px rgba(20, 24, 36, 0.05), 0 1px 2px rgba(20, 24, 36, 0.04);
    --shadow: 0 4px 12px rgba(20, 24, 36, 0.06);
    --shadow-md: 0 8px 24px rgba(20, 24, 36, 0.08);
    --shadow-lg: 0 16px 40px rgba(20, 24, 36, 0.10);
    --shadow-xl: 0 24px 64px rgba(20, 24, 36, 0.15);

    /* ── Radius ── */
    --radius-xs: 4px;
    --radius-sm: 8px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    /* ── Transition ── */
    --transition-fast: 0.15s ease;
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================================================================
   1. RESET & BASE
   ================================================================ */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

::selection {
    background: var(--primary);
    color: #fff;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c8cad2;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8aab4;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, "Noto Sans SC", "PingFang SC",
                 "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

code {
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
    font-size: 0.88em;
    background: #f3f4f8;
    padding: 2px 7px;
    border-radius: var(--radius-xs);
    color: var(--primary);
    word-break: break-all;
}

/* ================================================================
   2. LAYOUT
   ================================================================ */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ================================================================
   3. SIDEBAR
   ================================================================ */
.sidebar {
    width: 268px;
    background:
        linear-gradient(180deg, #141824 0%, #181c2a 40%, #1a1e2e 100%);
    color: var(--text-light);
    padding: 0;
    flex-shrink: 0;
    transition: width var(--transition-slow), padding var(--transition-slow);
    overflow: hidden;
    position: relative;
    z-index: 20;
    box-shadow: 4px 0 32px rgba(14, 16, 24, 0.22);
    display: flex;
    flex-direction: column;
}

.sidebar::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 60% 40% at 15% 20%, rgba(74, 85, 144, 0.06) 0%, transparent 70%),
        radial-gradient(ellipse 50% 35% at 80% 75%, rgba(201, 64, 58, 0.04) 0%, transparent 70%),
        linear-gradient(180deg, rgba(255,255,255,0.015), transparent 12%);
    pointer-events: none;
}

.sidebar::after {
    content: '';
    position: absolute;
    top: 20px;
    bottom: 20px;
    right: 0;
    width: 1px;
    background: linear-gradient(180deg, transparent, rgba(255,255,255,0.05), transparent);
    pointer-events: none;
}

/* ── Logo ── */
.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 800;
    color: #fff;
    padding: 28px 22px 24px;
    letter-spacing: -0.3px;
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.sidebar .logo::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 22px;
    right: 22px;
    height: 1px;
    background: linear-gradient(90deg, rgba(201,64,58,0.55), rgba(74,85,144,0.15), transparent 70%);
    opacity: 0.85;
}

.sidebar .logo span {
    background: linear-gradient(135deg, #fff, #e8d5d3);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar .logo .version {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    margin-left: auto;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

/* ── Nav ── */
.sidebar nav {
    flex: 1;
    padding: 8px 14px;
    position: relative;
    z-index: 1;
    overflow-y: auto;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 15px;
    color: #a4a8b6;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 10px;
    margin-bottom: 3px;
    transition: all var(--transition);
    position: relative;
    letter-spacing: 0.1px;
    border: 1px solid transparent;
    overflow: hidden;
}

.sidebar nav a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 15px;
    right: 15px;
    height: 2px;
    background: var(--primary);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition);
    border-radius: 1px;
    opacity: 0.7;
}

.sidebar nav a .nav-icon {
    width: 22px;
    text-align: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: transform var(--transition);
}

.sidebar nav a:hover {
    background: rgba(255,255,255,0.04);
    color: #d8dae2;
    transform: translateX(3px);
    border-color: rgba(255,255,255,0.04);
}

.sidebar nav a:hover::before {
    transform: scaleX(1);
}

.sidebar nav a:hover .nav-icon {
    transform: scale(1.12);
}

.sidebar nav a.active {
    background: linear-gradient(135deg, rgba(201, 64, 58, 0.14), rgba(74, 85, 144, 0.06));
    color: #fff;
    font-weight: 600;
    border-color: rgba(255,255,255,0.05);
    box-shadow:
        inset 3px 0 0 var(--primary),
        0 6px 18px rgba(14, 16, 22, 0.14);
}

.sidebar nav a.active::before {
    display: none;
}

.sidebar nav a.active::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 12px var(--primary-glow), 0 0 24px rgba(201,64,58,0.12);
}

/* ── Sidebar Footer ── */
.sidebar-footer {
    padding: 16px 18px 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    position: relative;
    z-index: 1;
    flex-shrink: 0;
}

.sidebar-footer::before {
    content: '';
    position: absolute;
    left: 18px;
    right: 18px;
    top: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(255,255,255,0.06), transparent 70%);
}

.sidebar-footer .user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: linear-gradient(135deg, rgba(255,255,255,0.04), rgba(255,255,255,0.015));
    border: 1px solid rgba(255,255,255,0.04);
}

.sidebar-footer .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), #a83a2e);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(201,64,58,0.18);
}

.sidebar-footer .user-name {
    font-size: 13px;
    font-weight: 600;
    color: #d8dae2;
    line-height: 1.3;
}

.sidebar-footer .user-role {
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.3;
}

/* ================================================================
   4. MAIN CONTENT
   ================================================================ */
.main {
    flex: 1;
    padding: 0;
    overflow-x: auto;
    background:
        radial-gradient(circle at 95% 5%, rgba(74, 85, 144, 0.04), transparent 30%),
        radial-gradient(circle at 5% 95%, rgba(201, 64, 58, 0.03), transparent 25%),
        var(--bg);
    min-height: 100vh;
}

.main-inner {
    padding: 32px 36px;
}

.main-inner > * {
    position: relative;
    z-index: 1;
}

.main-shell {
    max-width: 1440px;
    margin: 0 auto;
}

/* ================================================================
   5. TOPBAR
   ================================================================ */
.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 36px;
    position: sticky;
    top: 0;
    z-index: 15;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.85));
    border-bottom: 1px solid rgba(228, 230, 237, 0.8);
    box-shadow: var(--shadow-xs);
}

.topbar::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,64,58,0.12), transparent);
    pointer-events: none;
}

.topbar .breadcrumb {
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar .breadcrumb .breadcrumb-sep {
    color: #c4c6ce;
    font-weight: 400;
}

.topbar .breadcrumb span:last-child {
    color: var(--text);
    font-weight: 700;
}

.topbar-spacer {
    flex: 1 1 auto;
    min-width: 12px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 7px 16px;
    border-radius: 999px;
    border: 1.5px solid #e0e2e8;
    background: rgba(255,255,255,0.65);
    transition: all var(--transition);
    white-space: nowrap;
}

.logout-btn .logout-icon {
    transition: transform var(--transition);
    color: var(--text-muted);
}

.logout-btn:hover {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 14px rgba(201,64,58,0.28);
    transform: translateY(-1px);
}

.logout-btn:hover .logout-icon {
    transform: translateX(2px);
    color: #fff;
}

.logout-btn:active {
    transform: translateY(0);
}

.sidebar-toggle {
    background: #fff;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    color: var(--text-secondary);
    transition: all var(--transition);
    flex-shrink: 0;
}

.sidebar-toggle:hover {
    background: #f6f7fa;
    border-color: #c8cad2;
    color: var(--text);
}

/* ================================================================
   6. PAGE TITLE
   ================================================================ */
.page-title {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 28px;
    color: var(--text);
    letter-spacing: -0.5px;
    line-height: 1.3;
    position: relative;
    display: inline-block;
}

.page-title::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 40%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), transparent);
    border-radius: 2px;
}

/* ================================================================
   7. CARDS
   ================================================================ */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    padding: 28px 30px;
    margin-bottom: 24px;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}

.card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(201,64,58,0.08), transparent);
    pointer-events: none;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
    border-color: rgba(201,64,58,0.06);
}

.card-header {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 9px;
}

.card-header::before {
    content: '';
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, var(--primary), #e0706a);
    border-radius: 2px;
    flex-shrink: 0;
}

.card-header:has(span)::before { display: none; }

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

.kv-table { width: auto; min-width: 360px; border-collapse: collapse; }
.kv-table td { padding: 10px 14px; border-bottom: 1px solid var(--border-light); font-size: 13px; }
.kv-table td:first-child { width: 120px; font-weight: 700; color: var(--text); background: #fafbfd; }

details.card summary { list-style: none; cursor: pointer; }
details.card summary::-webkit-details-marker { display: none; }

.section-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin: -12px 0 20px;
    line-height: 1.5;
}

/* ================================================================
   8. STATS GRID
   ================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.stats-row .stat-card {
    flex: 1 1 0;
    min-width: 160px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    border-top: 4px solid var(--accent);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -30%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--accent-light);
    transition: transform var(--transition-slow);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-top-color: var(--primary);
}

.stat-card:hover::before {
    transform: scale(1.3);
}

.stat-card:nth-child(2) { border-top-color: var(--success); }
.stat-card:nth-child(2)::before { background: var(--success-light); }
.stat-card:nth-child(3) { border-top-color: var(--warning); }
.stat-card:nth-child(3)::before { background: var(--warning-light); }
.stat-card:nth-child(4) { border-top-color: var(--primary); }
.stat-card:nth-child(4)::before { background: var(--primary-light); }
.stat-card:nth-child(5) { border-top-color: #7c4a9e; }
.stat-card:nth-child(5)::before { background: rgba(124, 74, 158, 0.06); }

.stat-card .stat-value {
    font-size: 40px;
    font-weight: 800;
    color: var(--text);
    position: relative;
    z-index: 1;
    letter-spacing: -1.5px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
    font-weight: 500;
    position: relative;
    z-index: 1;
    letter-spacing: 0.2px;
}

/* ================================================================
   9. FORMS
   ================================================================ */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4a4d58;
    margin-bottom: 7px;
    letter-spacing: 0.15px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #dde0e7;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: all var(--transition);
    background: #fafbfd;
    color: var(--text);
}

.form-group input:hover,
.form-group select:hover,
.form-group textarea:hover {
    border-color: #c4c8d2;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    background: #fff;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #b8bcc6;
}

.form-group textarea {
    min-height: 120px;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
    font-size: 13px;
    line-height: 1.6;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 5px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.text-muted {
    font-size: 12px;
    color: var(--text-muted);
}

/* ================================================================
   10. BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    letter-spacing: 0.15px;
    line-height: 1.4;
    white-space: nowrap;
    user-select: none;
    font-family: inherit;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #b33730 100%);
    color: #fff;
    box-shadow: 0 2px 10px rgba(201, 64, 58, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #b33730 0%, #9e2c26 100%);
    box-shadow: 0 6px 20px rgba(201, 64, 58, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0) scale(0.97);
}

.btn-danger {
    background: #d94535;
    color: #fff;
    box-shadow: 0 2px 8px rgba(217, 69, 53, 0.18);
}

.btn-danger:hover {
    background: #c0392b;
    box-shadow: 0 5px 16px rgba(217, 69, 53, 0.28);
}

.btn-sm {
    padding: 7px 14px;
    font-size: 12px;
    border-radius: 6px;
    gap: 5px;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid #dde0e7;
    color: var(--text-secondary);
    font-weight: 500;
}

.btn-outline:hover {
    background: #f6f7fa;
    border-color: #b8bcc6;
    color: var(--text);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 10px;
}

.btn-ghost:hover {
    background: #f3f4f8;
    color: var(--text);
}

/* ================================================================
   11. TABLES
   ================================================================ */
.table-wrap {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    background: #fff;
}

.card > table,
.card > .table-wrap > table {
    margin-top: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    position: sticky;
    top: 0;
    z-index: 2;
}

th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    background: #fafbfd;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-secondary);
    vertical-align: middle;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:nth-child(even) {
    background: #fafbfd;
}

tbody tr:hover {
    background: #f4f5fb;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Empty state */
tbody .empty-row td {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 16px;
    font-size: 14px;
}

.table-actions {
    display: flex;
    flex-wrap: nowrap;   /* 不换行，多个操作按钮保持单行 */
    gap: 6px;
    align-items: center;
    white-space: nowrap;
}

.table-actions form {
    margin: 0;
}

/* 操作区紧凑按钮：比默认 btn-sm 更小巧，保证多按钮单行容纳 */
.table-actions .btn-sm {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 6px;
    line-height: 1.3;
}

/* 重开（正面动作，绿色） */
.btn-reactivate {
    background: linear-gradient(135deg, #2d7d5f 0%, #23915f 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(45, 125, 95, 0.2);
}
.btn-reactivate:hover {
    background: linear-gradient(135deg, #1f6a4e 0%, #1c7d53 100%);
    box-shadow: 0 5px 16px rgba(45, 125, 95, 0.3);
}
.btn-reactivate:active {
    transform: translateY(0) scale(0.97);
}

/* 过期为描边警示（红色边框） */
.btn-danger-outline {
    background: transparent;
    border-color: #c9403a;
    color: #c9403a;
}
.btn-danger-outline:hover {
    background: rgba(201, 64, 58, 0.08);
    border-color: #c9403a;
    color: #c9403a;
}

/* ================================================================
   12. BADGES
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.5;
}

.badge-active {
    background: #e8f5ee;
    color: #1d6b45;
}

.badge-expired {
    background: #fce9e8;
    color: #b0352a;
}

.badge-opened {
    background: #e8f5ee;
    color: #1d6b45;
}

.badge-draft {
    background: #e9eef9;
    color: #3a4f8a;
}

.badge-submitted {
    background: #fef4e2;
    color: #a87020;
}

.badge-submit_expired {
    background: #fce9e8;
    color: #b0352a;
}

.badge-unopened {
    background: #f2f3f6;
    color: #6e707a;
}

/* 永久过期徽章：去圆点、更紧凑 */
.badge-perma {
    background: #eef0f3;
    color: #858995;
    padding: 3px 9px;
    font-size: 11px;
    border-radius: 14px;
    cursor: default;
}
.badge-perma::before {
    content: none;
}

/* ================================================================
   13. ALERTS
   ================================================================ */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius);
    margin-bottom: 22px;
    font-size: 14px;
    font-weight: 500;
    animation: alertIn 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    line-height: 1.5;
}

@keyframes alertIn {
    from {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.alert-info {
    background: #e9f1f8;
    color: #1a4a5e;
    border-left: 4px solid #3b8aab;
}

.alert-success {
    background: #e8f5ee;
    color: #1d5335;
    border-left: 4px solid var(--success);
}

.alert-error {
    background: #fce9e8;
    color: #7a1f1a;
    border-left: 4px solid var(--primary);
}

.alert-icon {
    font-size: 18px;
    flex-shrink: 0;
    margin-top: 1px;
}

/* ================================================================
   14. FILTER BAR
   ================================================================ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    padding: 18px 22px;
    background: #fafbfd;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    margin-bottom: 20px;
}

.filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-bar .filter-group label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.filter-bar .filter-group input,
.filter-bar .filter-group select {
    padding: 8px 12px;
    font-size: 13px;
    border: 1.5px solid #dde0e7;
    border-radius: var(--radius-sm);
    background: #fff;
    min-width: 140px;
}

/* Toolbar / chip group */
.toolbar-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}

.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ================================================================
   15. URL DISPLAY
   ================================================================ */
.url-display {
    background: #f4f5f9;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-family: "SF Mono", "Fira Code", "Cascadia Code", "Consolas", monospace;
    font-size: 13px;
    word-break: break-all;
    border: 1px solid #e8eaf0;
    transition: background var(--transition-fast);
}

.url-display:hover {
    background: #edeef6;
}

/* ================================================================
   16. PAGINATION
   ================================================================ */
.pagination {
    display: flex;
    gap: 5px;
    margin-top: 22px;
    flex-wrap: wrap;
    align-items: center;
}

.pagination a,
.pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1.5px solid #dde0e7;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.pagination a:hover {
    background: #f4f5f9;
    border-color: var(--primary);
    color: var(--primary);
}

.pagination .current {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(201, 64, 58, 0.22);
}

.pagination a.disabled {
    opacity: .45;
    pointer-events: none;
    cursor: not-allowed;
}

/* 分页 + 每页条数选择器 行布局 */
.pagination-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 22px;
}
.pagination-row .pagination { margin-top: 0; }
.per-page {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.per-page-select {
    padding: 6px 10px;
    border: 1.5px solid #dde0e7;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: #fff;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 88px;
}
.per-page-select:hover,
.per-page-select:focus {
    border-color: var(--primary);
    color: var(--primary);
    outline: none;
}
.per-page .text-muted { font-size: 13px; }

/* ================================================================
   17. LOGIN PAGE
   ================================================================ */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(155deg, #0e1018 0%, #151828 35%, #1a1e30 65%, #11131e 100%);
    position: relative;
    overflow: hidden;
}

/* Floating particles */
.login-page::before {
    content: '';
    position: absolute;
    width: 640px;
    height: 640px;
    background: radial-gradient(circle, rgba(201, 64, 58, 0.05) 0%, transparent 60%);
    top: -220px;
    right: -140px;
    border-radius: 50%;
    animation: floatParticle1 14s ease-in-out infinite;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 460px;
    height: 460px;
    background: radial-gradient(circle, rgba(74, 85, 144, 0.04) 0%, transparent 60%);
    bottom: -150px;
    left: -100px;
    border-radius: 50%;
    animation: floatParticle2 18s ease-in-out infinite;
}

@keyframes floatParticle1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(35px, -25px) scale(1.08); }
    66% { transform: translate(-15px, 18px) scale(0.92); }
}

@keyframes floatParticle2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-25px, -30px) scale(1.1); }
}

/* Extra particles */
.login-bg-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.login-bg-particles span {
    position: absolute;
    display: block;
    width: 3px;
    height: 3px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    animation: driftUp linear infinite;
}

@keyframes driftUp {
    0% { transform: translateY(100vh) scale(0); opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { transform: translateY(-100px) scale(1); opacity: 0; }
}

/* Login Card */
.login-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border-radius: var(--radius-xl);
    padding: 48px 42px;
    max-width: 420px;
    width: 92%;
    box-shadow:
        0 32px 100px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(255, 255, 255, 0.12),
        inset 0 1px 0 rgba(255, 255, 255, 0.75);
    position: relative;
    z-index: 1;
    animation: cardEnter 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

@keyframes cardEnter {
    from {
        opacity: 0;
        transform: translateY(28px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Icon ring */
.login-container .login-icon {
    width: 68px;
    height: 68px;
    background: linear-gradient(135deg, var(--primary), #b33730);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 24px;
    box-shadow:
        0 10px 28px rgba(201, 64, 58, 0.28),
        0 0 0 6px rgba(201, 64, 58, 0.05);
    animation: iconPulse 3s ease-in-out infinite;
    position: relative;
}

@keyframes iconPulse {
    0%, 100% { box-shadow: 0 10px 28px rgba(201, 64, 58, 0.28), 0 0 0 6px rgba(201, 64, 58, 0.05); }
    50% { box-shadow: 0 10px 36px rgba(201, 64, 58, 0.36), 0 0 0 14px rgba(201, 64, 58, 0.02); }
}

.login-container h1 {
    text-align: center;
    margin-bottom: 6px;
    font-size: 24px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.3px;
}

.login-container .login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 32px;
    font-weight: 400;
}

.login-container .form-group {
    margin-bottom: 22px;
}

.login-container .form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #4a4d58;
    margin-bottom: 8px;
}

.login-container .form-group input {
    background: #fff;
    border: 2px solid #e0e2ea;
    padding: 13px 16px;
    border-radius: var(--radius);
    font-size: 15px;
    transition: all var(--transition);
}

.login-container .form-group input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.login-container .btn {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    border-radius: var(--radius);
    margin-top: 4px;
    letter-spacing: 0.3px;
}

.login-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.8;
}

/* ================================================================
   18. SIDEBAR COLLAPSED STATE
   ================================================================ */
.sidebar-collapsed .sidebar {
    width: 72px;
}

.sidebar-collapsed .sidebar .logo {
    justify-content: center;
    padding: 22px 8px 18px;
    font-size: 0;
    gap: 0;
}

.sidebar-collapsed .sidebar .logo::before {
    content: '🔗';
    font-size: 22px;
}

.sidebar-collapsed .sidebar .logo::after {
    display: none;
}

.sidebar-collapsed .sidebar .logo span {
    display: none;
}

.sidebar-collapsed .sidebar nav a {
    justify-content: center;
    padding: 13px 8px;
    font-size: 0;
    gap: 0;
    border-radius: var(--radius-sm);
}

.sidebar-collapsed .sidebar nav a::before {
    content: attr(data-icon);
    font-size: 18px;
    bottom: auto;
    left: auto;
    right: auto;
    background: none;
    transform: none;
}

.sidebar-collapsed .sidebar nav a:hover::before {
    transform: none;
}

.sidebar-collapsed .sidebar nav a.active::after {
    top: 8px;
    right: 8px;
    transform: none;
}

/* ================================================================
   19. FORM BUILDER
   ================================================================ */
.field-editor {
    transition: all var(--transition);
}

.field-editor:hover {
    box-shadow: 0 4px 20px rgba(20, 24, 36, 0.06);
    border-color: #c0c4ce !important;
}

.builder-grid {
    grid-template-columns: 1fr 1fr;
}

/* ================================================================
   20. COPY BUTTON
   ================================================================ */
.copy-link-btn {
    transition: all var(--transition-fast);
    opacity: 0.55;
}

.copy-link-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}

.copy-link-btn:active {
    transform: scale(1.35);
}

/* ================================================================
   21. EMPTY STATE
   ================================================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.45;
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
    max-width: 400px;
    margin: 0 auto;
}

/* ================================================================
   22. RESPONSIVE
   ================================================================ */
@media (max-width: 1024px) {
    .main-inner {
        padding: 24px 20px;
    }
    .topbar {
        padding: 14px 20px;
    }
}

@media (max-width: 900px) {
    .breadcrumb {
        display: none;
    }

    .topbar {
        padding: 12px 16px;
        gap: 10px;
    }

    .topbar-actions {
        gap: 8px;
    }
    .builder-grid {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .admin-wrapper {
        flex-direction: column;
    }

    /* Mobile: sidebar becomes top bar */
    .sidebar {
        width: 100%;
        flex-direction: row;
        align-items: center;
        padding: 8px 0;
        box-shadow: 0 2px 16px rgba(0, 0, 0, 0.16);
        overflow: visible;
    }
    .sidebar::before {
        display: none;
    }
    .sidebar .logo {
        padding: 0 16px;
        font-size: 16px;
        flex-shrink: 0;
    }
    .sidebar .logo::after {
        display: none;
    }
    .sidebar nav {
        display: flex;
        flex-direction: row;
        gap: 2px;
        padding: 0 8px;
        overflow-x: auto;
        overflow-y: hidden;
        flex: 1;
    }
    .sidebar nav a {
        padding: 8px 13px;
        white-space: nowrap;
        font-size: 12px;
        border-radius: var(--radius-sm);
        margin-bottom: 0;
        gap: 6px;
    }

    .sidebar-footer {
        display: none;
    }
    .sidebar nav a:hover {
        transform: none;
    }
    .sidebar nav a.active {
        border-radius: var(--radius-sm);
        box-shadow: none;
        border-bottom: 3px solid var(--primary);
        box-shadow: inset 0 -3px 0 var(--primary);
    }
    .sidebar nav a.active::after {
        display: none;
    }

    /* Collapsed sidebar on mobile */
    .sidebar-collapsed .sidebar {
        width: 100%;
        padding: 8px 0;
    }
    .sidebar-collapsed .sidebar .logo {
        font-size: 16px;
    }
    .sidebar-collapsed .sidebar .logo::before {
        display: none;
    }
    .sidebar-collapsed .sidebar .logo span {
        display: inline;
    }
    .sidebar-collapsed .sidebar nav {
        display: flex;
    }
    .sidebar-collapsed .sidebar nav a {
        font-size: 12px;
        padding: 8px 13px;
    }
    .sidebar-collapsed .sidebar nav a::before {
        display: none;
    }

    .main-inner {
        padding: 20px 16px;
    }
    .topbar {
        padding: 12px 16px;
    }
    .page-title {
        font-size: 22px;
        margin-bottom: 20px;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    .stat-card {
        padding: 18px;
    }
    .stat-card .stat-value {
        font-size: 30px;
    }
    .card {
        padding: 20px;
    }
    th, td {
        padding: 10px 10px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .stat-card .stat-value {
        font-size: 26px;
    }
    .btn {
        padding: 9px 16px;
        font-size: 13px;
    }
    th:nth-child(5),
    td:nth-child(5),
    th:nth-child(6),
    td:nth-child(6) {
        display: none;
    }
    .login-container {
        padding: 34px 24px;
    }
    .login-container h1 {
        font-size: 20px;
    }
}

/* ================================================================
   23. REDUCED MOTION
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}
