/* ============================================================
 * Fate Cycle admin — desktop console
 *
 * Shares the storefront's palette so the two read as one product, but the
 * skin is denser and quieter: this is a tool an operator lives in all day,
 * not a shop window. Desktop only, per Jade (2026-09-02).
 * ============================================================ */

:root {
  --ink:      #1B1D21;
  --ink-2:    #4A4F57;
  --ink-3:    #858B94;
  --ink-4:    #B4B9C0;
  --rule:     #E4E6EA;
  --rule-2:   #EFF1F4;
  --bg:       #F4F5F7;
  --card:     #FFFFFF;
  --sidebar:  #17181C;
  --sidebar-2:#22242A;

  --gold:     #D59C00;
  --clay:     #772B00;
  --ember:    #E35D00;
  --ok:       #2E7D5B;
  --warn:     #B8860B;
  --bad:      #B3352C;

  --el-wood:  #4E7A5B;
  --el-fire:  #9E2B25;
  --el-earth: #B08430;
  --el-metal: #8E959C;
  --el-water: #2B3440;

  --ui: -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI",
        "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;

  --r: 8px;
  --shadow: 0 1px 2px rgba(16, 18, 22, .05), 0 8px 24px rgba(16, 18, 22, .06);
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 14px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
/* Anything that answers a click says so, and anything that will not says that
 * too (Jade, 2026-10-19: 「所有可点击的链接，文字，按钮都使用 cursor:pointer」).
 * Text fields keep the I-beam: that is the honest cursor for somewhere you
 * type, so a label is only given the hand when its control is a choice. */
select, summary, [role="button"], [role="tab"],
label:has(select), label:has(input[type="checkbox"]),
label:has(input[type="radio"]), label:has(input[type="file"]) { cursor: pointer; }
button:disabled, a[aria-disabled="true"], .is-disabled { cursor: not-allowed; }

::selection { background: #FFE9B0; }

/* ---------------- shell ---------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: var(--sidebar); color: #C9CDD4;
  padding: 18px 12px;
}
.side__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 20px;
}
.side__mark {
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  display: grid; place-items: center;
  font-family: Bitter, Georgia, serif; font-weight: 700; font-size: 8px;
  letter-spacing: -.02em; color: #FFB45D;
}
.side__brand b { display: block; font-size: 14px; font-weight: 600; color: #fff; letter-spacing: .02em; }
.side__brand span { display: block; font-size: 11px; color: #7C838E; }

.side__group { margin-top: 14px; }
.side__group h6 {
  margin: 0 0 6px; padding: 0 10px;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: #6A717C; font-weight: 600;
}
.side__link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; margin-bottom: 1px; border-radius: 6px;
  font-size: 13.5px; color: #C9CDD4;
  transition: background .12s ease, color .12s ease;
}
.side__link:hover { background: var(--sidebar-2); color: #fff; }
.side__link.is-on { background: var(--sidebar-2); color: #fff; box-shadow: inset 2px 0 0 var(--gold); }
.side__link.is-locked { opacity: .38; cursor: not-allowed; }
.side__link i { width: 18px; text-align: center; font-style: normal; opacity: .9; }
.side__link em { margin-left: auto; font-style: normal; font-size: 11px; color: #7C838E; }
.side__foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid rgba(255,255,255,.07); }
.side__who { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.side__who .av {
  width: 28px; height: 28px; border-radius: 50%; background: var(--gold);
  display: grid; place-items: center; font-size: 12px; font-weight: 600; color: #2B2000;
}
.side__who > span { min-width: 0; }
.side__who b { display: block; font-size: 12.5px; color: #fff; font-weight: 500;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side__who span span, .side__who > span > span {
  display: block; font-size: 11px; color: #7C838E; white-space: nowrap; }
.side__who select {
  width: 100%; margin-top: 9px; background: var(--sidebar-2); color: #C9CDD4;
  border: 1px solid rgba(255,255,255,.1); border-radius: 5px; padding: 4px 6px; font-size: 11px;
}

/* ---------------- main ---------------- */
.main { min-width: 0; display: flex; flex-direction: column; }
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 26px;
  background: rgba(244, 245, 247, .86); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule);
}
.top h1 { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.top .crumb { font-size: 12.5px; color: var(--ink-3); }
.top__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.view { padding: 22px 26px 60px; }

/* ---------------- primitives ---------------- */
.card { background: var(--card); border: 1px solid var(--rule); border-radius: var(--r); }
.card + .card { margin-top: 16px; }
.card__hd {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--rule-2);
}
.card__hd h2 { margin: 0; font-size: 14.5px; font-weight: 600; }
.card__hd p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.card__hd .sp { margin-left: auto; }
.card__bd { padding: 18px; }
.card__bd--flush { padding: 0; }

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 6px;
  border: 1px solid var(--rule); background: #fff;
  font-size: 13px; font-weight: 500; color: var(--ink-2);
  transition: background .12s ease, border-color .12s ease, transform .06s ease;
}
.btn:hover { background: #FAFBFC; border-color: var(--ink-4); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn--primary:hover { background: #2B2E34; border-color: #2B2E34; }
.btn--gold { background: var(--gold); border-color: var(--gold); color: #2B2000; }
.btn--gold:hover { background: #E5A800; border-color: #E5A800; }
.btn--danger { color: var(--bad); }
.btn--danger:hover { background: #FDF3F2; border-color: #E7BDB9; }
.btn--sm { height: 28px; padding: 0 9px; font-size: 12px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.inp, .sel, .ta {
  width: 100%; height: 34px; padding: 0 10px;
  background: #fff; border: 1px solid var(--rule); border-radius: 6px;
  font-size: 13px; transition: border-color .12s ease, box-shadow .12s ease;
}
.ta { height: auto; min-height: 84px; padding: 8px 10px; line-height: 1.6; resize: vertical; }
.inp:focus, .sel:focus, .ta:focus {
  outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(213, 156, 0, .13);
}
.fld { display: block; margin-bottom: 13px; }
.fld > span { display: block; margin-bottom: 5px; font-size: 12px; font-weight: 500; color: var(--ink-2); }
.fld > small { display: block; margin-top: 4px; font-size: 11.5px; color: var(--ink-3); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.row { display: flex; align-items: center; gap: 9px; }
.row--wrap { flex-wrap: wrap; }
.sp { margin-left: auto; }

.sw { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sw i {
  width: 34px; height: 20px; border-radius: 10px; background: var(--ink-4);
  position: relative; transition: background .16s ease;
}
.sw i::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: transform .16s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.sw input:checked + i { background: var(--ok); }
.sw input:checked + i::after { transform: translateX(14px); }
.sw span { font-size: 13px; color: var(--ink-2); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 9px; border-radius: 11px;
  font-size: 11.5px; font-weight: 500;
  background: var(--rule-2); color: var(--ink-2);
}
.pill--live  { background: #E8F5EE; color: var(--ok); }
.pill--draft { background: #FFF6E2; color: var(--warn); }
.pill--off   { background: #F1F2F4; color: var(--ink-3); }
.pill--bad   { background: #FDECEA; color: var(--bad); }
.pill--el { color: #fff; }
.el-wood  { background: var(--el-wood); }
.el-fire  { background: var(--el-fire); }
.el-earth { background: var(--el-earth); }
.el-metal { background: var(--el-metal); }
.el-water { background: var(--el-water); }

/* ---------------- table ---------------- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  position: sticky; top: 60px; z-index: 5;
  padding: 9px 14px; text-align: left; background: #FAFBFC;
  border-bottom: 1px solid var(--rule);
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink-3); white-space: nowrap;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--rule-2); vertical-align: middle; }
.tbl tbody tr { transition: background .1s ease; }
.tbl tbody tr:hover { background: #FBFCFD; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .mono { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.tbl__acts { display: flex; gap: 6px; justify-content: flex-end; opacity: 0; transition: opacity .12s ease; }
.tbl tbody tr:hover .tbl__acts { opacity: 1; }

.thumb {
  width: 42px; height: 42px; border-radius: 6px; background: #F1F1F3;
  display: grid; place-items: center; overflow: hidden; flex: none;
}
.thumb svg { width: 100%; height: 100%; }

.empty { padding: 54px 20px; text-align: center; color: var(--ink-3); }
.empty b { display: block; margin-bottom: 5px; font-size: 14px; color: var(--ink-2); }

/* ---------------- stats ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; }
.kpi h6 { margin: 0 0 8px; font-size: 11.5px; font-weight: 500; color: var(--ink-3); letter-spacing: .03em; }
.kpi b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--ink-3); }
.kpi span.up { color: var(--ok); }
.kpi span.dn { color: var(--bad); }

.spark { display: flex; align-items: flex-end; gap: 3px; height: 66px; margin-top: 6px; }
.spark i {
  flex: 1; min-height: 4px; border-radius: 2px 2px 0 0; background: var(--ink-4);
  transition: background .12s ease;
}
.spark i.hot { background: var(--gold); }
.spark:hover i { background: var(--ink-3); }

.bars { display: grid; gap: 9px; }
.barrow { display: grid; grid-template-columns: 72px 1fr 54px; align-items: center; gap: 12px; font-size: 12.5px; }
.bartrack { height: 9px; border-radius: 5px; background: var(--rule-2); overflow: hidden; }
.bartrack i { display: block; height: 100%; border-radius: 5px; }
.barval { text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* ---------------- drawer ---------------- */
.scrim {
  position: fixed; inset: 0; z-index: 40; background: rgba(16, 18, 22, .34);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.scrim.is-on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; z-index: 41; top: 0; right: 0; bottom: 0;
  width: min(680px, 92vw); display: flex; flex-direction: column;
  background: var(--bg); box-shadow: -18px 0 46px rgba(16, 18, 22, .16);
  transform: translateX(100%); transition: transform .24s cubic-bezier(.32,.72,0,1);
}
.drawer.is-on { transform: none; }
.drawer__hd {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; background: #fff; border-bottom: 1px solid var(--rule);
}
.drawer__hd h2 { margin: 0; font-size: 15.5px; font-weight: 600; }
.drawer__hd p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); }
.drawer__bd { flex: 1; overflow-y: auto; padding: 18px 20px 26px; }
.drawer__ft {
  display: flex; gap: 10px; align-items: center;
  padding: 13px 20px; background: #fff; border-top: 1px solid var(--rule);
}
.x { width: 30px; height: 30px; border-radius: 6px; display: grid; place-items: center; color: var(--ink-3); }
.x:hover { background: var(--rule-2); color: var(--ink); }

/* ---------------- toast ---------------- */
.toasts { position: fixed; z-index: 60; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 15px; border-radius: 8px;
  background: var(--ink); color: #fff; font-size: 13px;
  box-shadow: 0 10px 30px rgba(16, 18, 22, .24);
  animation: rise .22s cubic-bezier(.32,.72,0,1);
}
.toast--bad { background: var(--bad); }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------------- misc ---------------- */
.tree { display: grid; gap: 2px; }
.tnode {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 6px; background: #fff;
  border: 1px solid var(--rule-2);
}
.tnode[draggable="true"] { cursor: grab; }
.tnode.is-drag { opacity: .4; }
.tnode.is-over { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(213,156,0,.14); }
.tnode__icon { width: 26px; text-align: center; font-size: 15px; }
.tnode__name { font-size: 13.5px; font-weight: 500; }
.tnode__meta { font-size: 11.5px; color: var(--ink-3); }
.tnode--l2 { margin-left: 26px; }
.tnode--l3 { margin-left: 52px; }
.grab { color: var(--ink-4); cursor: grab; user-select: none; }

.blocks { display: grid; gap: 10px; }
.block {
  border: 1px solid var(--rule); border-radius: 7px; background: #fff; padding: 11px 12px;
}
.block__hd { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.block__kind { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.block .ta { min-height: 60px; }
.ph {
  display: grid; place-items: center; border-radius: 6px;
  background: #ECECEE; border: 1px dashed var(--ink-4);
  font-size: 11px; letter-spacing: .16em; color: var(--ink-3);
}

.seg { display: inline-flex; padding: 2px; background: var(--rule-2); border-radius: 7px; }
.seg button { padding: 5px 11px; border-radius: 5px; font-size: 12.5px; color: var(--ink-2); }
.seg button.is-on { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.note {
  padding: 11px 14px; border-radius: 7px;
  background: #FFFCF2; border: 1px solid #F0E3BE;
  font-size: 12.5px; line-height: 1.65; color: #6E5A16;
}
.note b { font-weight: 600; }

.small-screen {
  display: none; position: fixed; inset: 0; z-index: 90; place-items: center;
  background: var(--bg); padding: 30px; text-align: center;
}
@media (max-width: 900px) {
  .small-screen { display: grid; }
  .small-screen p { max-width: 320px; color: var(--ink-2); line-height: 1.7; }
}

/* Transaction-email preview: a letter, shown as it will be sent — monospace so
 * the aligned columns in the order summary line up the way they will in a
 * mail client, and wrapped so a long tracking URL cannot push it sideways. */
.mail-prev {
  margin: 0; padding: 14px 16px;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 8px;
  font-family: var(--mono); font-size: 12.5px; line-height: 21px; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-word;
}
