/* Akkurt Klinik CRM */
* { box-sizing: border-box; }
:root {
  --ink: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --brand: #0e7490; --brand-dark: #155e75; --bg: #f1f5f9; --card: #fff;
  --red: #dc2626; --green: #059669; --amber: #d97706; --blue: #2563eb;
}
html, body { margin: 0; padding: 0; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif; color: var(--ink); background: var(--bg); font-size: 14px; }
h2 { margin: 0 0 16px; font-size: 20px; }
h4 { margin: 0 0 10px; font-size: 14px; }
a { color: var(--brand); }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 6px; font-size: 12px; word-break: break-all; }
.muted { color: var(--muted); }
.center { text-align: center; }
.txt-red { color: var(--red); }

/* ---------- Giriş ---------- */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, #0e7490 0%, #155e75 55%, #0f172a 100%); }
.login-card { background: #fff; border-radius: 16px; padding: 36px; width: 92%; max-width: 400px; box-shadow: 0 24px 60px rgba(2, 6, 23, .35); display: grid; gap: 14px; }
.login-logo { font-size: 22px; font-weight: 800; color: var(--brand-dark); }
.login-sub { margin: 0 0 6px; color: var(--muted); font-size: 13px; }

/* ---------- Yerleşim ---------- */
.app-body { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.brand { padding: 18px 18px 14px; font-weight: 800; font-size: 16px; color: #fff; border-bottom: 1px solid #1e293b; }
#nav { flex: 1; overflow-y: auto; padding: 10px; }
#nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 9px; color: #cbd5e1; text-decoration: none; margin-bottom: 2px; font-size: 13.5px; }
#nav a:hover { background: #1e293b; color: #fff; }
#nav a.active { background: var(--brand); color: #fff; }
.nav-ic { width: 18px; text-align: center; opacity: .85; }
.sidebar-foot { padding: 12px; border-top: 1px solid #1e293b; display: grid; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip b { display: block; font-size: 13px; color: #fff; }
.user-chip small { color: #94a3b8; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: 10px 18px; display: flex; gap: 12px; align-items: center; position: sticky; top: 0; z-index: 30; }
.global-search { position: relative; flex: 1; max-width: 520px; }
.global-search input { width: 100%; }
#menuToggle { display: none; font-size: 18px; }
.page { padding: 22px; }

/* ---------- Form elemanları ---------- */
input, select, textarea { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(14, 116, 144, .35); border-color: var(--brand); }
label { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.btn { font: inherit; padding: 9px 14px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; text-decoration: none; display: inline-block; font-weight: 600; font-size: 13.5px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: #f8fafc; }
.btn-danger { color: var(--red); border-color: #fecaca; }
.btn-block { width: 100%; }
.btn-mini { padding: 4px 8px; font-size: 12px; background: #f1f5f9; color: var(--ink); margin: 1px; }
.btn-mini:hover { background: #e2e8f0; }

/* ---------- Kartlar & grafikler ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card-title { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.card-value { font-size: 24px; font-weight: 800; margin-top: 6px; }
.card-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.charts { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; margin-bottom: 18px; }
.chart-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.chart-canvas { height: 230px; }
.lists { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.mini-list { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.mini-list ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; font-size: 13px; }

/* ---------- Tablolar ---------- */
.toolbar { display: flex; gap: 10px; align-items: end; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.list-search { max-width: 260px; }
.list-status { max-width: 190px; }
.table-wrap { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; padding: 11px 12px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; vertical-align: top; }
.tbl tr:hover td { background: #f8fafc; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.row-actions { white-space: nowrap; text-align: right; }
.pager { margin-top: 12px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.pg-on { background: var(--brand) !important; color: #fff !important; border-color: var(--brand) !important; }

/* ---------- Rozetler ---------- */
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.b-green { background: #d1fae5; color: #065f46; }
.b-amber { background: #fef3c7; color: #92400e; }
.b-red { background: #fee2e2; color: #991b1b; }
.b-blue { background: #dbeafe; color: #1e40af; }

/* ---------- Modal ---------- */
.modal-backdrop[hidden] { display: none; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(2, 6, 23, .55); z-index: 100; display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; box-shadow: 0 24px 60px rgba(2, 6, 23, .3); }
.modal-lg { max-width: 1020px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.f-wide { grid-column: 1 / -1; }
.f-check { display: flex; align-items: center; gap: 8px; grid-column: 1 / -1; font-size: 13.5px; color: var(--ink); }
.f-check input { width: auto; }
.form-actions { display: flex; gap: 10px; margin-top: 4px; }

/* ---------- Arama sonuçları ---------- */
.search-results { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(2, 6, 23, .15); z-index: 60; overflow: hidden; }
.search-item { padding: 9px 13px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.search-item:hover { background: #f0fdfa; }
.search-item small { color: var(--muted); }

/* ---------- Hasta 360 ---------- */
.p360-head { margin-bottom: 16px; display: grid; gap: 5px; }
.p360-head h3 { margin: 0; font-size: 19px; }
.p360-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.p360-sec { background: #f8fafc; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.p360-sec ul { margin: 0; padding-left: 4px; list-style: none; display: grid; gap: 7px; font-size: 13px; max-height: 220px; overflow-y: auto; }

/* ---------- Bildirim & uyarı ---------- */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); padding: 12px 20px; border-radius: 12px; color: #fff; z-index: 200; font-weight: 600; box-shadow: 0 10px 30px rgba(2, 6, 23, .3); }
.toast-ok { background: var(--green); }
.toast-err { background: var(--red); }
.alert { padding: 10px 14px; border-radius: 10px; font-size: 13px; }
.alert-err { background: #fee2e2; color: #991b1b; }
.alert-warn { background: #fef3c7; color: #92400e; margin-bottom: 14px; }

/* ---------- Mobil ---------- */
@media (max-width: 900px) {
  .sidebar { position: fixed; left: -240px; z-index: 90; transition: left .2s; }
  .sidebar.open { left: 0; box-shadow: 0 0 60px rgba(0, 0, 0, .4); }
  #menuToggle { display: inline-block; }
  .form-grid, .p360-grid { grid-template-columns: 1fr; }
}

/* ---- Sütun süzgeçleri (hasta/aday listeleri) ---- */
.table-wrap { max-height: 68vh; overflow: auto; }
.tbl thead tr:first-child th { position: sticky; top: 0; background: var(--card); z-index: 6; height: 38px; }
.tbl thead tr.filters th { position: sticky; top: 38px; background: #f8fafc; z-index: 5; padding: 5px 7px; border-bottom: 2px solid var(--line); }
.fwrap { position: relative; }
.fwrap input { width: 100%; min-width: 80px; padding: 5px 24px 5px 9px; font-size: 12.5px; font-weight: 400;
  text-transform: none; letter-spacing: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink, #0f172a); }
.fwrap input:focus { outline: 2px solid rgba(13, 148, 136, .35); border-color: #0d9488; }
.fwrap .fx { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); border: none; cursor: pointer;
  width: 17px; height: 17px; border-radius: 50%; font-size: 10px; line-height: 1; padding: 0;
  background: #cbd5e1; color: #fff; display: none; align-items: center; justify-content: center; }
.fwrap .fx.on { display: inline-flex; }
.fwrap .fx:hover { background: #ef4444; }

/* ---- Tarih aralığı + toplam kayıt ---- */
.date-range { display: inline-flex; align-items: center; gap: 6px; }
.date-range input[type="date"] { padding: 7px 9px; font-size: 12.5px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.list-per { padding: 7px 9px; font-size: 12.5px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.total-chip { display: inline-block; background: #0f766e; color: #fff; padding: 6px 14px; border-radius: 20px; font-size: 13px; margin-right: 10px; }
.total-chip b { font-size: 14px; }

/* ---- v5: modern liste görünümü ---- */
.table-wrap { border-radius: 16px; box-shadow: 0 4px 18px rgba(15, 23, 42, .07); border: 1px solid #e6ebf2; }
.tbl thead tr:first-child th { background: #f8fafc; font-weight: 600; }
.tbl tbody tr { transition: background .12s ease; }
.tbl tbody tr:hover td { background: #f0fdfa; }
.badge { border-radius: 999px; padding: 4px 12px; font-weight: 600; }
.pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pager .pg { min-width: 34px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .list-search { min-width: 240px; }

/* ---- v6: genel arama grupları + sürüm etiketi ---- */
.search-group { padding: 8px 12px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #0f766e; background: #f0fdfa; }
.api-ver { margin-top: 10px; font-size: 11px; color: #94a3b8; }
