/* ============================================================
   集市利润台 · 样式
   暖羊皮纸底 + 陶土红 / 松石绿 / 麦金
   ============================================================ */
:root {
  --paper: #f2ead9;
  --paper-2: #fbf7ee;
  --paper-3: #e9dfc9;
  --ink: #2b2823;
  --ink-2: #5d564a;
  --ink-3: #8b8272;
  --line: #dbcfb5;
  --line-2: #cbbda0;
  --accent: #b4552b;
  --accent-soft: #f3d9c9;
  --teal: #2f6b62;
  --teal-soft: #d5e6e0;
  --gold: #b98a2f;
  --danger: #a13a22;
  --shadow-sm: 0 1px 2px rgba(70, 55, 30, .08), 0 2px 8px rgba(70, 55, 30, .06);
  --shadow-md: 0 6px 24px rgba(70, 55, 30, .12);
  --shadow-lg: -18px 0 60px rgba(48, 38, 20, .22);
  --radius: 14px;
  --font-sans: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --font-serif: "Noto Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --font-num: "DIN Alternate", "Bahnschrift", "Segoe UI", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 15% -10%, #fffdf7 0%, rgba(255, 253, 247, 0) 60%),
    radial-gradient(900px 500px at 100% 0%, #efe4cd 0%, rgba(239, 228, 205, 0) 55%),
    repeating-linear-gradient(135deg, rgba(160, 135, 90, .035) 0 2px, rgba(160, 135, 90, 0) 2px 6px);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.55;
}

h1, h2, h3 { font-family: var(--font-serif); font-weight: 700; margin: 0; letter-spacing: .02em; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; }

/* ---------------- header ---------------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 26px;
  background: linear-gradient(180deg, rgba(251, 247, 238, .96), rgba(243, 234, 217, .88));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.crest {
  width: 42px; height: 42px; flex: none;
  display: grid; place-items: center;
  font-family: var(--font-serif); font-size: 21px; font-weight: 700;
  color: #fdf6e7;
  background: radial-gradient(circle at 30% 25%, #d0784a, #a8481f 70%);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), var(--shadow-sm);
}
.brand h1 { font-size: 20px; line-height: 1.15; }
.brand p { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); letter-spacing: .04em; }
.header-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.stamp {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--ink-2);
  padding: 5px 11px; border: 1px dashed var(--line-2); border-radius: 999px;
  background: rgba(255, 255, 255, .5);
}
.stamp b { font-family: var(--font-num); font-weight: 600; color: var(--ink); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px rgba(47, 107, 98, .18); }

.btn {
  border: 1px solid var(--line-2); background: var(--paper-2);
  padding: 7px 13px; border-radius: 9px; font-size: 13px; color: var(--ink-2);
  transition: .16s ease;
}
.btn:hover { border-color: var(--accent); color: var(--accent); background: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff8ef; }
.btn.primary:hover { background: #9d451f; color: #fff; }
.btn.ghost { background: transparent; }

/* ---------------- layout ---------------- */
.shell {
  display: grid;
  grid-template-columns: 306px minmax(0, 1fr);
  gap: 20px;
  padding: 20px 26px 44px;
  max-width: 1560px;
  margin: 0 auto;
  align-items: start;
}
.panel {
  background: linear-gradient(180deg, rgba(255, 253, 247, .92), rgba(253, 249, 240, .82));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.side { position: sticky; top: 84px; display: grid; gap: 14px; }

.side-section { padding: 15px 16px 17px; }
.side-section + .side-section { border-top: 1px dashed var(--line); }
.side-section h2 {
  font-size: 13px; letter-spacing: .12em; color: var(--ink-2);
  display: flex; align-items: center; gap: 8px; margin-bottom: 3px;
}
.side-section h2::before {
  content: ""; width: 4px; height: 13px; border-radius: 2px;
  background: linear-gradient(180deg, var(--accent), #d99a6c);
}
.hint { margin: 6px 0 10px; font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }

/* range */
.rate-row { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 4px; }
.rate-row span { font-size: 12.5px; color: var(--ink-2); }
.rate-val {
  font-family: var(--font-num); font-size: 19px; font-weight: 700; color: var(--accent);
  background: var(--accent-soft); border-radius: 8px; padding: 1px 9px; min-width: 62px; text-align: center;
}
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) var(--pct, 35%), var(--paper-3) var(--pct, 35%));
  outline: none; margin: 8px 0 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #fffdf7; border: 3px solid var(--accent); box-shadow: var(--shadow-sm); cursor: grab;
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fffdf7; border: 3px solid var(--accent); cursor: grab;
}

/* switch */
.switch {
  display: flex; align-items: flex-start; gap: 9px; padding: 6px 0; font-size: 12.5px;
  color: var(--ink-2); cursor: pointer; line-height: 1.4;
}
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  flex: none; width: 34px; height: 19px; border-radius: 999px; margin-top: 1px;
  background: var(--paper-3); border: 1px solid var(--line-2); position: relative; transition: .18s;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: #fffdf7; border: 1px solid var(--line-2); transition: .18s;
}
.switch input:checked + .track { background: var(--teal); border-color: var(--teal); }
.switch input:checked + .track::after { left: 17px; border-color: var(--teal); }
.switch input:focus-visible + .track { box-shadow: 0 0 0 3px rgba(47, 107, 98, .22); }
.switch em { font-style: normal; color: var(--ink-3); font-size: 11px; display: block; }

.seg { display: flex; background: var(--paper-3); border-radius: 9px; padding: 3px; gap: 3px; margin: 8px 0 2px; }
.seg button {
  flex: 1; border: 0; background: transparent; border-radius: 7px; padding: 5px 4px;
  font-size: 12px; color: var(--ink-2); transition: .15s;
}
.seg button.on { background: #fffdf7; color: var(--accent); box-shadow: var(--shadow-sm); font-weight: 600; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 4px; }
.chip-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.chip-row:last-child { margin-bottom: 0; }
.chip-label {
  flex: none; font-size: 10.5px; letter-spacing: .08em; color: var(--ink-3);
  border-left: 2px solid var(--line-2); padding-left: 6px; margin-right: 2px;
}
.chip.more { border-style: dotted; color: var(--ink-3); background: transparent; }
.chip.ghost { border-style: dashed; opacity: .75; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--line-2); background: #fffdf7; color: var(--ink-2);
  border-radius: 999px; padding: 4px 10px 4px 9px; font-size: 12px; transition: .15s;
}
.chip .cnt { font-family: var(--font-num); font-size: 10.5px; color: var(--ink-3); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: #8c3d1a; font-weight: 600; }
.chip.on .cnt { color: #a5522b; }
.chip .up { font-size: 10px; }
.chip-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.chip-actions button {
  flex: 1 1 auto; border: 1px dashed var(--line-2); background: transparent; border-radius: 8px;
  font-size: 11.5px; color: var(--ink-3); padding: 4px 8px; white-space: nowrap;
}
.chip-actions button:hover { color: var(--accent); border-color: var(--accent); }
.chip-actions button.mini { flex: 0 0 auto; padding: 4px 6px; font-size: 11px; }
.switch input:disabled + .track { opacity: .45; }
.switch input:disabled ~ span { opacity: .55; }

/* data status */
.status-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 6px; font-size: 12px; }
.status-list li { display: flex; justify-content: space-between; gap: 8px; color: var(--ink-2); }
.status-list b { font-family: var(--font-num); color: var(--ink); }
.status-list .warn b { color: var(--danger); }
details.warnbox { margin-top: 10px; font-size: 11.5px; color: var(--ink-3); }
details.warnbox summary { cursor: pointer; color: var(--accent); }
details.warnbox ul { margin: 6px 0 0; padding-left: 16px; max-height: 150px; overflow: auto; }

/* ---------------- content ---------------- */
.content { display: grid; gap: 16px; min-width: 0; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi {
  padding: 14px 16px; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 253, 247, .95), rgba(250, 245, 234, .85));
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.kpi::after {
  content: ""; position: absolute; right: -20px; top: -20px; width: 70px; height: 70px; border-radius: 50%;
  background: radial-gradient(circle, rgba(180, 85, 43, .10), transparent 70%);
}
.kpi .k-label { font-size: 11.5px; letter-spacing: .1em; color: var(--ink-3); }
.kpi .k-value { font-family: var(--font-num); font-size: 27px; font-weight: 700; line-height: 1.2; margin-top: 3px; }
.kpi .k-sub { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.kpi.accent .k-value { color: var(--accent); }
.kpi.teal .k-value { color: var(--teal); }
.kpi.gold .k-value { color: var(--gold); }

.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255, 253, 247, .8); box-shadow: var(--shadow-sm);
}
.search { position: relative; flex: 1 1 200px; min-width: 160px; }
.search input {
  width: 100%; border: 1px solid var(--line); background: #fffdf7; border-radius: 9px;
  padding: 7px 11px 7px 31px; font-size: 13px; outline: none; transition: .15s;
}
.search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(180, 85, 43, .12); }
.search::before {
  content: "⌕"; position: absolute; left: 11px; top: 50%; transform: translateY(-52%);
  font-size: 16px; color: var(--ink-3); pointer-events: none;
}
.tabs { display: flex; gap: 3px; background: var(--paper-3); padding: 3px; border-radius: 9px; }
.tabs button {
  border: 0; background: transparent; padding: 5px 11px; border-radius: 7px; font-size: 12.5px; color: var(--ink-2);
  transition: .15s; white-space: nowrap;
}
.tabs button.on { background: #fffdf7; color: var(--accent); font-weight: 600; box-shadow: var(--shadow-sm); }
select.sort {
  border: 1px solid var(--line); background: #fffdf7; border-radius: 9px; padding: 7px 9px; font-size: 12.5px;
  color: var(--ink-2); outline: none;
}

/* 制造源 / 星级筛选 */
.filterbar {
  display: grid; gap: 7px;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(255, 253, 247, .6); box-shadow: var(--shadow-sm);
}
.filter-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-row[hidden] { display: none; }
.filter-label {
  flex: none; font-size: 10.5px; letter-spacing: .08em; color: var(--ink-3);
  border-left: 2px solid var(--line-2); padding-left: 6px; margin-right: 2px;
}
.filter-hint { font-size: 11px; color: var(--ink-3); margin-left: 2px; }
.fchips { display: flex; flex-wrap: wrap; gap: 5px; }
.fchip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid var(--line-2); background: #fffdf7; color: var(--ink-2);
  border-radius: 999px; padding: 3px 9px; font-size: 11.5px; line-height: 1.5; transition: .15s;
}
.fchip .cnt { font-family: var(--font-num); font-size: 10px; color: var(--ink-3); }
.fchip:hover { border-color: var(--accent); color: var(--accent); }
.fchip.on { background: var(--accent-soft); border-color: var(--accent); color: #8c3d1a; font-weight: 600; }
.fchip.on .cnt { color: #a5522b; }
.fchip.zero { opacity: .42; }
.fchip.stars { letter-spacing: .5px; color: var(--gold); }
.fchip.stars.on { color: #8c3d1a; }

/* table */
.table-card { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 253, 247, .86); box-shadow: var(--shadow-sm); overflow: hidden; }
.table-scroll { max-height: calc(100vh - 300px); min-height: 240px; overflow: auto; }
table.items { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.items thead th {
  position: sticky; top: 0; z-index: 2; text-align: left; font-weight: 600; font-size: 11.5px;
  letter-spacing: .08em; color: var(--ink-3); background: #f6efdf;
  padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.items thead th.sortable { cursor: pointer; user-select: none; }
table.items thead th.sortable:hover { color: var(--accent); }
table.items thead th .arrow { opacity: .35; font-size: 9px; margin-left: 3px; }
table.items thead th.sorted .arrow { opacity: 1; color: var(--accent); }
table.items tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(219, 207, 181, .55); vertical-align: middle; }
table.items tbody tr { cursor: pointer; transition: background .12s; }
table.items tbody tr:hover { background: rgba(180, 85, 43, .055); }
table.items tbody tr.active { background: rgba(180, 85, 43, .1); }
table.items tbody tr.dim { opacity: .45; }

.cell-item { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar {
  position: relative; overflow: hidden;
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center; font-family: var(--font-serif); font-size: 13px; font-weight: 700;
  background: linear-gradient(160deg, #fbf3e2, #ecdcbd); color: #8a6a37;
  border: 1px solid rgba(180, 150, 100, .35); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
}
.avatar.mat { background: linear-gradient(160deg, #eef1ea, #d6e2dc); color: #4a6b60; }
.avatar.mid { background: linear-gradient(160deg, #f6efe4, #e6d5bb); color: #8a6a37; }
.avatar .fb { line-height: 1; }
.avatar.pic { background: #f3ece0; border-color: rgba(140, 118, 86, .3); }
.avatar-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.cell-item .nm { min-width: 0; }
.cell-item .nm b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.cell-item .nm small { color: var(--ink-3); font-size: 11px; }
.tier-stars { color: var(--gold); font-size: 10px; letter-spacing: 1px; }

.tag {
  display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px;
  background: var(--paper-3); color: var(--ink-2); white-space: nowrap;
}
.tag.risen { background: var(--accent-soft); color: #93401c; }
.tag.muted { background: transparent; border: 1px dashed var(--line-2); color: var(--ink-3); }
.tag.warn { background: #f7e2d8; color: var(--danger); }
.tag.teal { background: var(--teal-soft); color: #245c53; }

.money { font-family: var(--font-num); font-variant-numeric: tabular-nums; }
.money.sell { color: var(--ink); font-weight: 600; }
.money.cost { color: var(--ink-2); }
.money .small { font-size: 11px; color: var(--ink-3); }
.up-mark { font-size: 10px; margin-left: 3px; color: var(--accent); vertical-align: 1px; }
.up-mark.off { color: var(--line-2); }

.ratio-cell { display: flex; align-items: center; gap: 9px; min-width: 130px; }
.ratio-bar { position: relative; flex: 1; height: 6px; border-radius: 3px; background: var(--paper-3); overflow: hidden; }
.ratio-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; display: block; }
.ratio-num { font-family: var(--font-num); font-weight: 700; font-size: 15px; min-width: 54px; text-align: right; }
.r-hot { color: #1f6b4d; } .r-good { color: #2f6b62; } .r-mid { color: var(--gold); } .r-bad { color: var(--danger); } .r-na { color: var(--ink-3); }
.bar-hot { background: linear-gradient(90deg, #2f9a6e, #1f6b4d); }
.bar-good { background: linear-gradient(90deg, #63a99b, #2f6b62); }
.bar-mid { background: linear-gradient(90deg, #d8b45f, #b98a2f); }
.bar-bad { background: linear-gradient(90deg, #d07a5f, #a13a22); }
.bar-na { background: repeating-linear-gradient(45deg, var(--line-2) 0 4px, transparent 4px 8px); }

.ing-list { display: flex; flex-wrap: wrap; gap: 4px; max-width: 230px; }
.ing-pill {
  display: inline-flex; align-items: center; gap: 2px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .6); color: var(--ink-2);
  border-radius: 6px; padding: 1px 6px; font-size: 11px; line-height: 1.6; white-space: nowrap;
  transition: .14s;
}
.ing-pill i { font-style: normal; font-family: var(--font-num); font-size: 10px; color: var(--ink-3); }
.ing-pill:hover { border-color: var(--accent); color: var(--accent); background: #fff; }
.ing-pill.up { border-color: #e2b795; background: var(--accent-soft); color: #93401c; }
.ing-pill.up i { color: #a5522b; }

.empty { padding: 46px 20px; text-align: center; color: var(--ink-3); font-size: 13px; }.empty b { display: block; font-family: var(--font-serif); font-size: 16px; color: var(--ink-2); margin-bottom: 6px; }

/* ---------------- drawer ---------------- */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(43, 40, 35, .34); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 60;
}
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 94vw); z-index: 61;
  background: linear-gradient(180deg, #fdfaf3, #f6efdf);
  border-left: 1px solid var(--line-2); box-shadow: var(--shadow-lg);
  transform: translateX(104%); transition: transform .28s cubic-bezier(.22, .8, .3, 1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; align-items: flex-start; }
.drawer-head .avatar { width: 46px; height: 46px; border-radius: 12px; font-size: 16px; }
.drawer-head h3 { font-size: 18px; line-height: 1.25; }
.drawer-head .meta { font-size: 11.5px; color: var(--ink-3); margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; }
.drawer-close {
  margin-left: auto; border: 0; background: transparent; font-size: 20px; color: var(--ink-3);
  line-height: 1; padding: 2px 4px; border-radius: 6px;
}
.drawer-close:hover { background: var(--paper-3); color: var(--ink); }
.drawer-body { padding: 16px 20px 28px; overflow: auto; }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.stat {
  border: 1px solid var(--line); border-radius: 11px; padding: 9px 12px;
  background: rgba(255, 255, 255, .55);
}
.stat span { font-size: 11px; color: var(--ink-3); letter-spacing: .06em; }
.stat b { display: block; font-family: var(--font-num); font-size: 21px; line-height: 1.25; }
.stat.hero { grid-column: span 2; background: linear-gradient(120deg, #fdf1e6, #f8e4d3); border-color: #e2b795; }
.stat.hero b { font-size: 34px; color: var(--accent); }
.stat.hero b small { font-size: 14px; color: var(--ink-3); font-weight: 400; }

.block-title {
  margin: 20px 0 8px; font-size: 12px; letter-spacing: .12em; color: var(--ink-3);
  display: flex; align-items: center; gap: 8px;
}
.block-title::after { content: ""; flex: 1; height: 1px; background: repeating-linear-gradient(90deg, var(--line-2) 0 3px, transparent 3px 6px); }

.recipe-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.recipe-table th { text-align: left; font-weight: 500; color: var(--ink-3); font-size: 11px; padding: 4px 6px; border-bottom: 1px solid var(--line); }
.recipe-table td { padding: 6px; border-bottom: 1px dashed rgba(219, 207, 181, .7); vertical-align: middle; }
.recipe-table td.r, .recipe-table th.r { text-align: right; }
.recipe-table .share { height: 4px; border-radius: 2px; background: var(--paper-3); overflow: hidden; min-width: 44px; }
.recipe-table .share i { display: block; height: 100%; background: linear-gradient(90deg, #d8a06f, var(--accent)); }
.recipe-table tr.miss td { color: var(--danger); }
.ing-link { border: 0; background: none; padding: 0; color: var(--ink); text-decoration: underline dotted var(--line-2); text-underline-offset: 3px; }
.ing-link:hover { color: var(--accent); }

.note-box {
  margin-top: 16px; font-size: 12px; color: var(--ink-2); background: rgba(47, 107, 98, .07);
  border-left: 3px solid var(--teal); border-radius: 0 8px 8px 0; padding: 9px 12px; line-height: 1.55;
}
.note-box.warn { background: rgba(161, 58, 34, .07); border-left-color: var(--danger); }
.note-box b { color: var(--ink); }

/* ---------------- 行情横幅 ---------------- */
/* 置顶、横向铺满：行情缺失时全页利润数字的前提都不成立，必须一眼看到 */
.rise-banner {
  position: sticky; top: 0; z-index: 39;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
  margin: 0; padding: 10px 26px;
  font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
  background: rgba(161, 58, 34, .1);
  border-bottom: 1px solid rgba(161, 58, 34, .28);
  border-left: 4px solid var(--danger);
  box-shadow: var(--shadow-sm);
}
.rise-banner[hidden] { display: none; }
.rise-banner b { color: var(--danger); font-size: 13px; }
.rise-banner span { flex: 1 1 320px; min-width: 0; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: #2b2823; color: #fdf7ea; padding: 9px 18px; border-radius: 999px; font-size: 12.5px;
  box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transition: .25s; z-index: 90;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* guide modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(43, 40, 35, .4); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 80; padding: 20px; opacity: 0; pointer-events: none; transition: .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  width: min(640px, 100%); max-height: 82vh; overflow: auto; background: #fdfaf3;
  border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow-md); padding: 22px 24px;
}
.modal h3 { font-size: 18px; margin-bottom: 4px; }
.modal p, .modal li { font-size: 13px; color: var(--ink-2); line-height: 1.65; }
.modal ul { padding-left: 18px; }
.modal code { background: var(--paper-3); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.modal .close-row { display: flex; justify-content: flex-end; margin-top: 14px; }

/* footer */
.foot { padding: 0 26px 30px; color: var(--ink-3); font-size: 11.5px; text-align: center; }

@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; padding: 16px; }
  .side { position: static; }
  .table-scroll { max-height: none; }
  .cell-item .nm b { max-width: 150px; }
}
@media (max-width: 620px) {
  .app-header { padding: 12px 16px; }
  .rise-banner { padding: 9px 16px; font-size: 12px; }
  .brand h1 { font-size: 17px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi .k-value { font-size: 22px; }
  .hide-sm { display: none; }
}
