/* Klinik paneli — styles follow the reference design (Klinik paneli canvas). */
:root {
  --bg: #F4F5F2;
  --surface: #FFFFFF;
  --soft: #F7F8F6;
  --tab-bg: #E6E9E4;
  --ink: #18201E;
  --muted: #5B6662;
  --line: #E2E5E0;
  --line-soft: #EEF0EC;
  --input: #D5DAD6;
  --primary: #0B6157;
  --primary-dark: #08463F;
  --primary-text: #0B6157;
  --primary-soft: #DCEFEC;
  --on-primary: #FFFFFF;
  --bar: #2F8F83;
  --danger: #A12A1F;
  --danger-bg: #FBE9E7;
  --ok: #1F6B3A;
  --ok-bg: #E4F2E8;
  --warn: #9A4A06;
  --warn-bg: #FCEFDD;
  --nav-bg: #18201E;
  --nav-ink: #E9EEEC;
  --nav-muted: #A9B5B1;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.4; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { color: var(--ink); }
button, input, select, textarea { font: inherit; color: inherit; }
input[type=file] { max-width: 100%; }
h1 { margin: 0; font-size: 26px; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 17px; }
h3 { margin: 0; font-size: 15px; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.danger { color: var(--danger); }
.ok { color: var(--ok); }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Layout */
.shell { min-height: 100vh; display: flex; flex-wrap: wrap; }
.nav { flex: 1 1 220px; max-width: 100%; background: var(--nav-bg); color: var(--nav-ink); padding: 24px 16px; display: flex; flex-direction: column; gap: 24px; }
.nav__brand { padding: 0 8px; display: flex; align-items: center; gap: 12px; }
.nav__logo { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; background: #FFFFFF; flex: none; }
.nav__badge { margin-left: auto; min-width: 22px; text-align: center; border-radius: 999px; padding: 2px 7px; font-size: 12px; font-weight: 700; background: var(--primary); color: var(--on-primary); }
.nav__brand strong { display: block; font-size: 16px; line-height: 1.25; }
.nav__brand span span { font-size: 13px; color: var(--nav-muted); }
.nav__links { display: flex; flex-direction: column; gap: 4px; }
.nav__links a { display: flex; align-items: center; min-height: 44px; padding: 10px 12px; border-radius: 8px; color: var(--nav-ink); }
.nav__links a:hover { background: #26302D; color: #FFFFFF; }
.nav__links a[aria-current="page"] { background: #FFFFFF; color: var(--ink); font-weight: 600; }
.nav__foot { margin-top: auto; padding: 12px 8px 0; border-top: 1px solid #34403C; font-size: 13px; color: var(--nav-muted); display: flex; flex-direction: column; gap: 4px; }
.nav__foot strong { color: var(--nav-ink); }
.nav__foot a, .nav__foot button { color: #C9D3D0; background: none; border: 0; padding: 0; text-align: left; min-height: 32px; cursor: pointer; }
.main { flex: 999 1 560px; min-width: 0; padding: 24px 32px 48px; display: flex; flex-direction: column; gap: 20px; }
@media (max-width: 800px) {
  .nav { padding: 12px 16px; gap: 12px; }
  .nav__links { flex-direction: row; flex-wrap: wrap; }
  .nav__foot { display: none; }
  .main { padding: 16px 16px 40px; }
}

/* Top bar & search */
.topbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.search { position: relative; flex: 1 1 320px; max-width: 560px; }
.search__box { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--input); border-radius: 10px; padding: 0 14px; min-height: 46px; }
.search__box input { flex: 1; border: 0; outline: none; background: transparent; min-height: 44px; }
.search__results { position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--input); border-radius: 12px; padding: 8px; box-shadow: 0 8px 24px rgba(24, 32, 30, .12); }
.search__results:empty { display: none; }
.result { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; color: var(--ink); min-height: 44px; }
.result:hover { background: var(--soft); color: var(--ink); }
.shortcuts { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.shortcuts__icons { display: flex; gap: 8px; }
.shortcuts__date { font-size: 13px; color: var(--muted); white-space: nowrap; }
.icon-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--input); background: var(--surface); color: var(--ink); }
.icon-btn:hover { border-color: var(--ink); color: var(--ink); }
.icon-btn__badge { position: absolute; top: -6px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; background: var(--danger); color: #FFFFFF; }
@media (max-width: 800px) { .shortcuts__date { display: none; } }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }

/* Surfaces */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 6px; color: var(--ink); }
a.kpi:hover { border-color: var(--primary); color: var(--ink); }
.kpi__label { font-size: 13px; color: var(--muted); }
.kpi__value { font-size: 26px; font-weight: 700; font-family: var(--mono); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--line-soft); padding: 10px 0; color: var(--ink); min-height: 44px; }
a.row:hover { color: var(--ink); background: var(--soft); }
.row__main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row__title { font-weight: 600; }
.split { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.split__side { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.split__main { flex: 999 1 420px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* Tables */
.table-wrap { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; }  /* relative: keeps hidden labels inside the scroll box */
table.table { width: 100%; border-collapse: collapse; min-width: 720px; }
.table th { text-align: left; font-size: 13px; font-weight: 600; color: var(--muted); padding: 12px 20px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.table tr:last-child td { border-bottom: 0; }
.table tr[data-href] { cursor: pointer; }
.table tr[data-href]:hover td { background: var(--soft); }
.table td a.cell-link { color: var(--ink); font-weight: 600; }

/* Badges & pills */
.badge { display: inline-block; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px; white-space: nowrap; background: var(--tab-bg); color: var(--ink); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--primary { background: var(--primary-soft); color: var(--primary-text); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--tab-bg); border-radius: 10px; padding: 3px; }
.tabs a { display: inline-flex; align-items: center; border-radius: 8px; padding: 0 12px; min-height: 38px; font-size: 13px; font-weight: 600; color: var(--ink); }
.tabs a[aria-pressed="true"] { background: #FFFFFF; box-shadow: 0 1px 2px rgba(24, 32, 30, .12); }
.tabs--lg a { min-height: 44px; font-size: 14px; padding: 0 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 0 12px; min-height: 36px; font-size: 13px; font-weight: 600; border: 1px solid var(--input); background: #FFFFFF; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 10px; min-height: 44px; padding: 0 18px; font-size: 15px; font-weight: 600; border: 1px solid var(--input); background: #FFFFFF; color: var(--ink); cursor: pointer; text-decoration: none; }
.btn:hover { border-color: var(--ink); color: var(--ink); }
.btn--primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn--primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: var(--on-primary); }
.btn--outline { border-color: var(--primary-text); color: var(--primary-text); }
.btn--danger { border-color: var(--danger); color: var(--danger); }
.btn--link { border: 0; background: transparent; color: var(--primary-text); padding: 0 4px; }
.btn--lg { min-height: 48px; font-size: 16px; font-weight: 700; padding: 0 28px; }
.btn--sm { min-height: 36px; font-size: 13px; padding: 0 12px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Forms */
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field input:not([type=checkbox]):not([type=radio]):not([type=file]), .field select, .field textarea,
.input { font-size: 15px; font-weight: 400; border: 1px solid var(--input); border-radius: 8px; padding: 0 12px; min-height: 44px; background: #FFFFFF; width: 100%; }
.field textarea { padding: 10px 12px; resize: vertical; }
.field .help { font-weight: 400; font-size: 13px; color: var(--muted); }
.field .errorlist, .errorlist { margin: 0; padding: 0; list-style: none; color: var(--danger); font-size: 13px; font-weight: 600; }
.password { position: relative; display: block; }
.password input { padding-right: 76px !important; width: 100%; }
.password__toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--soft);
  color: var(--ink); border-radius: 6px; padding: 0 10px; min-height: 32px; font-size: 13px; font-weight: 600; cursor: pointer; }
.password__toggle:hover { background: var(--tab-bg); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--primary); }
.radio-pills > div { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-pills label { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 0 16px; min-height: 44px; font-size: 14px; font-weight: 600; border: 1.5px solid var(--input); background: #FFFFFF; cursor: pointer; }
.radio-pills input { position: absolute; opacity: 0; pointer-events: none; }
.radio-pills label:has(input:checked) { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.radio-pills label:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.panel { background: var(--soft); border-radius: 10px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.panel--dashed { border: 1.5px dashed #9AA6A2; }

/* Messages */
.messages { display: flex; flex-direction: column; gap: 8px; }
.message { border-radius: 10px; padding: 12px 16px; font-size: 14px; font-weight: 600; background: var(--ok-bg); color: var(--ok); }
.message--error { background: var(--danger-bg); color: var(--danger); }

/* Customer card */
.balance { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; padding: 8px 14px; border-radius: 10px; background: var(--ok-bg); }
.balance--debt { background: var(--danger-bg); }
.balance span { font-size: 12px; color: var(--muted); }
.balance strong { font-size: 20px; font-family: var(--mono); color: var(--ok); }
.balance--debt strong { color: var(--danger); }
.pets { display: flex; flex-wrap: wrap; gap: 8px; }
.pet-chip { display: flex; flex-direction: column; gap: 2px; border-radius: 10px; padding: 8px 14px; min-height: 44px; background: #FFFFFF; border: 1.5px solid var(--input); color: var(--ink); }
.pet-chip[aria-current="true"] { background: var(--primary-soft); border-color: var(--primary); }
.pet-chip--inactive { opacity: .6; }
.pet-chip--add { justify-content: center; border-style: dashed; border-color: #9AA6A2; color: var(--primary-text); font-weight: 600; font-size: 14px; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 500; }
.doc { display: flex; gap: 12px; align-items: center; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.doc__ext { flex: none; width: 44px; height: 52px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; font-family: var(--mono); background: var(--primary-soft); color: var(--primary-text); }
.doc__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.doc__body a { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc select { font-size: 13px; font-weight: 600; border-radius: 8px; border: 1px solid var(--input); min-height: 36px; padding: 0 8px; background: #FFFFFF; }
.history-item { border-top: 1px solid var(--line-soft); padding: 14px 0; display: flex; flex-direction: column; gap: 8px; }
.history-item__head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.history-item__meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lines { background: var(--soft); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.lines div { display: flex; justify-content: space-between; gap: 12px; }
.lines .total { font-size: 14px; font-weight: 600; border-top: 1px solid var(--line); padding-top: 6px; margin-top: 2px; }
.link-quiet { border: 0; background: none; padding: 0; font-size: 12px; color: var(--muted); cursor: pointer; text-decoration: underline; }
.link-quiet:hover { color: var(--danger); }
details.inline summary { cursor: pointer; list-style: none; }
details.inline summary::-webkit-details-marker { display: none; }

/* Visit cart */
.suggestions { display: flex; flex-direction: column; gap: 2px; }
.suggestion { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; border: 0; border-radius: 8px; background: var(--soft); padding: 8px 12px; min-height: 44px; cursor: pointer; }
.suggestion:hover, .suggestion:focus-visible { background: var(--primary-soft); }
.cart-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.cart-row__name { flex: 1 1 180px; font-weight: 500; }
.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 44px; height: 44px; border: 1px solid var(--input); border-radius: 8px; background: #FFFFFF; font-size: 18px; cursor: pointer; }
.qty span { min-width: 28px; text-align: center; font-family: var(--mono); }
.cart-row__total { min-width: 90px; text-align: right; font-family: var(--mono); }
.cart-row__due { flex-basis: 100%; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.cart-row__due input { min-height: 36px; border: 1px solid var(--input); border-radius: 8px; padding: 0 8px; }
.cart-row__warn { flex-basis: 100%; font-size: 13px; font-weight: 600; color: var(--warn); }
.sum-row { display: flex; justify-content: space-between; align-items: baseline; }

/* Stats */
.chart { position: relative; height: 212px; }
.chart__axis { position: absolute; left: 0; width: 64px; font-size: 11px; line-height: 1; color: var(--muted); font-family: var(--mono); }
.chart__grid { position: absolute; left: 72px; right: 0; border-top: 1px dashed var(--line); }
.chart__bars { position: absolute; left: 72px; right: 0; top: 5px; height: 170px; display: flex; align-items: flex-end; gap: 4px; border-bottom: 1px solid #C9CFCA; }
.chart__bar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; justify-content: center; }
.chart__bar div { width: 100%; max-width: 48px; background: var(--bar); border-radius: 4px 4px 0 0; }
.chart__bar:hover div { background: var(--primary); }
.chart__labels { position: absolute; left: 72px; right: 0; top: 184px; display: flex; gap: 4px; }
.chart__labels span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.hbar { display: grid; grid-template-columns: minmax(96px, 40%) 1fr auto; gap: 10px; align-items: center; min-height: 34px; font-size: 14px; }
.hbar__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar__track { height: 14px; display: flex; }
.hbar__fill { height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; }
.hbar__val { font-size: 13px; font-family: var(--mono); text-align: right; min-width: 76px; display: flex; flex-direction: column; align-items: flex-end; }
.meter { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; }
.meter__fill { display: block; height: 100%; background: var(--bar); }
.meter__fill--warn { background: var(--danger); }
.heat { border-collapse: separate; border-spacing: 3px; font-size: 11px; }
.heat th { color: var(--muted); font-weight: 500; padding: 0 2px; }
.heat td { width: 28px; height: 24px; border-radius: 4px; text-align: center; font-family: var(--mono); }
.heat .l0 { background: var(--soft); color: transparent; }
.heat .l1 { background: var(--primary-soft); color: var(--ink); }
.heat .l2 { background: color-mix(in srgb, var(--primary) 40%, #FFFFFF); color: var(--ink); }
.heat .l3 { background: color-mix(in srgb, var(--primary) 75%, #FFFFFF); color: var(--ink); }
.heat .l4 { background: var(--primary); color: var(--on-primary); }
.htmx-request.stats-region { opacity: .55; transition: opacity .15s; }

/* Login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--nav-bg); padding: 24px; }
.login__logo { width: 120px; height: 120px; border-radius: 50%; object-fit: cover; align-self: center; }
.login__card { width: 100%; max-width: 380px; background: #FFFFFF; border-radius: 16px; padding: 32px; display: flex; flex-direction: column; gap: 16px; }

/* WhatsApp */
.btn--wa { background: #1F7A4D; border-color: #1F7A4D; color: #FFFFFF; }
.btn--wa:hover { background: #17603C; border-color: #17603C; color: #FFFFFF; }
.wa-preview { white-space: pre-wrap; font-size: 13px; background: var(--soft); border-radius: 8px; padding: 10px 12px; margin: 0; }
.pay-split { display: flex; flex-direction: column; gap: 8px; }
.pay-split__grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.pay-split input { text-align: right; }
.report { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }

/* Appointment calendar */
.cal { min-width: 860px; table-layout: fixed; }
.cal--day { min-width: 0; }
.cal th, .cal td { border-right: 1px solid var(--line-soft); padding: 6px; }
.cal thead th { text-align: center; font-size: 13px; color: var(--ink); }
.cal__hour { width: 64px; font-size: 12px; color: var(--muted); font-weight: 500; vertical-align: top; }
.cal__today { background: var(--primary-soft); }
.cal__closed { background: repeating-linear-gradient(45deg, #FAFAF8, #FAFAF8 6px, #F1F2EF 6px, #F1F2EF 12px); }
.cal__cell { height: 56px; vertical-align: top; position: relative; }
.cal__add { display: block; text-align: center; color: var(--muted); border-radius: 6px; min-height: 24px; line-height: 24px; opacity: 0; }
.cal__cell:hover .cal__add, .cal__add:focus-visible { opacity: 1; background: var(--soft); }
@media (hover: none) { .cal__add { opacity: .5; } }
.appt { border-left: 3px solid var(--primary); background: var(--primary-soft); border-radius: 6px; padding: 4px 6px; margin-bottom: 4px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.appt__main { color: var(--ink); display: flex; flex-direction: column; }
.appt--geldi { border-left-color: var(--ok); background: var(--ok-bg); }
.appt--gelmedi { border-left-color: var(--danger); background: var(--danger-bg); }
