/* Qashqai otplata — showroom visual system */

:root {
  --bg: #e8ebf0;
  --bg-deep: #d7dce6;
  --ink: #0f1217;
  --ink-soft: #2f3642;
  --muted: #5c6573;
  --line: rgba(15, 18, 23, 0.12);
  --surface: #ffffff;
  --surface-solid: #f5f7fa;
  --accent: #9e1028;
  --accent-deep: #730c1d;
  --good: #176347;
  --steel: #7a8494;
  --font-display: "Syne", sans-serif;
  --font-body: "Outfit", sans-serif;
  --radius: 0;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 18px 48px rgba(15, 18, 23, 0.08);
  --shell: 880px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 480px at 80% -5%, rgba(158, 16, 40, 0.05), transparent 55%),
    radial-gradient(700px 400px at 0% 40%, rgba(70, 90, 120, 0.08), transparent 50%),
    linear-gradient(180deg, #eef1f5 0%, var(--bg) 50%, var(--bg-deep) 100%);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  padding: 1.25rem clamp(0.75rem, 3vw, 1.5rem) 2.5rem;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

/* —— Framed shell —— */

.page-shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

/* —— Top bar —— */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.95rem 1.35rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.topbar-nav {
  display: flex;
  gap: 1.15rem;
}

.topbar-nav a {
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color 0.2s;
}

.topbar-nav a:hover {
  color: var(--accent);
}

/* —— Overview —— */

.overview {
  display: grid;
  gap: 1.5rem;
  padding: 1.75rem 1.5rem 1.5rem;
  animation: riseIn 0.7s var(--ease) both;
}

@media (min-width: 640px) {
  .overview {
    padding: 2rem 2rem 1.75rem;
  }
}

.eyebrow {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 0.45rem;
}

.brand-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.4rem, 6vw, 3.6rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
  text-transform: uppercase;
  margin-bottom: 0.7rem;
}

.brand-title span {
  display: block;
  font-size: 0.3em;
  letter-spacing: 0.3em;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 0.4em;
}

.overview-meta {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.overview-status {
  background: var(--surface-solid);
  border: 1px solid var(--line);
  padding: 1.35rem 1.4rem;
  animation: riseIn 0.8s var(--ease) 0.08s both;
  min-width: 0;
}

.car-band {
  margin: 0 1.5rem;
  background: #9aa3b0;
  border: 1px solid var(--line);
  animation: riseIn 0.9s var(--ease) 0.12s both;
}

@media (min-width: 640px) {
  .car-band {
    margin: 0 2rem;
  }
}

.car-band img {
  width: 100%;
  height: auto;
  display: block;
}

/* —— Sections —— */

.section {
  padding: 2rem 1.5rem 2.5rem;
}

@media (min-width: 640px) {
  .section {
    padding: 2.25rem 2rem 2.75rem;
  }
}

.section-head {
  margin-bottom: 1.35rem;
  animation: riseIn 0.7s var(--ease) both;
}

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 3.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.section-copy {
  margin-top: 0.5rem;
  color: var(--muted);
  max-width: 40ch;
  font-size: 0.92rem;
}

/* —— Progress —— */

.debt-label {
  font-size: 0.75rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.debt-value {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 5vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.debt-value small {
  font-size: 0.4em;
  font-weight: 600;
  letter-spacing: 0;
  margin-left: 0.15em;
  color: var(--muted);
}

.meter {
  margin-top: 1.25rem;
  margin-bottom: 1.25rem;
}

.meter-track {
  height: 6px;
  background: rgba(18, 21, 26, 0.1);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-deep), var(--accent));
  transition: width 1.4s var(--ease);
}

.meter-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  margin-top: 0.7rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.meter-meta strong {
  color: var(--ink);
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

@media (min-width: 520px) {
  .stat-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat {
  background: var(--surface);
  padding: 1rem 1.1rem;
  min-width: 0;
}

.stat-label {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

/* —— History —— */

.history-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.history-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
  animation: riseIn 0.6s var(--ease) both;
}

.history-item:nth-child(1) { animation-delay: 0.05s; }
.history-item:nth-child(2) { animation-delay: 0.1s; }
.history-item:nth-child(3) { animation-delay: 0.15s; }
.history-item:nth-child(4) { animation-delay: 0.2s; }
.history-item:nth-child(5) { animation-delay: 0.25s; }

.history-date {
  font-weight: 600;
  font-size: 0.95rem;
}

.history-type {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 0.15rem;
}

.history-type.is-extra {
  color: var(--accent);
}

.history-amount {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
}

.empty {
  padding: 2.5rem 0;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.45rem 0.75rem;
  padding: 1.35rem 1.35rem 1.6rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  border-top: 1px solid var(--line);
  background: var(--surface-solid);
}

.footer-sep {
  opacity: 0.5;
}

/* —— Admin shell —— */

.admin-body {
  padding-top: 0;
}

.admin-body .admin-frame {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.admin-top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.95rem 1.35rem;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
}

.admin-top h1 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.admin-top nav {
  display: flex;
  gap: 1.1rem;
}

.admin-top a {
  font-size: 0.74rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  transition: color 0.2s;
}

.admin-top a:hover {
  color: var(--accent);
}

.admin-wrap {
  max-width: none;
  margin: 0;
  padding: 1.5rem 1.35rem 2.5rem;
  display: grid;
  gap: 1.75rem;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.admin-summary .stat {
  background: var(--surface-solid);
}

@media (max-width: 640px) {
  .admin-summary {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--surface);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  padding: clamp(1.25rem, 3vw, 1.75rem);
}

.panel h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0.35rem;
}

.panel-lead {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* Month grid */

.year-block + .year-block {
  margin-top: 1.75rem;
}

.year-label {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
}

.month-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  background: var(--surface-solid);
  border: 1px solid var(--line);
  transition: border-color 0.2s, background 0.2s;
}

.month-cell.is-paid {
  border-color: rgba(26, 107, 74, 0.35);
  background: rgba(26, 107, 74, 0.06);
}

.month-cell.is-busy {
  opacity: 0.6;
  pointer-events: none;
}

.month-info {
  min-width: 0;
}

.month-name {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-date {
  font-size: 0.72rem;
  color: var(--muted);
}

/* Toggle */

.toggle {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle .slider {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #c5cad3;
  transition: 0.25s var(--ease);
}

.toggle .slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  transition: 0.25s var(--ease);
}

.toggle input:checked + .slider {
  background: var(--good);
}

.toggle input:checked + .slider::before {
  transform: translateX(18px);
}

.toggle input:focus-visible + .slider {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Forms */

.form-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .form-grid.cols-3 {
    grid-template-columns: 1fr 1fr 1.4fr;
  }
}

.field label {
  display: block;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--line);
  background: var(--surface-solid);
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(163, 17, 42, 0.12);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.8rem 1.35rem;
  border: none;
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}

.btn:hover {
  background: var(--accent);
  transform: translateY(-1px);
}

.btn-danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(163, 17, 42, 0.35);
  padding: 0.45rem 0.75rem;
  font-size: 0.7rem;
}

.btn-danger:hover {
  background: var(--accent);
  color: #fff;
}

.form-actions {
  margin-top: 0.25rem;
}

.extra-list {
  margin-top: 1.75rem;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.extra-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.extra-date {
  font-weight: 600;
}

.extra-note {
  font-size: 0.85rem;
  color: var(--muted);
}

.extra-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.extra-amount {
  font-family: var(--font-display);
  font-weight: 700;
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.85rem 1.2rem;
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  z-index: 100;
  transform: translateY(120%);
  opacity: 0;
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease);
  pointer-events: none;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

.toast.is-error {
  background: var(--accent);
}

/* —— Motion —— */

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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