/* KONS — мини-приложение. Графит + лаймовый сигнал. */
:root {
  --bg: #0F1115; --surface: #191C22; --surface2: #14161B; --raise: #1D2027;
  --line: #262A33; --line2: #22262E; --line3: #2E333D;
  --text: #EDEFF3; --muted: #9AA1AD; --soft: #C9CED6;
  --accent: #C6F432; --accent-ink: #0F1115; --link: #C6F432;
  --danger: #FF6B6B; --danger-bg: #1F1416; --danger-line: #5C2226; --danger-ink: #FF9A9A;
  --radius: 16px;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Onest', system-ui, -apple-system, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
:root[data-theme="light"] {
  --bg: #F2F3F5; --surface: #FFFFFF; --surface2: #FAFAFB; --raise: #F6F7F9;
  --line: #E1E4E9; --line2: #ECEEF1; --line3: #D6DAE0;
  --text: #15171C; --muted: #5C636E; --soft: #3D434C;
  --accent: #C6F432; --accent-ink: #15171C; --link: #4C6A00;
  --danger: #D93838; --danger-bg: #FFF1F1; --danger-line: #F3C2C2; --danger-ink: #B42323;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 15px; }
body { min-height: 100vh; overscroll-behavior-y: none; }
button, input, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--link); text-decoration: none; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.boot { height: 100vh; display: flex; align-items: center; justify-content: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line3); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* каркас */
.screen { display: flex; flex-direction: column; min-height: 100vh; }
.top { padding: 16px 18px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top h1 { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -0.02em; }
.top .sub { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 2px; }
.top.back h1 { font-size: 22px; }
.content { flex: 1; padding: 4px 14px calc(96px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; }
.content.with-footer { padding-bottom: calc(150px + var(--safe-b)); }
.chip-user { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px 5px 5px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex: none; }
.avatar.grey { background: var(--line3); color: var(--text); }
.avatar.lg { width: 40px; height: 40px; font-size: 16px; }

/* карточки */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px 8px; }
.card-h .t { flex: 1; font-weight: 600; font-size: 15px; }
.card-h .n { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.cap { font-size: 12.5px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; padding: 12px 16px 6px; }
.row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line2); color: var(--text); width: 100%; background: none; border-left: 0; border-right: 0; border-bottom: 0; text-align: left; cursor: pointer; }
.row:active { background: var(--raise); }
.row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.row .t1 { font-size: 14.5px; font-weight: 500; }
.row .t2 { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sum { font-family: var(--mono); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.pad { padding: 8px 14px 12px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty .big { font-size: 17px; color: var(--text); font-weight: 600; }

/* кнопки */
.btn { height: 50px; border-radius: 14px; border: 1px solid var(--line3); background: var(--surface); color: var(--text); font-size: 15px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; padding: 0 16px; width: 100%; transition: transform .08s ease; }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 700; font-size: 16px; }
.btn.danger { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }
.btn.ghost { background: transparent; }
.btn.outline { background: transparent; border-color: currentColor; }
.btn.sm { height: 40px; font-size: 14px; border-radius: 11px; width: auto; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); color: var(--text); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: none; }

/* цифры */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 10px 9px; display: flex; flex-direction: column; gap: 3px; }
.stat .v { font-family: var(--mono); font-size: 20px; font-weight: 600; }
.stat .l { font-size: 11.5px; color: var(--muted); line-height: 1.2; }

/* плашки */
.alert { display: flex; align-items: center; gap: 12px; border-radius: var(--radius); padding: 13px 15px; border: 1px solid var(--danger-line); background: var(--danger-bg); color: var(--danger-ink); cursor: pointer; text-align: left; width: 100%; }
.alert .t { font-weight: 600; font-size: 15px; }
.alert .s { font-size: 13px; opacity: .85; }
.banner { display: flex; align-items: center; gap: 12px; border-radius: var(--radius); padding: 14px 16px; border: 1px solid var(--line); }
.banner .ic { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.banner .t { font-size: 17px; font-weight: 700; }
.banner .s { font-size: 13px; color: var(--muted); margin-top: 2px; }
.note { font-size: 13.5px; padding: 12px 14px; border-radius: 12px; background: var(--raise); border: 1px solid var(--line); color: var(--soft); }
.pill { font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }

/* вкладки */
.seg { display: grid; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.seg button { height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.seg button.on { background: var(--line3); color: var(--text); }
.search { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.search input { flex: 1; background: transparent; border: 0; outline: none; font-size: 15px; min-width: 0; }

/* заказ в списке */
.ocard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 7px; color: var(--text); cursor: pointer; width: 100%; text-align: left; }
.ocard:active { background: var(--raise); }
.ocard .l1 { display: flex; align-items: center; gap: 8px; }
.ocard .code { font-family: var(--mono); font-weight: 600; font-size: 15px; }
.ocard .time { margin-left: auto; font-size: 12.5px; color: var(--muted); }
.ocard .l2 { display: flex; align-items: baseline; gap: 10px; }
.ocard .who { font-size: 15px; font-weight: 600; }
.ocard .what { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ocard .sum { font-family: var(--mono); font-size: 15px; font-weight: 600; white-space: nowrap; }

/* история */
.tl { padding: 4px 16px 6px; }
.tl .step { display: flex; gap: 12px; }
.tl .rail { display: flex; flex-direction: column; align-items: center; width: 14px; flex: none; }
.tl .rail .d { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; }
.tl .rail .ln { flex: 1; width: 2px; background: var(--line3); margin: 3px 0; }
.tl .step:last-child .ln { background: transparent; }
.tl .body { flex: 1; padding-bottom: 12px; }
.tl .w { font-size: 14.5px; font-weight: 500; }
.tl .m { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

/* формы */
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.input, textarea.input { height: 44px; padding: 0 12px; background: var(--surface2); border: 1px solid var(--line3); border-radius: 11px; font-size: 15px; outline: none; width: 100%; }
textarea.input { height: auto; min-height: 140px; padding: 12px; line-height: 1.45; resize: vertical; }
.input:focus { border-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 13px; font-weight: 600; padding: 7px 11px; border-radius: 999px; border: 1px solid var(--line3); background: transparent; color: var(--muted); cursor: pointer; }
.chip.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.stepper { display: flex; align-items: center; height: 44px; border: 1px solid var(--line3); border-radius: 11px; background: var(--surface2); }
.stepper button { width: 42px; height: 42px; border: 0; background: transparent; font-size: 20px; cursor: pointer; }
.stepper span { width: 30px; text-align: center; font-family: var(--mono); font-weight: 600; }
.item-edit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.item-edit .hd { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.dashed { border-style: dashed; color: var(--link); background: transparent; }

/* нижняя панель и подвал */
.nav { position: fixed; left: 0; right: 0; bottom: 0; display: grid; align-items: center; padding: 8px 8px calc(10px + var(--safe-b)); background: color-mix(in srgb, var(--surface2) 92%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line2); z-index: 10; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; font-weight: 500; padding: 4px 0; }
.nav a.on { color: var(--link); font-weight: 600; }
:root:not([data-theme="light"]) .nav a.on { color: var(--accent); }
.nav .plus { display: flex; justify-content: center; }
.nav .plus span { width: 52px; height: 52px; border-radius: 18px; background: var(--accent); display: flex; align-items: center; justify-content: center; color: var(--accent-ink); }
.footer { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(14px + var(--safe-b)); background: color-mix(in srgb, var(--surface2) 94%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line2); display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.total-line { display: flex; align-items: baseline; }
.total-line .l { flex: 1; color: var(--muted); font-size: 14px; }
.total-line .v { font-family: var(--mono); font-size: 20px; font-weight: 600; }

/* шторка */
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: flex-end; animation: fade .15s ease; }
.sheet { width: 100%; max-height: 86vh; overflow-y: auto; background: var(--surface); border-radius: 20px 20px 0 0; padding: 10px 16px calc(20px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; animation: up .2s ease; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line3); margin: 2px auto 6px; }
.sheet h2 { margin: 0 0 4px; font-size: 19px; font-weight: 700; }
.sheet .opt { height: 50px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface2); display: flex; align-items: center; gap: 12px; padding: 0 14px; font-size: 15px; font-weight: 500; cursor: pointer; width: 100%; text-align: left; }
.sheet .opt:active { background: var(--raise); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: .6; } }

#toast { position: fixed; left: 50%; bottom: calc(110px + var(--safe-b)); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 11px 16px; border-radius: 12px; font-size: 14px; font-weight: 600; opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 60; max-width: calc(100vw - 32px); text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.help-body { font-size: 15px; line-height: 1.55; padding: 4px 16px 16px; color: var(--soft); }
.help-body b { color: var(--text); }
.help-body code { font-family: var(--mono); font-size: 13px; background: var(--raise); border: 1px solid var(--line); padding: 1px 5px; border-radius: 6px; white-space: pre-wrap; display: inline; }
.bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; gap: 2px; }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.legend div { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--soft); }
.legend b { margin-left: auto; font-family: var(--mono); font-weight: 500; color: var(--text); }
.big-num { font-family: var(--mono); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.toggle-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--line2); }
.toggle-row .main { flex: 1; }
.switch { width: 46px; height: 28px; border-radius: 999px; background: var(--line3); border: 0; position: relative; cursor: pointer; flex: none; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: left .15s ease; }
.switch.on { background: var(--accent); }
.switch.on::after { left: 21px; background: var(--accent-ink); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
