
/* OD-LAYOUT-PRIMITIVES v1 — structure only: display, flex/grid, overflow, wrapping, ratio, geometry.
   Put this @layer first; product CSS outside the layer wins ordinary layout rules.
   Native hidden and closed-dialog states take precedence over component display rules. */
@layer od-layout {
  [hidden]:not([hidden="until-found" i]) { display: none !important; }
  dialog:not([open]) { display: none !important; }

  :where(.od-stack,.od-row,.od-row-top,.od-cluster,.od-grid,.od-field,.od-stat,.od-cell,.od-tile) > :where(*) { min-width: 0; }

  .od-stack   { display: flex; flex-direction: column; gap: var(--od-gap, 8px); }
  .od-row     { display: flex; align-items: center; gap: var(--od-gap, 8px); }
  .od-row-top { display: flex; align-items: flex-start; gap: var(--od-gap, 8px); }
  .od-cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--od-gap, 8px); }
  .od-fill    { flex: 1 1 0; min-width: 0; }
  .od-fixed   { flex: none; }
  .od-grid    { display: grid; gap: var(--od-gap, 12px); grid-template-columns: repeat(var(--od-cols, 3), minmax(0, 1fr)); }

  .od-stat, .od-field, .od-cell { display: grid; gap: var(--od-gap, 2px); }
  :where(.od-stat,.od-field,.od-cell) > :where(*) { display: block; }
  .od-tile { display: grid; grid-template-rows: auto 1fr; }
  :where(.od-tile) > :where(*) { display: block; }

  .od-media { display: block; width: 100%; height: auto; aspect-ratio: var(--od-ratio, auto); }
  .od-media-cover { object-fit: cover; }

  .od-icon { display: inline-block; inline-size: var(--od-icon-size, 1em); block-size: var(--od-icon-size, 1em); flex: none; }

  .od-truncate { display: block; max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .od-clamp-2, .od-clamp-3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
  .od-clamp-2 { -webkit-line-clamp: 2; }
  .od-clamp-3 { -webkit-line-clamp: 3; }
  .od-lines-2 { min-height: calc(2 * 1.4em); }
  .od-nowrap  { white-space: nowrap; }
  .od-keep    { word-break: keep-all; overflow-wrap: anywhere; }

  .od-screen { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
  .od-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; }

  .od-rail { display: flex; gap: var(--od-gap, 8px); overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none;
             padding-inline: var(--od-rail-pad, 16px); scroll-padding-inline: var(--od-rail-pad, 16px); }
  .od-rail::-webkit-scrollbar { display: none; }
  :where(.od-rail) > :where(*) { flex: none; scroll-snap-align: start; }
  :where(.od-rail) > :where(:last-child) { margin-inline-end: var(--od-rail-pad, 16px); }

  .od-spacer { flex: none; visibility: hidden; pointer-events: none; }
  .od-touch  { min-width: 44px; min-height: 44px; }
}
:root [hidden]:where(:not([hidden="until-found" i])) { display: none; }
/* /OD-LAYOUT-PRIMITIVES v1 */

:root {
  --bg: #eceefb;
  --bg-2: #f5f4fd;
  --card: #ffffff;
  --ink: #26233c;
  --sub: #6e6b86;
  --mute: #9b98ae;
  --line: #ebeaf4;
  --line-2: #dedcef;
  --pri: #4a6cf7;
  --pri-2: #7a68ff;
  --pri-ink: #3f54d9;
  --pri-soft: #eef0ff;
  --green: #1f9d5c;
  --green-soft: #e6f6ec;
  --red: #e5484d;
  --red-soft: #fdecec;
  --orange: #d97a12;
  --orange-soft: #fff3e3;
  --pink: #d63f86;
  --pink-soft: #fdebf4;
  --blue: #2f73da;
  --blue-soft: #e8f1fe;
  --gray-soft: #f1f1f5;
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --shadow: 0 16px 36px -18px rgba(92, 84, 210, .32), 0 2px 6px -2px rgba(92, 84, 210, .08);
  --shadow-pop: 0 24px 60px -20px rgba(60, 52, 160, .38);
  --grad: linear-gradient(135deg, var(--pri) 0%, var(--pri-2) 100%);
  --side-w: 220px;
  --t-fast: 160ms;
  --t-mid: 240ms;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-size: 14px;
  line-height: 1.55;
  background:
    radial-gradient(40% 30% at 92% 0%, rgba(214, 222, 255, .95), transparent 70%),
    radial-gradient(35% 30% at 0% 40%, rgba(236, 226, 255, .9), transparent 70%),
    radial-gradient(60% 24% at 50% 108%, rgba(255, 255, 255, .95), transparent 70%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--pri); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 20px;
  padding: 20px 14px;
  background: rgba(255, 255, 255, .55);
  border-right: 1px solid rgba(255, 255, 255, .8);
}
.logo { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.logo-badge {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; background: var(--grad);
  box-shadow: 0 8px 16px -6px rgba(74, 108, 247, .5);
  position: relative;
}
.logo-badge::after {
  content: ""; position: absolute; top: -3px; right: -4px; width: 10px; height: 10px;
  background: #f5b942; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%);
}
.logo-name { font-size: 18px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  min-height: 42px; padding: 0 12px;
  border: 0; border-radius: 12px; background: transparent;
  color: var(--ink); font-size: 14px; text-align: left; white-space: nowrap;
  transition: background var(--t-fast) ease-out, color var(--t-fast) ease-out;
  --od-icon-size: 18px;
}
@media (hover: hover) { .nav-item:hover { background: rgba(255, 255, 255, .85); color: var(--pri-ink); } }
.nav-item[aria-current="page"] { background: var(--pri-soft); color: var(--pri-ink); font-weight: 700; box-shadow: inset 3px 0 0 var(--pri); }
.side-foot { margin-top: auto; padding: 12px; border-radius: 14px; background: rgba(255,255,255,.7); font-size: 12px; color: var(--sub); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 14px 28px;
  background: rgba(240, 240, 252, .82);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); white-space: nowrap; }
.crumb strong { color: var(--ink); font-weight: 600; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.range {
  display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 10px; background: #fff; --od-icon-size: 16px; color: var(--sub);
}
.range select { border: 0; background: transparent; color: var(--ink); font-size: 13px; padding-right: 4px; }
.range select:focus-visible { outline: none; }
.range:focus-within { outline: 2px solid var(--pri); outline-offset: 2px; }
.icon-btn {
  position: relative; display: grid; place-items: center;
  width: 40px; height: 40px; border: 0; border-radius: 12px; background: transparent; color: var(--ink);
  --od-icon-size: 20px; transition: background var(--t-fast) ease-out;
}
@media (hover: hover) { .icon-btn:hover { background: rgba(255,255,255,.9); color: var(--pri-ink); } }
.dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid #f0f0fc; }
.me {
  display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 8px 0 4px;
  border: 0; border-radius: 12px; background: transparent; --od-icon-size: 16px;
}
@media (hover: hover) { .me:hover { background: rgba(255,255,255,.9); } }
.avatar {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, #ff9fc6, #a58bff);
}
.pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  min-width: 220px; padding: 8px; border-radius: 14px; background: #fff; box-shadow: var(--shadow-pop);
  animation: popIn var(--t-fast) ease-out;
}
.pop-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px;
  border: 0; border-radius: 10px; background: transparent; text-align: left; --od-icon-size: 16px;
}
@media (hover: hover) { .pop-item:hover { background: var(--pri-soft); color: var(--pri-ink); } }
.pop-note { padding: 8px 10px; border-radius: 10px; }
.pop-note + .pop-note { border-top: 1px solid var(--line); }
.pop-note b { display: block; font-size: 13px; }
.pop-note small { display: block; color: var(--sub); font-size: 12px; }
.anchor { position: relative; }
@keyframes popIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.page { padding: 8px 28px 40px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-title { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: .01em; white-space: nowrap; margin-right: 8px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--line-2);
  background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap;
  --od-icon-size: 16px; transition: background var(--t-fast) ease-out, border-color var(--t-fast) ease-out, transform var(--t-fast) ease-out;
}
@media (hover: hover) { .btn:hover { border-color: var(--pri); color: var(--pri-ink); } }
.btn:active { transform: scale(.98); }
.btn-pri { border: 0; background: var(--grad); color: #fff; box-shadow: 0 8px 18px -8px rgba(74, 108, 247, .7); }
@media (hover: hover) { .btn-pri:hover { color: #fff; background: linear-gradient(135deg, #3d5ff0 0%, #6c58f5 100%); } }
.btn-danger { border: 0; background: var(--red); color: #fff; }
@media (hover: hover) { .btn-danger:hover { color: #fff; background: #cf3a3f; } }
.btn-soft-danger { border-color: #f6c9cb; background: var(--red-soft); color: var(--red); }
@media (hover: hover) { .btn-soft-danger:hover { border-color: var(--red); color: #c22f34; } }
.btn:disabled { opacity: 1; background: #eceaf3; color: #8d8aa1; border-color: #e2e0ec; box-shadow: none; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-sm { min-height: 32px; padding: 0 10px; font-size: 13px; border-radius: 8px; }

.field-inline { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); white-space: nowrap; }
.input, .select {
  height: 38px; padding: 0 12px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff;
  font-size: 14px; color: var(--ink); min-width: 0;
  transition: border-color var(--t-fast) ease-out, box-shadow var(--t-fast) ease-out;
}
.select { padding-right: 28px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236e6b86' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus { outline: none; border-color: var(--pri); box-shadow: 0 0 0 3px rgba(74, 108, 247, .18); }
.input::placeholder { color: var(--mute); }
.input.is-err { border-color: var(--red); }
.search { display: flex; align-items: center; min-width: 0; }
.search .input { border-radius: 10px 0 0 10px; width: 220px; }
.search .btn { border-radius: 0 10px 10px 0; border-left: 0; padding: 0 12px; }

/* ---------- panels ---------- */
.panel { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,.9); min-width: 0; }
.panel-pad { padding: 20px; }
.work { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-items: start; }
.work.has-side { grid-template-columns: minmax(0, 1fr) 340px; }
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 20px; border-bottom: 1px solid var(--line); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { font-size: 13px; font-weight: 600; color: var(--sub); background: #fafaff; }
tbody tr { transition: background var(--t-fast) ease-out; }
@media (hover: hover) { tbody tr:hover { background: #f8f8ff; } }
td.cell-name { max-width: 220px; }
.thumb { width: 48px; height: 48px; border-radius: 10px; overflow: hidden; background: var(--pri-soft); display: grid; place-items: center; color: var(--pri); --od-icon-size: 20px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 13px; }
.muted { color: var(--sub); }
.check { width: 16px; height: 16px; accent-color: var(--pri); }

.tag { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; --od-icon-size: 12px; }
.tag-pri { background: var(--pri-soft); color: var(--pri-ink); }
.tag-pink { background: var(--pink-soft); color: var(--pink); }
.tag-blue { background: var(--blue-soft); color: var(--blue); }
.tag-orange { background: var(--orange-soft); color: var(--orange); }
.tag-green { background: var(--green-soft); color: var(--green); }
.tag-red { background: var(--red-soft); color: var(--red); }
.tag-gray { background: var(--gray-soft); color: #6b6880; }

.ops { display: flex; gap: 4px; }
.link { border: 0; background: transparent; padding: 4px 6px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--pri-ink); white-space: nowrap; }
@media (hover: hover) { .link:hover { background: var(--pri-soft); } }
.link-danger { color: var(--red); }
@media (hover: hover) { .link-danger:hover { background: var(--red-soft); } }
.link-warn { color: var(--orange); }
@media (hover: hover) { .link-warn:hover { background: var(--orange-soft); } }

.pager { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px 20px; font-size: 13px; color: var(--sub); }
.pager .select { height: 32px; font-size: 13px; }
.pages { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.pg { min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; font-size: 13px; color: var(--ink); --od-icon-size: 14px; display: grid; place-items: center; }
@media (hover: hover) { .pg:hover:not(:disabled) { background: var(--pri-soft); color: var(--pri-ink); } }
.pg[aria-current="page"] { background: var(--grad); color: #fff; font-weight: 700; }
.pg:disabled { color: #b9b6c8; cursor: not-allowed; }

.empty { padding: 48px 20px; text-align: center; color: var(--sub); }
.empty b { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- side drawer ---------- */
.drawer { position: sticky; top: 84px; display: flex; flex-direction: column; max-height: calc(100vh - 100px); animation: slideIn var(--t-mid) ease-out; }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 18px 20px 12px; }
.drawer-head h2 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; }
.drawer-body { padding: 4px 20px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.drawer-foot { display: flex; gap: 10px; padding: 14px 20px 18px; border-top: 1px solid var(--line); }
.drawer-foot .btn { flex: 1; }
.scrim { display: none; }
.gen-panel { position: sticky; top: 84px; display: flex; flex-direction: column; }

.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--ink); }
.req { color: var(--red); margin-right: 2px; }
.help { font-size: 12px; color: var(--sub); }
.err { font-size: 12px; color: var(--red); font-weight: 600; }
.input-count { position: relative; }
.input-count .input { width: 100%; padding-right: 56px; }
.input-count .count { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-size: 12px; color: var(--mute); }
.drop {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  min-height: 120px; padding: 16px; border: 1.5px dashed #c7c3f1; border-radius: 12px; background: #f8f7ff;
  color: var(--sub); font-size: 12px; text-align: center; width: 100%; --od-icon-size: 26px;
  transition: border-color var(--t-fast) ease-out, background var(--t-fast) ease-out;
}
.drop b { color: var(--ink); font-size: 13px; }
.drop .od-icon { color: var(--pri); }
@media (hover: hover) { .drop:hover { border-color: var(--pri); background: var(--pri-soft); } }
.drop.has-img { padding: 0; overflow: hidden; border-style: solid; }
.drop.has-img img { width: 100%; height: 160px; object-fit: contain; display: block; background: #f3f2fb; }
.details { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.detail { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--pri-soft); }
.detail img { width: 100%; height: 100%; object-fit: cover; display: block; }
.detail .x {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; border-radius: 50%; border: 0;
  display: grid; place-items: center; background: rgba(38, 35, 60, .7); color: #fff; --od-icon-size: 12px;
}
.add-tile { aspect-ratio: 1; border: 1.5px dashed #c7c3f1; border-radius: 10px; background: #f8f7ff; color: var(--pri-ink); font-size: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; --od-icon-size: 18px; }
.stepper { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: #fff; }
.stepper .input { border: 0; border-radius: 0; flex: 1; text-align: left; }
.stepper .input:focus { box-shadow: none; }
.stepper:focus-within { border-color: var(--pri); box-shadow: 0 0 0 3px rgba(74, 108, 247, .18); }
.stepper button { width: 38px; height: 38px; border: 0; border-left: 1px solid var(--line); background: #fafaff; --od-icon-size: 14px; display: grid; place-items: center; }
.radios { display: flex; gap: 20px; }
.radio { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.radio input { accent-color: var(--pri); width: 16px; height: 16px; }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 24px; margin: 0; cursor: pointer; }
.switch .track { width: 44px; height: 24px; border-radius: 12px; background: #d6d4e3; position: relative; transition: background var(--t-fast) ease-out; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform var(--t-fast) ease-out; }
.switch input:checked + .track { background: var(--pri); }
.switch input:checked + .track::after { transform: translateX(20px); }
.switch input:focus-visible + .track { outline: 2px solid var(--pri); outline-offset: 2px; }

.user-card { padding: 16px; border-radius: 14px; background: #fafaff; display: flex; flex-direction: column; gap: 12px; }
.kv small { display: block; font-size: 12px; color: var(--sub); }
.kv b { display: block; font-size: 15px; word-break: break-all; }
.balance {
  display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 16px; color: #fff; background: var(--grad);
  box-shadow: 0 14px 28px -14px rgba(74, 108, 247, .8); --od-icon-size: 34px;
}
.balance small { display: block; font-size: 13px; opacity: .9; }
.balance b { display: block; font-size: 30px; font-weight: 800; line-height: 1.1; }
.balance b span { font-size: 15px; font-weight: 600; margin-left: 4px; }
.act-list { display: flex; flex-direction: column; gap: 10px; }
.act-list .btn { min-height: 44px; }

.tip { display: flex; gap: 8px; padding: 12px; border-radius: 12px; background: var(--pri-soft); color: var(--pri-ink); font-size: 12px; --od-icon-size: 16px; }

/* ---------- overview ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat { padding: 20px; display: flex; gap: 14px; align-items: center; }
.stat-ic { flex: none; width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; --od-icon-size: 22px; }
.stat-num { font-size: 26px; font-weight: 800; line-height: 1.15; white-space: nowrap; }
.stat-cap { font-size: 13px; color: var(--sub); }
.two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.panel-title { margin: 0 0 12px; font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.chart > .trend-chart { width: 100%; height: auto; display: block; }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.rank li { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.rank-no { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--gray-soft); color: var(--sub); }
.rank li:nth-child(-n+3) .rank-no { background: var(--grad); color: #fff; }
.bar { height: 6px; border-radius: 3px; background: var(--pri-soft); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; border-radius: 3px; background: var(--grad); }

/* ---------- home config ---------- */
.slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.slot { padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.slot-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; color: var(--sub); }
.slot-img { aspect-ratio: 1; border-radius: 14px; overflow: hidden; }
.slot-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot-img.is-empty { border: 1.5px dashed #c7c3f1; background: #f6f5ff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #7d78b8; font-size: 13px; --od-icon-size: 28px; }
.slot-ops { display: flex; gap: 6px; }
.slot-ops .btn { flex: 1; padding: 0 6px; }
.json-out { margin: 0; padding: 14px; border-radius: 12px; background: #1f1d33; color: #e6e4ff; font-size: 12px; line-height: 1.6; max-height: 260px; overflow: auto; white-space: pre; }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 28px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }

/* ---------- dialog / toast ---------- */
dialog.dlg {
  border: 0; padding: 0; border-radius: 18px; width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow-pop); color: var(--ink);
}
dialog.dlg[open] { animation: popIn var(--t-mid) ease-out; }
dialog.dlg::backdrop { background: rgba(38, 35, 60, .32); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 20px 20px 8px; --od-icon-size: 22px; }
.dlg-head h2 { margin: 0; font-size: 17px; flex: 1; }
.dlg-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none; --od-icon-size: 18px; }
.dlg-ic.danger { background: var(--red-soft); color: var(--red); }
.dlg-ic.info { background: var(--pri-soft); color: var(--pri-ink); }
.dlg-body { padding: 8px 20px 4px; display: flex; flex-direction: column; gap: 14px; color: var(--sub); }
.dlg-body .form-field { color: var(--ink); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px 20px; }

.toasts { position: fixed; left: 50%; top: 20px; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 12px; background: #26233c; color: #fff; font-size: 14px; box-shadow: var(--shadow-pop); animation: popIn var(--t-mid) ease-out; --od-icon-size: 16px; }
.toast .od-icon { color: #8ee0b0; }

/* ---------- responsive ---------- */
@media (max-width: 1440px) { .work.has-side { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  :root { --side-w: 72px; }
  .side { padding: 20px 10px; align-items: center; }
  .logo-name, .nav-label, .side-foot { display: none; }
  .nav-item { justify-content: center; padding: 0; width: 48px; }
  .nav-item[aria-current="page"] { box-shadow: none; }
  .work.has-side { grid-template-columns: minmax(0, 1fr); }
  .drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 60; width: min(380px, 100vw); max-height: none; border-radius: 20px 0 0 20px; }
  .gen-panel { position: static; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(38, 35, 60, .3); border: 0; }
  .two { grid-template-columns: minmax(0, 1fr); }
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 768px) {
  .topbar, .page { padding-left: 16px; padding-right: 16px; }
  .range-text { display: none; }
  .slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search .input { width: 160px; }
}
@media (max-width: 480px) {
  :root { --side-w: 60px; }
  .nav-item { width: 44px; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .crumb { display: none; }
  .top-actions { margin-left: 0; width: 100%; justify-content: space-between; }
  .me-name { display: none; }
  .search, .search .input { width: 100%; flex: 1; }
  .drawer { width: 100vw; border-radius: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Connected forms use the original design's drawer and dialog components. */
[hidden] { display:none !important; }
a.nav-item,a.link { text-decoration:none; }
.catalog-filters,.page-content { display:contents; }
.pages #page-buttons { display:contents; }
#editor-form { display:flex; flex-direction:column; min-height:0; max-height:inherit; }
#editor .drawer-body { flex:1; min-height:0; }
.drawer-fields { display:flex; flex-direction:column; gap:16px; }
.prompt-input { width:100%; min-height:160px; resize:vertical; }
.description-input { width:100%; min-height:80px; resize:vertical; }
.upload-label { cursor:pointer; }
.case-picker { display:grid; gap:8px; max-height:180px; overflow:auto; }
#history pre,.snapshot { white-space:pre-wrap; overflow-wrap:anywhere; font-size:12px; line-height:1.7; padding:12px; background:var(--bg-2); border-radius:10px; max-height:240px; overflow:auto; }
#error,.form-error { padding:12px 14px; background:var(--red-soft); color:var(--red); border-radius:10px; margin:0; }
.form-error { margin:0 20px; }
.form-field textarea { height:auto; padding:10px 12px; }
.checkbox-cell { width:44px; }
.cell-name .help { display:block; }
.user-reference { max-width:180px; overflow-wrap:anywhere; white-space:normal; }
.audit-change { max-width:340px; white-space:normal; overflow-wrap:anywhere; }
.readonly-value { color:var(--ink); font-weight:600; max-width:65%; overflow-wrap:anywhere; text-align:right; }
#operations-page { display:contents; }
.overview-shortcuts { padding:14px 20px; display:flex; align-items:center; flex-wrap:wrap; gap:12px; }
.overview-shortcuts .panel-title { margin:0 8px 0 0; padding-right:20px; border-right:1px solid var(--line-2); }
.overview-shortcuts .btn:not(.btn-pri) { background:var(--pri-soft); color:var(--pri-ink); }
.overview-shortcuts a.btn { text-decoration:none; }
.overview-side,.overview-todos { display:grid; gap:12px; align-content:start; }
.overview-side { gap:16px; }
.overview-todo { display:flex; align-items:center; gap:12px; padding:12px; border:1px solid var(--line); border-radius:12px; text-decoration:none; color:var(--ink); background:var(--bg-2); }
.overview-todo strong { flex:1; font-size:14px; }
.overview-todo small { display:block; color:var(--sub); font-size:11px; font-weight:400; }
.overview-todo b { font-size:22px; }
.todo-symbol { display:grid; place-items:center; --od-icon-size:24px; }
.todo-errors .todo-symbol,.todo-errors b { color:var(--red); }
.todo-expiring .todo-symbol,.todo-expiring b { color:var(--pri); }
.overview-todo:hover { border-color:var(--pri); }
.overview-section-head { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:18px 20px 12px; }
.overview-section-head .panel-title { margin:0; }
.overview-recent { overflow:hidden; }
.overview-recent .table-wrap { padding:0 12px 12px; }
.overview-recent th { background:var(--pri-soft); }
.overview-recent tbody tr:last-child td { border-bottom:0; }
.recent-user { display:inline-flex; align-items:center; gap:10px; color:var(--ink); }
.recent-avatar { display:grid; place-items:center; width:36px; height:36px; flex:none; border-radius:10px; background:var(--pri-soft); color:var(--pri-ink); font-size:16px; }
.recent-template { color:var(--pri-ink); }
#user-drawer .drawer-body { overflow-y:auto; }
.slot .slot-img img { width:100%; height:100%; object-fit:cover; }
@media(max-width:1024px) { .work.has-side .drawer { overflow-y:auto; } }

.home-section{margin-top:24px}.home-order{display:grid;grid-template-columns:repeat(auto-fit,minmax(190px,1fr));gap:16px;margin:20px 0}.generation-preview{text-align:center}.generation-preview img{max-width:100%;max-height:65vh;object-fit:contain;border-radius:12px}
