:root {
  --primary: #2c3e50;
  --primary-dark: #1a252f;
  --accent: #7a1c1c;
  --accent-light: #c62828;
  --accent-soft: rgba(122, 28, 28, 0.08);
  --bg: #f4f6f9;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --muted: #64748b;
  --success: #0f766e;
  --success-bg: #ecfdf5;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(44, 62, 80, 0.08);
  --font: "Inter", system-ui, sans-serif;
  --font-display: "Source Serif 4", Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }

.app-body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(122, 28, 28, 0.06), transparent),
    linear-gradient(180deg, #fafbfc 0%, var(--bg) 100%);
}

.topbar {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
  display: block;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-title { font-family: var(--font-display); font-weight: 700; font-size: 0.95rem; }
.brand-sub { font-size: 0.68rem; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.06em; }

.nav-main {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-left: auto;
}

.nav-main a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.15s, color 0.15s;
}

.nav-main a:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }
.nav-main a.is-active,
.nav-dropdown.is-active > .nav-dropdown-toggle {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown-toggle {
  color: rgba(255, 255, 255, 0.85);
  padding: 0.45rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: background 0.15s, color 0.15s;
  background: transparent;
  border: none;
  font-family: inherit;
  cursor: pointer;
  line-height: 1.2;
}

.nav-dropdown-toggle:hover,
.nav-dropdown.is-open > .nav-dropdown-toggle {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.nav-dropdown-chevron {
  font-size: 0.72rem;
  opacity: 0.85;
  transition: transform 0.2s ease;
}

.nav-dropdown.is-open .nav-dropdown-chevron {
  transform: rotate(180deg);
}

.nav-dropdown-panel {
  display: none;
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  min-width: 240px;
  padding: 0.4rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
  z-index: 200;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-dropdown.is-open .nav-dropdown-panel {
  display: flex;
}

.nav-dropdown-panel a {
  color: var(--text);
  text-decoration: none;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s, color 0.15s;
}

.nav-dropdown-panel a:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-dropdown-panel a.is-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  border-radius: 999px;
}

.user-meta { display: flex; flex-direction: column; font-size: 0.72rem; opacity: 0.85; }
.user-meta strong { font-size: 0.85rem; opacity: 1; color: #fff; }

.main-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.page-head { margin-bottom: 1.5rem; }
.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 700;
  margin: 0;
  color: var(--primary);
}

.site-footer {
  text-align: center;
  padding: 1.5rem;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}

.site-footer a { color: var(--accent); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad { padding: 1.25rem 1.5rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}

.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-light); box-shadow: 0 4px 14px rgba(122, 28, 28, 0.35); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost { background: transparent; color: rgba(255,255,255,0.9); border: 1px solid rgba(255,255,255,0.25); }
.btn-ghost:hover { background: rgba(255,255,255,0.1); }
.btn-outline { background: #fff; color: var(--accent); border: 1px solid var(--accent); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

.alert {
  padding: 0.85rem 1rem;
  border-radius: 10px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid #a7f3d0; }
.alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

.form-row { margin-bottom: 1rem; }
.form-row label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 0.35rem; color: var(--primary); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: #fff;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data-table th, table.data-table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
table.data-table th { background: #f8fafc; font-weight: 600; color: var(--primary); }
table.data-table tr:hover td { background: #fafbfc; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: #fffbeb; color: #b45309; }
.badge-muted { background: #f1f5f9; color: var(--muted); }

/* Login */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}

.login-card {
  width: 100%;
  max-width: 440px;
  padding: 2.25rem;
}

.login-hero { text-align: center; margin-bottom: 1.75rem; }
.login-hero h1 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--primary);
  margin: 0 0 0.35rem;
}
.login-hero p { color: var(--muted); font-size: 0.9rem; margin: 0; }

.login-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 1rem;
  border-radius: 16px;
  object-fit: contain;
  background: #fff;
  padding: 6px;
  display: block;
  box-shadow: 0 8px 24px rgba(122, 28, 28, 0.2);
}

/* Standart maddeler accordion */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  padding: 1rem 1.25rem;
  border-left: 4px solid var(--accent);
}

.stat-card .label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; color: var(--primary); }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-bar .form-row { margin: 0; min-width: 140px; }

.kategori-block { margin-bottom: 1.25rem; }

.kategori-head {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent);
  padding: 0.75rem 0;
  border-bottom: 2px solid var(--accent-soft);
  margin-bottom: 0.5rem;
}

.madde-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.65rem;
  overflow: hidden;
  background: var(--surface);
  transition: box-shadow 0.2s;
}

.madde-item.open { box-shadow: var(--shadow); border-color: rgba(122, 28, 28, 0.25); }

.madde-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  background: #fafbfc;
  transition: background 0.15s;
}

.madde-item.open .madde-header { background: var(--accent-soft); }

.madde-header:hover { background: #f1f5f9; }

.madde-kod {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.85rem;
  min-width: 56px;
}

.madde-baslik { flex: 1; font-weight: 600; color: var(--primary); font-size: 0.92rem; line-height: 1.35; }

.madde-chevron {
  transition: transform 0.2s;
  color: var(--muted);
}

.madde-item.open .madde-chevron { transform: rotate(180deg); }

.madde-body {
  display: none;
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

.madde-item.open .madde-body { display: block; }

.madde-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 1rem 0;
  align-items: flex-end;
}

.madde-content {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  min-height: 80px;
  line-height: 1.65;
}

.madde-content.empty { color: var(--muted); font-style: italic; }

.madde-actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.onay-info { font-size: 0.85rem; color: var(--success); display: flex; align-items: center; gap: 0.35rem; }

@media (max-width: 768px) {
  .topbar-inner { flex-direction: column; align-items: stretch; }
  .nav-main { margin-left: 0; justify-content: center; }
  .nav-dropdown { width: 100%; }
  .nav-dropdown-toggle { width: 100%; justify-content: center; }
  .nav-dropdown-panel {
    left: 50%;
    transform: translateX(-50%);
    width: min(100%, 320px);
  }
  .user-chip { justify-content: space-between; }
}

.stds-table-wrap { margin-top: 0.75rem; }
.stds-data-table { font-size: 0.875rem; }
.stds-data-table th.num,
.stds-data-table td.num { text-align: right; white-space: nowrap; }
.stds-data-table th.group-head {
  text-align: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
}
.stds-data-table th.sub { font-size: 0.78rem; font-weight: 600; }
.stds-table-grouped thead tr:first-child th { vertical-align: middle; }
.table-empty {
  margin: 0;
  padding: 1rem;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}
.madde-content .stds-table-wrap { overflow-x: auto; }

.stds-data-table th.sortable {
  cursor: pointer;
  user-select: none;
  padding-right: 1.75rem;
  position: relative;
}
.stds-data-table th.sortable:hover { background: #eef2f7; }
.stds-data-table th.sortable::after {
  content: '\2195';
  position: absolute;
  right: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.35;
  font-size: 0.8rem;
  line-height: 1;
}
.stds-data-table th.sortable.sort-asc::after {
  content: '\2191';
  opacity: 0.95;
}
.stds-data-table th.sortable.sort-desc::after {
  content: '\2193';
  opacity: 0.95;
}

.page-lead {
  color: var(--muted);
  font-size: 0.95rem;
  margin: -0.75rem 0 1.5rem;
  max-width: 720px;
  line-height: 1.55;
}

.breadcrumb-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--muted);
  margin: -0.5rem 0 1.25rem;
}

.breadcrumb-nav a { color: var(--accent); text-decoration: none; }
.breadcrumb-nav a:hover { text-decoration: underline; }

.madde-donem-hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 1rem 0 0.5rem;
}

.excel-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.excel-panel h2 i { margin-right: 0.35rem; color: var(--accent); }

.madde-status { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; font-size: 0.8rem; }

body.stds-modal-open { overflow: hidden; }

.stds-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
  animation: stdsModalIn 0.2s ease;
}
.stds-modal-overlay.is-closing {
  opacity: 0;
  transition: opacity 0.18s ease;
}
@keyframes stdsModalIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.stds-modal {
  width: min(560px, 100%);
  max-height: min(85vh, 720px);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.25);
  animation: stdsModalSlide 0.22s ease;
}
@keyframes stdsModalSlide {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.stds-modal-head {
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #f8fafc, #eef2ff);
}
.stds-modal-head h2 {
  margin: 0;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.stds-modal-body {
  padding: 1.15rem 1.35rem;
  overflow-y: auto;
}
.stds-modal-foot {
  padding: 1rem 1.35rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  background: #fafbfc;
}
.stds-modal-foot-note {
  flex: 1 1 220px;
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.stds-modal-section + .stds-modal-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.stds-modal-section h3 {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.stds-modal-section-warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 1rem;
}
.stds-modal-section-warn h3 { color: #b45309; }
.stds-modal-highlight {
  margin: 0.5rem 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}
.stds-modal-meta {
  margin: 0 0 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
}
.stds-duyuru-list { display: flex; flex-direction: column; gap: 0.85rem; }
.stds-duyuru-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  background: #fff;
}
.stds-duyuru-item-head {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.45rem;
}
.stds-duyuru-item-head time {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}
.stds-duyuru-item-body {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #334155;
}

.stds-inline-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0;
}

.lab-bulk-toolbar {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.5rem;
}

.lab-bulk-delete-btn:not(:disabled) {
  color: var(--danger);
  border-color: #fecaca;
}

.lab-bulk-delete-btn:not(:disabled):hover {
  background: var(--danger-bg);
  color: var(--danger);
}

.bulk-check-col {
  width: 2.5rem;
  text-align: center;
  vertical-align: middle;
}

.bulk-check-col input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  cursor: pointer;
}
