:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7785;
  --line: #e3e8ee;
  --brand: #1f6feb;
  --brand-dark: #1755b8;
  --green: #1f9d55;
  --red: #d64545;
  --chip: #eef3fb;
  --chip-ink: #1f6feb;
  --pot: #fff4e0;
  --pot-ink: #b66a00;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", Roboto, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
}
.hidden { display: none !important; }

/* ---------- Login ---------- */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #1f6feb, #11398a);
}
.login-card {
  background: #fff; padding: 36px 32px; border-radius: 14px;
  width: 340px; box-shadow: 0 20px 50px rgba(0,0,0,.3);
  display: flex; flex-direction: column; gap: 14px;
}
.login-card h1 { font-size: 20px; margin: 0; text-align: center; }
.login-sub { margin: 0 0 6px; color: var(--muted); text-align: center; font-size: 13px; }
.login-card label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; }
.login-card input { padding: 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.login-card button {
  margin-top: 6px; padding: 11px; background: var(--brand); color: #fff;
  border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.login-card button:hover { background: var(--brand-dark); }
.login-hint { text-align: center; color: var(--muted); font-size: 12px; margin: 4px 0 0; }
.error-msg { color: var(--red); font-size: 13px; min-height: 18px; text-align: center; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 230px; background: #16243a; color: #cdd7e5;
  display: flex; flex-direction: column; flex-shrink: 0;
}
.brand {
  padding: 20px; font-size: 17px; font-weight: 700; color: #fff;
  line-height: 1.25; border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-btn {
  text-align: left; background: transparent; color: #cdd7e5; border: none;
  padding: 11px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500;
}
.nav-btn:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-btn.active { background: var(--brand); color: #fff; }
.nav-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: #6b7a90; padding: 14px 14px 4px; }
.sidebar-foot {
  padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08);
  display: flex; flex-direction: column; gap: 8px; font-size: 13px;
}
.foot-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.foot-actions { display: flex; gap: 14px; }
.link-btn { background: none; border: none; color: #8fb4f5; cursor: pointer; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

.content { flex: 1; padding: 26px 30px; overflow-x: auto; }

/* ---------- Headings & toolbar ---------- */
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.page-head h1 { font-size: 22px; margin: 0; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------- Buttons ---------- */
.btn { padding: 9px 16px; border: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-light { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-light:hover { background: #f0f3f7; }
.btn-danger { background: #fde7e7; color: var(--red); }
.btn-danger:hover { background: #f9d3d3; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.icon-btn { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--muted); }
.icon-btn:hover { color: var(--ink); }

/* ---------- Cards / tables ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { background: #f7f9fc; color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f9fbfd; }
.row-actions { display: flex; gap: 6px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ---------- Chips ---------- */
.chip { display: inline-block; background: var(--chip); color: var(--chip-ink); padding: 3px 9px; border-radius: 20px; font-size: 12px; margin: 2px 3px 2px 0; }
.chip.pot { background: var(--pot); color: var(--pot-ink); }
.chip.status { background: #eaf6ee; color: var(--green); }
.chip-row { display: flex; flex-wrap: wrap; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff;
}
.field textarea { resize: vertical; min-height: 60px; }
.field select[multiple] { min-height: 120px; }
.hint { font-size: 11px; color: var(--muted); }

.checks { border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 170px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; background: #fff; }
.checks label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 13px; color: var(--ink); cursor: pointer; }
.checks input { width: auto; }

.pot-box { background: var(--pot); border: 1px dashed #f0c886; border-radius: 8px; padding: 12px; min-height: 44px; }
.pot-box .empty-inline { color: var(--pot-ink); opacity: .7; font-size: 13px; }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(16,24,40,.5); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow-y: auto; z-index: 50; }
.modal { background: #fff; border-radius: 14px; width: 720px; max-width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); }

.section-title { font-size: 13px; font-weight: 700; color: var(--ink); margin: 22px 0 10px; text-transform: uppercase; letter-spacing: .3px; }

/* ---------- Admin ---------- */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }
.admin-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.admin-card h3 { margin: 0; padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--line); }
.admin-list { list-style: none; margin: 0; padding: 8px; flex: 1; max-height: 240px; overflow-y: auto; }
.admin-list li { display: flex; justify-content: space-between; align-items: center; padding: 7px 10px; border-radius: 6px; font-size: 13px; }
.admin-list li:hover { background: #f6f8fb; }
.admin-add { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.admin-add input { flex: 1; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.del-x { background: none; border: none; color: var(--red); cursor: pointer; font-size: 15px; opacity: .55; }
.del-x:hover { opacity: 1; }

/* ---------- Toast ---------- */
.toast { position: fixed; bottom: 24px; right: 24px; background: #16243a; color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.25); z-index: 100; font-size: 13px; }
.toast.err { background: var(--red); }

.search-box { padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; width: 240px; }

/* Admin - rol seçimi & ekleme */
.admin-add select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }
.role-sel { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; background: #fff; }

/* Yetki matrisi */
.perm-grid th { background: #f7f9fc; }
.perm-grid td, .perm-grid th { padding: 9px 12px; }
.perm-grid input[type="checkbox"] { width: 17px; height: 17px; cursor: pointer; }
.perm-grid input[type="checkbox"]:disabled { cursor: not-allowed; opacity: .55; }
