:root {
  color-scheme: light;
  --side: #f3f3f3;
  --main: #fafafa;
  --ink: #141414;
  --muted: #6f6f6f;
  --faint: #8a8a8a;
  --line: rgba(0, 0, 0, .08);
  --hover: rgba(0, 0, 0, .05);
  --active: rgba(0, 0, 0, .07);
  --composer: #fff;
  --shadow: 0 10px 32px rgba(0, 0, 0, .06);
  --send: #141414;
  --send-ink: #fff;
  --danger: #c43b55;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --side: #181818;
  --main: #141414;
  --ink: #ececec;
  --muted: #9a9a9a;
  --faint: #7d7d7d;
  --line: rgba(255, 255, 255, .08);
  --hover: rgba(255, 255, 255, .06);
  --active: rgba(255, 255, 255, .09);
  --composer: #242424;
  --shadow: 0 12px 36px rgba(0, 0, 0, .38);
  --send: #ececec;
  --send-ink: #141414;
  --danger: #ff8b9a;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--main);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.app { display: flex; min-height: 100%; }
.side {
  position: relative;
  z-index: 31;
  width: 248px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 14px 10px 10px;
  transition: width .16s ease;
}
.brand-row { display: flex; align-items: center; gap: 4px; margin-bottom: 8px; }
.brand { display: flex; align-items: center; height: 44px; padding: 0 8px; min-width: 0; flex: 1; }
.brand img { height: 34px; width: auto; display: none; }
.brand .mark { width: 26px; height: 26px; }
html[data-theme="light"] .brand .word.on-light,
html[data-theme="dark"] .brand .word.on-dark { display: block; }
.fold { width: 32px; flex: none; justify-content: center; padding: 0; }
@media (min-width: 801px) {
  html[data-side="collapsed"] .side { width: 64px; padding-left: 8px; padding-right: 8px; }
  html[data-side="collapsed"] .brand-row { flex-direction: column; }
  html[data-side="collapsed"] .brand { flex: none; justify-content: center; height: 32px; padding: 0; }
  html[data-side="collapsed"] .brand .word { display: none !important; }
  html[data-side="collapsed"][data-theme="light"] .brand .mark.on-light,
  html[data-side="collapsed"][data-theme="dark"] .brand .mark.on-dark { display: block; }
  html[data-side="collapsed"] .nav span,
  html[data-side="collapsed"] .who { display: none; }
  html[data-side="collapsed"] .nav,
  html[data-side="collapsed"] .account { justify-content: center; padding: 0; gap: 0; }
}
.side nav { display: flex; flex-direction: column; gap: 2px; }
.nav {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  text-decoration: none;
}
.nav svg { flex: none; }
.nav:hover { background: var(--hover); }
.nav.active { background: var(--active); }
.nav span { font-size: 13.5px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.account { display: flex; align-items: center; gap: 8px; min-width: 0; width: 100%; height: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: inherit; font: inherit; text-align: left; text-decoration: none; cursor: pointer; }
.account-menu {
  position: fixed; z-index: 1000; width: 280px; padding: 6px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--composer); box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
}
.account-menu .head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 6px; }
.account-menu .head .avatar { width: 28px; height: 28px; font-size: 13px; }
.account-menu .name { font-size: 13px; font-weight: 600; }
.account-menu .sub, .account-menu .usage { color: var(--muted); font-size: 12px; }
.account-menu .usage-title { padding: 2px 8px 0; color: var(--muted); font-size: 11px; }
.account-menu .usage { display: flex; flex-direction: column; gap: 4px; padding: 4px 8px 8px; }
.account-menu .menu-line { display: flex; justify-content: space-between; gap: 12px; }
.account-menu .menu-line b { color: var(--ink); font-weight: 600; }
.account-menu .sep { height: 1px; margin: 4px 6px; background: var(--line); }
.account-menu .item {
  display: flex; align-items: center; width: 100%; height: 32px; padding: 0 8px;
  border: 0; border-radius: 8px; background: transparent; color: inherit;
  font: inherit; text-align: left; text-decoration: none;
}
.account-menu .item:hover { background: var(--hover); }
.account-menu .item.danger { color: var(--danger); }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.avatar {
  width: 20px; height: 20px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--main);
  font-size: 11px; font-weight: 600; line-height: 1;
}
.who { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
html.embed .side { display: none; }
.stage { flex: 1; min-width: 0; overflow: auto; background: var(--main); }
.page { width: min(1080px, calc(100% - 56px)); margin: 32px auto 48px; }
.page h1 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.03em; }
.lead { margin: 6px 0 18px; color: var(--muted); }
.tabs { display: flex; gap: 4px; margin: 0 0 18px; flex-wrap: wrap; }
.tabs button {
  height: 32px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent;
}
.tabs button.active, .tabs button:hover { background: var(--active); }
.panel, .card, .wrap, article {
  background: var(--composer);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.panel { padding: 18px 18px 16px; margin: 0 0 16px; }
.card { padding: 16px 18px; }
.card span, .label, .note, .stats, .empty, .sub { color: var(--muted); }
.card b, .value { display: block; margin-top: 4px; font-size: 22px; font-weight: 620; letter-spacing: -.03em; }
.grid, .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 0 0 16px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
article { overflow: hidden; }
.results article.on { box-shadow: inset 0 0 0 2px var(--ink); }
article video, article img { display: block; width: 100%; max-height: 420px; object-fit: contain; background: #0e0e0e; }
.results article img, .results article video { cursor: pointer; }
.meta { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 12px 12px; color: var(--muted); font-size: 12px; }
.meta span { min-width: 0; overflow-wrap: anywhere; }
.meta .btn { height: 28px; padding: 0 10px; flex: none; }
.meta input[type="checkbox"] { width: 16px; height: 16px; margin: 4px 0 0; padding: 0; flex: none; }
.tools { display: flex; align-items: center; gap: 8px; }
.tools .stats { white-space: nowrap; }
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; }
.filters input[type="search"] { width: min(260px, 100%); }
.filters select { width: auto; }
.seg { display: flex; gap: 6px; }
.seg button {
  height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--ink);
}
.seg button.on { background: var(--send); color: var(--send-ink); border-color: transparent; }
.btn.star.on { background: var(--send); color: var(--send-ink); border-color: transparent; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
h2 { margin: 0 0 8px; font-size: 15px; font-weight: 600; }
.table-wrap, .wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); font-size: 13px; white-space: nowrap; }
th { color: var(--muted); font-weight: 520; }
tr:last-child td { border-bottom: 0; }
.field { margin: 0 0 12px; }
label { display: block; margin: 0 0 6px; color: var(--muted); font-size: 13px; }
input, select {
  height: 38px; padding: 0 12px;
  border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--ink);
}
.field input, .field select, .limits-grid input, .limits-grid select { width: 100%; display: block; }
#create-form { display: flex; gap: 8px; align-items: center; }
#create-form input { width: 220px; }
input:focus, select:focus { outline: none; border-color: var(--ink); }
button.primary, .btn {
  height: 36px; padding: 0 14px; border: 0; border-radius: 10px;
  background: var(--send); color: var(--send-ink);
}
.btn.secondary { background: var(--hover); color: var(--ink); }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
button.primary { width: 100%; margin-top: 4px; }
button.primary:disabled, .btn:disabled { opacity: .45; cursor: default; }
.err { min-height: 18px; margin: 0 0 8px; color: var(--danger); font-size: 13px; }
.foot { margin: 14px 0 0; text-align: center; color: var(--faint); font-size: 13px; }
.foot a { color: var(--muted); text-decoration: none; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
code { font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--hover); padding: 2px 6px; border-radius: 6px; }
pre {
  padding: 14px; border-radius: 12px; overflow: auto;
  background: #161616; color: #e8e8e8;
  font: 12px/1.7 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.badge { padding: 2px 8px; border-radius: 999px; background: var(--hover); color: var(--ink); font-size: 12px; }
.secret { margin: 12px 0; padding: 14px; border-radius: 12px; background: var(--hover); }
.secret code { display: block; margin: 8px 0; white-space: normal; overflow-wrap: anywhere; }
.flow { height: 4px; margin-top: 10px; border-radius: 4px; background: var(--hover); overflow: hidden; }
.flow i { display: block; height: 100%; background: var(--ink); }
.limits-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin: 12px 0; }
#notice {
  position: fixed; right: 20px; bottom: 20px; z-index: 5;
  max-width: min(420px, calc(100% - 40px));
  padding: 10px 14px; border-radius: 12px;
  background: var(--send); color: var(--send-ink);
}
.gate { min-height: 100%; display: grid; place-items: center; padding: 32px 16px; }
.gate-stack { width: min(420px, 100%); }
.hero { height: 92px; margin: 0 0 22px; }
.hero svg { width: 100%; height: 100%; display: block; }
.gate .panel { padding: 8px 8px 14px; }
.gate h1 { margin: 8px 8px 0; font-size: 20px; }
.gate .lead { margin: 4px 8px 14px; }
.gate .field, .gate .err, .gate button.primary { margin-left: 8px; margin-right: 8px; }
.gate button.primary { width: calc(100% - 16px); }
.theme-float {
  position: fixed; top: 16px; right: 16px;
  height: 32px; padding: 0 12px; border: 0; border-radius: 8px;
  background: var(--hover); color: var(--ink);
}
.link { color: var(--ink); }
.head-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
@media (max-width: 1100px) {
  .app { flex-direction: column; }
  .side, html[data-side="collapsed"] .side {
    width: 100% !important;
    position: sticky;
    top: 0;
    z-index: 40;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: max(6px, env(safe-area-inset-top)) 10px 8px;
  }
  .fold { display: none; }
  .brand-row, html[data-side="collapsed"] .brand-row { flex-direction: row; margin: 0; flex: none; }
  .brand, html[data-side="collapsed"] .brand { height: 36px; width: auto; flex: none; padding: 0 2px; justify-content: center; }
  .brand .word { display: none !important; }
  html[data-theme="light"] .brand .mark.on-light,
  html[data-theme="dark"] .brand .mark.on-dark { display: block; }
  .side nav {
    flex: 1;
    min-width: 0;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .side nav::-webkit-scrollbar { display: none; }
  .side-foot { flex: none; flex-direction: row; align-items: center; margin: 0; gap: 2px; }
  html[data-side="collapsed"] .nav span,
  html[data-side="collapsed"] .who { display: inline; }
  .nav, .account, html[data-side="collapsed"] .nav, html[data-side="collapsed"] .account {
    flex: none;
    height: 36px;
    justify-content: flex-start;
    padding: 0 10px;
    gap: 8px;
  }
  .who { max-width: 7em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page { width: min(100% - 20px, 1080px); margin-top: 12px; }
  .two { grid-template-columns: 1fr; }
}
