
/* ── Design Tokens ─────────────────────────────────────────────────────────── */
:root {
  --bg:         #f8fafc;
  --surface:    #ffffff;
  --surface-2:  #f1f5f9;
  --surface-3:  #e8eef5;
  --border:     #e2e8f0;
  --border-2:   #cbd5e1;
  --text:       #0f172a;
  --text-2:     #334155;
  --muted:      #64748b;
  --muted-2:    #94a3b8;
  --accent:     #0ea5e9;
  --accent-dk:  #0284c7;
  --accent-bg:  #f0f9ff;
  --accent-bdr: #bae6fd;
  --green:      #10b981;
  --green-bg:   #ecfdf5;
  --green-bdr:  #a7f3d0;
  --amber:      #f59e0b;
  --amber-bg:   #fffbeb;
  --amber-bdr:  #fde68a;
  --red:        #ef4444;
  --red-bg:     #fef2f2;
  --red-bdr:    #fecaca;
  --purple:     #8b5cf6;
  --purple-bg:  #f5f3ff;
  --purple-bdr: #ddd6fe;
  --radius:     10px;
  --radius-lg:  14px;
  --shadow:     0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
  --shadow-lg:  0 4px 24px rgba(0,0,0,.08);
}

/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

a { color: var(--accent-dk); text-decoration: none; font-weight: 600; }
a:hover { color: var(--accent); }

input, select, textarea, button { font-family: inherit; font-size: 14px; }
img { max-width: 100%; height: auto; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: env(safe-area-inset-top, 0) max(28px, env(safe-area-inset-right, 0px)) 0 max(28px, env(safe-area-inset-left, 0px));
  min-height: calc(56px + env(safe-area-inset-top, 0px));
  height: auto;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 16px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.brand-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.topbar nav a {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 600;
  transition: border-color .15s, background .15s, color .15s;
}

.topbar nav a:hover {
  border-color: var(--accent-bdr);
  background: var(--accent-bg);
  color: var(--accent-dk);
}

/* Vurgulu nav butonu (Deger Kaybi Ekle) */
.topbar nav a.nav-cta {
  background: linear-gradient(135deg, #e63946 0%, #c92a3a 100%);
  color: #fff;
  border-color: #c92a3a;
  box-shadow: 0 3px 10px rgba(230,57,70,.32);
  font-weight: 700;
}
.topbar nav a.nav-cta:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(230,57,70,.42);
  color: #fff;
}

/* Metric card — Serviste aktif yeşil vurgu */
.metric-card.metric-card-active {
  background: linear-gradient(135deg, #f0fff4 0%, #fff 100%);
  border-color: #c8f7d0;
  position: relative;
}
.metric-card.metric-card-active::after {
  content: '';
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  box-shadow: 0 0 0 0 rgba(22,163,74,.55);
  animation: metricCardPulse 1.6s ease-out infinite;
}
@keyframes metricCardPulse {
  0%   { box-shadow: 0 0 0 0 rgba(22,163,74,.55); }
  70%  { box-shadow: 0 0 0 12px rgba(22,163,74,0); }
  100% { box-shadow: 0 0 0 0 rgba(22,163,74,0); }
}

/* eyebrow — eski kodla uyumluluk */
.eyebrow { display: none; }

.topbar h1 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

/* ── User Badge ────────────────────────────────────────────────────────────── */
.user-badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 52px;
  max-width: 180px;
  padding: 5px 13px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.user-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-avatar {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--accent-bg);
  border: 1px solid var(--accent-bdr);
}

/* ── Layout ────────────────────────────────────────────────────────────────── */
.layout {
  width: min(1360px, calc(100% - 32px));
  margin: 28px auto 56px;
}

.layout.narrow {
  width: min(760px, calc(100% - 32px));
}

/* ── Stat Cards ────────────────────────────────────────────────────────────── */
.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

.metric-card .metric-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.metric-card .metric-value {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text);
}

.metric-card .metric-sub {
  font-size: 12px;
  color: var(--muted-2);
  margin-top: 6px;
}

/* ── Filter Panel ──────────────────────────────────────────────────────────── */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.filter-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.filter-subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.filter-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  text-decoration: none;
}

.filter-pill:hover {
  border-color: var(--accent-bdr);
  background: var(--accent-bg);
  color: var(--accent-dk);
}

.filter-pill.active {
  border-color: var(--accent-bdr);
  background: var(--accent-bg);
  color: var(--accent-dk);
  font-weight: 700;
}

/* ── Search / Filter Form ──────────────────────────────────────────────────── */
.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(2, minmax(140px, 1fr)) auto auto;
  gap: 8px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
  box-shadow: var(--shadow);
  align-items: center;
}

/* ── Inputs ────────────────────────────────────────────────────────────────── */
input, select {
  height: 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}

input:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(14,165,233,.12);
}

input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 16px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  border: none;
  white-space: nowrap;
}

button[type="submit"], .btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent-dk);
}

button[type="submit"]:hover, .btn-primary:hover {
  background: var(--accent-dk);
}

.btn-secondary, .ghost {
  background: var(--surface);
  color: var(--text-2);
  border: 1px solid var(--border);
  font-weight: 600;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: all .15s;
}

.btn-secondary:hover, .ghost:hover {
  border-color: var(--border-2);
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid var(--red-bdr);
}

.btn-danger:hover {
  background: var(--red);
  color: #fff;
}

.link-danger {
  background: transparent;
  border: none;
  color: var(--red);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  height: auto;
}

.link-danger:hover { color: #b91c1c; }

/* ── Table Card ────────────────────────────────────────────────────────────── */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.table-head h2 {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.table-head span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.table-head-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.per-page {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
}

.per-page a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 28px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.per-page a.active {
  background: var(--surface);
  color: var(--accent-dk);
  box-shadow: var(--shadow);
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

thead tr { background: var(--surface-2); }

th {
  padding: 9px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background .1s;
}

tbody tr:hover { background: var(--surface-2); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 700;
}

.pagination a {
  border: 1px solid var(--border);
  color: var(--text-2);
  background: var(--surface);
}

.pagination a:not(.disabled):hover {
  border-color: var(--accent-bdr);
  background: var(--accent-bg);
  color: var(--accent-dk);
}

.pagination a.disabled {
  pointer-events: none;
  opacity: .45;
}

.pagination span {
  color: var(--muted);
}

/* ── Badges / Pills ────────────────────────────────────────────────────────── */
.pill, .type-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid;
}

.status-green {
  background: var(--green-bg);
  color: var(--green);
  border-color: var(--green-bdr);
}

.status-yellow {
  background: var(--amber-bg);
  color: var(--amber);
  border-color: var(--amber-bdr);
}

.status-red {
  background: var(--red-bg);
  color: var(--red);
  border-color: var(--red-bdr);
}

.type-badge {
  background: var(--accent-bg);
  color: var(--accent-dk);
  border-color: var(--accent-bdr);
  border-radius: 6px;
}

/* Plaka */
td strong, .plate-mono {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--text);
}

/* ── Empty State ───────────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
  display: block;
}

.empty-state span {
  font-size: 13px;
  max-width: 360px;
}

/* ── Policy Warning Section ────────────────────────────────────────────────── */
.policy-warning {
  background: var(--amber-bg);
  border: 1px solid var(--amber-bdr);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.policy-warning-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 18px;
  border: 0;
  border-bottom: 1px solid var(--amber-bdr);
  background: #fef9ec;
  cursor: pointer;
  text-align: left;
}

.policy-warning-head span {
  font-size: 13px;
  font-weight: 700;
  color: #92400e;
}

.policy-warning-head:hover {
  background: #fff4d8;
}

.policy-warning-head:focus-visible {
  outline: 3px solid rgba(245, 158, 11, .28);
  outline-offset: -3px;
}

.policy-count {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--amber-bdr);
  color: #92400e;
  font-size: 11px;
  font-weight: 700;
}

.policy-toggle-label {
  margin-left: auto;
  color: #78350f !important;
}

.policy-warning-body {
  max-height: 720px;
  opacity: 1;
  overflow: auto;
  transition: max-height .22s ease, opacity .18s ease;
}

.policy-warning.is-collapsed .policy-warning-head {
  border-bottom-color: transparent;
}

.policy-warning.is-collapsed .policy-warning-body {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
}

/* ── Form Cards ────────────────────────────────────────────────────────────── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.form-card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.form-card-header .kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 4px;
}

.form-card-header h2 {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.form-card-header p {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.form-card-body {
  padding: 24px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap: 16px;
}

.form-grid label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.form-grid label input,
.form-grid label select {
  height: 40px;
  border-radius: var(--radius);
}

.check-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.check-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.check-row span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: none;
  letter-spacing: 0;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 20px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

/* ── Attachment upload panel ───────────────────────────────────────────────── */
.upload-panel, .edit-upload {
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-lg);
  padding: 16px;
  background: var(--surface-2);
  margin-top: 4px;
}

.upload-panel legend, .edit-upload legend {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  padding: 0 6px;
}

.upload-panel p, .edit-upload p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.attach-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.attach-row input, .attach-row select {
  height: 36px;
  font-size: 13px;
}

.attach-add {
  margin-top: 10px;
  height: 34px;
  font-size: 12px;
}

/* ── Detail View ───────────────────────────────────────────────────────────── */
.detail-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 16px;
}

.detail-hero {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.detail-hero .kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 4px;
}

.detail-hero h2 {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0,1fr));
  gap: 12px;
  padding: 20px 24px;
}

.detail-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.detail-item dt {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 5px;
}

.detail-item dd {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* Attachments section */
.detail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.detail-section-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.category-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.category-tabs a {
  display: inline-flex;
  align-items: center;
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  transition: all .15s;
  text-decoration: none;
}

.category-tabs a:hover, .category-tabs a.active {
  border-color: var(--accent-bdr);
  background: var(--accent-bg);
  color: var(--accent-dk);
}

.attachment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow .15s, transform .15s;
}

.attachment-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

/* ── Login Page ────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-shell {
  width: min(420px, calc(100% - 32px));
}

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

.login-card .brand {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--accent);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.login-card h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 24px;
}

.login-card label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 14px;
}

.login-card button {
  width: 100%;
  margin-top: 8px;
  height: 42px;
  font-size: 14px;
}

/* ── Alerts ────────────────────────────────────────────────────────────────── */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--red-bdr);
  background: var(--red-bg);
  color: var(--red);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

.success {
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--green-bdr);
  background: var(--green-bg);
  color: var(--green);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
}

/* ── Import page ───────────────────────────────────────────────────────────── */
.error-list {
  margin-top: 10px;
  overflow: auto;
  max-height: 260px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  white-space: pre-wrap;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--text-2);
}

.log-note {
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

/* ── Edit Attachments ──────────────────────────────────────────────────────── */
.edit-attachments {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 20px;
}

.edit-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.edit-section-head h3 {
  font-size: 14px;
  font-weight: 700;
}

.compact-table table { min-width: 700px; }
.compact-table th, .compact-table td { padding: 9px 14px; }
.muted-cell { color: var(--muted); font-size: 12px; }
.row-actions { text-align: right; white-space: nowrap; display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

/* ── Inline action buttons in table ───────────────────────────────────────── */
td a.btn-table {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  margin-left: 4px;
  transition: all .15s;
}

td a.btn-table:hover {
  border-color: var(--accent-bdr);
  background: var(--accent-bg);
  color: var(--accent-dk);
}

td a.btn-table-primary {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--accent-bdr);
  background: var(--accent-bg);
  color: var(--accent-dk);
  margin-left: 4px;
  transition: all .15s;
}

td a.btn-table-primary:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ── Insurance tabs (legacy uyumluluk) ─────────────────────────────────────── */
.insurance-tabs {
  display: flex;
  gap: 6px;
  align-items: center;
  overflow-x: auto;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.insurance-tabs a {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: var(--surface);
  transition: all .15s;
  text-decoration: none;
}

.insurance-tabs a.active {
  border-color: var(--accent-bdr);
  background: var(--accent-bg);
  color: var(--accent-dk);
  font-weight: 700;
}

/* ── Section kicker ─────────────────────────────────────────────────────────── */
.section-kicker {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}

/* ── btn-primary / btn-secondary / btn-soft (legacy) ──────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 16px; border-radius: var(--radius);
  background: var(--accent); color: #fff; border: 1px solid var(--accent-dk);
  font-weight: 700; font-size: 13px; cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn-primary:hover { background: var(--accent-dk); color: #fff; }

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  height: 38px; padding: 0 14px; border-radius: var(--radius);
  background: var(--surface); color: var(--text-2); border: 1px solid var(--border);
  font-weight: 600; font-size: 13px; cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn-secondary:hover { border-color: var(--border-2); background: var(--surface-2); color: var(--text); }

.btn-soft {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; padding: 0 12px; border-radius: var(--radius);
  background: var(--accent-bg); color: var(--accent-dk); border: 1px solid var(--accent-bdr);
  font-weight: 700; font-size: 12px; cursor: pointer; transition: all .15s;
  text-decoration: none;
}
.btn-soft:hover { background: var(--accent); color: #fff; }

/* Mobile/touch performance layer */
button,
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
.topbar nav a,
.filter-pill,
.category-tabs a,
.btn-primary,
.btn-secondary,
.btn-soft,
td a.btn-table,
td a.btn-table-primary {
  min-height: 44px;
}

input[type="checkbox"],
input[type="radio"] {
  min-height: 16px;
}

.table-card,
.policy-warning,
.form-card,
.detail-card,
.filter-panel {
  content-visibility: auto;
  contain-intrinsic-size: auto 480px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .topbar {
    padding: calc(12px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 12px max(16px, env(safe-area-inset-left, 0px));
    flex-wrap: wrap;
  }
  .metrics { grid-template-columns: 1fr 1fr; }
  .filters { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .attach-row { grid-template-columns: 1fr; }
  .layout { width: calc(100% - 24px); }
}

@media (max-width: 768px) {
  .topbar {
    align-items: flex-start;
    gap: 12px;
  }

  .topbar-brand,
  .topbar nav {
    width: 100%;
  }

  .topbar nav {
    gap: 8px;
  }

  .topbar nav a,
  .btn-primary,
  .btn-secondary,
  .btn-soft,
  .filter-pill {
    flex: 1 1 auto;
  }

  .user-badge {
    max-width: 100%;
  }

  .filter-panel-header,
  .table-head,
  .edit-section-head,
  .detail-section-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .table-head-tools,
  .pagination {
    width: 100%;
    justify-content: flex-start;
  }

  .pagination {
    flex-wrap: wrap;
  }

  .filter-pills {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .table-wrap {
    overflow: visible;
  }

  .table-wrap table,
  .compact-table table {
    min-width: 0;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap tr {
    margin: 0 0 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .table-wrap td {
    display: grid;
    grid-template-columns: minmax(96px, 38%) minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    min-height: 44px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    text-align: left !important;
    white-space: normal !important;
  }

  .table-wrap td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .table-wrap td[data-label]::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }

  .table-wrap td[data-label="Islem"] {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start !important;
    gap: 8px;
  }

  .table-wrap td[data-label="Islem"]::before {
    flex: 0 0 100%;
  }

  .table-wrap td[data-label="Islem"] a,
  .table-wrap td[data-label="Islem"] form,
  .row-actions a,
  .row-actions form {
    flex: 1 1 120px;
    margin-left: 0;
  }

  td a.btn-table,
  td a.btn-table-primary,
  .link-danger {
    justify-content: center;
    width: 100%;
  }

  .upload-panel,
  .attachment-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 600px) {
  .metrics { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .filter-pills { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ── Import Tabs ────────────────────────────────────────────────────────────── */
.import-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 4px;
}

.import-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  transition: all .15s;
  min-height: 0 !important;
  height: auto !important;
}

.import-tab strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
}

.import-tab span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
}

.import-tab:hover {
  border-color: var(--border-2);
  background: var(--surface);
}

.import-tab.import-tab-active {
  border-color: var(--accent-bdr);
  background: var(--accent-bg);
  box-shadow: 0 0 0 3px rgba(14,165,233,.08);
}

.import-tab.import-tab-active strong { color: var(--accent-dk); }
.import-tab.import-tab-active span   { color: var(--accent-dk); opacity: .75; }

.import-hint {
  font-size: 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  margin-top: 8px;
  line-height: 1.6;
}

.import-hint em { font-style: normal; font-weight: 600; color: var(--text-2); }

/* ── Table Switcher ─────────────────────────────────────────────────────────── */
.table-switcher {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px;
  box-shadow: var(--shadow);
  width: fit-content;
}

.tsw-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  min-height: 0 !important;
}

.tsw-btn:hover {
  background: var(--surface-2);
  color: var(--text-2);
}

.tsw-btn.tsw-active {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text);
  box-shadow: var(--shadow);
}

.tsw-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.tsw-btn.tsw-active .tsw-count {
  background: var(--accent-bg);
  color: var(--accent-dk);
}

/* ── Deger Kaybi Table ───────────────────────────────────────────────────────── */

/* Row renk kodlama — Excel'deki mantıkla örtüşür */
tbody tr.dk-normal td { border-left: 3px solid var(--green); }
tbody tr.dk-yatma td:first-child { border-left: 3px solid var(--accent); }
tbody tr.dk-yatma { background: #f0f9ff; }
tbody tr.dk-yatma:hover { background: #e0f2fe; }
tbody tr.dk-bekle td:first-child { border-left: 3px solid var(--amber); }
tbody tr.dk-bekle { background: var(--amber-bg); }
tbody tr.dk-bekle:hover { background: #fef3c7; }
tbody tr.dk-dava td:first-child { border-left: 3px solid var(--red); }
tbody tr.dk-dava { background: var(--red-bg); }
tbody tr.dk-dava:hover { background: #fee2e2; }

/* DURUM pill renkleri */
.pill.dk-pill-dk-normal  { background: var(--green-bg);  color: var(--green);      border-color: var(--green-bdr);  }
.pill.dk-pill-dk-yatma   { background: var(--accent-bg); color: var(--accent-dk);  border-color: var(--accent-bdr); }
.pill.dk-pill-dk-bekle   { background: var(--amber-bg);  color: var(--amber);      border-color: var(--amber-bdr);  }
.pill.dk-pill-dk-dava    { background: var(--red-bg);    color: var(--red);        border-color: var(--red-bdr);    }

/* Legend */
.dk-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dk-leg-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid;
}

.dk-leg-item.dk-normal { background: var(--green-bg);  color: var(--green);     border-color: var(--green-bdr); }
.dk-leg-item.dk-yatma  { background: var(--accent-bg); color: var(--accent-dk); border-color: var(--accent-bdr); }
.dk-leg-item.dk-bekle  { background: var(--amber-bg);  color: var(--amber);     border-color: var(--amber-bdr); }
.dk-leg-item.dk-dava   { background: var(--red-bg);    color: var(--red);       border-color: var(--red-bdr); }

/* ── Column Filter Popup ────────────────────────────────────────────────────── */
.cfp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px !important;
  min-height: 0 !important;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--muted-2);
  cursor: pointer;
  padding: 0;
  margin-left: 5px;
  vertical-align: middle;
  transition: all .15s;
  flex-shrink: 0;
}

.cfp-btn:hover {
  border-color: var(--border);
  background: var(--surface-3);
  color: var(--muted);
}

th.cfp-active .cfp-btn {
  border-color: var(--accent-bdr);
  background: var(--accent-bg);
  color: var(--accent-dk);
}

th.cfp-active {
  color: var(--accent-dk);
}

th[data-col] {
  cursor: default;
  white-space: nowrap;
}

#cfp {
  position: absolute;
  z-index: 300;
  width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.cfp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.cfp-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text);
}

.cfp-clear-btn {
  font-size: 11px !important;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  height: auto !important;
  min-height: 0 !important;
  transition: color .15s;
}

.cfp-clear-btn:hover { color: var(--red); }

.cfp-search {
  display: block;
  width: calc(100% - 16px) !important;
  height: 32px !important;
  min-height: 0 !important;
  margin: 8px;
  font-size: 12px;
  padding: 0 10px;
}

.cfp-list {
  max-height: 210px;
  overflow-y: auto;
  padding: 4px 0;
}

.cfp-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-2);
  cursor: pointer;
  transition: background .1s;
  min-height: 0 !important;
  user-select: none;
}

.cfp-item:hover { background: var(--surface-2); }

.cfp-item input[type="checkbox"] {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  min-height: 0 !important;
  cursor: pointer;
}

.cfp-empty {
  display: block;
  padding: 14px 12px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.cfp-foot {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

.cfp-apply {
  width: 100%;
  height: 32px !important;
  min-height: 0 !important;
  font-size: 12px !important;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent-dk);
  border-radius: var(--radius);
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}

.cfp-apply:hover { background: var(--accent-dk); }

/* ── Utility ───────────────────────────────────────────────────────────────── */
.mx-auto { margin-left: auto; margin-right: auto; }
.w-full { width: 100%; }
.max-w-\[1420px\] { max-width: 1420px; }
.max-w-5xl { max-width: 1024px; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-6 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-8 { padding-top: 2rem; padding-bottom: 2rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }

/* These map Tailwind classes used in existing PHP files to our new tokens */
.rounded-xl, .rounded-2xl { border-radius: var(--radius-lg); }
.rounded-lg { border-radius: var(--radius); }
.rounded-md { border-radius: 6px; }
.rounded-full { border-radius: 999px; }
.border { border: 1px solid var(--border); }
.border-slate-200 { border-color: var(--border); }
.border-amber-200 { border-color: var(--amber-bdr); }
.bg-white { background: var(--surface); }
.bg-slate-50 { background: var(--surface-2); }
.bg-amber-50 { background: var(--amber-bg); }
.bg-blue-600 { background: var(--accent); }
.bg-blue-50 { background: var(--accent-bg); }
.shadow-sm { box-shadow: var(--shadow); }
.text-slate-950 { color: var(--text); }
.text-slate-700 { color: var(--text-2); }
.text-slate-500 { color: var(--muted); }
.text-amber-900 { color: #92400e; }
.text-amber-800 { color: #92400e; }
.text-blue-700 { color: var(--accent-dk); }
.text-red-700 { color: var(--red); }
.text-emerald-700 { color: var(--green); }
.text-white { color: #fff; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-normal { font-weight: 400; }
.text-3xl { font-size: 1.875rem; }
.text-xl { font-size: 1.25rem; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.overflow-hidden { overflow: hidden; }
.overflow-x-auto { overflow-x: auto; }
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
.py-1 { padding-top: 0.25rem; padding-bottom: 0.25rem; }
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
.py-4 { padding-top: 1rem; padding-bottom: 1rem; }
.py-5 { padding-top: 1.25rem; padding-bottom: 1.25rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.block { display: block; }
.inline-flex { display: inline-flex; }
.h-9 { height: 2.25rem; }
.h-10 { height: 2.5rem; }
.h-11 { height: 2.75rem; }
.h-12 { height: 3rem; }
.w-full { width: 100%; }
.whitespace-nowrap { white-space: nowrap; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.underline { text-decoration: underline; }
.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Tailwind grid helpers used in index.php */
.sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
.lg\:grid-cols-\[minmax\(260px\,1\.4fr\)_minmax\(180px\,1fr\)_minmax\(180px\,1fr\)_auto_auto\] {
  grid-template-columns: minmax(260px,1.4fr) minmax(180px,1fr) minmax(180px,1fr) auto auto;
}
.sm\:grid-cols-2, .sm\:px-6, .lg\:px-8 { }
@media (min-width: 640px) {
  .sm\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sm\:px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 1024px) {
  .lg\:px-8 { padding-left: 2rem; padding-right: 2rem; }
  .lg\:grid-cols-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
  .xl\:grid-cols-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
  .lg\:grid-cols-\[minmax\(260px\,1\.4fr\)_minmax\(180px\,1fr\)_minmax\(180px\,1fr\)_auto_auto\] {
    grid-template-columns: minmax(260px,1.4fr) minmax(180px,1fr) minmax(180px,1fr) auto auto;
  }
}

/* focus:ring shim */
.focus\:border-blue-500:focus { border-color: var(--accent); }
.focus\:ring-4:focus { box-shadow: 0 0 0 3px rgba(14,165,233,.12); }

/* hover shims */
.hover\:bg-slate-50:hover { background: var(--surface-2); }
.hover\:bg-blue-700:hover { background: var(--accent-dk); }
.hover\:bg-blue-100:hover { background: #dbeafe; }
.hover\:bg-amber-100:hover { background: #fef3c7; }
.hover\:underline:hover { text-decoration: underline; }

/* Pill/badge bg for policy warning table rows */
.rounded-full.bg-red-100 { background: var(--red-bg); }
.rounded-full.bg-amber-100 { background: var(--amber-bg); }
.rounded-full.bg-emerald-100 { background: var(--green-bg); }
.text-red-700 { color: var(--red); }
.text-amber-800 { color: #92400e; }
.text-emerald-700 { color: var(--green); }
.font-semibold { font-weight: 600; }

/* object-cover for images */
.object-cover { object-fit: cover; }
.object-position-center { object-position: center; }
.aspect-\[4\/3\] { aspect-ratio: 4/3; }
