:root {
  --bg: #F3F1F6;
  --surface: #FFFFFF;
  --ink: #1E1A24;
  --muted: #716B7A;
  --line: #E4E0EA;
  --plum: #4A2858;
  --plum-2: #6A3F7A;
  --plum-soft: #EFE6F3;
  --gold: #B8862E;
  --gold-soft: #FBF3E2;
  --green: #1F8A66;
  --green-soft: #E3F4ED;
  --red: #C43A3A;
  --red-soft: #FBE7E7;
  --blue: #2F5FA6;
  --blue-soft: #E6EEF9;
  --on-plum: #FFFFFF;
  --on-gold: #1E1A24;
  --r-sm: 8px;
  --r: 14px;
  --r-lg: 22px;
  --nav-h: 64px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink);
  font-size: 15px; line-height: 1.45; min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom);
}
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
a { color: var(--plum-2); }
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; }
[hidden] { display: none !important; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: 100dvh; }
.sidebar { display: none; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; background: var(--plum); color: var(--on-plum);
  padding: calc(12px + env(safe-area-inset-top)) 18px 12px; display: flex; align-items: baseline; justify-content: space-between;
}
.topbar-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.topbar-date { font-size: 13px; opacity: .8; }
.view { padding: 16px 16px calc(var(--nav-h) + 90px); max-width: 980px; width: 100%; margin: 0 auto; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.bottomnav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 8px 0;
}
.bottomnav a svg { width: 22px; height: 22px; }
.bottomnav a.active { color: var(--plum); }

@media (min-width: 900px) {
  .shell { }
  .sidebar {
    display: flex; flex-direction: column; width: 240px; background: var(--plum); color: var(--on-plum);
    position: sticky; top: 0; height: 100dvh; padding: 22px 16px;
  }
  .sidebar-brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; padding: 0 8px 22px; }
  .sidebar-brand .mark { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 18px; }
  .sidenav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
  .sidenav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; color: rgba(255,255,255,.78); text-decoration: none; font-weight: 600; font-size: 14px; }
  .sidenav a svg { width: 20px; height: 20px; }
  .sidenav a.active { background: rgba(255,255,255,.14); color: #fff; }
  .sidebar-user { border-top: 1px solid rgba(255,255,255,.14); padding-top: 14px; font-size: 13px; display: flex; flex-direction: column; gap: 2px; }
  .sidebar-user span { opacity: .7; }
  .sidebar-user a { color: #fff; opacity: .8; margin-top: 6px; }
  .bottomnav { display: none; }
  .topbar { background: transparent; color: var(--ink); padding: 22px 28px 0; position: static; }
  .topbar-date { color: var(--muted); }
  .view { padding: 18px 28px 80px; }
  .fab-mic { bottom: 28px; right: 28px; }
}

/* ---------- Cards / lists ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.stat { background: var(--surface); border-radius: var(--r); padding: 14px 16px; border: 1px solid var(--line); }
.stat .lbl { font-size: 12px; color: var(--muted); font-weight: 600; }
.stat .val { font-size: 22px; font-weight: 800; margin-top: 2px; letter-spacing: -0.02em; }
.stat.hero { grid-column: 1 / -1; background: var(--plum); color: var(--on-plum); border: 0; }
.stat.hero .lbl { color: rgba(255,255,255,.75); }
.stat.hero .val { font-size: 30px; }
.stat.gold .val { color: var(--gold); }
.stat.green .val { color: var(--green); }
@media (min-width: 900px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } .stat.hero { grid-column: span 2; } }

.section { margin-bottom: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.section-head h2 { font-size: 16px; font-weight: 800; }
.section-head .link { font-size: 13px; font-weight: 600; background: none; border: 0; color: var(--plum-2); padding: 4px 0; cursor: pointer; }

.list { background: var(--surface); border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row:last-child { border-bottom: 0; }
.row:active { background: var(--plum-soft); }
.row .main { flex: 1; min-width: 0; }
.row .title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .end { text-align: right; flex-shrink: 0; }
.row .time { font-weight: 800; font-size: 15px; width: 52px; flex-shrink: 0; color: var(--plum); }
.row.done .time { color: var(--green); }
.row.cancelled .title { text-decoration: line-through; color: var(--muted); }
.money { font-weight: 800; letter-spacing: -0.01em; }
.money.pos { color: var(--red); }
.money.neg { color: var(--green); }
.money.zero { color: var(--muted); }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--plum-soft); color: var(--plum); font-weight: 800; display: grid; place-items: center; font-size: 14px; flex-shrink: 0; }

.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.pill-bekliyor { background: var(--blue-soft); color: var(--blue); }
.pill-tamamlandi { background: var(--green-soft); color: var(--green); }
.pill-iptal { background: var(--red-soft); color: var(--red); }
.pill-gelmedi { background: var(--gold-soft); color: var(--gold); }
.pill-odeme { background: var(--green-soft); color: var(--green); }
.pill-borc { background: var(--red-soft); color: var(--red); }

.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 14px; }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; font-size: 15px; }

/* ---------- Week strip ---------- */
.datebar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.datebar .nav-btn { width: 38px; height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; cursor: pointer; color: var(--ink); }
.datebar input[type=date] { flex: 1; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 10px; font-size: 15px; font-weight: 600; min-width: 0; }
.datebar .today-btn { border: 0; background: var(--plum-soft); color: var(--plum); font-weight: 700; border-radius: 10px; padding: 0 12px; height: 38px; cursor: pointer; }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 14px; }
.week button { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 8px 2px 6px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--ink); }
.week button .d { font-size: 11px; color: var(--muted); font-weight: 600; }
.week button .n { font-size: 17px; font-weight: 800; }
.week button .c { font-size: 10px; min-height: 14px; color: var(--muted); font-weight: 700; }
.week button.sel { background: var(--plum); color: var(--on-plum); border-color: var(--plum); }
.week button.sel .d, .week button.sel .c { color: rgba(255,255,255,.8); }
.week button.today:not(.sel) { border-color: var(--plum-2); }

/* ---------- WhatsApp ---------- */
.wa-btn { flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--green-soft); color: var(--green); display: grid; place-items: center; cursor: pointer; margin-left: 2px; }
.wa-btn:disabled { opacity: .35; cursor: default; }
.wa-btn:not(:disabled):hover { background: var(--green); color: #fff; }
.btn-wa { background: #25D366; color: #fff; }
.btn-wa:disabled { background: var(--line); color: var(--muted); }

/* ---------- Buttons ---------- */
.btn { border: 0; border-radius: 12px; padding: 12px 18px; font-weight: 700; font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--plum); color: var(--on-plum); }
.btn-ghost { background: var(--plum-soft); color: var(--plum); }
.btn-green { background: var(--green); color: #fff; }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; border-radius: 9px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }
.icon-btn { background: none; border: 0; width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--plum-soft); color: var(--plum); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; background: #fff; color: var(--ink); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--plum-2); outline-offset: 0; border-color: transparent; }
.field textarea { min-height: 70px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field.check { flex-direction: row; align-items: center; gap: 10px; }
.field.check input { width: 20px; height: 20px; }
.form-error { background: var(--red-soft); color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-bottom: 12px; font-weight: 600; }
.notice { border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; margin-bottom: 14px; }
.notice-red { background: var(--red-soft); color: var(--red); }
.notice-gold { background: var(--gold-soft); color: var(--gold); }
.notice-green { background: var(--green-soft); color: var(--green); }
.search { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; margin-bottom: 12px; background: #fff; }
.suggest { position: relative; }
.suggest-list { position: absolute; left: 0; right: 0; top: 100%; z-index: 5; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(30,26,36,.12); max-height: 220px; overflow: auto; }
.suggest-list div { padding: 10px 12px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--line); }
.suggest-list div:last-child { border-bottom: 0; }
.suggest-list div:hover { background: var(--plum-soft); }
.suggest-list small { color: var(--muted); margin-left: 6px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); }
.chip.miss { background: var(--gold-soft); color: var(--gold); }

/* ---------- Sheet (bottom sheet mobile / dialog desktop) ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(30,26,36,.45); z-index: 40; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 92dvh; overflow: auto;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
  animation: up .22s ease-out;
}
.sheet::before { content: ''; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sheet-head h2 { font-size: 18px; font-weight: 800; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 900px) {
  .sheet { left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%, -50%); width: 520px; border-radius: var(--r-lg); padding: 22px 26px; animation: none; }
  .sheet::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

.detail-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.detail-head .avatar { width: 48px; height: 48px; font-size: 17px; }
.detail-head h2 { font-size: 19px; }
.detail-head .sub { color: var(--muted); font-size: 13px; }
.balance-box { display: flex; align-items: center; justify-content: space-between; background: var(--bg); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.balance-box .lbl { font-size: 13px; color: var(--muted); font-weight: 600; }
.balance-box .money { font-size: 20px; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.tabs button { flex: 1; border: 0; background: var(--bg); border-radius: 10px; padding: 9px; font-weight: 700; color: var(--muted); cursor: pointer; font-size: 13px; }
.tabs button.active { background: var(--plum); color: var(--on-plum); }

/* ---------- Mic FAB ---------- */
.fab-mic {
  position: fixed; right: 18px; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); z-index: 35;
  width: 62px; height: 62px; border-radius: 50%; border: 0; background: var(--plum); color: var(--on-plum);
  box-shadow: 0 10px 24px rgba(74,40,88,.35); cursor: pointer; display: grid; place-items: center;
}
.fab-mic:active { transform: scale(.96); }
.voice-panel { text-align: center; padding: 10px 0 4px; }
.voice-orb {
  width: 96px; height: 96px; border-radius: 50%; margin: 6px auto 16px; display: grid; place-items: center;
  background: var(--plum); color: var(--on-plum); position: relative;
}
.voice-orb.listening::after {
  content: ''; position: absolute; inset: -10px; border-radius: 50%; border: 3px solid var(--plum-2);
  animation: pulse 1.2s ease-out infinite;
}
@keyframes pulse { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .voice-orb.listening::after { animation: none; opacity: .5; } }
.voice-status { font-weight: 700; margin-bottom: 6px; }
.voice-text { min-height: 44px; color: var(--muted); font-size: 15px; padding: 0 8px; }
.voice-hint { font-size: 13px; color: var(--muted); margin: 14px 0 6px; line-height: 1.5; }
.voice-hint code { background: var(--bg); padding: 2px 6px; border-radius: 6px; font-family: inherit; font-weight: 600; color: var(--ink); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 14px; max-width: calc(100% - 32px); text-align: center; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }
@media (min-width: 900px) { .toast { bottom: 28px; } }

/* ---------- Settings ---------- */
.settings-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin-bottom: 14px; }
.settings-card h2 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }

/* ---------- Login ---------- */
.login-body { background: var(--plum); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-wrap { width: 100%; max-width: 380px; }
.login-brand { text-align: center; color: var(--on-plum); margin-bottom: 22px; }
.login-mark { width: 60px; height: 60px; border-radius: 18px; background: rgba(255,255,255,.14); display: grid; place-items: center; font-size: 28px; margin: 0 auto 12px; }
.login-brand h1 { font-size: 26px; font-weight: 800; }
.login-brand p { margin: 4px 0 0; opacity: .75; }
.login-card { background: #fff; border-radius: var(--r-lg); padding: 22px; }
.login-card .notice { margin-bottom: 0; }
.login-card .btn-ghost { margin-top: 12px; }

/* ---------- Super admin ---------- */
.sa-body { background: #15101A; color: #fff; }
.sa-body .login-card { background: #221A29; color: #fff; }
.sa-body .field input, .sa-body .field select { background: #15101A; color: #fff; border-color: #3A2E45; }
.sa-body .field > span { color: #A89BB5; }
.sa-wrap { max-width: 860px; margin: 0 auto; padding: 24px 16px 60px; }
.sa-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.sa-top h1 { font-size: 20px; font-weight: 800; }
.sa-top a { color: #C9B8D8; font-size: 14px; }
.sa-card { background: #221A29; border: 1px solid #3A2E45; border-radius: var(--r); padding: 18px; margin-bottom: 14px; }
.sa-card h2 { font-size: 16px; font-weight: 800; margin-bottom: 12px; }
.sa-card .row { border-color: #3A2E45; cursor: default; }
.sa-card .row .sub { color: #A89BB5; }
.sa-card .list { background: transparent; border-color: #3A2E45; }
.sa-card .stat { background: #15101A; border-color: #3A2E45; }
.sa-card .stat .lbl { color: #A89BB5; }
.sa-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; letter-spacing: .08em; background: #15101A; border-radius: 10px; padding: 12px 14px; margin-bottom: 12px; word-break: break-all; }
.sa-status { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.sa-status.on { background: var(--green-soft); color: var(--green); }
.sa-status.off { background: var(--red-soft); color: var(--red); }

/* ---------- Online rozeti, tema ayarları ---------- */
.pill-online { background: var(--plum-soft); color: var(--plum); }
.day-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px; padding: 6px 10px; font-size: 13px; font-weight: 600; cursor: pointer; background: #fff; flex: 0 0 auto; }
.day-chip input { width: 16px; height: 16px; margin: 0; }
.day-chip:has(input:checked) { background: var(--red-soft); border-color: var(--red); color: var(--red); }
.theme-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
@media (min-width: 640px) { .theme-grid { grid-template-columns: 1fr 1fr; } }
.theme-box { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.color-row { display: flex; align-items: center; justify-content: space-between; font-size: 14px; }
.color-row input[type=color] { width: 56px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: #fff; cursor: pointer; }
.theme-preview { --p: var(--plum); --a: var(--gold); display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.theme-preview .tp-bar { flex: 1; height: 28px; border-radius: 8px; background: var(--p); }
.theme-preview .tp-chip { width: 48px; height: 28px; border-radius: 8px; background: var(--a); }
.palettes { display: flex; flex-wrap: wrap; gap: 8px; }
.palette { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; width: 56px; height: 30px; padding: 0; cursor: pointer; background: none; }
.palette i { flex: 1; display: block; }
.palette:hover { outline: 2px solid var(--plum-2); }

/* ---------- Randevu hatırlatma popup ---------- */
.remind-pop { position: fixed; left: 50%; top: calc(14px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 70; width: min(440px, calc(100% - 24px));
  background: var(--surface); border-radius: 18px; box-shadow: 0 18px 48px rgba(30,26,36,.28); border: 2px solid var(--gold); padding: 14px 16px; animation: drop .3s ease-out; }
@keyframes drop { from { transform: translate(-50%, -24px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .remind-pop { animation: none; } }
.remind-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.remind-head .bell { width: 38px; height: 38px; border-radius: 50%; background: var(--gold-soft); color: var(--gold); display: grid; place-items: center; font-size: 20px; flex-shrink: 0; animation: ring 1s ease-in-out 3; }
@keyframes ring { 0%,100% { transform: rotate(0); } 25% { transform: rotate(-14deg); } 75% { transform: rotate(14deg); } }
.remind-head strong { font-size: 15px; display: block; }
.remind-head span { font-size: 13px; color: var(--muted); }
.remind-body { background: var(--bg); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.remind-body .n { font-weight: 800; font-size: 17px; }
.remind-body .s { font-size: 13px; color: var(--muted); }
.remind-count { font-size: 12px; color: var(--muted); text-align: center; margin-top: 8px; }
.remind-pop .btn-row .btn { flex: 1; padding: 10px 8px; font-size: 13px; }
