/* =============================================================
   Components — buttons, cards, forms, badges, alerts, tables,
   modals, drawers, tabs, skeletons, avatars, chips, pagination,
   timeline, empty states, stats.
   ============================================================= */

/* ------------------------------------------------------------
   Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 44px;
  padding: 10px 18px;
  font-family: inherit;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  line-height: 1;
  letter-spacing: 0.01em;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  color: var(--color-text);
  background: var(--color-surface-2);
  cursor: pointer;
  user-select: none;
  transition: background var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard),
              transform var(--dur-fast) var(--ease-standard);
  white-space: nowrap;
}

.btn:hover { background: var(--color-surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: var(--color-on-primary);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border-strong);
}
.btn-secondary:hover { background: var(--color-surface-2); }

.btn-ghost {
  background: transparent;
  color: var(--color-text-soft);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--color-surface-2); color: var(--color-text); }

.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.btn-danger:hover { filter: brightness(0.95); }

.btn-success {
  background: var(--color-success);
  color: #fff;
  border-color: var(--color-success);
}
.btn-success:hover { filter: brightness(0.95); }

.btn-sm {
  min-height: 36px;
  padding: 8px 12px;
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
}

.btn-lg {
  min-height: 52px;
  padding: 14px 22px;
  font-size: var(--fs-base);
}

.btn-icon {
  min-height: 44px;
  min-width: 44px;
  padding: 0;
  aspect-ratio: 1 / 1;
}

.btn-icon.btn-sm {
  min-height: 36px;
  min-width: 36px;
}

.btn-block { width: 100%; }

.btn[aria-busy="true"] {
  position: relative;
  color: transparent !important;
}

.btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  color: var(--color-on-primary);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */
.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.card--flat { box-shadow: none; }
.card--muted { background: var(--color-surface-2); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--color-divider);
}

.card-header h2,
.card-header h3,
.card-header h4 {
  margin: 0;
  font-size: var(--fs-h5);
  font-weight: var(--fw-semibold);
}

.card-header__subtitle {
  margin-top: 2px;
  font-size: var(--fs-sm);
  color: var(--color-muted);
  font-weight: var(--fw-regular);
}

.card-body {
  padding: var(--sp-5);
  flex: 1;
}

.card-body--tight { padding: var(--sp-4); }

.card-footer {
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
}

/* ------------------------------------------------------------
   Stat tiles (dashboard KPIs)
   ------------------------------------------------------------ */
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-xs);
}

.stat__label {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--color-muted);
  font-weight: var(--fw-medium);
}

.stat__value {
  font-size: var(--fs-h2);
  font-weight: var(--fw-bold);
  line-height: 1.1;
  color: var(--color-text);
}

.stat__delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-muted);
}

.stat__delta--up { color: var(--color-success); }
.stat__delta--down { color: var(--color-danger); }

/* ------------------------------------------------------------
   Forms
   ------------------------------------------------------------ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-soft);
}

.form-label__required {
  color: var(--color-danger);
  margin-left: 2px;
}

.form-hint {
  font-size: var(--fs-xs);
  color: var(--color-muted);
}

.form-error {
  font-size: var(--fs-xs);
  color: var(--color-danger);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  font: inherit;
  font-size: var(--fs-sm);
  color: var(--color-text);
  /* background: var(--color-surface); */
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--dur-fast) var(--ease-standard),
              background var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}

.input::placeholder,
.textarea::placeholder { color: var(--color-placeholder); }

.input:hover,
.select:hover,
.textarea:hover { border-color: var(--color-border-strong); }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: var(--shadow-focus);
  background: var(--color-surface);
}

.input--solid,
.select--solid,
.textarea--solid {
  background: var(--color-surface-2);
  border-color: transparent;
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.5;
}

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

[data-theme="dark"] .select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b93a7' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
}

.form-invalid .input,
.form-invalid .select,
.form-invalid .textarea {
  border-color: var(--color-danger);
}

.form-invalid .input:focus,
.form-invalid .select:focus,
.form-invalid .textarea:focus {
  box-shadow: 0 0 0 4px var(--color-danger-tint);
}

/* Input group with prefix/suffix (for search, balance, etc) */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}

.input-group .input {
  padding-left: 42px;
}

.input-group__prefix,
.input-group__suffix {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-muted);
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
}

.input-group__prefix { left: 0; }
.input-group__suffix { right: 0; }
.input-group--has-suffix .input { padding-right: 42px; padding-left: 14px; }

/* Checkbox & radio */
.checkbox,
.radio {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--color-text);
  cursor: pointer;
  user-select: none;
  min-height: 28px;
  line-height: 1.4;
}

.checkbox input[type="checkbox"],
.radio input[type="radio"] {
  appearance: none;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  border: 1.5px solid var(--color-border-strong);
  background: var(--color-surface);
  cursor: pointer;
  display: inline-block;
  position: relative;
  transition: border-color var(--dur-fast) var(--ease-standard),
              background var(--dur-fast) var(--ease-standard);
}

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

.checkbox input[type="checkbox"]:checked,
.radio input[type="radio"]:checked {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.checkbox input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid var(--color-on-primary);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.radio input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 8px;
  height: 8px;
  transform: translate(-50%, -50%);
  background: var(--color-on-primary);
  border-radius: 50%;
}

.checkbox input[type="checkbox"]:focus-visible,
.radio input[type="radio"]:focus-visible {
  box-shadow: var(--shadow-focus);
}

/* Switch (iOS-style) */
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
  min-height: 32px;
  font-size: var(--fs-sm);
  color: var(--color-text);
}

.switch input { display: none; }

.switch__track {
  position: relative;
  width: 40px;
  height: 24px;
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
  transition: background var(--dur-fast) var(--ease-standard);
  flex-shrink: 0;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-xs);
  transition: transform var(--dur-fast) var(--ease-standard);
}

.switch input:checked + .switch__track {
  background: var(--color-primary);
}

.switch input:checked + .switch__track::after {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch__track {
  box-shadow: var(--shadow-focus);
}

/* ------------------------------------------------------------
   Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  min-height: 22px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  line-height: 1.2;
  background: var(--color-neutral-tint);
  color: var(--color-text-soft);
  white-space: nowrap;
}

.badge-primary { background: var(--color-primary-tint); color: var(--color-primary); }
.badge-success { background: var(--color-success-tint); color: var(--color-success); }
.badge-warning { background: var(--color-warning-tint); color: var(--color-warning); }
.badge-danger  { background: var(--color-danger-tint);  color: var(--color-danger); }
.badge-info    { background: var(--color-info-tint);    color: var(--color-info); }
.badge-neutral { background: var(--color-neutral-tint); color: var(--color-text-soft); }

.badge-solid-primary { background: var(--color-primary); color: var(--color-on-primary); }
.badge-solid-success { background: var(--color-success); color: #fff; }
.badge-solid-warning { background: var(--color-warning); color: #fff; }
.badge-solid-danger  { background: var(--color-danger);  color: #fff; }
.badge-solid-info    { background: var(--color-info);    color: #fff; }

.badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.badge-lg {
  padding: 6px 12px;
  font-size: var(--fs-sm);
  min-height: 28px;
}

/* ------------------------------------------------------------
   Spec list — label / value rows (vehicle summary card, etc.)
   ------------------------------------------------------------ */
.spec {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
  border-bottom: 1px dashed var(--color-divider);
  font-size: var(--fs-sm);
}
.spec:last-child { border-bottom: 0; }
.spec__label {
  color: var(--color-muted);
  font-weight: var(--fw-medium);
  flex-shrink: 0;
}
.spec__value {
  color: var(--color-text);
  font-weight: var(--fw-semibold);
  text-align: right;
  overflow-wrap: anywhere;
}

/* License plate — Turkish yellow */
.plate {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 4px;
  background: #ffcb0a;
  color: #111;
  font-weight: var(--fw-bold);
  font-size: var(--fs-xs);
  letter-spacing: 0.06em;
  border: 1px solid #a07c00;
  font-family: var(--font-mono);
}

/* ------------------------------------------------------------
   Alerts
   ------------------------------------------------------------ */
.alert {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--fs-sm);
}

.alert__icon { flex-shrink: 0; margin-top: 2px; }
.alert__body { flex: 1; min-width: 0; }
.alert__title { font-weight: var(--fw-semibold); margin: 0 0 4px; font-size: var(--fs-sm); }
.alert__dismiss {
  margin-left: auto;
  color: inherit;
  opacity: 0.6;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.alert__dismiss:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }

.alert-success { background: var(--color-success-tint); border-color: transparent; color: var(--color-success); }
.alert-warning { background: var(--color-warning-tint); border-color: transparent; color: var(--color-warning); }
.alert-danger  { background: var(--color-danger-tint);  border-color: transparent; color: var(--color-danger); }
.alert-info    { background: var(--color-info-tint);    border-color: transparent; color: var(--color-info); }

.alert-success .alert__body,
.alert-warning .alert__body,
.alert-danger  .alert__body,
.alert-info    .alert__body { color: var(--color-text); }

/* ------------------------------------------------------------
   Tables (responsive — collapse to cards below md)
   ------------------------------------------------------------ */
.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-sm);
}

.table th,
.table td {
  padding: var(--sp-3) var(--sp-4);
  text-align: left;
  vertical-align: middle;
}

.table thead th {
  background: var(--color-surface-2);
  color: var(--color-muted);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-divider);
  white-space: nowrap;
}

.table tbody tr {
  border-top: 1px solid var(--color-divider);
  transition: background var(--dur-fast) var(--ease-standard);
}

.table tbody tr:first-child { border-top: 0; }
.table tbody tr:hover { background: var(--color-surface-2); }

.table__row-link {
  color: var(--color-text);
  font-weight: var(--fw-medium);
}

.table__row-link:hover { text-decoration: none; color: var(--color-primary); }

.table-responsive { overflow-x: auto; }

/* Card-list mode below md */
@media (max-width: 767.98px) {
  .table--stack { border: 0; }
  .table--stack thead { display: none; }
  .table--stack tbody,
  .table--stack tr,
  .table--stack td { display: block; width: 100%; }

  .table--stack tr {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: var(--sp-3);
    margin-bottom: var(--sp-3);
    background: var(--color-surface);
  }

  .table--stack tr:hover { background: var(--color-surface); }
  .table--stack tbody tr { border-top: 1px solid var(--color-border); }

  .table--stack td {
    padding: 6px 0;
    border: 0;
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    align-items: center;
  }

  .table--stack td::before {
    content: attr(data-label);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: var(--fw-semibold);
    color: var(--color-muted);
    flex-shrink: 0;
  }

  .table--stack td[data-label=""]::before { content: ""; }
}

/* ------------------------------------------------------------
   Tabs
   ------------------------------------------------------------ */
.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--color-divider);
  margin-bottom: var(--sp-4);
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 12px var(--sp-3);
  color: var(--color-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  border-bottom: 2px solid transparent;
  min-height: 44px;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard);
  cursor: pointer;
  background: transparent;
}

.tab:hover { color: var(--color-text); text-decoration: none; }

.tab-active,
.tab[aria-selected="true"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  font-weight: var(--fw-semibold);
}

/* Ensure the native [hidden] attribute always wins on tabpanels,
   even when the panel element also carries classes like .card that
   set their own `display`. */
[role="tabpanel"][hidden] { display: none !important; }

/* Money shown with a historical (captured-at-transaction-time) rate.
   Shows a muted EUR-equivalent inline; tooltip carries the rate. */
.money-hist small { font-weight: var(--fw-regular); margin-left: 4px; }
.money-hist[title]:hover { cursor: help; }

.tab__badge {
  font-size: 10.5px;
  background: var(--color-surface-3);
  color: var(--color-text-soft);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  font-weight: var(--fw-semibold);
}

/* ------------------------------------------------------------
   Chips (for filter pills, tags)
   ------------------------------------------------------------ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--color-surface);
  color: var(--color-text-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  cursor: pointer;
  min-height: 36px;
  transition: background var(--dur-fast) var(--ease-standard),
              border-color var(--dur-fast) var(--ease-standard),
              color var(--dur-fast) var(--ease-standard);
}

.chip:hover { background: var(--color-surface-2); }

.chip-active,
.chip[aria-pressed="true"] {
  background: var(--color-primary-tint);
  color: var(--color-primary);
  border-color: transparent;
}

.chip__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: var(--radius-pill);
  background: rgba(0, 0, 0, 0.06);
}

/* ------------------------------------------------------------
   Avatar
   ------------------------------------------------------------ */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary-tint);
  color: var(--color-primary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
  overflow: hidden;
  border: 1px solid var(--color-divider);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 56px; height: 56px; font-size: var(--fs-base); }
.avatar-xl { width: 72px; height: 72px; font-size: var(--fs-lg); }

/* ------------------------------------------------------------
   Progress & spinner
   ------------------------------------------------------------ */
.progress {
  width: 100%;
  height: 8px;
  background: var(--color-surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: inherit;
  transition: width var(--dur-normal) var(--ease-standard);
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border-strong);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ------------------------------------------------------------
   Skeleton
   ------------------------------------------------------------ */
.skeleton {
  display: block;
  background: var(--color-surface-2);
  border-radius: var(--radius-md);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.55) 50%,
    transparent 100%);
  animation: shimmer 1.4s infinite;
  transform: translateX(-100%);
}

[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.06) 50%,
    transparent 100%);
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

.skeleton-line { height: 12px; }
.skeleton-title { height: 24px; width: 60%; }
.skeleton-circle { border-radius: 50%; }

/* ------------------------------------------------------------
   Empty state
   ------------------------------------------------------------ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--sp-7) var(--sp-5);
  color: var(--color-muted);
  gap: var(--sp-3);
}

.empty-state__icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-2);
}

.empty-state__title {
  color: var(--color-text);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-lg);
  margin: 0;
}

.empty-state__description {
  max-width: 36ch;
  font-size: var(--fs-sm);
}

/* ------------------------------------------------------------
   Pagination
   ------------------------------------------------------------ */
.pagination {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.page-btn {
  min-width: 36px;
  min-height: 36px;
  padding: 0 10px;
  font-size: var(--fs-sm);
  color: var(--color-text-soft);
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--dur-fast) var(--ease-standard);
  border: 0;
  background: transparent;
  cursor: pointer;
}

.page-btn:hover { background: var(--color-surface-2); }
.page-btn:disabled { color: var(--color-muted); cursor: not-allowed; opacity: 0.5; }

.page-btn-active,
.page-btn[aria-current="page"] {
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-weight: var(--fw-semibold);
}

.page-btn-active:hover { background: var(--color-primary-hover); }

/* ------------------------------------------------------------
   Modal
   ------------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--sp-4);
  background: var(--color-overlay);
  animation: fadeIn var(--dur-normal) var(--ease-standard);
}

.modal.is-open { display: flex; }

.modal-dialog {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - var(--sp-6));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: popIn var(--dur-normal) var(--ease-standard);
}

.modal-dialog--lg { max-width: 720px; }
.modal-dialog--xl { max-width: 960px; }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--color-divider);
}

.modal-title {
  margin: 0;
  font-size: var(--fs-h5);
  font-weight: var(--fw-semibold);
}

.modal-body {
  padding: var(--sp-5);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--color-divider);
  background: var(--color-surface-2);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

/* ------------------------------------------------------------
   Drawer (right slide-out)
   ------------------------------------------------------------ */
.drawer {
  position: fixed;
  inset: 0;
  z-index: var(--z-drawer);
  display: none;
}

.drawer.is-open { display: block; }

.drawer__backdrop {
  position: absolute;
  inset: 0;
  background: var(--color-overlay);
  animation: fadeIn var(--dur-normal) var(--ease-standard);
}

.drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100vw);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  animation: slideInRight var(--dur-normal) var(--ease-standard);
}

.drawer__panel--left { right: auto; left: 0; animation-name: slideInLeft; }

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--color-divider);
}

.drawer__body {
  padding: var(--sp-5);
  overflow-y: auto;
  flex: 1;
}

/* ------------------------------------------------------------
   Dropdown / tooltip
   ------------------------------------------------------------ */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  padding: 6px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: var(--z-dropdown);
  display: none;
}

.dropdown.is-open > .dropdown-menu { display: block; }

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: 8px 12px;
  font-size: var(--fs-sm);
  color: var(--color-text);
  border-radius: var(--radius-sm);
  transition: background var(--dur-fast) var(--ease-standard);
  cursor: pointer;
  text-align: left;
  background: transparent;
}

.dropdown-item:hover { background: var(--color-surface-2); text-decoration: none; color: var(--color-text); }
.dropdown-item--danger { color: var(--color-danger); }
.dropdown-divider { height: 1px; background: var(--color-divider); margin: 4px 0; }

.tooltip {
  position: absolute;
  padding: 6px 10px;
  background: var(--color-text);
  color: var(--color-bg);
  font-size: var(--fs-xs);
  border-radius: var(--radius-sm);
  white-space: nowrap;
  pointer-events: none;
  box-shadow: var(--shadow-md);
  z-index: var(--z-tooltip);
}

/* ------------------------------------------------------------
   Timeline
   ------------------------------------------------------------ */
.timeline {
  position: relative;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--color-divider);
}

.timeline-item {
  position: relative;
  padding-bottom: var(--sp-5);
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-item__marker {
  position: absolute;
  left: -28px;
  top: 2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
}

.timeline-item--primary .timeline-item__marker { border-color: var(--color-primary); color: var(--color-primary); }
.timeline-item--success .timeline-item__marker { border-color: var(--color-success); color: var(--color-success); }
.timeline-item--warning .timeline-item__marker { border-color: var(--color-warning); color: var(--color-warning); }
.timeline-item--danger  .timeline-item__marker { border-color: var(--color-danger);  color: var(--color-danger); }

.timeline-item__header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  font-size: var(--fs-sm);
}

.timeline-item__actor { font-weight: var(--fw-semibold); color: var(--color-text); }
.timeline-item__date  { color: var(--color-muted); font-size: var(--fs-xs); }

.timeline-item__body {
  margin-top: 4px;
  font-size: var(--fs-sm);
  color: var(--color-text-soft);
}

/* ------------------------------------------------------------
   File dropzone
   ------------------------------------------------------------ */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6) var(--sp-4);
  border: 2px dashed var(--color-border-strong);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  text-align: center;
  color: var(--color-muted);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard),
              background var(--dur-fast) var(--ease-standard);
}

.dropzone:hover,
.dropzone.is-dragover {
  border-color: var(--color-primary);
  background: var(--color-primary-tint);
  color: var(--color-primary);
}

.dropzone__icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-3);
  box-shadow: var(--shadow-sm);
}

.dropzone__title { color: var(--color-text); font-weight: var(--fw-semibold); }
.dropzone__hint { margin-top: 4px; font-size: var(--fs-xs); }

/* ------------------------------------------------------------
   Vehicle selector (cascading selects with icons)
   ------------------------------------------------------------ */
.vehicle-select {
  display: grid;
  gap: var(--sp-3);
}

@media (min-width: 768px) {
  .vehicle-select { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .vehicle-select { grid-template-columns: repeat(3, 1fr); }
}

/* Option card (for radio groups with visuals, e.g. Stage list) */
.option-card {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-standard),
              background var(--dur-fast) var(--ease-standard);
}

.option-card:hover { border-color: var(--color-border-strong); }

.option-card input { margin-top: 2px; flex-shrink: 0; }

.option-card--active,
.option-card:has(input:checked) {
  border-color: var(--color-primary);
  background: var(--color-primary-tint);
}

.option-card__body { flex: 1; }
.option-card__title { font-weight: var(--fw-semibold); color: var(--color-text); }
.option-card__subtitle { font-size: var(--fs-xs); color: var(--color-muted); margin-top: 2px; }
.option-card__price { font-weight: var(--fw-semibold); color: var(--color-primary); }

/* ------------------------------------------------------------
   Product card (shop)
   ------------------------------------------------------------ */
.product {
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--dur-fast) var(--ease-standard),
              box-shadow var(--dur-fast) var(--ease-standard);
}

.product:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product__media {
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--color-surface-2), var(--color-surface-3));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  font-size: var(--fs-xs);
  position: relative;
  overflow: hidden;
}

.product__badge {
  position: absolute;
  top: 12px;
  left: 12px;
}

.product__body { padding: var(--sp-4); flex: 1; display: flex; flex-direction: column; gap: var(--sp-2); }
.product__category { font-size: var(--fs-xs); color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.product__title { margin: 0; font-size: var(--fs-h5); font-weight: var(--fw-semibold); color: var(--color-text); }
.product__price { font-size: var(--fs-h5); color: var(--color-primary); font-weight: var(--fw-bold); margin-top: auto; }

.product__actions { padding: 0 var(--sp-4) var(--sp-4); display: flex; gap: var(--sp-2); }

/* ------------------------------------------------------------
   Wizard steps header
   ------------------------------------------------------------ */
.wizard-steps {
  display: flex;
  gap: var(--sp-2);
  align-items: center;
  margin-bottom: var(--sp-5);
}

.wizard-step {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  color: var(--color-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  flex: 1;
  min-width: 0;
}

.wizard-step__num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
  border: 2px solid transparent;
}

.wizard-step__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-step.is-active .wizard-step__num {
  background: var(--color-primary);
  color: var(--color-on-primary);
}
.wizard-step.is-active { color: var(--color-text); }

.wizard-step.is-complete .wizard-step__num {
  background: var(--color-success);
  color: #fff;
}

.wizard-steps__divider {
  height: 2px;
  flex: 1;
  background: var(--color-divider);
  margin: 0 var(--sp-2);
  min-width: 16px;
  border-radius: var(--radius-pill);
}

@media (max-width: 639.98px) {
  .wizard-step__label { display: none; }
  .wizard-step { flex: 0 0 auto; }
  .wizard-steps__divider { flex: 1; }
}

/* ------------------------------------------------------------
   Wizard footer — running total + nav buttons on step 3.
   Sticks to the viewport bottom on narrow screens.
   ------------------------------------------------------------ */
.wizard-footer {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-top: var(--sp-5);
  padding: var(--sp-3) var(--sp-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.wizard-footer__total {
  flex: 1;
  text-align: center;
  font-size: var(--fs-lg);
}

@media (max-width: 639.98px) {
  .wizard-footer {
    position: sticky;
    bottom: 0;
    margin: var(--sp-4) calc(-1 * var(--sp-4)) 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06);
    z-index: var(--z-sticky, 10);
  }
  .wizard-footer__total {
    font-size: var(--fs-base);
  }
}

/* ------------------------------------------------------------
   Admin panel — small additions on top of the shared shell
   ------------------------------------------------------------ */
.app--admin .topbar { border-bottom-color: var(--color-primary-tint); }
.topbar__brand-mark--admin { background: var(--color-text); color: var(--color-surface); }
.sidebar--admin .sidebar__section-title { color: var(--color-primary); }

.admin-user-chip {
  display: none;
  align-items: center;
  gap: var(--sp-2);
  padding: 4px 10px 4px 4px;
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
}
.admin-user-chip__name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 768px) { .admin-user-chip { display: inline-flex; } }

.hidden-md-down { display: none; }
@media (min-width: 768px) { .hidden-md-down { display: inline-flex; } }

.admin-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.admin-filters .form-group { margin: 0; }
.admin-filters__actions {
  display: flex;
  gap: var(--sp-2);
  align-items: flex-end;
}

.admin-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-surface-2);
  display: inline-block;
  vertical-align: middle;
}
.admin-thumb--sm { width: 28px; height: 28px; }

.admin-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--sp-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}
.admin-stat__label { font-size: var(--fs-xs); color: var(--color-text-soft); text-transform: uppercase; letter-spacing: 0.06em; }
.admin-stat__value { font-size: var(--fs-2xl); font-weight: var(--fw-bold); color: var(--color-text); }
.admin-stat__hint { font-size: var(--fs-xs); color: var(--color-muted); }

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--sp-4);
}

.admin-actions {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.admin-actions .btn-sm { min-height: 32px; padding: 6px 10px; }

/* Inline danger confirm form button */
.inline-form { display: inline; }

/* ------------------------------------------------------------
   Animations
   ------------------------------------------------------------ */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn   { from { opacity: 0; transform: scale(0.97) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes slideInRight { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes slideInLeft  { from { transform: translateX(-100%); } to { transform: translateX(0); } }

/* ------------------------------------------------------------
 *  CMS — Web Sitesi admin additions
 * ------------------------------------------------------------ */
.translation-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--color-bg-muted, #eef);
    color: var(--color-text, #334);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.05em;
}
[data-theme="dark"] .translation-badge {
    background: rgba(255,255,255,0.08);
    color: var(--color-text, #ddd);
}

/* Media library grid */
.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--sp-3, 12px);
}
.media-item {
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    background: var(--color-surface, #fff);
    display: flex;
    flex-direction: column;
    transition: box-shadow .15s ease;
}
.media-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.media-item__thumb {
    aspect-ratio: 4 / 3;
    background: var(--color-bg-muted, #f5f5f7);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.media-item__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.media-item__meta {
    padding: var(--sp-2, 8px);
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-size: 12px;
}
.media-item__name {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.media-item__size { color: var(--color-muted, #888); }
.media-item__actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    flex-wrap: wrap;
}

/* Quill editor — theme tokens + dark mode */
.quill-wrap { border-radius: var(--radius-md, 8px); }
.quill-surface { background: var(--color-surface, #fff); border-radius: 0 0 var(--radius-md, 8px) var(--radius-md, 8px); }
.ql-toolbar.ql-snow { border-color: var(--color-border, #e5e7eb) !important; border-top-left-radius: var(--radius-md, 8px); border-top-right-radius: var(--radius-md, 8px); }
.ql-container.ql-snow { border-color: var(--color-border, #e5e7eb) !important; min-height: 240px; border-bottom-left-radius: var(--radius-md, 8px); border-bottom-right-radius: var(--radius-md, 8px); }
.ql-editor { color: var(--color-text, #111); font-size: 14px; line-height: 1.6; min-height: 240px; }
.ql-editor p, .ql-editor li { margin-bottom: 0.6em; }
[data-theme="dark"] .ql-toolbar.ql-snow { background: var(--color-surface, #1f2937); }
[data-theme="dark"] .ql-toolbar.ql-snow .ql-stroke { stroke: var(--color-text, #ddd); }
[data-theme="dark"] .ql-toolbar.ql-snow .ql-fill { fill: var(--color-text, #ddd); }
[data-theme="dark"] .ql-toolbar.ql-snow .ql-picker-label { color: var(--color-text, #ddd); }
[data-theme="dark"] .quill-surface, [data-theme="dark"] .ql-container.ql-snow { background: var(--color-surface, #111827); }
[data-theme="dark"] .ql-editor { color: var(--color-text, #e5e7eb); }
[data-theme="dark"] .ql-editor.ql-blank::before { color: var(--color-muted, #888); }

/* KVKK consent checkbox (Agent G will use on forms) */
.kvkk-consent {
    display: flex;
    gap: var(--sp-2, 8px);
    align-items: flex-start;
    font-size: 13px;
    color: var(--color-muted, #666);
}
.kvkk-consent input[type="checkbox"] { margin-top: 3px; }
