/* =====================================================================
   Perakendia · Haber — BASE
   Tokens + kabuk (WindowChrome, ModuleRail, SectionRail) + logo + buton.
   Değerler index.html :root bloklarından birebir alındı.
   ===================================================================== */

/* ---- 1. Tokens ------------------------------------------------------ */
:root {
  --font-sans: 'Inter Tight', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  /* Anasayfada başlıklar fallback serif'le render ediliyor — aynısı */
  --pn-serif: 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --pn-meta: var(--font-sans);

  /* Kabuk (koyu) */
  --bg: #0c0e12; --surface: #14171d; --surface-2: #1a1e26;
  --line: #232831; --line-2: #2d333e;
  --fg: #f5f6f8; --fg-2: #c8cdd6; --muted: #7a8290;
  --accent: #BB1919; --accent-ink: #08090d;
  --t-fast: 160ms cubic-bezier(.4,0,.2,1);
  --t-base: 320ms cubic-bezier(.4,0,.2,1);

  /* Sektör / modül renkleri */
  --c-retail: #BB1919; --c-auto: #ff6b35; --c-mesai: #ff8a5b; --c-carsi: #ff527b;
  --c-meydan: #e9b04b; --c-divan: #ef5a5a; --c-kadi: #e6a23a; --c-hane: #3d6e7c;
  --c-garaj: #ff6b35; --c-usta: #a85a3a; --c-lonca: #3da55c; --c-sandik: #f59842;
  --c-mezat: #d6394c; --c-akce: #5aa7ff;

  /* Haber portalı (açık) */
  --pn-bg: #ffffff; --pn-paper: #f4f1ea; --pn-paper-2: #ece7dd; --pn-card: #ffffff;
  --pn-ink: #0d0d0d; --pn-ink-2: #4a4845; --pn-ink-3: #807e7a;
  --pn-line: #e7e3d9; --pn-line-2: #d0cabb;
  --pn-red: #c5211d; --pn-red-deep: #931714; --pn-red-soft: #fde6e3;
  --pn-amber: #b8923a; --pn-amber-soft: #f4e9c8;
  --pn-r-xs: 6px; --pn-r-sm: 10px; --pn-r-md: 14px; --pn-r-lg: 20px; --pn-r-xl: 28px;
  --pn-shadow-sm: 0 1px 2px rgba(20,18,12,0.04);
  --pn-shadow-md: 0 10px 28px rgba(20,18,12,0.07), 0 2px 6px rgba(20,18,12,0.04);
  --pn-shadow-lg: 0 24px 56px rgba(20,18,12,0.14), 0 6px 14px rgba(20,18,12,0.06);
  --pn-gutter: clamp(28px, 4vw, 72px);

  /* Durum renkleri (panel) — palete uyumlu türetildi */
  --st-ok: #2f7d4f;   --st-ok-soft: #e3f1e8;
  --st-warn: #a8741a; --st-warn-soft: #f6ecd4;
  --st-info: #2f5f8f; --st-info-soft: #e2ecf6;
  /* Köken etiketleri */
  --o-editor: #0d0d0d; --o-ajans: #2f5f8f; --o-kazima: #a8741a; --o-firma: #6b4fa0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-sans);
  color: var(--pn-ink);
  background: #08090d;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--pn-red); color: #fff; }

/* ---- 2. AppShell ---------------------------------------------------- */
.hx-app {
  height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: 44px minmax(0, 1fr);
}
.hx-stage {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  min-height: 0;
}
.hx-app[data-no-right='true'] .hx-stage { grid-template-columns: 56px minmax(0, 1fr); }
.hx-main {
  min-height: 0;
  overflow-y: auto;
  background: var(--pn-bg);
  position: relative;
  scroll-behavior: smooth;
}

/* WindowChrome */
.hx-chrome {
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  background: #08090d;
  border-bottom: 1px solid var(--line);
}
.hx-chrome__dots { display: flex; gap: 6px; }
.hx-chrome__dots span { width: 11px; height: 11px; border-radius: 50%; background: #2a2f38; }
.hx-chrome__url {
  flex: 1; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; gap: 8px;
  height: 26px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  font: 500 12px/1 var(--font-sans); color: var(--muted);
}
.hx-chrome__url b { color: var(--fg-2); font-weight: 600; }
.hx-chrome__url i { width: 7px; height: 7px; border-radius: 50%; background: #3da55c; }

/* ModuleRail (sol) */
.hx-rail-left {
  background: #08090d; border-right: 1px solid var(--line);
  padding: 6px 6px 12px;
  display: flex; flex-direction: column; gap: 3px;
  overflow-y: auto; scrollbar-width: none;
}
.hx-rail-left::-webkit-scrollbar { display: none; }
.divider {
  --c: var(--c-retail);
  position: relative; flex: 0 0 160px;
  display: grid; grid-template-rows: auto 1fr;
  padding: 10px 6px 12px;
  background: color-mix(in oklab, var(--c) 92%, #1a1d22);
  border-radius: 10px 14px 14px 10px;
  opacity: .92; text-align: center;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  transition: opacity var(--t-fast);
}
.divider::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255,255,255,0.10) 0%, rgba(255,255,255,0) 35%);
}
.divider::after {
  content: ''; position: absolute; inset: 6px 5px; pointer-events: none;
  border: 1px dashed rgba(0,0,0,0.28); border-radius: 8px;
}
.divider:hover { opacity: 1; }
.divider--active { opacity: 1; box-shadow: inset 0 1px 0 rgba(255,255,255,0.18); }
.divider__num {
  justify-self: center; display: grid; place-items: center;
  width: 22px; height: 18px; border-radius: 4px;
  background: rgba(0,0,0,0.22); color: rgba(0,0,0,0.82);
  font: 700 11px/1 var(--font-sans);
}
.divider--active .divider__num {
  background: #fff; color: color-mix(in oklab, var(--c) 65%, #000);
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}
.divider__label {
  place-self: center; writing-mode: vertical-rl; transform: rotate(180deg);
  font: 700 11px/1 var(--font-sans); letter-spacing: .22em; text-transform: uppercase;
  color: rgba(0,0,0,0.82); white-space: nowrap;
}
.divider[data-sector='retail'] .divider__label { color: #fff; }
.divider[data-sector='retail'] .divider__num { background: rgba(255,255,255,0.22); color: #fff; }
.divider[data-sector='retail']::after { border-color: rgba(255,255,255,0.42); }
.divider[data-sector='retail'].divider--active .divider__num { background: #fff; color: color-mix(in oklab, var(--c-retail) 70%, #000); }

/* SectionRail (sağ) */
.hx-rail-right {
  background: #08090d; border-left: 2px solid var(--c-retail);
  padding: 6px 4px 12px 6px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto; scrollbar-width: none;
}
.hx-rail-right::-webkit-scrollbar { display: none; }
.sub-tab {
  flex: 0 0 auto; min-height: 140px; position: relative;
  display: grid; grid-template-rows: auto 1fr; place-items: center;
  padding: 12px 6px 12px 10px;
  background: color-mix(in oklab, var(--accent) 88%, #1a1d22);
  border: 1px solid color-mix(in oklab, var(--accent) 60%, #000);
  border-radius: 12px 10px 10px 12px;
  color: rgba(255,255,255,0.96); opacity: .9;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform var(--t-base), opacity var(--t-fast), background var(--t-fast);
}
.sub-tab::after { content: ''; position: absolute; top: 8px; bottom: 8px; left: 2px; border-left: 1px dashed rgba(255,255,255,0.32); }
.sub-tab:hover { opacity: 1; transform: translateX(-2px); }
.sub-tab--active {
  opacity: 1; transform: translateX(-6px); color: rgba(0,0,0,0.92);
  background: color-mix(in oklab, var(--accent) 96%, #1a1d22); border-color: var(--accent);
}
.sub-tab--active::after { border-left-color: rgba(255,255,255,0.5); }
.sub-tab__num { font: 700 9.5px/1 var(--font-sans); letter-spacing: .08em; opacity: .65; }
.sub-tab__label {
  writing-mode: vertical-rl; transform: rotate(180deg); margin-top: 6px;
  font: 600 10.5px/1 var(--font-sans); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap;
}

/* ---- 3. BrandLogo --------------------------------------------------- */
.pk-logo { display: inline-flex; align-items: center; gap: 9px; color: inherit; }
.pk-logo img.pk-logo__mark { height: 28px; width: auto; flex: none; }
.pk-logo__txt { display: flex; flex-direction: column; line-height: 1; gap: 4px; }
.pk-logo__name { font: 700 19px/0.9 'Poppins', 'Avenir Next', 'Futura', 'Century Gothic', var(--font-sans); letter-spacing: -0.03em; color: #0b2e22; }
.pk-logo__sub { font: 600 7.5px/1 var(--font-sans); letter-spacing: .3em; text-transform: uppercase; color: #5a6b64; }
.pk-logo--dark .pk-logo__name { color: #f4f1ec; }
.pk-logo--dark .pk-logo__sub { color: #9aa3ad; }
.pk-logo--dark img.pk-logo__mark { height: 26px; }

/* ---- 4. Button / Chip / Field primitives ---------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 0 18px;
  border: 1px solid var(--pn-line-2); border-radius: var(--pn-r-sm);
  background: transparent; color: var(--pn-ink);
  font: 700 13px/1 var(--font-sans); cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--pn-ink); }
.btn--primary { background: var(--pn-ink); border-color: var(--pn-ink); color: #fff; }
.btn--primary:hover { background: var(--pn-red); border-color: var(--pn-red); }
.btn--red { background: var(--pn-red); border-color: var(--pn-red); color: #fff; }
.btn--red:hover { background: var(--pn-red-deep); border-color: var(--pn-red-deep); }
.btn--ghost { border-color: transparent; }
.btn--ghost:hover { background: rgba(20,18,12,0.05); border-color: transparent; }
.btn--sm { min-height: 32px; padding: 0 12px; font-size: 12px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 15px; height: 15px; flex: none; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 11px; border-radius: 999px;
  font: 700 10.5px/1 var(--font-sans); letter-spacing: .14em; text-transform: uppercase;
  background: #fff; color: var(--pn-ink); border: 1px solid var(--pn-line);
}
.chip--red { background: var(--pn-red); color: #fff; border-color: var(--pn-red); }
.kicker { font: 700 11px/1 var(--font-sans); letter-spacing: .2em; text-transform: uppercase; color: var(--pn-red); }

/* Origin badge — Editör / Ajans / Kazıma / Firma */
.origin {
  --o: var(--o-editor);
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 9px 0 7px; border-radius: 6px;
  font: 700 10.5px/1 var(--font-sans); letter-spacing: .08em; text-transform: uppercase;
  color: var(--o); background: color-mix(in oklab, var(--o) 9%, #fff);
  border: 1px solid color-mix(in oklab, var(--o) 24%, #fff);
  white-space: nowrap;
}
.origin::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--o); }
.origin[data-o='ajans'] { --o: var(--o-ajans); }
.origin[data-o='kazima'] { --o: var(--o-kazima); }
.origin[data-o='firma'] { --o: var(--o-firma); }

/* Toast */
.hx-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 300;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px 12px 18px; border-radius: 12px;
  background: var(--pn-ink); color: #fff; box-shadow: var(--pn-shadow-lg);
  font: 600 13.5px/1.3 var(--font-sans);
  transition: transform .25s, opacity .25s;
}
.hx-toast.is-on { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; }
.hx-toast button { background: none; border: 0; color: #ffb4ae; font-weight: 700; cursor: pointer; }

/* Görsel fallback */
.ph { background: linear-gradient(135deg, var(--pn-paper), var(--pn-paper-2)); }

/* ---- 5. Kabuk responsive -------------------------------------------- */
/* ≤880px: raylar yatay ayıraç şeritlerine dönüşür (defter ayıraçlarının kenardan görünüşü) */
@media (max-width: 880px) {
  .hx-app { grid-template-rows: auto minmax(0, 1fr); height: 100dvh; }
  .hx-chrome { display: none; }
  .hx-stage, .hx-app[data-no-right='true'] .hx-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0,1fr); }
  .hx-main { overflow-x: hidden; }
  .hx-rail-left {
    grid-row: 1; flex-direction: row; gap: 3px; padding: 6px 6px 0;
    border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto;
  }
  .hx-rail-left .divider {
    flex: 0 0 auto; height: 34px; padding: 0 12px 0 8px;
    grid-template-rows: none; grid-template-columns: auto auto; align-items: center; gap: 8px;
    border-radius: 10px 10px 0 0;
  }
  .hx-rail-left .divider::after { inset: 5px 5px 0; border-bottom: 0; border-radius: 7px 7px 0 0; }
  .hx-rail-left .divider__label { writing-mode: horizontal-tb; transform: none; font-size: 10px; letter-spacing: .16em; }
  .hx-rail-right { display: none; }
}

[hidden] { display: none !important; }
