/* =============================================================================
   Parantez Flow — Dynamics 365 (UCI) / Fluent UI v9 görünümü
   Değerler d365-tokens.css'ten gelir (docs/MSCRM_UI/D365-UI-SPEC.md).
   Kurallar: kontrol 4px / yüzey 8px radius, çift katmanlı gölge, tek aksan rengi,
   başlıklar 600, kenarlıksız gri input + focus alt çizgisi.
   ============================================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--fontFamilyBase);
  font-size: var(--fontSizeBase300);
  line-height: var(--lineHeightBase300);
  color: var(--colorNeutralForeground1);
  background: var(--d365-appCanvas);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--colorBrandForegroundLink); text-decoration: none; }
a:hover { color: var(--colorBrandForegroundLinkHover); text-decoration: underline; }
h1 { font-size: var(--fontSizeBase500); line-height: var(--lineHeightBase500); font-weight: var(--fontWeightSemibold); margin: 0; }
h2 { font-size: var(--fontSizeBase300); line-height: var(--lineHeightBase300); font-weight: var(--fontWeightSemibold); margin: 20px 0 8px; }
h3 { font-size: var(--fontSizeBase300); font-weight: var(--fontWeightSemibold); margin: 16px 0 8px; }
.muted { color: var(--colorNeutralForeground3); }
.small { font-size: var(--fontSizeBase200); line-height: var(--lineHeightBase200); }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Fluent iki katmanlı klavye odağı */
:focus-visible {
  outline: var(--strokeWidthThick) solid var(--colorStrokeFocus2);
  outline-offset: var(--strokeWidthThick);
  box-shadow: 0 0 0 var(--strokeWidthThick) var(--colorStrokeFocus1);
  border-radius: var(--borderRadiusMedium);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 0; box-shadow: none; }

.ico {
  width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 1.15; stroke-linecap: round; stroke-linejoin: round;
}

/* --- Kabuk ----------------------------------------------------------------- */
.appbar {
  position: sticky; top: 0; z-index: 100;
  height: var(--d365-headerHeight);
  display: flex; align-items: center;
  background: var(--d365-headerBackground); color: var(--d365-headerForeground);
}
.appbar a, .appbar a:hover { color: inherit; text-decoration: none; }
.appbar-btn {
  width: 48px; height: 48px; flex: none; position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; padding: 0; cursor: pointer; color: inherit;
  border-radius: 0;
  transition: background var(--durationFaster) var(--curveEasyEase);
}
.appbar-btn:hover { background: var(--colorSubtleBackgroundInvertedHover); }
.appbar-btn:active { background: var(--colorSubtleBackgroundInvertedPressed); }
.appbar-btn .ico { width: 20px; height: 20px; }
.appbar .brand { display: flex; align-items: center; gap: 8px; padding: 0 12px 0 4px; font-size: var(--fontSizeBase400); font-weight: var(--fontWeightSemibold); white-space: nowrap; }
.appbar .brand img { width: 22px; height: 22px; filter: invert(1); }
.appbar .divider { width: 1px; height: 20px; background: rgba(255,255,255,.4); margin: 0 4px 0 0; }
.appbar .appname { font-size: var(--fontSizeBase300); opacity: .9; padding: 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.appbar .spacer { flex: 1; }
.appbar .counter {
  position: absolute; top: 8px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: var(--borderRadiusCircular); background: #f7630c; color: #fff;
  font-size: 10px; line-height: 16px; font-weight: var(--fontWeightSemibold); text-align: center;
}
.avatar {
  width: 32px; height: 32px; border-radius: var(--borderRadiusCircular);
  background: var(--colorBrandBackground); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fontSizeBase200); font-weight: var(--fontWeightSemibold); flex: none;
}
.avatar.lg { width: 40px; height: 40px; font-size: var(--fontSizeBase300); }

.shell { display: flex; min-height: calc(100vh - var(--d365-headerHeight)); }

/* Sitemap (sol menü) */
.sitemap {
  width: var(--d365-sitemapWidth); flex: none;
  background: var(--d365-sitemapBackground);
  position: sticky; top: var(--d365-headerHeight); height: calc(100vh - var(--d365-headerHeight));
  overflow-y: auto; overflow-x: hidden; padding: 4px 0 16px;
}
.sitemap .group { font-weight: var(--fontWeightSemibold); padding: 12px 16px 4px; white-space: nowrap; }
.sitemap a {
  position: relative; display: flex; align-items: center; gap: 12px;
  height: var(--d365-navItemHeight); width: var(--d365-navItemWidth);
  padding: 0 8px 0 20px; color: var(--colorNeutralForeground1); text-decoration: none; white-space: nowrap;
  transition: background var(--durationFaster) var(--curveEasyEase);
}
.sitemap a:hover { background: var(--colorNeutralBackground1Hover); text-decoration: none; color: var(--colorNeutralForeground1); }
.sitemap a .ico { color: var(--colorNeutralForeground2); }
.sitemap a .label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.sitemap a.active { background: var(--colorNeutralBackground1); }
.sitemap a.active::before {
  content: ""; position: absolute; left: 4px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 21px; background: var(--colorBrandStroke1); border-radius: var(--borderRadiusCircular);
}
.sitemap a.active .ico { color: var(--colorBrandForeground1); }
.nav-badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--borderRadiusCircular);
  background: var(--colorBrandBackground); color: #fff; font-size: 11px; font-weight: var(--fontWeightSemibold);
  display: inline-flex; align-items: center; justify-content: center;
}
/* Daraltılmış sitemap: yalnızca ikonlar */
body.nav-collapsed .sitemap { width: var(--d365-sitemapWidthCollapsed); }
body.nav-collapsed .sitemap .group { height: 1px; padding: 0; margin: 8px 12px; background: var(--colorNeutralStroke2); font-size: 0; }
body.nav-collapsed .sitemap a { width: 48px; padding: 0; justify-content: center; }
body.nav-collapsed .sitemap a .label { display: none; }
body.nav-collapsed .sitemap .nav-badge { position: absolute; top: 2px; right: 4px; min-width: 14px; height: 14px; font-size: 9px; padding: 0 3px; }

.main { flex: 1; min-width: 0; padding: 9px 9px 32px; }
.page { max-width: 1440px; margin: 0 auto; }

/* Hesap menüsü (popover) */
.popover {
  position: absolute; top: calc(var(--d365-headerHeight) - 4px); right: 8px; z-index: 200;
  min-width: 256px; background: var(--colorNeutralBackground1); color: var(--colorNeutralForeground1);
  border-radius: var(--borderRadiusMedium); box-shadow: var(--shadow16); padding: 4px;
  animation: menuIn var(--durationFaster) var(--curveDecelerateMid);
}
.popover[hidden] { display: none; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.popover .who { display: flex; gap: 12px; align-items: center; padding: 12px; }
.popover .who strong { display: block; font-weight: var(--fontWeightSemibold); }
.popover .who span { color: var(--colorNeutralForeground3); font-size: var(--fontSizeBase200); }
.popover .sep { height: 1px; background: var(--colorNeutralStroke2); margin: 4px 0; }
.menu-item {
  display: flex; align-items: center; gap: 12px; width: 100%; height: var(--d365-menuItemHeight);
  padding: 7px 10px 7px 12px; border: 0; background: none; border-radius: var(--borderRadiusMedium);
  font: inherit; color: var(--colorNeutralForeground1); text-align: left; cursor: pointer;
}
.menu-item:hover { background: var(--colorSubtleBackgroundHover); text-decoration: none; color: var(--colorNeutralForeground1); }
.menu-item .ico { color: var(--colorNeutralForeground2); }

/* --- Komut çubuğu ---------------------------------------------------------- */
.commandbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  min-height: var(--d365-commandBarHeight); padding: 6px 8px;
  background: var(--colorNeutralBackground1);
  border-radius: var(--borderRadiusXLarge);
  box-shadow: var(--shadow4); border: var(--strokeWidthThin) solid var(--colorTransparentStroke);
  margin-bottom: 9px;
}
.commandbar .sep { width: 1px; height: 20px; background: var(--colorNeutralStroke2); margin: 0 4px; }
.commandbar .spacer { flex: 1; }
.commandbar form { display: contents; }
.cmd {
  height: var(--d365-controlHeight); display: inline-flex; align-items: center; gap: 8px;
  padding: 1px 12px; border: 0; background: transparent; border-radius: var(--borderRadiusMedium);
  font: inherit; font-weight: var(--fontWeightRegular); color: var(--colorNeutralForeground1);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--durationFaster) var(--curveEasyEase);
}
.cmd:hover { background: var(--colorSubtleBackgroundHover); color: var(--colorNeutralForeground1); text-decoration: none; }
.cmd:active { background: var(--colorSubtleBackgroundPressed); }
.cmd .ico { color: var(--colorBrandForeground1); }
.cmd.danger .ico { color: var(--colorStatusDangerForeground1); }
.cmd.icon-only { padding: 0; width: 32px; justify-content: center; }
.cmd.icon-only .ico { color: var(--colorNeutralForeground2); }
.cmd:disabled { color: var(--colorNeutralForegroundDisabled); cursor: not-allowed; background: transparent; }
.cmd:disabled .ico { color: var(--colorNeutralForegroundDisabled); }

/* --- Sayfa / kayıt başlığı ------------------------------------------------- */
.page-head {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  background: var(--colorNeutralBackground1); border-radius: var(--borderRadiusXLarge);
  box-shadow: var(--shadow4); border: var(--strokeWidthThin) solid var(--colorTransparentStroke);
  padding: 14px 20px; margin-bottom: 16px;
}
.page-head > div:first-child { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-head p { margin: 2px 0 0; color: var(--colorNeutralForeground3); }
.entity-icon {
  width: 40px; height: 40px; border-radius: var(--borderRadiusMedium); flex: none;
  background: var(--colorNeutralBackground3); color: var(--colorNeutralForeground2);
  display: inline-flex; align-items: center; justify-content: center;
}
.entity-icon .ico { width: 20px; height: 20px; }
.view-title { font-size: var(--fontSizeBase500); line-height: var(--lineHeightBase500); font-weight: var(--fontWeightSemibold); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.back { display: none; }
.company-banner {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 9px; border-radius: var(--borderRadiusMedium);
  background: var(--colorStatusWarningBackground1); border: 1px solid var(--colorStatusWarningBorder1); color: var(--colorStatusWarningForeground1);
}

/* --- Kayıt formu başlığı (D365 form header) ------------------------------- */
.record-head {
  background: var(--colorNeutralBackground1); border-radius: var(--borderRadiusXLarge);
  box-shadow: var(--shadow4); border: 1px solid var(--colorTransparentStroke);
  padding: 14px 20px 0; margin-bottom: 16px;
}
.record-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.record-title { flex: 1; min-width: 200px; }
.record-title .muted { margin-top: 2px; }
.record-fields { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.record-fields > div { display: flex; flex-direction: column; padding-left: 24px; border-left: 1px solid var(--colorNeutralStroke2); }
.record-fields .k { font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); }
.record-fields .v { font-weight: var(--fontWeightSemibold); }
.record-fields .persona { flex-direction: row; align-items: center; gap: 8px; }
.record-fields .persona > div { display: flex; flex-direction: column; }
.record-fields .link { color: var(--colorBrandForegroundLink); font-weight: var(--fontWeightRegular); }
.record-head .tabs { background: none; padding: 0; border-radius: 0; border-bottom: 0; margin-top: 4px; }
.record-head .tabs a { height: var(--d365-formTabHeight); font-size: var(--fontSizeBase400); }
.record-head .tabs a.active::after { bottom: 8px; }

/* İş süreci akışı (BPF) */
.bpf { display: flex; gap: 2px; margin-top: 14px; overflow-x: auto; }
.bpf .stage {
  flex: 1; min-width: 110px; height: 32px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px;
  background: var(--colorNeutralBackground3); color: var(--colorNeutralForeground2); white-space: nowrap;
  clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%, 10px 50%);
}
.bpf .stage:first-child { clip-path: polygon(0 0, calc(100% - 10px) 0, 100% 50%, calc(100% - 10px) 100%, 0 100%); border-radius: var(--borderRadiusMedium) 0 0 var(--borderRadiusMedium); }
.bpf .stage.done { background: var(--colorBrandBackground); color: #fff; }
.bpf .stage.current { background: var(--colorBrandBackground2); color: var(--colorBrandForeground1); font-weight: var(--fontWeightSemibold); }
.bpf .stage.current.done { background: var(--colorBrandBackground); color: #fff; }
.bpf .stage.rejected { background: var(--colorStatusDangerBackground1); color: var(--colorStatusDangerForeground1); }

/* Form gövdesi: ana kolon 2fr + yan kolon 1fr */
.form-body { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.form-body > div > .card:last-child { margin-bottom: 0; }
dl.grid.compact { grid-template-columns: 120px 1fr; }
dialog.modal.md { width: 640px; }
.vat-table td { padding: 4px 12px 4px 0; height: auto; border-bottom: 0; }
.vat-table th { padding-left: 0; height: 32px; border-bottom: 0; }
.vat-table tbody tr:hover td { background: none; }
.preview-col > .card:first-child { position: sticky; top: calc(var(--d365-headerHeight) + 9px); }

/* --- Yüzeyler -------------------------------------------------------------- */
.card {
  background: var(--colorNeutralBackground1); border-radius: var(--borderRadiusXLarge);
  border: var(--strokeWidthThin) solid var(--colorTransparentStroke); box-shadow: var(--shadow4);
  padding: 12px 20px 16px; margin-bottom: 16px;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 2px; }
.card.flush { padding: 0; overflow-x: auto; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.cols > * > .card:last-child { margin-bottom: 0; }
.with-preview { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.section-title { font-weight: var(--fontWeightSemibold); margin: 0 0 8px; }

/* Grid (liste) */
table { width: 100%; border-collapse: collapse; background: var(--colorNeutralBackground1); }
th {
  height: var(--d365-gridHeaderHeight); padding: 0 12px; text-align: left; white-space: nowrap;
  font-size: var(--fontSizeBase200); font-weight: var(--fontWeightSemibold);
  color: var(--d365-gridHeaderForeground); border-bottom: 1px solid var(--colorNeutralStroke2);
}
td { height: var(--d365-gridRowHeight); padding: 8px 12px; border-bottom: 1px solid var(--colorNeutralStroke3); vertical-align: middle; }
tbody tr:hover td { background: var(--colorNeutralBackground1Hover); }
tr:last-child td { border-bottom: 0; }
tfoot td { font-weight: var(--fontWeightSemibold); border-top: 1px solid var(--colorNeutralStroke2); }
td a { color: var(--colorBrandForegroundLink); }
tr[data-href] { cursor: pointer; }
dl.grid { display: grid; grid-template-columns: 170px 1fr; gap: 0 16px; margin: 0; }
dl.grid dt { color: var(--colorNeutralForeground3); padding: 6px 0; }
dl.grid dd { margin: 0; padding: 6px 0; min-height: 32px; }

/* Durum göstergesi: nokta + metin */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px;
  border-radius: var(--borderRadiusCircular); font-size: var(--fontSizeBase200); white-space: nowrap;
  background: var(--colorNeutralBackground3); color: var(--colorNeutralForeground2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.pending { background: var(--colorStatusWarningBackground1); color: var(--colorStatusWarningForeground1); }
.badge.approved { background: var(--colorStatusSuccessBackground1); color: var(--colorStatusSuccessForeground1); }
.badge.rejected { background: var(--colorStatusDangerBackground1); color: var(--colorStatusDangerForeground1); }
.badge.info { background: var(--colorBrandBackground2); color: var(--colorBrandForeground2); }
.badge.off { color: var(--colorNeutralForeground3); }

/* --- Butonlar -------------------------------------------------------------- */
.btn, button.btn {
  height: var(--d365-controlHeight); min-width: 96px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 5px 12px; border-radius: var(--borderRadiusMedium);
  border: 1px solid var(--colorNeutralStroke1); background: var(--colorNeutralBackground1);
  color: var(--colorNeutralForeground1); font: inherit; font-weight: var(--fontWeightSemibold);
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background var(--durationFaster) var(--curveEasyEase), border-color var(--durationFaster) var(--curveEasyEase);
}
.btn:hover { background: var(--colorNeutralBackground1Hover); border-color: var(--colorNeutralStroke1Hover); color: var(--colorNeutralForeground1); text-decoration: none; }
.btn:active { background: var(--colorNeutralBackground1Pressed); }
.btn.primary { background: var(--colorBrandBackground); color: #fff; border-color: transparent; }
.btn.primary:hover { background: var(--colorBrandBackgroundHover); color: #fff; }
.btn.primary:active { background: var(--colorBrandBackgroundPressed); }
.btn.success { background: var(--colorBrandBackground); color: #fff; border-color: transparent; }
.btn.success:hover { background: var(--colorBrandBackgroundHover); color: #fff; }
.btn.danger { color: var(--colorStatusDangerForeground1); }
.btn.sm { height: 28px; min-width: 0; padding: 3px 8px; font-size: var(--fontSizeBase200); font-weight: var(--fontWeightRegular); }
.btn:disabled, .btn:disabled:hover { background: var(--colorNeutralBackgroundDisabled); color: var(--colorNeutralForegroundDisabled); border-color: transparent; cursor: not-allowed; }
.btn .ico { color: inherit; }
.inline { display: inline; }

/* --- Formlar --------------------------------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 20px; }
.field { display: flex; flex-direction: column; margin-bottom: 12px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field label { font-weight: var(--fontWeightRegular); margin-bottom: 4px; }
.field.required > label::after { content: " *"; color: var(--d365-requiredAsterisk); }
.field .help { font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); margin-top: 4px; }
.field .errors { color: var(--colorStatusDangerForeground1); font-size: var(--fontSizeBase200); margin: 4px 0 0; padding: 0; list-style: none; }
.field.checkbox { flex-direction: row; align-items: center; gap: 8px; min-height: 32px; }
.field.checkbox label { margin: 0; }
input[type=text], input[type=password], input[type=email], input[type=number], input[type=date],
select, textarea {
  width: 100%; min-height: var(--d365-controlHeight); padding: 5px 12px;
  font: inherit; color: var(--colorNeutralForeground1);
  background-color: var(--colorNeutralBackground3);
  border: 1px solid var(--colorTransparentStroke); border-radius: var(--borderRadiusMedium);
  /* Focus alt çizgisi: ortadan dışa açılan 2px marka çizgisi */
  background-image: linear-gradient(var(--colorCompoundBrandStroke), var(--colorCompoundBrandStroke));
  background-size: 0 2px; background-position: 50% 100%; background-repeat: no-repeat;
  transition: background-size var(--durationNormal) var(--curveDecelerateMid), background-color var(--durationFaster) var(--curveEasyEase);
  outline: 0;
}
input:hover, select:hover, textarea:hover { background-color: var(--colorNeutralBackground3Hover); }
input:focus, select:focus, textarea:focus { background-size: 100% 2px; }
input::placeholder, textarea::placeholder { color: var(--colorNeutralForeground4); }
select {
  appearance: none; -webkit-appearance: none; padding-right: 32px;
  background-image: linear-gradient(var(--colorCompoundBrandStroke), var(--colorCompoundBrandStroke)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%23424242' stroke-width='1.15' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-size: 0 2px, 16px 16px; background-position: 50% 100%, right 10px center;
}
select:focus { background-size: 100% 2px, 16px 16px; }
select[multiple] { padding-right: 12px; background-image: none; }
textarea { min-height: 64px; resize: vertical; }
input[readonly] { color: var(--colorNeutralForeground3); }
input[type=file] { width: 100%; padding: 4px; font: inherit; color: var(--colorNeutralForeground3); background: var(--colorNeutralBackground3); border-radius: var(--borderRadiusMedium); }
input[type=file]::file-selector-button {
  height: 28px; margin-right: 12px; padding: 0 12px; font: inherit; font-weight: var(--fontWeightSemibold);
  color: var(--colorNeutralForeground1); background: var(--colorNeutralBackground1);
  border: 1px solid var(--colorNeutralStroke1); border-radius: var(--borderRadiusMedium); cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--colorNeutralBackground1Hover); }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--colorCompoundBrandBackground); }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--colorStatusDangerBorder2); }
.field ul.choices, .field > div > ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.field > div:has(> div > label > input[type=checkbox]) { display: flex; flex-wrap: wrap; gap: 0 20px; }
.field ul label, .field > div label { font-weight: var(--fontWeightRegular); display: inline-flex; align-items: center; gap: 8px; min-height: 28px; }
/* Belgeden okunan alanlar */
.field.low-confidence input, .field.low-confidence select { background-color: var(--colorStatusWarningBackground1); border-color: var(--colorStatusWarningBorder1); }
.field.high-confidence input, .field.high-confidence select { background-color: var(--colorStatusSuccessBackground1); }
.conf-tag { font-size: var(--fontSizeBase200); margin-left: 6px; }
.conf-tag.low { color: var(--colorStatusWarningForeground1); }
.conf-tag.high { color: var(--colorStatusSuccessForeground1); }
.form-errors {
  padding: 8px 12px; margin-bottom: 12px; border-radius: var(--borderRadiusMedium);
  background: var(--colorStatusDangerBackground1); border: 1px solid var(--colorStatusDangerBorder1); color: var(--colorStatusDangerForeground1);
}
.form-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; align-items: end; }
.filters .field { margin-bottom: 8px; }
.filters .actions { margin-bottom: 8px; }

/* --- Mesaj çubukları ------------------------------------------------------- */
.messages { list-style: none; padding: 0; margin: 0 0 9px; display: flex; flex-direction: column; gap: 6px; }
.messages li, .alert {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: var(--borderRadiusMedium);
  background: var(--colorNeutralBackground1); border: 1px solid var(--colorNeutralStroke2); color: var(--colorNeutralForeground1);
}
.messages .success, .alert.success { background: var(--colorStatusSuccessBackground1); border-color: var(--colorStatusSuccessBorder1); }
.messages .error, .alert.error { background: var(--colorStatusDangerBackground1); border-color: var(--colorStatusDangerBorder1); color: var(--colorStatusDangerForeground1); }
.messages .warning, .alert.warning { background: var(--colorStatusWarningBackground1); border-color: var(--colorStatusWarningBorder1); }
.messages .info, .alert.info { background: var(--colorBrandBackground2); border-color: var(--colorBrandStroke2); }
.alert > .ico { margin-top: 2px; }
.alert.warning > .ico { color: var(--colorStatusWarningForeground1); }
.alert.info > .ico, .alert:not(.warning):not(.error):not(.success) > .ico { color: var(--colorBrandForeground1); }
.alert.mb { margin-bottom: 12px; }

/* --- Sekmeler -------------------------------------------------------------- */
.tabs {
  display: flex; gap: 16px; overflow-x: auto; scrollbar-width: none;
  background: var(--colorNeutralBackground1); padding: 0 20px;
  border-radius: var(--borderRadiusXLarge) var(--borderRadiusXLarge) 0 0;
  border-bottom: 1px solid var(--colorNeutralStroke2);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  position: relative; height: 44px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  color: var(--colorNeutralForeground1); text-decoration: none;
}
.tabs a:hover { color: var(--colorNeutralForeground2BrandHover); text-decoration: none; }
.tabs a.active { font-weight: var(--fontWeightSemibold); }
.tabs a.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 3px; background: var(--colorBrandStroke1); border-radius: var(--borderRadiusSmall); }
.tabs .count { font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); font-weight: var(--fontWeightRegular); }
/* Sekmeli liste: sekme + araç çubuğu + grid tek yüzey */
.view { background: var(--colorNeutralBackground1); border-radius: var(--borderRadiusXLarge); box-shadow: var(--shadow4); border: 1px solid var(--colorTransparentStroke); margin-bottom: 16px; }
.view > .card { box-shadow: none; border-radius: 0; margin: 0; border: 0; border-bottom: 1px solid var(--colorNeutralStroke2); }
.view > .card:last-child { border-bottom: 0; border-radius: 0 0 var(--borderRadiusXLarge) var(--borderRadiusXLarge); }
.view > .card.flush { overflow-x: auto; }

.view-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 14px 20px 2px; }
.view .tabs { border-radius: 0; }
.view > .card:not(.flush) { padding: 6px 20px; }
.view .filter-panel[open] { padding-bottom: 6px; }
table.totals td { height: 36px; }

/* Filtre paneli */
.filter-panel > summary { list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: var(--fontWeightSemibold); height: 32px; }
.filter-panel > summary::-webkit-details-marker { display: none; }
.filter-panel > summary .ico { color: var(--colorBrandForeground1); }
.filter-panel[open] > summary { margin-bottom: 8px; }
.filter-panel > summary .chev { margin-left: auto; transition: transform var(--durationFast) var(--curveEasyEase); color: var(--colorNeutralForeground2); }
.filter-panel[open] > summary .chev { transform: rotate(180deg); }

/* Sayfalama */
.pagination { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 16px; border-top: 1px solid var(--colorNeutralStroke2); color: var(--colorNeutralForeground2); }

/* --- Modal ----------------------------------------------------------------- */
dialog.modal {
  border: 1px solid var(--colorTransparentStroke); border-radius: var(--borderRadiusXLarge); padding: 0;
  width: 422px; max-width: 90%; max-height: calc(100vh - 48px);
  box-shadow: var(--shadow64); color: var(--colorNeutralForeground1); background: var(--colorNeutralBackground1);
}
dialog.modal[open] { animation: dialogIn var(--durationGentle) var(--curveDecelerateMid); }
dialog.modal::backdrop { background: var(--d365-overlay); animation: fadeIn var(--durationFast) var(--curveEasyEase); }
@keyframes dialogIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
dialog.modal > form, dialog.modal > div { padding: var(--d365-dialogPadding); display: flex; flex-direction: column; gap: 16px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.modal-head h3, dialog.modal h3 { margin: 0; font-size: var(--fontSizeBase500); line-height: 35px; font-weight: var(--fontWeightSemibold); }
.modal-close { width: 32px; height: 35px; flex: none; border: 0; background: none; border-radius: var(--borderRadiusMedium); color: var(--colorNeutralForeground2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.modal-close:hover { background: var(--colorSubtleBackgroundHover); }
dialog.modal p { margin: 0; }
dialog.modal .field { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Yükleniyor durumu */
.btn.is-loading::before, .cmd.is-loading::before {
  content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.cmd.is-loading .ico { display: none; }
button:disabled { cursor: not-allowed; }

/* --- Özet sayfası ---------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { background: var(--colorNeutralBackground1); border-radius: var(--borderRadiusXLarge); box-shadow: var(--shadow4); border: 1px solid var(--colorTransparentStroke); padding: 12px 16px 14px; }
.stat .label { font-weight: var(--fontWeightSemibold); }
.stat .value { font-family: var(--fontFamilyNumeric); font-size: var(--fontSizeHero700); line-height: var(--lineHeightHero700); font-weight: var(--fontWeightSemibold); margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); }
.tasks { list-style: none; margin: 0; padding: 0; }
.tasks li { border-bottom: 1px solid var(--colorNeutralStroke3); }
.tasks li:last-child { border-bottom: 0; }
.tasks a { display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 52px; color: var(--colorNeutralForeground1); }
.tasks a:hover { background: var(--colorNeutralBackground1Hover); text-decoration: none; color: var(--colorNeutralForeground1); }
.tasks .n { min-width: 32px; height: 32px; padding: 0 6px; border-radius: var(--borderRadiusMedium); display: inline-flex; align-items: center; justify-content: center; font-weight: var(--fontWeightSemibold); background: var(--colorNeutralBackground3); }
.tasks .n.warn { background: var(--colorStatusWarningBackground1); color: var(--colorStatusWarningForeground1); }
.tasks .n.bad { background: var(--colorStatusDangerBackground1); color: var(--colorStatusDangerForeground1); }
.tasks .n.ok { background: var(--colorStatusSuccessBackground1); color: var(--colorStatusSuccessForeground1); }
.tasks .t { flex: 1; min-width: 0; }
.tasks .t small { display: block; color: var(--colorNeutralForeground3); font-size: var(--fontSizeBase200); }
.tasks .go { color: var(--colorNeutralForeground3); }
.card-title { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-weight: var(--fontWeightSemibold); border-bottom: 1px solid var(--colorNeutralStroke2); }
.card-title a { font-weight: var(--fontWeightRegular); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 10px; align-items: center; min-height: 32px; }
.checklist .mark { width: 18px; height: 18px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--colorNeutralStrokeAccessible); color: transparent; }
.checklist .mark .ico { width: 12px; height: 12px; stroke-width: 2; }
.checklist .done .mark { background: var(--colorBrandBackground); border-color: var(--colorBrandBackground); color: #fff; }
.checklist .done .label { color: var(--colorNeutralForeground3); }
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 48px 24px; color: var(--colorNeutralForeground3); }
.empty .art { width: 64px; height: 64px; border-radius: 50%; background: var(--colorBrandBackground2); color: var(--colorBrandForeground1); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 8px; }
.empty .art .ico { width: 28px; height: 28px; stroke-width: 1; }
.empty strong { font-size: var(--fontSizeBase500); line-height: var(--lineHeightBase500); font-weight: var(--fontWeightSemibold); color: var(--colorNeutralForeground1); }
.empty p { margin: 0; max-width: 42ch; }

/* --- Belge yükleme --------------------------------------------------------- */
.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  border: 1px dashed var(--colorNeutralStrokeAccessible); border-radius: var(--borderRadiusXLarge);
  padding: 32px 16px; background: var(--colorNeutralBackground2); cursor: pointer;
  transition: background var(--durationFaster) var(--curveEasyEase), border-color var(--durationFaster) var(--curveEasyEase);
}
.dropzone:hover, .dropzone.dragover { border-color: var(--colorBrandStroke1); background: var(--colorBrandBackground2); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; }
.dropzone .icon { color: var(--colorBrandForeground1); width: 32px; height: 32px; stroke-width: 1; }
.dropzone .title { font-weight: var(--fontWeightSemibold); }
.dropzone .hint { font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); }
.file-preview { display: none; align-items: center; gap: 12px; margin-top: 12px; padding: 8px; border-radius: var(--borderRadiusMedium); background: var(--colorNeutralBackground3); }
.file-preview.show { display: flex; }
.file-preview img { width: 48px; height: 48px; object-fit: cover; border-radius: var(--borderRadiusMedium); }
.file-preview .doc { width: 48px; height: 48px; border-radius: var(--borderRadiusMedium); background: var(--colorNeutralBackground1); color: var(--colorStatusDangerForeground1); display: flex; align-items: center; justify-content: center; font-weight: var(--fontWeightSemibold); font-size: var(--fontSizeBase200); }
.camera-btn { display: none; }
.preview { max-width: 100%; max-height: 560px; display: block; margin: 0 auto; border-radius: var(--borderRadiusMedium); }
.doc-preview { display: flex; flex-direction: column; gap: 8px; max-height: 75vh; overflow-y: auto; background: var(--colorNeutralBackground3); border-radius: var(--borderRadiusMedium); padding: 8px; }
.doc-preview .preview { max-height: none; width: 100%; max-width: 480px; background: #fff; box-shadow: var(--shadow2); }
.doc-preview .page-no { text-align: center; }
.doc-links { margin: 8px 0 0; }
.preview-frame { width: 100%; height: 560px; border: 0; border-radius: var(--borderRadiusMedium); background: var(--colorNeutralBackground3); }

/* Hazır tarih aralıkları */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  height: 28px; padding: 0 10px; border: 1px solid var(--colorTransparentStroke); border-radius: var(--borderRadiusMedium);
  background: var(--colorNeutralBackground3); font: inherit; color: var(--colorNeutralForeground1); cursor: pointer;
}
.chip:hover { background: var(--colorNeutralBackground3Hover); }
.calc-hint { font-size: var(--fontSizeBase200); color: var(--colorNeutralForeground3); margin: 8px 0 0; }

/* --- Giriş ekranları ------------------------------------------------------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; }
.auth-bar { height: var(--d365-headerHeight); background: var(--d365-headerBackground); color: #fff; display: flex; align-items: center; gap: 8px; padding: 0 16px; font-size: var(--fontSizeBase400); font-weight: var(--fontWeightSemibold); }
.auth-bar img { width: 22px; height: 22px; filter: invert(1); }
.auth-body { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 10vh 16px 32px; }
.auth .card { width: 100%; max-width: 440px; padding: 32px 36px; }
.auth .card h1 { margin-bottom: 8px; }
.auth .card .form-actions .btn { min-width: 108px; }
.qr { display: block; width: 184px; height: 184px; margin: 12px auto; }
.secret { font-family: var(--fontFamilyMonospace); background: var(--colorNeutralBackground3); padding: 6px 10px; border-radius: var(--borderRadiusMedium); word-break: break-all; display: block; text-align: center; }
.codes { columns: 2; font-family: var(--fontFamilyMonospace); padding-left: 24px; }

.nav-backdrop { display: none; }
.mobile-only { display: none; }

/* --- Tablet / telefon ------------------------------------------------------ */
@media (max-width: 860px) {
  body.nav-open { overflow: hidden; }
  .appbar .appname, .appbar .divider { display: none; }
  .sitemap {
    position: fixed; top: var(--d365-headerHeight); left: 0; bottom: 0; z-index: 90; height: auto;
    width: min(280px, 85vw); transform: translateX(-100%); transition: transform var(--durationGentle) var(--curveDecelerateMid);
    box-shadow: none;
  }
  body.nav-collapsed .sitemap { width: min(280px, 85vw); }
  body.nav-collapsed .sitemap .group { height: auto; padding: 12px 16px 4px; margin: 0; background: none; font-size: inherit; }
  body.nav-collapsed .sitemap a { width: 100%; padding: 0 8px 0 20px; justify-content: flex-start; }
  body.nav-collapsed .sitemap a .label { display: block; }
  body.nav-collapsed .sitemap .nav-badge { position: static; }
  .sitemap a { width: 100%; height: 44px; }
  body.nav-open .sitemap { transform: none; box-shadow: var(--shadow64); }
  body.nav-open .nav-backdrop { display: block; position: fixed; inset: var(--d365-headerHeight) 0 0 0; z-index: 80; background: var(--d365-overlay); }
  .main { padding: 8px 8px 32px; }
  .mobile-only { display: inline-flex; }
  .page-head { padding: 12px 16px; }
  .page-head > .actions { width: 100%; }
  .page-head > .actions .btn { flex: 1 1 auto; }
  .card { padding: 12px 16px; }
  .cols, .with-preview, .form-body { grid-template-columns: minmax(0, 1fr); }
  .record-head { padding: 12px 16px 0; }
  .record-fields { gap: 12px; width: 100%; }
  .record-fields > div { padding-left: 0; border-left: 0; }
  .bpf .stage { min-width: 96px; padding: 0 12px; font-size: var(--fontSizeBase200); }
  .commandbar { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .commandbar::-webkit-scrollbar { display: none; }
  .commandbar .spacer { display: none; }

  /* iOS'ta odaklanınca yakınlaşmayı önlemek için 16px */
  input[type=text], input[type=password], input[type=email], input[type=number], input[type=date], select, textarea { font-size: 16px; min-height: 40px; }
  .btn, button.btn { height: 40px; }
  .cmd { height: 40px; }
  .btn.sm { height: 32px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters .actions { grid-column: 1 / -1; }
  .filters .actions .btn, .form-actions .btn { flex: 1 1 auto; }
  dl.grid { grid-template-columns: 1fr; }
  dl.grid dt { padding: 6px 0 0; }
  dl.grid dd { padding: 0 0 6px; min-height: 0; }
  .camera-btn { display: inline-flex; }
  .dropzone { padding: 24px 12px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stat .value { font-size: var(--fontSizeBase500); line-height: var(--lineHeightBase500); }
  .form-body > .preview-col { order: -1; }
  .preview-col > .card:first-child { position: static; }
  .preview { max-height: 45vh; }
  .doc-preview { max-height: 55vh; }
  .preview-frame { height: 60vh; }
  .modal-actions .btn { flex: 1; }

  /* Tablolar: kart görünümü (.stack) */
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tfoot { display: block; }
  table.stack tr { display: flex; flex-direction: column; padding: 10px 16px; border-bottom: 1px solid var(--colorNeutralStroke2); }
  table.stack tr:last-child { border-bottom: 0; }
  table.stack tbody tr:hover td { background: none; }
  table.stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; height: auto; padding: 3px 0; border: 0; text-align: right; white-space: normal; }
  table.stack td::before { content: attr(data-label); flex-shrink: 0; text-align: left; color: var(--colorNeutralForeground3); font-size: var(--fontSizeBase200); }
  table.stack td:not([data-label])::before { content: none; }
  table.stack td.cell-title { order: -1; display: block; text-align: left; font-weight: var(--fontWeightSemibold); padding-bottom: 4px; }
  table.stack td.cell-title .small { font-weight: var(--fontWeightRegular); }
  table.stack td.cell-actions { justify-content: flex-start; flex-wrap: wrap; gap: 8px; padding-top: 8px; }
  table.stack td[colspan] { display: block; text-align: left; }
  table.stack tfoot td { border-top: 0; }
}

@media (max-width: 420px) {
  .filters { grid-template-columns: minmax(0, 1fr); }
  .codes { columns: 1; }
  .auth .card { padding: 24px 20px; }
}

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