@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("/fonts/plus-jakarta-sans.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root, html[data-theme="light"] {
  --bg: #FFFFFF;
  --nav: #F8FAFC;
  --surface: #FFFFFF;
  --ink: #202124;
  --muted: #5F6368;
  --line: #E8EAED;
  --blue: #1A73E8;
  --blue-hover: #1557B0;
  --blue-soft: #E8F0FE;
  --link: #1A73E8;
  --green: #1E8E3E;
  --green-soft: #E6F4EA;
  --amber: #F9AB00;
  --amber-soft: #FEF7E0;
  --red: #D93025;
  --red-soft: #FCE8E6;
  --ok: var(--green);
  --alert: var(--red);
  --warn: var(--amber);
  --fill: #F8FAFC;
  --shadow: 0 8px 24px rgba(32, 33, 36, 0.16);
  --preview-stage: #000000;
  --toast-bg: #202124;
  --toast-ink: #FFFFFF;
  --sans: "Plus Jakarta Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: 150ms ease;
  --rail: 256px;
  --top: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 24px;
  --paper: var(--bg);
  --sheet: var(--surface);
  --rule: var(--line);
  --hair: var(--line);
  --ink-2: var(--muted);
  --canvas: var(--bg);
  --bronze: var(--blue);
  --wax: var(--red);
  --pine: var(--green);
  --display: var(--sans);
}

html[data-theme="dark"], html[data-theme="night"], html.night {
  --bg: #1F1F1F;
  --nav: #1F1F1F;
  --surface: #2D2E30;
  --ink: #E8EAED;
  --muted: #9AA0A6;
  --line: #3C4043;
  --blue: #1A73E8;
  --blue-hover: #1557B0;
  --blue-soft: #1A3A5C;
  --link: #8AB4F8;
  --green: #81C995;
  --green-soft: #1E3B2A;
  --amber: #FDD663;
  --amber-soft: #3D3216;
  --red: #F28B82;
  --red-soft: #5C2B29;
  --ok: #81C995;
  --alert: #F28B82;
  --warn: #FDD663;
  --fill: #2D2E30;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --preview-stage: #000000;
  --toast-bg: #2D2E30;
  --toast-ink: #E8EAED;
  --paper: var(--bg);
  --sheet: var(--surface);
  --rule: var(--line);
  --hair: var(--line);
  --ink-2: var(--muted);
  --canvas: var(--bg);
  --bronze: var(--blue);
  --wax: var(--red);
  --pine: var(--green);
}

@media (prefers-color-scheme: dark) {
  html[data-theme="system"], html.theme-system {
    --bg: #1F1F1F;
    --nav: #1F1F1F;
    --surface: #2D2E30;
    --ink: #E8EAED;
    --muted: #9AA0A6;
    --line: #3C4043;
    --blue: #1A73E8;
    --blue-hover: #1557B0;
    --blue-soft: #1A3A5C;
    --link: #8AB4F8;
    --green: #81C995;
    --green-soft: #1E3B2A;
    --amber: #FDD663;
    --amber-soft: #3D3216;
    --red: #F28B82;
    --red-soft: #5C2B29;
    --ok: #81C995;
    --alert: #F28B82;
    --warn: #FDD663;
    --fill: #2D2E30;
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    --preview-stage: #000000;
    --toast-bg: #2D2E30;
    --toast-ink: #E8EAED;
    --paper: var(--bg);
    --sheet: var(--surface);
    --rule: var(--line);
    --hair: var(--line);
    --ink-2: var(--muted);
    --canvas: var(--bg);
    --bronze: var(--blue);
    --wax: var(--red);
    --pine: var(--green);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html {
  background: var(--bg);
  color: var(--ink);
  scrollbar-color: var(--line) var(--bg);
}
body {
  margin: 0;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 20px;
  background: var(--bg);
  color: var(--ink);
}
body.app {
  display: grid;
  grid-template-columns: var(--rail) 1fr;
  min-height: 100dvh;
}
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--link); }
h1, h2, h3 {
  font-family: var(--sans);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 .4rem;
  color: var(--ink);
}
h1 { font-size: 22px; line-height: 28px; }
h2 { font-size: 16px; line-height: 24px; }
.mono { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.wrap { overflow-wrap: anywhere; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.ico { width: 20px; height: 20px; flex: none; display: block; }
.fine { color: var(--muted); font-size: 12px; }
.kicker {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  margin: 0 0 .35rem;
}

.wordmark {
  font-family: var(--sans);
  font-size: 18px;
  font-weight: 500;
  text-decoration: none;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}
.wordmark .logo, .wordmark .mark, .mark-svg {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: cover;
  flex: none;
}
.tag { display: none; }

.rail {
  position: sticky;
  top: 0;
  height: 100dvh;
  width: var(--rail);
  padding: 16px 12px 16px;
  border-right: 1px solid var(--line);
  background: var(--nav);
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 20;
}
.spaces, .admin-spaces { display: flex; flex-direction: column; gap: 2px; margin-top: 16px; }
.space {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px;
  text-decoration: none;
  min-height: 40px;
  border-radius: var(--radius-pill);
  color: var(--ink);
  border: 0;
  font-weight: 500;
  font-size: 14px;
}
.space:hover { background: var(--fill); }
.space.is-current {
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 600;
}
html[data-theme="dark"] .space.is-current,
html.night .space.is-current {
  color: #8AB4F8;
}
.space .ico { color: inherit; }

.folder-tree {
  margin: 12px 8px 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  flex: 1;
  min-height: 0;
}
.folder-tree a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 0 8px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
}
.folder-tree a:hover { background: var(--fill); }
.quota-box {
  margin-top: auto;
  padding: 12px 8px 4px;
  border-top: 1px solid var(--line);
}
.quota-box p { margin: 0 0 8px; font-size: 12px; color: var(--muted); }
.quota-box a { font-size: 12px; font-weight: 500; }

.stage { min-width: 0; display: flex; flex-direction: column; min-height: 100dvh; background: var(--bg); }
.top {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--top);
  padding: 12px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.search-wrap { position: relative; flex: 1; max-width: 720px; }
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--nav);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0 16px;
  width: 280px;
  max-width: 100%;
  transition: width var(--ease), background var(--ease), box-shadow var(--ease);
}
.search:focus-within {
  width: min(560px, 100%);
  background: var(--surface);
  border-color: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent);
}
.search input {
  flex: 1;
  border: 0;
  background: transparent;
  outline: none;
  min-height: 44px;
  color: var(--ink);
}
.search .ico { color: var(--muted); }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.pane { padding: 24px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius-pill);
  font-weight: 500;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
}
.btn:hover { background: var(--fill); }
.btn:focus-visible, .icon-btn:focus-visible, a:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-primary:hover { background: var(--blue-hover); border-color: var(--blue-hover); color: #fff; }
.btn-danger {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}
.btn-danger:hover { filter: brightness(0.95); color: #fff; }
.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
}
.btn-ghost:hover { background: var(--fill); }
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--muted);
  text-decoration: none;
  border-radius: 50%;
}
.icon-btn:hover, .icon-btn.is-on { background: var(--blue-soft); color: var(--blue); }
.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  font-family: var(--mono);
}
.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  border-radius: 50%;
  overflow: hidden;
  padding: 0;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.3rem; }

.split-btn { display: inline-flex; position: relative; }
.split-btn > .btn { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split-more { position: relative; }
.split-more > summary {
  list-style: none;
  min-height: 40px;
  width: 36px;
  display: grid;
  place-items: center;
  background: var(--blue);
  color: #fff;
  border: 1px solid var(--blue);
  border-left: 1px solid color-mix(in srgb, #fff 28%, var(--blue));
  border-radius: 0 var(--radius-pill) var(--radius-pill) 0;
  cursor: pointer;
}
.split-more > summary::-webkit-details-marker { display: none; }
.split-more[open] > .split-menu,
.split-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 6px;
  z-index: 40;
}
.split-menu button, .split-menu a {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
}
.split-menu button:hover, .split-menu a:hover { background: var(--blue-soft); color: var(--blue); }

.acct { position: relative; }
.acct > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  font-size: 13px;
}
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary:hover { background: var(--fill); }
.acct-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 240px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 50;
}
.acct-menu a, .acct-menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  text-align: left;
}
.acct-menu a:hover, .acct-menu button:hover { background: var(--fill); }
.acct-menu .theme-row { display: flex; gap: 4px; padding: 6px; }
.acct-sep { height: 1px; background: var(--line); margin: 6px 0; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-end;
  padding-bottom: 16px;
  margin-bottom: 16px;
}
.toolbar-actions, .inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 13px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--blue); }
.sep { opacity: .5; }

.ledger {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ledger th {
  text-align: left;
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
.ledger td {
  padding: 0 12px;
  height: 44px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.ledger tbody tr:hover { background: var(--fill); }
.ledger tbody tr.is-selected { background: var(--blue-soft); }
.iname {
  font-size: 14px;
  font-weight: 500;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-more { opacity: 0.55; }
.row:hover .row-more, .row:focus-within .row-more, .row-more:focus { opacity: 1; }
.ledger.dense td, .ledger.dense th { padding: 6px 10px; height: auto; }
.c-check { width: 36px; }
.c-size, .c-mod, .c-own, .c-share { white-space: nowrap; }
.c-more { width: 44px; }
.item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-height: 32px;
  color: var(--ink);
}
.type {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--fill);
  color: var(--muted);
}
.type .ico { width: 16px; height: 16px; }
.type-folder { background: var(--amber-soft); color: #B06000; }
.type-pdf { background: var(--red-soft); color: var(--red); }
.type-image { background: var(--blue-soft); color: var(--blue); }
.type-file { background: var(--fill); color: var(--muted); }
.type-audio, .type-video { background: var(--blue-soft); color: var(--blue); }
html[data-theme="dark"] .type-folder, html.night .type-folder { color: var(--amber); }
.mark { display: inline-flex; align-items: center; gap: .2rem; color: var(--muted); font-size: 12px; }
.mark-share { color: var(--green); }

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}
.g-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-decoration: none;
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  color: var(--ink);
}
.g-thumb {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  background: var(--fill);
  overflow: hidden;
  border-radius: 8px;
}
.g-thumb img { width: 100%; height: 100%; object-fit: cover; }

.empty {
  max-width: 420px;
  margin: 72px auto;
  text-align: center;
  padding: 16px;
}
.empty p { margin: 0 0 16px; color: var(--muted); font-size: 14px; }
.empty-actions { display: flex; gap: 8px; justify-content: center; }
.empty-art {
  display: block;
  width: min(280px, 100%);
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  margin: 0 auto 16px;
  border-radius: 12px;
  background: var(--fill);
  border: 1px solid var(--line);
}
html[data-theme="dark"] .empty-art, html.night .empty-art { opacity: 0.9; }
.type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 8px;
  margin: 8px 0 16px;
}
.type-chip {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.type-chip strong { display: block; font-size: 13px; }

.banner {
  margin: 12px 24px 0;
  padding: 12px 16px;
  border: 1px solid var(--line);
  background: var(--blue-soft);
  color: var(--ink);
  border-radius: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.banner-alert { background: var(--red-soft); border-color: transparent; color: var(--red); }
.banner-ok { background: var(--green-soft); border-color: transparent; }
.pane > .banner { margin: 0 0 16px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack.tight { gap: 8px; }
label { display: flex; flex-direction: column; gap: 4px; }
label.check { flex-direction: row; align-items: center; gap: 8px; }
label span { font-size: 12px; color: var(--muted); font-weight: 500; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
input[type="search"], input[type="date"], select, textarea {
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-sm);
  color: var(--ink);
}
textarea { min-height: 88px; resize: vertical; }
.hint { color: var(--muted); font-style: normal; font-size: 12px; }

.auth-card, .panel, .sheet {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: none;
  padding: 24px;
  border-radius: 12px;
}
.auth-card { max-width: 420px; margin: 48px auto; }
.auth-card h1 { font-size: 24px; line-height: 30px; }
.slim-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.slim-main { padding: 24px; background: var(--bg); min-height: calc(100dvh - 64px); }
body.slim { background: var(--bg); }

body.auth {
  min-height: 100dvh;
  background: var(--nav);
}
.auth-stage {
  display: grid;
  grid-template-columns: minmax(320px, 46%) 1fr;
  min-height: 100dvh;
}
.auth-brand {
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 36px 40px 32px;
  color: #fff;
  background-color: #1557B0;
  background-image: linear-gradient(180deg, rgba(26, 115, 232, 0.22) 0%, rgba(21, 87, 176, 0.45) 38%, rgba(32, 33, 36, 0.78) 100%), url("/img/bg/auth.jpg");
  background-size: cover;
  background-position: center;
}
html[data-theme="dark"] .auth-brand,
html.night .auth-brand {
  background-color: #1F1F1F;
  background-image: linear-gradient(180deg, rgba(31, 31, 31, 0.35) 0%, rgba(31, 31, 31, 0.82) 100%), url("/img/bg/auth-dark.jpg");
}
.auth-brand .wordmark { color: #fff; align-self: flex-start; }
.auth-brand .wordmark span { font-weight: 500; }
.auth-brand-copy { margin-top: auto; max-width: 420px; }
.auth-brand-kicker {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #AECBFA;
}
.auth-brand-title {
  font-size: 36px;
  line-height: 42px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin: 0 0 14px;
  color: #fff;
}
.auth-brand-lede {
  margin: 0 0 28px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 15px;
  line-height: 24px;
  max-width: 34ch;
}
.auth-points {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
}
.auth-points li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  background: transparent;
  font-size: 14px;
  line-height: 20px;
  color: rgba(255, 255, 255, 0.92);
}
.auth-points .ico { color: #AECBFA; flex: none; }
.auth-brand-foot {
  margin: 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
}
.auth-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 56px 32px 48px;
  background: var(--nav);
}
.auth-panel-bar {
  position: absolute;
  top: 20px;
  right: 24px;
}
.auth-panel > .banner { margin: 0 auto 16px; max-width: 420px; width: 100%; }
.auth-main {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}
body.auth .auth-card {
  max-width: none;
  margin: 0;
  padding: 32px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 12px;
  animation: auth-in 150ms ease;
}
@keyframes auth-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
body.auth .auth-card h1 {
  font-size: 26px;
  line-height: 32px;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
body.auth .auth-card .kicker {
  color: var(--blue);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
html[data-theme="dark"] body.auth .auth-card .kicker,
html.night body.auth .auth-card .kicker { color: #8AB4F8; }
.auth-lede {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 14px;
  line-height: 22px;
}
.auth-form { gap: 16px; }
.auth-form .fld { margin-bottom: 0; }
.auth-form .fld-label { font-size: 13px; color: var(--ink); font-weight: 500; }
.auth-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.auth-label-row .fld-label { margin: 0; }
.auth-forgot {
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.auth-forgot:hover { text-decoration: underline; }
.auth-form input[type="email"],
.auth-form input[type="text"],
.auth-form input[type="password"] {
  min-height: 48px;
  font-size: 16px;
  width: 100%;
}
.auth-form .pw {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.auth-form .pw input {
  border: 0;
  background: transparent;
  border-radius: 8px 0 0 8px;
  min-height: 48px;
  outline: none;
}
.auth-form .pw .icon-btn {
  width: 48px;
  height: 48px;
  color: var(--muted);
  flex: none;
  border-radius: 0 8px 8px 0;
}
.auth-form .pw:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent);
}
.auth-form .fld-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--blue) 18%, transparent);
  outline: none;
}
.auth-submit { width: 100%; min-height: 48px; font-weight: 600; border-radius: 24px; }
.auth-foot { margin: 20px 0 0; }
.auth-account {
  margin: 0;
  padding: 10px 12px;
  background: var(--fill);
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink);
  word-break: break-all;
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-theme {
  display: inline-flex;
  gap: 0;
  padding: 2px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 24px;
}
.auth-theme .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
}
.auth-theme .icon-btn.is-on {
  background: var(--blue-soft);
  color: var(--blue);
}
.auth-card .banner { margin: 0 0 16px; }
.auth-card .banner.banner-alert {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.auth-card .banner .ico { flex: none; margin-top: 1px; }

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, .8fr);
  gap: 24px;
}
.preview-pane {
  background: var(--preview-stage);
  border: 1px solid var(--line);
  min-height: 240px;
  padding: 0;
  border-radius: 12px;
  overflow: hidden;
  color: #E8EAED;
}
.preview-img, video { max-width: 100%; height: auto; display: block; margin: 0 auto; }
.preview-frame { width: 100%; height: 70vh; border: 0; background: #000; }
.preview-text {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12px;
  margin: 0;
  padding: 16px;
  color: #E8EAED;
}
.table-scroll { overflow: auto; max-height: 70vh; }
.meta { display: grid; gap: 12px; }
.meta div { display: grid; grid-template-columns: 7.5rem 1fr; gap: 8px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.meta dt { color: var(--muted); font-size: 12px; }
.versions, .activity, .comments, .people, .notifs, .menu { list-style: none; margin: 0; padding: 0; }
.versions li, .activity li, .comments li, .people li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.comments li { display: block; }
.comments time { color: var(--muted); font-size: 12px; margin-left: 8px; }

.modal, .drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(32, 33, 36, 0.4);
  display: grid;
  place-items: center;
  padding: 16px;
}
.drawer { place-items: stretch end; }
.sheet {
  width: min(480px, 100%);
  max-height: 90dvh;
  overflow: auto;
}
.sheet.wide { width: min(640px, 100%); }
.drawer .sheet { height: 100%; width: min(380px, 100%); border-radius: 0; }
.sheet header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.menu a, .menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  background: none;
  border: 0;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  border-radius: 8px;
  padding: 0 8px;
}
.menu a:hover, .menu button:hover { background: var(--fill); }

.dock {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: min(360px, calc(100vw - 2rem));
  z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.dock header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.dock ul { list-style: none; margin: 0; padding: 8px 12px 12px; }
.dock li { margin: 8px 0; font-size: 13px; }
.prog {
  height: 4px;
  background: var(--fill);
  margin-top: 6px;
  border-radius: 4px;
  overflow: hidden;
}
.prog > span { display: block; height: 100%; background: var(--blue); width: 0; }

.drop-hint {
  margin-top: 16px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  border: 2px dashed var(--line);
  border-radius: 12px;
  background: var(--fill);
}
body.is-drag .drop-hint, body.is-drag .pane {
  outline: 2px dashed var(--blue);
  outline-offset: -8px;
}

.stats, .kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}
.stats article, .kpi {
  background: var(--blue-soft);
  border: 0;
  padding: 16px;
  border-radius: 12px;
}
.kpi-green { background: var(--green-soft); }
.kpi-amber { background: var(--amber-soft); }
.kpi-red { background: var(--red-soft); }
.kpi .kicker, .stats .kicker { color: var(--muted); }
.stat { font-family: var(--sans); font-size: 24px; font-weight: 600; margin: 0; color: var(--ink); }
html[data-theme="dark"] .kpi, html.night .kpi,
html[data-theme="dark"] .stats article, html.night .stats article { color: var(--ink); }

.subnav {
  display: none;
}
.admin-head {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}
.admin-head .search { width: min(420px, 100%); background: var(--nav); }
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: end;
}
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.meter {
  height: 8px;
  background: var(--line);
  border: 0;
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
}
.meter > span { display: block; height: 100%; background: var(--blue); }
.stack-bar {
  display: flex;
  height: 12px;
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
}
.stack-bar > span { display: block; height: 100%; }
.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  gap: 24px;
  margin-top: 24px;
}
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.timeline time { color: var(--muted); font-size: 12px; }
.who-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  background: var(--muted);
}
.status-dot.ok { background: var(--green); }
.status-dot.warn { background: var(--amber); }
.status-dot.off { background: var(--muted); }

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 8px 0 12px;
}
.notifs a { display: block; text-decoration: none; padding: 10px 0; border-bottom: 1px solid var(--line); color: var(--ink); }
.notifs .unread a { font-weight: 600; }
.notifs small { display: block; color: var(--muted); font-weight: 400; }
.seg {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  overflow: hidden;
}
.seg .icon-btn { border-radius: 0; }

.rail-toggle { display: none; }
.public-item { max-width: 860px; margin: 0 auto; padding: 24px; }

.skip {
  position: absolute;
  left: 12px;
  top: -3rem;
  z-index: 80;
  background: var(--blue);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
}
.skip:focus { top: 12px; }
.mark, .logo { width: 32px; height: 32px; object-fit: cover; border-radius: 8px; }
.avatar, .avatar-img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 0;
  background: var(--blue-soft);
}
.avatar-img.sm { width: 24px; height: 24px; }
.avatar-img.xl { width: 88px; height: 88px; }
.avatar-fallback {
  display: inline-grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
}
.people li { display: flex; align-items: center; gap: 10px; }
.notif-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.notif-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--blue-soft);
  color: var(--blue);
  flex: none;
}
.notif-mark .ico { width: 18px; height: 18px; }
.g-card { position: relative; }
.g-owner {
  position: absolute;
  right: 14px;
  bottom: 36px;
  width: 24px;
  height: 24px;
  border: 2px solid var(--surface);
}
.who { display: inline-flex; align-items: center; gap: 8px; }
.theme-switch {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: var(--nav);
  border-radius: var(--radius-pill);
  overflow: hidden;
  height: 40px;
  padding: 2px;
  gap: 0;
}
.theme-switch .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--muted);
}
.theme-switch .icon-btn.is-on {
  background: var(--blue-soft);
  color: var(--blue);
}
.pw { display: flex; align-items: center; gap: 4px; }
.pw input { flex: 1; }
.pick-list { max-height: 50vh; overflow: auto; border-top: 1px solid var(--line); }
.pick { padding: 8px; border-radius: 8px; }
.pick:hover { background: var(--fill); }
.atts { list-style: none; margin: 6px 0 0; padding: 0; }
.atts a { display: inline-flex; gap: 6px; align-items: center; }

.toast {
  background: var(--toast-bg);
  color: var(--toast-ink);
  padding: 12px 16px;
  font-size: 13px;
  border-radius: 8px;
  box-shadow: var(--shadow);
  border: 1px solid transparent;
}

@media (max-width: 860px) {
  .auth-stage { grid-template-columns: 1fr; min-height: 100dvh; }
  .auth-brand {
    min-height: 168px;
    padding: 20px 24px 24px;
    gap: 16px;
    border-right: 0;
  }
  .auth-brand-copy { margin-top: 0; max-width: none; }
  .auth-brand-title { font-size: 22px; line-height: 28px; margin-bottom: 0; }
  .auth-brand-title br { display: none; }
  .auth-brand-kicker, .auth-brand-lede, .auth-points, .auth-brand-foot { display: none; }
  .auth-panel {
    padding: 56px 20px calc(32px + env(safe-area-inset-bottom));
    justify-content: flex-start;
  }
  .auth-panel-bar { top: 12px; right: 16px; }
  body.auth .auth-card { padding: 24px; }
  body.app { grid-template-columns: 1fr; }
  .rail {
    position: fixed;
    left: 0;
    top: 0;
    width: min(280px, 86vw);
    transform: translateX(-105%);
    transition: transform var(--ease);
    z-index: 50;
  }
  .rail.is-open { transform: none; }
  .rail-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(32, 33, 36, 0.4);
    z-index: 45;
  }
  .rail-toggle {
    display: grid;
    place-items: center;
    position: fixed;
    left: 12px;
    bottom: 16px;
    z-index: 35;
    width: 48px;
    height: 48px;
    border: 0;
    border-radius: 50%;
    background: var(--blue);
    color: #fff;
    box-shadow: var(--shadow);
  }
  .top { padding-left: 16px; padding-right: 16px; }
  .pane { padding: 16px; }
  .detail { grid-template-columns: 1fr; }
  .c-own, .c-share, .c-mod { display: none; }
  .admin-grid { grid-template-columns: 1fr; }
  .acct > summary span { display: none; }
  .top-actions .btn span { display: none; }
  .theme-switch { height: 36px; }
  .theme-switch .icon-btn { width: 32px; height: 32px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
[hidden] { display: none !important; }
/* --- Modern UI/UX Design & Micro-Interaction Enhancements --- */
header.top {
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.ledger tbody tr.row {
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.ledger tbody tr.row:hover {
  background-color: var(--fill);
}

.row-actions-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-sm {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

.text-danger {
  color: var(--red) !important;
}

.text-danger:hover {
  background: var(--red-soft) !important;
  color: var(--red) !important;
}

.mark-share, .mark-private {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: background 0.15s ease, color 0.15s ease;
}

.mark-share {
  background: var(--blue-soft);
  color: var(--blue);
  border: 1px solid color-mix(in srgb, var(--blue) 25%, transparent);
}

.mark-private {
  background: var(--fill);
  color: var(--muted);
  border: 1px solid var(--line);
}

.g-card {
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, border-color 0.2s ease;
  border-radius: var(--radius);
}

.g-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  border-color: var(--blue);
}

.g-card:hover .g-thumb img {
  transform: scale(1.05);
}

.g-thumb img {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bulk-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  gap: 12px;
  z-index: 50;
  animation: bulkSlideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes bulkSlideUp {
  from { opacity: 0; transform: translate(-50%, 16px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

code { font-family: var(--mono); font-size: .9em; }
