/*
 * Panel teması — IBM Carbon tasarım sistemi (açık: g10, koyu: g100).
 * Erişilebilirlik hedefi: WCAG 2.2 AA (Birleşik Krallık kamu sektörü
 * erişilebilirlik yönetmeliği ve GOV.UK hizmet standardının istediği düzey).
 *
 *  - Metin kontrastı en az 4.5:1, kontrol kenarları ve odak halkası en az 3:1.
 *  - Klavye odağı her zaman görünür (2px Carbon odak halkası, :focus-visible).
 *  - Tıklama hedefleri en az 24x24 px (WCAG 2.5.8); varsayılan kontrol 40 px.
 *  - Bağlantılar altı çizili; renk tek başına anlam taşımaz.
 *  - "Hareketi azalt" tercihinde geçiş animasyonları kapanır.
 *
 * Renkler yalnızca aşağıdaki --cds-* belirteçlerinden okunur; koyu tema sadece
 * belirteçleri değiştirir. HTML'deki Tailwind renk/köşe sınıfları en altta bu
 * belirteçlere eşlenir (tailwind.css yeniden derlenmeden).
 */

:root {
  --cds-font: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
  --cds-font-mono: 'IBM Plex Mono', 'Menlo', 'Consolas', monospace;

  /* Göz yormaması için saf beyaz/siyah yerine Carbon "cool gray" tonları. */
  --cds-background: #e9ecef;
  --cds-layer: #f8f9fa;
  --cds-layer-accent: #e1e5e9;
  --cds-layer-hover: #edf0f3;
  --cds-field: #eef1f4;
  --cds-field-hover: #e4e8ec;
  --cds-border-subtle: #d6dbe0;
  --cds-border-strong: #878d96;
  --cds-text-primary: #21272a;
  --cds-text-secondary: #4d5358;
  --cds-text-helper: #5d646b;
  --cds-text-on-color: #ffffff;
  --cds-icon-secondary: #4d5358;
  --cds-link: #0f62fe;
  --cds-link-hover: #0043ce;
  --cds-focus: #0f62fe;
  --cds-focus-inset: #f8f9fa;
  --cds-interactive: #0f62fe;
  --cds-highlight: #edf5ff;

  --cds-button-primary: #0f62fe;
  --cds-button-primary-hover: #0050e6;
  --cds-button-primary-active: #002d9c;
  --cds-button-secondary: #393939;
  --cds-button-secondary-hover: #474747;
  --cds-button-secondary-active: #6f6f6f;
  --cds-button-tertiary: #0f62fe;
  --cds-button-tertiary-hover: #0050e6;
  --cds-button-danger: #da1e28;
  --cds-button-danger-hover: #b81921;
  --cds-button-success: #198038;
  --cds-button-success-hover: #0e6027;
  --cds-button-disabled: #c6c6c6;
  --cds-text-disabled: #8d8d8d;

  --cds-support-error: #da1e28;
  --cds-support-success: #198038;
  --cds-support-warning: #f1c21b;
  --cds-support-info: #0043ce;
  --cds-text-error: #da1e28;
  --cds-text-success: #0e6027;
  --cds-text-warning: #8a3800;
  --cds-notification-error: #fff1f1;
  --cds-notification-success: #defbe6;
  --cds-notification-warning: #fcf4d6;
  --cds-notification-info: #edf5ff;

  --cds-overlay: rgba(22, 22, 22, 0.5);
  --cds-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  --cds-motion: 70ms cubic-bezier(0.2, 0, 0.38, 0.9);

  /* Eski adlar (bazı betikler hâlâ kullanıyor) */
  --brand: var(--cds-interactive);
  --brand-2: var(--cds-link-hover);
  --ok: var(--cds-text-success);
  --danger: var(--cds-text-error);
  --ink: var(--cds-text-primary);
  --muted: var(--cds-text-secondary);
  --line: var(--cds-border-subtle);
  --surface: var(--cds-layer);
  --radius: 0;
}

/* ===== KARANLIK TEMA (Carbon g100) ===== */
html.dark {
  color-scheme: dark;
  --cds-background: #161616;
  --cds-layer: #262626;
  --cds-layer-accent: #393939;
  --cds-layer-hover: #333333;
  --cds-field: #393939;
  --cds-field-hover: #474747;
  --cds-border-subtle: #393939;
  --cds-border-strong: #8d8d8d;
  --cds-text-primary: #f4f4f4;
  --cds-text-secondary: #c6c6c6;
  --cds-text-helper: #a8a8a8;
  --cds-icon-secondary: #c6c6c6;
  --cds-link: #78a9ff;
  --cds-link-hover: #a6c8ff;
  --cds-focus: #ffffff;
  --cds-focus-inset: #161616;
  --cds-interactive: #4589ff;
  --cds-highlight: #001d6c;

  --cds-button-secondary: #6f6f6f;
  --cds-button-secondary-hover: #5e5e5e;
  --cds-button-secondary-active: #393939;
  --cds-button-tertiary: #ffffff;
  --cds-button-tertiary-hover: #f4f4f4;
  --cds-button-disabled: #525252;
  --cds-text-disabled: #8d8d8d;

  --cds-text-error: #ff8389;
  --cds-text-success: #42be65;
  --cds-text-warning: #f1c21b;
  --cds-support-error: #fa4d56;
  --cds-support-success: #42be65;
  --cds-support-info: #4589ff;
  --cds-notification-error: #3d1517;
  --cds-notification-success: #0d2a16;
  --cds-notification-warning: #3a2f05;
  --cds-notification-info: #0d1f42;

  --cds-overlay: rgba(0, 0, 0, 0.65);
  --cds-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

/* ===== Temel ===== */
*,
.font-sans {
  font-family: var(--cds-font);
}
code, pre, kbd, samp, .font-mono { font-family: var(--cds-font-mono); }

body {
  background: var(--cds-background);
  color: var(--cds-text-primary);
  font-size: 0.9375rem;
  line-height: 1.5;
  letter-spacing: 0;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
}

/* Tailwind preflight bağlantıları "inherit" yapıyor; sınıfsız bağlantılar Carbon bağlantısı olur. */
a:not([class]) { color: var(--cds-link); text-decoration: underline; text-underline-offset: 2px; }
a:not([class]):hover { color: var(--cds-link-hover); }

/* Klavye odağı: Carbon odak halkası. Fare tıklamasında görünmez, Tab ile her zaman görünür. */
:focus-visible {
  outline: 2px solid var(--cds-focus);
  outline-offset: 1px;
}
button:focus-visible,
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-outline:focus-visible,
.btn-success:focus-visible,
.btn-danger:focus-visible,
.sidebar-btn:focus-visible {
  outline: 2px solid var(--cds-focus);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 3px var(--cds-focus-inset);
}

/* "Ana içeriğe geç" bağlantısı: yalnızca klavye odağında görünür. */
.skip-link {
  position: absolute;
  left: 0.5rem;
  top: -100px;
  z-index: 100;
  padding: 0.75rem 1rem;
  background: var(--cds-layer);
  color: var(--cds-text-primary);
  font-weight: 600;
  text-decoration: underline;
  box-shadow: var(--cds-shadow);
}
.skip-link:focus { top: 0.5rem; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.sr-only-focusable:not(:focus) {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ===== Butonlar (Carbon Button, orta boy 40px) ===== */
.btn-primary,
.btn-secondary,
.btn-outline,
.btn-success,
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 0;
  font-weight: 400;
  font-size: 0.875rem;
  line-height: 1.29;
  letter-spacing: 0.16px;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--cds-motion), border-color var(--cds-motion), color var(--cds-motion);
}

.btn-sm {
  min-height: 2rem;
  padding: 0 0.75rem;
  gap: 0.375rem;
}

.btn-primary { background: var(--cds-button-primary); color: var(--cds-text-on-color); }
.btn-primary:hover { background: var(--cds-button-primary-hover); }
.btn-primary:active { background: var(--cds-button-primary-active); }

.btn-secondary { background: var(--cds-button-secondary); color: var(--cds-text-on-color); }
.btn-secondary:hover { background: var(--cds-button-secondary-hover); }
.btn-secondary:active { background: var(--cds-button-secondary-active); }

/* Carbon "tertiary": çerçeveli */
.btn-outline { background: transparent; border-color: var(--cds-button-tertiary); color: var(--cds-button-tertiary); }
.btn-outline:hover { background: var(--cds-button-tertiary-hover); border-color: var(--cds-button-tertiary-hover); color: var(--cds-text-on-color); }
html.dark .btn-outline:hover { color: #161616; }

.btn-success { background: var(--cds-button-success); color: var(--cds-text-on-color); }
.btn-success:hover { background: var(--cds-button-success-hover); }

.btn-danger { background: var(--cds-button-danger); color: var(--cds-text-on-color); }
.btn-danger:hover { background: var(--cds-button-danger-hover); }

.btn-primary:disabled,
.btn-secondary:disabled,
.btn-success:disabled,
.btn-danger:disabled {
  background: var(--cds-button-disabled);
  border-color: transparent;
  color: var(--cds-text-disabled);
  cursor: not-allowed;
}
.btn-outline:disabled {
  background: transparent;
  border-color: var(--cds-button-disabled);
  color: var(--cds-text-disabled);
  cursor: not-allowed;
}

/* ===== Form (Carbon Text input) ===== */
.input-base {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.6875rem 1rem;
  font-weight: 400;
  background-color: var(--cds-field);
  border: 0;
  border-bottom: 1px solid var(--cds-border-strong);
  border-radius: 0;
  color: var(--cds-text-primary);
  font-size: 0.9375rem;
  line-height: 1.29;
  letter-spacing: 0.16px;
  transition: background-color var(--cds-motion), outline var(--cds-motion);
}
.input-base:hover { background-color: var(--cds-field-hover); }
.input-base:focus,
.input-base:focus-visible {
  outline: 2px solid var(--cds-focus);
  outline-offset: -2px;
  box-shadow: none;
}
.input-base::placeholder { color: var(--cds-text-helper); opacity: 1; }
.input-base:disabled {
  background-color: var(--cds-field);
  border-bottom-color: transparent;
  color: var(--cds-text-disabled);
  cursor: not-allowed;
}
.input-base[aria-invalid="true"] { outline: 2px solid var(--cds-support-error); outline-offset: -2px; }
.card .input-base { background-color: var(--cds-field); }
/* Tek satırlı alanlar (metin, seçim, tarih) aynı yükseklikte: yan yana dizildiklerinde etiketler kaymaz. */
input.input-base:not([type="file"]),
select.input-base {
  height: 2.5rem;
  padding-top: 0;
  padding-bottom: 0;
}
select.input-base { cursor: pointer; padding-left: 1rem; padding-right: 0.5rem; }
/* Betiklerin doldurduğu, henüz boş kutular (ör. veri gelmemiş liste) araya boşluk koymasın. */
.card div[id]:empty { display: none; }

/* Türkçe tarih alanı (gg.aa.yyyy). Tarayıcının kendi tarih kutusu, işletim
 * sistemi diline göre "tt.mm.jjjj" gibi yabancı biçim gösterdiği için gizlenir;
 * değer yine onun üzerinden (yyyy-aa-gg) okunur. Bkz. app.js enhanceDateInputs. */
.date-field { position: relative; display: block; }
.date-field.is-inline { display: inline-block; width: auto; }
.date-field .date-text { padding-right: 2.75rem; font-variant-numeric: tabular-nums; }
.date-field.is-inline .date-text { width: 9.5rem !important; }
.date-field .date-native {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 2.5rem;
  height: 2.5rem;
  opacity: 0;
  pointer-events: none;
}
.date-field .date-picker-btn {
  position: absolute;
  top: 0;
  right: 0;
  width: 2.5rem;
  height: 2.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
  color: var(--cds-icon-secondary);
  cursor: pointer;
}
.date-field .date-picker-btn:hover { color: var(--cds-text-primary); }
textarea.input-base { line-height: 1.43; }

input[type="file"].input-base { padding: 0.375rem 0.5rem; font-size: 0.8125rem; }
input[type="file"].input-base::file-selector-button {
  margin-right: 0.75rem;
  min-height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--cds-button-tertiary);
  border-radius: 0;
  background: transparent;
  color: var(--cds-button-tertiary);
  font: inherit;
  cursor: pointer;
}

input[type="checkbox"],
input[type="radio"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--cds-text-primary);
}

.label-base {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.34;
  letter-spacing: 0.32px;
  color: var(--cds-text-secondary);
}

/* ===== Kartlar (Carbon Tile) ===== */
.card {
  background-color: var(--cds-layer);
  border: 1px solid var(--cds-border-subtle);
  border-radius: 0;
  box-shadow: none;
  /* Izgara/flex içindeki kart içeriğinin (tek satırlık uzun yazı, dosya seçici) genişliğine
     zorlanmaz; yoksa dar ekranda kart sayfadan taşar. */
  min-width: 0;
}

.card-header {
  padding: 1rem 1.5rem;
  background: transparent;
  color: var(--cds-text-primary);
  border-bottom: 1px solid var(--cds-border-subtle);
  border-radius: 0;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.375;
}
/* Yalnızca başlık simgesi gri; başlıktaki düğmelerin simgeleri düğme rengini alır. */
.card-header > .bi,
.card-header > span > .bi { color: var(--cds-icon-secondary); }
.card-header .input-base { font-weight: 400; }

.section-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--cds-text-primary);
}
.section-title .bi { color: var(--cds-icon-secondary); }

/* İstatistik kartları */
.stat-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
}
.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: 0 0 auto;
  border-radius: 0;
  background: var(--cds-highlight);
  color: var(--cds-link);
  font-size: 1.25rem;
}
.stat-label {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.32px;
  color: var(--cds-text-secondary);
}
.stat-value {
  margin-top: 0.25rem;
  font-size: 1.75rem;
  line-height: 1.29;
  font-weight: 400;
  color: var(--cds-text-primary);
}
.stat-value.is-small {
  font-size: 1rem;
  font-weight: 600;
}

/* ===== Üst çubuk (temayla aynı yüzey; siyah bant yerine) ===== */
.panel-nav {
  position: sticky;
}
/* .bg-white eşlemesini (aşağıda) ezmek için iki sınıflı seçici */
.panel-nav,
.panel-nav.bg-white {
  top: 0;
  z-index: 30;
  background: var(--cds-layer) !important;
  border-bottom: 1px solid var(--cds-border-subtle) !important;
  color: var(--cds-text-primary);
}
.panel-nav .chip { background: transparent; border-color: var(--cds-border-subtle); color: var(--cds-text-secondary); }
.panel-nav .icon-btn,
.panel-nav .btn-secondary {
  background: transparent;
  border-color: transparent;
  color: var(--cds-text-secondary);
}
.panel-nav .icon-btn:hover,
.panel-nav .btn-secondary:hover { background: var(--cds-layer-hover); color: var(--cds-text-primary); }

/* ===== Yan menü (Carbon Side nav) ===== */
.panel-sidebar {
  width: 16rem;
  background: var(--cds-layer) !important;
  border-color: var(--cds-border-subtle) !important;
}
.panel-sidebar-inner {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 1rem 0;
  height: 100%;
}
.sidebar-btn,
.sidebar-btn.btn-secondary {
  position: relative;
  width: 100%;
  min-height: 2.25rem;
  justify-content: flex-start;
  gap: 0.75rem;
  padding: 0 1rem;
  background: transparent;
  border: 0;
  box-shadow: none;
  color: var(--cds-text-secondary);
  font-weight: 400;
  text-align: left;
  text-decoration: none;
}
.sidebar-btn .bi { color: var(--cds-icon-secondary); font-size: 1rem; }
.sidebar-btn span {
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-btn:hover,
.sidebar-btn.btn-secondary:hover {
  background: var(--cds-layer-hover);
  color: var(--cds-text-primary);
}
.sidebar-btn.is-active,
.sidebar-btn[aria-current="page"] {
  background: var(--cds-layer-accent);
  color: var(--cds-text-primary);
  font-weight: 600;
}
.sidebar-btn.is-active::before,
.sidebar-btn[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--cds-interactive);
}
.sidebar-btn.is-active .bi { color: var(--cds-text-primary); }
.sidebar-group {
  display: flex;
  flex-direction: column;
  margin-top: 1rem;
}
.sidebar-group:not(:has(.sidebar-btn:not(.hidden))) { display: none; }
.sidebar-group-title {
  padding: 0 1rem 0.5rem;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.32px;
  color: var(--cds-text-secondary);
}
.sidebar-footer {
  margin: auto 1rem 0;
  padding-top: 1rem;
  border-top: 1px solid var(--cds-border-subtle);
  font-size: 0.8125rem;
  line-height: 1.34;
  letter-spacing: 0.32px;
  color: var(--cds-text-secondary);
}
.sidebar-footer a { color: inherit; }
.sidebar-footer a:hover { color: var(--cds-text-primary); }

/* Portal altbilgisi — tek satır: marka | geliştirici  ……  Künye */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--cds-border-subtle);
  background: var(--cds-layer);
  color: var(--cds-text-secondary);
  font-size: 0.8125rem;
  line-height: 1.4;
  letter-spacing: 0.32px;
}
.site-footer-inner {
  margin: 0 auto;
  max-width: 1400px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
}
.site-footer-brand {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.site-footer-brand strong {
  color: var(--cds-text-primary);
  font-weight: 600;
}
.site-footer-sep {
  color: var(--cds-border-strong, #c6c6c6);
  user-select: none;
}
.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}
.site-footer a:hover { color: var(--cds-text-primary); }
body.site-shell {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}
body.site-shell > main { flex: 1 0 auto; }

.kunye-page {
  margin: 0 auto;
  max-width: 40rem;
  padding: 2.5rem 1rem 3rem;
}
.kunye-page h1 {
  margin: 0 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--cds-text-primary);
}
.kunye-page .kunye-lead {
  margin: 0 0 2rem;
  color: var(--cds-text-secondary);
  font-size: 0.9375rem;
}
.kunye-page h2 {
  margin: 0 0 0.75rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cds-text-secondary);
}
.kunye-page address {
  margin: 0 0 2rem;
  font-style: normal;
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--cds-text-primary);
}
.kunye-page .kunye-meta {
  margin: 0;
  display: grid;
  gap: 0.85rem 1.25rem;
}
@media (min-width: 480px) {
  .kunye-page .kunye-meta {
    grid-template-columns: 7rem 1fr;
    align-items: baseline;
  }
}
.kunye-page .kunye-meta dt {
  margin: 0;
  color: var(--cds-text-secondary);
  font-size: 0.8125rem;
}
.kunye-page .kunye-meta dd {
  margin: 0;
  color: var(--cds-text-primary);
}

/* Carbon Tag */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  min-height: 2rem;
  padding: 0 0.75rem;
  border: 1px solid var(--cds-border-subtle);
  border-radius: 0;
  background: var(--cds-layer);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--cds-text-secondary);
  white-space: nowrap;
}

/* Yalnızca simgeli düğme (Carbon icon-only ghost button) */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0;
  border: 1px solid transparent;
  background: transparent;
  color: var(--cds-icon-secondary);
  transition: background-color var(--cds-motion);
}
.icon-btn:hover { background: var(--cds-layer-hover); color: var(--cds-text-primary); }

/* ===== Tablolar (Carbon Data table) ===== */
.table-wrap {
  overflow: auto;
  border: 0;
  border-radius: 0;
  background: var(--cds-layer);
}
.data-table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
}
.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 3rem;
  padding: 0 1rem;
  background-color: var(--cds-layer-accent);
  color: var(--cds-text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: 0.16px;
  text-align: left;
  border-bottom: 0;
  white-space: nowrap;
}
.data-table tbody td {
  height: 3rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--cds-layer);
  border-bottom: 1px solid var(--cds-border-subtle);
  background: var(--cds-field);
  font-size: 0.9375rem;
  color: var(--cds-text-secondary);
  vertical-align: middle;
}
.data-table.is-compact thead th { height: 2rem; padding: 0 0.75rem; font-size: 0.8125rem; }
.data-table.is-compact tbody td { height: 2rem; padding: 0.25rem 0.75rem; font-size: 0.8125rem; white-space: nowrap; }
.data-table thead th.text-center { text-align: center; }
.data-table tbody tr:hover td { background-color: var(--cds-layer-hover); color: var(--cds-text-primary); }
.data-table .time-cell {
  position: sticky;
  left: 0;
  background-color: var(--cds-layer-accent);
  color: var(--cds-text-primary);
  font-weight: 600;
  white-space: nowrap;
}

.table-scroll { max-height: 70vh; }
/* Ölçüm tablosunda zaman sütunu içeriği kadar geniş; kalan alan ölçümlere kalır. */
.data-table .time-cell { width: 1%; }

/* Sayfayla birlikte akan tablo: kendi dikey kaydırması yok (çift kaydırma
 * çubuğu olmaz), başlık satırı üst çubuğun altında sabit kalır. Dar ekranda
 * yalnızca yatay kaydırma vardır. */
.table-flow { overflow-x: auto; overflow-y: visible; }
@media (min-width: 1024px) {
  .table-flow { overflow: visible; }
  .table-flow .data-table thead th { top: var(--panel-nav-h, 0px); z-index: 2; }
}

/* Parti tablosunda satırlar tek satır (yoğun liste); dar ekranda yana kayar. */
#party-table td { white-space: nowrap; }

/* Sayısal sütunlar sağa hizalı, rakamlar eşit genişlikte */
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.data-table thead th.num { text-align: right; }
.data-table thead th.col-actions,
.data-table td.col-actions { width: 1%; padding-left: 0.5rem; padding-right: 0.5rem; text-align: right; white-space: nowrap; }
.data-table td.col-actions .icon-btn { width: 2rem; height: 2rem; }

/* Satıra tıklayınca detay açılan tablolar */
.data-table.is-clickable tbody tr[data-row-id] { cursor: pointer; }
.row-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--cds-text-primary);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.row-link:hover { color: var(--cds-link); text-decoration: underline; }
.row-link:focus-visible { outline: 2px solid var(--cds-focus); outline-offset: 2px; box-shadow: none; }

/* Sıralanabilir başlık (Carbon sortable header) */
.data-table thead th.is-sortable { padding: 0; }
.th-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  height: 3rem;
  padding: 0 1rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
th.num .th-sort { justify-content: flex-end; }
.th-sort:hover { background: var(--cds-layer-hover); }
.th-sort .bi { font-size: 0.75rem; color: var(--cds-icon-secondary); opacity: 0; }
.th-sort:hover .bi,
.th-sort:focus-visible .bi,
th[aria-sort="ascending"] .th-sort .bi,
th[aria-sort="descending"] .th-sort .bi { opacity: 1; color: var(--cds-text-primary); }

/* Hücre içi ikincil satır (ör. kullanıcı · e-posta) */
.cell-sub {
  margin-top: 0.125rem;
  font-size: 0.8125rem;
  letter-spacing: 0.32px;
  color: var(--cds-text-helper);
}
.cell-sep { margin: 0 0.25rem; color: var(--cds-text-helper); }

/* Satır işlem menüsü (Carbon Overflow menu) */
.action-menu {
  position: fixed;
  z-index: 60;
  width: 14rem;
  overflow-y: auto;
  padding: 0;
  background: var(--cds-layer);
  border: 0;
  border-radius: 0;
  box-shadow: var(--cds-shadow);
}
.action-menu.hidden { display: none; }
.action-menu-group + .action-menu-group { border-top: 1px solid var(--cds-border-subtle); }
.action-menu-title {
  padding: 0.5rem 1rem 0.25rem;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.32px;
  color: var(--cds-text-secondary);
}
.action-menu-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 0;
  border-radius: 0;
  background: transparent;
  text-align: left;
  font-size: 0.875rem;
  color: var(--cds-text-secondary);
  cursor: pointer;
}
.action-menu-item .bi { width: 1rem; color: var(--cds-icon-secondary); }
.action-menu-item:hover { background: var(--cds-layer-hover); color: var(--cds-text-primary); }
.action-menu-item:hover .bi { color: var(--cds-text-primary); }
.action-menu-item:focus-visible { outline: 2px solid var(--cds-focus); outline-offset: -2px; }
.action-menu-item.is-ok,
.action-menu-item.is-ok .bi { color: var(--cds-text-success); }
.action-menu-item.is-danger,
.action-menu-item.is-danger .bi { color: var(--cds-text-error); }
.action-menu-item.is-danger:hover,
.action-menu-item.is-danger:hover .bi { background: var(--cds-button-danger); color: var(--cds-text-on-color); }

/* Rozetler (Carbon Tag; durum metinle de yazılı, renk tek başına anlam taşımaz) */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  min-height: 1.5rem;
  padding: 0 0.5rem;
  border-radius: 1rem;
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.32px;
  white-space: nowrap;
}
.badge-neutral { background: #e0e0e0; color: #161616; }
.badge-brand { background: #d0e2ff; color: #002d9c; }
.badge-violet { background: #e8daff; color: #491d8b; }
.badge-amber { background: #fcf4d6; color: #5e2900; }
.badge-green { background: #a7f0ba; color: #044317; }
.badge-red { background: #ffd7d9; color: #750e13; }
html.dark .badge-neutral { background: #525252; color: #f4f4f4; }
html.dark .badge-brand { background: #0043ce; color: #d0e2ff; }
html.dark .badge-violet { background: #6929c4; color: #e8daff; }
html.dark .badge-amber { background: #684e00; color: #fcf4d6; }
html.dark .badge-green { background: #0e6027; color: #a7f0ba; }
html.dark .badge-red { background: #a2191f; color: #ffd7d9; }

/* Panel içi modal (Carbon Modal) */
.panel-modal {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 2rem 0.75rem;
  background: var(--cds-overlay);
}
.panel-modal.hidden { display: none; }
.panel-modal > .card { width: 100%; max-width: 64rem; border: 0; box-shadow: var(--cds-shadow); }
.panel-modal .modal-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0;
  color: var(--cds-icon-secondary);
}
.panel-modal .modal-x:hover { background: var(--cds-layer-hover); color: var(--cds-text-primary); }
.license-key {
  font-family: var(--cds-font-mono);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  word-break: break-all;
}

/* Müşteri panelindeki teklif (paket) kartları */
.offer-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--cds-border-subtle);
  border-radius: 0;
  background: var(--cds-layer);
}
.offer-card.is-current { border-color: var(--cds-interactive); box-shadow: inset 0 0 0 1px var(--cds-interactive); }
.offer-card .offer-price { font-size: 1.25rem; font-weight: 600; color: var(--cds-text-primary); line-height: 1.4; }
.offer-card ul { display: grid; gap: 0.375rem; font-size: 0.875rem; }
.offer-card ul li { display: flex; gap: 0.5rem; align-items: flex-start; }
.offer-card ul li .bi { color: var(--cds-text-success); margin-top: 0.125rem; }
.offer-card .offer-actions { margin-top: auto; padding-top: 0.25rem; }
/* Teklif iç notu (yalnızca superadmin görür) */
.offer-note {
  margin-top: 0.25rem;
  padding: 0.25rem 0.5rem;
  border-left: 3px solid var(--cds-support-warning);
  background: var(--cds-notification-warning);
  color: var(--cds-text-primary);
  font-size: 0.75rem;
  white-space: pre-line;
}
#offer-storage-fields:disabled { opacity: 0.5; }
td.offer-terms { min-width: 18rem; }

/* Meta bilgi ızgarası */
.meta-item {
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 0;
  background: var(--cds-field);
}
.meta-item dt {
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.32px;
  color: var(--cds-text-secondary);
}
.meta-item dd {
  margin-top: 0.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--cds-text-primary);
  word-break: break-word;
}

/* Alt alta "etiket — değer" listesi (Carbon structured list); geniş ekranda iki sütun. */
.meta-list {
  display: grid;
  grid-template-columns: 1fr;
  column-gap: 2rem;
  border-top: 1px solid var(--cds-border-subtle);
}
@media (min-width: 768px) {
  .meta-list { grid-template-columns: 1fr 1fr; }
}
.meta-list .meta-item {
  display: grid;
  grid-template-columns: minmax(7rem, 42%) 1fr;
  gap: 1rem;
  align-items: baseline;
  padding: 0.625rem 0;
  background: transparent;
  border-bottom: 1px solid var(--cds-border-subtle);
}
.meta-list .meta-item dt {
  font-size: 0.875rem;
  letter-spacing: 0.16px;
  color: var(--cds-text-secondary);
}
.meta-list .meta-item dd { margin-top: 0; }

.empty-state {
  padding: 2rem 1rem;
  border: 1px dashed var(--cds-border-strong);
  border-radius: 0;
  text-align: center;
  font-size: 0.875rem;
  color: var(--cds-text-secondary);
}

.media-card {
  overflow: hidden;
  border: 1px solid var(--cds-border-subtle);
  border-radius: 0;
  background: var(--cds-layer);
}

/* Durum bildirimi (Carbon Toast notification) */
.status-toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 70;
  max-width: min(28rem, calc(100vw - 2rem));
  min-height: 3rem;
  padding: 0.875rem 1rem;
  border: 0;
  border-left: 3px solid var(--cds-support-info);
  border-radius: 0;
  background: var(--cds-notification-info);
  box-shadow: var(--cds-shadow);
  color: var(--cds-text-primary);
  font-size: 0.875rem;
  font-weight: 400;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.status-toast > .bi { font-size: 1.25rem; line-height: 1; }
.status-toast > span { flex: 1; padding-top: 0.125rem; }
.status-toast.is-ok { border-left-color: var(--cds-support-success); background: var(--cds-notification-success); }
.status-toast.is-ok > .bi { color: var(--cds-support-success); }
.status-toast.is-error { border-left-color: var(--cds-support-error); background: var(--cds-notification-error); }
.status-toast.is-error > .bi { color: var(--cds-support-error); }
.status-toast-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin: -0.375rem -0.5rem -0.375rem 0;
  border: 0;
  background: transparent;
  color: var(--cds-text-primary);
  cursor: pointer;
}
.status-toast-close:hover { background: rgba(0, 0, 0, 0.08); }
html.dark .status-toast-close:hover { background: rgba(255, 255, 255, 0.12); }

/* Onay penceresi (Carbon danger modal) */
.confirm-dialog > .card { max-width: 32rem; margin-top: 12vh; }
.confirm-dialog h2 { font-size: 1.25rem; font-weight: 400; line-height: 1.4; color: var(--cds-text-primary); }
.confirm-dialog .confirm-body { padding: 0 1rem 2rem; color: var(--cds-text-primary); }
.confirm-dialog .confirm-actions { display: grid; grid-template-columns: 1fr 1fr; }
.confirm-dialog .confirm-actions > button { min-height: 4rem; align-items: flex-start; justify-content: flex-start; padding-top: 1rem; }

.modal-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0;
  color: #f4f4f4;
  background-color: #393939;
  border: 0;
  font-size: 1.1rem;
  transition: background-color var(--cds-motion);
  --cds-focus: #ffffff;
  --cds-focus-inset: #161616;
}
.modal-close-btn:hover { background-color: #474747; }

/* Giriş kartındaki metin bağlantıları (Şifremi unuttum, Kayıt olun) */
.auth-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--cds-link);
  font-weight: 400;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.auth-link:hover { color: var(--cds-link-hover); }
.auth-link:focus-visible { outline-offset: 1px; box-shadow: none; }

@media (max-width: 768px) {
  /* iOS odakta yakınlaştırmasın diye form alanı en az 16px */
  .input-base { font-size: 16px; }

  .stat-card { gap: 0.75rem; padding: 0.75rem; }
  .stat-icon { display: none; }
  .stat-value { font-size: 1.25rem; }
  .stat-value.is-small { font-size: 0.875rem; }

  /* Telefonda menü tek satır, yana kayan sekme şeridi (Carbon Tabs gibi). */
  .panel-sidebar { width: 100%; }
  .panel-sidebar-inner {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
    padding: 0;
  }
  .sidebar-group { display: contents; }
  .sidebar-group-title { display: none; }
  .sidebar-btn,
  .sidebar-btn.btn-secondary {
    width: auto;
    flex: 0 0 auto;
    min-height: 3rem;
    justify-content: flex-start;
  }
  .sidebar-btn.is-active::before,
  .sidebar-btn[aria-current="page"]::before { top: auto; right: 0; width: auto; height: 3px; }
  .sidebar-footer { display: none; }
}

/* ===== Tailwind yardımcı sınıflarının Carbon belirteçlerine eşlenmesi ===== */
/* Carbon'da köşeler kare; yalnızca tam yuvarlak (avatar/nokta) kalır. */
.rounded, .rounded-sm, .rounded-md, .rounded-lg, .rounded-xl, .rounded-2xl { border-radius: 0 !important; }
.shadow, .shadow-sm, .shadow-md, .shadow-lg { box-shadow: none !important; }

.bg-white { background-color: var(--cds-layer) !important; }
.bg-neutral-50 { background-color: var(--cds-background) !important; }
.bg-neutral-100 { background-color: var(--cds-field) !important; }
.bg-neutral-200 { background-color: var(--cds-layer-accent) !important; }

/* Metin: neutral-400/500 beyaz zeminde 4.5:1'in altında kalıyordu. */
.text-neutral-900, .text-neutral-800 { color: var(--cds-text-primary) !important; }
.text-neutral-700, .text-neutral-600, .text-neutral-500 { color: var(--cds-text-secondary) !important; }
.text-neutral-400 { color: var(--cds-text-helper) !important; }
.border-neutral-100, .border-neutral-200 { border-color: var(--cds-border-subtle) !important; }
.border-neutral-300 { border-color: var(--cds-border-strong) !important; }

/* Durum kutuları -> Carbon Inline notification (sol şerit + açık zemin) */
.bg-amber-50, .bg-blue-50, .bg-red-50, .bg-rose-50, .bg-green-50 { color: var(--cds-text-primary); }
.bg-amber-50 { background-color: var(--cds-notification-warning) !important; }
.bg-blue-50 { background-color: var(--cds-notification-info) !important; }
.bg-red-50, .bg-rose-50 { background-color: var(--cds-notification-error) !important; }
.bg-green-50 { background-color: var(--cds-notification-success) !important; }
.border-amber-200, .border-amber-300 { border-color: var(--cds-support-warning) !important; border-left-width: 3px !important; }
.border-blue-200 { border-color: var(--cds-support-info) !important; border-left-width: 3px !important; }
.border-red-200, .border-rose-200 { border-color: var(--cds-support-error) !important; border-left-width: 3px !important; }
.border-green-200 { border-color: var(--cds-support-success) !important; border-left-width: 3px !important; }
.border-blue-300, .border-blue-400 { border-color: var(--cds-interactive) !important; }
.ring-blue-200 { --tw-ring-color: var(--cds-interactive) !important; }
.bg-blue-600 { background-color: var(--cds-button-primary) !important; }

.text-amber-900, .text-amber-800, .text-blue-800, .text-red-800, .text-rose-800, .text-green-800 { color: var(--cds-text-primary) !important; }
.text-amber-700, .text-amber-600 { color: var(--cds-text-warning) !important; }
.text-red-600, .text-rose-600, .text-rose-500 { color: var(--cds-text-error) !important; }
.text-green-600, .text-emerald-600, .text-emerald-700 { color: var(--cds-text-success) !important; }

html.dark .dark\:border-neutral-700 { border-color: var(--cds-border-subtle) !important; }
html.dark .dark\:text-neutral-200 { color: var(--cds-text-primary) !important; }
html.dark .dark\:bg-neutral-900 { background-color: var(--cds-background) !important; }
html.dark select option { background-color: var(--cds-layer); }

/* Hareketi azalt tercihi (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}

/* Windows yüksek karşıtlık modu: kare çerçeveler ve odak görünür kalsın */
@media (forced-colors: active) {
  .btn-primary, .btn-secondary, .btn-outline, .btn-success, .btn-danger, .icon-btn, .chip, .badge { border: 1px solid ButtonText; }
  .sidebar-btn.is-active::before { background: Highlight; }
  :focus-visible { outline-color: Highlight; }
}

/* Saha ekibinin müşteri gözüyle (salt okunur) görünümü: lisans ekranında satın alma ve düzenleme yok. */
body.view-only #view-license button,
body.view-only #view-license form { display: none !important; }

/* ---- Sıcaklık eğrisi (assets/temperature-chart.js) ---- */
.temp-chart {
  --tc-thermostat: #2a78d6;
  --tc-room: #eb6834;
  --tc-threshold: var(--cds-text-secondary);
  --tc-grid: var(--cds-border-subtle);
  --tc-tick: var(--cds-text-helper);
  display: block;
  min-width: 0;
}
html.dark .temp-chart {
  --tc-thermostat: #3987e5;
  --tc-room: #d95926;
}
.temp-chart-frame { position: relative; }
.temp-chart svg { display: block; overflow: visible; }
.temp-chart .tc-grid { stroke: var(--tc-grid); stroke-width: 1; }
.temp-chart .tc-tick { fill: var(--tc-tick); font-size: 11px; font-family: var(--cds-font); }
.temp-chart .tc-threshold { stroke: var(--tc-threshold); stroke-width: 1.5; stroke-dasharray: 6 4; }
.temp-chart .tc-line { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.temp-chart .tc-line.is-thermostat { stroke: var(--tc-thermostat); }
.temp-chart .tc-line.is-room { stroke: var(--tc-room); stroke-width: 2; }
.temp-chart .tc-cross { stroke: var(--cds-text-secondary); stroke-width: 1; }
.temp-chart-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 10px; font-size: 12px; color: var(--cds-text-secondary); }
.temp-chart-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.temp-chart-key { display: inline-block; width: 16px; height: 0; border-top: 2px solid; flex-shrink: 0; }
.temp-chart-key.is-thermostat { border-color: var(--tc-thermostat); }
.temp-chart-key.is-room { border-color: var(--tc-room); }
.temp-chart-key.is-threshold { border-top-style: dashed; border-color: var(--tc-threshold); }
.temp-chart-tip {
  position: absolute;
  top: 8px;
  z-index: 3;
  max-width: min(360px, 100%);
  padding: 8px 10px;
  background: var(--cds-layer);
  border: 1px solid var(--cds-border-subtle);
  box-shadow: var(--cds-shadow);
  font-size: 12px;
  color: var(--cds-text-primary);
  pointer-events: none;
}
.temp-chart-tip-title { margin-bottom: 4px; color: var(--cds-text-secondary); }
.temp-chart-tip-grid { display: grid; grid-template-columns: repeat(2, minmax(0, auto)); gap: 2px 14px; }
.temp-chart-tip-row { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.temp-chart-tip-row .temp-chart-key { width: 10px; }
.temp-chart-tip-name { color: var(--cds-text-secondary); }
.temp-chart-note, .temp-chart-empty { margin-top: 8px; font-size: 12px; color: var(--cds-text-helper); }

/* Medya kartındaki dosya adı: uzun ad (boşluksuz da olsa) kartı taşırmadan en fazla iki satıra kırılır. */
.media-name {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.media-card { min-width: 0; }

/* QR rapor sayfasının üstündeki firma / parti / fırın şeridi. */
.report-strip {
  background: var(--cds-layer);
  border-bottom: 1px solid var(--cds-border-subtle);
  box-shadow: inset 0 3px 0 var(--cds-interactive);
}
.report-strip[hidden] { display: none; }
.report-strip-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px 40px;
  padding-top: 16px;
  padding-bottom: 14px;
}
.report-strip-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.report-strip-label {
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--cds-text-helper);
}
.report-strip-value {
  font-size: 20px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--cds-text-primary);
  overflow-wrap: anywhere;
}
.report-strip-item:not(.is-company) .report-strip-value { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .report-strip-inner { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; padding-top: 14px; padding-bottom: 12px; }
  .report-strip-item.is-company { grid-column: 1 / -1; }
  .report-strip-value { font-size: 17px; }
  /* Telefonda başlık kesilmesin: etiket yalnız simge kalır, yazı ekran okuyucuya kalır. */
  .report-chip-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
