/* Aquaera — Water Management Platform design system */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --aq-bg: #f4f8f9;
  --aq-surface: #ffffff;
  --aq-surface-raised: #ffffff;
  --aq-border: #d5e0e4;
  --aq-border-subtle: #e6eef1;
  --aq-text: #17313a;
  --aq-text-secondary: #3a5360;
  --aq-text-muted: #5c7380;
  --aq-accent: #087f8c;
  --aq-accent-hover: #066874;
  --aq-accent-soft: #ddf3f4;
  --aq-accent-muted: #8fc4cb;
  --aq-sidebar-bg: #123e4a;
  --aq-sidebar-bg-soft: #165260;
  --aq-sidebar-hover: #195766;
  --aq-sidebar-text: #d7e6ea;
  --aq-sidebar-muted: #9bb4bc;
  --aq-sidebar-active: #ddf3f4;
  --aq-sidebar-active-text: #087f8c;
  --aq-sidebar-border: rgba(255, 255, 255, 0.1);
  --aq-success-bg: #dafbe1;
  --aq-success-text: #116329;
  --aq-error-bg: #ffebe9;
  --aq-error-text: #cf222e;
  --aq-warn-bg: #fff8c5;
  --aq-warn-text: #7d4e00;
  --aq-info-bg: #ddf4ff;
  --aq-info-text: #0969da;
  --aq-radius-sm: 6px;
  --aq-radius: 10px;
  --aq-radius-lg: 14px;
  --aq-shadow-sm: 0 1px 2px rgba(23, 49, 58, 0.06);
  --aq-shadow: 0 4px 16px rgba(23, 49, 58, 0.08);
  --aq-sidebar-w: 248px;
  --aq-topbar-h: 56px;
  --aq-font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Legacy aliases — mevcut şablonlarla uyumluluk */
  --bg: var(--aq-bg);
  --card: var(--aq-surface);
  --text: var(--aq-text);
  --muted: var(--aq-text-muted);
  --line: var(--aq-border);
  --primary: var(--aq-accent);
  --primary2: var(--aq-accent-hover);
  --soft: var(--aq-accent-soft);
  --blue: var(--aq-info-bg);
  --warn: var(--aq-warn-bg);
  --shadow: var(--aq-shadow);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--aq-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--aq-text);
  background: var(--aq-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--aq-accent); }

/* ─── App shell ─── */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--aq-sidebar-w);
  background:
    linear-gradient(180deg, rgba(8, 127, 140, 0.12) 0%, transparent 28%),
    var(--aq-sidebar-bg);
  border-right: 1px solid var(--aq-sidebar-border);
  display: flex;
  flex-direction: column;
  /* Above .nav-drawer-overlay (110) so mobile drawer links receive clicks */
  z-index: 120;
  transition: transform 0.22s ease;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 16px 12px;
  text-decoration: none;
  color: #fff;
  flex-shrink: 0;
}

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(145deg, #087f8c 0%, #123e4a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.brand-mark::before {
  content: '';
  position: absolute;
  bottom: 6px;
  left: 4px;
  right: 4px;
  height: 3px;
  background: rgba(255, 255, 255, 0.35);
  border-radius: 2px;
}

.brand-mark::after {
  content: '';
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 14px;
  height: 8px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
}

.brand-text strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-text span {
  display: block;
  font-size: 11px;
  color: var(--aq-sidebar-muted);
  font-weight: 500;
  margin-top: 1px;
}

.workspace-chip {
  margin: 0 12px 10px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--aq-sidebar-border);
  border-radius: var(--aq-radius-sm);
  flex-shrink: 0;
}

.workspace-chip small {
  display: block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--aq-sidebar-muted);
  margin-bottom: 2px;
}

.workspace-chip strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 2px 10px 12px;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section-label {
  display: block;
  padding: 8px 10px 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--aq-sidebar-muted);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--aq-radius-sm);
  color: var(--aq-sidebar-text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  transition: background 0.12s, color 0.12s;
}

.sidebar-link:hover {
  background: var(--aq-sidebar-hover);
  color: #fff;
}

.sidebar-link.is-active {
  background: var(--aq-sidebar-active);
  color: var(--aq-sidebar-active-text);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--aq-accent);
}

.sidebar-link-icon {
  width: 18px;
  height: 18px;
  opacity: 0.75;
  flex-shrink: 0;
}

.sidebar-link.is-active .sidebar-link-icon { opacity: 1; color: var(--aq-sidebar-active-text); }

.sidebar-footer {
  padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--aq-sidebar-border);
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.08);
}

.sidebar-user {
  padding: 6px 10px 8px;
  font-size: 12px;
  color: var(--aq-sidebar-muted);
}

.sidebar-user strong {
  display: block;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 1px;
}

.sidebar-footer .sidebar-link { font-size: 12px; }

.sidebar-link-logout { color: #ffb4ae !important; }
.sidebar-link-logout:hover { background: rgba(248, 81, 73, 0.16) !important; color: #ffe3e0 !important; }
.sidebar-link-logout.is-active {
  background: rgba(248, 81, 73, 0.18) !important;
  color: #ffe3e0 !important;
  box-shadow: none;
}

/* ─── Main area ─── */

.app-main {
  flex: 1;
  margin-left: var(--aq-sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--aq-topbar-h);
  background: var(--aq-surface);
  border-bottom: 1px solid var(--aq-border-subtle);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
}

.topbar-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-radius-sm);
  background: var(--aq-surface);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  color: var(--aq-text);
}

.topbar-toggle svg { width: 18px; height: 18px; }

.topbar-context h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.topbar-context p {
  margin: 0;
  font-size: 12px;
  color: var(--aq-text-muted);
}

.topbar-spacer { flex: 1; }

.locale-selector {
  display: flex;
  align-items: center;
  margin-right: 8px;
  flex-shrink: 0;
}

.locale-select {
  max-width: 132px;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--aq-border);
  border-radius: 8px;
  background: #fff;
  color: var(--aq-text);
  font: inherit;
  font-size: 12px;
  line-height: 1.2;
  cursor: pointer;
}

.auth-topbar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px 0;
  max-width: 1200px;
  margin: 0 auto;
}

.auth-topbar .locale-selector { margin-right: 0; }

@media (max-width: 390px) {
  .locale-select { max-width: 108px; font-size: 11px; padding-right: 24px; }
  .topbar-meta { display: none; }
}

.topbar-meta {
  font-size: 12px;
  color: var(--aq-text-muted);
  font-weight: 500;
}

.wrap {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 24px 48px;
  flex: 1;
}

.footer {
  margin-top: auto;
  padding: 16px 24px;
  color: var(--aq-text-muted);
  text-align: center;
  font-size: 12px;
  border-top: 1px solid var(--aq-border-subtle);
  background: var(--aq-surface);
}

/* ─── Page headers ─── */

.page-header {
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1,
.section-title h1 {
  margin: 0;
  font-size: 1.625rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.section-title h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-title p {
  margin: 4px 0 0;
  color: var(--aq-text-muted);
  font-size: 13px;
}

.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

section { margin-top: 32px; }
section:first-of-type { margin-top: 0; }

.workspace-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--aq-surface);
  border: 1px solid var(--aq-border-subtle);
  border-radius: var(--aq-radius-lg);
  margin-bottom: 24px;
}

.workspace-banner-mark {
  width: 36px;
  height: 36px;
  border-radius: var(--aq-radius);
  background: var(--aq-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--aq-accent);
  flex-shrink: 0;
}

.workspace-banner-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.workspace-banner-text span {
  font-size: 12px;
  color: var(--aq-text-muted);
}

/* ─── KPI & metrics ─── */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 0 0 24px;
}

.kpi-grid-compact { grid-template-columns: repeat(4, 1fr); }

.kpi-card,
.metric {
  background: var(--aq-surface);
  border: 1px solid var(--aq-border-subtle);
  border-radius: var(--aq-radius-lg);
  padding: 16px 18px;
  box-shadow: var(--aq-shadow-sm);
  min-height: 0;
}

.kpi-card small,
.metric small {
  display: block;
  color: var(--aq-text-muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.kpi-card strong,
.metric strong {
  display: block;
  font-size: 1.5rem;
  margin-top: 6px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.kpi-card em,
.metric em {
  display: block;
  margin-top: 4px;
  font-style: normal;
  color: var(--aq-text-muted);
  font-size: 12px;
}

.kpi-highlight { border-color: var(--aq-accent-muted); background: linear-gradient(180deg, #fff, var(--aq-accent-soft)); }
.kpi-warn { border-color: #f0c040; background: var(--aq-warn-bg); }

.metric-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.metric-link:hover {
  border-color: var(--aq-accent-muted);
  box-shadow: var(--aq-shadow);
}

/* ─── Actions ─── */

.quick-actions { margin: 0 0 32px; }

.action-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.action-grid-primary { margin-bottom: 10px; }
.action-grid-secondary { grid-template-columns: repeat(4, 1fr); gap: 8px; }

.action-card {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 12px 16px;
  border-radius: var(--aq-radius);
  background: var(--aq-accent);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  border: 1px solid transparent;
  transition: background 0.12s;
}

.action-card:hover {
  background: var(--aq-accent-hover);
  color: #fff;
}

.action-secondary {
  background: var(--aq-surface);
  color: var(--aq-text);
  border-color: var(--aq-border);
  box-shadow: none;
}

.action-secondary:hover {
  background: var(--aq-bg);
  color: var(--aq-text);
  border-color: var(--aq-border);
}

/* ─── Cards, panels, tables ─── */

.panel, .card, .tablebox, .notice, .formbox, .data-card, .detail-item, .profile-card {
  background: var(--aq-surface);
  border: 1px solid var(--aq-border-subtle);
  border-radius: var(--aq-radius-lg);
  box-shadow: var(--aq-shadow-sm);
}

.panel { padding: 24px; }
.panel h2 { margin: 0 0 8px; font-size: 1.75rem; font-weight: 700; letter-spacing: -0.03em; }
.panel p { margin: 0 0 12px; color: var(--aq-text-muted); }

.card { padding: 16px 18px; }
.card h3, .formbox h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.card p { margin: 0; color: var(--aq-text-muted); font-size: 13px; }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.tag {
  display: inline-block;
  margin-bottom: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--aq-accent-soft);
  color: var(--aq-accent);
  font-size: 11px;
  font-weight: 600;
}

.notice {
  padding: 16px 18px;
  border-left: 3px solid var(--aq-accent);
  margin-bottom: 10px;
}

.notice h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.notice p { margin: 0 0 8px; color: var(--aq-text-secondary); font-size: 13px; }
.notice-compact { padding: 12px 14px; margin-bottom: 8px; }
.notice-compact h3 { margin: 0 0 4px; font-size: 14px; }
.notice-compact .notice-body { margin: 0; font-size: 13px; line-height: 1.45; }
.notice-toggle {
  display: none;
  margin-top: 6px;
  padding: 0;
  border: none;
  background: none;
  color: var(--aq-accent);
  font: inherit;
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  width: auto;
}

.notice-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.notice-type {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--aq-accent-soft);
  color: var(--aq-accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.notice-subtitle {
  margin: 0 0 6px;
  color: var(--aq-text-secondary);
  font-size: 13px;
  font-style: italic;
}

.notice-official .notice-view-btn {
  margin-top: 10px;
  display: inline-flex;
  width: auto;
}

.belge-page {
  max-width: 860px;
  margin: 0 auto;
}

.belge-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.belge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.belge-document {
  background: var(--aq-surface);
  border: 1px solid var(--aq-border-subtle);
  border-radius: 12px;
  padding: 24px 28px;
}

.belge-header {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--aq-border-subtle);
}

.belge-header h1 {
  margin: 8px 0 0;
  font-size: 22px;
  line-height: 1.35;
}

.belge-subtitle {
  margin: 8px 0 0;
  color: var(--aq-text-secondary);
  font-size: 15px;
  font-style: italic;
}

.belge-content {
  font-size: 15px;
  line-height: 1.65;
  color: var(--aq-text-primary);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}

.belge-content h1 {
  font-size: 20px;
  margin: 0 0 14px;
}

.belge-content h2 {
  font-size: 17px;
  margin: 22px 0 10px;
}

.belge-content p {
  margin: 0 0 12px;
}

.belge-content ul,
.belge-content ol {
  margin: 0 0 12px 20px;
  padding: 0;
}

.belge-content li {
  margin-bottom: 6px;
}

.belge-content blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--aq-accent);
  background: var(--aq-bg);
  color: var(--aq-text-secondary);
}

@media print {
  .app-sidebar,
  .app-topbar,
  .footer,
  .mobile-bottom-nav,
  .flash-wrap,
  .no-print,
  .nav-drawer-overlay {
    display: none !important;
  }

  body,
  .app-main,
  .wrap,
  main.wrap {
    margin: 0 !important;
    padding: 0 !important;
    background: #fff !important;
  }

  .belge-document {
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
  }

  .belge-content {
    font-size: 12pt;
  }
}

@media (max-width: 640px) {
  .belge-document {
    padding: 16px 14px;
  }

  .belge-header h1 {
    font-size: 18px;
  }

  .belge-content {
    font-size: 14px;
  }

  .belge-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .belge-actions {
    width: 100%;
  }

  .belge-actions .btn {
    flex: 1;
    justify-content: center;
  }
}

.date { color: var(--aq-text-muted); font-size: 12px; font-weight: 600; }

.tablebox { overflow: hidden; }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--aq-surface);
}

th, td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--aq-border-subtle);
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  background: var(--aq-bg);
  color: var(--aq-text-secondary);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:last-child td { border-bottom: none; }
.right { text-align: right; white-space: nowrap; }
.total { font-weight: 700; background: var(--aq-bg); }
.muted { color: var(--aq-text-muted); }

.table-clickable .clickable-row { cursor: pointer; }
.table-clickable .clickable-row:hover td { background: var(--aq-bg); }
.row-action { width: 1%; white-space: nowrap; }
.cell-sub { font-size: 12px; color: var(--aq-text-muted); margin-top: 2px; font-weight: 400; }

.mobile-cards { display: none; }

.data-card {
  display: block;
  padding: 14px 16px;
  margin-bottom: 8px;
  text-decoration: none;
  color: inherit;
}

.data-card strong { display: block; font-size: 15px; font-weight: 600; }
.data-card span { display: block; color: var(--aq-text-muted); font-size: 12px; margin-top: 3px; }
.data-card-amount { display: block; margin-top: 6px; font-weight: 700; color: var(--aq-accent); }

/* ─── Forms ─── */

.formbox { padding: 20px; }

label {
  display: block;
  font-weight: 600;
  font-size: 12px;
  margin: 12px 0 5px;
  color: var(--aq-text-secondary);
}

input, select, textarea {
  width: 100%;
  border: 1px solid var(--aq-border);
  border-radius: var(--aq-radius-sm);
  padding: 9px 11px;
  font: inherit;
  font-size: 14px;
  background: var(--aq-surface);
  color: var(--aq-text);
  transition: border-color 0.12s, box-shadow 0.12s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--aq-accent);
  box-shadow: 0 0 0 3px rgba(11, 110, 122, 0.15);
}

textarea { min-height: 96px; resize: vertical; }

button {
  width: 100%;
  border: none;
  border-radius: var(--aq-radius-sm);
  padding: 10px 14px;
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  background: var(--aq-accent);
  color: #fff;
  margin-top: 14px;
  cursor: pointer;
  transition: background 0.12s;
}

button:hover { background: var(--aq-accent-hover); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  margin-top: 0;
  padding: 8px 14px;
  border-radius: var(--aq-radius-sm);
  font-weight: 600;
  font-size: 13px;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  background: var(--aq-accent);
  color: #fff;
}

.btn:hover { background: var(--aq-accent-hover); color: #fff; }
.btn-primary { background: var(--aq-accent); color: #fff; }
.btn-primary:hover { background: var(--aq-accent-hover); }
.btn-outline { background: var(--aq-surface); color: var(--aq-accent); border-color: var(--aq-border); }
.btn-outline:hover { background: var(--aq-accent-soft); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; min-height: 44px; }
.btn-logout { background: var(--aq-surface); color: var(--aq-error-text); border-color: #ffccc7; }
.btn-logout:hover { background: var(--aq-error-bg); }

.form-actions { margin-top: 16px; display: flex; gap: 10px; flex-wrap: wrap; }
.form-row-2, .form-row-3 { display: grid; gap: 12px; margin-bottom: 4px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.form-section label { margin-top: 10px; }
.form-compact label { margin: 8px 0 4px; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
  padding: 14px 16px;
  background: var(--aq-surface);
  border: 1px solid var(--aq-border-subtle);
  border-radius: var(--aq-radius-lg);
}

.filter-bar-wide .filter-field-grow { flex: 1; min-width: 220px; }
.filter-field label { display: block; font-size: 11px; font-weight: 600; color: var(--aq-text-muted); margin: 0 0 5px; text-transform: uppercase; letter-spacing: 0.04em; }
.filter-field input, .filter-field select { width: 100%; min-width: 160px; }
.filter-bar .btn-primary { min-height: 38px; padding: 0 16px; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.checkbox-row input { width: auto; margin: 0; }
.checkbox-row label { display: inline; margin: 0; font-weight: 500; }

/* ─── Badges & alerts ─── */

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-normal { background: var(--aq-info-bg); color: var(--aq-info-text); }
.badge-acil { background: var(--aq-warn-bg); color: var(--aq-warn-text); }
.badge-kritik { background: var(--aq-error-bg); color: var(--aq-error-text); }
.badge-durum { background: var(--aq-accent-soft); color: var(--aq-accent); }
.badge-ok { background: var(--aq-success-bg, #e8f5e9); color: var(--aq-success-text, #1b5e20); }

.input-compact {
  width: 100%;
  max-width: 7.5rem;
  padding: 6px 8px;
  font-size: 13px;
  border: 1px solid var(--aq-border);
  border-radius: 6px;
  background: var(--aq-surface);
}
.input-num { text-align: right; font-variant-numeric: tabular-nums; }
.muted-row td { color: var(--aq-text-muted); }

.alert {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: var(--aq-radius);
  background: var(--aq-accent-soft);
  border: 1px solid var(--aq-accent-muted);
  font-weight: 600;
  font-size: 13px;
}

.alert-info { background: var(--aq-info-bg); border-color: #9cd7ff; color: var(--aq-info-text); font-weight: 600; }
.readonly-banner {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 10px;
  border-radius: var(--aq-radius-sm);
  background: var(--aq-info-bg);
  color: var(--aq-info-text);
  font-size: 12px;
  font-weight: 600;
}

.formula {
  background: var(--aq-warn-bg);
  border: 1px solid #f0c040;
  border-radius: var(--aq-radius);
  padding: 14px;
  font-weight: 600;
  margin-top: 14px;
  font-size: 13px;
}

.flash-wrap { margin-bottom: 16px; }

.flash {
  padding: 11px 14px;
  border-radius: var(--aq-radius);
  margin-bottom: 8px;
  background: var(--aq-surface);
  border: 1px solid var(--aq-border);
  font-size: 13px;
}

.flash.success { border-color: #86d99a; background: var(--aq-success-bg); color: var(--aq-success-text); }
.flash.error { border-color: #ffaba8; background: var(--aq-error-bg); color: var(--aq-error-text); }

/* ─── Profile & detail ─── */

.profile-hero { margin-bottom: 16px; }
.profile-card { padding: 20px 22px; }
.profile-card h1 { margin: 0 0 6px; font-size: 1.35rem; font-weight: 700; }
.profile-meta { margin: 0; color: var(--aq-text-muted); font-size: 13px; }

.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
.detail-item { padding: 14px 16px; }
.detail-item small { display: block; color: var(--aq-text-muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.detail-item strong { font-size: 14px; font-weight: 600; }
.detail-section { margin-top: 24px; }
.detail-hint { font-size: 12px; margin-top: 8px; color: var(--aq-text-muted); }

.page-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-actions-desktop { display: none; }
.text-link { margin-top: 10px; }
.text-link a { color: var(--aq-accent); font-weight: 600; text-decoration: none; font-size: 13px; }
.text-link a:hover { text-decoration: underline; }
.link-list { display: flex; flex-direction: column; gap: 8px; }
.link-list a { color: var(--aq-accent); font-weight: 600; text-decoration: none; padding: 8px 0; border-bottom: 1px solid var(--aq-border-subtle); font-size: 13px; }

.hero { display: grid; grid-template-columns: 1.45fr 0.95fr; gap: 16px; margin-bottom: 20px; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.admin-cards { align-items: start; }
.kalem-list { margin-top: 12px; }
.onay-form .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.structure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.structure-grid .formbox { margin: 0; }
.template-download { display: flex; margin-top: 12px; align-items: center; justify-content: center; }
.unit-form { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; align-items: end; }
.unit-form label { margin: 0; }
.unit-form button { margin: 0; }
.unit-form input, .unit-form select { width: 100%; }
.inline-password-form { display: flex; gap: 7px; min-width: 265px; }
.inline-password-form input { min-width: 155px; padding: 8px 9px; }
.inline-password-form button { width: auto; margin: 0; white-space: nowrap; }
.field-help { display: block; color: var(--aq-text-muted); font-size: 12px; margin-top: 4px; }

.info-cards .card .tag { background: var(--aq-accent-soft); color: var(--aq-accent); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }

/* ─── Auth pages ─── */

.auth-page { background: var(--aq-bg); min-height: 100vh; }

.auth-wrap {
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  max-width: 960px;
  width: 100%;
  min-height: 520px;
  background: var(--aq-surface);
  border: 1px solid var(--aq-border-subtle);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--aq-shadow);
}

.auth-brand-panel {
  background: var(--aq-sidebar-bg);
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
}

.auth-brand-panel .brand-mark {
  width: 40px;
  height: 40px;
  margin-bottom: 24px;
}

.auth-brand-panel h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.auth-brand-panel .auth-subtitle {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--aq-sidebar-muted);
  font-weight: 500;
}

.auth-brand-panel .auth-tagline {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: var(--aq-sidebar-text);
  max-width: 320px;
}

.auth-brand-footer {
  font-size: 12px;
  color: var(--aq-sidebar-muted);
}

.auth-form-panel {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.auth-form-panel h2 {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.auth-form-panel .auth-form-desc {
  margin: 0 0 24px;
  color: var(--aq-text-muted);
  font-size: 13px;
}

.login-box { display: flex; justify-content: center; width: 100%; }
.narrow { max-width: 400px; width: 100%; }
.login-card { padding: 0; border: none; box-shadow: none; background: transparent; }
.onboarding-card { max-width: 480px; }

.btn-login { margin-top: 20px; padding: 11px 16px; font-size: 14px; border-radius: var(--aq-radius-sm); }

.login-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--aq-border-subtle);
}

.login-links a { color: var(--aq-accent); font-size: 13px; font-weight: 600; text-decoration: none; }
.login-links a:hover { text-decoration: underline; }
.login-link-muted { color: var(--aq-text-muted) !important; font-weight: 500 !important; font-size: 12px !important; }

.footer-auth { margin-top: 0; border-top: none; background: transparent; }

/* ─── Login-only compact layout (scoped; other auth pages unchanged) ─── */

.auth-page-login .auth-wrap {
  min-height: auto;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 16px 24px;
}

.auth-page-login .footer-auth {
  display: none;
}

.auth-page-login .auth-topbar {
  padding: 10px 16px 4px;
  max-width: 420px;
  width: 100%;
}

.login-compact {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.login-compact .auth-layout-login {
  display: flex;
  flex-direction: column;
  grid-template-columns: none;
  max-width: 100%;
  min-height: 0;
  width: 100%;
}

.login-compact .auth-brand-compact {
  padding: 16px 20px;
  justify-content: center;
  gap: 0;
}

.login-compact .auth-brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-compact .auth-brand-compact .brand-mark {
  width: 36px;
  height: 36px;
  margin: 0;
  flex-shrink: 0;
}

.login-compact .auth-brand-text {
  min-width: 0;
}

.login-compact .auth-brand-compact h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.login-compact .auth-brand-compact .auth-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.3;
}

.login-compact .auth-form-panel {
  padding: 20px 20px 22px;
  justify-content: flex-start;
}

.login-compact .auth-form-panel h2 {
  font-size: 18px;
}

.login-compact .auth-form-panel .auth-form-desc {
  margin: 0 0 16px;
}

.login-compact .btn-login {
  margin-top: 14px;
  width: 100%;
}

.login-compact .login-links {
  margin-top: 14px;
  padding-top: 12px;
}

@media (max-width: 390px) {
  .auth-page-login .auth-wrap {
    padding: 4px 12px 16px;
  }

  .auth-page-login .auth-topbar {
    padding: 8px 12px 0;
  }

  .login-compact .auth-brand-compact {
    padding: 12px 14px;
  }

  .login-compact .auth-form-panel {
    padding: 16px 14px 18px;
  }

  .login-compact .auth-brand-compact h1 {
    font-size: 18px;
  }

  .login-compact .locale-select {
    max-width: 120px;
  }
}

/* ─── Mobile bottom nav ─── */

.mobile-bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  background: var(--aq-surface);
  border-top: 1px solid var(--aq-border-subtle);
  box-shadow: 0 -2px 12px rgba(13, 17, 23, 0.06);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: stretch;
}

.mob-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--aq-text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 6px 4px;
  border-radius: var(--aq-radius-sm);
  min-width: 56px;
  min-height: 48px;
  transition: color 0.12s, background 0.12s;
}

.mob-nav-item .mob-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mob-nav-item .mob-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.mob-nav-item .mob-label { line-height: 1.1; letter-spacing: 0.01em; }

.mob-nav-item.active,
.mob-nav-item:hover {
  color: var(--aq-accent);
  background: var(--aq-accent-soft);
}

.mob-nav-item[data-nav="logout"] { color: var(--aq-error-text); }
.mob-nav-item[data-nav="logout"].active,
.mob-nav-item[data-nav="logout"]:hover {
  background: var(--aq-error-bg);
  color: var(--aq-error-text);
}

body.has-mobile-nav .wrap {
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}

/* ─── Mobile drawer (legacy nav fallback) ─── */

.nav-drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(18, 62, 74, 0.45);
  z-index: 110;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

body.sidebar-open .nav-drawer-overlay {
  opacity: 1;
  pointer-events: auto;
}

.nav-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 2px 4px 8px;
  border-bottom: 1px solid var(--aq-sidebar-border);
  margin-bottom: 6px;
}

.nav-drawer-head strong { font-size: 13px; font-weight: 700; color: #fff; }

.nav-drawer-close {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--aq-sidebar-muted);
  cursor: pointer;
  padding: 0;
  border-radius: var(--aq-radius-sm);
  margin: 0;
  width: auto;
}

.nav-drawer-close:hover { background: rgba(255,255,255,0.08); color: #fff; }

/* Hide legacy header styles */
header.legacy-header { display: none; }

/* ─── Responsive ─── */

@media (max-width: 1024px) {
  .kpi-grid, .kpi-grid-compact { grid-template-columns: repeat(2, 1fr); }
  .action-grid, .action-grid-primary, .action-grid-secondary { grid-template-columns: repeat(2, 1fr); }
  .form-row-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 920px) {
  .app-sidebar {
    transform: translateX(-100%);
    width: min(268px, 84vw);
  }

  body.sidebar-open .app-sidebar {
    transform: translateX(0);
  }

  .nav-drawer-overlay { display: block; }

  .app-main { margin-left: 0; }

  .topbar-toggle { display: flex; }

  .app-topbar { padding: 0 16px; }

  .sidebar-brand {
    padding: 14px 14px 10px;
    gap: 10px;
  }

  .brand-text strong { font-size: 14px; }
  .brand-text span { font-size: 10px; }

  .workspace-chip {
    margin: 0 10px 8px;
    padding: 6px 9px;
  }

  .sidebar-nav {
    padding: 0 8px 10px;
  }

  .sidebar-section {
    margin-bottom: 6px;
  }

  .sidebar-section-label {
    padding: 6px 9px 2px;
    font-size: 9px;
    letter-spacing: 0.09em;
  }

  .sidebar-link {
    padding: 8px 9px;
    min-height: 40px;
    font-size: 13px;
  }

  .sidebar-footer {
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }

  .wrap { padding: 20px 16px calc(72px + env(safe-area-inset-bottom)); }

  .mobile-bottom-nav { display: flex; }

  .sidebar-nav .sidebar-link.nav-mobile-dup { display: none !important; }
  .sidebar-section-mobile-dup { display: none !important; }

  .hero { grid-template-columns: 1fr; }
  .cards { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .panel h2 { font-size: 1.4rem; }
  .section-title { flex-direction: column; align-items: flex-start; }
  .section-title h2 { font-size: 1rem; }
  .detail-grid { grid-template-columns: 1fr; }
  .onay-form .form-row { grid-template-columns: 1fr; }
  .page-actions:not(.page-actions-desktop) .btn { width: 100%; text-align: center; min-height: 44px; }
  .page-actions-desktop { display: none; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .form-row-2 { grid-template-columns: 1fr; }
  .page-actions { flex-direction: column; align-items: stretch; }
  .mobile-cards { display: block; }
  .table-responsive table.table-clickable { display: none; }
  .table-responsive table:not(.table-clickable) { display: table; }
  .tablebox { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { font-size: 12px; }
  th, td { padding: 10px 12px; }
  #tahakkuklar, #duyurular { scroll-margin-top: 72px; scroll-margin-bottom: 96px; }
  .notice-compact .notice-body {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .notice-compact.is-open .notice-body {
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
  }
  .notice-toggle { display: inline-block; }
  .action-grid-primary, .action-grid-secondary { grid-template-columns: 1fr 1fr; }
  .structure-grid { grid-template-columns: 1fr; }
  .unit-form { grid-template-columns: 1fr; }
  .unit-form button { margin-top: 8px; }
  button, .btn { min-height: 44px; font-size: 14px; }
  input, select, textarea { font-size: 16px; padding: 10px 12px; min-height: 44px; }
  .formbox { padding: 14px; }
  .btn-sm, .row-action .btn { min-height: 36px !important; min-width: 72px; width: auto; padding: 6px 12px; font-size: 12px; }

  .auth-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .auth-brand-panel {
    padding: 32px 24px;
  }

  .auth-brand-panel h1 { font-size: 22px; }

  .auth-form-panel {
    padding: 32px 24px;
  }
}

@media (min-width: 921px) {
  .page-actions-desktop { display: flex; justify-content: flex-end; }
  .nav-drawer-overlay { display: none !important; }
  .nav-drawer-head, .nav-drawer-close { display: none !important; }
}

@media (max-width: 520px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-grid-compact { grid-template-columns: 1fr 1fr; }
  .action-grid, .action-grid-primary, .action-grid-secondary { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.35rem; }
  .login-links { flex-direction: column; text-align: center; }
  .mob-nav-item { min-width: 48px; font-size: 9px; }
  .inline-password-form { flex-direction: column; min-width: 0; }
}

.status-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.status-open {
  background: #e6f4ea;
  color: #1e7e34;
}

.status-closed {
  background: #f3f4f6;
  color: #6b7280;
}

.row-muted td {
  opacity: 0.72;
}

.action-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.inline-form {
  display: inline;
  margin: 0;
}

.btn-danger {
  color: #b42318;
  border-color: #fecdca;
}

.btn-danger:hover {
  background: #fef3f2;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0;
  font-size: 13px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 4px 12px;
  margin: 10px 0;
}

.belge-edit-area {
  min-height: 360px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .action-stack {
    flex-direction: column;
    align-items: stretch;
  }

  .action-stack .btn {
    width: 100%;
  }
}
