:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #eef1f6;
  --text: #16202a;
  --text-muted: #5b6b7a;
  --border: #dde3ea;
  --brand: #144b8c;
  --brand-dark: #0d3766;
  --brand-contrast: #ffffff;
  --ok-bg: #e5f6ea;
  --ok-text: #146c2e;
  --warn-bg: #fff4e0;
  --warn-text: #94590a;
  --danger-bg: #fdeaea;
  --danger-text: #b31f1f;
  --danger: #c62828;
  --shadow: 0 1px 3px rgba(20, 30, 45, .08), 0 1px 2px rgba(20, 30, 45, .06);
  --radius: 12px;
  --touch: 48px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}

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

img { max-width: 100%; }

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 12px 14px 90px;
}

/* ---------- Ust bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--brand);
  color: var(--brand-contrast);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  box-shadow: var(--shadow);
}
.topbar a.brand {
  color: var(--brand-contrast);
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar .user-chip {
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: 8px;
}
.topbar form { display: inline; }
.lang-switch {
  font-size: .78rem;
  display: flex;
  align-items: center;
  gap: 4px;
}
.lang-switch a {
  color: inherit;
  text-decoration: none;
  opacity: .55;
  padding: 3px 6px;
  border-radius: 6px;
}
.lang-switch a.active {
  opacity: 1;
  font-weight: 700;
  background: rgba(255,255,255,.15);
}
.lang-switch.lang-switch-anon {
  justify-content: center;
  margin: 10px 0 0;
}
.lang-switch.lang-switch-anon a {
  color: var(--text, #144b8c);
  opacity: .55;
}
.lang-switch.lang-switch-anon a.active {
  opacity: 1;
  background: rgba(20,75,140,.1);
}

/* ---------- Hub (comfortfs.com karsilama sayfasi) ---------- */
.hub-wrap {
  max-width: 640px;
  margin: 40px auto 0;
  padding: 0 8px;
}
.hub-head {
  text-align: center;
  margin-bottom: 30px;
}
.hub-logo { font-size: 3rem; line-height: 1; }
.hub-head h1 {
  font-size: 1.7rem;
  margin: 8px 0 4px;
  color: var(--text);
}
.hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 520px) {
  .hub-grid { grid-template-columns: 1fr; }
}
.hub-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 18px;
  text-align: center;
  color: var(--text);
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.hub-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(20,30,45,.14);
}
.hub-ic { font-size: 2.6rem; line-height: 1; margin-bottom: 10px; }
.hub-name { font-weight: 700; font-size: 1.1rem; margin-bottom: 4px; }
.hub-desc { color: var(--text-muted); font-size: .85rem; }
.icon-btn {
  background: rgba(255,255,255,.15);
  border: none;
  color: var(--brand-contrast);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: .85rem;
  min-height: 36px;
}

/* ---------- Alt navigasyon (mobil) ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 4px 2px calc(4px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 8px rgba(20,30,45,.06);
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  color: var(--text-muted);
  font-size: .68rem;
  padding: 6px 2px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.bottom-nav a.active { color: var(--brand); background: var(--surface-2); }
.bottom-nav .ic { font-size: 1.25rem; line-height: 1; }

/* ---------- Kart / bolum ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.card h2, .card h3 { margin-top: 0; }

.page-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 6px 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.section-title { font-size: 1rem; font-weight: 700; margin: 18px 0 8px; }

/* ---------- Butonlar ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--touch);
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--surface-2);
  color: var(--text);
  width: 100%;
}
.btn:hover { text-decoration: none; filter: brightness(0.97); }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row .btn { width: auto; flex: 1 1 auto; min-width: 140px; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1.5px solid var(--brand); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .85rem; width: auto; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Form ---------- */
label { display: block; font-weight: 600; font-size: .9rem; margin: 12px 0 6px; }
input[type=text], input[type=number], input[type=password], input[type=search],
input[type=date], input[type=file], select, textarea {
  width: 100%;
  min-height: var(--touch);
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
}
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
}
.hint { color: var(--text-muted); font-size: .82rem; margin-top: 4px; }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; }
fieldset { border: 1.5px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 12px 0; }
legend { font-weight: 700; padding: 0 6px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.checkbox-row input { width: auto; min-height: auto; }

/* ---------- Uyari kutulari ---------- */
.alert {
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: .92rem;
}
.alert-error { background: var(--danger-bg); color: var(--danger-text); border: 1px solid #f3caca; }
.alert-warn { background: var(--warn-bg); color: var(--warn-text); border: 1px solid #f5deb0; }
.alert-ok { background: var(--ok-bg); color: var(--ok-text); border: 1px solid #bfe6cb; }
.alert-info { background: #e8f0fb; color: var(--brand-dark); border: 1px solid #c9dcf3; }

/* ---------- Rozet / durum ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}
.badge-on { background: var(--ok-bg); color: var(--ok-text); }
.badge-out { background: var(--warn-bg); color: var(--warn-text); }
.badge-done { background: #eceff3; color: #566373; }
.badge::before { content: "●"; font-size: .6rem; }

/* ---------- Liste satirlari ---------- */
.list { display: flex; flex-direction: column; gap: 8px; }
.row-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
}
.row-link:hover { border-color: var(--brand); text-decoration: none; }
.row-link .meta { color: var(--text-muted); font-size: .82rem; }
.row-title { font-weight: 700; }
.row-right { text-align: right; white-space: nowrap; }
.chev { color: var(--text-muted); }

/* ---------- Istatistik grid ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.stat-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}
.stat-box .num { font-size: 1.6rem; font-weight: 800; color: var(--brand); }
.stat-box .lbl { font-size: .78rem; color: var(--text-muted); margin-top: 2px; }

/* ---------- Menu grid (ana ekran) ---------- */
.menu-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.menu-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 10px;
  text-align: center;
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: .92rem;
}
.menu-tile .ic { font-size: 1.7rem; }
.menu-tile:hover { border-color: var(--brand); text-decoration: none; }

/* ---------- Tablo (masaustu) / kart (mobil) ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: .9rem; }
th { color: var(--text-muted); font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: none; }

/* ---------- Arama kutusu ---------- */
.search-box { display: flex; gap: 8px; margin-bottom: 10px; }
.search-box input { flex: 1; }

/* ---------- Yardimci siniflar ---------- */
.muted { color: var(--text-muted); }
.text-right { text-align: right; }
.mono { font-variant-numeric: tabular-nums; font-family: "SFMono-Regular", Menlo, Consolas, monospace; }
.big-number { font-size: 1.6rem; font-weight: 800; }
.spacer { height: 8px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }
.tag { display: inline-block; background: var(--surface-2); border-radius: 8px; padding: 2px 8px; font-size: .78rem; margin-right: 4px; }
.empty-state { text-align: center; color: var(--text-muted); padding: 40px 16px; }
.empty-state .ic { font-size: 2.2rem; margin-bottom: 8px; }
.pagination { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.qr-box { display: flex; justify-content: center; padding: 12px; background: #fff; border-radius: 10px; }
.qr-box svg { width: 220px; height: 220px; }
.top-actions { display: flex; gap: 8px; }

@media (min-width: 640px) {
  .container { padding-bottom: 40px; }
  .bottom-nav { display: none; }
  .menu-grid { grid-template-columns: repeat(3, 1fr); }
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

@media print {
  .topbar, .bottom-nav, .no-print { display: none !important; }
  body { background: #fff; }
  .container { padding: 0; max-width: none; }
}
