:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1f2933; --muted: #6b7280; --line: #e3e6ea;
  --accent: #0f766e; --accent-ink: #fff; --danger: #b91c1c; --today: #ecfdf5;
  --radius: 8px;
  color-scheme: light;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--accent); }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.empty { color: var(--muted); padding: 24px; text-align: center; }

.demo-bar { background: #fef3c7; color: #78350f; font-size: .8rem; padding: 4px 16px; text-align: center; }
.link { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 0 4px; }

.top { display: flex; align-items: center; gap: 24px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); height: 52px; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: .02em; }
.top nav { display: flex; gap: 4px; overflow-x: auto; }
.top nav a { padding: 8px 12px; border-radius: 6px; text-decoration: none; color: var(--ink); white-space: nowrap; }
.top nav a.on { background: var(--today); color: var(--accent); font-weight: 600; }

main { padding: 16px; max-width: 1400px; margin: 0 auto; }

button, .btn { font: inherit; padding: 7px 12px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
button:hover, .btn:hover { border-color: #c9ced4; }
button.on, .btn.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.primary:hover { filter: brightness(1.08); }
.danger { color: var(--danger); border-color: #f1c4c4; }
.icon { border: 0; background: none; font-size: 1.1rem; padding: 4px 8px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 12px; }
.toolbar .group { display: flex; gap: 4px; }
.toolbar input[type=search] { flex: 1; min-width: 200px; max-width: 420px; }
.cal-title { flex: 1; text-align: center; text-transform: capitalize; min-width: 200px; }
.legend { display: flex; gap: 16px; font-size: .85rem; color: var(--muted); margin: -4px 0 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }

input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); width: 100%; }
textarea { resize: vertical; }

/* Ay görünümü */
.month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.mhead { background: var(--panel); padding: 6px; font-size: .8rem; color: var(--muted); text-align: center; text-transform: capitalize; }
.mcell { background: var(--panel); min-height: 110px; padding: 4px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; min-width: 0; }
.mcell.other { background: #fafafa; }
.mcell.other .dnum { color: #b0b5bb; }
.mcell.today { background: var(--today); }
.dnum { border: 0; background: none; padding: 2px 6px; align-self: flex-start; font-weight: 600; font-size: .85rem; }
.chip { border: 0; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 12%, #fff); border-radius: 4px; padding: 2px 6px; font-size: .78rem; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; width: 100%; }
.more { border: 0; background: none; font-size: .75rem; color: var(--muted); padding: 0 6px; text-align: left; }

/* Hafta / gün */
.grid-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; max-height: calc(100vh - 210px); }
.tgrid { display: grid; grid-template-columns: 56px repeat(7, minmax(110px, 1fr)); min-width: 820px; }
.tgrid.one { grid-template-columns: 56px 1fr; min-width: 0; }
.hours .hour { font-size: .72rem; color: var(--muted); text-align: right; padding: 2px 6px 0 0; }
.col { border-left: 1px solid var(--line); min-width: 0; }
.col-head { position: sticky; top: 0; z-index: 2; display: block; width: 100%; height: 40px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; background: var(--panel); text-transform: capitalize; font-size: .85rem; justify-content: center; }
.col-head.spacer { border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 2; }
.col-head.today { color: var(--accent); background: var(--today); }
.col-body { position: relative; cursor: pointer; background-image: repeating-linear-gradient(to bottom, var(--line) 0, var(--line) 1px, transparent 1px, transparent 48px); }
.ev { position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; overflow: hidden; text-align: left; padding: 3px 6px; font-size: .76rem; line-height: 1.25; border: 0; border-left: 4px solid var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); border-radius: 5px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.ev:hover { background: color-mix(in srgb, var(--c) 22%, #fff); z-index: 1; }
.ev b { font-size: .8rem; }
.ev span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cancel { opacity: .5; text-decoration: line-through; }
.badge { font-size: .65rem; background: var(--c); color: #fff; border-radius: 3px; padding: 0 4px; margin-left: 4px; font-weight: 600; text-decoration: none; }
.now-line { position: absolute; left: 0; right: 0; height: 2px; background: #dc2626; z-index: 1; pointer-events: none; }

/* Tablolar */
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; font-size: .9rem; }
.list th, .list td { padding: 9px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); background: #fafbfc; }
.list tbody tr { cursor: pointer; }
.list tbody tr:hover { background: #f8fafb; }
.list td.wrap { white-space: normal; min-width: 180px; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.tag { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 999px; background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 75%, #000); font-weight: 600; }

.avatar { --c: var(--accent); display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: color-mix(in srgb, var(--c) 16%, #fff); color: var(--c); font-weight: 700; font-size: 1.2rem; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: .75rem; }

/* Hasta kartı */
.back { display: inline-block; margin-bottom: 8px; text-decoration: none; }
.pcard { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.phead { display: flex; align-items: center; gap: 14px; padding: 16px; flex-wrap: wrap; }
.phead p { margin: 2px 0 0; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--ink); border-color: var(--accent); font-weight: 600; }
#tab { padding: 16px; }

.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form.cols { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--muted); }
.form .wide { grid-column: 1 / -1; }
.form h3.section { font-size: .95rem; margin: 10px 0 0; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.form h3.section:first-child { margin-top: 0; }
.form fieldset { border: 1px solid var(--line); border-radius: 6px; display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 8px 12px; }
.form legend { font-size: .82rem; color: var(--muted); padding: 0 4px; }
.form label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--ink); font-size: .9rem; }
.form label.check input { width: auto; }
.form .calc { align-self: end; font-size: .85rem; color: var(--muted); padding-bottom: 8px; }
.actions { display: flex; gap: 8px; align-items: center; }
.err { color: var(--danger); margin: 0; }

.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.timeline button { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left; border-left: 4px solid var(--c); padding: 10px 12px; }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(15, 23, 42, .4); }
dialog .form { padding: 0 20px 20px; }
.dlg-head { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 16px 0 4px; position: sticky; top: 0; background: #fff; }

@media (max-width: 640px) {
  main { padding: 12px; }
  .top { gap: 12px; }
  .form { grid-template-columns: 1fr; }
  .cal-title { order: -1; flex-basis: 100%; text-align: left; }
  .mcell { min-height: 72px; }
  .chip { font-size: .68rem; padding: 1px 3px; }
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .85em; }
.tab-soon { padding: 9px 14px; color: #b0b5bb; white-space: nowrap; cursor: default; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.form input[type=color] { height: 38px; padding: 3px; }
