:root {
  --bg: #f3f5f9;
  --sidebar: #0f172a;
  --sidebar-2: #1e293b;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --primary: #2563eb;
  --primary-2: #3b82f6;
  --primary-soft: #dbeafe;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --muted: #64748b;
  --card: #ffffff;
  --border: #e5e9f2;
  --text: #0f172a;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .08);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, .08), 0 2px 6px rgba(15, 23, 42, .05);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .16);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Tahoma, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }

::selection { background: var(--primary-soft); }

.icon { vertical-align: -3px; }

/* ---------- Yerleşim ---------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  background: linear-gradient(180deg, #0b1220 0%, #101b33 55%, #172554 100%);
  color: var(--sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  padding: 20px 22px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(148, 163, 184, .12);
}

.sidebar .brand .logo {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), #7c3aed);
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, .45);
  overflow: hidden;
}

.sidebar .brand .logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  padding: 3px;
}

.sidebar .brand .title { font-size: 15px; font-weight: 700; color: #fff; line-height: 1.2; }
.sidebar .brand .title span { display: block; font-size: 10.5px; font-weight: 500; color: #7d8db1; letter-spacing: .03em; }

.sidebar nav { flex: 1; padding: 14px 12px; overflow-y: auto; }

.sidebar .nav-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #5b6b8f;
  padding: 8px 12px 6px;
  font-weight: 600;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  margin: 2px 0;
  border-radius: 10px;
  color: var(--sidebar-text);
  font-weight: 500;
  font-size: 13.5px;
  position: relative;
  transition: background .15s ease, color .15s ease;
}

.sidebar nav a .icon { opacity: .85; }

.sidebar nav a:hover { background: rgba(148, 163, 184, .1); color: #e2e8f0; }

.sidebar nav a.active {
  background: linear-gradient(90deg, rgba(37, 99, 235, .9), rgba(59, 130, 246, .75));
  color: #fff;
  box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
}

.sidebar nav a.active .icon { opacity: 1; }

.sidebar .userbox {
  padding: 14px 20px;
  border-top: 1px solid rgba(148, 163, 184, .12);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar .userbox .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(148, 163, 184, .2);
  display: grid; place-items: center;
  color: #cbd5e1;
  flex-shrink: 0;
}

.sidebar .userbox .meta { min-width: 0; }
.sidebar .userbox .meta .name { color: #e2e8f0; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar .userbox .meta .role { color: #5b6b8f; font-size: 11px; }
.sidebar .userbox a.logout { margin-left: auto; color: #7d8db1; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.sidebar .userbox a.logout:hover { background: rgba(220, 38, 38, .18); color: #fca5a5; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 15px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar h1 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.topbar .user { color: var(--muted); font-size: 13px; }
.topbar .user strong { color: var(--text); }

.content { padding: 26px 28px 40px; flex: 1; }

/* ---------- Kartlar ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 22px;
  overflow: hidden;
}

.card .card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 14.5px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: linear-gradient(180deg, #fbfcfe 0%, #ffffff 100%);
}

.card .card-body { padding: 20px; }
.card .card-body.flat { padding: 0; }

/* ---------- Tablolar ---------- */
table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th {
  background: #f8fafc;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}
.table tbody tr { transition: background .12s ease; }
.table tbody tr:hover { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  background: var(--primary);
  color: #fff;
  transition: all .15s ease;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .1);
}
.btn:hover { background: var(--primary-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.btn:active { transform: translateY(0); }
.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: 8px; }
.btn-outline { background: transparent; color: var(--primary); border-color: #bfdbfe; box-shadow: none; }
.btn-outline:hover { background: var(--primary-soft); color: var(--primary); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-warning { background: var(--warning); }
.btn-warning:hover { background: #b45309; }
.btn-secondary { background: #475569; }
.btn-secondary:hover { background: #334155; }
.btn-block { display: flex; width: 100%; justify-content: center; }

/* ---------- Form ---------- */
.form-group { margin-bottom: 17px; }
.form-group label { display: block; margin-bottom: 7px; font-weight: 600; font-size: 13px; }
.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }
textarea.form-control { resize: vertical; min-height: 76px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; }
.form-grid .full { grid-column: 1 / -1; }

/* ---------- Rozetler ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--success-soft); color: #15803d; }
.badge-danger  { background: var(--danger-soft); color: #b91c1c; }
.badge-warning { background: var(--warning-soft); color: #b45309; }
.badge-muted   { background: #e2e8f0; color: #475569; }

/* ---------- İstatistikler ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease;
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat .chip {
  width: 48px; height: 48px;
  border-radius: 13px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.stat .num { font-size: 24px; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; }
.stat .lbl { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.stat.blue .chip { background: var(--primary-soft); color: var(--primary); } .stat.blue .num { color: var(--primary); }
.stat.green .chip { background: var(--success-soft); color: var(--success); } .stat.green .num { color: #15803d; }
.stat.red .chip { background: var(--danger-soft); color: var(--danger); } .stat.red .num { color: #b91c1c; }
.stat.orange .chip { background: var(--warning-soft); color: var(--warning); } .stat.orange .num { color: #b45309; }
.stat.violet .chip { background: #ede9fe; color: #7c3aed; } .stat.violet .num { color: #6d28d9; }

/* ---------- Bildirimler ---------- */
.alert { padding: 13px 17px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: 13.5px; display: flex; align-items: center; gap: 10px; }
.alert-success { background: var(--success-soft); color: #15803d; border: 1px solid #bbf7d0; }
.alert-danger  { background: var(--danger-soft); color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-soft); color: #b45309; border: 1px solid #fde68a; }
.alert-info    { background: var(--primary-soft); color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ---------- Fatura / Detay ---------- */
.meta-list { list-style: none; }
.meta-list li { padding: 8px 0; border-bottom: 1px dashed var(--border); display: flex; gap: 8px; }
.meta-list li:last-child { border-bottom: none; }
.meta-list .k { color: var(--muted); flex-shrink: 0; min-width: 150px; }
.invoice-total { font-size: 24px; font-weight: 800; color: var(--primary); text-align: right; padding-top: 14px; border-top: 2px solid var(--border); letter-spacing: -.02em; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.nowrap { white-space: nowrap; }

/* ---------- Sayfalama ---------- */
.pagination { display: flex; gap: 6px; margin-top: 14px; }
.pagination a, .pagination span {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 500;
  transition: all .12s ease;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Araç çubuğu ---------- */
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 12px; }
.search { padding: 9px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; font-family: inherit; }
.search:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, .13); }

/* ---------- Giriş ---------- */
.guest-body {
  background: linear-gradient(135deg, #0b1220 0%, #101b33 45%, #172554 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.guest-card {
  background: #fff;
  border-radius: 20px;
  width: 410px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.guest-card .head {
  padding: 34px 34px 26px;
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  color: #fff;
}
.guest-card .head .logo {
  width: 54px; height: 54px;
  border-radius: 15px;
  background: rgba(255, 255, 255, .18);
  display: grid; place-items: center;
  margin-bottom: 16px;
  backdrop-filter: blur(4px);
}
.guest-card .head h1 { font-size: 22px; font-weight: 800; letter-spacing: -.01em; }
.guest-card .head .sub { color: rgba(255, 255, 255, .8); font-size: 13px; margin-top: 4px; }
.guest-card .body { padding: 28px 34px 34px; }
.guest-card .foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }

/* ---------- Seçim kutuları ---------- */
.selection-box { border: 1px solid var(--border); border-radius: var(--radius-sm); max-height: 280px; overflow: auto; }
.selection-box label { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background .12s ease; }
.selection-box label:last-child { border-bottom: none; }
.selection-box label:hover { background: #f8fafc; }
.selection-box input[type="checkbox"] { accent-color: var(--primary); width: 16px; height: 16px; }

.footer-note { text-align: center; color: var(--muted); font-size: 12px; padding: 16px; }

/* ---------- Yuvarlatılmış üst halka ---------- */
.kpi-row { display: flex; align-items: center; }

/* ---------- Sorumlu (responsive) ---------- */
@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .sidebar nav a { flex: 1 1 auto; }
  .sidebar .nav-label { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
  .content { padding: 16px; }
  .table { font-size: 13px; }
}