/* ============================================================
   theme.css — 马卡龙糖果风设计系统
   设计令牌集中在 :root；主题色由 [data-theme] 覆盖；
   深色模式由 [data-mode="dark"] 覆盖。
   ============================================================ */

:root {
    /* 背景与文字 */
    --bg: #FDFBF7;
    --bg-grad: linear-gradient(160deg, #FDFBF7 0%, #FFF5F8 55%, #F8F5FF 100%);
    --card: #FFFFFF;
    --card-soft: rgba(255, 255, 255, .85);
    --ink: #5B4A42;
    --ink-2: #7C6B62;
    --ink-soft: #9C8E85;
    --line: #F0E8E0;
    --thead: #FAF6F0;
    --row-line: #F5EFE8;

    /* 糖果六色（默认 = 少女粉） */
    --c1-light: #FFF0F5; --c1-mid: #FFAFD2; --c1-deep: #F27BA5; --c1-hover: #EE6492;
    --c2-light: #F6F3FF; --c2-mid: #C7CEEA; --c2-deep: #8A93D6; --c2-hover: #7A83CC;
    /* 渐变主色别名（跟随主题变化） */
    --c1: var(--c1-deep); --c2: var(--c2-deep);
    --mint-light: #E8F8F1; --mint-mid: #A8E6CF; --mint-deep: #4FA981;
    --lemon-light: #FFF8E6; --lemon-mid: #FFE8A3; --lemon-deep: #B8860B;
    --blue-light: #E3F2FD; --blue-mid: #BBDEFB; --blue-deep: #3A85BD;

    /* 语义色 */
    --ok-light: #E8F8F1; --ok-deep: #2E7D5B;
    --warn-light: #FFF3E0; --warn-deep: #8B6315;
    --danger-light: #FFECEC; --danger-deep: #B63F49;
    --info-light: #EAF1FF; --info-deep: #3B5BA9;

    /* 形状与阴影 */
    --radius-jelly: 24px 28px 20px 26px;
    --radius-card: 16px;
    --radius-pill: 20px;
    --shadow-candy: 0 8px 32px rgba(242, 123, 165, .13);
    --shadow-pop: 0 16px 48px rgba(242, 123, 165, .20);
    --shadow-sm: 0 4px 14px rgba(157, 120, 140, .08);

    /* 动效 */
    --anim: .3s cubic-bezier(.4, 0, .2, 1);
    --anim-bounce: .4s cubic-bezier(.68, -0.55, .265, 1.55);

    --font: 'Nunito', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Segoe UI', sans-serif;
}

/* ---------- 八套主题配色 ---------- */
[data-theme="pink"]   { --c1-light:#FFF0F5; --c1-mid:#FFAFD2; --c1-deep:#F27BA5; --c1-hover:#EE6492; --c2-light:#F6F3FF; --c2-mid:#C7CEEA; --c2-deep:#8A93D6; --c2-hover:#7A83CC; }
[data-theme="rose"]   { --c1-light:#FFEDED; --c1-mid:#F9B5B5; --c1-deep:#E4585C; --c1-hover:#D64246; --c2-light:#FFF1F0; --c2-mid:#F7CBC8; --c2-deep:#C8726E; --c2-hover:#B85F5B; }
[data-theme="amber"]  { --c1-light:#FFF6E8; --c1-mid:#FFD493; --c1-deep:#E09112; --c1-hover:#C87F08; --c2-light:#FFF9EF; --c2-mid:#F5DFB8; --c2-deep:#B98A3E; --c2-hover:#A3782F; }
[data-theme="mint"]   { --c1-light:#E9F9F1; --c1-mid:#A8E6CF; --c1-deep:#3FA97B; --c1-hover:#2F9168; --c2-light:#EEF9F6; --c2-mid:#BCE4D6; --c2-deep:#5E9E87; --c2-hover:#4E8974; }
[data-theme="teal"]   { --c1-light:#E6F7F6; --c1-mid:#A5DEDA; --c1-deep:#2E9E97; --c1-hover:#228A83; --c2-light:#ECF6F6; --c2-mid:#BFE1DF; --c2-deep:#5A9290; --c2-hover:#4A7F7D; }
[data-theme="indigo"] { --c1-light:#EAF1FF; --c1-mid:#B6CCF7; --c1-deep:#3A6FD8; --c1-hover:#2A5CBF; --c2-light:#EEF2FF; --c2-mid:#C4D0F2; --c2-deep:#6A80BE; --c2-hover:#5A6FAD; }
[data-theme="taro"]   { --c1-light:#F3F0FF; --c1-mid:#C3B8F0; --c1-deep:#7B68C8; --c1-hover:#6A57B7; --c2-light:#F6F4FF; --c2-mid:#D2CBF0; --c2-deep:#8A7DC0; --c2-hover:#796CB0; }
[data-theme="graphite"]{--c1-light:#F3F4F6; --c1-mid:#C8CCD4; --c1-deep:#4A4F58; --c1-hover:#3A3F47; --c2-light:#F5F6F8; --c2-mid:#D5D8DE; --c2-deep:#6E747D; --c2-hover:#5E646C; }

/* ---------- 深色模式 ---------- */
[data-mode="dark"] {
    --bg: #14121A;
    --bg-grad: linear-gradient(160deg, #14121A 0%, #1B1620 55%, #17141F 100%);
    --card: #1E1A26;
    --card-soft: rgba(30, 26, 38, .85);
    --ink: #EFE9EE;
    --ink-2: #CDC3CB;
    --ink-soft: #9A8F99;
    --line: #2E2735;
    --thead: #241F2C;
    --row-line: #292231;
    --c1-light: #2A1F28;
    --c2-light: #241F33;
    --mint-light: #1B2A24;
    --lemon-light: #2A2418;
    --blue-light: #1B2430;
    --ok-light: #1B2A24;
    --warn-light: #2A2418;
    --danger-light: #2E1D20;
    --info-light: #1C2231;
    --shadow-candy: 0 8px 32px rgba(0, 0, 0, .45);
    --shadow-pop: 0 16px 48px rgba(0, 0, 0, .6);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, .35);
    color-scheme: dark;
}

/* ============================================================
   基础
   ============================================================ */
* { box-sizing: border-box; }
html { scroll-padding-top: 96px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.6;
    color: var(--ink);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 800; line-height: 1.35; text-wrap: balance; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
input, textarea { caret-color: var(--c1-deep); }
::placeholder { color: var(--ink-soft) !important; opacity: 1; }
::selection { background: var(--c1-light); color: var(--ink); }
:focus-visible { outline: 3px solid var(--c2-deep); outline-offset: 3px; }
img, svg { vertical-align: middle; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--ink-soft); }
.tiny { font-size: 12px; }
.center { text-align: center; }
.hidden { display: none !important; }

/* 渐变文字 */
.gradient-text, .main-title, .site-name, .stat-value {
    background: linear-gradient(110deg, var(--c1-deep), var(--c2-deep));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: var(--c1-deep);
}

/* ============================================================
   按钮
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 18px; border-radius: 14px; border: 2px solid transparent;
    font-weight: 700; font-size: 13.5px; cursor: pointer; white-space: nowrap;
    transition: all var(--anim); background: var(--card); color: var(--ink-2);
    text-decoration: none; font-family: inherit;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-primary {
    background: linear-gradient(135deg, var(--c1-deep), var(--c2-deep));
    color: #fff; box-shadow: 0 8px 22px rgba(0, 0, 0, .10);
    text-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.btn-primary:hover { box-shadow: 0 12px 30px rgba(0, 0, 0, .14); filter: brightness(1.04); }
.btn-ghost { border-color: var(--line); background: var(--card); color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--c1-mid); color: var(--c1-deep); background: var(--c1-light); }
.btn-soft { background: var(--c1-light); color: var(--c1-deep); border-color: transparent; }
.btn-soft:hover { background: var(--c1-mid); }
.btn-danger { background: var(--card); border-color: var(--danger-light); color: var(--danger-deep); }
.btn-danger:hover { background: var(--danger-light); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 11px; border-width: 1.5px; }
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: 16px; }
.btn-block { width: 100%; }

/* ============================================================
   卡片
   ============================================================ */
.card {
    background: var(--card);
    border: 2px solid var(--line);
    border-radius: var(--radius-jelly);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-pad { padding: 22px 24px; }
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 16px 22px; border-bottom: 2px dashed var(--line); flex-wrap: wrap;
}
.card-head h3 { font-size: 16px; display: flex; align-items: center; gap: 8px; }
.card-head h3 i { color: var(--c1-deep); }
.card-soft { background: var(--card-soft); backdrop-filter: blur(14px); }

/* ============================================================
   表单
   ============================================================ */
.field { margin-bottom: 16px; }
.field > label, .field > .label {
    display: block; font-weight: 700; font-size: 13px; color: var(--ink-2); margin-bottom: 7px;
}
.label .req, .field > label .req { color: var(--danger-deep); margin-left: 3px; }
.input, .select, textarea.input {
    width: 100%; padding: 11px 14px; border-radius: 14px;
    border: 2px solid var(--c1-mid); background: var(--card);
    font-size: 14px; color: var(--ink); outline: none;
    transition: all var(--anim);
}
.input:focus, .select:focus, textarea.input:focus {
    border-color: var(--c1-deep);
    box-shadow: 0 0 0 4px rgba(0, 0, 0, .05);
}
textarea.input { min-height: 92px; resize: vertical; }
select.select { appearance: none; background-image: none; cursor: pointer; }
.hint { color: var(--ink-soft); font-size: 12px; margin-top: 6px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--ink-2); }
.check input { width: 17px; height: 17px; accent-color: var(--c1-deep); }
.row {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.inline { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.field-err { color: var(--danger-deep); font-size: 12.5px; margin-top: 5px; display: none; }

/* ============================================================
   标签 / 徽章
   ============================================================ */
.tag, .chip {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; line-height: 1.8;
}
.tag-brand { background: var(--c1-light); color: var(--c1-deep); }
.tag-ok { background: var(--ok-light); color: var(--ok-deep); }
.tag-warn { background: var(--warn-light); color: var(--warn-deep); }
.tag-danger { background: var(--danger-light); color: var(--danger-deep); }
.tag-info { background: var(--info-light); color: var(--info-deep); }
.tag-off { background: var(--thead); color: var(--ink-soft); }
.chip { background: var(--thead); color: var(--ink-2); font-weight: 600; }

/* ============================================================
   表格
   ============================================================ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
    background: var(--thead); color: var(--ink-soft); font-weight: 700; text-align: left;
    padding: 11px 14px; white-space: nowrap; border-bottom: 1px solid var(--line);
}
table.tb td { padding: 12px 14px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
table.tb tbody tr { transition: background var(--anim); }
table.tb tbody tr:hover td { background: var(--c1-light); }
table.tb tr:last-child td { border-bottom: 0; }
.htable td:first-child { color: var(--ink-soft); width: 150px; white-space: nowrap; }

/* ============================================================
   提示条
   ============================================================ */
.alert {
    display: flex; gap: 9px; align-items: flex-start;
    padding: 12px 16px; border-radius: 14px; font-size: 13.5px; margin-bottom: 16px;
    border: 2px solid transparent;
}
.alert-err { background: var(--danger-light); color: var(--danger-deep); border-color: var(--danger-light); }
.alert-ok { background: var(--ok-light); color: var(--ok-deep); border-color: var(--ok-light); }
.alert-info { background: var(--info-light); color: var(--info-deep); border-color: var(--info-light); }
.alert-warn { background: var(--warn-light); color: var(--warn-deep); border-color: var(--warn-light); }

/* ============================================================
   弹窗（站内自定义，不用浏览器 alert/confirm）
   ============================================================ */
.dlg-mask {
    position: fixed; inset: 0; background: rgba(60, 40, 60, .38);
    backdrop-filter: blur(3px); z-index: 3000;
    display: none; align-items: flex-start; justify-content: center;
    padding: 6vh 16px; overflow: auto;
}
.dlg-mask.show { display: flex; }
.dlg {
    background: var(--card); border-radius: 24px; width: 100%; max-width: 560px;
    box-shadow: 0 24px 70px rgba(90, 50, 90, .28);
    animation: dlgIn .22s cubic-bezier(.34, 1.56, .64, 1);
    position: relative; border: 2px solid var(--line);
}
.dlg.wide { max-width: 820px; }
@keyframes dlgIn { from { opacity: 0; transform: translateY(-14px) scale(.98); } to { opacity: 1; transform: none; } }
.dlg-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 2px dashed var(--line);
}
.dlg-head h3 { font-size: 16px; }
.dlg-x {
    border: 0; background: transparent; font-size: 18px; color: var(--ink-soft);
    cursor: pointer; line-height: 1; padding: 5px 9px; border-radius: 10px;
}
.dlg-x:hover { background: var(--c1-light); color: var(--c1-deep); }
.dlg-body { padding: 20px 22px; max-height: 66vh; overflow: auto; }
.dlg-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 14px 22px; border-top: 2px dashed var(--line); background: var(--thead);
    border-radius: 0 0 22px 22px;
}
.confirm-text { font-size: 14px; color: var(--ink-2); line-height: 1.8; }

/* toast */
.toast-wrap {
    position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
    z-index: 4000; display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.toast {
    padding: 11px 20px; border-radius: 14px; background: var(--ink); color: #fff;
    font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-pop);
    animation: toastIn .24s cubic-bezier(.34, 1.56, .64, 1); max-width: 86vw;
}
.toast.err { background: var(--danger-deep); }
.toast.ok { background: var(--ok-deep); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; transform: none; } }

/* ============================================================
   分页
   ============================================================ */
.pager { display: flex; gap: 6px; justify-content: flex-end; padding: 16px 22px; flex-wrap: wrap; }
.pager a, .pager span {
    padding: 6px 13px; border-radius: 11px; border: 2px solid var(--line);
    font-size: 13px; font-weight: 600; color: var(--ink-2); background: var(--card);
}
.pager a:hover { border-color: var(--c1-mid); color: var(--c1-deep); }
.pager .cur { background: linear-gradient(135deg, var(--c1-deep), var(--c2-deep)); border-color: transparent; color: #fff; }

/* ============================================================
   空状态 / 加载
   ============================================================ */
.empty { text-align: center; padding: 44px 16px; color: var(--ink-soft); }
.empty .big { font-size: 34px; margin-bottom: 8px; opacity: .55; }
.loading-spinner {
    width: 26px; height: 26px; border-radius: 50%; margin: 24px auto;
    border: 3px solid var(--c1-mid); border-top-color: var(--c1-deep);
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   工具栏（列表页）
   ============================================================ */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 120px; padding: 8px 12px; font-size: 13px; border-radius: 12px; }
.toolbar input[type=text] { min-width: 190px; }

/* ============================================================
   统计卡
   ============================================================ */
.grid-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.stat {
    position: relative; background: var(--card); border: 2px solid var(--line);
    border-radius: 18px; padding: 16px 18px; box-shadow: var(--shadow-sm); overflow: hidden;
    transition: transform var(--anim), box-shadow var(--anim);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-candy); }
.stat .k { color: var(--ink-soft); font-size: 12.5px; font-weight: 600; }
.stat .v { font-size: 25px; font-weight: 800; margin-top: 3px; color: var(--ink); }
.stat .ic {
    position: absolute; right: 12px; top: 12px; width: 34px; height: 34px; border-radius: 12px 14px 10px 13px;
    display: grid; place-items: center; background: var(--c1-light); color: var(--c1-deep); font-size: 15px;
    transform: rotate(-3deg);
}

/* 布局网格 */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 12px; gap: 12px; flex-wrap: wrap; }
.section-title h3 { font-size: 15.5px; }
.section-title .muted { font-size: 12.5px; }
.split { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.quick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.quick a {
    display: flex; align-items: center; gap: 10px; padding: 12px 14px;
    border: 2px solid var(--line); border-radius: 14px; color: var(--ink-2);
    font-weight: 700; font-size: 13.5px; background: var(--card); transition: all var(--anim);
}
.quick a i { font-style: normal; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--c1-light); color: var(--c1-deep); flex: none; }
.quick a:hover { border-color: var(--c1-mid); transform: translateY(-2px); box-shadow: var(--shadow-candy); }
.quick a.primary { background: linear-gradient(135deg, var(--c1-deep), var(--c2-deep)); border-color: transparent; color: #fff; }
.quick a.primary i { background: rgba(255, 255, 255, .22); color: #fff; }

/* ============================================================
   滚动条
   ============================================================ */
* { scrollbar-width: thin; scrollbar-color: var(--c1-mid) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--c1-mid); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
