:root {
  --bg: #faf6f3;
  --panel: #ffffff;
  --ink: #2b2226;
  --ink-2: #6f6267;
  --ink-3: #a3969b;
  --line: #eee4df;
  --soft: #f5ece8;
  --accent: #9c4a5f;
  --accent-ink: #7d3649;
  --accent-soft: #f6e4e8;
  --gold: #b8874b;
  --ok: #3f7d5c;
  --ok-soft: #e4f1e9;
  --warn: #b07418;
  --warn-soft: #fbefd9;
  --bad: #b2433b;
  --bad-soft: #f8e1de;
  --info: #496e9c;
  --info-soft: #e3ebf5;
  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 1px 2px rgba(60, 30, 40, .04), 0 6px 24px -12px rgba(60, 30, 40, .12);
  --display: "Fraunces", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--sans); font-size: 14.5px; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 500; letter-spacing: -.01em; margin: 0; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }

/* Buttons & inputs */
.btn { font: 600 13.5px var(--sans); border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 9px 14px; border-radius: 999px; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: #dccfc9; background: #fffdfc; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--soft); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.block { width: 100%; justify-content: center; padding: 12px; }
.icon-btn { border: 0; background: transparent; font-size: 18px; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { background: var(--soft); }
input, select, textarea { font: 500 14px var(--sans); color: var(--ink); width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 70px; }
input[type=color] { padding: 3px; height: 40px; }
input[type=checkbox] { width: auto; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { color: var(--bad); font-size: 13px; min-height: 18px; margin: 4px 0; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; align-items: center; }
.form-actions .spacer { flex: 1; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 13.5px; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 50% -10%, #f3dfe3, transparent), var(--bg); }
.login-card { width: 100%; max-width: 360px; background: var(--panel); padding: 34px 30px 28px; border-radius: 22px; box-shadow: var(--shadow); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { font-size: 28px; }
.login-card p { margin: -6px 0 6px; }
.brand-mark { width: 44px; height: 44px; border-radius: 13px; background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M10 21c3-8 9-10 12-10-1 4-4 10-12 10z' fill='%23fff'/%3E%3C/svg%3E") center/70% no-repeat; flex: none; }
.brand-mark.sm { width: 36px; height: 36px; border-radius: 11px; }

/* Shell */
.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 22px 14px; border-right: 1px solid var(--line); background: #fdfaf8; display: flex; flex-direction: column; gap: 22px; }
.side-brand { display: flex; gap: 11px; align-items: center; padding: 0 8px; }
.side-brand strong { display: block; font-family: var(--display); font-weight: 600; font-size: 16px; line-height: 1.2; }
.side-brand small { color: var(--ink-3); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px; color: var(--ink-2); font-weight: 600; }
.nav a svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a.on { background: var(--accent-soft); color: var(--accent-ink); }
.nav-sep { margin: 16px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.side-out { justify-content: flex-start; }
.main { min-width: 0; }
.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 18px 32px; background: rgba(250, 246, 243, .9); backdrop-filter: blur(10px); border-bottom: 1px solid transparent; }
.top h2 { font-size: 26px; flex: 1; }
.top-actions { display: flex; gap: 8px; }
.menu-btn { display: none; }
.view { padding: 8px 32px 48px; max-width: 1320px; }
.scrim { display: none; }

/* Cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 10px; }
.card-h h3 { font-size: 17px; }
.card-b { padding: 6px 18px 18px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: 1.6fr 1fr; }
.g-2e { grid-template-columns: 1fr 1fr; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.kpi { padding: 16px 18px; }
.kpi span { color: var(--ink-2); font-size: 12.5px; font-weight: 600; }
.kpi b { display: block; font-family: var(--display); font-weight: 500; font-size: 28px; margin-top: 6px; letter-spacing: -.02em; }
.kpi small { color: var(--ink-3); font-size: 12px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.toolbar input[type=search] { max-width: 340px; }
.toolbar input[type=date] { width: auto; }
.seg { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: transparent; font: 600 12.5px var(--sans); padding: 6px 12px; border-radius: 999px; cursor: pointer; color: var(--ink-2); }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }

/* Tables & lists */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: #fdf9f7; }
.table .r { text-align: right; }
.table-wrap { overflow-x: auto; }
.list { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row .t { font-variant-numeric: tabular-nums; font-weight: 700; width: 48px; flex: none; }
.row .grow { flex: 1; min-width: 0; }
.row .grow b { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .grow small { color: var(--ink-2); }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.empty { padding: 28px 10px; text-align: center; color: var(--ink-3); }
.empty b { display: block; color: var(--ink-2); font-family: var(--display); font-weight: 500; font-size: 17px; margin-bottom: 4px; }

.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--ink-2); white-space: nowrap; }
.chip.bekliyor { background: var(--warn-soft); color: var(--warn); }
.chip.onaylandi { background: var(--info-soft); color: var(--info); }
.chip.tamamlandi { background: var(--ok-soft); color: var(--ok); }
.chip.iptal { background: #efeaea; color: #8a7f80; text-decoration: line-through; }
.chip.gelmedi { background: var(--bad-soft); color: var(--bad); }
.chip.gelir { background: var(--ok-soft); color: var(--ok); }
.chip.gider { background: var(--bad-soft); color: var(--bad); }
.pos { color: var(--ok); }
.neg { color: var(--bad); }

/* Bars */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; min-width: 0; }
.bars .b i { display: block; width: 100%; max-width: 30px; background: var(--accent-soft); border-radius: 6px 6px 3px 3px; min-height: 3px; transition: background .15s; }
.bars .b.today i { background: var(--accent); }
.bars .b:hover i { background: var(--accent); }
.bars .b small { font-size: 10.5px; color: var(--ink-3); }
.hbar { display: grid; grid-template-columns: minmax(90px, 1.1fr) 2fr auto; gap: 12px; align-items: center; padding: 8px 0; }
.hbar .track { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
.hbar .track i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.hbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }

/* Calendar */
.cal { overflow: auto; max-height: calc(100vh - 210px); }
.cal-grid { display: grid; position: relative; min-width: 100%; }
.cal-head { position: sticky; top: 0; z-index: 3; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 8px; font-weight: 700; display: flex; gap: 8px; align-items: center; justify-content: center; font-size: 13px; }
.cal-head.corner { left: 0; z-index: 4; }
.cal-times { position: sticky; left: 0; z-index: 2; background: #fff; border-right: 1px solid var(--line); }
.cal-times div { font-size: 11.5px; color: var(--ink-3); text-align: right; padding: 0 8px; transform: translateY(-7px); font-variant-numeric: tabular-nums; }
.cal-col { position: relative; border-right: 1px solid var(--line); }
.cal-col:last-child { border-right: 0; }
.cal-slot { border-bottom: 1px dashed #f1e9e5; cursor: pointer; }
.cal-slot.hour { border-bottom: 1px solid var(--line); }
.cal-slot:hover { background: #fcf5f3; }
.appt { position: absolute; left: 4px; right: 4px; border-radius: 9px; padding: 5px 8px; font-size: 12px; line-height: 1.3; overflow: hidden; cursor: pointer; border-left: 3px solid var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 12%, #fff); box-shadow: 0 1px 2px rgba(0, 0, 0, .05); transition: transform .1s; }
.appt:hover { transform: translateY(-1px); box-shadow: 0 4px 10px -4px rgba(0, 0, 0, .18); z-index: 1; }
.appt b { display: block; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt small { color: var(--ink-2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appt.tamamlandi { opacity: .72; }
.appt.iptal, .appt.gelmedi { opacity: .45; text-decoration: line-through; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--bad); z-index: 2; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }

/* Customer detail */
.profile { display: flex; gap: 16px; align-items: center; padding: 20px; }
.avatar { width: 56px; height: 56px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-family: var(--display); font-size: 22px; flex: none; }
.profile h3 { font-size: 24px; }
.profile .meta { color: var(--ink-2); display: flex; gap: 14px; flex-wrap: wrap; margin-top: 4px; font-size: 13.5px; }
.profile .acts { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.stats div { padding: 14px 20px; border-right: 1px solid var(--line); }
.stats div:last-child { border-right: 0; }
.stats span { font-size: 12px; color: var(--ink-2); font-weight: 600; }
.stats b { display: block; font-size: 18px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.note-box { background: #fffaf0; border: 1px solid #f2e3c4; border-radius: var(--r-sm); padding: 12px 14px; white-space: pre-wrap; margin: 0 20px 20px; font-size: 13.5px; }
.pkg { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pkg:last-child { border-bottom: 0; }
.pkg .grow { flex: 1; }
.pips { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 6px; }
.pips i { width: 12px; height: 6px; border-radius: 3px; background: var(--soft); }
.pips i.u { background: var(--accent); }
.back { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); font-weight: 600; margin-bottom: 12px; }

/* Modal & toast */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(43, 34, 38, .38); display: grid; place-items: center; padding: 18px; animation: fade .15s ease; }
.modal-card { background: #fff; border-radius: 18px; width: 100%; max-width: 560px; max-height: calc(100vh - 36px); overflow: auto; box-shadow: 0 24px 60px -20px rgba(40, 20, 30, .4); animation: pop .18s ease; }
.modal-card > header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 4px; position: sticky; top: 0; background: #fff; z-index: 1; }
.modal-card > header h3 { font-size: 21px; }
#modalBody { padding: 12px 20px 20px; }
.summary { background: var(--soft); border-radius: var(--r-sm); padding: 12px 14px; margin-bottom: 14px; display: grid; gap: 4px; }
.summary b { font-weight: 700; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 999px; font-weight: 600; font-size: 13.5px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--bad); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(8px) scale(.98); opacity: 0; } }

/* Responsive */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .g-2, .g-2e { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 40; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .15); }
  .shell.menu .side { transform: none; }
  .shell.menu .scrim { display: block; position: fixed; inset: 0; z-index: 30; background: rgba(43, 34, 38, .3); }
  .menu-btn { display: block; }
  .top { padding: 12px 16px; }
  .top h2 { font-size: 22px; }
  .view { padding: 4px 14px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats div:nth-child(2) { border-right: 0; }
  .stats div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .profile { flex-wrap: wrap; }
  .profile .acts { margin-left: 0; justify-content: flex-start; }
  .hide-m { display: none; }
  .cal { max-height: calc(100vh - 230px); }
  .note-box { margin: 0 14px 14px; }
}
@media (max-width: 480px) {
  .kpi b { font-size: 22px; }
  .modal { padding: 0; align-items: end; }
  .modal-card { border-radius: 18px 18px 0 0; max-height: 92vh; }
}
