/* ============================================================
   Bills Radar — premium UI system
   ============================================================ */

:root {
  --bg: #0a0d13;
  --sidebar: #0d111a;
  --panel: #11151f;
  --panel-2: #161c29;
  --panel-3: #1c2333;
  --line: #222b3d;
  --line-soft: #1a2130;
  --text: #e9edf5;
  --muted: #97a2ba;
  --faint: #66718c;
  --accent: #34d399;
  --accent-2: #22d3ee;
  --amber: #fbbf24;
  --red: #f87171;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --radius: 16px;
  --shadow: 0 10px 34px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1100px 420px at 75% -8%, rgba(52, 211, 153, .055), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, rgba(96, 165, 250, .045), transparent 60%),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(52, 211, 153, .28); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

a { color: inherit; }

/* ---------- layout ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px; flex-shrink: 0;
  position: sticky; top: 0; height: 100vh;
  background: var(--sidebar);
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  padding: 22px 14px 16px;
}

.brand { display: flex; align-items: center; gap: 11px; padding: 0 8px 22px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #04231a; font-weight: 800; font-size: 17px;
  box-shadow: 0 4px 16px rgba(52, 211, 153, .28);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; letter-spacing: -.02em; }
.brand-text span { color: var(--faint); font-size: 11.5px; }

.nav { display: flex; flex-direction: column; gap: 3px; }

.nav-label {
  color: var(--faint); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .09em; padding: 10px 10px 6px;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: 10px;
  color: var(--muted); text-decoration: none;
  font-weight: 500; font-size: 13.5px;
  border: 1px solid transparent;
  transition: background .15s ease, color .15s ease;
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(52, 211, 153, .14), rgba(34, 211, 238, .05) 70%, transparent);
  border-color: rgba(52, 211, 153, .18);
  color: var(--accent);
}
.nav-item.active svg { opacity: 1; }

.sidebar-foot { margin-top: auto; padding: 0 4px; }
.side-stat {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 12px 14px;
  display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px;
}
.side-stat-label { color: var(--faint); font-size: 11px; }
.side-stat-value { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.side-note { color: var(--faint); font-size: 11px; padding: 0 6px; }

.main {
  flex: 1; min-width: 0;
  padding: 26px 30px 44px;
  max-width: 1180px;
}

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head h1 { margin: 0; font-size: 23px; letter-spacing: -.025em; font-weight: 700; }
.page-head p { margin: 5px 0 0; color: var(--muted); font-size: 13.5px; }
.page-actions { display: flex; gap: 9px; }

/* ---------- flashes ---------- */

.flashes { margin-bottom: 16px; }
.flash {
  padding: 11px 14px; border-radius: 11px; margin-bottom: 8px;
  font-size: 13.5px; background: var(--panel);
  border: 1px solid var(--line-soft); border-left: 3px solid var(--accent);
  box-shadow: var(--shadow);
}
.flash.error { border-left-color: var(--red); }

/* ---------- panels & cards ---------- */

.panel {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.panel h2 {
  font-size: 11.5px; margin: 0 0 14px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .09em; font-weight: 600;
  display: flex; align-items: center; gap: 7px;
}

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); transition: transform .16s ease, border-color .16s ease;
}
.kpi:hover { transform: translateY(-2px); border-color: var(--line); }
.kpi.alert { border-color: rgba(251, 191, 36, .35); }
.kpi-top { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.kpi-ico {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  font-size: 14px;
}
.kpi-ico.green { background: rgba(52, 211, 153, .13); }
.kpi-ico.blue { background: rgba(96, 165, 250, .13); }
.kpi-ico.violet { background: rgba(167, 139, 250, .13); }
.kpi-ico.amber { background: rgba(251, 191, 36, .14); }
.kpi-label { color: var(--muted); font-size: 12px; }
.kpi-value { font-size: 26px; font-weight: 750; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--faint); font-size: 11.5px; margin-top: 3px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .kpis { grid-template-columns: repeat(2, 1fr); } }

/* ---------- pills ---------- */

.pill {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 3.5px 10px; border-radius: 999px; white-space: nowrap;
  background: var(--panel-3); color: var(--muted);
}
.pill.warn { background: rgba(251, 191, 36, .13); color: var(--amber); }
.pill.danger { background: rgba(248, 113, 113, .13); color: var(--red); }
.pill.calm { background: rgba(96, 165, 250, .12); color: var(--blue); }
.pill.violet { background: rgba(167, 139, 250, .13); color: var(--violet); }
.pill.ok { background: rgba(52, 211, 153, .13); color: var(--accent); }

/* ---------- attention list ---------- */

.attention { list-style: none; margin: 0; padding: 0; }
.attention li {
  display: flex; align-items: center; gap: 10px; padding: 10px 2px;
  border-bottom: 1px solid var(--line-soft);
}
.attention li:last-child { border-bottom: 0; }
.attention .name { font-weight: 600; }
.attention .price { margin-left: auto; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }

/* ---------- category bars ---------- */

.cats { list-style: none; margin: 0; padding: 0; }
.cats li {
  display: grid; grid-template-columns: 120px 1fr auto; gap: 12px;
  align-items: center; padding: 7px 0; font-size: 13px;
}
.bar { background: var(--panel-3); border-radius: 999px; height: 7px; overflow: hidden; }
.fill {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.cat-total { color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- table ---------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; color: var(--faint); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em;
  padding: 8px 10px; border-bottom: 1px solid var(--line);
}
td { padding: 12px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: rgba(255, 255, 255, .018); }
tbody tr:last-child td { border-bottom: 0; }
th.r, td.r { text-align: right; }
td.r { font-variant-numeric: tabular-nums; }
tr.dim td { color: var(--faint); }
tr.spacer td { border: 0; padding-top: 20px; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
td .notes { color: var(--muted); font-size: 12px; margin-top: 3px; font-weight: 400; }
td div.rel { display: block; color: var(--faint); font-size: 12px; margin-top: 2px; }
.rel { color: var(--faint); font-size: 12px; }
td.name { font-weight: 600; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions form { display: contents; }

/* ---------- subscriptions: cards (narrow) vs table (wide) ---------- */

.sub-cards { display: none; }
.sub-card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 14px; padding: 13px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.sub-card.dim { opacity: .55; }
.sc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sc-name { font-weight: 600; }
.sc-meta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.sc-cost { font-weight: 650; font-variant-numeric: tabular-nums; }
.sc-due { color: var(--muted); font-size: 13px; }
.sc-meta .row-actions { margin-left: auto; }

@media (max-width: 1020px) {
  .table-wrap, .table-panel { display: none; }
  .sub-cards { display: block; }
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: linear-gradient(135deg, var(--accent), #2dd4bf);
  color: #04231a; border: 0; border-radius: 10px;
  padding: 9px 16px; font-weight: 650; font-size: 13px;
  cursor: pointer; text-decoration: none;
  box-shadow: 0 4px 14px rgba(52, 211, 153, .22);
  transition: filter .15s ease, transform .15s ease;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  box-shadow: none;
}
.btn-ghost:hover { background: var(--panel-3); }
.btn-danger { background: rgba(248, 113, 113, .1); color: var(--red); border: 1px solid rgba(248, 113, 113, .2); box-shadow: none; }
.btn-danger:hover { background: rgba(248, 113, 113, .16); }
.btn-sm { padding: 4px 8px; font-size: 11.5px; border-radius: 7px; box-shadow: none; }

/* ---------- forms ---------- */

.form-card { max-width: 760px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { color: var(--muted); font-size: 12px; font-weight: 550; }
.field input, .field select {
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 10px 12px; font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus {
  outline: none; border-color: rgba(52, 211, 153, .55);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .12);
}
.field.wide { grid-column: span 2; }
.field-check {
  flex-direction: row; align-items: center; gap: 8px;
  color: var(--text); font-size: 13px; padding-bottom: 10px;
}
.field-check input { width: 16px; height: 16px; accent-color: var(--accent); }
.form-foot { margin-top: 18px; display: flex; gap: 10px; align-items: center; }

/* ---------- chat (Gil page) ---------- */

.chat-card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column;
  height: calc(100vh - 190px); min-height: 420px;
  overflow: hidden;
}
.chat-log {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
}
.cmsg { display: flex; }
.cmsg.user { justify-content: flex-end; }
.cbubble {
  max-width: 76%; padding: 10px 14px; border-radius: 14px;
  font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word;
}
.cmsg.user .cbubble {
  background: linear-gradient(135deg, rgba(52, 211, 153, .22), rgba(34, 211, 238, .16));
  border: 1px solid rgba(52, 211, 153, .2); border-bottom-right-radius: 5px;
}
.cmsg.bot .cbubble {
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-bottom-left-radius: 5px;
}
.chat-composer { display: flex; gap: 9px; padding: 14px; border-top: 1px solid var(--line-soft); background: var(--panel-2); }
.chat-composer input {
  flex: 1; background: var(--panel); border: 1px solid var(--line);
  color: var(--text); border-radius: 11px; padding: 12px 14px; font-size: 14.5px;
}
.chat-composer input:focus { outline: none; border-color: rgba(52, 211, 153, .55); box-shadow: 0 0 0 3px rgba(52, 211, 153, .12); }
.chat-composer button {
  background: linear-gradient(135deg, var(--accent), #2dd4bf); color: #04231a;
  border: 0; border-radius: 11px; width: 50px; font-size: 17px; font-weight: 700; cursor: pointer;
}
.chat-composer button:hover { filter: brightness(1.08); }

/* ---------- misc ---------- */

.empty {
  border: 1px dashed var(--line); border-radius: 12px;
  padding: 26px; text-align: center; color: var(--muted);
}
.muted { color: var(--muted); }

/* ---------- mobile: hamburger menu ---------- */

.menu-btn { display: none; }

@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 40;
    flex-direction: row; align-items: center; gap: 10px; padding: 10px 14px;
  }
  .menu-btn {
    display: grid; place-items: center; flex-shrink: 0;
    width: 40px; height: 40px; border-radius: 11px;
    background: var(--panel-2); border: 1px solid var(--line);
    color: var(--text); cursor: pointer;
  }
  .menu-btn svg { width: 20px; height: 20px; }
  .menu-btn .close { display: none; }
  .sidebar.open .menu-btn .bars { display: none; }
  .sidebar.open .menu-btn .close { display: block; }

  .brand { padding: 0; }
  .brand-text span, .sidebar-foot, .nav-label { display: none; }
  .user-chip { margin-left: auto; padding: 3px 6px; border: 0; background: none; }
  .uc-text { display: none; }
  .uc-logout { margin-left: 0; }

  /* the tab list becomes a drop-down panel */
  .nav {
    display: none;
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column;
    background: var(--sidebar);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 18px 34px rgba(0, 0, 0, .5);
    padding: 10px 12px 14px;
    gap: 4px;
    z-index: 60;
  }
  .sidebar.open .nav { display: flex; }
  .nav-item { padding: 13px 12px; font-size: 15px; }

  .main { padding: 18px 16px 40px; }
  .form-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .form-grid { grid-template-columns: 1fr !important; }
  .kpis { grid-template-columns: 1fr; }
  .main { padding: 14px 12px 32px; }
  .page-head h1 { font-size: 20px; }
  .kpi-value { font-size: 22px; }
  .extract-row { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: stretch; }
  .cats li { grid-template-columns: 84px 1fr auto; }
  .sum-card { width: 100%; }
}

/* ---------- phone refinements ---------- */

@media (max-width: 720px) {
  /* prevent iOS focus-zoom: inputs need 16px+ */
  .field input, .field select, .chat-composer input, .composer input,
  .search-input, .sort-select, .paste-box textarea, .item-row input,
  .add-form input, .add-form select {
    font-size: 16px;
  }
  /* long pills wrap instead of overflowing */
  .attention li, .spc-top, .item-list li, .sc-meta { flex-wrap: wrap; }
  .item-list li .item-who { flex-basis: 100%; order: 3; text-align: left; }
  .page-actions { width: 100%; flex-wrap: wrap; }
  .btn { padding: 10px 14px; }
  .btn-sm { padding: 8px 12px; font-size: 13px; }
  .row-actions { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .item-row { grid-template-columns: 74px 1fr 34px; }
  .item-row .item-name { grid-column: 1 / -1; grid-row: 1; }
  .item-row .item-qty { grid-row: 2; grid-column: 1; }
  .item-row .item-price { grid-row: 2; grid-column: 2; }
  .item-row .item-del { grid-row: 2; grid-column: 3; justify-self: end; }
  .editor-meta { grid-template-columns: 1fr !important; }
}

/* ============================================================
   Hisab v3 — auth, splits, friends, settings
   ============================================================ */

/* ---------- auth pages ---------- */

.auth-body {
  display: grid; place-items: center; min-height: 100vh;
  background:
    radial-gradient(900px 400px at 70% -10%, rgba(52, 211, 153, .08), transparent 60%),
    radial-gradient(800px 400px at 10% 110%, rgba(96, 165, 250, .06), transparent 60%),
    var(--bg);
}
.auth-wrap { width: 380px; max-width: calc(100vw - 32px); padding: 24px 0; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.brand-mark.big { width: 56px; height: 56px; font-size: 26px; margin: 0 auto 12px; border-radius: 17px; }
.auth-brand h1 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
.auth-brand p { margin: 4px 0 0; color: var(--faint); font-size: 13px; }
.auth-card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 16px; padding: 22px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}
.auth-card .field input {
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 11px 12px; font-size: 14px;
}
.auth-card .field input:focus {
  outline: none; border-color: rgba(52, 211, 153, .55);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .12);
}
.auth-lead { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.wide-btn { width: 100%; justify-content: center; padding: 12px; font-size: 14px; }
.auth-foot { text-align: center; color: var(--faint); font-size: 11.5px; margin-top: 16px; }

/* ---------- user chip (sidebar) ---------- */

.user-chip {
  display: flex; align-items: center; gap: 9px;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 9px 10px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; overflow: hidden;
  background: linear-gradient(135deg, var(--violet), var(--blue));
  color: #fff; font-size: 11px; font-weight: 700;
}
.avatar.sm { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }
.uc-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.uc-text strong { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uc-text span { color: var(--faint); font-size: 10.5px; }
.uc-logout { margin-left: auto; color: var(--faint); display: grid; place-items: center; padding: 4px; border-radius: 7px; }
.uc-logout:hover { color: var(--red); background: rgba(248, 113, 113, .1); }
.uc-logout svg { width: 15px; height: 15px; }

/* ---------- chips (participants) ---------- */

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 999px;
  padding: 7px 13px; font-size: 13px; font-weight: 550;
  cursor: default; transition: border-color .15s ease, background .15s ease;
}
.chip.on {
  border-color: rgba(52, 211, 153, .4);
  background: rgba(52, 211, 153, .1);
}
.chip-x {
  background: none; border: 0; color: var(--faint);
  cursor: pointer; font-size: 14px; padding: 0 0 0 2px; line-height: 1;
}
.chip-x:hover { color: var(--red); }
.add-chip { cursor: pointer; color: var(--muted); border-style: dashed; }
.add-chip:hover { color: var(--accent); border-color: rgba(52, 211, 153, .4); }

.mini-chip {
  height: 30px; min-width: 30px; padding: 0 11px; border-radius: 999px;
  background: var(--panel-3); border: 1px solid transparent;
  color: var(--muted); font-size: 12px; font-weight: 600;
  cursor: pointer; transition: all .13s ease; white-space: nowrap;
}
.mini-chip:hover { border-color: var(--line); color: var(--text); }
.mini-chip.on {
  background: linear-gradient(135deg, rgba(52, 211, 153, .25), rgba(34, 211, 238, .18));
  border-color: rgba(52, 211, 153, .5);
  color: var(--accent);
}

/* ---------- split editor ---------- */

.extract-row { display: grid; grid-template-columns: 220px 1fr; gap: 14px; }
@media (max-width: 760px) { .extract-row { grid-template-columns: 1fr; } }
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  background: var(--panel-2); border: 1.5px dashed var(--line);
  border-radius: 12px; padding: 22px 14px; cursor: pointer; text-align: center;
  color: var(--muted); font-size: 13px; transition: border-color .15s ease;
}
.dropzone:hover { border-color: rgba(52, 211, 153, .5); color: var(--text); }
.dz-ico { font-size: 26px; }
.paste-box textarea {
  width: 100%; background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 12px; padding: 12px 14px;
  font-size: 13px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  resize: vertical; line-height: 1.55;
}
.paste-box textarea:focus {
  outline: none; border-color: rgba(52, 211, 153, .55);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .12);
}
.extract-foot { display: flex; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

.item-row {
  display: grid; grid-template-columns: 1.4fr 110px 1fr 34px;
  gap: 10px; align-items: center;
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
}
.item-row.unassigned { border-color: rgba(251, 191, 36, .35); }
.item-row input {
  background: var(--panel); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 8px 10px; font-size: 13.5px;
}
.item-row input:focus { outline: none; border-color: rgba(52, 211, 153, .55); }
.item-price { text-align: right; font-variant-numeric: tabular-nums; }
.assign-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.item-del {
  background: none; border: 0; color: var(--faint);
  font-size: 14px; cursor: pointer; padding: 4px; border-radius: 7px;
}
.item-del:hover { color: var(--red); background: rgba(248, 113, 113, .1); }

.seg { display: inline-flex; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg-btn {
  background: none; border: 0; color: var(--muted);
  padding: 7px 13px; font-size: 12.5px; font-weight: 550;
  border-radius: 8px; cursor: pointer;
}
.seg-btn.on { background: var(--panel-3); color: var(--accent); }

.summary-wrap { margin-top: 20px; display: flex; justify-content: flex-end; }
.sum-card {
  width: 360px; max-width: 100%;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px;
}
.sum-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px;
}
.sum-row:last-child { border-bottom: 0; }
.sum-row strong { font-variant-numeric: tabular-nums; }
.sum-total {
  display: flex; justify-content: space-between; align-items: center;
  padding: 11px 0 4px; margin-top: 6px; border-top: 1px solid var(--line);
  font-size: 14px;
}
.sum-total strong { font-size: 18px; font-variant-numeric: tabular-nums; }
.sum-note { font-size: 12px; margin: 4px 0 12px; min-height: 16px; }

/* ---------- split cards & detail ---------- */

.split-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 13px; }
.split-card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow); transition: transform .16s ease, border-color .16s ease;
}
.split-card:hover { transform: translateY(-2px); border-color: var(--line); }
.spc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 9px; }
.type-badge {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  background: var(--panel-3); border-radius: 999px; padding: 4px 11px;
}
.spc-title { font-weight: 650; font-size: 15.5px; letter-spacing: -.01em; margin-bottom: 4px; }
.spc-meta { color: var(--muted); font-size: 12.5px; }
.spc-meta .owes { color: var(--amber); }
.spc-foot {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 13px; padding-top: 12px; border-top: 1px solid var(--line-soft);
}
.spc-total { font-size: 17px; font-weight: 750; font-variant-numeric: tabular-nums; }

.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft); font-size: 13.5px;
}
.item-list li:last-child { border-bottom: 0; }
.item-who { flex: 1; font-size: 12px; text-align: right; }
.price { font-variant-numeric: tabular-nums; font-weight: 600; }
.bill-math { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.bill-math div { display: flex; justify-content: space-between; padding: 4px 0; color: var(--muted); font-size: 13px; }
.bill-math div strong { color: var(--text); font-variant-numeric: tabular-nums; }
.bill-math .grand { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; color: var(--text); }
.bill-math .grand strong { font-size: 16px; }

/* ---------- friends ---------- */

.login-details { margin-top: 12px; }
.login-details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.friend-list { list-style: none; margin: 0; padding: 0; }
.friend-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.friend-list li:last-child { border-bottom: 0; }
.fl-text { display: flex; flex-direction: column; line-height: 1.35; flex: 1; }
.fl-text strong { font-size: 13.5px; }
.fl-text span { color: var(--muted); font-size: 12px; }

.mt { margin-top: 20px; }

/* ---------- quantity-aware item editor ---------- */

.item-block {
  background: var(--panel-2); border: 1px solid var(--line-soft);
  border-radius: 12px; padding: 10px 12px; margin-bottom: 8px;
}
.item-block.unassigned { border-color: rgba(251, 191, 36, .35); }
.item-qty {
  width: 74px !important; text-align: center; font-variant-numeric: tabular-nums;
  background: var(--panel); border: 1px solid var(--line);
  color: var(--accent); border-radius: 8px; padding: 8px 6px; font-size: 13.5px;
}
.item-qty:focus { outline: none; border-color: rgba(52, 211, 153, .55); }
.assign-row { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; margin-top: 9px; }
.asg {
  display: inline-flex; align-items: center; gap: 2px;
  background: rgba(52, 211, 153, .1); border: 1px solid rgba(52, 211, 153, .35);
  border-radius: 999px; padding: 3px 5px 3px 4px;
}
.asg.me { border-color: rgba(96, 165, 250, .4); background: rgba(96, 165, 250, .1); }
.asg button {
  background: none; border: 0; color: var(--text);
  cursor: pointer; font-size: 12px; padding: 2px 4px; border-radius: 6px;
  line-height: 1;
}
.asg button:hover { background: rgba(255, 255, 255, .08); }
.asg-x { color: var(--faint) !important; }
.asg-x:hover { color: var(--red) !important; }
.asg-name { font-weight: 600; font-size: 12.5px; }
.asg-minus { color: var(--muted) !important; font-weight: 700; }
.asg-plus { color: var(--accent) !important; font-weight: 700; }
.asg-q { color: var(--accent); font-size: 12px; font-weight: 700; min-width: 22px; text-align: center; font-variant-numeric: tabular-nums; }
.unclaimed-hint { color: var(--amber); font-size: 11.5px; font-weight: 550; }
.item-row .item-qty { width: 74px; }
.editor-meta .field select { width: 100%; }

/* ---------- toolbar & small controls ---------- */

.search-input, .sort-select {
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 10px; padding: 8px 12px; font-size: 13px;
}
.search-input { min-width: 180px; }
.search-input:focus, .sort-select:focus {
  outline: none; border-color: rgba(52, 211, 153, .55);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, .12);
}
.page-actions { flex-wrap: wrap; }

.pick-chip {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px;
  cursor: pointer; font-size: 13px; font-weight: 550;
  transition: border-color .15s ease, background .15s ease;
}
.pick-chip input { accent-color: var(--accent); margin: 0; }
.pick-chip:has(input:checked) {
  border-color: rgba(52, 211, 153, .45);
  background: rgba(52, 211, 153, .1);
}

.linklike {
  background: none; border: 0; padding: 0;
  color: var(--accent); font-size: inherit; font-weight: 600;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.linklike.danger { color: var(--red); }
.linklike:hover { filter: brightness(1.2); }

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

.pair-box {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin: 12px 0;
}
.pair-code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 22px; font-weight: 700; letter-spacing: .18em;
  color: var(--accent);
}
.steps { margin: 10px 0 0; padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.steps code {
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 6px; padding: 2px 7px; color: var(--text); font-size: 12px;
}
.share-link { color: var(--accent); font-weight: 600; }
