/* Diary Vault - petrol steel and safe-dial brass */
:root {
  --bg: #0d171b;
  --bg-2: #101d22;
  --surface: #14242a;
  --surface-2: #1a2e35;
  --line: #21363d;
  --line-2: #2d4750;
  --text: #e6ede8;
  --muted: #93a7a4;
  --faint: #64797c;
  --brass: #c9a35b;
  --brass-2: #dfbe7c;
  --brass-ink: #1b1408;
  --steel: #8fb8de;
  --sage: #9cc59a;
  --danger: #ef6461;
  --danger-bg: rgba(239, 100, 97, .12);
  --warn: #e8b44f;
  --ok: #7fcf94;

  --r-lg: 20px;
  --r-md: 12px;
  --r-sm: 9px;

  --f-display: "Fraunces", Georgia, "Times New Roman", serif;
  --f-body: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;

  --shadow: 0 30px 70px -24px rgba(0, 0, 0, .75);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font: 400 15px/1.5 var(--f-body);
  background:
    radial-gradient(900px 520px at 85% -10%, rgba(201, 163, 91, .08), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(143, 184, 222, .05), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; border-radius: 6px; }
.no-scroll { overflow: hidden; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.noscript { padding: 24px; text-align: center; }
h1, h2, h3, p { margin: 0; }

/* ---------- screens ---------- */
.screen.center {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(24px + var(--safe-t)) 20px calc(24px + var(--safe-b));
}

/* ---------- safe dial ---------- */
.dial { position: relative; width: 132px; height: 132px; margin: 0 auto 22px; }
.dial::before {
  content: "";
  position: absolute;
  top: -7px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--brass-2);
  z-index: 1;
}
.dial svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(var(--r, 0deg));
  transition: transform .45s cubic-bezier(.2, .8, .2, 1);
}
.dial line { stroke: var(--brass); stroke-linecap: round; opacity: .4; transition: stroke .2s; }
.dial line.major { opacity: .95; }
.dial-core {
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 32px;
  color: var(--brass);
  background: radial-gradient(circle at 35% 30%, #2b464e, #122126 70%);
  border: 1px solid var(--line-2);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .05), 0 12px 30px -10px rgba(0, 0, 0, .7);
  transition: color .2s;
}
.dial-sm { width: 96px; height: 96px; margin-bottom: 18px; }
.dial-sm .dial-core { inset: 18px; font-size: 24px; }
.dial.is-spinning svg { animation: rot 2.4s linear infinite; }
.dial.is-error line { stroke: var(--danger); }
.dial.is-error .dial-core { color: var(--danger); }
.dial.is-error { animation: shake .42s; }
.dial.is-open svg { transform: rotate(calc(var(--r, 0deg) + 360deg)); transition-duration: .8s; }
.dial.is-open .dial-core { color: var(--ok); }

@keyframes rot { to { transform: rotate(360deg); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* ---------- auth card ---------- */
.auth-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 34px 28px 28px;
  background: linear-gradient(180deg, rgba(26, 46, 53, .55), rgba(20, 36, 42, .9));
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}
.auth-head { text-align: center; margin-bottom: 6px; }
.auth-head h1 {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.1;
  letter-spacing: -.015em;
  font-variation-settings: "opsz" 72;
}
.auth-head p { margin-top: 8px; color: var(--muted); font-size: 14.5px; line-height: 1.55; }
.auth-foot {
  display: flex;
  gap: 6px;
  justify-content: center;
  align-items: center;
  color: var(--faint);
  font-size: 12.5px;
}

.pin-wrap { position: relative; }
.pin-input {
  width: 100%;
  height: 60px;
  padding: 0 52px;
  text-align: center;
  font-family: var(--f-mono);
  font-size: 24px;
  letter-spacing: .35em;
  background: var(--bg-2);
  border: 1px solid var(--line-2);
  border-radius: 16px;
  outline: 0;
  transition: border-color .15s, box-shadow .15s;
}
.pin-input:focus { border-color: var(--brass); box-shadow: 0 0 0 4px rgba(201, 163, 91, .14); }
.pin-wrap .icon-btn { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }

.attempts {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--warn);
  text-align: center;
}
.attempts.is-critical { color: var(--danger); font-weight: 600; }

.notice, .banner {
  display: flex;
  gap: 12px;
  padding: 13px 14px;
  border-radius: var(--r-md);
  font-size: 13.5px;
  line-height: 1.5;
}
.notice { background: rgba(232, 180, 79, .07); border: 1px solid rgba(232, 180, 79, .22); color: #ecd7a6; }
.notice > i { color: var(--warn); font-size: 18px; margin-top: 1px; }
.notice p + p { margin-top: 3px; color: #c9b88e; }
.banner { background: var(--danger-bg); border: 1px solid rgba(239, 100, 97, .3); color: #f6c3c1; align-items: center; }
.banner > i { color: var(--danger); font-size: 18px; }

/* ---------- form fields ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 500; color: var(--muted); }
.field-label .req { color: var(--brass); font-weight: 600; }
.field-hint { font-size: 12.5px; color: var(--faint); }
.input-wrap {
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 46px;
  padding: 0 5px 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .15s, box-shadow .15s;
}
.input-wrap:focus-within { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(201, 163, 91, .13); }
.input-wrap > i { color: var(--faint); font-size: 18px; margin-right: 6px; flex: none; }
.input-wrap input, .input-wrap textarea {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  padding: 11px 4px;
  font-size: 15px;
}
.input-wrap input::placeholder, .input-wrap textarea::placeholder { color: var(--faint); }
.input-wrap input[type="password"] { font-family: var(--f-mono); letter-spacing: .08em; }
.input-wrap.is-mono input { font-family: var(--f-mono); }
.input-wrap.is-multi { align-items: flex-start; padding-top: 2px; }
.input-wrap.is-multi > i { margin-top: 12px; }
.input-wrap textarea { resize: vertical; min-height: 88px; line-height: 1.6; }
.input-wrap textarea.big { min-height: 240px; }
.input-wrap.is-multi .icon-btn { margin-top: 5px; }

.select-wrap { position: relative; }
.select-wrap select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 46px;
  padding: 0 40px 0 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  outline: 0;
}
.select-wrap select:focus { border-color: var(--brass); }
.select-wrap option { background: var(--surface); }
.select-wrap i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); font-size: 18px; }

.meter-row { display: flex; align-items: center; gap: 10px; min-height: 18px; }
.meter { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.meter span { height: 4px; border-radius: 2px; background: var(--line-2); transition: background .2s; }
.meter[data-s="1"] span:nth-child(-n+1) { background: var(--danger); }
.meter[data-s="2"] span:nth-child(-n+2) { background: var(--warn); }
.meter[data-s="3"] span:nth-child(-n+3) { background: var(--brass); }
.meter[data-s="4"] span { background: var(--ok); }
.meter-label { font-size: 12.5px; color: var(--muted); min-width: 48px; text-align: right; }

.form-error { color: var(--danger); font-size: 13.5px; line-height: 1.45; }
.form-error:empty { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-weight: 600;
  font-size: 14.5px;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, transform .08s;
}
.btn i { font-size: 18px; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: var(--brass); color: var(--brass-ink); }
.btn-primary:hover:not(:disabled) { background: var(--brass-2); }
.btn-ghost { border-color: var(--line-2); color: var(--text); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost.danger { color: var(--danger); border-color: rgba(239, 100, 97, .35); }
.btn-ghost.danger:hover:not(:disabled) { background: var(--danger-bg); }
.btn-danger { background: var(--danger); color: #210908; }
.btn-danger:hover:not(:disabled) { background: #f47d7a; }
.btn .spin { display: none; animation: rot .8s linear infinite; }
.btn.is-busy .spin { display: inline-block; }

.icon-btn {
  width: 38px;
  height: 38px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  color: var(--muted);
  font-size: 18px;
  text-decoration: none;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.is-on { color: var(--brass); }

/* ---------- app layout ---------- */
.app { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100dvh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 22px 14px;
  background: rgba(16, 29, 34, .7);
  border-right: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 20px; }
.brand-mark {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--brass);
  background: radial-gradient(circle at 35% 30%, #2b464e, #122126 70%);
  border: 1px solid var(--line-2);
}
.brand-name { display: block; font-family: var(--f-display); font-size: 23px; font-weight: 500; line-height: 1; letter-spacing: -.01em; }
.brand-sub { display: block; margin-top: 4px; font-size: 12px; color: var(--faint); }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  text-align: left;
  color: var(--muted);
  font-weight: 500;
  transition: background .12s, color .12s;
}
.nav-item i { font-size: 19px; }
.nav-item span { flex: 1; }
.nav-item em { font-style: normal; font-size: 12.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.is-active { background: var(--surface-2); color: var(--text); }
.nav-item.is-active i { color: var(--brass); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 8px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.autolock-note { display: flex; align-items: center; gap: 7px; padding: 0 10px; font-size: 12.5px; color: var(--faint); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 32px;
  background: rgba(13, 23, 27, .86);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand { display: none; align-items: center; gap: 10px; }
.topbar-brand .brand-mark { width: 34px; height: 34px; font-size: 16px; }
.topbar-brand .brand-name { font-size: 21px; }
.search {
  flex: 1;
  max-width: 580px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 12px 0 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color .15s;
}
.search:focus-within { border-color: var(--brass); }
.search > i { color: var(--faint); font-size: 18px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; }
.search input::placeholder { color: var(--faint); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--faint);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  padding: 1px 7px;
}
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }

.view { width: 100%; max-width: 1000px; padding: 30px 32px 60px; }
.view-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 18px; }
.view-head h2 {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 34px;
  line-height: 1.1;
  letter-spacing: -.015em;
  font-variation-settings: "opsz" 96;
}

/* ---------- ledger list ---------- */
.item-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.item-list:empty { display: none; }
.item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.item:last-child { border-bottom: 0; }
.item:hover { background: var(--surface-2); }
.item-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.item-title, .item-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-title { font-weight: 600; font-size: 15.5px; }
.item-sub { font-size: 13.5px; color: var(--muted); }
.item-type { font-size: 12.5px; color: var(--faint); min-width: 92px; text-align: right; }
.item-fav { color: var(--brass); font-size: 17px; }
.item-go { color: var(--faint); font-size: 20px; }

.avatar {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-family: var(--f-display);
  font-size: 19px;
  font-weight: 600;
}
.avatar.t-login { background: hsl(var(--h, 200) 32% 68%); color: #0f1a1d; }
.avatar.t-bank { background: rgba(201, 163, 91, .13); color: var(--brass); border: 1px solid rgba(201, 163, 91, .3); font-size: 20px; }
.avatar.t-note { background: rgba(156, 197, 154, .11); color: var(--sage); border: 1px solid rgba(156, 197, 154, .28); font-size: 20px; }
.avatar.lg { width: 54px; height: 54px; border-radius: 15px; font-size: 24px; }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 64px 24px;
  text-align: center;
  border: 1px dashed var(--line-2);
  border-radius: var(--r-lg);
}
.empty .big { font-size: 40px; color: var(--faint); }
.empty h3 { font-family: var(--f-display); font-weight: 500; font-size: 23px; }
.empty p { max-width: 42ch; margin-bottom: 8px; }

.chips { display: none; gap: 8px; overflow-x: auto; padding: 12px 16px 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 500;
}
.chip.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }

.fab {
  display: none;
  position: fixed;
  right: 18px;
  bottom: calc(20px + var(--safe-b));
  z-index: 30;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: var(--brass);
  color: var(--brass-ink);
  font-size: 28px;
  box-shadow: 0 16px 34px -10px rgba(201, 163, 91, .45), var(--shadow);
}
.show-sm, .show-sm-flex { display: none; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(4, 9, 11, .62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .2s;
}
.overlay.open { opacity: 1; }
.center-modal { display: grid; place-items: center; padding: 20px; }

.sheet {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(470px, 100%);
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--surface);
  border-left: 1px solid var(--line-2);
  transform: translateX(28px);
  transition: transform .24s cubic-bezier(.2, .8, .2, 1);
}
.overlay.open .sheet { transform: none; }
#sheet-body { display: flex; flex-direction: column; min-height: 100%; }
.sheet-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 18px 18px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.sheet-title { flex: 1; min-width: 0; }
.sheet-title h3 {
  font-family: var(--f-display);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.2;
  overflow-wrap: anywhere;
  margin-bottom: 5px;
}
.sheet-actions { display: flex; gap: 2px; align-self: flex-start; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-size: 12px;
  color: var(--muted);
}
.badge.t-login { color: var(--steel); border-color: rgba(143, 184, 222, .3); }
.badge.t-bank { color: var(--brass); border-color: rgba(201, 163, 91, .32); }
.badge.t-note { color: var(--sage); border-color: rgba(156, 197, 154, .3); }

.detail-fields { flex: 1; padding: 6px 22px 12px; }
.dfield { padding: 14px 0; border-bottom: 1px solid var(--line); }
.dfield:last-child { border-bottom: 0; }
.dl { font-size: 12.5px; color: var(--faint); margin-bottom: 2px; }
.drow { display: flex; align-items: flex-start; gap: 8px; }
.dv { flex: 1; min-width: 0; padding-top: 8px; font-size: 15px; overflow-wrap: anywhere; }
.dv.mono { font-family: var(--f-mono); font-size: 14.5px; letter-spacing: .02em; }
.dv.multi { white-space: pre-wrap; line-height: 1.65; }
.dactions { display: flex; gap: 2px; flex: none; }
.sheet-foot {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px calc(14px + var(--safe-b));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.row { display: flex; gap: 8px; }

.modal {
  width: min(660px, 100%);
  max-height: calc(100dvh - 40px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 22px;
  box-shadow: var(--shadow);
  transform: translateY(12px) scale(.985);
  transition: transform .22s cubic-bezier(.2, .8, .2, 1);
}
.overlay.open .modal { transform: none; }
.modal-sm { width: min(420px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 18px 0 22px; }
.modal-head h3 { font-family: var(--f-display); font-weight: 500; font-size: 25px; }
.modal-body { display: flex; flex-direction: column; gap: 16px; padding: 18px 22px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px calc(18px + var(--safe-b));
  border-top: 1px solid var(--line);
}

.seg {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 13px;
}
.seg button {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 9px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  transition: background .15s, color .15s;
}
.seg button.is-active { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.seg button.is-active i { color: var(--brass); }

.confirm-body { align-items: flex-start; padding-top: 24px; }
.confirm-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  font-size: 24px;
  background: var(--danger-bg);
  color: var(--danger);
}
.confirm-body h3 { font-family: var(--f-display); font-weight: 500; font-size: 23px; }
.confirm-body p { line-height: 1.55; overflow-wrap: anywhere; }

/* ---------- settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.card.full { grid-column: 1 / -1; }
.card > .btn { align-self: flex-start; }
.card-head { display: flex; gap: 14px; align-items: flex-start; }
.card-head > i {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 20px;
  color: var(--brass);
  background: var(--bg-2);
  border: 1px solid var(--line);
}
.card-head h3 { font-size: 16.5px; font-weight: 600; }
.card-head p { margin-top: 2px; font-size: 13.5px; color: var(--muted); }
.card-danger { border-color: rgba(239, 100, 97, .3); }
.card-danger .card-head > i { color: var(--danger); background: var(--danger-bg); border-color: rgba(239, 100, 97, .25); }

.spec { margin: 0; display: flex; flex-direction: column; }
.spec div { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.spec div:last-child { border-bottom: 0; }
.spec dt { color: var(--muted); }
.spec dd { margin: 0; text-align: right; }

.log-list { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.log-list:empty { display: none; }
.log-list li { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.log-list li:last-child { border-bottom: 0; }
.log-list i { font-size: 18px; margin-top: 1px; }
.log-ok i { color: var(--ok); }
.log-bad i { color: var(--danger); }
.log-info i { color: var(--steel); }
.log-meta { margin-top: 2px; font-size: 12.5px; color: var(--faint); }

/* ---------- toasts ---------- */
.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  z-index: 90;
  width: min(440px, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  gap: 8px;
  transform: translateX(-50%);
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 15px;
  border-radius: 13px;
  background: #e6ede8;
  color: #0d171b;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: toastIn .22s ease-out;
  transition: opacity .2s, transform .2s;
}
.toast i { font-size: 19px; flex: none; }
.toast.ok i { color: #2f7d4a; }
.toast.warn i, .toast.info i { color: #8a6516; }
.toast.err { background: var(--danger); color: #210908; }
.toast.out { opacity: 0; transform: translateY(6px); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  input, select, textarea { font-size: 16px !important; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { flex-wrap: wrap; padding: calc(12px + var(--safe-t)) 16px 12px; gap: 10px; }
  .topbar-brand { display: flex; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .hide-sm { display: none !important; }
  .show-sm { display: inline-grid; }
  .show-sm-flex { display: flex; }
  .fab { display: grid; }
  .view { padding: 16px 16px calc(110px + var(--safe-b)); }
  .view-head h2 { font-size: 27px; }
  .item { padding: 13px 14px; gap: 12px; }
  .item-type { display: none; }
  .settings-grid, .form-grid { grid-template-columns: 1fr; }
  .card { padding: 18px; }

  .sheet {
    top: auto;
    left: 0;
    width: 100%;
    max-height: 92dvh;
    border-left: 0;
    border-top: 1px solid var(--line-2);
    border-radius: 24px 24px 0 0;
    transform: translateY(36px);
  }
  .sheet::before {
    content: "";
    position: sticky;
    top: 0;
    display: block;
    width: 42px;
    height: 4px;
    margin: 10px auto -4px;
    border-radius: 2px;
    background: var(--line-2);
    z-index: 2;
  }
  .sheet-head { padding: 16px 12px 14px 18px; }
  .detail-fields { padding: 4px 18px 10px; }
  .sheet-foot { padding-left: 18px; padding-right: 18px; }

  .center-modal { place-items: end center; padding: 0; }
  .modal { width: 100%; max-height: 94dvh; border-radius: 24px 24px 0 0; border-bottom: 0; transform: translateY(36px); }
  .modal-sm { width: 100%; }
  .toasts { bottom: calc(92px + var(--safe-b)); }
}

@media (max-width: 380px) {
  .auth-card { padding: 28px 20px 22px; }
  .sheet-foot .btn { padding: 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
