:root {
  --night: #070a12;
  --deep: #0d1220;
  --raise: #111827;
  --frost: #e8eef6;
  --haze: #8a94a7;
  --dim: #5b6478;
  --mint: #8be0d8;
  --signal: #4a86ff;
  --line: rgba(232, 238, 246, 0.08);
  --line-2: rgba(232, 238, 246, 0.16);
  --hover: rgba(232, 238, 246, 0.04);
  --brand: linear-gradient(100deg, #f2f4f8 0%, #8be0d8 48%, #4a86ff 100%);
  --good: #8be0d8;
  --warn: #e0b86a;
  --bad: #ef8f8f;
  --st: #e39a5f;
  --sv: #d8c690;
  --display: "Unbounded", system-ui, sans-serif;
  --text: "Golos Text", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --wrap: 1240px;
  --gutter: clamp(16px, 3.4vw, 40px);
}

*, *::before, *::after { box-sizing: border-box; }

html { background: var(--night); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--frost);
  font: 15px/1.5 var(--text);
  -webkit-font-smoothing: antialiased;
  background: var(--night);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60vmax 44vmax at 92% -8%, rgba(74, 134, 255, 0.12), transparent 62%),
    radial-gradient(46vmax 36vmax at -6% 4%, rgba(139, 224, 216, 0.06), transparent 60%);
}

::selection { background: rgba(139, 224, 216, 0.28); }
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--mint); text-decoration: none; }
img { display: block; }
h1, h2, h3 { margin: 0; }
.num { font-variant-numeric: tabular-nums; }
.quiet { color: var(--haze); }
.dim { color: var(--dim); }
.good { color: var(--good); }
.warn { color: var(--warn); }
.bad { color: var(--bad); }
.hidden { display: none !important; }
.grow { flex: 1; min-width: 0; }

:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 3px;
  border-radius: 8px;
}

/* ---------- top ---------- */

.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 64px;
  padding: 0 var(--gutter);
  background: rgba(7, 10, 18, 0.78);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--frost);
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.03em;
  white-space: nowrap;
}

.brand img { width: 30px; height: 30px; transition: transform 0.6s var(--ease-out); }
.brand:hover img { transform: rotate(-90deg); }

.nav { display: flex; gap: 2px; height: 100%; min-width: 0; }

.nav button {
  position: relative;
  height: 100%;
  padding: 0 13px;
  border: 0;
  background: none;
  color: var(--haze);
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav button::after {
  content: "";
  position: absolute;
  left: 13px;
  right: 13px;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
  transform: scaleX(0);
  transition: transform 0.4s var(--ease-out);
}

.nav button:hover { color: var(--frost); }
.nav button.is-on { color: var(--frost); }
.nav button.is-on::after { transform: none; }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.scope-btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  max-width: 280px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--haze);
  transition: color 0.2s ease, border-color 0.2s ease;
}

.scope-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scope-ico { flex: none; }
.scope-btn:hover, .scope-btn.is-open { color: var(--frost); border-color: var(--line-2); }
.scope-btn.is-filtered { color: var(--frost); border-color: rgba(139, 224, 216, 0.4); }
.scope-btn.is-filtered .scope-ico { color: var(--mint); }

.avatar-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--deep);
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 600;
  transition: border-color 0.2s ease;
}

.avatar-btn:hover, .avatar-btn.is-open { border-color: rgba(139, 224, 216, 0.5); }
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; }

.menu {
  position: absolute;
  right: var(--gutter);
  top: 60px;
  z-index: 30;
  width: 250px;
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: #0d1220;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}

.menu-head { padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-head b { display: block; font-family: var(--display); font-weight: 600; font-size: 14px; letter-spacing: -0.02em; }
.menu-head .quiet { font-size: 13px; }

.menu > button {
  display: flex;
  width: 100%;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
}

.menu > button:hover { background: var(--hover); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.menu.scope { width: 300px; right: calc(var(--gutter) + 200px); padding: 10px; display: grid; gap: 10px; }
.scope-group { display: grid; gap: 2px; }
.scope-title { padding: 4px 8px 6px; color: var(--dim); font-size: 12px; font-weight: 500; }

.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: none;
  text-align: left;
  color: var(--haze);
}

.opt:hover { background: var(--hover); color: var(--frost); }
.opt.is-on { color: var(--frost); }
.opt img { width: 20px; height: 20px; border-radius: 50%; }

.opt i {
  flex: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  display: grid;
  place-items: center;
}

.opt.radio i { border-radius: 50%; }
.opt.is-on i { border-color: var(--mint); background: rgba(139, 224, 216, 0.14); }
.opt.is-on i::after { content: ""; width: 6px; height: 6px; border-radius: 2px; background: var(--mint); }
.opt.radio.is-on i::after { border-radius: 50%; }

/* ---------- page ---------- */

.page {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: clamp(28px, 5vh, 52px) var(--gutter) 80px;
}

.ph {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: clamp(24px, 4vh, 40px);
}

.ph h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.ph p { margin: 10px 0 0; color: var(--haze); }
.ph p b { color: var(--frost); font-weight: 600; }
.ph-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
}

.sec-head h2 {
  font-family: var(--display);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.02em;
  color: var(--haze);
}

.sec-head.small { padding-top: 22px; }
.sec-head .quiet { font-size: 13px; }

.stack { display: grid; gap: 40px; align-content: start; }

.empty { padding: 28px 0; color: var(--haze); }

.empty.big {
  display: grid;
  justify-items: start;
  gap: 18px;
  padding: 48px 0;
  border-top: 1px solid var(--line);
  font-size: 1.05rem;
}

/* ---------- overview ---------- */

.ov {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 24px clamp(24px, 5vw, 72px);
  align-items: end;
  padding-bottom: clamp(28px, 5vh, 44px);
}

.ov-label { color: var(--haze); font-weight: 500; }

.ov-total {
  margin-top: 10px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.6rem, 7.4vw, 5.6rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ov-note { margin: 14px 0 0; color: var(--haze); max-width: 34rem; }

.ov-stats { margin: 0; display: grid; gap: 0; }

.ov-stats > div {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 2px 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.ov-stats dt { color: var(--haze); }

.ov-stats dd {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.ov-stats small { grid-column: 1 / -1; color: var(--dim); font-size: 13px; }

.sell {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 16px clamp(20px, 4vw, 48px);
  padding: clamp(22px, 4vh, 32px) 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: clamp(36px, 6vh, 56px);
  isolation: isolate;
}

.sell::before {
  content: "";
  position: absolute;
  inset: 0 calc(-1 * var(--gutter));
  z-index: -1;
  background: radial-gradient(600px 160px at var(--mx, 70%) 50%, rgba(139, 224, 216, 0.08), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
}

.sell.has { cursor: pointer; }
.sell.has:hover::before { opacity: 1; }

.sell h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  letter-spacing: -0.045em;
}

.sell p { margin: 8px 0 0; color: var(--haze); max-width: 38rem; }

.sell-sum {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.6rem, 3.6vw, 2.6rem);
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  background-image: var(--brand), linear-gradient(var(--frost), var(--frost));
  background-repeat: no-repeat;
  background-size: 0% 100%, 100% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: background-size 0.8s var(--ease-out);
}

.sell.has:hover .sell-sum { background-size: 100% 100%, 100% 100%; }
.sell:not(.has) .sell-sum { color: var(--haze); background: none; }

.ov-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 48px clamp(28px, 5vw, 64px);
  align-items: start;
}

.sites { border-top: 1px solid var(--line); }

.site-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.site-row .quiet { grid-column: 1; font-size: 13px; }

.site-net {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.first {
  max-width: 40rem;
  padding: clamp(40px, 10vh, 100px) 0;
}

.first h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.first p { margin: 18px 0 0; color: var(--haze); font-size: 1.05rem; }
.first-actions { display: flex; gap: 10px; margin-top: 28px; flex-wrap: wrap; }

/* ---------- rows ---------- */

.rows { border-top: 1px solid var(--line); }

.r {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(0, 0.9fr) minmax(0, 1.1fr) minmax(110px, auto);
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  isolation: isolate;
}

.r::before {
  content: "";
  position: absolute;
  inset: 0 -12px;
  z-index: -1;
  border-radius: 12px;
  background: var(--hover);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.r:hover::before, .r:focus-visible::before { opacity: 1; }
.r:focus-visible { outline: none; }

.r.compact { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(96px, auto); }
.r.dep { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(110px, auto); padding: 14px 0; }

.r-case, .r-site { min-width: 0; }
.r-case-name, .r-site b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-site b { font-weight: 500; }
.r-acc { color: var(--haze); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.r-sum { text-align: right; white-space: nowrap; }

.r-sum b {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.sub { display: block; color: var(--haze); font-size: 12.5px; }
.r .sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.day { margin-bottom: 34px; }

.day-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
}

.day-head h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.day-head h3 img { width: 22px; height: 22px; border-radius: 50%; }
.day-head span { color: var(--haze); font-size: 13px; }
.day-head span b { color: var(--frost); font-weight: 600; font-variant-numeric: tabular-nums; }

.item { display: flex; align-items: center; gap: 12px; min-width: 0; }

.thumb {
  position: relative;
  flex: none;
  width: 54px;
  height: 40px;
  border-radius: 10px;
  background: radial-gradient(circle at 50% 60%, rgba(232, 238, 246, 0.06), rgba(232, 238, 246, 0.015));
  display: grid;
  place-items: center;
  overflow: hidden;
}

.thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }

.thumb::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--rc, transparent);
}

.item-name { min-width: 0; }
.item-name b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.tags:empty { display: none; }
.tags { display: flex; align-items: center; gap: 4px; margin-top: 4px; min-width: 0; overflow: hidden; white-space: nowrap; }
.drop { margin-left: 4px; overflow: hidden; text-overflow: ellipsis; color: var(--haze); font-size: 12.5px; }
.r .en { display: none; }

.en {
  display: block;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  display: inline-block;
  padding: 0 7px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--haze);
  font-size: 11px;
  line-height: 17px;
  white-space: nowrap;
}

.tag.st { color: var(--st); border-color: rgba(227, 154, 95, 0.4); }
.tag.sv { color: var(--sv); border-color: rgba(216, 198, 144, 0.4); }
.tag.free { color: var(--mint); border-color: rgba(139, 224, 216, 0.4); }

.status { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; white-space: nowrap; color: var(--haze); }
.status::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.sell { color: var(--mint); }
.status.sell::before { box-shadow: 0 0 0 4px rgba(139, 224, 216, 0.14), 0 0 10px rgba(139, 224, 216, 0.55); }
.status.hold { color: var(--warn); }
.status.gone, .status.unknown { color: var(--dim); }
.status.unknown::before { background: none; border: 1px solid currentColor; }

/* ---------- tables ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }

th {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}

td { padding: 11px 12px 11px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th.num, td.num { text-align: right; white-space: nowrap; padding-right: 0; padding-left: 12px; }
.week .done { font-weight: 500; }
.week .miss { color: var(--dim); }
.block .week { margin-bottom: 4px; }
.page > .block { margin-bottom: 44px; }

/* ---------- controls ---------- */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: none;
  color: var(--frost);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  isolation: isolate;
  transition: transform 0.3s var(--ease-out), border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.btn:hover { border-color: rgba(232, 238, 246, 0.32); }
.btn:active:not(:disabled) { transform: scale(0.97); }

.btn.primary { border-color: transparent; background: var(--frost); color: var(--night); }

.btn.primary::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--brand);
  transform: translateX(-101%);
  transition: transform 0.5s var(--ease-out);
}

.btn.primary:hover:not(:disabled)::before { transform: none; }
.btn.ghost { border-color: transparent; color: var(--haze); }
.btn.ghost:hover { color: var(--frost); background: var(--hover); }
.btn.small { height: 34px; padding: 0 14px; font-size: 14px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: 0.4; cursor: default; }
.plus { font-size: 18px; line-height: 1; margin-top: -2px; }

.link-btn { padding: 0; border: 0; background: none; color: var(--mint); font-weight: 500; }
.link-btn:hover { color: var(--frost); }

.icon-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--haze);
  font-size: 18px;
  line-height: 1;
}

.icon-btn:hover { color: var(--frost); border-color: var(--line-2); }

.field { display: grid; gap: 8px; }
.field > span { color: var(--haze); font-size: 13px; font-weight: 500; }

.input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: rgba(7, 10, 18, 0.6);
  color: var(--frost);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input::placeholder { color: var(--dim); }
.input:hover { border-color: rgba(232, 238, 246, 0.24); }
.input:focus { border-color: rgba(139, 224, 216, 0.5); box-shadow: 0 0 0 4px rgba(139, 224, 216, 0.1); }
select.input { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--haze) 50%), linear-gradient(135deg, var(--haze) 50%, transparent 50%); background-position: calc(100% - 19px) 19px, calc(100% - 14px) 19px; background-size: 5px 5px; background-repeat: no-repeat; }
textarea.input { height: auto; padding: 10px 14px; resize: vertical; }

.search { position: relative; }
.search .input { padding-left: 38px; }

.search::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  width: 11px;
  height: 11px;
  border: 1.6px solid var(--dim);
  border-radius: 50%;
  transform: translateY(-62%);
  pointer-events: none;
}

.search::after {
  content: "";
  position: absolute;
  left: 24px;
  top: 50%;
  width: 6px;
  height: 1.6px;
  background: var(--dim);
  transform: translateY(5px) rotate(45deg);
  pointer-events: none;
}

.ph-tools .search { width: 230px; }

.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.seg button {
  padding: 7px 14px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--haze);
  font-weight: 500;
  transition: color 0.2s ease, background 0.2s ease;
}

.seg button:hover { color: var(--frost); }
.seg button.is-on { background: var(--frost); color: var(--night); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.chip {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: none;
  color: var(--haze);
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.chip:hover { color: var(--frost); border-color: rgba(232, 238, 246, 0.3); }
.chip.is-on { border-color: var(--frost); background: var(--frost); color: var(--night); }

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--haze);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
}

.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch i {
  position: relative;
  flex: none;
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: rgba(232, 238, 246, 0.12);
  transition: background 0.25s ease;
}

.switch i::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--haze);
  transition: transform 0.3s var(--ease-out), background 0.25s ease;
}

.switch input:checked + i { background: rgba(139, 224, 216, 0.35); }
.switch input:checked + i::after { transform: translateX(14px); background: var(--mint); }
.switch input:focus-visible + i { outline: 2px solid var(--mint); outline-offset: 3px; }
.switch:hover { color: var(--frost); }
.switch.line { padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }

/* ---------- drawer ---------- */

.veil { position: fixed; inset: 0; z-index: 40; background: rgba(3, 5, 10, 0.62); backdrop-filter: blur(4px); }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  width: min(620px, 100vw);
  display: flex;
  flex-direction: column;
  background: #0b101b;
  border-left: 1px solid var(--line-2);
  box-shadow: -30px 0 90px rgba(0, 0, 0, 0.5);
}

.drawer.wide { width: min(820px, 100vw); }
.drawer-form { display: contents; }

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 26px 18px;
}

.drawer-head h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: -0.045em;
}

.drawer-sub { margin: 8px 0 0; max-width: 30rem; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 6px 26px 26px;
  display: grid;
  gap: 22px;
  align-content: start;
}

.drawer-body.center { justify-items: center; text-align: center; padding-top: 24px; }

.drawer-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 26px;
  border-top: 1px solid var(--line);
  background: #0a0e18;
}

.drawer-foot .grow { flex: 1; }
.foot-sum { flex: 1; display: grid; min-width: 0; }
.foot-sum span { color: var(--haze); font-size: 13px; }

.foot-sum b {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.x-btn {
  flex: none;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: none;
  color: var(--haze);
  font-size: 22px;
  line-height: 1;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.4s var(--ease-out);
}

.x-btn:hover { color: var(--frost); border-color: var(--line-2); transform: rotate(90deg); }

.draft-hint {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  color: var(--mint);
  font-size: 13px;
}

.draft-hint::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px rgba(139, 224, 216, 0.6); }

.step { display: grid; gap: 12px; }
.step-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.step-head b {
  font-family: var(--display);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: -0.03em;
}

.step-head .quiet { font-size: 13px; }
.or { color: var(--dim); font-size: 13px; }

.amount-input { position: relative; }

.amount-input .input {
  height: 74px;
  padding: 0 52px 0 18px;
  border-radius: 18px;
  font-family: var(--display);
  font-weight: 600;
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.amount-input i {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--dim);
  font-family: var(--display);
  font-style: normal;
  font-size: 1.4rem;
}

.chips.quick { margin-top: -10px; }
.chips.quick .chip { height: 32px; font-size: 14px; }
.chips.quick .quiet { font-size: 13px; }

.picked {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
}

.picked.is-done { border-color: rgba(139, 224, 216, 0.3); background: rgba(139, 224, 216, 0.04); }

.list {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
}

.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: var(--hover); }
.list-row .grow b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.list-row.add b { color: var(--mint); }
.list-note { padding: 16px; color: var(--haze); font-size: 14px; }

.variants { display: grid; gap: 10px; }
.variants-wait { font-size: 14px; }
.variant-group { display: grid; grid-template-columns: 84px 1fr; gap: 8px; align-items: start; }
.variant-group > span { padding-top: 8px; color: var(--haze); font-size: 13px; }
.variant-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.vchip {
  display: grid;
  min-width: 76px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: none;
  text-align: left;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.vchip b { font-weight: 600; font-size: 13px; }
.vchip small { color: var(--haze); font-size: 12px; font-variant-numeric: tabular-nums; }
.vchip:hover { border-color: rgba(232, 238, 246, 0.32); }
.vchip.is-on { border-color: var(--mint); background: rgba(139, 224, 216, 0.1); }
.vchip.is-on small { color: var(--mint); }

.qr { border-radius: 18px; background: #fff; padding: 12px; }

/* ---------- cases ---------- */

.case-cat { display: flex; align-items: baseline; gap: 10px; margin: 36px 0 14px; }
.case-cat:first-of-type { margin-top: 0; }
.case-cat h2 { font-family: var(--display); font-weight: 500; font-size: 14px; letter-spacing: -0.02em; color: var(--haze); }

.case-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 6px; }

.case-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 0;
  border-radius: 16px;
  background: none;
  text-align: left;
  transition: background 0.25s ease;
}

.case-card:hover { background: var(--hover); }
.case-card .case-img { height: 116px; display: grid; place-items: center; }
.case-card .case-img img { max-width: 100%; max-height: 116px; object-fit: contain; transition: transform 0.5s var(--ease-out); }
.case-card:hover .case-img img { transform: translateY(-6px) scale(1.04); }
.case-card b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.case-card .sub { display: flex; gap: 8px; }

.case-hero {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  padding-bottom: 28px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.case-hero img { width: 150px; height: 116px; object-fit: contain; }
.case-hero h2 { font-family: var(--display); font-weight: 600; font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -0.045em; }
.case-hero p { margin: 8px 0 0; }

.skin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.skin-grid.pick { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); max-height: 380px; overflow-y: auto; padding-right: 2px; }

.skin {
  position: relative;
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: none;
  text-align: left;
  overflow: hidden;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.skin::before {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  top: 0;
  height: 2px;
  border-radius: 0 0 2px 2px;
  background: var(--rc, transparent);
}

.skin .skin-img { height: 68px; display: grid; place-items: center; }
.skin .skin-img img { max-width: 100%; max-height: 68px; object-fit: contain; }
.skin b { font-weight: 500; font-size: 12.5px; line-height: 1.3; }
.skin .en { font-size: 11px; white-space: normal; }
.skin small { display: flex; justify-content: space-between; gap: 6px; color: var(--haze); font-size: 12px; font-variant-numeric: tabular-nums; }
button.skin:hover { border-color: var(--line-2); background: var(--hover); }

/* ---------- calendar ---------- */

.cal-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(24px, 4vw, 56px); align-items: start; }
.cal-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 16px; flex-wrap: wrap; }
.cal-nav { display: flex; align-items: center; gap: 12px; }
.cal-nav b { min-width: 150px; text-align: center; font-family: var(--display); font-weight: 600; letter-spacing: -0.03em; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.cal-dow { padding: 10px; color: var(--dim); font-size: 12.5px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }

.cal-day {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 88px;
  padding: 10px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: none;
  text-align: left;
  transition: background 0.15s ease;
}

.cal-day:hover { background: var(--hover); }
.cal-day.out { opacity: 0.35; }
.cal-day.today .cal-n { color: var(--night); background: var(--mint); }
.cal-day.in-range { background: rgba(139, 224, 216, 0.06); }
.cal-day.edge { box-shadow: inset 0 0 0 1px rgba(139, 224, 216, 0.6); }
.cal-n { align-self: flex-start; min-width: 22px; padding: 0 5px; border-radius: 999px; color: var(--haze); font-size: 12.5px; text-align: center; }
.cal-sum { margin-top: auto; font-family: var(--display); font-weight: 600; font-size: 13px; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.cal-cnt { color: var(--haze); font-size: 11.5px; }
.cal-dep { position: absolute; top: 12px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.cal-heat { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--mint); opacity: var(--h, 0); }
.legend { display: flex; gap: 16px; color: var(--haze); font-size: 13px; }
.legend i { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; vertical-align: middle; }

.cal-total { font-family: var(--display); font-weight: 600; font-size: 2.4rem; letter-spacing: -0.05em; line-height: 1; font-variant-numeric: tabular-nums; }
.cal-total-note { margin: 8px 0 18px; }

.dl { display: grid; grid-template-columns: 1fr auto; margin: 0; border-top: 1px solid var(--line); }
.dl dt, .dl dd { padding: 10px 0; border-bottom: 1px solid var(--line); }
.dl dt { color: var(--haze); }
.dl dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- settings ---------- */

.sets { border-top: 1px solid var(--line); }

.set {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.6fr);
  gap: 20px clamp(24px, 5vw, 72px);
  padding: clamp(28px, 5vh, 44px) 0;
  border-bottom: 1px solid var(--line);
  scroll-margin-top: 90px;
}

.set-copy h2 { font-family: var(--display); font-weight: 600; font-size: 1.2rem; letter-spacing: -0.04em; }
.set-copy p { margin: 10px 0 0; color: var(--haze); max-width: 24rem; }
.set-body { display: grid; gap: 18px; align-content: start; min-width: 0; }
.set-body .stack { gap: 16px; }

.accs { border-top: 1px solid var(--line); }
.acc { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.acc img, .acc .ph { width: 44px; height: 44px; border-radius: 50%; background: var(--deep); object-fit: cover; }
.acc .grow b { font-weight: 600; }
.acc-actions { display: flex; gap: 4px; flex-wrap: wrap; }

.inline-form { display: flex; gap: 10px; }
.inline-form .input { flex: 1; min-width: 0; }

.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px 24px; }
.kv > div { display: grid; gap: 2px; }
.kv span { color: var(--haze); font-size: 13px; }
.kv b { font-weight: 600; }
.kv .sub { margin-top: 2px; }
.note { margin: 0; }

.sync { display: grid; gap: 10px; }
.progress { height: 3px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); transition: width 0.4s var(--ease-out); }
.log { max-height: 180px; overflow-y: auto; white-space: pre-wrap; color: var(--haze); font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- login ---------- */

.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }

.login { width: min(380px, 100%); display: grid; gap: 16px; }
.login .brand { margin-bottom: 28px; }
.login h1 { font-family: var(--display); font-weight: 600; font-size: clamp(2.2rem, 6vw, 3rem); letter-spacing: -0.055em; line-height: 1; }
.login .lead { margin: -4px 0 12px; color: var(--haze); }
.login .btn { margin-top: 4px; height: 48px; }
.err { min-height: 18px; color: var(--bad); font-size: 14px; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 60;
  max-width: min(560px, calc(100vw - 32px));
  padding: 12px 20px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: #111827;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  transform: translateX(-50%);
}

.toast.bad { border-color: rgba(239, 143, 143, 0.5); }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  .page.enter { animation: rise 0.5s var(--ease-out) both; }
  .login.enter { animation: rise 0.7s var(--ease-out) both; }
  .drawer.enter { animation: slide 0.45s var(--ease-out) both; }
  .veil.enter { animation: fade 0.3s ease both; }
  .menu.enter { animation: drop 0.25s var(--ease-out) both; }
  .toast.enter { animation: toast-in 0.35s var(--ease-out) both; }
  .page.enter .ov-total { animation: rise-big 0.9s var(--ease-out) both; }
}

@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
@keyframes rise-big { from { opacity: 0; transform: translateY(30px); filter: blur(8px); } }
@keyframes slide { from { transform: translateX(48px); opacity: 0.4; } }
@keyframes fade { from { opacity: 0; } }
@keyframes drop { from { opacity: 0; transform: translateY(-8px) scale(0.98); } }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.001ms !important; }
}

/* ---------- responsive ---------- */

@media (max-width: 1240px) {
  .scope-text { display: none; }
  .scope-btn { width: 36px; padding: 0; justify-content: center; }
  .menu.scope { right: calc(var(--gutter) + 90px); }
}

@media (max-width: 1100px) {
  .ov, .ov-grid, .cal-wrap { grid-template-columns: minmax(0, 1fr); }
  .ov-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 24px; }
  .ov-stats > div { grid-template-columns: 1fr; }
  .ov-stats dd { text-align: left; }
  .btn-text { display: none; }
  .top-right .btn.primary { width: 36px; padding: 0; }
  .r:not(.compact):not(.dep) { grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1fr) minmax(100px, auto); }
  .r:not(.dep) .r-acc { display: none; }
  .scope-btn { max-width: 190px; }
  .menu.scope { right: var(--gutter); }
}

@media (max-width: 860px) {
  .top { flex-wrap: wrap; gap: 0 12px; height: auto; padding-top: 10px; }
  .top-right { height: 44px; }
  .nav { order: 3; flex: 0 0 calc(100% + 2 * var(--gutter)); height: 44px; margin: 6px calc(-1 * var(--gutter)) 0; padding: 0 calc(var(--gutter) - 10px); overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); }
  .nav::-webkit-scrollbar { display: none; }
  .nav button { flex: none; padding: 0 10px; }
  .nav button::after { left: 10px; right: 10px; }
  .btn-text { display: none; }
  .top-right .btn.primary { width: 36px; padding: 0; }
  .scope-text { display: none; }
  .scope-btn { width: 36px; padding: 0; justify-content: center; }
  .set { grid-template-columns: minmax(0, 1fr); }
  .ov-stats { grid-template-columns: minmax(0, 1fr); }
  .ov-stats > div { grid-template-columns: 1fr auto; }
  .ov-stats dd { text-align: right; }
  .r, .r.compact, .r.dep, .r:not(.compact):not(.dep) { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .r .r-case, .r .r-inv, .r .r-acc { grid-column: 1; display: block; padding-left: 66px; }
  .r.dep .r-acc { padding-left: 0; }
  .r:not(.dep) .r-acc { display: none; }
  .r .r-sum { grid-column: 2; grid-row: 1; }
  .r .r-case { font-size: 13px; color: var(--haze); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .r .r-case .r-case-name, .r .r-case .sub { display: inline; font-size: inherit; }
  .r .r-case .sub::before { content: ", "; }
  .sell { grid-template-columns: minmax(0, 1fr); }
  .ph-tools { width: 100%; }
  .ph-tools .search { flex: 1; width: auto; min-width: 180px; }
  .cal-day { min-height: 62px; padding: 6px; }
  .cal-cnt { display: none; }
  .cal-sum { font-size: 11px; }
  .drawer-head, .drawer-body, .drawer-foot { padding-left: 18px; padding-right: 18px; }
  .drawer-foot { flex-wrap: wrap; }
  .foot-sum { flex-basis: 100%; }
  .inline-form { flex-direction: column; }
}
