:root {
  --bg: #0a0a0a;
  --surface: #151515;
  --border: #1e1e1e;
  --accent: #F5C518;
  --success: #22C55E;
  --error: #EF4444;
  --text: #e8e4dd;
  --text-muted: #bbb;
  --radius: 14px;
  --radius-sm: 10px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Space Grotesk', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Mono font for data */
.mono { font-family: 'JetBrains Mono', monospace; }

/* Layout — mobile max width */
.page { max-width: 480px; margin: 0 auto; min-height: 100vh; }

/* --- Buttons --- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 14px; border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: opacity 0.15s;
}
.btn:active { opacity: 0.8; }
.btn-accent { background: var(--accent); color: #0a0a0a; }
.btn-success { background: var(--success); color: #fff; }
.btn-surface {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
}

/* --- Inputs --- */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-family: 'JetBrains Mono', monospace;
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: #ddd; margin-bottom: 6px;
}
.field input {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 13px 14px; color: #fff;
  font-size: 14px; font-family: inherit; outline: none;
  transition: border-color 0.2s;
}
.field input::placeholder { color: #888; }
.field input:focus { border-color: var(--accent); }

/* --- Cards --- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
}

/* --- Balance card --- */
.balance {
  background: var(--accent); border-radius: 16px; padding: 20px;
  position: relative; overflow: hidden; margin: 0 0 20px;
}
.balance::before {
  content: '₽'; position: absolute; right: -8px; top: -12px;
  font-size: 100px; font-weight: 800; color: rgba(0,0,0,0.06); line-height: 1;
}
.balance-label {
  font-size: 11px; color: rgba(0,0,0,0.5); letter-spacing: 2px;
  text-transform: uppercase; font-weight: 600;
}
.balance-amount {
  font-family: 'JetBrains Mono', monospace; font-size: 36px;
  font-weight: 700; color: #0a0a0a; letter-spacing: -2px;
  margin: 4px 0; line-height: 1;
}
.balance-sub { font-size: 11px; color: rgba(0,0,0,0.4); }

/* --- Waybill timer panel --- */
.wb-timer {
  background: var(--surface); border: 1px solid rgba(34,197,94,0.25);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
  transition: border-color 0.3s;
}
.wb-timer--inactive {
  border-color: var(--border);
}
.wb-timer--warn { border-color: rgba(245,197,24,0.4); }
.wb-timer--danger { border-color: rgba(239,68,68,0.4); }
.wb-timer--expired { border-color: rgba(239,68,68,0.3); opacity: 0.6; }

.wb-timer-header { display: flex; justify-content: space-between; align-items: flex-start; }
.wb-timer-label {
  font-family: 'JetBrains Mono', monospace; font-size: 9px;
  letter-spacing: 2px; color: var(--success); font-weight: 600;
}
.wb-timer--warn .wb-timer-label { color: var(--accent); }
.wb-timer--danger .wb-timer-label { color: var(--error); }
.wb-timer--inactive .wb-timer-label { color: var(--text-muted); }
.wb-timer--expired .wb-timer-label { color: var(--error); }

.wb-timer-number { font-size: 15px; font-weight: 700; color: #fff; margin-top: 2px; }
.wb-timer-plate {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--accent); background: rgba(245,197,24,0.08);
  padding: 3px 8px; border-radius: 4px; letter-spacing: 1px;
}

.wb-timer-bar-wrap {
  height: 4px; background: #1e1e1e; border-radius: 2px;
  margin: 12px 0; overflow: hidden;
}
.wb-timer-bar {
  height: 100%; background: var(--success); border-radius: 2px;
  transition: width 1s linear, background-color 0.3s;
  width: 100%;
}
.wb-timer--warn .wb-timer-bar { background: var(--accent); }
.wb-timer--danger .wb-timer-bar { background: var(--error); }

.wb-timer-footer { display: flex; justify-content: space-between; align-items: baseline; }
.wb-timer-clock {
  font-family: 'JetBrains Mono', monospace; font-size: 28px;
  font-weight: 700; color: #fff; letter-spacing: -1px; line-height: 1;
}
.wb-timer-hint { font-size: 11px; color: var(--text-muted); }

/* --- Nav bar --- */
.nav { padding: 14px 20px; display: flex; align-items: center; gap: 14px; }
.nav-back {
  width: 36px; height: 36px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: #888; text-decoration: none; font-size: 18px;
}
.nav-title { font-size: 16px; font-weight: 700; color: #fff; }

/* --- Header --- */
.header { padding: 14px 20px; display: flex; justify-content: space-between; align-items: center; }
.header-name { font-size: 17px; font-weight: 600; color: #fff; }
.header-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; }
.header-logout {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  color: #444; letter-spacing: 1px; border: 1px solid var(--border);
  border-radius: 6px; padding: 5px 10px; background: none;
  cursor: pointer; text-decoration: none;
}

/* --- Action buttons --- */
.action {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px; text-decoration: none; color: var(--text);
  transition: border-color 0.2s; cursor: pointer;
}
.action:hover { border-color: #333; }
.action-icon {
  width: 40px; height: 40px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.action-icon.green { background: rgba(34,197,94,0.12); color: var(--success); }
.action-icon.slate { background: rgba(148,163,184,0.1); color: #64748B; }
.action-text { font-size: 14px; font-weight: 600; }
.action-sub { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.action-arrow { margin-left: auto; color: #333; font-size: 16px; }

/* --- Transaction list --- */
.tx-title {
  font-family: 'JetBrains Mono', monospace; font-size: 10px;
  letter-spacing: 2px; color: #444; text-transform: uppercase;
  padding: 16px 0 8px;
}
.tx-list { background: var(--surface); border-radius: 12px; border: 1px solid var(--border); overflow: hidden; }
.tx-item { padding: 11px 14px; display: flex; justify-content: space-between; align-items: center; }
.tx-item + .tx-item { border-top: 1px solid #1c1c1c; }
.tx-label { font-size: 12px; font-weight: 500; color: #aaa; }
.tx-date { font-size: 10px; color: #444; font-family: 'JetBrains Mono', monospace; }
.tx-val { font-family: 'JetBrains Mono', monospace; font-size: 13px; font-weight: 600; }
.tx-neg { color: var(--error); }
.tx-pos { color: var(--success); }

/* --- Waybill cards (history) --- */
.wb-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; overflow: hidden; }
.wb-main { padding: 14px 16px; display: flex; justify-content: space-between; align-items: flex-start; }
.wb-num { font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 600; color: #fff; letter-spacing: 0.5px; }
.wb-meta { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.wb-badge { font-family: 'JetBrains Mono', monospace; font-size: 10px; font-weight: 600; letter-spacing: 1px; padding: 4px 8px; border-radius: 6px; }
.wb-ok { background: rgba(34,197,94,0.1); color: var(--success); border: 1px solid rgba(34,197,94,0.2); }
.wb-error { background: rgba(239,68,68,0.1); color: var(--error); border: 1px solid rgba(239,68,68,0.2); }
.wb-actions { display: flex; border-top: 1px solid #1c1c1c; }
.wb-btn {
  flex: 1; padding: 10px; font-size: 11px; font-weight: 600; color: #777;
  text-align: center; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 6px; border: none; background: none;
  font-family: inherit; text-decoration: none; transition: color 0.15s;
}
.wb-btn:hover { color: var(--accent); }

/* --- Odometer input --- */
.odo-input {
  border: 2px solid var(--accent); border-radius: var(--radius); padding: 16px;
  font-family: 'JetBrains Mono', monospace; font-size: 22px; font-weight: 700;
  color: #fff; background: var(--surface); width: 100%; text-align: center;
  letter-spacing: 1px; outline: none;
}
.odo-hint { font-size: 11px; color: #444; margin-top: 6px; text-align: center; }

/* --- Price row --- */
.price-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: rgba(245,197,24,0.06);
  border: 1px solid rgba(245,197,24,0.15); border-radius: var(--radius-sm);
  margin: 18px 0;
}
.price-label { font-size: 13px; color: #888; }
.price-val { font-family: 'JetBrains Mono', monospace; font-size: 16px; font-weight: 700; color: var(--accent); }

/* --- Success card --- */
.success-card {
  margin-top: 18px; background: var(--surface); border: 1px solid var(--success);
  border-radius: var(--radius); padding: 18px; text-align: center;
}
.success-icon { font-size: 32px; margin-bottom: 8px; }
.success-title { font-size: 14px; font-weight: 600; color: #fff; }
.success-num { font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--accent); margin-top: 2px; letter-spacing: 1px; }

/* --- Error message --- */
.error-msg {
  background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2);
  border-radius: var(--radius-sm); padding: 12px 16px; margin-top: 12px;
  font-size: 13px; color: var(--error); text-align: center;
}

/* --- Login page --- */
.login-page {
  display: flex; flex-direction: column; justify-content: center;
  min-height: 100vh; padding: 40px 24px;
}
.login-mark {
  width: 48px; height: 48px; background: var(--accent); border-radius: 4px;
  transform: rotate(-3deg); display: flex; align-items: center;
  justify-content: center; margin-bottom: 16px; font-size: 24px;
}
.login-title { font-size: 26px; font-weight: 700; color: #fff; letter-spacing: -1px; line-height: 1.1; }
.login-title em { font-style: normal; color: var(--accent); }
.login-sub { font-size: 12px; color: #ccc; margin-top: 6px; letter-spacing: 0.5px; margin-bottom: 32px; }

/* --- Car plate badge --- */
.plate {
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  color: var(--accent); background: rgba(245,197,24,0.08);
  padding: 2px 8px; border-radius: 4px; display: inline-block;
  letter-spacing: 1px; margin-top: 3px;
}

/* --- Section padding --- */
.content { padding: 20px; }

/* --- Loading state --- */
.htmx-request .btn { opacity: 0.5; pointer-events: none; }
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: block; text-align: center; color: var(--text-muted); padding: 12px; }
