/* Peeksy — administrator design system */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jbmono-latin-500.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #090a0f;
  --bg-2: #0d0f15;
  --surface: #111319;
  --surface-2: #161921;
  --surface-3: #1c2029;
  --surface-hover: #1f2330;
  --border: rgba(255, 255, 255, 0.065);
  --border-2: rgba(255, 255, 255, 0.11);
  --border-3: rgba(255, 255, 255, 0.18);
  --text: #eceef4;
  --text-2: #a3aabb;
  --text-3: #6c7387;
  --accent: #8b7bff;
  --accent-2: #6b8cff;
  --accent-ink: #ffffff;
  --accent-soft: rgba(139, 123, 255, 0.13);
  --accent-ring: rgba(139, 123, 255, 0.42);
  --grad: linear-gradient(135deg, #9a8aff 0%, #6b8cff 100%);
  --s-available: #78a0ff;
  --s-unopened: #a796ff;
  --s-viewing: #f4b648;
  --s-expired: #ff8b5e;
  --s-archived: #3ccfa6;
  --s-deleted: #ff5f76;
  --ok: #3ccfa6;
  --warn: #f4b648;
  --danger: #ff5f76;
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-2: 0 10px 30px -10px rgba(0, 0, 0, 0.6), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-3: 0 30px 80px -20px rgba(0, 0, 0, 0.75), 0 8px 24px rgba(0, 0, 0, 0.4);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --sidebar-w: 256px;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "cv11", "ss01", "ss03";
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
code, .mono { font-family: var(--mono); font-size: 0.92em; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-ring); outline-offset: 2px; }
::selection { background: rgba(139, 123, 255, 0.35); }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Buttons ---------- */
.btn {
  --h: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--h);
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 550;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: background 0.18s var(--ease), border-color 0.18s var(--ease), transform 0.12s var(--ease), box-shadow 0.18s var(--ease), opacity 0.18s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.btn svg { flex: none; width: 16px; height: 16px; }
.btn:hover { background: var(--surface-hover); border-color: var(--border-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.btn-primary {
  background: var(--grad);
  border-color: transparent;
  color: var(--accent-ink);
  box-shadow: 0 6px 20px -8px rgba(122, 116, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.btn-primary:hover { background: var(--grad); filter: brightness(1.08); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: rgba(255, 95, 118, 0.12); border-color: rgba(255, 95, 118, 0.32); color: #ffb3bf; }
.btn-danger:hover { background: rgba(255, 95, 118, 0.2); border-color: rgba(255, 95, 118, 0.5); }
.btn-danger-solid { background: #e5485f; border-color: transparent; color: #fff; }
.btn-danger-solid:hover { background: #f05369; border-color: transparent; }
.btn-sm { --h: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn-lg { --h: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn-label { opacity: 0.6; }
.btn.is-loading::after {
  content: "";
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- Forms ---------- */
.field { display: grid; gap: 7px; margin-bottom: 16px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 560; color: var(--text-2); letter-spacing: 0.01em; }
.field-hint { font-size: 12.5px; color: var(--text-3); }
.input, .select {
  width: 100%;
  height: 42px;
  padding: 0 13px;
  border-radius: 10px;
  border: 1px solid var(--border-2);
  background: var(--bg-2);
  color: var(--text);
  font-size: 14.5px;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  min-width: 0;
}
.input::placeholder { color: var(--text-3); }
.input:hover, .select:hover { border-color: var(--border-3); }
.input:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.input-wrap { position: relative; display: block; }
.input-wrap .input { padding-right: 44px; }
.input-affix { position: absolute; right: 4px; top: 4px; width: 34px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--text-3); display: grid; place-items: center; }
.input-affix:hover { color: var(--text); background: var(--surface-3); }
.select {
  appearance: none;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6' fill='none' stroke='%23a3aabb' stroke-width='2.4' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.search {
  position: relative;
  flex: 1 1 220px;
  min-width: 0;
  max-width: 340px;
}
.search .input { height: 38px; padding-left: 36px; font-size: 13.5px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }

.check { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; color: var(--text-2); margin: 6px 0 12px; cursor: pointer; line-height: 1.4; }
.check input, .cbx {
  appearance: none;
  flex: none;
  width: 18px;
  height: 18px;
  margin: 0;
  border-radius: 5px;
  border: 1.5px solid var(--border-3);
  background: var(--bg-2);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.check input::after, .cbx::after {
  content: "";
  width: 10px; height: 6px;
  border: 2px solid #fff;
  border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px) scale(0);
  transition: transform 0.15s var(--ease);
}
.check input:checked, .cbx:checked { background: var(--accent); border-color: var(--accent); }
.check input:checked::after, .cbx:checked::after { transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.check-warn { color: #ffd59a; }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; color: var(--text-2); user-select: none; }
.switch input { appearance: none; width: 36px; height: 20px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-2); position: relative; margin: 0; cursor: pointer; transition: background 0.18s; flex: none; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #c9cedb; transition: transform 0.2s var(--ease), background 0.2s; }
.switch input:checked { background: var(--accent); border-color: var(--accent); }
.switch input:checked::after { transform: translateX(16px); background: #fff; }

.alert { padding: 11px 14px; border-radius: 10px; font-size: 13.5px; margin-bottom: 18px; border: 1px solid; }
.alert-error { background: rgba(255, 95, 118, 0.09); border-color: rgba(255, 95, 118, 0.3); color: #ffc2cb; }
.alert-info { background: rgba(120, 160, 255, 0.08); border-color: rgba(120, 160, 255, 0.25); color: #c9d8ff; }
.alert-success { background: rgba(60, 207, 166, 0.08); border-color: rgba(60, 207, 166, 0.28); color: #b6f0df; }
.alert-warn { background: rgba(244, 182, 72, 0.08); border-color: rgba(244, 182, 72, 0.3); color: #ffe0a6; }

/* ---------- Badges ---------- */
.badge {
  --c: var(--text-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 26%, transparent);
  white-space: nowrap;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--c); flex: none; }
.badge-neutral::before { display: none; }
.badge-available { --c: var(--s-available); }
.badge-unopened { --c: var(--s-unopened); }
.badge-viewing { --c: var(--s-viewing); }
.badge-viewing::before { animation: pulse 1.4s ease-in-out infinite; }
.badge-expired { --c: var(--s-expired); }
.badge-archived { --c: var(--s-archived); }
.badge-deleted { --c: var(--s-deleted); }
.badge-revoked { --c: var(--text-3); }

/* ---------- Auth / Install ---------- */
.auth-body { min-height: 100vh; min-height: 100dvh; background: radial-gradient(1200px 600px at 50% -10%, rgba(120, 110, 255, 0.12), transparent 60%), var(--bg); }
.auth-glow { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(500px 300px at 85% 110%, rgba(80, 140, 255, 0.07), transparent 70%); }
.auth-shell { position: relative; min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 34px 30px 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.01)), var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  animation: rise 0.45s var(--ease) both;
}
.auth-card-center { text-align: center; }
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 28px; }
.auth-brand-center { justify-content: center; }
.brand-mark { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 6px 14px rgba(120, 110, 255, 0.4)); }
.brand-name { font-size: 18px; font-weight: 680; letter-spacing: -0.02em; }
.auth-brand .badge { margin-left: auto; }
.auth-title { font-size: 24px; font-weight: 680; letter-spacing: -0.025em; margin-bottom: 6px; }
.auth-sub { color: var(--text-2); font-size: 14px; margin-bottom: 24px; }
.auth-form { margin-top: 4px; }
.auth-form .btn { margin-top: 8px; }
.auth-foot { margin-top: 22px; display: flex; align-items: center; justify-content: center; gap: 7px; font-size: 12px; color: var(--text-3); }

.install-card { max-width: 620px; }
.install-step { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 20px; }
.install-step h2 { font-size: 13px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-2); margin-bottom: 14px; }
.install-step p { color: var(--text-2); margin-bottom: 10px; }
.install-actions { display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 20px; margin-top: 8px; flex-wrap: wrap; }
.install-success { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: rgba(60, 207, 166, 0.14); color: var(--ok); margin-bottom: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.checklist li { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; font-size: 13.5px; }
.checklist li:nth-child(odd) { background: rgba(255, 255, 255, 0.015); }
.check-icon { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; }
.checklist .ok .check-icon { background: rgba(60, 207, 166, 0.18); box-shadow: inset 0 0 0 4px rgba(60, 207, 166, 0.0), inset 0 0 0 5px var(--ok); }
.checklist .warn .check-icon { box-shadow: inset 0 0 0 5px var(--warn); }
.checklist .fail .check-icon { box-shadow: inset 0 0 0 5px var(--danger); }
.check-label { min-width: 0; overflow-wrap: anywhere; }
.check-note { color: var(--text-3); font-size: 12px; text-align: right; }
.checklist .fail .check-note { color: #ff9aaa; }
.code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  padding: 11px 13px;
  margin: 0 0 14px;
  color: #cfd5ff;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* ---------- App shell ---------- */
.app-body { min-height: 100vh; min-height: 100dvh; }
.app { min-height: 100vh; min-height: 100dvh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0e1016, #0b0c11);
  border-right: 1px solid var(--border);
  padding: 18px 14px max(14px, env(safe-area-inset-bottom));
  z-index: 40;
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 22px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand .brand-mark { width: 30px; height: 30px; }
.brand .brand-name { font-size: 17px; }
.sidebar-close { display: none; }
.nav { display: grid; gap: 2px; overflow-y: auto; flex: 1; align-content: start; }
.nav-section { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); padding: 14px 10px 8px; }
.nav-section:first-child { padding-top: 2px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--text-2);
  font-weight: 540;
  font-size: 13.5px;
  transition: background 0.15s, color 0.15s;
}
.nav-item svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-item:hover { background: rgba(255, 255, 255, 0.035); color: var(--text); }
.nav-item.active { background: linear-gradient(90deg, rgba(139, 123, 255, 0.16), rgba(139, 123, 255, 0.04)); color: #fff; }
.nav-item.active::before { content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--grad); }
.nav-item.active svg { color: #b4a9ff; }
.nav-count { margin-left: auto; font-size: 11.5px; font-weight: 600; color: var(--text-3); font-variant-numeric: tabular-nums; }
.nav-count:empty { display: none; }
.sidebar-foot { display: grid; gap: 10px; border-top: 1px solid var(--border); padding-top: 14px; }
.worker-chip { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); padding: 0 8px; min-width: 0; }
.worker-chip span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.worker-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text-3); flex: none; }
.worker-chip.ok .dot { background: var(--ok); box-shadow: 0 0 0 3px rgba(60, 207, 166, 0.15); }
.worker-chip.warn .dot { background: var(--warn); box-shadow: 0 0 0 3px rgba(244, 182, 72, 0.15); }
.account { display: flex; align-items: center; gap: 10px; padding: 6px 4px 0 6px; }
.avatar { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); border: 1px solid var(--border-2); font-weight: 650; font-size: 13px; color: #c9c2ff; flex: none; }
.account-meta { display: grid; line-height: 1.25; min-width: 0; flex: 1; }
.account-meta strong { font-size: 13px; font-weight: 600; }
.account-meta span { font-size: 12px; color: var(--text-3); }
.account form { margin: 0; }

.main { margin-left: var(--sidebar-w); min-width: 0; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  padding: 12px 32px;
  background: rgba(9, 10, 15, 0.78);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav-toggle { display: none; }
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { font-size: 18px; font-weight: 660; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-sub:empty { display: none; }
.topbar-actions { display: flex; gap: 8px; flex: none; }
.content { padding: 28px 32px 56px; width: 100%; outline: none; animation: fade 0.25s var(--ease) both; }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(2px); z-index: 35; animation: fade 0.2s both; }

/* ---------- Cards / sections ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2 { font-size: 14px; font-weight: 640; letter-spacing: -0.01em; }
.card-head .link { font-size: 12.5px; color: var(--text-2); font-weight: 540; }
.card-head .link:hover { color: var(--text); }
.card-body { padding: 18px 20px; }
.section-gap { display: grid; gap: 20px; }

.stats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.stat {
  --c: var(--accent);
  position: relative;
  overflow: hidden;
  padding: 16px 16px 15px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: border-color 0.2s, transform 0.2s var(--ease), background 0.2s;
  text-align: left;
  min-width: 0;
}
a.stat:hover { border-color: color-mix(in srgb, var(--c) 35%, transparent); transform: translateY(-1px); background: var(--surface-2); }
.stat::after { content: ""; position: absolute; inset: auto -30% -60% auto; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 20%, transparent), transparent 70%); pointer-events: none; }
.stat-label { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-label::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.stat-value { font-size: 28px; font-weight: 680; letter-spacing: -0.03em; margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.stat-hint { font-size: 11.5px; color: var(--text-3); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.overview-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; }
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(139, 123, 255, 0.22);
  background: radial-gradient(600px 200px at 0% 0%, rgba(139, 123, 255, 0.16), transparent 70%), radial-gradient(400px 200px at 100% 100%, rgba(107, 140, 255, 0.1), transparent 70%), var(--surface);
}
.hero h2 { font-size: 18px; font-weight: 660; letter-spacing: -0.02em; margin-bottom: 4px; }
.hero p { color: var(--text-2); max-width: 560px; }
.hero-actions { display: flex; gap: 10px; flex: none; flex-wrap: wrap; }

.kv { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }

.feed { list-style: none; margin: 0; padding: 4px 0; }
.feed li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 20px; }
.feed li + li { border-top: 1px solid var(--border); }
.feed-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.feed-icon svg { width: 15px; height: 15px; }
.feed-text { min-width: 0; font-size: 13px; }
.feed-text strong { font-weight: 560; }
.feed-text span { display: block; color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-time { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- Toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar-spacer { flex: 1; }
.segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button { border: 0; background: transparent; color: var(--text-2); height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 550; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px; transition: background 0.15s, color 0.15s; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), inset 0 0 0 1px var(--border-2); }
.segmented .count { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.view-switch { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; }
.view-switch button { width: 32px; height: 30px; border: 0; border-radius: 8px; background: transparent; color: var(--text-3); display: grid; place-items: center; }
.view-switch button.active { background: var(--surface-3); color: var(--text); }
.view-switch svg { width: 16px; height: 16px; }

/* ---------- Photo grid ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 264px), 1fr)); gap: 16px; }
.pcard {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s var(--ease), box-shadow 0.2s;
  min-width: 0;
  animation: rise 0.35s var(--ease) both;
}
.pcard:hover { border-color: var(--border-2); box-shadow: var(--shadow-2); }
.pcard.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), var(--shadow-2); }
.pthumb { position: relative; aspect-ratio: 4 / 3; background: repeating-conic-gradient(#14161d 0 25%, #111319 0 50%) 50% / 18px 18px; overflow: hidden; border: 0; padding: 0; width: 100%; display: block; cursor: zoom-in; }
.pthumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s var(--ease), opacity 0.3s; opacity: 0; }
.pthumb img.loaded { opacity: 1; }
.pcard:hover .pthumb img { transform: scale(1.03); }
.pthumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, transparent 30%, transparent 70%, rgba(0, 0, 0, 0.35) 100%); pointer-events: none; }
.pthumb-missing { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); font-size: 12.5px; z-index: 1; text-align: center; padding: 10px; }
.pbadges { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; z-index: 2; pointer-events: none; }
.pbadges .badge { backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); background: color-mix(in srgb, var(--c) 22%, rgba(10, 11, 16, 0.72)); }
.pselect { pointer-events: auto; width: 22px; height: 22px; border-radius: 7px; background: rgba(10, 11, 16, 0.6); border-color: rgba(255, 255, 255, 0.4); backdrop-filter: blur(8px); }
.pbody { padding: 13px 14px 12px; display: grid; gap: 3px; min-width: 0; }
.pname { display: block; width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -0.005em; }
.pmeta { display: flex; gap: 6px; flex-wrap: wrap; color: var(--text-3); font-size: 12px; font-variant-numeric: tabular-nums; }
.pmeta span + span::before { content: "·"; margin-right: 6px; }
.ptimes { display: grid; gap: 3px; margin-top: 8px; padding-top: 9px; border-top: 1px dashed var(--border-2); font-size: 12px; }
.ptimes div { display: flex; justify-content: space-between; gap: 10px; }
.ptimes dt { color: var(--text-3); }
.ptimes dd { margin: 0; color: var(--text-2); font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plink { display: flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 6px 6px 10px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--border); min-width: 0; }
.plink code { flex: 1; min-width: 0; font-size: 11.5px; color: #c4bcff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plink .btn { flex: none; }
.pactions { display: flex; gap: 6px; padding: 0 14px 14px; margin-top: auto; }
.pactions .btn { flex: 1 1 auto; min-width: 0; }
.pactions .btn span { overflow: hidden; text-overflow: ellipsis; }
.pname:hover { color: #cfc8ff; }
.pactions .icon-btn { border: 1px solid var(--border-2); background: var(--surface-2); width: 32px; height: 32px; border-radius: 9px; }
.pactions .icon-btn:hover { border-color: var(--border-3); }
.pactions .icon-btn.danger:hover { color: #ff9aaa; border-color: rgba(255, 95, 118, 0.4); background: rgba(255, 95, 118, 0.1); }
.pwarn { margin: 0 14px 12px; font-size: 12px; color: #ffcf8a; background: rgba(244, 182, 72, 0.08); border: 1px solid rgba(244, 182, 72, 0.22); padding: 7px 9px; border-radius: 8px; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 640; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 12px 16px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background 0.12s; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.018); }
.table .cell-photo { display: flex; align-items: center; gap: 12px; min-width: 0; }
.table .cell-photo img, .table .cell-photo .tthumb { width: 44px; height: 34px; border-radius: 7px; object-fit: cover; background: var(--surface-3); flex: none; }
.table .cell-name { font-weight: 560; max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table .num { font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-2); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Activity list (responsive) */
.events { list-style: none; margin: 0; padding: 0; }
.events li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px 20px; }
.events li + li { border-top: 1px solid var(--border); }
.ev-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.ev-icon svg { width: 16px; height: 16px; }
.ev-icon.c-ok { color: var(--ok); background: rgba(60, 207, 166, 0.1); }
.ev-icon.c-warn { color: var(--warn); background: rgba(244, 182, 72, 0.1); }
.ev-icon.c-bad { color: var(--danger); background: rgba(255, 95, 118, 0.1); }
.ev-icon.c-accent { color: #b6abff; background: var(--accent-soft); }
.ev-main { min-width: 0; }
.ev-title { font-size: 13.5px; font-weight: 560; }
.ev-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-time { text-align: right; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ev-actor { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 650; color: var(--text-3); }

/* ---------- Upload ---------- */
.upload-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 6px;
  min-height: 280px;
  padding: 36px 24px;
  border-radius: var(--radius-xl);
  border: 1.5px dashed var(--border-3);
  background: radial-gradient(500px 220px at 50% 0%, rgba(139, 123, 255, 0.08), transparent 70%), var(--surface);
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
  cursor: pointer;
}
.dropzone:hover { border-color: rgba(139, 123, 255, 0.55); }
.dropzone.drag { border-color: var(--accent); background: radial-gradient(500px 260px at 50% 30%, rgba(139, 123, 255, 0.18), transparent 70%), var(--surface); transform: scale(1.005); }
.dz-icon { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--grad); color: #fff; box-shadow: 0 14px 30px -10px rgba(122, 116, 255, 0.7); margin-bottom: 12px; }
.dz-icon svg { width: 26px; height: 26px; }
.dz-title { font-size: 17px; font-weight: 640; letter-spacing: -0.015em; }
.dz-sub { color: var(--text-2); font-size: 13.5px; }
.dz-formats { display: flex; gap: 6px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.dz-formats span { font-size: 11px; font-weight: 650; letter-spacing: 0.06em; padding: 3px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.queue { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 10px; }
.qitem { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 10px 14px 10px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); animation: rise 0.3s var(--ease) both; }
.qthumb { width: 52px; height: 52px; border-radius: 10px; object-fit: cover; background: var(--surface-3); }
.qmain { min-width: 0; display: grid; gap: 5px; }
.qname { font-weight: 560; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qsub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qsub.err { color: #ff9aaa; white-space: normal; }
.qsub.ok { color: var(--ok); }
.progress { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: 4px; transition: width 0.2s; }
.qitem.done .progress > i { background: var(--ok); }
.qitem.fail .progress > i { background: var(--danger); width: 100% !important; }
.qactions { display: flex; gap: 6px; }
.tips { display: grid; gap: 14px; }
.tip { display: grid; grid-template-columns: 30px 1fr; gap: 12px; font-size: 13px; color: var(--text-2); }
.tip-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: #bdb3ff; }
.tip-icon svg { width: 15px; height: 15px; }
.tip strong { display: block; color: var(--text); font-weight: 600; margin-bottom: 1px; }

/* ---------- Bulk bar ---------- */
.bulkbar {
  position: sticky;
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 15;
  margin: 20px auto 0;
  width: fit-content;
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  border-radius: 14px;
  background: rgba(28, 32, 41, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-3);
  animation: rise 0.25s var(--ease) both;
  flex-wrap: wrap;
}
.bulkbar strong { font-size: 13.5px; font-weight: 600; margin-right: 6px; white-space: nowrap; }

/* ---------- Empty / loading ---------- */
.empty { display: grid; place-items: center; text-align: center; padding: 64px 24px; border: 1px dashed var(--border-2); border-radius: var(--radius-xl); background: radial-gradient(400px 160px at 50% 0%, rgba(139, 123, 255, 0.06), transparent 70%); }
.empty-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); margin-bottom: 16px; border: 1px solid var(--border-2); }
.empty-icon svg { width: 24px; height: 24px; }
.empty h3 { font-size: 16px; font-weight: 640; margin-bottom: 6px; letter-spacing: -0.01em; }
.empty p { color: var(--text-2); max-width: 400px; margin-bottom: 18px; }
.skeleton { background: linear-gradient(90deg, var(--surface) 0%, var(--surface-3) 50%, var(--surface) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; border-radius: var(--radius-lg); border: 1px solid var(--border); }
.sk-card { height: 300px; }
.sk-stat { height: 98px; }
.sk-row { height: 56px; border-radius: 12px; }
.loading-center { display: grid; place-items: center; padding: 60px; }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 2.5px solid var(--surface-3); border-top-color: var(--accent); animation: spin 0.75s linear infinite; }

/* ---------- Modal ---------- */
.modal-root:empty { display: none; }
.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(4, 5, 8, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); display: grid; place-items: center; padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom)); animation: fade 0.18s both; overflow-y: auto; }
.modal {
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), transparent 40%), var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-3);
  animation: pop 0.24s var(--ease) both;
  min-width: 0;
}
.modal-lg { max-width: 760px; }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 22px 0; }
.modal-head h3 { font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.modal-head p { color: var(--text-2); font-size: 13.5px; margin-top: 4px; }
.modal-head .icon-btn { margin: -6px -8px 0 auto; }
.modal-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: #bdb3ff; }
.modal-icon.danger { background: rgba(255, 95, 118, 0.13); color: #ff8fa0; }
.modal-icon.ok { background: rgba(60, 207, 166, 0.13); color: var(--ok); }
.modal-icon svg { width: 20px; height: 20px; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.urlbox { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 12px; background: var(--bg); border: 1px solid rgba(139, 123, 255, 0.3); box-shadow: 0 0 0 4px rgba(139, 123, 255, 0.06); min-width: 0; }
.urlbox code { flex: 1; min-width: 0; font-size: 12.5px; color: #d3ccff; overflow-wrap: anywhere; line-height: 1.45; padding: 4px 0; user-select: all; }
.notes { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 8px; font-size: 13px; color: var(--text-2); }
.notes li { display: flex; gap: 9px; align-items: flex-start; }
.notes li::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); margin-top: 7px; flex: none; }

.detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.detail-img { border-radius: 12px; overflow: hidden; background: repeating-conic-gradient(#14161d 0 25%, #111319 0 50%) 50% / 18px 18px; aspect-ratio: 4 / 3; display: grid; place-items: center; }
.detail-img img { width: 100%; height: 100%; object-fit: contain; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 12.5px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 16px; bottom: 0; width: 1px; background: var(--border-2); }
.timeline li:last-child::after { display: none; }
.timeline strong { font-weight: 580; display: block; font-size: 13px; }
.timeline span { color: var(--text-3); }
.subhead { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); margin: 18px 0 10px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(3, 4, 6, 0.94); display: flex; flex-direction: column; animation: fade 0.2s both; }
.lightbox-bar { display: flex; align-items: center; gap: 10px; padding: max(12px, env(safe-area-inset-top)) 16px 12px; min-width: 0; }
.lightbox-title { flex: 1; min-width: 0; font-weight: 580; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lightbox-title span { color: var(--text-3); font-weight: 450; margin-left: 8px; }
.lightbox-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 16px max(16px, env(safe-area-inset-bottom)); }
.lightbox-stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6); animation: pop 0.25s var(--ease) both; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 90; right: 20px; bottom: max(20px, env(safe-area-inset-bottom)); display: grid; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 13px 12px 13px 14px;
  border-radius: 14px;
  background: rgba(30, 34, 44, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-3);
  font-size: 13.5px;
  animation: toast-in 0.3s var(--ease) both;
}
.toast.leaving { animation: toast-out 0.25s var(--ease) both; }
.toast-icon { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; }
.toast-icon svg { width: 13px; height: 13px; }
.toast.ok .toast-icon { background: rgba(60, 207, 166, 0.16); color: var(--ok); }
.toast.err .toast-icon { background: rgba(255, 95, 118, 0.16); color: var(--danger); }
.toast.info .toast-icon { background: var(--accent-soft); color: #bdb3ff; }
.toast-msg { min-width: 0; overflow-wrap: anywhere; padding-top: 1px; }
.toast-msg strong { display: block; font-weight: 600; }
.toast-msg span { color: var(--text-2); font-size: 12.5px; }
.toast .icon-btn { width: 24px; height: 24px; margin: -2px -2px 0 0; border-radius: 7px; }
.toast .icon-btn svg { width: 14px; height: 14px; }

/* System page */
.sys-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 8px; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pill.bad::before { background: var(--danger); }
.notice-list { margin: 0; padding-left: 18px; color: var(--text-2); display: grid; gap: 6px; font-size: 13px; }

.noscript-admin { position: fixed; inset: auto 16px 16px; padding: 14px; border-radius: 12px; background: var(--danger); color: #fff; z-index: 99; }

/* ---------- Animations ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(16px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: 0.35; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1360px) {
  .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .upload-layout { grid-template-columns: minmax(0, 1fr); }
  .sys-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.28s var(--ease); box-shadow: var(--shadow-3); width: min(var(--sidebar-w), 84vw); padding-top: max(18px, env(safe-area-inset-top)); }
  .sidebar.open { transform: none; }
  .sidebar-close { display: inline-grid; }
  .main { margin-left: 0; }
  .nav-toggle { display: inline-grid; margin-left: -6px; }
  .topbar { padding: 10px 20px; padding-top: max(10px, env(safe-area-inset-top)); min-height: 60px; }
  .content { padding: 22px 20px 48px; }
}
@media (max-width: 720px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 24px; }
  .hero { flex-direction: column; align-items: flex-start; padding: 20px; }
  .detail { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
  .search { max-width: none; flex-basis: 100%; }
  .toolbar-spacer { display: none; }
  .modal-foot .btn { flex: 1 1 auto; }
  .auth-card { padding: 28px 22px 22px; }
}
@media (max-width: 560px) {
  .topbar { padding-left: 16px; padding-right: 16px; gap: 10px; }
  .topbar-actions .btn span { display: none; }
  .topbar-actions .btn { width: 38px; padding: 0; }
  .topbar-sub { display: none; }
  .content { padding: 18px 16px 40px; }
  .events li { grid-template-columns: 30px minmax(0, 1fr); padding: 12px 16px; }
  .ev-icon { width: 30px; height: 30px; }
  .ev-time { grid-column: 2; text-align: left; margin-top: -8px; }
  .ev-actor { display: inline; margin-right: 6px; }
  .feed li { padding: 10px 16px; }
  .card-head, .card-body { padding-left: 16px; padding-right: 16px; }
  .toasts { right: 16px; left: 16px; width: auto; bottom: auto; top: max(12px, env(safe-area-inset-top)); }
  .qitem { grid-template-columns: 44px minmax(0, 1fr); }
  .qthumb { width: 44px; height: 44px; }
  .qactions { grid-column: 1 / -1; justify-content: flex-end; }
  .dropzone { min-height: 230px; padding: 28px 18px; }
  .bulkbar { width: 100%; justify-content: space-between; }
  .checklist li { grid-template-columns: 18px minmax(0, 1fr); }
  .check-note { grid-column: 2; text-align: left; }
}
@media (max-width: 360px) {
  .stats { gap: 8px; }
  .stat { padding: 12px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 11.5px; }
  .segmented button { padding: 0 9px; }
}

.worker-result { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.worker-result span { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }

/* ---------- Viewer design ---------- */
.design-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.design-form { min-width: 0; }
.design-preview { position: sticky; top: 92px; display: grid; justify-items: center; }
.preview-head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.preview-head h2 { font-size: 14px; font-weight: 640; }
.phone { width: 300px; height: 610px; padding: 10px; border-radius: 44px; background: linear-gradient(160deg, #262a35, #12141b); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), inset 0 0 0 1px rgba(255, 255, 255, 0.05), var(--shadow-3); }
.phone-screen { position: relative; width: 280px; height: 590px; border-radius: 34px; overflow: hidden; background: #000; }
.pv-frame { position: absolute; left: 0; top: 0; width: 375px; height: 790px; border: 0; transform: scale(0.7467); transform-origin: 0 0; opacity: 0; transition: opacity 0.18s ease; pointer-events: none; }
.pv-frame.on { opacity: 1; }
.field-label-row { display: flex; justify-content: space-between; gap: 10px; }
.counter { color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.textarea { height: auto; min-height: 104px; padding: 11px 13px; line-height: 1.5; resize: vertical; }
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 95, 118, 0.15); }
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 20px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font-size: 12px; font-weight: 560; transition: border-color 0.15s, background 0.15s, color 0.15s; }
.swatch:hover { border-color: var(--border-3); color: var(--text); }
.swatch.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.swatch-dot { width: 28px; height: 28px; border-radius: 50%; }
.swatch-custom { background: conic-gradient(#ff5f76, #f4b648, #3ccfa6, #6b8cff, #9a8aff, #ff5f76); box-shadow: 0 0 0 3px var(--bg-2), 0 0 0 4px rgba(255, 255, 255, 0.14); }
.color-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.color-field { display: grid; gap: 7px; min-width: 0; }
.color-row { display: flex; gap: 8px; min-width: 0; }
.color-row input[type="color"] { appearance: none; -webkit-appearance: none; flex: none; width: 42px; height: 42px; padding: 3px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--bg-2); cursor: pointer; }
.color-row input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-row input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 7px; }
.color-row input[type="color"]::-moz-color-swatch { border: 0; border-radius: 7px; }
.color-row .input { font-size: 13px; text-transform: lowercase; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 10px; transition: opacity 0.2s; }
.icon-grid.is-off { opacity: 0.4; }
.icon-tile-wrap { position: relative; display: block; }
.icon-tile { width: 100%; aspect-ratio: 1; display: grid; place-items: center; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); padding: 0; transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s; overflow: hidden; }
.icon-tile svg { width: 24px; height: 24px; }
.icon-tile img { width: 70%; height: 70%; object-fit: contain; }
.icon-tile:hover { border-color: var(--border-3); color: var(--text); }
.icon-tile.active { border-color: var(--accent); background: var(--accent-soft); color: #d6d0ff; box-shadow: 0 0 0 1px var(--accent); }
.icon-add { border-style: dashed; color: var(--text-3); }
.icon-del { position: absolute; top: -7px; right: -7px; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border-2); background: var(--surface-3); color: var(--text-2); display: grid; place-items: center; padding: 0; opacity: 0; transition: opacity 0.15s, background 0.15s; }
.icon-del svg { width: 12px; height: 12px; }
.icon-tile-wrap:hover .icon-del, .icon-del:focus-visible { opacity: 1; }
.icon-del:hover { background: #e5485f; color: #fff; border-color: transparent; }
@media (hover: none) { .icon-del { opacity: 1; } }
.style-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.style-opt { display: grid; justify-items: center; gap: 8px; padding: 12px 6px 10px; border-radius: 12px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font-size: 12px; font-weight: 560; }
.style-opt:hover { border-color: var(--border-3); color: var(--text); }
.style-opt.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.style-sample { display: grid; place-items: center; width: 64px; height: 26px; border-radius: 8px; font-size: 11.5px; font-weight: 650; color: #fff; }
.s-gradient { background: var(--grad); }
.s-solid { background: var(--accent); }
.s-outline { box-shadow: inset 0 0 0 1.5px var(--accent); color: var(--text); }
.s-glass { background: rgba(255, 255, 255, 0.1); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18); color: var(--text); }
.s-soft { background: var(--accent-soft); color: #c9c1ff; }
.toggle-list { display: grid; gap: 14px; }
.savebar { position: sticky; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 15; margin-top: 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 10px 10px 18px; border-radius: 14px; background: rgba(28, 32, 41, 0.92); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--border-2); box-shadow: var(--shadow-3); flex-wrap: wrap; }
.savebar.is-dirty { border-color: rgba(139, 123, 255, 0.45); }
.savebar-state { font-size: 13px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.savebar-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.savebar-state.dirty { color: var(--text); }
.savebar-state.dirty::before { background: var(--warn); }
.savebar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 1180px) {
  .design-layout { grid-template-columns: minmax(0, 1fr); }
  .design-preview { position: static; order: -1; }
}
@media (max-width: 560px) {
  .color-grid { grid-template-columns: minmax(0, 1fr); }
  .savebar { padding: 10px; }
  .savebar-state { width: 100%; justify-content: center; }
  .savebar-actions { width: 100%; }
  .savebar-actions .btn { flex: 1 1 auto; }
  .preview-head { justify-content: center; }
}
@media (max-width: 340px) {
  .phone { width: 270px; height: 550px; border-radius: 40px; }
  .phone-screen { width: 250px; height: 530px; border-radius: 31px; }
  .pv-frame { transform: scale(0.6667); }
}
