/* ==========================================================================
   GTA Bike Rental CRM — общий каркас дизайна
   Вдохновлено интерфейсом Claude Console (platform.claude.com)
   ========================================================================== */

@font-face {
  font-family: "Rhythmic RUS";
  src: url("/static/fonts/Rhythmic_RUS.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Porsche Original";
  src: url("/static/fonts/Porsche_Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root,
html[data-theme="day"] {
  --bg: #faf9f7;
  --surface: #ffffff;
  --border: #e5e3df;
  --border-strong: #d8d5cf;
  --text: #1b1a17;
  --text-muted: #6b6862;
  --text-faint: #94908a;
  --accent: #1b1a17;
  --accent-contrast: #ffffff;
  --accent-hover: #34322c;
  --danger: #b3411f;
  --danger-bg: #fbeee8;
  --success: #2b7a2b;
  --success-bg: #eaf5ea;
  --warning-bg: #fff8e1;
  --warning-border: #e0c46c;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 7px;
  --sidebar-w: 240px;
  --topbar-h: 80px;
  --shadow-sm: 0 1px 2px rgba(20, 18, 14, 0.04);
  --shadow-md: 0 8px 24px rgba(20, 18, 14, 0.08);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --dur-fast: 0.15s;
  --dur: 0.25s;
  --gradient-brand: linear-gradient(120deg, #ffd9e6 0%, #ffc0d6 28%, #d6cdfb 55%, #b9dcff 78%, #a2d4ff 100%);
  --gradient-text: #1b1a17;
  --gradient-text-muted: rgba(27, 26, 23, 0.68);
  --gradient-shadow: 0 14px 28px rgba(180, 150, 200, 0.4);
  --bg-overlay: rgba(250, 249, 247, 0.5);
  --surface-glass: rgba(255, 255, 255, 0.06);
}

html[data-theme="night"] {
  --bg: #17151d;
  --surface: #201d28;
  --border: #322e3b;
  --border-strong: #433e50;
  --text: #f2efe9;
  --text-muted: #aca7b3;
  --text-faint: #746f7d;
  --accent: #f2efe9;
  --accent-contrast: #17151d;
  --accent-hover: #ddd8cf;
  --danger: #ff8467;
  --danger-bg: #3a201a;
  --success: #7ed37e;
  --success-bg: #1d3320;
  --warning-bg: #3a3018;
  --warning-border: #6b5a28;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.5);
  --gradient-brand: linear-gradient(120deg, #241a2e 0%, #3a2340 35%, #6b2f3a 65%, #d9642b 100%);
  --gradient-text: #ffffff;
  --gradient-text-muted: rgba(255, 255, 255, 0.78);
  --gradient-shadow: 0 14px 28px rgba(0, 0, 0, 0.5);
  --bg-overlay: rgba(23, 21, 29, 0.86);
  --surface-glass: rgba(23, 21, 29, 0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "PT Sans Narrow", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  background-color: var(--bg);
  background-image: linear-gradient(var(--bg-overlay), var(--bg-overlay)), url("/static/img/site-bg.png");
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
  background-attachment: fixed;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.hello-greeting-wrap {
  position: fixed;
  top: 40px;
  left: 50%;
  z-index: 22;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.hello-greeting {
  font-family: "Rhythmic RUS", "Unbounded", "PT Sans Narrow", cursive;
  font-weight: 400;
  font-size: 40px;
  letter-spacing: 0.5px;
  margin: 0;
  display: inline-block;
  transform: rotate(-2deg);
  background: linear-gradient(
    155deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(255, 255, 255, 0.6) 22%,
    rgba(255, 255, 255, 0.22) 45%,
    rgba(255, 255, 255, 0.55) 65%,
    rgba(255, 255, 255, 0.92) 100%
  );
  background-clip: text;
  -webkit-background-clip: text;
  color: rgba(255, 255, 255, 0.42);
  -webkit-text-fill-color: rgba(255, 255, 255, 0.42);
  text-shadow:
    -1px -1px 0 rgba(27, 26, 23, 0.7),
    1px -1px 0 rgba(27, 26, 23, 0.7),
    -1px 1px 0 rgba(27, 26, 23, 0.7),
    1px 1px 0 rgba(27, 26, 23, 0.7),
    0 2px 4px rgba(0, 0, 0, 0.25),
    2px 6px 12px rgba(0, 0, 0, 0.3);
}

a { color: inherit; }

/* ---------- Motion ---------- */

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.main {
  animation: fade-in-up 0.35s var(--ease) both;
}

.card, .notice, .notice-error, table {
  animation: fade-in 0.35s var(--ease) both;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001s !important; transition-duration: 0.001s !important; }
}

/* ---------- Topbar (unified gradient: logo + page header) ---------- */

.topbar {
  display: flex;
  align-items: stretch;
  height: var(--topbar-h);
  background: var(--gradient-brand);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: var(--gradient-shadow);
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: hidden;
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

.topbar-brand {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding-left: 24px;
  position: relative;
  z-index: 1;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.topbar-brand:hover {
  opacity: 0.9;
  transform: scale(1.03);
}

.topbar-brand:active {
  transform: scale(0.98);
}

.topbar-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 40px;
  color: var(--gradient-text);
  position: relative;
  z-index: 1;
}

.topbar-content:empty {
  padding: 0;
}

.topbar-content h1 {
  margin: 0;
  font-size: 20px;
  color: var(--gradient-text);
}

.topbar-content p {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--gradient-text-muted);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
}

.btn-quick-rental-global {
  align-self: center;
  margin-right: 40px;
  position: relative;
  z-index: 2;
}

.month-badge {
  position: fixed; top: 16px; right: 40px; width: 92px; height: 92px;
  border-radius: 50%; color: var(--gradient-text); text-decoration: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15); text-align: center; line-height: 1.2;
  z-index: 21; font-weight: 700;
  /* Кольцо-прогресс окупаемости: заполненная часть — до --pb-deg, остальное приглушено. */
  --pb-deg: 0deg;
  background: conic-gradient(rgba(255,255,255,0.95) var(--pb-deg), rgba(255,255,255,0.20) 0);
  cursor: grab; user-select: none; touch-action: none;
  transition: transform var(--dur-fast) var(--ease), filter var(--dur-fast) var(--ease);
}
.month-badge-inner {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 74%; height: 74%; border-radius: 50%;
  /* Полупрозрачная «дырка» в кольце — работает и на светлой, и на тёмной теме. */
  background: rgba(0,0,0,0.30);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.month-badge:hover { transform: translateY(-2px); filter: brightness(1.08); }
.month-badge.is-dragging { cursor: grabbing; transition: none; transform: scale(1.06); box-shadow: 0 10px 24px rgba(0,0,0,0.3); }
.month-badge.paid-back { background: conic-gradient(#3ddc84 360deg, #3ddc84 0); }
.month-badge small { font-size: 9.5px; opacity: 0.8; letter-spacing: .02em; }
.month-badge strong { font-size: 20px; }

.btn-quick-rental {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(6px);
  color: var(--gradient-text);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  white-space: nowrap;
  transition: transform var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease);
}

.btn-quick-rental-plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--gradient-text);
  color: transparent;
  font-size: 18px;
  line-height: 1;
  flex-shrink: 0;
}

html[data-theme="day"] .btn-quick-rental-plus {
  background: #1b1a17;
  color: #ffffff;
}

html[data-theme="night"] .btn-quick-rental-plus {
  background: #ffffff;
  color: #17151d;
}

.btn-quick-rental:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.34);
  border-color: rgba(255, 255, 255, 0.55);
}

.btn-quick-rental:active {
  transform: translateY(0) scale(0.98);
}

.brand-logo {
  max-height: 48px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

/* ---------- App shell ---------- */

.app-shell {
  display: flex;
  min-height: calc(100vh - var(--topbar-h));
}

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface-glass);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.sidebar-nav a {
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.12);
}

.sidebar-nav .nav-icon {
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18));
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text-muted);
  font-size: 18px;
  font-weight: 700;
  position: relative;
  transform-origin: left center;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), padding-left var(--dur-fast) var(--ease);
}

.sidebar-nav a:hover {
  background: var(--bg);
  color: var(--text);
  padding-left: 14px;
  transform: scale(1.04);
}

.sidebar-nav a:active {
  transform: scale(0.98);
}

.sidebar-nav a.active {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
}

.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
  animation: fade-in var(--dur) var(--ease) both;
}

.nav-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.sidebar-footer {
  margin-top: 24px;
  padding: 10px 10px 0;
  border-top: 1px solid var(--border);
  font-size: 15px;
  color: var(--text-faint);
}

button.logout-btn[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: underline;
  transition: color var(--dur-fast) var(--ease);
}

button.logout-btn[type="submit"]:hover {
  color: var(--text);
  background: none;
  box-shadow: none;
}

.logout-btn .nav-icon {
  width: 18px;
  height: 18px;
}

.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 12px;
  cursor: pointer;
  user-select: none;
}

.theme-switch-icon {
  width: 17px;
  height: 17px;
  object-fit: contain;
  opacity: 0.5;
  transition: opacity var(--dur-fast) var(--ease);
}

.theme-switch-track {
  position: relative;
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  flex-shrink: 0;
  transition: background var(--dur) var(--ease);
}

.theme-switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  transition: transform var(--dur) var(--ease);
}

.theme-switch:hover .theme-switch-track {
  box-shadow: 0 0 0 3px rgba(107, 104, 98, 0.12);
}

.theme-switch.is-night .theme-switch-track {
  background: var(--accent);
}

.theme-switch.is-night .theme-switch-thumb {
  transform: translateX(16px);
}

.theme-switch.is-night .theme-switch-icon:last-child {
  opacity: 1;
}

.theme-switch:not(.is-night) .theme-switch-icon:first-child {
  opacity: 1;
}

.main {
  flex: 1;
  min-width: 0;
  padding: 32px 40px 60px;
  max-width: 1200px;
}

/* ---------- Typography ---------- */

h1, h2, h3 {
  font-family: "Unbounded", "PT Sans Narrow", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  font-size: 28px;
  margin: 0 0 20px;
}

h2 {
  font-size: 20px;
  margin: 32px 0 12px;
}

h3 {
  font-size: 16px;
  margin: 24px 0 10px;
}

p { margin: 0 0 12px; }

.muted { color: var(--text-muted); }

/* ---------- Cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  transition: box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.card-grid .card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.card-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 8px;
}

.card-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* ---------- Money cards (reports) ---------- */

.card-money {
  background: var(--gradient-brand);
  border: none;
  color: var(--gradient-text);
  transition: background var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.card-money .card-label {
  color: var(--gradient-text-muted);
}

.card-money .card-value {
  color: var(--gradient-text) !important;
}

.card-grid .card-money:hover {
  box-shadow: var(--gradient-shadow);
}

/* ---------- Buttons ---------- */

button,
.btn,
input[type="submit"] {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

button:hover,
.btn:hover,
input[type="submit"]:hover {
  background: var(--bg);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

button:active,
.btn:active,
input[type="submit"]:active {
  transform: translateY(0) scale(0.97);
  box-shadow: none;
}

button[type="submit"],
.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}

button[type="submit"]:hover,
.btn-primary:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--border-strong);
}

.btn-danger:hover {
  background: var(--danger-bg);
  border-color: #e6b6a4;
}

button.btn-pill[type="submit"],
.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px 8px 8px;
  border-radius: 999px;
  background: var(--gradient-brand);
  border: 1px solid transparent;
  color: var(--gradient-text);
  font-weight: 700;
  font-size: 15px;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.btn-pill-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 14px;
  line-height: 1;
  flex-shrink: 0;
}

html[data-theme="day"] .btn-pill-icon { background: #1b1a17; color: #ffffff; }
html[data-theme="night"] .btn-pill-icon { background: #ffffff; color: #17151d; }

button.btn-pill[type="submit"]:hover,
.btn-pill:hover {
  background: var(--gradient-brand);
  transform: translateY(-2px);
  box-shadow: var(--gradient-shadow);
}

button.btn-pill[type="submit"]:active,
.btn-pill:active {
  transform: translateY(0) scale(0.98);
}

.color-swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  vertical-align: middle;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15) inset;
}

input.color-picker {
  width: 56px;
  max-width: 56px;
  height: 36px;
  padding: 3px;
  cursor: pointer;
}

.file-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.file-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.file-input-btn {
  margin: 0;
}

.file-input-filename {
  font-size: 13px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Forms ---------- */

label {
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="email"],
input[type="password"],
select,
textarea {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  width: 100%;
  max-width: 420px;
  margin-top: 4px;
  transition: border-color var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

textarea { max-width: 100%; min-height: 70px; }

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b6862' stroke-width='1.6' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}

.toolbar select { width: auto; min-width: 200px; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(27, 26, 23, 0.08);
}

/* Radio/checkbox pill groups (.options), already used across forms */
.options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.options label {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  font-weight: 500;
  background: var(--surface);
  transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}

.options label:hover {
  border-color: var(--text-faint);
  transform: translateY(-1px);
}

.options input[type="radio"],
.options input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 2px solid #a8a49c;
  border-radius: 4px;
  display: inline-block;
  position: relative;
  margin: 0;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease);
}

.options input[type="radio"] { border-radius: 50%; }

.options input[type="radio"]:checked,
.options input[type="checkbox"]:checked {
  background-color: var(--accent);
  border-color: var(--accent);
  transform: scale(1.05);
}

.options input[type="radio"]:checked::after,
.options input[type="checkbox"]:checked::after {
  content: "✓";
  color: var(--accent-contrast);
  position: absolute;
  left: 1px;
  top: -3px;
  font-size: 12px;
  animation: fade-in var(--dur-fast) var(--ease) both;
}

/* ---------- Tables ---------- */

table {
  border-collapse: collapse;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

th, td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
}

th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background var(--dur-fast) var(--ease); }

tbody tr:hover { background: var(--bg); }

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

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-success { background: var(--success-bg); color: var(--success); border-color: transparent; }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: transparent; }
.badge-warning { background: var(--warning-bg); color: #8a6d1f; border-color: var(--warning-border); }

/* ---------- Notices / banners ---------- */

.notice {
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
}

.notice-error {
  background: var(--danger-bg);
  border: 1px solid #e6b6a4;
  color: var(--danger);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  margin-bottom: 16px;
}

/* ---------- Utility ---------- */

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.stack { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

form.inline, form.delete { display: inline; }

/* ==========================================================================
   Мобильная версия (телефоны и маленькие планшеты)
   Компьютер продолжает показывать полную вёрстку выше — эти правила
   включаются только на узких экранах.
   ========================================================================== */

@media (max-width: 860px) {
  :root { --topbar-h: 64px; }

  body { font-size: 15.5px; }

  /* Topbar: логотип и заголовок сжимаются, кнопка "Новая аренда" — компактнее */
  .topbar-brand {
    width: auto;
    padding-left: 12px;
  }

  .brand-logo { max-height: 32px; }

  .topbar-content { padding: 0 10px; }

  .topbar-content h1 { font-size: 16px; }

  .topbar-content p { font-size: 12px; }

  .btn-quick-rental-global {
    margin-right: 10px;
  }

  .btn-quick-rental {
    padding: 6px 12px 6px 6px;
    font-size: 0;
    gap: 0;
  }

  .btn-quick-rental-plus {
    width: 24px;
    height: 24px;
    font-size: 16px;
  }

  .hello-greeting-wrap {
    top: 34px;
  }

  .hello-greeting {
    font-size: 24px;
  }

  .month-badge {
    top: auto;
    bottom: 14px;
    right: 14px;
    width: 66px;
    height: 66px;
  }

  .month-badge strong { font-size: 13px; }
  .month-badge small { font-size: 9px; }

  /* App shell: sidebar becomes a horizontally scrollable strip under the topbar */
  .app-shell {
    flex-direction: column;
    min-height: 0;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: var(--topbar-h);
    z-index: 15;
    padding: 10px 12px 8px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
  }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 4px;
    padding-bottom: 2px;
  }

  .sidebar-nav a {
    flex-shrink: 0;
    font-size: 13px;
    padding: 8px 10px;
    white-space: nowrap;
  }

  .sidebar-nav a:hover {
    padding-left: 10px;
    transform: none;
  }

  .sidebar-nav a.active::before {
    left: 0;
    top: auto;
    bottom: 0;
    transform: none;
    width: 100%;
    height: 3px;
    border-radius: 3px 3px 0 0;
  }

  .nav-icon { width: 18px; height: 18px; }

  .sidebar-footer {
    margin-top: 8px;
    padding-top: 8px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px 16px;
  }

  .main {
    padding: 18px 14px 40px;
    max-width: 100%;
  }

  h1 { font-size: 22px; }
  h2 { font-size: 17px; margin: 24px 0 10px; }

  /* Tables scroll horizontally instead of squeezing columns unreadably */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  th, td {
    padding: 8px 10px;
    font-size: 13px;
  }

  /* Forms: full-width inputs, bigger tap targets */
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="datetime-local"],
  input[type="email"],
  input[type="password"],
  select,
  textarea {
    max-width: 100%;
    font-size: 16px; /* prevents iOS Safari auto-zoom on focus */
  }

  button,
  .btn,
  input[type="submit"] {
    padding: 11px 16px;
  }

  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar select { width: 100%; }

  .actions { min-width: 0; }

  .card { padding: 16px; }

  .card-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .card-grid { grid-template-columns: 1fr; }
  .hello-greeting-wrap { display: none; }
}

/* ── Кружок-прогресс окупаемости ─────────────────────────────────────── */
.pb-ring {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  vertical-align: middle;
  font-weight: bold;
  line-height: 1;
  flex: none;
}
.pb-ring-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 74%;
  height: 74%;
  border-radius: 50%;
  background: var(--card-bg, #fff);
}
.pb-ring-empty {
  background: var(--border, #e0e0e0);
  color: var(--muted, #888);
  font-size: 15px;
}
.pb-row { display: flex; align-items: center; gap: 12px; }
.pb-bikes { display: flex; flex-direction: column; gap: 10px; }
