:root {
  color-scheme: dark;
  --bg: #101010;
  --card: #161616;
  --text: #f2f2f0;
  --muted: #9a9a96;
  --faint: #6a6a66;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --fill: rgba(255, 255, 255, 0.045);
  --fill-strong: rgba(255, 255, 255, 0.08);
  --green: #3dd68c;
  --red: #ff6b6b;
  --accent: #e6b450;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100dvh; background: var(--bg); color: var(--text); }
body.loading { visibility: hidden; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid #d8d8d4; outline-offset: 2px; }
a { color: inherit; }

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(700px 360px at 50% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%), var(--bg);
}
.card {
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 28px 24px 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}
.mark { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -0.03em; }
.mark img { width: 28px; height: 28px; border-radius: 7px; box-shadow: inset 0 0 0 1px var(--line); }
h1 { margin: 6px 0 0; font-size: 24px; font-weight: 600; letter-spacing: -0.035em; }
h2 { margin: 0 0 12px; font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.hint { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 12px; }
input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  color: var(--text);
  padding: 10px 12px;
  font-size: 16px;
}
.form-error { margin: 0; color: var(--red); min-height: 1em; font-size: 12px; overflow-wrap: anywhere; }
.saved { margin: 8px 0 0; color: var(--green); font-size: 12px; min-height: 1em; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 9px;
  background: #f4f4f2;
  color: #161616;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.ghost:hover { background: var(--fill); }
.btn.danger { background: var(--red); color: #1a0b0b; }
.btn:disabled { opacity: 0.6; cursor: progress; }
.danger-text { color: var(--red) !important; }
.link { align-self: center; border: 0; background: none; color: var(--muted); font-size: 13px; padding: 4px; }
.link:hover { color: var(--text); }
.family { display: flex; justify-content: center; gap: 6px; margin-top: 6px; }
.family span { padding: 3px 10px; border-radius: 99px; box-shadow: inset 0 0 0 1px var(--line); color: var(--faint); font-size: 11px; }
.spinner { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 99px; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.home { max-width: 920px; margin: 0 auto; padding: 0 20px 60px; }
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 64px;
  background: rgba(16, 16, 16, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 28px;
}
.tabs { display: flex; gap: 4px; flex: 1; justify-content: center; }
.tab { height: 32px; padding: 0 14px; border: 0; border-radius: 99px; background: transparent; color: var(--muted); font-size: 14px; }
.tab:hover { color: var(--text); }
.tab.on { background: var(--fill-strong); color: var(--text); }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.avatar {
  width: 26px;
  height: 26px;
  border-radius: 99px;
  background: #2a2a2a center / cover no-repeat;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }
.avatar.has-image { color: transparent; }
.panel > h2 { font-size: 28px; letter-spacing: -0.035em; margin: 8px 0 6px; }
.apps { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-top: 24px; }
.app-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 20px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.01));
  box-shadow: inset 0 0 0 1px var(--line);
  text-decoration: none;
  transition: box-shadow 0.15s, transform 0.15s;
}
.app-tile:hover { box-shadow: inset 0 0 0 1px var(--line-strong); transform: translateY(-2px); }
.app-tile img { width: 40px; height: 40px; border-radius: 10px; margin-bottom: 10px; }
.app-tile strong { font-size: 17px; }
.app-tile span { color: var(--faint); font-size: 12px; }
.block { padding: 22px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.block-head h2 { margin: 0; }
.profile-row { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.photo-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.photo-actions .link { align-self: flex-start; padding: 0; }
.file-btn { flex-direction: row; cursor: pointer; }
.file-btn input { display: none; }
.row-form { display: flex; align-items: flex-end; gap: 10px; }
.row-form label { flex: 1; }
.row-form .btn { height: 42px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack .btn { align-self: flex-start; }
.list { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.item:first-child { border-top: 0; }
.item-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.item-text strong { font-size: 14px; font-weight: 600; }
.item-text span { color: var(--faint); font-size: 12px; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; color: var(--faint); font-weight: 500; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; padding: 0 10px 8px 0; }
.table td { padding: 10px 10px 10px 0; border-top: 1px solid var(--line); white-space: nowrap; }
.table .ok { color: var(--green); }
.table .bad { color: var(--red); }
.table .faint { color: var(--faint); }
.actions-cell { text-align: right; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell div { display: flex; flex-direction: column; }
.user-cell span { color: var(--faint); font-size: 12px; }
.switch { flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 14px; margin-bottom: 6px; }
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }
dialog {
  width: min(420px, calc(100vw - 24px));
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #1b1b1b;
  color: var(--text);
  padding: 22px;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.62); }
dialog h2 { margin: 0; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.choices { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.choices .btn { justify-content: flex-start; }
@media (max-width: 640px) {
  .top { flex-wrap: wrap; height: auto; padding: 10px 0; gap: 10px; }
  .tabs { order: 3; flex-basis: 100%; justify-content: flex-start; }
  #who-name { display: none; }
  .row-form { flex-direction: column; align-items: stretch; }
}
