/* =============================================================================
   iOS 授权验证系统 —— 后台样式
   设计参考：现代简约扁平管理面板（浅色为主，支持暗色）
   ============================================================================= */

:root {
    --bg:            #f4f6f9;
    --surface:       #ffffff;
    --surface-2:     #fafbfc;
    --sidebar-bg:    #ffffff;
    --border:        #e8ecf1;
    --border-2:      #eef1f5;
    --text:          #1e293b;
    --text-2:        #64748b;
    --text-3:        #94a3b8;
    --brand:         #3b82f6;
    --brand-600:     #2563eb;
    --brand-soft:    #eff5ff;
    --green:         #22c55e;
    --blue:          #3b82f6;
    --gray:          #94a3b8;
    --red:           #ef4444;
    --orange:        #f59e0b;
    --radius:        12px;
    --radius-lg:     16px;
    --shadow:        0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
}

html.dark {
    --bg:            #0f1419;
    --surface:       #171c23;
    --surface-2:     #1d232b;
    --sidebar-bg:    #141920;
    --border:        #262d38;
    --border-2:      #222933;
    --text:          #e6ebf2;
    --text-2:        #94a3b8;
    --text-3:        #64748b;
    --brand-soft:    #1b2537;
    --shadow:        0 1px 2px rgba(0, 0, 0, .3);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body.app-body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background .2s, color .2s;
}

/* 去掉浏览器默认的蓝色聚焦框 */
*:focus { outline: none; }
*:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
::selection { background: #cfe2ff; color: #1e293b; }
html.dark ::selection { background: #1e3a5f; color: #e6ebf2; }

/* 滚动条 */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #d5dbe3; border-radius: 8px; }
html.dark ::-webkit-scrollbar-thumb { background: #333b47; }
::-webkit-scrollbar-track { background: transparent; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }

/* =========================== 布局 =========================== */

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

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

.content {
    flex: 1;
    padding: 18px 20px 8px;
}

.footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 20px 16px;
    color: var(--text-3);
    font-size: 12px;
}
.footer svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }

/* =========================== 侧边栏 =========================== */

.sidebar {
    width: 210px;
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    transition: width .2s ease;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 14px 14px 12px;
    border-bottom: 1px solid var(--border-2);
}

.brand-logo {
    width: 26px; height: 26px;
    flex-shrink: 0;
    border-radius: 7px;
    background: linear-gradient(135deg, #4f9cf9, #2563eb);
    color: #fff;
    display: grid;
    place-items: center;
}
.brand-logo svg { width: 16px; height: 16px; }

.brand-text {
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    background: linear-gradient(90deg, #3b82f6, #6366f1);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-collapse {
    margin-left: auto;
    border: 0;
    background: transparent;
    color: var(--text-3);
    display: grid;
    place-items: center;
    padding: 2px;
    border-radius: 5px;
}
.brand-collapse svg { width: 16px; height: 16px; }
.brand-collapse:hover { color: var(--brand); background: var(--brand-soft); }

.menu {
    flex: 1;
    overflow-y: auto;
    padding: 10px 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 8px 10px;
    border-radius: 9px;
    border: 0;
    background: transparent;
    color: var(--text-2);
    font-size: 13.5px;
    text-align: left;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.menu-item:hover { background: var(--brand-soft); color: var(--brand-600); }
.menu-item.active { background: var(--brand-soft); color: var(--brand-600); font-weight: 600; }

.menu-icon { display: grid; place-items: center; width: 17px; }
.menu-icon .ico { width: 16px; height: 16px; }
.menu-title { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-arrow { display: grid; place-items: center; transition: transform .2s; }
.menu-arrow .ico { width: 14px; height: 14px; }

.menu-children {
    max-height: 0;
    overflow: hidden;
    transition: max-height .25s ease;
    padding-left: 8px;
}
.menu-group.open .menu-children { max-height: 420px; }
.menu-group.open .menu-arrow { transform: rotate(180deg); }

.menu-item.sub { font-size: 13px; padding: 7px 10px; }

.sidebar-foot { padding: 8px; border-top: 1px solid var(--border-2); }

/* 收起状态 */
.app-shell.collapsed .sidebar { width: 62px; }
.app-shell.collapsed .brand-text,
.app-shell.collapsed .menu-title,
.app-shell.collapsed .menu-arrow { display: none; }
.app-shell.collapsed .menu-children { max-height: 0 !important; }
.app-shell.collapsed .menu-item { justify-content: center; }
.app-shell.collapsed .menu-icon { width: auto; }
/* 收起后折叠按钮必须仍然可见（否则无法再展开）：改为上下堆叠居中 */
.app-shell.collapsed .brand {
    flex-direction: column;
    gap: 7px;
    padding: 11px 8px 10px;
}
.app-shell.collapsed .brand-collapse { margin-left: 0; }
.app-shell.collapsed .brand-collapse svg { transform: rotate(180deg); }

.sidebar-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 20, 25, .45);
    z-index: 40;
}

/* =========================== 顶部栏 =========================== */

.topbar {
    height: 50px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 30;
}

.tabs {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-2);
    white-space: nowrap;
    border: 1px solid transparent;
}
.tab:hover { background: var(--surface-2); }
.tab.active {
    color: var(--brand-600);
    background: var(--brand-soft);
    border-color: #d9e7ff;
}
html.dark .tab.active { border-color: #24344d; }
.tab .tab-close {
    display: grid; place-items: center;
    width: 15px; height: 15px;
    border-radius: 50%; border: 0; background: transparent;
    color: inherit; opacity: .5;
}
.tab .tab-close:hover { background: rgba(0,0,0,.08); opacity: 1; }
.tab .tab-close .ico { width: 11px; height: 11px; }

.topbar-right { display: flex; align-items: center; gap: 6px; }

.icon-btn {
    width: 32px; height: 32px;
    display: grid; place-items: center;
    border: 0; background: transparent;
    border-radius: 8px;
    color: var(--text-2);
    transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--brand-600); }
.icon-btn .ico { width: 17px; height: 17px; }

.user-box {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 4px 9px 4px 4px;
    border-radius: 20px;
    background: var(--surface-2);
    cursor: pointer;
    position: relative;
}
.avatar {
    width: 26px; height: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4f9cf9, #2563eb);
    color: #fff;
    display: grid; place-items: center;
    font-size: 12px; font-weight: 600;
}
.user-name { font-size: 13px; font-weight: 600; }

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px); right: 0;
    min-width: 155px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(16,24,40,.10);
    padding: 5px;
    display: none;
    z-index: 50;
}
.user-box.open .user-dropdown { display: block; }
.user-dropdown a {
    display: flex; align-items: center; gap: 8px;
    padding: 7px 9px; border-radius: 8px;
    font-size: 13px; color: var(--text-2);
}
.user-dropdown a:hover { background: var(--brand-soft); color: var(--brand-600); }
.user-dropdown .ico { width: 15px; height: 15px; }

.mobile-only { display: none; }

/* =========================== 卡片 =========================== */

.page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.page-title { font-size: 17px; font-weight: 700; margin: 0 0 2px; }
.page-desc { font-size: 12.5px; color: var(--text-3); margin: 0; }

.welcome {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}
.welcome h2 { margin: 0 0 3px; font-size: 21px; font-weight: 700; }
.welcome p { margin: 0; color: var(--text-3); font-size: 13px; }
.welcome-date {
    display: flex; align-items: baseline; gap: 6px;
    color: var(--text-3); font-size: 13px;
    border-left: 1px solid var(--border); padding-left: 16px;
}
.welcome-date b { font-size: 30px; color: var(--brand); font-weight: 700; line-height: 1; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}
.card + .card { margin-top: 14px; }
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-2);
    flex-wrap: wrap;
}
.card-title { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; margin: 0; }
.card-title .ico { width: 15px; height: 15px; color: var(--brand); }
.card-body { padding: 16px; }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* 统计卡片 */
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 14px 15px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: transform .15s, border-color .15s;
}
.stat:hover { transform: translateY(-1px); border-color: #dbe4ef; }
html.dark .stat:hover { border-color: #2f3949; }

.stat-ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; margin-bottom: 10px; }
.stat-ico .ico { width: 17px; height: 17px; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

.stat-ghost {
    position: absolute;
    right: -6px; bottom: -8px;
    opacity: .07;
    pointer-events: none;
}
.stat-ghost .ico { width: 66px; height: 66px; }

.c-blue   { color: var(--blue);   } .bg-c-blue   { background: #eff5ff; }
.c-green  { color: var(--green);  } .bg-c-green  { background: #eefdf3; }
.c-gray   { color: var(--gray);   } .bg-c-gray   { background: #f1f4f8; }
.c-red    { color: var(--red);    } .bg-c-red    { background: #fef2f2; }
.c-orange { color: var(--orange); } .bg-c-orange { background: #fff8ec; }
.c-purple { color: #8b5cf6;       } .bg-c-purple { background: #f4f1ff; }

html.dark .bg-c-blue   { background: #16243a; }
html.dark .bg-c-green  { background: #10261a; }
html.dark .bg-c-gray   { background: #1f252e; }
html.dark .bg-c-red    { background: #2b1618; }
html.dark .bg-c-orange { background: #2b2113; }
html.dark .bg-c-purple { background: #221b3a; }

/* =========================== 表单 =========================== */

.form-row { margin-bottom: 14px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid-3 { display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0,1fr)); }

.lbl {
    display: block;
    font-size: 12.5px;
    color: var(--text-2);
    margin-bottom: 5px;
    font-weight: 500;
}
.lbl .req { color: var(--red); margin-left: 2px; }

.input, .select, .textarea {
    width: 100%;
    padding: 8px 11px;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font-size: 13.5px;
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 15px; padding-right: 30px; }
html.dark .select { background-color: var(--surface); }
.hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { display: none; }
.switch-track {
    width: 38px; height: 21px; border-radius: 21px;
    background: #d8dee7; position: relative; transition: background .2s;
}
html.dark .switch-track { background: #333b47; }
.switch-track::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 17px; height: 17px; border-radius: 50%;
    background: #fff; transition: transform .2s;
    box-shadow: 0 1px 2px rgba(0,0,0,.18);
}
.switch input:checked + .switch-track { background: var(--brand); }
.switch input:checked + .switch-track::after { transform: translateX(17px); }

.checkbox { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; vertical-align: -2px; }

/* =========================== 按钮 =========================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 9px;
    border: 1px solid transparent;
    background: var(--brand);
    color: #fff;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, opacity .15s, border-color .15s;
    white-space: nowrap;
}
.btn:hover { background: var(--brand-600); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .ico { width: 15px; height: 15px; }

.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: #d7dfe9; color: var(--brand-600); }

.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
html.dark .btn-danger { background: #2b1618; color: #f87171; }

.btn-warn { background: #fff3e0; color: #d97706; }
.btn-warn:hover { background: #ffe9cc; }
html.dark .btn-warn { background: #2b2113; color: #fbbf24; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-sm .ico { width: 13px; height: 13px; }
.btn-block { width: 100%; }

.btn-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* =========================== 表格 =========================== */

.table-wrap { overflow-x: auto; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
    text-align: left;
    padding: 10px 14px;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-2);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border-2);
    white-space: nowrap;
}
table.tbl td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-2);
    color: var(--text);
    vertical-align: middle;
}
table.tbl tbody tr:last-child td { border-bottom: 0; }
table.tbl tbody tr:hover { background: var(--surface-2); }
/* 等宽 / 弱化文本：表格内外通用 */
.mono {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
}
.muted { color: var(--text-3); font-size: 12.5px; }

.empty {
    text-align: center;
    padding: 44px 20px;
    color: var(--text-3);
}
.empty .ico { width: 40px; height: 40px; opacity: .35; margin-bottom: 8px; }

/* 徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
}
.badge-blue   { background: #eff5ff; color: #2563eb; }
.badge-green  { background: #eefdf3; color: #16a34a; }
.badge-gray   { background: #f1f4f8; color: #64748b; }
.badge-red    { background: #fef2f2; color: #dc2626; }
.badge-orange { background: #fff8ec; color: #d97706; }
.badge-purple { background: #f4f1ff; color: #7c3aed; }

html.dark .badge-blue   { background: #16243a; color: #60a5fa; }
html.dark .badge-green  { background: #10261a; color: #4ade80; }
html.dark .badge-gray   { background: #1f252e; color: #94a3b8; }
html.dark .badge-red    { background: #2b1618; color: #f87171; }
html.dark .badge-orange { background: #2b2113; color: #fbbf24; }
html.dark .badge-purple { background: #221b3a; color: #a78bfa; }

.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-online  { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.15); }
.dot-offline { background: var(--gray); }

/* =========================== 分页（居中） =========================== */

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-wrap: wrap;
    padding: 14px;
    border-top: 1px solid var(--border-2);
}
.page-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-2);
    font-size: 12.5px;
}
.page-btn:hover { border-color: var(--brand); color: var(--brand-600); }
.page-active { background: var(--brand); border-color: var(--brand); color: #fff; }
.page-active:hover { color: #fff; }
.page-info { color: var(--text-3); font-size: 12px; margin-right: 6px; }
.page-dots { color: var(--text-3); padding: 0 2px; }

/* =========================== 图表 =========================== */

.chart-ring-wrap { display: flex; align-items: center; justify-content: center; gap: 34px; flex-wrap: wrap; padding: 8px 0; }

.ring {
    width: 172px; height: 172px;
    border-radius: 50%;
    position: relative;
    flex-shrink: 0;
}
.ring::after {
    content: '';
    position: absolute; inset: 33px;
    border-radius: 50%;
    background: var(--surface);
}
.ring-center {
    position: absolute; inset: 0;
    display: grid; place-items: center;
    z-index: 2; text-align: center;
}
.ring-center b { font-size: 22px; font-weight: 700; display: block; line-height: 1.1; }
.ring-center span { font-size: 11.5px; color: var(--text-3); }

.legend { display: flex; flex-direction: column; gap: 11px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend-color { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.legend-name { color: var(--text-2); min-width: 52px; }
.legend-value { font-weight: 600; }

.bar-chart {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    gap: 12px;
    height: 210px;
    padding: 10px 4px 0;
    position: relative;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bar {
    width: 100%;
    max-width: 40px;
    border-radius: 7px 7px 3px 3px;
    background: linear-gradient(180deg, #60a5fa, #3b82f6);
    min-height: 4px;
    position: relative;
    transition: height .4s ease;
}
.bar-col:hover .bar { background: linear-gradient(180deg, #3b82f6, #2563eb); }
.bar-value { font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.bar-label { font-size: 12px; color: var(--text-3); white-space: nowrap; }

.bar-grid {
    position: absolute; inset: 10px 0 32px;
    display: flex; flex-direction: column; justify-content: space-between;
    pointer-events: none;
}
.bar-grid span { border-top: 1px dashed var(--border); width: 100%; }

/* 折线趋势 */
.trend { display: flex; align-items: flex-end; gap: 3px; height: 120px; padding-top: 8px; }
.trend-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; height: 100%; }
.trend-bar { width: 100%; border-radius: 4px 4px 0 0; background: linear-gradient(180deg,#93c5fd,#3b82f6); min-height: 3px; }
.trend-label { font-size: 10px; color: var(--text-3); white-space: nowrap; transform: scale(.92); }

.progress-line { height: 6px; border-radius: 6px; background: var(--border); overflow: hidden; }
.progress-line > i { display: block; height: 100%; background: var(--brand); border-radius: 6px; transition: width .3s; }

/* =========================== 终端日志 =========================== */

.terminal {
    background: #0d1117;
    border-radius: var(--radius);
    padding: 14px 16px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
    font-size: 12.5px;
    line-height: 1.75;
    color: #c9d1d9;
    height: 380px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    border: 1px solid #1f242c;
}
.terminal .ln-ok    { color: #3fb950; }
.terminal .ln-info  { color: #58a6ff; }
.terminal .ln-warn  { color: #d29922; }
.terminal .ln-err   { color: #f85149; }
.terminal .cursor { display: inline-block; width: 7px; height: 14px; background: #58a6ff; vertical-align: -2px; animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* =========================== Flash / Toast / Modal =========================== */

.flash {
    display: flex; align-items: center; gap: 9px;
    padding: 11px 14px;
    border-radius: var(--radius);
    margin-bottom: 14px;
    font-size: 13.5px;
    animation: slideDown .25s ease;
}
.flash .ico { width: 16px; height: 16px; flex-shrink: 0; }
.flash-success { background: #eefdf3; color: #15803d; border: 1px solid #d3f5e0; }
.flash-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fbdcdc; }
html.dark .flash-success { background: #10261a; color: #4ade80; border-color: #1c3b28; }
html.dark .flash-error   { background: #2b1618; color: #f87171; border-color: #4a2124; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } }

.toast-wrap {
    position: fixed; top: 16px; right: 16px;
    display: flex; flex-direction: column; gap: 8px;
    z-index: 200;
}
.toast {
    display: flex; align-items: center; gap: 8px;
    min-width: 200px; max-width: 340px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    box-shadow: 0 8px 24px rgba(16,24,40,.12);
    font-size: 13px;
    animation: slideLeft .22s ease;
}
.toast .ico { width: 16px; height: 16px; flex-shrink: 0; }
.toast-ok  .ico { color: var(--green); }
.toast-err .ico { color: var(--red); }
@keyframes slideLeft { from { opacity: 0; transform: translateX(16px); } }

.modal { display: none; position: fixed; inset: 0; z-index: 300; }
.modal.open { display: block; }
.modal-mask { position: absolute; inset: 0; background: rgba(15,20,25,.45); backdrop-filter: blur(1px); }
.modal-panel {
    position: relative;
    margin: 6vh auto 0;
    width: min(560px, calc(100vw - 32px));
    max-height: 88vh;
    display: flex; flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(16,24,40,.22);
    animation: popIn .2s ease;
    overflow: hidden;
}
.modal-panel.wide { width: min(800px, calc(100vw - 32px)); }
@keyframes popIn { from { opacity: 0; transform: translateY(-10px) scale(.99); } }

.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-2);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid var(--border-2);
}
.modal-foot:empty { display: none; }

/* =========================== 其他 =========================== */

.code-box {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 11px 13px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    word-break: break-all;
    color: var(--text-2);
    position: relative;
}
.copy-btn { position: absolute; top: 7px; right: 7px; }

.tag-list { display: flex; gap: 6px; flex-wrap: wrap; }
.tip {
    display: flex; gap: 9px;
    padding: 11px 13px;
    border-radius: 10px;
    background: var(--brand-soft);
    color: var(--brand-600);
    font-size: 12.5px;
    line-height: 1.7;
}
.tip .ico { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.tip-warn { background: #fff8ec; color: #b45309; }
html.dark .tip-warn { background: #2b2113; color: #fbbf24; }

.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}
.filter-bar .filter-item { min-width: 128px; }
.filter-bar .filter-item.grow { flex: 1; min-width: 180px; }

.card-mono-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 7px;
    max-height: 320px;
    overflow-y: auto;
    padding: 10px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.card-mono-list span {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    padding: 4px 8px;
    background: var(--surface);
    border: 1px solid var(--border-2);
    border-radius: 6px;
    cursor: pointer;
}
.card-mono-list span:hover { border-color: var(--brand); color: var(--brand-600); }

/* =========================== 登录页 =========================== */

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(1100px 500px at 12% -8%, #dbeafe 0%, transparent 58%),
        radial-gradient(900px 460px at 96% 6%, #e0e7ff 0%, transparent 55%),
        var(--bg);
}
html.dark .login-page {
    background:
        radial-gradient(1100px 500px at 12% -8%, #16233a 0%, transparent 58%),
        radial-gradient(900px 460px at 96% 6%, #1e1b3a 0%, transparent 55%),
        var(--bg);
}
.login-card {
    width: min(400px, 100%);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 30px 28px;
    box-shadow: 0 10px 40px rgba(16,24,40,.08);
}
.login-logo {
    width: 46px; height: 46px;
    border-radius: 13px;
    background: linear-gradient(135deg, #4f9cf9, #2563eb);
    color: #fff;
    display: grid; place-items: center;
    margin: 0 auto 14px;
}
.login-logo svg { width: 25px; height: 25px; }
.login-card h1 { font-size: 19px; text-align: center; margin: 0 0 4px; font-weight: 700; }
.login-card .sub { text-align: center; color: var(--text-3); font-size: 12.5px; margin-bottom: 22px; }

/* =========================== 响应式 =========================== */

@media (max-width: 1180px) {
    .grid-6 { grid-template-columns: repeat(3, minmax(0,1fr)); }
}
@media (max-width: 900px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .grid-2 { grid-template-columns: 1fr; }
    .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0; top: 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform .22s ease;
        box-shadow: 4px 0 24px rgba(16,24,40,.10);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-mask.show { display: block; }
    .app-shell.collapsed .sidebar { width: 210px; }
    .mobile-only { display: grid; }
    .content { padding: 14px 14px 6px; }
    .grid-6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .welcome-date { display: none; }
    .user-name { display: none; }
    .welcome h2 { font-size: 18px; }
}
@media (max-width: 520px) {
    .grid-4, .grid-3, .grid-6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .stat-value { font-size: 20px; }
}