:root {
  --bg: #14120f;
  --bg-elevated: #1e1a15;
  --bg-card: #211d17;
  --border: #34302a;
  --text: #f2ede2;
  --text-muted: #a89f8f;
  --accent: #d6362c;
  --accent-soft: rgba(214, 54, 44, 0.16);
  --planlandi: #e8b93f;
  --tamamlandi: #3fa34d;
  --iptal: #c0392b;
  --radius: 14px;
  --radius-sm: 9px;
  --font-display: 'Bebas Neue', sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

body {
  background-image:
    radial-gradient(circle at 15% 0%, rgba(214, 54, 44, 0.08), transparent 45%),
    radial-gradient(circle at 85% 100%, rgba(214, 54, 44, 0.05), transparent 40%);
  background-attachment: fixed;
}

.hidden { display: none !important; }

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

::selection { background: var(--accent-soft); color: var(--text); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Giriş ekranı ---------- */

#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-mark.small {
  width: 26px;
  height: 26px;
  font-size: 12px;
  border-radius: 6px;
  margin-right: 8px;
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 0.5px;
  margin: 0;
  line-height: 1;
}

.brand-sub {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 13px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field span {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.field input,
.field select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  font-size: 15px;
  width: 100%;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
}

.field-row {
  display: flex;
  gap: 12px;
}
.field-row .field { flex: 1; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
}
.btn-primary:active { transform: scale(0.98); }

.btn-block { width: 100%; }

.error {
  color: var(--iptal);
  background: rgba(192, 57, 43, 0.12);
  border: 1px solid rgba(192, 57, 43, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  margin: 12px 0 0;
  word-break: break-word;
}

.error a { color: inherit; text-decoration: underline; }

/* ---------- Uygulama kabuğu ---------- */

#app-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 90px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}

.topbar-brand {
  font-family: var(--font-display);
  font-size: 19px;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: 13px;
}

.range-nav {
  padding: 14px 18px 6px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.range-nav-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-label {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
}

.btn-icon {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 18px;
  flex-shrink: 0;
}

.btn-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 500;
}

.select-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  margin-left: auto;
}

/* ---------- Randevu listesi ---------- */

.appt-list {
  padding: 14px 18px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}

@media (min-width: 720px) {
  #app-screen { max-width: 900px; margin: 0 auto; width: 100%; }
  .topbar, .range-nav { max-width: 900px; margin: 0 auto; width: 100%; }
  .appt-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    align-content: start;
  }
  .empty { grid-column: 1 / -1; }
}

.empty {
  color: var(--text-muted);
  text-align: center;
  padding: 60px 20px;
  font-size: 14.5px;
}

.appt-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--planlandi);
  border-radius: var(--radius-sm);
  padding: 14px 15px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: transform 0.1s ease;
}

.appt-card:active { transform: scale(0.99); }

.appt-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.appt-date {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}

.appt-status {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  letter-spacing: 0.2px;
}

.appt-customer {
  font-size: 16px;
  font-weight: 600;
}

.appt-meta {
  font-size: 13.5px;
  color: var(--text-muted);
}

.appt-money {
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 13.5px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.appt-money .muted { color: var(--text-muted); }
.appt-money .kalan { color: var(--iptal); font-weight: 600; }

/* ---------- FAB ---------- */

.fab {
  position: fixed;
  right: 20px;
  bottom: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 30px;
  line-height: 1;
  box-shadow: 0 8px 24px rgba(214, 54, 44, 0.4);
  z-index: 6;
}
.fab:active { transform: scale(0.94); }

/* ---------- Modal ---------- */

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.modal-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-elevated);
  border-radius: 20px 20px 0 0;
  padding: 10px 22px 28px;
  border-top: 1px solid var(--border);
}

@media (min-width: 640px) {
  .modal-sheet {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 420px;
    max-height: 85vh;
    border-radius: var(--radius);
    border: 1px solid var(--border);
  }
}

.modal-handle {
  width: 40px;
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  margin: 10px auto 16px;
}
@media (min-width: 640px) { .modal-handle { display: none; } }

.modal-sheet h2 {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.3px;
  margin: 0 0 18px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary,
.modal-actions .btn-danger {
  flex: 1;
  border-radius: var(--radius-sm);
  padding: 13px 10px;
  font-size: 14.5px;
  font-weight: 600;
  border: none;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border) !important;
}

.btn-danger {
  background: transparent;
  color: var(--iptal);
  border: 1px solid rgba(192, 57, 43, 0.4) !important;
  flex: 0 0 auto !important;
}

/* ---------- Erişilebilirlik: azaltılmış hareket ---------- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ---------- Sekme çubuğu ---------- */

.tabbar {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 61px;
  background: var(--bg);
  z-index: 4;
  overflow-x: auto;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
}

.tab-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.tab-page.hidden { display: none; }

/* ---------- Sayfa araç çubuğu / arama ---------- */

.page-toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 16px 18px 8px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 160px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
}

.hint-text {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
  flex: 1;
  min-width: 200px;
}

.section-title {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.3px;
  margin: 22px 18px 8px;
  font-weight: normal;
}

/* ---------- Basit liste (Müşteriler / Sanatçılar / Kazanç / Alacaklar) ---------- */

.simple-list {
  padding: 6px 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 720px) {
  .simple-list { padding-left: calc((100% - 900px) / 2 + 18px); padding-right: calc((100% - 900px) / 2 + 18px); }
  .simple-list.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

.row-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 13px 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.row-card .row-main { flex: 1; min-width: 0; }
.row-card .row-title { font-weight: 600; font-size: 15px; }
.row-card .row-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.row-card .row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.row-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  padding: 7px 11px;
  font-size: 12.5px;
}
.row-btn.danger { color: var(--iptal); border-color: rgba(192, 57, 43, 0.4); }

/* ---------- Özet kartı (Kazanç / Müşteri Kartı) ---------- */

.summary-card {
  margin: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
  font-size: 14px;
  line-height: 1.9;
  font-family: var(--font-mono);
}

@media (min-width: 720px) {
  .summary-card { max-width: 900px; margin-left: auto; margin-right: auto; }
}

.summary-card b { font-weight: 700; }

/* ---------- Geniş modal (Müşteri Kartı) ---------- */

.modal-sheet-wide { max-height: 92vh; }
@media (min-width: 640px) {
  .modal-sheet-wide { width: 560px; }
}

.card-history-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--planlandi);
  border-radius: var(--radius-sm);
  padding: 10px 13px;
  font-size: 13px;
}
.card-history-row .chr-top { display: flex; justify-content: space-between; color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }
.card-history-row .chr-main { margin-top: 3px; }

/* ---------- Topbar aksiyonları ---------- */
.topbar-actions { display: flex; gap: 8px; }

/* ---------- İğne ekleme (randevu formu) ---------- */
.needle-add-row { display: flex; gap: 6px; margin-top: 4px; }
.needle-add-row select { flex: 2; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 10px; font-size: 13.5px; }
.needle-add-row input { flex: 1; min-width: 0; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); padding: 10px; font-size: 13.5px; }
.needle-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; }
.needle-list .needle-row { display: flex; justify-content: space-between; align-items: center; background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.needle-list .needle-row button { background: transparent; border: 1px solid rgba(192,57,43,0.4); color: var(--iptal); border-radius: 6px; padding: 4px 9px; font-size: 12px; }
.needle-empty { color: var(--text-muted); font-size: 12.5px; }

/* ---------- Seans satırları ---------- */
.session-rows { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.session-row { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px; }
.session-row .sr-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.session-row .sr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.session-row input, .session-row select { background: var(--bg); border: 1px solid var(--border); color: var(--text); border-radius: 7px; padding: 7px 9px; font-size: 12.5px; width: 100%; }
.session-row .sr-needle-row { display: flex; gap: 6px; margin-top: 6px; grid-column: 1 / -1; }

/* ---------- Ayarlar ---------- */
.settings-actions { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }

/* ---------- Aylık Kırılım Tablosu ---------- */
.table-scroll { overflow-x: auto; margin: 10px 0; }
.breakdown-table { border-collapse: collapse; width: 100%; font-size: 12.5px; font-family: var(--font-mono); }
.breakdown-table th, .breakdown-table td { padding: 7px 9px; text-align: center; border-bottom: 1px solid var(--border); white-space: nowrap; }
.breakdown-table th { color: var(--text-muted); font-weight: 600; }
.breakdown-table td:first-child, .breakdown-table th:first-child { text-align: left; font-family: var(--font-body); font-weight: 600; }
.breakdown-table tr.total-row { background: var(--bg-card); font-weight: 700; }

