:root {
  --bg: #f8fafc; --card: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --brand: #1f4e79; --brand-2: #2b6cb0; --on-brand: #ffffff;
  --ok: #10b981; --ok-bg: #ecfdf5; --warn: #f59e0b; --warn-bg: #fffbeb;
  --bad: #ef4444; --bad-bg: #fef2f2; --idle: #64748b; --idle-bg: #f1f5f9;
  --radius: 12px; --nav-h: 60px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090d12; --card: #131b24; --text: #f1f5f9; --muted: #94a3b8; --line: #222f3e;
    --brand: #4a8fd0; --brand-2: #60a5fa; --on-brand: #0b1117;
    --ok: #34d399; --ok-bg: #064e3b; --warn: #fbbf24; --warn-bg: #451a03;
    --bad: #f87171; --bad-bg: #450a0a; --idle: #94a3b8; --idle-bg: #1e293b;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: 1.25rem; font-weight: 700; margin: 0 0 .75rem; letter-spacing: -0.015em; color: var(--text); }
h2 { font-size: 1.05rem; font-weight: 600; margin: 1.15rem 0 .5rem; letter-spacing: -0.01em; color: var(--text); }
a { color: var(--brand); text-decoration: none; transition: color .15s; }
a:hover { color: var(--brand-2); }
.muted { color: var(--muted); }
.small { font-size: .8rem; }

.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .6rem;
  background: var(--card); color: var(--text); border-bottom: 2px solid var(--brand);
  padding: .5rem 1rem; padding-top: calc(.5rem + env(safe-area-inset-top));
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.topbar .brand { height: 34px; width: auto; border-radius: 6px; flex: none; }
.topbar .title { font-weight: 700; flex: 1; font-size: 1rem; color: var(--brand); }
.topbar button { background: transparent; border: 0; color: var(--text); font-size: 1.15rem; padding: .25rem .5rem; position: relative; min-height: 38px; cursor: pointer; }
@media (prefers-color-scheme: dark) {
  .topbar .brand { background: #fff; padding: 2px; }
  .login .logo { background: #fff; padding: 12px; border-radius: 16px; }
}
.bell-badge {
  position: absolute; top: -1px; right: -1px; background: var(--bad); color: #fff; border-radius: 99px;
  font-size: .65rem; min-width: 17px; padding: 0 4px; line-height: 17px; text-align: center; font-weight: 700;
}
main { max-width: 760px; margin: 0 auto; padding: 1rem; }

.nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
}
.nav a {
  flex: 1; text-align: center; padding: .45rem .2rem; color: var(--muted); font-size: .72rem; position: relative; min-height: var(--nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-weight: 500;
}
.nav a .ico { font-size: 1.25rem; line-height: 1; }
.nav a.active { color: var(--brand); font-weight: 700; }
.nav .badge { position: absolute; top: 5px; left: calc(50% + 6px); background: var(--bad); color: #fff; border-radius: 99px; font-size: .65rem; min-width: 16px; line-height: 16px; }

/* Kartlar */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem 1.05rem; margin-bottom: .75rem; box-shadow: 0 1px 3px rgba(0,0,0,0.02);
  transition: all .15s ease-in-out;
}
a.card { display: block; color: inherit; }
a.card:hover { border-color: #cbd5e1; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.05); }
.balance {
  background: linear-gradient(135deg, #1f4e79 0%, #153857 100%);
  color: var(--on-brand); border: 0; box-shadow: 0 4px 14px rgba(31, 78, 121, 0.28);
}
.balance .big { font-size: 2.2rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; }
.balance .grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: .75rem; font-size: .78rem; opacity: .95; }
.balance .grid b { display: block; font-size: 1.02rem; }
.balance .note { margin-top: .6rem; font-size: .82rem; background: rgba(255,255,255,.16); padding: .35rem .6rem; border-radius: 8px; }
@media (prefers-color-scheme: dark) { .balance .note { background: rgba(0,0,0,.25); } }

.row { display: flex; align-items: center; gap: .6rem; justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: .65rem; }
.chip { display: inline-flex; align-items: center; padding: .15rem .55rem; border-radius: 99px; font-size: .75rem; font-weight: 600; white-space: nowrap; line-height: 1.35; }
.chip.pending { background: var(--warn-bg); color: var(--warn); }
.chip.approved { background: var(--ok-bg); color: var(--ok); }
.chip.rejected, .chip.cancelled { background: var(--bad-bg); color: var(--bad); }
.chip.withdrawn { background: var(--idle-bg); color: var(--idle); }

/* Kompakt Butonlar */
button, .btn {
  font: inherit; border: 0; border-radius: 8px; padding: .45rem .85rem; background: var(--brand); color: var(--on-brand);
  font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; text-align: center;
  min-height: 38px; font-size: .88rem; transition: all .15s ease-in-out; line-height: 1.25;
}
button:hover, .btn:hover { filter: brightness(1.06); }
button.secondary, .btn.secondary { background: var(--idle-bg); color: var(--text); border: 1px solid var(--line); }
button.secondary:hover, .btn.secondary:hover { background: #e2e8f0; }
button.danger { background: var(--bad); color: #fff; }
button.ok { background: var(--ok); color: #fff; }
@media (prefers-color-scheme: dark) {
  button.secondary:hover, .btn.secondary:hover { background: #2a3749; }
  button.ok, button.danger { color: #0b1520; }
  button.ok { background: #34d399; }
  button.danger { background: #f87171; }
}
button.small { min-height: 30px; padding: .25rem .6rem; font-size: .8rem; border-radius: 6px; }
button:disabled { opacity: .5; cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .65rem; }
.actions > * { flex: 1 1 130px; }

/* Kompakt Form Elemanları (A+ SaaS Standardı) */
label { display: block; font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: .25rem; }
input, select, textarea {
  width: 100%; font: inherit; font-size: .88rem; color: var(--text); background: var(--card); border: 1px solid var(--line);
  border-radius: 8px; padding: .45rem .7rem; min-height: 38px; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31, 78, 121, 0.12);
}
textarea { min-height: 72px; resize: vertical; line-height: 1.4; }
.check { display: flex; align-items: center; gap: .5rem; color: var(--text); font-size: .88rem; margin: 0; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; min-height: 0; cursor: pointer; }
.field { margin-bottom: .75rem; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem; }
.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; }

.alert { padding: .65rem .85rem; border-radius: 8px; margin-bottom: .75rem; font-size: .88rem; line-height: 1.4; border: 1px solid transparent; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border-color: rgba(245, 158, 11, 0.2); }
.alert.bad { background: var(--bad-bg); color: var(--bad); border-color: rgba(239, 68, 68, 0.2); }
.alert.ok { background: var(--ok-bg); color: var(--ok); border-color: rgba(16, 185, 129, 0.2); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: .65rem; padding: .5rem 0; border-top: 1px solid var(--line); font-size: .88rem; }
.timeline li:first-child { border-top: 0; }
.dot { width: 20px; height: 20px; border-radius: 50%; flex: none; display: grid; place-items: center; font-size: .75rem; margin-top: 2px; background: var(--idle-bg); color: var(--idle); }
.dot.approved { background: var(--ok-bg); color: var(--ok); }
.dot.rejected { background: var(--bad-bg); color: var(--bad); }
.dot.pending { background: var(--warn-bg); color: var(--warn); }

.tabs { display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .75rem; -webkit-overflow-scrolling: touch; }
.tabs a { white-space: nowrap; padding: .35rem .75rem; border-radius: 8px; background: var(--idle-bg); color: var(--text); font-size: .84rem; font-weight: 600; border: 1px solid var(--line); transition: all .15s; }
.tabs a.active { background: var(--brand); color: #fff; border-color: var(--brand); box-shadow: 0 2px 6px rgba(31, 78, 121, 0.22); }

/* ==========================================================================
   Modern Kurumsal Giriş Tasarımı & PWA Entegrasyonu
   ========================================================================== */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 1rem;
  background: radial-gradient(circle at 50% 0%, #1e456b 0%, #0d2238 60%, #091726 100%);
  position: relative;
  overflow: hidden;
}
.auth-page::before {
  content: '';
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 350px;
  background: radial-gradient(circle, rgba(74, 143, 208, 0.15) 0%, transparent 70%);
  pointer-events: none;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border-radius: 18px;
  padding: 1.75rem 1.75rem 1.5rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(255, 255, 255, 0.1);
  position: relative;
  z-index: 2;
  animation: authCardIn .3s ease-out;
}
@media (prefers-color-scheme: dark) {
  .auth-card {
    background: #17212c;
    border: 1px solid #283747;
    box-shadow: 0 20px 48px rgba(0, 0, 0, 0.5);
  }
}
@keyframes authCardIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.auth-card-header {
  text-align: center;
  margin-bottom: 1.15rem;
}
.auth-card-logo {
  height: 42px;
  max-width: 210px;
  width: auto;
  object-fit: contain;
  margin-bottom: .5rem;
  display: inline-block;
}
.auth-card-title {
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 .15rem;
  line-height: 1.2;
}
.auth-card-desc {
  font-size: .78rem;
  color: var(--muted);
  margin: 0;
}

/* Kompakt Segmented Control */
.auth-tabs {
  display: flex;
  background: var(--idle-bg);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 1rem;
  border: 1px solid var(--line);
}
.auth-tab {
  flex: 1;
  text-align: center;
  padding: .45rem .25rem;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: var(--muted);
  border: 0;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  transition: all .15s ease-in-out;
}
.auth-tab.active {
  background: var(--brand);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(31, 78, 121, 0.25);
}

/* Modül Seçici Hap */
.auth-modules {
  display: flex;
  gap: .35rem;
  margin-bottom: .9rem;
}
.auth-mod-btn {
  flex: 1;
  padding: .4rem .5rem;
  border-radius: 8px;
  font-size: .76rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-height: 32px;
  transition: all .15s;
}
.auth-mod-btn.active {
  background: rgba(31, 78, 121, 0.08);
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 700;
}
@media (prefers-color-scheme: dark) {
  .auth-mod-btn.active {
    background: rgba(74, 143, 208, 0.16);
    color: var(--brand);
  }
}

/* Kompakt Form Elemanları */
.auth-form .field {
  margin-bottom: .75rem;
}
.auth-form label {
  font-size: .78rem;
  font-weight: 600;
  margin-bottom: .2rem;
  color: var(--text);
}
.auth-form input {
  min-height: 38px;
  font-size: .88rem;
  padding: .45rem .7rem;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--card);
}
.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.auth-input-wrap input {
  padding-right: 36px;
}
.auth-pw-toggle {
  position: absolute;
  right: 3px;
  background: transparent !important;
  border: 0 !important;
  color: var(--muted);
  cursor: pointer;
  padding: .25rem;
  min-height: 30px;
  font-size: 1rem;
  line-height: 1;
}
.auth-submit {
  width: 100%;
  margin-top: .3rem;
  min-height: 40px;
  font-size: .88rem;
  font-weight: 700;
  border-radius: 8px;
  background: linear-gradient(135deg, #1f4e79 0%, #153857 100%);
  box-shadow: 0 4px 12px rgba(31, 78, 121, 0.28);
}
.auth-card-footer {
  text-align: center;
  margin-top: 1rem;
  padding-top: .85rem;
  border-top: 1px solid var(--line);
  font-size: .72rem;
  color: var(--muted);
  line-height: 1.4;
}

/* PWA Kurulum Butonu & Rozeti */
.pwa-box {
  margin-top: .85rem;
  padding: .65rem .8rem;
  background: var(--idle-bg);
  border-radius: 10px;
  border: 1px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}
.pwa-box-text {
  font-size: .76rem;
  color: var(--text);
  font-weight: 500;
}
.pwa-install-btn {
  padding: .35rem .7rem;
  font-size: .76rem;
  min-height: 30px;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  border: 0;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  white-space: nowrap;
}

/* iOS Kurulum Rehberi Modalı */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn .2s ease;
}
.modal-card {
  background: var(--card);
  border-radius: 18px;
  max-width: 440px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  border: 1px solid var(--line);
  position: relative;
  animation: scaleIn .25s ease-out;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .4rem;
}
.modal-close {
  background: var(--idle-bg);
  border: 0;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
}
.ios-steps {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  margin: 1rem 0;
}
.ios-step {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem .85rem;
  border-radius: 10px;
  background: var(--idle-bg);
  border: 1px solid var(--line);
}
.ios-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.ios-step-content {
  font-size: .84rem;
  line-height: 1.35;
  color: var(--text);
}
.ios-step-content b {
  color: var(--brand);
}

/* Sidebar Kullanıcı & Yetkili Kartı */
.sidebar-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: .35rem;
}
.role-badge {
  font-size: .68rem;
  font-weight: 700;
  padding: .12rem .45rem;
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  line-height: 1.3;
}
.role-badge.super {
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
}
.role-badge.ik {
  background: var(--brand);
  color: var(--on-brand);
}
.role-badge.zimmet {
  background: var(--ok);
  color: #fff;
}
.role-badge.viewer {
  background: var(--idle);
  color: #fff;
}
.admin-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .7rem;
  color: var(--ok);
  font-weight: 600;
  margin-top: .25rem;
}
.admin-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 5px var(--ok);
}

.login { max-width: 400px; margin: 0 auto; padding: 4vh 1.25rem 2rem; }
.login .logo { width: 190px; max-width: 65%; height: auto; display: block; margin: 0 auto 1rem; }
.login h1 { text-align: center; }
.zphoto { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); margin: .3rem .3rem 0 0; display: block; }
.empty { text-align: center; color: var(--muted); padding: 1.75rem 1rem; font-size: .88rem; }
.kv { display: grid; grid-template-columns: 8rem 1fr; gap: .25rem .55rem; font-size: .88rem; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-weight: 500; }

/* Tablolar (A+ Standartları) */
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .86rem; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); margin-top: .4rem; }
table.t td, table.t th { padding: .45rem .6rem; border-top: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.t tr:first-child td, table.t tr:first-child th { border-top: 0; }
table.t tr:hover td { background: rgba(31, 78, 121, 0.035); }
table.t input { min-height: 32px; padding: .25rem .5rem; font-size: .82rem; }

#toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: .65rem 1rem; border-radius: 10px; max-width: 90vw; opacity: 0; pointer-events: none;
  transition: .2s ease; z-index: 2000; font-size: .86rem; font-weight: 500; box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.bad { background: var(--bad); color: #fff; }

/* Raporlar & KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .55rem; margin-bottom: .75rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .65rem .75rem; box-shadow: 0 1px 2px rgba(0,0,0,0.02); }
.kpi .v { font-size: 1.25rem; font-weight: 700; color: var(--brand); line-height: 1.2; letter-spacing: -0.01em; }
.kpi .l { font-size: .75rem; color: var(--muted); margin-top: .15rem; font-weight: 500; }
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; border: 1px solid var(--line); }
table.rep { border-collapse: separate; border-spacing: 0; font-size: .8rem; width: 100%; white-space: nowrap; }
table.rep th { background: var(--brand); color: var(--on-brand); padding: .45rem .6rem; text-align: left; position: sticky; top: 0; font-weight: 600; }
table.rep td { padding: .4rem .6rem; border-top: 1px solid var(--line); }
table.rep tr:hover td { background: rgba(31, 78, 121, 0.035); }
table.rep .num { text-align: right; font-variant-numeric: tabular-nums; }
table.rep tr.total td { font-weight: 700; background: var(--idle-bg); }
table.rep th:first-child, table.rep td:first-child { position: sticky; left: 0; background: var(--card); }
table.rep th:first-child { background: var(--brand); }
table.rep tr.total td:first-child { background: var(--idle-bg); }
.chart.columns { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 1rem; }
.chart.columns .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.chart .bar { background: var(--brand-2); border-radius: 4px 4px 0 0; width: 100%; }
.chart.columns .val { font-size: .6rem; color: var(--muted); }
.chart.columns .lbl { font-size: .6rem; color: var(--muted); margin-top: 3px; }
.chart.hbars { display: flex; flex-direction: column; gap: .45rem; }
.hrow { display: grid; grid-template-columns: 7.5rem 1fr 3rem; align-items: center; gap: .5rem; font-size: .78rem; }
.hrow .lbl { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.hrow .track { background: var(--idle-bg); border-radius: 5px; height: 12px; overflow: hidden; }
.hrow .bar { height: 100%; border-radius: 0 5px 5px 0; }
.hrow .val { text-align: right; color: var(--muted); }

input:disabled { background: var(--idle-bg); color: var(--muted); cursor: not-allowed; }

/* İzin yükü renkleri */
:root { --hi-bg: #ffe3c8; --hi: #a14a00; --crit-bg: #fbc9c4; }
@media (prefers-color-scheme: dark) { :root { --hi-bg: #4a2c12; --hi: #f4b27a; --crit-bg: #5a2420; } }
table.rep tr.tone-ok td { background: var(--ok-bg); }
table.rep tr.tone-warn td { background: var(--warn-bg); }
table.rep tr.tone-high td { background: var(--hi-bg); }
table.rep tr.tone-crit td { background: var(--crit-bg); }
table.rep tr.tone-idle td { background: var(--idle-bg); }
.lvl { display: inline-block; padding: .1rem .5rem; border-radius: 99px; font-size: .72rem; font-weight: 600; white-space: nowrap; }
.lvl.ok { background: var(--ok-bg); color: var(--ok); }
.lvl.warn { background: var(--warn-bg); color: var(--warn); }
.lvl.high { background: var(--hi-bg); color: var(--hi); }
.lvl.crit { background: var(--crit-bg); color: var(--bad); }
.lvl.idle { background: var(--idle-bg); color: var(--idle); }
table.rep tr[class*="tone-"] .lvl { border: 1px solid rgba(0,0,0,.1); }
.legend { display: flex; flex-wrap: wrap; gap: .35rem; margin: 0 0 .55rem; }

table.rep td:first-child, table.rep th:first-child { white-space: normal; min-width: 6.5rem; max-width: 8.5rem; }
table.rep td:nth-child(2), table.rep td:nth-child(3) { padding-left: .35rem; padding-right: .35rem; }

/* İnteraktif İzin Takvimi (HRMS Standardı) */
.cal-wrap { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem; margin-bottom: .85rem; }
.cal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .65rem; }
.cal-title { font-weight: 700; font-size: .95rem; color: var(--text); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal-head-cell { font-size: .72rem; font-weight: 700; color: var(--muted); padding: .25rem 0; }
.cal-cell {
  aspect-ratio: 1; min-height: 38px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 8px; font-size: .8rem; font-weight: 500; cursor: pointer; border: 1px solid transparent; transition: all .12s; position: relative;
  background: var(--card);
}
.cal-cell:hover { background: var(--idle-bg); border-color: var(--line); }
.cal-cell.today { border-color: var(--brand); font-weight: 700; color: var(--brand); }
.cal-cell.selected { background: var(--brand) !important; color: #fff !important; }
.cal-cell.has-leaves { background: var(--warn-bg); color: var(--warn); font-weight: 700; }
.cal-cell.empty { opacity: .2; cursor: default; }
.cal-badge { font-size: .62rem; line-height: 1; padding: 2px 4px; border-radius: 4px; background: rgba(0,0,0,.08); margin-top: 2px; }
.cal-cell.selected .cal-badge { background: rgba(255,255,255,.3); color: #fff; }

/* Duyuru ve İK Bülten Kartı */
.bulletin-box {
  background: linear-gradient(135deg, rgba(31, 78, 121, 0.06) 0%, rgba(47, 111, 167, 0.02) 100%);
  border: 1px solid rgba(31, 78, 121, 0.2);
  border-radius: var(--radius);
  padding: .85rem 1rem;
  margin-bottom: .85rem;
}
.bulletin-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-weight: 700;
  font-size: .88rem;
  color: var(--brand);
  margin-bottom: .3rem;
}
.bulletin-text {
  font-size: .82rem;
  color: var(--text);
  line-height: 1.4;
}

/* ==========================================================================
   Masaüstü / Web Arayüzü: Sidebar & Responsive Düzen
   ========================================================================== */
.sidebar { display: none; }
.app-layout { min-height: 100vh; }
.main-wrapper { min-width: 0; width: 100%; }

@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .nav { display: none !important; }

  .app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
  }

  /* Sabit Kenar Çubuğu (Sidebar) */
  .sidebar {
    display: flex;
    flex-direction: column;
    width: 260px;
    flex-shrink: 0;
    height: 100vh;
    position: sticky;
    top: 0;
    background: var(--card);
    border-right: 1px solid var(--line);
    padding: 1.15rem .9rem;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.02);
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .2rem .4rem .9rem;
    border-bottom: 1px solid var(--line);
    margin-bottom: .9rem;
  }
  .sidebar-brand .logo {
    height: 36px;
    max-width: 190px;
    width: auto;
    object-fit: contain;
  }
  @media (prefers-color-scheme: dark) {
    .sidebar-brand .logo {
      background: rgba(255, 255, 255, 0.95);
      padding: 3px 6px;
      border-radius: 6px;
    }
  }

  /* Modül Değiştirici Kapsül */
  .sidebar-module-switch {
    background: var(--idle-bg);
    border-radius: 10px;
    padding: .45rem .65rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
    border: 1px solid var(--line);
  }
  .sidebar-module-switch .mod-name {
    font-size: .8rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: .35rem;
  }
  .sidebar-module-switch button {
    padding: .15rem .5rem;
    min-height: 26px;
    font-size: .72rem;
    border-radius: 6px;
    background: var(--brand);
    color: var(--on-brand);
  }

  /* Navigasyon Linkleri */
  .sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: .25rem;
    flex: 1;
    overflow-y: auto;
    padding-right: .2rem;
  }
  .sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .55rem .75rem;
    border-radius: 8px;
    color: var(--text);
    font-size: .86rem;
    font-weight: 500;
    transition: all .12s ease-in-out;
    position: relative;
  }
  .sidebar-nav a .ico {
    font-size: 1.15rem;
    line-height: 1;
    width: 22px;
    text-align: center;
  }
  .sidebar-nav a:hover {
    background: var(--idle-bg);
    color: var(--brand);
  }
  .sidebar-nav a.active {
    background: var(--brand);
    color: var(--on-brand);
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(31, 78, 121, 0.22);
  }
  .sidebar-nav a .badge {
    margin-left: auto;
    background: var(--bad);
    color: #fff;
    border-radius: 99px;
    font-size: .68rem;
    font-weight: 700;
    padding: .1rem .45rem;
    min-width: 18px;
    text-align: center;
  }
  .sidebar-nav a.active .badge {
    background: #fff;
    color: var(--bad);
  }

  /* Kullanıcı Alt Alanı */
  .sidebar-footer {
    border-top: 1px solid var(--line);
    padding-top: .85rem;
    margin-top: .4rem;
    display: flex;
    flex-direction: column;
    gap: .5rem;
  }
  .sidebar-user {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .35rem .45rem;
    border-radius: 8px;
    background: var(--idle-bg);
  }
  .sidebar-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--brand);
    color: var(--on-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: .88rem;
    flex-shrink: 0;
  }
  .sidebar-user-info {
    flex: 1;
    min-width: 0;
  }
  .sidebar-user-name {
    font-size: .84rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar-user-role {
    font-size: .72rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    font-size: .78rem;
    color: var(--bad);
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: .35rem;
    min-height: 30px;
    cursor: pointer;
    font-weight: 600;
    width: 100%;
    transition: background .12s;
  }
  .sidebar-logout:hover {
    background: var(--bad-bg);
  }

  /* Sağ İçerik Alanı */
  .main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .topbar {
    padding: .75rem 2rem;
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand { display: none; }
  .topbar .title { font-size: 1.15rem; }

  main {
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 1.5rem 2rem;
  }

  .desktop-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: .85rem;
  }
}
