/* ===== DentaLife Tasarım Sistemi ===== */
:root {
  --primary: #0d9488;
  --primary-dark: #0f766e;
  --primary-light: #5eead4;
  --primary-bg: #f0fdfa;
  --accent: #2563eb;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
  --info: #0ea5e9;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(15,23,42,.06), 0 8px 24px -12px rgba(15,23,42,.12);
  --shadow-lg: 0 20px 50px -20px rgba(15,23,42,.35);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--primary-dark); text-decoration: none; }
h1,h2,h3,h4 { margin: 0 0 .4em; line-height: 1.2; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; gap: .5rem; border: 1px solid transparent; background: var(--primary); color: #fff; padding: .6rem 1.1rem; border-radius: 10px; font-weight: 600; font-size: 14px; transition: .15s; }
.btn:hover { background: var(--primary-dark); }
.btn.sm { padding: .38rem .7rem; font-size: 13px; border-radius: 8px; }
.btn.ghost { background: transparent; color: var(--primary-dark); border-color: var(--line); }
.btn.ghost:hover { background: var(--primary-bg); }
.btn.light { background: var(--primary-bg); color: var(--primary-dark); }
.btn.danger { background: var(--danger); }
.btn.warn { background: var(--warn); }
.btn.ok { background: var(--ok); }
.btn.block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Forms ---- */
.field { margin-bottom: 1.05rem; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: #475569; margin-bottom: .38rem; letter-spacing: .01em; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field .hint { font-size: 11.5px; color: var(--muted); margin-top: .3rem; }

.input,
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]):not([type=range]):not([type=submit]):not([type=button]):not([type=reset]),
select, textarea {
  width: 100%;
  padding: .62rem .8rem;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  font-size: 14.5px;
  line-height: 1.35;
  transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
input::placeholder, textarea::placeholder { color: #94a3b8; opacity: 1; }

/* hover */
.input:hover, input:hover:not(:disabled):not(:focus), select:hover:not(:disabled), textarea:hover:not(:focus) {
  border-color: #cbd5e1;
}
/* focus */
.input:focus, input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3.5px var(--primary-bg);
  background: #fff;
}
/* disabled / readonly */
input:disabled, select:disabled, textarea:disabled,
input[readonly] {
  background: #f1f5f9; color: #64748b; cursor: not-allowed; border-color: var(--line);
}

/* select — özel ok */
select {
  padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  cursor: pointer;
}

textarea { min-height: 84px; resize: vertical; }

/* number: tarayıcı oklarını koru */
input[type=number] { -moz-appearance: textfield; appearance: auto; }

/* date/time takvim ikonu rengi */
input[type=date]::-webkit-calendar-picker-indicator,
input[type=time]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; }
input[type=date]:hover::-webkit-calendar-picker-indicator,
input[type=time]:hover::-webkit-calendar-picker-indicator { opacity: 1; }

/* color input */
input[type=color] { padding: 3px; height: 40px; width: 100%; border-radius: 10px; cursor: pointer; border: 1.5px solid var(--line); }
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: none; border-radius: 6px; }

/* file input */
input[type=file] {
  padding: .42rem .5rem; font-size: 13px; cursor: pointer; color: var(--muted);
}
input[type=file]::file-selector-button {
  margin-right: .7rem; padding: .45rem .85rem; border: none; border-radius: 8px;
  background: var(--primary-bg); color: var(--primary-dark); font-weight: 600; font-size: 13px;
  cursor: pointer; transition: .15s; font-family: inherit;
}
input[type=file]::file-selector-button:hover { background: var(--primary); color: #fff; }

/* checkbox & radio — tema renginde */
input[type=checkbox], input[type=radio] {
  width: 17px; height: 17px; accent-color: var(--primary); cursor: pointer; vertical-align: middle;
  -webkit-appearance: auto; appearance: auto;
}

/* hatalı alan */
.field.error input, .field.error select, .field.error textarea,
input.error, select.error, textarea.error {
  border-color: var(--danger); box-shadow: 0 0 0 3px #fee2e2;
}
.field.error .hint { color: var(--danger); }

/* İkonlu input grubu — wrapper'ın kendisi kutu gibi davranır (arka plan/kenarlık/odak halkası),
   iç <input> şeffaf akar. Böylece genel input:not(...) zincirinin yüksek özgüllüğüyle
   çakışmaz (önceki sürümde padding-left override edilemiyor, ikon yazının üstüne biniyordu). */
.input-group {
  display: flex;
  align-items: center;
  gap: .6rem;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: #fff;
  padding: 0 .9rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input-group:hover { border-color: #cbd5e1; }
.input-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.input-group .icon {
  flex: none;
  display: flex;
  align-items: center;
  font-size: 16px;
  color: #94a3b8;
  line-height: 1;
  transition: color .15s ease;
}
.input-group:focus-within .icon { color: var(--primary); }
.input-group input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: .72rem 0 !important;
}
.input-group input:hover, .input-group input:focus { border: 0 !important; box-shadow: none !important; }
.input-group .pw-toggle {
  flex: none;
  border: 0;
  background: none;
  color: #94a3b8;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  padding: .35rem;
  border-radius: 6px;
  transition: color .15s ease, background .15s ease;
}
.input-group .pw-toggle:hover { color: var(--primary-dark); background: var(--bg); }

.row { display: flex; gap: .85rem; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 130px; }

/* ---- Cards ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 1.2rem 1.3rem; }
.grid { display: grid; gap: 1rem; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--primary-bg); color: var(--primary-dark); white-space: nowrap; }
.badge.gray { background: #f1f5f9; color: #475569; }
.badge.ok { background: #dcfce7; color: #15803d; }
.badge.warn { background: #fef3c7; color: #b45309; }
.badge.danger { background: #fee2e2; color: #b91c1c; }
.badge.info { background: #e0f2fe; color: #0369a1; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }

/* ---- Tables ---- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); padding: .6rem .7rem; border-bottom: 2px solid var(--line); }
.tbl td { padding: .65rem .7rem; border-bottom: 1px solid var(--line); }
.tbl tr:hover td { background: var(--primary-bg); }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ---- Toast ---- */
#toasts { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: .6rem; }
.toast { background: var(--ink); color: #fff; padding: .8rem 1.1rem; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; max-width: 340px; animation: slideIn .2s; }
.toast.ok { background: var(--ok); } .toast.err { background: var(--danger); } .toast.warn { background: var(--warn); }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

/* ---- Modal ---- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,.55); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; z-index: 999; overflow-y: auto; }
.modal { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; animation: pop .18s; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.3rem; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; }
.modal-body { padding: 1.3rem; }
.modal-foot { padding: 1rem 1.3rem; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: .6rem; }
.x { background: none; border: none; font-size: 1.4rem; color: var(--muted); line-height: 1; }
@keyframes pop { from { transform: scale(.96); opacity: 0; } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; }
.flex { display: flex; gap: .6rem; align-items: center; }
.between { display: flex; justify-content: space-between; align-items: center; gap: .6rem; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.stat-big { font-size: 1.7rem; font-weight: 700; }
hr.sep { border: none; border-top: 1px solid var(--line); margin: 1rem 0; }

.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .ico { font-size: 2.4rem; margin-bottom: .4rem; opacity: .5; }
.spin { width: 30px; height: 30px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: rot 1s linear infinite; margin: 2rem auto; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ===== App shell (portal + admin) ===== */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: #0b3b38; color: #cbeae5; padding: 0; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar .brand { padding: 1.1rem 1.2rem; font-weight: 800; font-size: 1.15rem; color: #fff; display: flex; align-items: center; gap: .5rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar .brand .logo { width: 30px; height: 30px; background: var(--primary-light); border-radius: 8px; display: grid; place-items: center; color: #0b3b38; font-weight: 900; }
.nav { flex: 1; overflow-y: auto; padding: .6rem; }
.nav a { display: flex; align-items: center; gap: .7rem; padding: .6rem .8rem; border-radius: 9px; color: #a7d5cf; font-size: 14px; font-weight: 500; margin-bottom: 2px; }
.nav a .ico { width: 20px; text-align: center; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.nav .sec { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #5f9b94; padding: .8rem .8rem .3rem; }
.nav a .count { margin-left: auto; background: var(--warn); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 .4rem; font-weight: 700; }
.sidebar .who { padding: .9rem 1.2rem; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px; }
.main { min-width: 0; background: var(--bg); }
.topbar { background: #fff; border-bottom: 1px solid var(--line); padding: .8rem 1.4rem; display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 20; }
.topbar h2 { margin: 0; font-size: 1.15rem; }
.topbar .grow { flex: 1; }
.content { padding: 1.4rem; max-width: 1250px; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-bg); color: var(--primary-dark); display: grid; place-items: center; font-weight: 700; font-size: 13px; }

.cards-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.1rem; box-shadow: var(--shadow); }
.kpi .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.kpi .val { font-size: 1.55rem; font-weight: 700; margin-top: .2rem; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpi.accent { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: none; }
.kpi.accent .lbl, .kpi.accent .sub { color: rgba(255,255,255,.85); }

.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--line); margin-bottom: 1.1rem; overflow-x: auto; }
.tabs button { background: none; border: none; padding: .6rem .9rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: .9rem; }
.section-title h3 { margin: 0; }

/* ===== Odontogram ===== */
.odo { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; }
.odo-arch { display: flex; justify-content: center; gap: 0; }
.odo-quad { display: flex; gap: 3px; }
.odo-mid { width: 2px; background: var(--line); margin: 0 8px; }
.tooth { width: 34px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.tooth .tno { font-size: 10px; color: var(--muted); }
.tooth .tbox { width: 26px; height: 34px; border: 1px solid #cbd5e1; border-radius: 5px 5px 7px 7px; transition: .12s; }
.tooth.has .tbox { border-color: #94a3b8; }
.tooth:hover .tbox { transform: translateY(-2px); box-shadow: 0 4px 8px rgba(0,0,0,.12); }
.odo-arch.bottom .tooth { flex-direction: column-reverse; }
.odo-labels { display: flex; justify-content: space-between; max-width: 640px; margin: .3rem auto; font-size: 11px; color: var(--muted); padding: 0 1rem; }
.odo-legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; margin-top: 1rem; font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: .35rem; color: var(--muted); }
.legend-item .dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.list-row { display: flex; align-items: center; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: none; }
.pill-tabs { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.pill-tabs button { border: 1px solid var(--line); background: #fff; padding: .4rem .8rem; border-radius: 999px; font-size: 13px; font-weight: 600; color: var(--muted); }
.pill-tabs button.active { background: var(--primary); color: #fff; border-color: var(--primary); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 100; width: 250px; height: 100vh; transform: translateX(-100%); transition: .2s; }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex !important; }
}
.menu-toggle { display: none; }

/* ===== Günlük ajanda (sekreter) ===== */
.agenda { display: flex; flex-direction: column; gap: .5rem; }
.agenda-row { display: flex; align-items: center; gap: .9rem; padding: .6rem .8rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.agenda-row:hover { box-shadow: var(--shadow); }
.agenda-time { font-weight: 700; font-size: 1.05rem; color: var(--primary-dark); min-width: 52px; font-variant-numeric: tabular-nums; }
.agenda-actions { display: flex; align-items: center; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
select.mini { padding: .3rem .5rem; font-size: 12px; border-radius: 7px; min-width: 90px; }
@media (max-width: 720px) { .agenda-row { flex-wrap: wrap; } .agenda-actions { width: 100%; justify-content: flex-start; } }

/* ---- Doktor ekranı: sıradaki hasta kartı ---- */
.next-card { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border: 0; }
.next-card .muted, .next-card .tiny { color: rgba(255,255,255,.85) !important; }
.next-card .next-name { font-size: 1.9rem; font-weight: 800; line-height: 1.1; margin: .5rem 0 .2rem; }
.next-card .btn { background: #fff; color: var(--primary-dark); }
.next-card .badge { background: rgba(255,255,255,.2); color: #fff; }

/* ---- Ajanda: haftalık ---- */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; }
.week-col { border: 1px solid var(--line); border-radius: 10px; background: #fff; overflow: hidden; display: flex; flex-direction: column; }
.week-col.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.week-head { padding: .4rem; text-align: center; font-size: 12px; color: var(--muted); background: var(--bg); border-bottom: 1px solid var(--line); }
.week-head b { display: block; font-size: 1.1rem; color: var(--ink); }
.week-col.today .week-head b { color: var(--primary-dark); }
.week-body { padding: .35rem; display: flex; flex-direction: column; gap: .25rem; min-height: 120px; position: relative; }
.day-add { margin-top: auto; border: 1px dashed var(--line); background: transparent; color: var(--muted); border-radius: 6px; padding: .15rem; cursor: pointer; font-size: 12px; }
.day-add:hover { border-color: var(--primary); color: var(--primary-dark); }
.appt-chip.rem { background: #fef9c3 !important; border-left: 3px solid #f59e0b !important; color: #92400e; }
.appt-chip.rem.done { opacity: .5; text-decoration: line-through; }
.appt-chip[draggable="true"] { cursor: grab; }
.appt-chip[draggable="true"]:active { cursor: grabbing; }
.week-body.drop-hover { background: var(--primary-light); outline: 2px dashed var(--primary); outline-offset: -2px; border-radius: 6px; }
.cal-day.drop-hover { border-color: var(--primary); outline: 2px dashed var(--primary); outline-offset: -2px; }

/* ---- Ajanda: aylık ---- */
.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .4rem; }
.month-grid.head { margin-bottom: .4rem; }
.month-grid .mh { text-align: center; font-size: 12px; color: var(--muted); font-weight: 600; padding: .2rem; }
.cal-day { border: 1px solid var(--line); border-radius: 8px; padding: .35rem; min-height: 92px; background: #fff; cursor: pointer; display: flex; flex-direction: column; gap: .2rem; }
.cal-day:hover { border-color: var(--primary-light); }
.cal-day.today { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.cal-day.dim { background: var(--bg); opacity: .55; }
.cal-num { font-size: 12px; font-weight: 700; color: var(--muted); }
.cal-day.today .cal-num { color: var(--primary-dark); }
@media (max-width: 820px) {
  .week-grid { grid-template-columns: 1fr; }
  .month-grid { gap: .2rem; } .cal-day { min-height: 62px; } .cal-day .appt-chip { display: none; }
}
