/* ==========================================================================
   Renk paleti doğrudan logodan alındı: turuncu #FF4800, siyah, gri kademeler.
   Turuncu yalnızca birincil eyleme ve etkin duruma ayrıldı; her yerde
   kullanılırsa vurgu değerini kaybeder.
   ========================================================================== */

:root {
  color-scheme: light;

  --brand:        #FF4800;
  --brand-press:  #D93D00;
  --brand-ink:    #FFFFFF;
  --brand-wash:   #FFF1EB;
  --brand-edge:   #FFC9B3;

  --bg:           #EEF0F2;
  --surface:      #FFFFFF;
  --surface-2:    #F6F7F8;
  --surface-3:    #EDEFF1;
  --line:         #DDE1E5;
  --line-strong:  #C4CAD0;

  --ink:          #14171A;
  --ink-2:        #4E575F;
  --muted:        #7B848C;

  --ok:           #0B7A46;
  --ok-wash:      #E6F4EC;
  --warn:         #9A6408;
  --warn-wash:    #FCF2DE;
  --danger:       #C42B26;
  --danger-wash:  #FBEAE9;
  --info:         #1A5FBF;
  --info-wash:    #E9F0FB;

  --steel:        #6E7780;

  --r-sm: 6px;
  --r:    9px;
  --r-lg: 13px;

  --sh-1: 0 1px 2px rgba(10,14,18,.07);
  --sh-2: 0 4px 12px -4px rgba(10,14,18,.14), 0 1px 3px rgba(10,14,18,.08);
  --sh-win: 0 12px 34px -12px rgba(10,14,18,.34), 0 2px 8px rgba(10,14,18,.10);
  --sh-win-active: 0 22px 52px -16px rgba(10,14,18,.42), 0 3px 10px rgba(10,14,18,.14);

  --topbar-h: 54px;
  --sidebar-w: 224px;
  --tap: 40px;

  --ease: cubic-bezier(.2,.7,.3,1);
}

[data-theme="dark"] {
  color-scheme: dark;

  --brand:        #FF5F1F;
  --brand-press:  #E64C10;
  --brand-ink:    #1A0A03;
  --brand-wash:   #2C1710;
  --brand-edge:   #5C2E15;

  --bg:           #0C0E10;
  --surface:      #16191C;
  --surface-2:    #1D2125;
  --surface-3:    #24292E;
  --line:         #2B3037;
  --line-strong:  #3C434B;

  --ink:          #E6E9EC;
  --ink-2:        #A7B0B8;
  --muted:        #7D868E;

  --ok:           #3FBE7E;
  --ok-wash:      #12291F;
  --warn:         #E0A32B;
  --warn-wash:    #2C2413;
  --danger:       #F0635C;
  --danger-wash:  #2E1614;
  --info:         #63A0F0;
  --info-wash:    #12213A;

  --steel:        #99A2AA;

  --sh-1: 0 1px 2px rgba(0,0,0,.5);
  --sh-2: 0 4px 12px -4px rgba(0,0,0,.6), 0 1px 3px rgba(0,0,0,.5);
  --sh-win: 0 12px 34px -12px rgba(0,0,0,.75), 0 2px 8px rgba(0,0,0,.5);
  --sh-win-active: 0 22px 52px -16px rgba(0,0,0,.85), 0 3px 10px rgba(0,0,0,.6);
}

/* ------------------------------------------------------------------ temel */

/* hidden özniteliği her zaman kazansın.
   .app ve .gate gibi display kuralı olan sınıflar, tarayıcının [hidden] için
   uyguladığı display:none kuralını ezer. Bu olunca gizlenmiş sayılan gate
   katmanı (position:fixed, inset:0, z-index:500) ekranı kaplar ve altındaki
   çalışan arayüz görünmez olur. */
[hidden] { display: none !important; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-text-size-adjust: 100%;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7;
      stroke-linecap: round; stroke-linejoin: round; }
a { color: var(--brand); text-underline-offset: 2px; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 21px; font-weight: 640; }
h2 { font-size: 15.5px; font-weight: 640; }
h3 { font-size: 13.5px; font-weight: 620; }
p { margin: 0; }

:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: var(--r-sm); }
::selection { background: var(--brand); color: var(--brand-ink); }

/* ------------------------------------------------------------- iskelet */

.app { display: flex; flex-direction: column; height: 100dvh; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  padding-right: max(14px, env(safe-area-inset-right));
  padding-left: max(14px, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex: none; z-index: 40;
}
.brand { display: flex; align-items: center; min-width: 0; }
.brand b {
  font-size: 16px; font-weight: 660; letter-spacing: .01em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand b::first-letter { color: var(--brand); }

.searchbox {
  display: flex; align-items: center; gap: 8px; flex: 1; max-width: 460px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r); padding: 0 10px; height: 36px;
}
.searchbox:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash); }
.searchbox svg { color: var(--muted); flex: none; }
.searchbox input { flex: 1; border: 0; background: none; min-width: 0; height: 100%; }
.searchbox input:focus { outline: none; }

.topbar-right { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.userchip {
  display: flex; align-items: center; gap: 8px; height: var(--tap);
  padding: 0 10px 0 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; cursor: pointer;
}
.userchip:hover { background: var(--surface-2); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--brand);
          color: var(--brand-ink); display: grid; place-items: center;
          font-size: 11.5px; font-weight: 700; flex: none; }
.userchip small { color: var(--muted); font-size: 11.5px; }

.shell { display: flex; flex: 1; min-height: 0; }

/* ------------------------------------------------------------- kenar menü */

.sidebar {
  width: var(--sidebar-w); flex: none; background: var(--surface);
  border-right: 1px solid var(--line); padding-left: env(safe-area-inset-left);
  display: flex; flex-direction: column; min-height: 0;
  transition: width .22s var(--ease), opacity .18s var(--ease);
}
.sidebar-head {
  flex: none; display: flex; align-items: center; height: 46px;
  padding: 0 16px; border-bottom: 1px solid var(--line);
}
.sidebar-head b { font-size: 15px; font-weight: 660; white-space: nowrap; }
.sidebar-head b::first-letter { color: var(--brand); }
.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 0 16px; }

/* Kapalı durum: menü tamamen çekilir, masaüstü genişler. */
.app.nav-off .sidebar { width: 0; opacity: 0; overflow: hidden; border-right: 0; }
.app.nav-off .sidebar-head, .app.nav-off .sidebar-nav { visibility: hidden; }
#drawerBtn.on { background: var(--brand-wash); border-color: var(--brand-edge); color: var(--brand); }
.navgroup { padding: 4px 10px 2px; }
.navgroup > h3 { font-size: 11px; font-weight: 600; color: var(--muted);
                 padding: 8px 10px 6px; }
.navitem {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: var(--tap); padding: 0 10px; margin-bottom: 1px;
  border: 0; border-radius: var(--r-sm); background: none;
  color: var(--ink-2); cursor: pointer; text-align: left; font-size: 14px;
  transition: background .12s var(--ease), color .12s var(--ease);
}
.navitem svg { flex: none; color: var(--steel); }
.navitem:hover { background: var(--surface-2); color: var(--ink); }
.navitem:active { background: var(--surface-3); }
.navitem.open { color: var(--ink); font-weight: 550; }
.navitem.open svg { color: var(--brand); }
.navitem .live { margin-left: auto; width: 6px; height: 6px; border-radius: 50%;
                 background: var(--brand); flex: none; }

/* ---------------------------------------------------------------- masaüstü */

/* İçerik alanı: tek bir sayfa gösterir. Pencere yığını yerine sayfa yığını
   var; ayrıntı ekranları ve formlar üste açılır, geri düğmesiyle dönülür. */
.content {
  isolation: isolate; z-index: 0;
  position: relative; flex: 1; min-width: 0;
  display: flex; flex-direction: column; min-height: 0;
  background: radial-gradient(circle at 1px 1px, var(--line) 1px, transparent 0) 0 0 / 22px 22px;
}

.pagebar {
  position: relative; z-index: 2; flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.pagebar-text { flex: 1; min-width: 0; }
.pagebar-text h1 { font-size: 19px; font-weight: 650; white-space: nowrap;
                   overflow: hidden; text-overflow: ellipsis; }
.pagebar-text p { font-size: 13px; color: var(--muted); white-space: nowrap;
                  overflow: hidden; text-overflow: ellipsis; }

.page {
  position: relative; z-index: 1; flex: 1; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding: 18px;
  animation: pageIn .18s var(--ease);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ düğme */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px;
       min-height: var(--tap); padding: 0 15px; border-radius: var(--r);
       border: 1px solid transparent; cursor: pointer;
       font-size: 14px; font-weight: 550; white-space: nowrap;
       transition: background .12s var(--ease), border-color .12s var(--ease),
                   color .12s var(--ease), transform .08s var(--ease); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }
.btn-sm { min-height: 32px; padding: 0 11px; font-size: 13px; border-radius: var(--r-sm); }

.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover:not(:disabled) { background: var(--brand-press); }

.btn-quiet { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-strong); }

.btn-ok { background: var(--ok-wash); color: var(--ok); }
.btn-ok:hover:not(:disabled) { background: var(--ok); color: #fff; }

.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger); color: #fff; }

.btn-ghost { background: none; color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }

.iconbtn { width: var(--tap); height: var(--tap); display: grid; place-items: center;
           border: 1px solid var(--line); border-radius: var(--r);
           background: var(--surface); color: var(--ink-2); cursor: pointer;
           transition: background .12s var(--ease), color .12s var(--ease); }
.iconbtn:hover { background: var(--surface-2); color: var(--ink); }
.iconbtn.on { background: var(--brand-wash); border-color: var(--brand-edge); color: var(--brand); }

.btnrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip { min-height: 32px; padding: 0 13px; border-radius: 999px;
        border: 1px solid var(--line); background: var(--surface); color: var(--ink-2);
        cursor: pointer; font-size: 13px; }
.chip:hover { border-color: var(--line-strong); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); font-weight: 560; }

/* ------------------------------------------------------------------- plaka */

.plate { display: inline-flex; align-items: stretch; border-radius: 4px; overflow: hidden;
         background: #FFF; color: #111; border: 1.5px solid #111;
         font-weight: 700; white-space: nowrap; line-height: 1; }
.plate::before { content: ""; width: 7px; background: var(--info); flex: none; }
.plate b { padding: 4px 8px 4px 7px; font-size: 13px; letter-spacing: .02em; }
.plate.lg b { padding: 6px 13px 6px 11px; font-size: 17px; }
[data-theme="dark"] .plate { border-color: #4A5058; }

/* -------------------------------------------------------------------- kart */

.card { background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--r); padding: 14px; }
.card + .card { margin-top: 12px; }
.grid { display: grid; gap: 10px; }
.g2 { grid-template-columns: repeat(2, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }

.sec { display: flex; align-items: center; justify-content: space-between;
       gap: 10px; margin: 20px 0 10px; flex-wrap: wrap; }
.sec:first-child { margin-top: 0; }
.lead { color: var(--ink-2); font-size: 13.5px; margin-bottom: 14px; }

.stat { background: var(--surface); border: 1px solid var(--line);
        border-radius: var(--r); padding: 12px 13px; }
.stat span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.stat b { font-size: 18px; font-weight: 640; letter-spacing: -.02em; }

/* Tutarın yazıyla okunuşu: rakamın altında, küçük ve soluk. Hiçbir şeyi
   örtmez; hane hatasını (5.000 yerine 50.000) yakalamaya yarar. */
.money-words {
  display: block; margin-top: 3px; font-style: normal; font-size: 11px;
  line-height: 1.35; color: var(--muted); overflow-wrap: anywhere;
}
.totals .money-words { text-align: right; margin-top: 0; }
.field .money-words, input + .money-words { margin-top: 4px; }
.stat.accent { border-left: 3px solid var(--brand); }

.counters { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
            background: var(--line); border: 1px solid var(--line);
            border-radius: var(--r); overflow: hidden; }
.counter { background: var(--surface); padding: 14px 15px; }
.counter span { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 5px; }
.counter b { font-size: 27px; font-weight: 600; letter-spacing: -.03em; line-height: 1; }
.counter.hot b { color: var(--brand); }

.pos { color: var(--ok); } .neg { color: var(--danger); }
.num { font-weight: 600; letter-spacing: -.01em; }
.muted { color: var(--muted); font-size: 12.5px; }

/* ------------------------------------------------------------------- tablo */

.tablewrap { border: 1px solid var(--line); border-radius: var(--r);
             overflow: hidden; background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-2);
     padding: 9px 12px; background: var(--surface-2);
     border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px;
     vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--surface-2); }

.rows { border: 1px solid var(--line); border-radius: var(--r);
        overflow: hidden; background: var(--surface); }
.row-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px;
            min-height: 52px; border-bottom: 1px solid var(--line); cursor: pointer; }
.row-item:last-child { border-bottom: 0; }
.row-item:hover { background: var(--surface-2); }
.row-item .grow { flex: 1; min-width: 0; }
.row-item .grow b { display: block; font-size: 13.5px; font-weight: 600; }
.row-item .grow small { color: var(--ink-2); font-size: 12.5px; }

dl.kv { display: grid; grid-template-columns: 128px 1fr; gap: 6px 14px;
        margin: 0; font-size: 13.5px; }
dl.kv dt { color: var(--ink-2); }
dl.kv dd { margin: 0; }

/* -------------------------------------------------------- yaklaşan gider */

.due-list { display: grid; gap: 7px; }
.due-item {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px;
  border: 1px solid var(--line); border-left: 3px solid var(--line-strong);
  border-radius: var(--r); background: var(--surface);
}
.due-item.soon { border-left-color: var(--warn); }
.due-item.late { border-left-color: var(--danger); background: var(--danger-wash); }
.due-item .grow { flex: 1; min-width: 0; }
.due-item b { display: block; font-size: 13.5px; }
.due-item small { color: var(--ink-2); font-size: 12.5px; }
.due-when { font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.due-item.late .due-when { color: var(--danger); font-weight: 600; }

/* ------------------------------------------------------------------ rozet */

.tag { display: inline-block; padding: 2px 8px; border-radius: 999px;
       font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.tag.waiting    { background: var(--surface-3); color: var(--ink-2); }
.tag.accepted   { background: var(--info-wash); color: var(--info); }
.tag.inprogress { background: var(--brand-wash); color: var(--brand); }
.tag.ready      { background: var(--ok-wash); color: var(--ok); }
.tag.delivered  { background: var(--surface-3); color: var(--muted); }
.tag.cancelled  { background: var(--danger-wash); color: var(--danger); }
.tag.due        { background: var(--warn-wash); color: var(--warn); }
.tag.role       { background: var(--surface-3); color: var(--ink-2); }

/* -------------------------------------------------------------------- form */

.field { display: block; margin-bottom: 13px; }
.field > span { display: block; font-size: 12.5px; font-weight: 550;
                color: var(--ink-2); margin-bottom: 5px; }
.field .req { color: var(--brand); font-style: normal; }
.field input, .field select, .field textarea,
input[type=text], input[type=tel], input[type=search], input[type=number],
input[type=password], input[type=date], input[type=datetime-local],
input[type=month], select, textarea {
  width: 100%; min-height: var(--tap); padding: 8px 11px;
  border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--ink); font-size: 14.5px;
}
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-wash);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:disabled, select:disabled { background: var(--surface-2); color: var(--muted); }
.field-hint { display: block; font-size: 12px; color: var(--muted);
              margin-top: 4px; font-style: normal; }
.field-err { display: block; font-size: 12px; color: var(--danger);
             margin-top: 4px; font-style: normal; font-weight: 550; }
.field.has-err input, .field.has-err select, .field.has-err textarea {
  border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-wash);
}
.formrow { display: grid; gap: 10px; }
.formrow.c2 { grid-template-columns: 1fr 1fr; }
.formrow.c3 { grid-template-columns: repeat(3, 1fr); }
.checkline { display: flex; align-items: center; gap: 9px; min-height: var(--tap);
             cursor: pointer; font-size: 14px; margin-bottom: 13px; }
.checkline input { width: 18px; height: 18px; min-height: 0; flex: none; accent-color: var(--brand); }
.plate-field input { text-align: center; font-weight: 700; font-size: 16px;
                     letter-spacing: .07em; text-transform: uppercase; }
.money input, input.money { text-align: right; }

.lines { border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.line { display: grid; gap: 8px; padding: 9px 11px; align-items: center;
        border-bottom: 1px solid var(--line); }
/* Sütun sayısı satırın içeriğine göre değişmemeli. "Başka işlem" seçilince
   beliren serbest isim alanı ayrı bir sütun açarsa tutar alanı sağa kayar;
   bu yüzden seçim kutusu ile isim alanı tek bir hücrede toplandı. */
.line.svc  { grid-template-columns: minmax(0,1.4fr) minmax(0,1fr) 132px 38px; }
.line.cost { grid-template-columns: minmax(0,1fr) minmax(0,1.3fr) 132px 38px; }
.line > * { min-width: 0; }
.line input, .line select { margin: 0; min-height: 36px; }
.svc-cell { display: grid; gap: 6px; min-width: 0; }
.svc-cell input[hidden] { display: none !important; }
.line .x { width: 34px; height: 34px; border: 0; border-radius: var(--r-sm);
           background: none; color: var(--muted); cursor: pointer; font-size: 18px;
           display: grid; place-items: center; }
.line .x:hover { background: var(--danger-wash); color: var(--danger); }
.lines-foot { display: flex; justify-content: space-between; align-items: center;
              gap: 10px; padding: 9px 11px; background: var(--surface-2); flex-wrap: wrap; }
.totals { display: flex; flex-direction: column; gap: 5px; padding: 12px 14px;
          background: var(--surface-2); border-radius: var(--r); }
.totals div { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.totals .big { font-size: 16px; font-weight: 640; padding-top: 7px;
               border-top: 1px solid var(--line); }

.suggest-wrap { position: relative; }
.suggest { position: absolute; left: 0; right: 0; top: 100%; z-index: 60;
           background: var(--surface); border: 1px solid var(--line);
           border-radius: var(--r); box-shadow: var(--sh-2); margin-top: 4px;
           max-height: 244px; overflow-y: auto; }
.suggest button { display: block; width: 100%; text-align: left; padding: 9px 12px;
                  background: none; border: 0; border-bottom: 1px solid var(--line);
                  cursor: pointer; font-size: 13.5px; min-height: var(--tap); }
.suggest button:last-child { border-bottom: 0; }
.suggest button:hover { background: var(--brand-wash); }

/* --------------------------------------------------------------- fotoğraf */

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.photo { position: relative; aspect-ratio: 4/3; border-radius: var(--r-sm);
         overflow: hidden; background: var(--surface-3); border: 1px solid var(--line); }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo .x { position: absolute; top: 5px; right: 5px; width: 28px; height: 28px;
            border: 0; border-radius: var(--r-sm); background: rgba(12,14,16,.76);
            color: #fff; cursor: pointer; font-size: 15px; }
.photo .x:hover { background: var(--danger); }
.photo-add { display: flex; flex-direction: column; align-items: center;
             justify-content: center; gap: 4px; aspect-ratio: 4/3;
             border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm);
             background: var(--surface); color: var(--ink-2); cursor: pointer;
             font-size: 12.5px; }
.photo-add:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-wash); }

/* Sürükle-bırak. Dosya alanın üzerine geldiğinde tüm bölge işaretlenir;
   kullanıcı nereye bırakacağını tahmin etmek zorunda kalmaz. */
.dropzone { position: relative; border-radius: var(--r); transition: background .15s var(--ease); }
.dropzone.over { background: var(--brand-wash); outline: 2px dashed var(--brand); outline-offset: 4px; }
.dropzone.over::after {
  content: attr(data-drop); position: absolute; inset: 0; display: grid;
  place-items: center; font-size: 14px; font-weight: 600; color: var(--brand);
  background: color-mix(in srgb, var(--surface) 78%, transparent);
  border-radius: var(--r); pointer-events: none;
}

/* -------------------------------------------------------- boş durum / hata */

.empty { display: grid; justify-items: center; gap: 8px; padding: 32px 20px; text-align: center; }
.empty-mark { width: 56px; height: 38px; color: var(--line-strong); stroke-width: 1.5; }
.empty-mark .dash { stroke-dasharray: 3 3; color: var(--brand); }
.empty-title { font-size: 14.5px; font-weight: 600; }
.empty-hint { font-size: 13px; color: var(--ink-2); max-width: 40ch; }
.empty .btn { margin-top: 6px; }

.error-state { display: grid; justify-items: center; gap: 8px; padding: 28px 20px;
               text-align: center; }
.error-title { font-size: 14.5px; font-weight: 600; color: var(--danger); }
.error-fix { font-size: 13px; color: var(--ink-2); max-width: 44ch; }
.error-state .btn { margin-top: 6px; }

.skeleton { display: grid; gap: 9px; padding: 4px 0; }
.sk-row { height: 42px; border-radius: var(--r);
          background: linear-gradient(90deg, var(--surface-2) 25%,
                      var(--surface-3) 37%, var(--surface-2) 63%);
          background-size: 400% 100%; animation: sk 1.3s ease infinite; }
@keyframes sk { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* ---------------------------------------------------------------- bildirim */

#toasts { position: fixed; z-index: 300; left: 50%; transform: translateX(-50%);
          top: calc(12px + env(safe-area-inset-top)); display: grid; gap: 8px;
          width: min(460px, calc(100vw - 24px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px;
         border-radius: var(--r); background: var(--surface);
         border: 1px solid var(--line); box-shadow: var(--sh-2);
         opacity: 0; transform: translateY(-8px);
         transition: opacity .18s var(--ease), transform .18s var(--ease); }
.toast.in { opacity: 1; transform: none; }
.toast-body { flex: 1; min-width: 0; }
.toast-body p { font-size: 13.5px; }
.toast-fix { color: var(--ink-2); font-size: 12.5px; margin-top: 3px; }
.toast-x { width: 26px; height: 26px; border: 0; border-radius: var(--r-sm);
           background: none; color: var(--muted); cursor: pointer; font-size: 16px; flex: none; }
.toast-x:hover { background: var(--surface-2); color: var(--ink); }
.toast-ok    { border-left: 3px solid var(--ok); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-info  { border-left: 3px solid var(--brand); }

/* ------------------------------------------------------------ profil paneli */

.popmenu {
  position: fixed; z-index: 320; width: 264px; padding: 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-2);
  animation: modalIn .16s var(--ease);
}
.popmenu-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.popmenu-head b { display: block; font-size: 14px; }
.popmenu-head small { color: var(--ink-2); font-size: 12.5px; }
.avatar.lg { width: 36px; height: 36px; font-size: 14px; }
.popmenu-note { font-size: 12.5px; color: var(--ink-2); margin-bottom: 8px; }
.popmenu-acts { display: grid; gap: 6px; margin-top: 12px; }
.popmenu-acts .btn { width: 100%; }

/* --------------------------------------------------------- onay penceresi */

.modal-back { position: fixed; inset: 0; z-index: 400; background: rgba(8,10,12,.5);
              display: grid; place-items: center; padding: 20px;
              animation: fade .14s var(--ease); }
@keyframes fade { from { opacity: 0; } }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(12px) scale(.97); }
  to   { opacity: 1; transform: none; }
}
@keyframes drawerIn { from { transform: translateX(-100%); } }
.modal { animation: modalIn .2s var(--ease); background: var(--surface); border: 1px solid var(--line);
         border-radius: var(--r-lg); box-shadow: var(--sh-win-active);
         padding: 20px; width: min(430px, 100%); }
.modal-lead { color: var(--ink-2); font-size: 13.5px; margin: 8px 0 14px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }

/* ------------------------------------------------------------ giriş ekranı */

.gate { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center;
        background: var(--bg); padding: 20px;
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
        overflow-y: auto; }
.gate-card { width: min(420px, 100%); background: var(--surface);
             border: 1px solid var(--line); border-radius: var(--r-lg);
             box-shadow: var(--sh-2); padding: 26px; }
.gate-logo { display: block; width: 58px; height: 58px; border-radius: 12px; margin-bottom: 16px; }
.gate-card h1 { margin-bottom: 6px; }
.gate-card .lead { margin-bottom: 18px; }
.who { display: grid; gap: 7px; margin-bottom: 16px; }
.who button { display: flex; align-items: center; gap: 10px; min-height: 52px;
              padding: 0 12px; border: 1px solid var(--line); border-radius: var(--r);
              background: var(--surface); cursor: pointer; text-align: left; }
.who button:hover { border-color: var(--line-strong); background: var(--surface-2); }
.who button.on { border-color: var(--brand); background: var(--brand-wash); }
.who .grow { flex: 1; min-width: 0; }
.who b { display: block; font-size: 14px; }
.who small { color: var(--ink-2); font-size: 12.5px; }
.pin-input input { text-align: center; letter-spacing: .5em; font-size: 20px;
                   font-weight: 600; padding-left: .5em; }
.gate-foot { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }

/* ---------------------------------------------------------------- efektler */

/* İmleç parlaması. Tıklamayı engellememesi için pointer-events kapalı. */
.cursor-glow {
  position: fixed; left: 0; top: 0; width: 340px; height: 340px;
  margin: -170px 0 0 -170px; border-radius: 50%;
  pointer-events: none; z-index: 200; opacity: 0;
  transition: opacity .25s var(--ease);
  background: radial-gradient(circle,
    color-mix(in srgb, var(--brand) 22%, transparent) 0%,
    color-mix(in srgb, var(--brand) 8%, transparent) 38%,
    transparent 68%);
}
[data-theme="dark"] .cursor-glow {
  background: radial-gradient(circle,
    color-mix(in srgb, var(--brand) 26%, transparent) 0%,
    color-mix(in srgb, var(--brand) 10%, transparent) 40%,
    transparent 70%);
}

/* Nokta alanı: masaüstünün desenini çizen tuval. Kapalıyken CSS deseni
   devreye girsin diye tuval gizlenince arka plan deseni geri gelir. */
.dot-field { position: absolute; inset: 0; pointer-events: none; z-index: 0; }
/* Sayfa zemini saydam: kartların arasından arka plandaki nokta alanı görünür,
   metinlerin altında ise kartın kendi zemini var, okunurluk bozulmaz. */
.page { background: none; }
.content:has(.dot-field:not([hidden])) { background-image: none; }


/* -------------------------------------------------------------- açılış */

.splash {
  position: fixed; inset: 0; z-index: 900; display: grid; place-items: center;
  background: var(--bg); opacity: 0; transition: opacity .28s var(--ease);
}
.splash.in { opacity: 1; }
.splash-stage { display: grid; justify-items: center; gap: 14px; text-align: center; padding: 24px; }
.splash-skip {
  position: absolute; top: max(14px, env(safe-area-inset-top)); right: 16px;
  min-height: 34px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); cursor: pointer; font-size: 13px;
}
.splash-skip:hover { color: var(--ink); border-color: var(--line-strong); }

.tank { width: 96px; height: 120px; }
.tank .tank-body, .tank .tank-neck, .tank .tank-hose {
  fill: none; stroke: var(--ink-2); stroke-width: 3.4;
  stroke-linecap: round; stroke-linejoin: round;
}
.tank .tank-mark { stroke: var(--ink-2); stroke-width: 2.4; opacity: .35; stroke-linecap: round; }
.tank .fuel { fill: var(--brand); stroke: none; transition: none; }

.splash-pct {
  font-size: 13px; color: var(--muted); letter-spacing: .18em;
  font-variant-numeric: tabular-nums;
}
.splash-brand {
  font-size: clamp(26px, 6vw, 46px); font-weight: 700; letter-spacing: .14em;
  color: var(--ink); white-space: nowrap;
}
.splash-term {
  margin: 0; font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 12.5px; line-height: 1.7; color: var(--brand);
  text-align: left; min-height: 66px; white-space: pre;
}
.splash-term::after {
  content: "▌"; animation: blink 1s steps(2) infinite; color: var(--brand);
}
@keyframes blink { 50% { opacity: 0; } }

/* ------------------------------------------------------------------ grafik */

.bars { display: flex; align-items: flex-end; gap: 5px; height: 104px; padding-top: 6px; }
.bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end;
       gap: 4px; text-align: center; }
.bar i, .bar u { display: block; border-radius: 3px 3px 0 0; min-height: 2px; }
.bar i { background: var(--brand); }
.bar u { background: var(--steel); }
.bar span { font-size: 10px; color: var(--muted); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); margin-top: 9px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.split { display: flex; height: 7px; border-radius: 4px; overflow: hidden;
         background: var(--surface-3); margin-top: 8px; }
.split i { display: block; height: 100%; }

/* --------------------------------------------------------------- dar ekran */

.drawer-back { display: none; }

@media (max-width: 900px) {
  :root { --tap: 44px; }

  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 120; width: 264px;
             transform: translateX(-100%); transition: transform .2s var(--ease);
             padding-top: max(12px, env(safe-area-inset-top));
             padding-bottom: max(12px, env(safe-area-inset-bottom));
             box-shadow: var(--sh-win); }
  .sidebar.open { transform: none; }
  .drawer-back { display: block; position: fixed; inset: 0; z-index: 110;
                 background: rgba(8,10,12,.45); opacity: 0; pointer-events: none;
                 transition: opacity .2s var(--ease); }
  .drawer-back.on { opacity: 1; pointer-events: auto; }

  .pagebar { padding: 10px 12px; }
  .pagebar-text h1 { font-size: 17px; }
  .page { padding: 14px; padding-bottom: max(14px, env(safe-area-inset-bottom)); }

  .g3, .g4, .counters { grid-template-columns: repeat(2, 1fr); }
  .formrow.c2, .formrow.c3 { grid-template-columns: 1fr; }
  .line.svc, .line.cost { grid-template-columns: 1fr 1fr; }
  .line .x { justify-self: end; }
  dl.kv { grid-template-columns: 108px 1fr; }
  th, td { padding: 9px 10px; font-size: 13px; }
  .hide-sm { display: none; }
  .topbar { gap: 8px; }
  .brand-text { display: none; }
}

@media (max-width: 560px) {
  .counters, .g2, .g3, .g4 { grid-template-columns: 1fr; }
}

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

@media print {
  .topbar, .sidebar, .pagebar, #toasts, .drawer-back { display: none !important; }
  .content, .page { overflow: visible !important; background: none !important; }
  body { overflow: visible; background: #fff; }
}


/* Ön kontrol: tüm işlemler tek çatı altında çoklu seçilebilir. */
.precheck-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.precheck-opt{display:flex;align-items:center;gap:9px;padding:10px 11px;border:1px solid var(--line);border-radius:10px;background:var(--surface-2);cursor:pointer;user-select:none}
.precheck-opt:hover{border-color:var(--text-3)}
.precheck-opt:has(input:checked){border-color:var(--accent);box-shadow:inset 0 0 0 1px var(--accent)}
.precheck-opt input{width:18px;height:18px;accent-color:var(--accent);flex:0 0 auto}
.precheck-readonly{display:flex;flex-wrap:wrap;gap:7px}
.precheck-readonly span{padding:6px 9px;border:1px solid var(--line);border-radius:999px;background:var(--surface-2);font-size:13px}
@media(max-width:760px){.precheck-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:480px){.precheck-grid{grid-template-columns:1fr}}

/* Online Phase 4: çevrimdışı kuyruk ve sürüm bildirimi */
.sync-badge {
  position: fixed; right: 14px; bottom: 14px; z-index: 12000;
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 13px;
  background: var(--surface); color: var(--text); box-shadow: 0 8px 30px rgba(0,0,0,.18);
  font: inherit; font-weight: 700; cursor: pointer;
}
.sync-badge[data-problem="1"] { outline: 2px solid #d97706; }
.update-banner {
  position: fixed; left: 50%; top: 12px; transform: translateX(-50%); z-index: 13000;
  display: flex; align-items: center; gap: 12px; padding: 9px 12px 9px 15px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  color: var(--text); box-shadow: 0 10px 35px rgba(0,0,0,.22); font-weight: 700;
}
@media (max-width: 600px) {
  .update-banner { width: calc(100% - 24px); justify-content: space-between; }
  .sync-badge { right: 10px; bottom: 10px; }
}
