* { box-sizing: border-box; }
:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --primary: #2563eb;
  --danger: #dc2626;
  --warn: #f59e0b;
}
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------------- giriş ---------------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1e3a8a, #7c3aed);
}
.login-card {
  background: var(--card); padding: 40px 36px; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: 12px; width: 320px; text-align: center;
}
.login-logo { font-size: 42px; }
.login-card h1 { margin: 0; font-size: 22px; }
.login-card p { margin: 0 0 8px; }
.login-card input {
  padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 15px;
}
.login-card button {
  padding: 12px; border: none; border-radius: 8px; background: var(--primary);
  color: #fff; font-size: 15px; font-weight: 600; cursor: pointer;
}
.login-card button:hover { filter: brightness(1.1); }
.login-error {
  background: #fee2e2; color: #991b1b; padding: 8px; border-radius: 8px; font-size: 13px;
}

/* ---------------- üst bar ---------------- */
.topbar {
  display: flex; align-items: center; gap: 24px;
  background: #0f172a; color: #fff; padding: 0 20px; height: 54px;
  position: sticky; top: 0; z-index: 50;
}
.brand { font-weight: 700; font-size: 16px; white-space: nowrap; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  background: none; border: none; color: #cbd5e1; padding: 8px 14px;
  font-size: 14px; cursor: pointer; border-radius: 8px;
}
.tab:hover { background: #1e293b; color: #fff; }
.tab.active { background: var(--primary); color: #fff; font-weight: 600; }
.logout { color: #cbd5e1; text-decoration: none; font-size: 14px; }
.logout:hover { color: #fff; }

main { padding: 20px; max-width: 1500px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------------- araç çubuğu ---------------- */
.toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
}
.toolbar-label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font-size: 14px; cursor: pointer;
}
.btn:hover { filter: brightness(.96); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.btn.danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn.danger:hover { background: #fef2f2; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn.tiny { padding: 3px 8px; font-size: 12px; border-radius: 6px; }
.pool-actions { display: flex; gap: 4px; margin-right: 6px; }
select, input[type="number"], input[type="text"], input[type="password"] {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px;
  background: #fff;
}
.status-bar { margin-left: auto; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 8px; }
.status-bar.ok { background: #dcfce7; color: #166534; }
.status-bar.bad { background: #fee2e2; color: #991b1b; }

.legend { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; font-size: 12px; }
.legend-item { display: flex; align-items: center; gap: 5px; color: var(--muted); }
.legend-dot { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }

/* ---------------- program tablosu ---------------- */
.grid-wrap { overflow-x: auto; background: var(--card); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
table.schedule { border-collapse: collapse; width: 100%; min-width: 1050px; }
.schedule th, .schedule td { border: 1px solid var(--line); text-align: center; }
.schedule thead th { background: #f8fafc; padding: 8px 6px; font-size: 13px; }
.schedule th.day-head { background: #0f172a; color: #fff; font-size: 14px; }
.schedule th.day-head.day-sep, .schedule td.day-sep, .schedule th.period-head.day-sep { border-left: 3px solid #94a3b8; }
.schedule th.period-head { font-weight: 500; }
.schedule th.period-head .time { display: block; font-size: 10px; color: var(--muted); font-weight: 400; }
.schedule th.class-head {
  background: #f8fafc; font-size: 13px; padding: 6px 10px; text-align: left;
  position: sticky; left: 0; z-index: 2; min-width: 110px;
}
.schedule td.cell { height: 56px; min-width: 92px; padding: 3px; vertical-align: middle; }
.schedule td.cell.dragover { background: #dbeafe; outline: 2px dashed var(--primary); outline-offset: -3px; }

.chip {
  border-radius: 8px; padding: 4px 6px; font-size: 12px; font-weight: 600;
  color: #fff; cursor: grab; position: relative; user-select: none;
  border-left: 5px solid transparent;
  box-shadow: 0 1px 2px rgba(0,0,0,.2);
  text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.chip:active { cursor: grabbing; }
.chip .teacher { display: block; font-size: 10px; font-weight: 400; opacity: .95; }
.chip.dragging { opacity: .4; }
.chip.conflict { outline: 3px solid #dc2626; outline-offset: 1px; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { outline-color: #fca5a5; } }
.chip .warn-badge {
  position: absolute; top: -7px; right: -7px; background: var(--warn); color: #fff;
  border-radius: 50%; width: 16px; height: 16px; font-size: 11px; line-height: 16px;
  text-align: center; cursor: help; text-shadow: none;
}
.dim { opacity: .18; }

/* ---------------- çakışma paneli ---------------- */
.conflict-panel { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.conflict-item {
  background: #fee2e2; color: #991b1b; border-left: 4px solid var(--danger);
  padding: 8px 12px; border-radius: 6px; font-size: 13px;
}

/* ---------------- havuz ---------------- */
.pool-title { font-size: 16px; margin: 22px 0 10px; }
.pool { display: flex; flex-direction: column; gap: 8px; }
.pool-class {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--card); padding: 8px 12px; border-radius: 10px;
  border: 1px dashed var(--line); min-height: 44px;
}
.pool-class.dragover { background: #dbeafe; border-color: var(--primary); }
.pool-class .pool-label { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 100px; }
.pool .chip { display: inline-block; }
.count-badge {
  background: rgba(255,255,255,.3); border-radius: 10px; padding: 0 6px;
  font-size: 10px; margin-left: 4px;
}
.pool-empty { font-size: 12px; color: #16a34a; }

/* ---------------- atamalar ---------------- */
#assignments-container { display: flex; flex-direction: column; gap: 16px; }
.card {
  background: var(--card); border-radius: 12px; padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.card h3 { margin: 0 0 10px; font-size: 15px; }
table.assign { border-collapse: collapse; width: 100%; font-size: 13px; }
table.assign th, table.assign td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; }
table.assign th { color: var(--muted); font-weight: 600; font-size: 12px; }
table.assign input[type="number"] { width: 56px; }
.check-group { display: flex; gap: 8px; }
.check-group label { display: flex; align-items: center; gap: 3px; font-size: 12px; white-space: nowrap; }
.placed-info { font-size: 11px; color: var(--muted); }
.placed-info.full { color: #16a34a; font-weight: 600; }

/* ---------------- tanımlar ---------------- */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.def-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.def-row input[type="text"] { flex: 1; }
.def-row input[type="color"] { width: 34px; height: 28px; padding: 1px; border: 1px solid var(--line); border-radius: 6px; }
.add-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.add-row input[type="text"] { flex: 1; min-width: 120px; }
.pwd-form { display: flex; flex-direction: column; gap: 8px; max-width: 240px; }
.icon-btn { background: none; border: none; cursor: pointer; font-size: 15px; color: var(--muted); }
.icon-btn:hover { color: var(--danger); }

/* ---------------- öğretmen görünümü ---------------- */
#teacher-table td.cell { min-width: 92px; }
.mini-chip {
  border-radius: 6px; padding: 2px 5px; font-size: 11px; font-weight: 600; color: #fff;
  margin: 2px 0; text-shadow: 0 1px 1px rgba(0,0,0,.25);
}
.mini-chip.conflict { outline: 2px solid #dc2626; }

/* ---------------- toast ---------------- */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(80px);
  background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 10px;
  font-size: 14px; opacity: 0; transition: all .25s; z-index: 100; pointer-events: none;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }
.cell.disabled{background:#f1f5f9;cursor:not-allowed;opacity:.4}
