/* Demir Konut v12.7.0 — Tasarım 3.0 · katman 2/4: uygulama kabuğu
   Üst çubuk, kenar menü (1024–1199 px ray, 1200 px+ tam), alt sekme çubuğu, sayfa alanı, sayfa başlığı şeridi, alt
   pencereler, bildirimler, yeni kayıt ve ATLAS düğmeleri; 320 px telefondan 2560 px+ ekrana, dikey ve yatay.
   v12410-ui.css / v12411 / v12414 / v1251-ui katmanlarını aynı seçici ve !important ile bilinçli olarak geçersiz kılar. */

/* ================================================================ sayfa alanı */
.app { min-height: 100dvh; }
.main > #view {
  width: 100%; max-width: var(--content-max); margin: 0 auto; box-sizing: border-box;
  padding: var(--sp-4) max(var(--gutter), env(safe-area-inset-right)) calc(var(--tabbar-h) + var(--safe-b) + var(--dock-space) + var(--sp-4)) max(var(--gutter), env(safe-area-inset-left)) !important;
}
@media (min-width: 1024px) { .main > #view { padding-top: var(--sp-5) !important; padding-bottom: calc(var(--sp-8) + 64px) !important; } }
@media (min-width: 1600px) { .main > #view { padding-top: var(--sp-6) !important; } }
@media (display-mode: window-controls-overlay) { .main > #view { padding-top: calc(env(titlebar-area-height, 64px) + var(--sp-4)) !important; } }
.view > *, .workspace-page > * { min-width: 0; }

/* ================================================================ üst çubuk */
#topbar {
  min-height: calc(var(--topbar-h) + var(--safe-t));
  padding: calc(var(--sp-2) + var(--safe-t)) max(var(--gutter), env(safe-area-inset-right)) var(--sp-2) max(var(--gutter), env(safe-area-inset-left));
  gap: var(--sp-1);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(18px); backdrop-filter: saturate(1.6) blur(18px);
  border-bottom: 1px solid var(--line-2);
}
#topbar.scrolled { border-bottom-color: var(--line); box-shadow: var(--shadow-1); }
#topbar .tb-title { margin-right: var(--sp-2); }
#topbar .tb-title h1 { font-size: var(--fs-xl); font-weight: 760; letter-spacing: -.35px; line-height: 1.3; }
#topbar .tb-title small { font-size: var(--fs-sm); color: var(--slate); }
#topbar .icon-btn { width: 42px; height: 42px; min-width: 42px; min-height: 42px; flex-basis: 42px; border-radius: 12px; color: var(--ink-2); }
#topbar .icon-btn:hover { background: var(--surface-2); color: var(--ink); transform: none; }
#topbar .icon-btn:active { transform: scale(.94); }
#topbar .tb-actions { gap: var(--sp-1); }
#topbar .sync-badge { min-height: 32px; }
#topbar #tbMore { background: var(--surface-2); border: 1px solid var(--line); }
@media (max-width: 699px) {
  #topbar { padding-left: max(var(--sp-2), env(safe-area-inset-left)); padding-right: max(var(--sp-2), env(safe-area-inset-right)); gap: 0; }
  #topbar .tb-title { padding-left: var(--sp-2); margin-right: var(--sp-1); }
  #topbar .tb-title h1 { font-size: 17px; }
  #topbar .tb-title small { font-size: var(--fs-xs); }
  #topbar .icon-btn { width: 40px; height: 40px; min-width: 40px; min-height: 40px; flex-basis: 40px; }
}
@media (max-width: 359px) {
  #topbar .tb-title h1 { font-size: 16px; }
  #topbar .icon-btn { width: 38px; min-width: 38px; flex-basis: 38px; }
}

/* ---- lisans / çevrimdışı şeritleri */
.lic-bar, .offline-bar { padding: 7px max(var(--gutter), env(safe-area-inset-right)) 7px max(var(--gutter), env(safe-area-inset-left)); font-size: var(--fs-sm); min-height: 36px; }
.lic-bar .btn, .lic-bar button { min-height: 32px; }

/* ================================================================ kenar menü */
@media (min-width: 1024px) {
  .sidebar {
    width: var(--sidebar-w); padding: var(--sp-4) var(--sp-3);
    background: linear-gradient(180deg, #0F1826 0%, #131E30 100%); border-right: 1px solid rgba(255, 255, 255, .06); box-shadow: none;
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent;
  }
  [data-theme="dark"] .sidebar { background: linear-gradient(180deg, #0C121C 0%, #0F1724 100%); border-right-color: rgba(255, 255, 255, .07); }
  .sb-brand { padding: var(--sp-1) var(--sp-2) var(--sp-4); margin-bottom: var(--sp-2); }
  .sb-group { font-size: 10.5px; letter-spacing: .9px; color: #6E7E94; padding: var(--sp-4) var(--sp-3) var(--sp-1); }
  .sb-link { padding: 9px var(--sp-3); border-radius: 11px; font-size: 13.5px; color: #AAB6C6; position: relative; transition: background var(--dur-1), color var(--dur-1); }
  .sb-link .ic { width: 20px; height: 20px; opacity: .95; }
  .sb-link:hover { background: rgba(255, 255, 255, .06); color: #fff; transform: none; }
  .sb-link:hover .ic { transform: none; }
  .sb-link.active { background: color-mix(in srgb, var(--gold) 14%, transparent); color: #fff; box-shadow: none; }
  .sb-link.active::before { content: ''; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--gold-2); }
  .sb-link:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -2px; }
  .sb-foot { padding: var(--sp-4) var(--sp-2) 0; }
}
/* Kenar menü dikey flex ve kaydırmalı: öğeler büzülmesin (v12.8: ray etiketlerinin ikinci satırı eziliyordu) */
@media (min-width: 1024px) { .sidebar > * { flex-shrink: 0; } }
/* daralt / genişlet düğmesi (js/sidebar.js ekler; html[data-sb] ray/tam durumunu taşır) */
@media (min-width: 1024px) {
  .sb-toggle { display: flex; align-items: center; justify-content: center; gap: 8px; margin: var(--sp-3) 0 0; padding: 8px 10px; min-height: 40px; border: 1px solid rgba(255, 255, 255, .1); border-radius: 11px; background: rgba(255, 255, 255, .04); color: #AAB6C6; font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; flex-shrink: 0; transition: background var(--dur-1), color var(--dur-1); }
  .sb-toggle:hover { background: rgba(255, 255, 255, .09); color: #fff; }
  .sb-toggle:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
  .sb-toggle svg { flex: none; transition: transform .25s var(--ease-out); }
  html[data-sb="rail"] .sb-toggle { padding: 8px 0; }
  html[data-sb="rail"] .sb-toggle span { display: none; }
  html[data-sb="rail"] .sb-toggle svg { transform: rotate(180deg); }
}
/* ray: simge + iki satırlık kısa ad (otomatik: 1024–1199 px; her genişlikte düğmeyle seçilebilir) */
@media (min-width: 1024px) {
  html[data-sb="rail"] .sidebar { padding: var(--sp-3) 6px; }
  html[data-sb="rail"] .sb-brand { justify-content: center; padding: 2px 0 var(--sp-3); gap: 0; }
  html[data-sb="rail"] .sb-brand > :not(.sb-mark) { display: none !important; }
  html[data-sb="rail"] .sb-mark { width: 40px; height: 40px; border-radius: 12px; font-size: 15px; }
  html[data-sb="rail"] .sb-group { height: 1px; padding: 0; margin: 8px 10px; font-size: 0; background: rgba(255, 255, 255, .08); overflow: hidden; }
  html[data-sb="rail"] .sb-link { flex: none; flex-direction: column; justify-content: center; gap: 4px; padding: 7px 2px; min-height: 58px; height: auto; text-align: center; font-size: 9.5px; line-height: 1.2; font-weight: 600; letter-spacing: 0; }
  html[data-sb="rail"] .sb-link span { display: block !important; max-height: 2.45em; overflow: hidden; max-width: 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.2; }
  html[data-sb="rail"] .sb-link .ic { width: 21px; height: 21px; }
  html[data-sb="rail"] .sb-link.active::before { top: 6px; bottom: 6px; }
  html[data-sb="rail"] .sb-foot { padding: var(--sp-3) 0 0; }
  html[data-sb="rail"] .sb-foot .row { justify-content: center; }
  html[data-sb="rail"] .sb-foot .row > div { display: none !important; }
}

/* ================================================================ alt sekme çubuğu */
@media (min-width: 640px) and (max-width: 1023px) {
  #tabbar { padding-left: max(calc((100% - 640px) / 2), env(safe-area-inset-left)); padding-right: max(calc((100% - 640px) / 2), env(safe-area-inset-right)); }
}
@media (max-width: 359px) { #tabbar .tab, #tabbar .fab { font-size: 10px; letter-spacing: 0; } }

/* ================================================================ yeni kayıt ve ATLAS düğmeleri */
@media (min-width: 1024px) {
  .atlas-launcher { right: max(var(--sp-6), env(safe-area-inset-right)); bottom: max(var(--sp-6), var(--safe-b)); min-height: 60px; }
  .atlas-dock { bottom: calc(max(var(--sp-6), var(--safe-b)) + 72px); height: min(720px, calc(100dvh - 120px - var(--safe-t))); }
  .fab-desktop, #fabDesktop { /* v12411-assistant.css'teki #fabDesktop{left:276px} kuralını kimlikle geçersiz kılar */
    left: auto; right: max(var(--sp-6), env(safe-area-inset-right)); bottom: calc(max(var(--sp-6), var(--safe-b)) + 72px);
    display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: auto; height: 54px; padding: 0 22px 0 16px; border-radius: 999px; z-index: 41;
    background: var(--btn-primary-bg); color: var(--btn-primary-ink); font-weight: 700; font-size: 14.5px; letter-spacing: -.1px;
    box-shadow: var(--btn-primary-shadow), inset 0 0 0 1px rgba(255, 255, 255, .08);
  }
  .fab-desktop::after { content: 'Yeni kayıt'; white-space: nowrap; }
  .fab-desktop .ic { width: 22px; height: 22px; }
  .fab-desktop:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
  .fab-desktop[hidden] { display: none !important; }
}
@media (min-width: 1600px) { .atlas-dock { width: min(480px, calc(100vw - 48px)); height: min(780px, calc(100dvh - 120px - var(--safe-t))); } }
@media (max-width: 1023px) {
  .atlas-launcher { right: max(var(--sp-3), env(safe-area-inset-right)); bottom: calc(var(--tabbar-h) + var(--safe-b) + 10px); }
}
@media (max-width: 640px), (orientation: landscape) and (max-height: 560px) and (max-width: 1023px) {
  .atlas-launcher { min-width: 50px; min-height: 50px; padding: 4px 6px; gap: 0; justify-content: center; border-radius: 18px; opacity: .94; }
  .atlas-launcher > span:not(.atlas-avatar) { display: none; }
  .atlas-launcher .atlas-avatar { flex: none; width: 44px; height: 46px; }
}

/* ================================================================ sayfa başlığı: masaüstünde kart, telefonda bağlam şeridi */
.workspace-page > .ux-page-heading, .workspace-page > .workspace-heading {
  padding: var(--sp-5) var(--sp-6); gap: var(--sp-5); margin: 0 0 var(--sp-4);
  border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.ux-page-heading .eyebrow, .workspace-heading .eyebrow { font-size: 10.5px; letter-spacing: .8px; color: var(--slate); }
.ux-page-heading h2, .workspace-heading h2 { font-size: var(--fs-2xl); margin: 4px 0 6px; letter-spacing: -.5px; line-height: 1.2; }
.ux-page-heading p, .workspace-heading p { font-size: var(--fs-md); color: var(--slate); max-width: 72ch; line-height: 1.55; }
.ux-page-actions, .dash-customize { gap: var(--sp-2); }
.ux-page-actions .btn, .dash-customize .btn { min-height: 40px; font-size: var(--fs-sm); padding: 8px 14px; border-radius: 11px; }
/* Alt sekme çubuğu düzeninde (<1024 px) sayfa adı üst çubukta yazılıdır; başlık kartı tek satırlık bağlam şeridine iner. */
@media (max-width: 1023px), (orientation: landscape) and (max-height: 560px) {
  .workspace-page > .ux-page-heading, .workspace-page > .workspace-heading {
    display: flex !important; flex-direction: row !important; flex-wrap: wrap; align-items: center !important;
    gap: var(--sp-2) var(--sp-3); padding: 9px 12px; margin: 0 0 var(--sp-3); border-radius: var(--radius-md); box-shadow: none;
  }
  .ux-page-heading > .ux-heading-copy, .ux-page-heading > div:first-child, .workspace-heading > div:first-child { flex: 1 1 150px !important; min-width: 0; width: auto !important; }
  .ux-page-heading .eyebrow, .workspace-heading .eyebrow { font-size: 9.5px; letter-spacing: .6px; }
  /* başlık üst çubukta zaten yazılı; burada ekran okuyucu için kalır */
  .ux-page-heading h2, .workspace-heading h2 { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; margin: 0; }
  .ux-page-heading p, .workspace-heading p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-sm); line-height: 1.4; margin: 2px 0 0; }
  .ux-page-heading .dash-customize, .workspace-heading .dash-customize { width: auto !important; flex: none; gap: 6px; }
  .dash-customize .btn { flex: none !important; min-height: 36px; padding: 6px 10px; font-size: var(--fs-xs); border-radius: 10px; }
  .ux-page-actions { width: auto !important; flex: none; flex-wrap: nowrap; margin-left: auto; gap: 6px; }
  .ux-page-actions .btn { flex: none !important; width: 36px; min-width: 36px; min-height: 36px; padding: 0; font-size: 0; gap: 0; border-radius: 10px; justify-content: center; }
  .ux-page-actions .btn .ic, .ux-page-actions .btn svg { width: 18px; height: 18px; }
}
@media (max-width: 359px) { .dash-customize .btn span, .dash-customize .btn { font-size: 10.5px; padding: 6px 8px; } }

/* ---- "Kullanım ve ipuçları" şeridi: alçak, telefonda daha alçak, yatay telefonda kapalıyken gizli */
.workspace-page > .page-guide { margin: 0 0 var(--sp-4); border-radius: var(--radius-md); }
.workspace-page .page-guide > summary { min-height: 40px; padding: 8px 12px; font-size: var(--fs-sm); }
@media (max-width: 767px) {
  .workspace-page > .page-guide { margin-bottom: var(--sp-3); }
  .workspace-page .page-guide > summary { min-height: 36px; padding: 6px 10px; font-size: var(--fs-xs); }
  .workspace-page .page-guide > div { padding: 14px; }
}
@media (orientation: landscape) and (max-height: 560px) { .workspace-page > .page-guide:not([open]) { display: none; } }

/* ================================================================ alt pencereler (sheet) */
.sheet { border-top-color: var(--line); }
.sheet-head h3 { font-size: 17px; }
@media (min-width: 768px) {
  .sheet { max-width: 720px; border-radius: var(--radius-xl); border: 1px solid var(--line); }
  .sheet.full { height: min(88dvh, 940px); }
  .sheet.tall { height: min(80dvh, 760px); }
}
@media (min-width: 1200px) { .sheet { max-width: 760px; } }
@media (orientation: landscape) and (max-height: 560px) {
  .sheet-wrap { padding: 0; align-items: flex-end; }
  .sheet, .tx-sheet { width: 100% !important; max-width: none !important; border-radius: 0 !important; max-height: 100dvh !important; border: 0; }
  .sheet.full, .sheet.tall { height: 100dvh !important; }
  .sheet-handle { display: none; }
  .sheet-head { padding: 6px 12px !important; min-height: 44px; }
  .sheet-head h3 { font-size: 16px; }
  .sheet-body { padding: 10px 14px !important; }
  .sheet-foot { padding: 8px 14px !important; }
}

/* ================================================================ bildirimler (toast) */
.toasts { width: min(calc(100vw - 24px), 440px); bottom: calc(var(--tabbar-h) + var(--safe-b) + 12px); }
.toast { border-radius: 14px; font-size: 13.5px; }
@media (min-width: 1024px) {
  .toasts { left: auto; right: max(var(--sp-6), env(safe-area-inset-right)); bottom: calc(max(var(--sp-6), var(--safe-b)) + 72px + 66px); transform: none; }
}
@media (orientation: landscape) and (max-height: 560px) { .toasts { bottom: auto; top: calc(var(--topbar-h) + var(--safe-t) + 8px); } }

/* ================================================================ yatay telefon ve kısa ekran: kabuk sıkışır */
@media (orientation: landscape) and (max-height: 560px) {
  #topbar { padding-top: calc(4px + var(--safe-t)); padding-bottom: 4px; }
  #topbar .tb-title h1 { font-size: 15.5px; }
  #topbar .tb-title small { display: none; }
  #topbar .icon-btn { width: 38px; height: 38px; min-width: 38px; min-height: 38px; flex-basis: 38px; }
  .lic-bar, .offline-bar { padding-top: 3px; padding-bottom: 3px; min-height: 30px; font-size: var(--fs-xs); }
  .main > #view { padding-top: var(--sp-3) !important; }
  .atlas-launcher { bottom: calc(var(--tabbar-h) + var(--safe-b) + 6px); min-height: 44px; }
}

/* ================================================================ klavye odağı: tüm kabukta aynı halka */
.workspace-page :is(button, a, summary, input, select, textarea):focus-visible,
.sheet :is(button, a, summary, input, select, textarea):focus-visible,
:is(.model-page, .assistant-page, .dashboard-page) :is(button, summary, a, input, textarea, select):focus-visible,
#topbar :is(button, a):focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 2px; }

/* ================================================================ yazdırma ve yüksek karşıtlık */
@media print { .lic-bar, .offline-bar, .atlas-launcher, .atlas-dock, .page-guide, .ux-page-actions, .fab-desktop { display: none !important; } }
@media (forced-colors: active) {
  .sb-link.active::before { background: Highlight; }
  .fab-desktop { border: 1px solid ButtonText; }
  .workspace-page > .ux-page-heading { border: 1px solid CanvasText; }
}
