/*
 * Copyright (c) 2026 Tayfun Şimşek. Tüm hakları saklıdır / All rights reserved.
 *
 * Purpose / Amaç: Kabuk yerleşimi ve ortak bileşenler. Üç kırılım (§4): telefon <600 kenar şeridi
 *   (varsayılan SAĞ, el tercihiyle sol), tablet 600–1024 sol şerit, masaüstü ≥1025 sol tam menü
 *   (daraltılabilir). KB ui/kenar-seridi-menu-ve-geri; desen ServiceIQ web/app.css (yeniden yazıldı).
 * Reason / Gerekçe: Şerit içeriği ÖRTMEZ — gövde şerit kadar boşluk bırakır (§15.1). Masaüstü menüsü
 *   mantıksal özelliklerle yazılır; telefon şeridi FİZİKSEL taraftadır (el tercihi fizikseldir).
 *   Renk ve ölçü yalnız belirteçten (tokens.css) gelir — bu dosyada sabit renk yok (§30).
 * Risks / Riskler: Dokunma alanı (--touch, --touch-field) küçültülmez; sahada eldiven var.
 */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--c-bg); color: var(--c-text);
  font-family: var(--font); font-size: var(--fs-md); line-height: 1.5;
}
h1, h2, h3, .display { font-family: var(--font-display); text-wrap: balance; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.muted { color: var(--c-text-muted); }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; z-index: 50; background: var(--c-surface); padding: 10px 14px; }
.skip:focus { top: 8px; }
:focus-visible { outline: 3px solid var(--c-primary); outline-offset: 2px; }

/* ---------- Menü ortak ---------- */
.nav {
  position: fixed; top: 0; bottom: 0; z-index: 30; background: var(--c-nav); color: var(--c-nav-text);
  display: flex; flex-direction: column; gap: 6px;
  padding: max(10px, env(safe-area-inset-top, 0px)) 6px max(10px, env(safe-area-inset-bottom, 0px));
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
}
.nav-list, .nav-foot { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nav-foot { margin-top: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: var(--touch); min-width: var(--touch);
  padding: 0 12px; border: 0; border-radius: var(--radius-sm); background: transparent; color: inherit;
  font: inherit; font-weight: 600; font-size: var(--fs-sm); text-decoration: none; cursor: pointer;
}
.nav-item:hover { background: color-mix(in srgb, var(--c-nav-text) 12%, transparent); }
.nav-item[aria-current="page"] { background: var(--c-primary); color: var(--c-surface); }
.nav-brand { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-lg); padding: 8px 12px 12px; }
.wm-a { color: var(--c-nav-text); }
.nav-item { position: relative; }
.nav-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--c-primary);
             color: var(--c-surface); font-size: 11px; font-weight: 800; display: inline-flex; align-items: center;
             justify-content: center; margin-inline-start: auto; }
.nav-item[aria-current="page"] .nav-badge { background: var(--c-surface); color: var(--c-primary); }
@media (max-width: 1024.98px) { .nav:not(.open) .nav-badge { position: absolute; top: 2px; inset-inline-end: 2px; } }
#readOnlyStrip { margin: 12px 16px 0; }
.from-team { border-inline-start: 4px solid var(--c-primary); }
p.pre { white-space: pre-wrap; margin: 0; }
.wm-b { color: var(--c-brand); }

@media (max-width: 599.98px) {
  body { padding-right: var(--rail-w); }
  html[data-hand="left"] body { padding-right: 0; padding-left: var(--rail-w); }
  .nav { right: 0; width: var(--rail-w); align-items: center; touch-action: pan-y; user-select: none; }
  html[data-hand="left"] .nav { right: auto; left: 0; }
  .nav-brand, .nav-collapse { display: none; }
  .nav-item { flex-direction: column; justify-content: center; gap: 2px; padding: 4px; width: 54px; font-size: 10px; }
  .nav-item .nav-label { max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav.open { width: min(82vw, 300px); align-items: stretch; }
  .nav.open .nav-item { flex-direction: row; width: auto; justify-content: flex-start; padding: 0 12px; font-size: var(--fs-sm); }
  .nav.open .nav-item .nav-label { max-width: none; }
  .nav:not(.open) .nav-hand { display: none; }
}
@media (min-width: 600px) and (max-width: 1024.98px) {
  body { padding-inline-start: var(--rail-w); }
  .nav { inset-inline-start: 0; width: var(--rail-w); align-items: center; }
  .nav-brand, .nav-collapse, .nav-hand { display: none; }
  .nav-item { flex-direction: column; justify-content: center; gap: 2px; padding: 4px; width: 54px; font-size: 10px; }
  .nav-item .nav-label { max-width: 54px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav.open { width: 300px; align-items: stretch; }
  .nav.open .nav-item { flex-direction: row; width: auto; justify-content: flex-start; padding: 0 12px; font-size: var(--fs-sm); }
}
@media (min-width: 1025px) {
  body { padding-inline-start: var(--side-w); }
  .nav { inset-inline-start: 0; width: var(--side-w); padding-inline: 12px; }
  .nav-menu, .nav-hand { display: none; }
  html[data-nav="narrow"] body { padding-inline-start: 76px; }
  html[data-nav="narrow"] .nav { width: 76px; align-items: center; }
  html[data-nav="narrow"] .nav .nav-label, html[data-nav="narrow"] .nav-brand { display: none; }
  html[data-nav="narrow"] .nav-collapse .ic { transform: scaleX(-1); }
}
[dir="rtl"] .nav-back .ic, [dir="rtl"] .nav-collapse .ic { transform: scaleX(-1); }
.scrim { position: fixed; inset: 0; background: color-mix(in srgb, var(--c-nav) 50%, transparent); z-index: 20; }
@media (prefers-reduced-motion: no-preference) { .nav { transition: width .18s ease; } }

/* ---------- İçerik ---------- */
main { padding: 20px 16px 40px; max-width: 1200px; }
main:focus { outline: none; }
.page-title { font-size: var(--fs-xl); font-weight: 800; margin: 0 0 6px; }
.section-title { font-size: var(--fs-lg); font-weight: 700; margin: 24px 0 8px; }
.card { background: var(--c-surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.lead { color: var(--c-text-2); margin: 0 0 14px; max-width: 62ch; }
.hint { font-size: var(--fs-sm); color: var(--c-text-muted); margin: 0; }
.small { font-size: var(--fs-xs); }
.banner { border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 12px; font-weight: 600;
          background: var(--c-warn-soft); color: var(--c-warn); }
.banner.ok { background: var(--c-profit-soft); color: var(--c-profit); }
.byline { margin-top: 40px; font-size: var(--fs-xs); color: var(--c-text-muted); }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label, .field > label { font-weight: 700; font-size: var(--fs-sm); }
.input {
  width: 100%; min-height: var(--touch-field); border-radius: var(--radius-sm); border: 1.5px solid var(--c-border);
  background: var(--c-surface); color: var(--c-text); font: inherit; padding: 10px 12px;
}
.input:focus { border-color: var(--c-primary); outline: none; box-shadow: 0 0 0 3px var(--c-primary-soft); }
.input[aria-invalid="true"] { border-color: var(--c-loss); }
.input.code { font-family: var(--font-display); font-size: 28px; letter-spacing: .4em; text-align: center; font-weight: 800; }
.field-error { color: var(--c-loss); font-size: var(--fs-sm); font-weight: 600; margin: 0; }
.field-error:empty { display: none; }
.form-error { color: var(--c-loss); font-weight: 600; margin: 0; }
.form-error:empty { display: none; }
.password-wrap { position: relative; display: flex; }
.password-wrap .input { padding-inline-end: 56px; }
.reveal { position: absolute; inset-inline-end: 4px; top: 50%; transform: translateY(-50%);
          min-width: var(--touch); min-height: var(--touch); border: 0; background: transparent; color: var(--c-text-2);
          cursor: pointer; border-radius: var(--radius-sm); }
.reveal[aria-pressed="true"] { color: var(--c-primary); }
.check { display: flex; align-items: center; gap: 10px; min-height: var(--touch); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--c-primary); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--touch-field);
  padding: 0 20px; border: 0; border-radius: var(--radius-sm); font: inherit; font-family: var(--font-display);
  font-weight: 700; font-size: var(--fs-md); cursor: pointer; text-decoration: none;
}
.btn-primary { background: var(--c-primary); color: var(--c-surface); }
.btn-primary:active { background: var(--c-primary-press); }
.btn-ghost { background: transparent; color: var(--c-text); border: 1.5px solid var(--c-border); }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: progress; }
.link { background: none; border: 0; color: var(--c-primary); font: inherit; font-weight: 700; cursor: pointer;
        min-height: var(--touch); padding: 0 4px; text-decoration: underline; text-underline-offset: 3px; }
.link:disabled { color: var(--c-text-muted); cursor: default; text-decoration: none; }

/* ---------- Giriş ekranları ---------- */
body.signed-out, body.no-firm { padding: 0 !important; }
body.signed-out .nav, body.signed-out .scrim { display: none; }
body.signed-out main { margin: 0 auto; max-width: 520px; }
.auth { padding-top: 24px; }
.auth-brand { font-family: var(--font-display); font-weight: 800; font-size: 22px; margin-bottom: 20px; }
.auth-brand .wm-a { color: var(--c-text); }
.auth-brand .wm-b { color: var(--c-primary); }
.auth-title { font-size: 30px; line-height: 1.1; font-weight: 800; margin: 0 0 8px; }
.auth-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: 6px; }

/* ---------- Liste, rozet ---------- */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 2px 10px; border-radius: 999px;
        font-size: var(--fs-xs); font-weight: 700; background: var(--c-surface-2); color: var(--c-text-2); }
.chip.open { background: var(--c-primary-soft); color: var(--c-primary); }
.chip.used { background: var(--c-profit-soft); color: var(--c-profit); }
.chip.withdrawn, .chip.expired { background: var(--c-surface-2); color: var(--c-text-muted); }
.code-box { font-family: var(--font-display); font-size: 26px; font-weight: 800; letter-spacing: .08em;
            background: var(--c-primary-soft); color: var(--c-text); padding: 12px 16px; border-radius: var(--radius-sm);
            user-select: all; font-variant-numeric: tabular-nums; }
.counter { font-family: var(--font-display); font-weight: 800; font-size: var(--fs-xl); font-variant-numeric: tabular-nums; }

/* Ekran kökü: kartlar arası boşluk tek yerde (her ekran kendi boşluğunu uydurmaz). */
#view { display: flex; flex-direction: column; gap: 14px; }
.card.stack > .btn, .card.stack > a.btn, form.stack > .btn:not(.btn-block) { align-self: flex-start; }
.card .section-title { margin-top: 0; }
.card.stack > p, .stack-tight > p { margin: 0; }

/* ---------- Firma kurulumu (tahta 11) ---------- */
.seg { display: flex; gap: 8px; }
.seg-btn { min-height: var(--touch); min-width: 96px; padding: 0 18px; border-radius: var(--radius-sm); cursor: pointer;
           border: 1.5px solid var(--c-border); background: var(--c-surface); color: var(--c-text);
           font: inherit; font-weight: 700; }
.seg-btn[aria-pressed="true"] { border: 2px solid var(--c-primary); background: var(--c-primary-soft); color: var(--c-primary); }
.field-pair { display: grid; grid-template-columns: 1fr 112px; gap: 10px; align-items: start; }
@media (max-width: 599.98px) { .field-pair { grid-template-columns: 1fr 92px; gap: 8px; } }
.tiles { display: flex; flex-direction: column; gap: 10px; }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 64px; width: 100%;
        padding: 10px 14px; border-radius: var(--radius); border: 1.5px solid var(--c-border); cursor: pointer;
        background: var(--c-surface); color: var(--c-text); font: inherit; text-align: start; }
.tile[aria-pressed="true"] { border: 2px solid var(--c-primary); background: var(--c-primary-soft); }
.tile-name { font-weight: 700; }
.tile-desc { font-size: var(--fs-sm); color: var(--c-text-2); }

/* ---------- Liste + ayrıntı (tahta 23) ---------- */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.stack-tight { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
            min-height: var(--touch); padding: 10px 14px; border-radius: var(--radius-sm); border: 0; cursor: pointer;
            background: var(--c-surface); color: var(--c-text); text-decoration: none; font: inherit; text-align: start;
            box-shadow: var(--shadow); }
.list-row:hover { background: var(--c-surface-2); }
.list-row[aria-current="true"] { outline: 2px solid var(--c-primary); }
.list.compact .list-row { box-shadow: none; border: 1.5px solid var(--c-border); }
.chip-btn { min-height: var(--touch); padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--c-border);
            background: var(--c-surface); color: var(--c-text-2); font: inherit; font-size: var(--fs-sm);
            font-weight: 700; cursor: pointer; }
.chip-btn[aria-pressed="true"] { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary); }
.seg.wrap { flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px 16px; margin: 0; }
.fact dt { font-size: var(--fs-xs); color: var(--c-text-muted); font-weight: 700; }
.fact dd { margin: 0; overflow-wrap: anywhere; }
.chip.status-quoted, .chip.status-lead { background: var(--c-primary-soft); color: var(--c-primary); }
.chip.status-approved, .chip.status-in_progress, .chip.status-completed { background: var(--c-profit-soft); color: var(--c-profit); }
.chip.status-lost, .chip.status-cancelled { background: var(--c-surface-2); color: var(--c-text-muted); }
.split { display: flex; flex-direction: column; gap: 14px; }
.pane-list, .pane-detail { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.pane-detail:empty { display: none; }
@media (max-width: 1024.98px) {
  .split.has-detail .pane-list { display: none; }
}
@media (min-width: 1025px) {
  .split { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; align-items: start; }
  .only-narrow { display: none; }
}

/* ---------- İş sayfası: ölçü, kapsam, tahmin (MeasureM, ScopeM, EstimateD) ---------- */
details > summary { cursor: pointer; font-weight: 700; min-height: var(--touch); display: flex; align-items: center; }
.measure-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.field-pair.even { grid-template-columns: 1fr 1fr; }
.card.inner { background: var(--c-surface-2); box-shadow: none; padding: 12px; }
.result-strip { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 10px 14px; border-radius: var(--radius-sm);
                background: var(--c-nav); color: var(--c-nav-text); font-variant-numeric: tabular-nums; }
.list.scope { gap: 4px; }
.scope-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 7.5em; align-items: center; gap: 6px 12px;
             padding: 6px 0; border-bottom: 1px solid var(--c-border); }
.scope-row > :last-child:not(.amount) { grid-column: 1 / -1; }
.scope-who { display: grid; grid-template-columns: auto 8.5em auto 8.5em; align-items: center; gap: 4px 6px; }
.scope-who .input.compact { min-width: 0; width: 100%; }
.mini { font-size: var(--fs-xs); color: var(--c-text-muted); font-weight: 700; }
@media (max-width: 760px) {
  .scope-row { grid-template-columns: minmax(0, 1fr) 6.5em; }
  .scope-who { grid-column: 1 / -1; grid-row: 2; grid-template-columns: auto 1fr auto 1fr; }
}
.scope-row.off strong { color: var(--c-text-muted); text-decoration: line-through; }
.row.end { justify-content: flex-end; }
.input.compact { min-height: var(--touch); width: auto; min-width: 7.5em; padding: 6px 10px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 6.5em; text-align: end; }
.amount.warn { color: var(--c-warn); }
.summary .row.between { font-variant-numeric: tabular-nums; }
.row.between.strong { font-weight: 800; font-size: var(--fs-lg); }
.price-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px;
             padding: 10px 14px; background: var(--c-surface); border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.price-row.unset { outline: 1.5px dashed var(--c-warn); }
.prefix { font-weight: 700; color: var(--c-text-2); }
ul.plain { margin: 0; padding-inline-start: 18px; }
.link.danger { color: var(--c-loss); }
.chip.quote-sent, .chip.quote-draft { background: var(--c-primary-soft); color: var(--c-primary); }
.chip.quote-accepted { background: var(--c-profit-soft); color: var(--c-profit); }
.chip.quote-declined, .chip.quote-superseded, .chip.quote-expired { background: var(--c-surface-2); color: var(--c-text-muted); }

/* ---------- Saha olayı (tahta 25 IncidentM, 26 EventsD) ---------- */
.tiles.kinds { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.kind-tile { min-height: 72px; }
.evidence-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
img.evidence, video.evidence { width: 100%; max-height: 220px; object-fit: cover; border-radius: var(--radius-sm);
                               background: var(--c-surface-2); display: block; }
.hash { font-family: ui-monospace, Consolas, monospace; font-size: var(--fs-xs); color: var(--c-text-muted);
        overflow-wrap: anywhere; }
.btn-dark { background: var(--c-nav); color: var(--c-nav-text); }
.sealed-box { border-inline-start: 4px solid var(--c-profit); }
.ok-text { color: var(--c-profit); font-weight: 700; margin: 0; }
.file-strip { flex-direction: row; flex-wrap: wrap; }

.margin-input { width: 5.5em; min-width: 0; text-align: end; }

/* ---------- Paylaşım (tahta 27 ShareM) ---------- */
.share-pick { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.pick { flex: none; display: flex; flex-direction: column; gap: 4px; padding: 4px; border-radius: var(--radius-sm);
        border: 2px solid transparent; background: var(--c-surface-2); cursor: pointer; color: inherit; font: inherit; }
.pick[aria-pressed="true"] { border-color: var(--c-primary); }
.share-thumb { width: 110px; height: 82px; object-fit: cover; border-radius: 6px; display: block; }
.share-preview { display: block; width: 100%; max-width: 420px; max-height: 60vh; object-fit: contain; margin-inline: auto;
                 border-radius: var(--radius-sm); background: var(--c-surface-2); }
@media (max-width: 599.98px) { .card.share-out { padding: 8px; } }
.share-assure { border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.share-assure.ok { background: var(--c-profit-soft); color: var(--c-text); border-inline-start: 4px solid var(--c-profit); }
.share-assure.off { background: var(--c-surface-2); color: var(--c-text); border-inline-start: 4px solid var(--c-border); }
.check.optional { border-top: 1.5px dashed var(--c-border); padding-top: 10px; }
