/* BackOffice panel — tek stil dosyası.

   Çerçeve yok: panel tablo ve formdan oluşuyor, bir CSS kütüphanesi
   indirmek hem derleme adımı hem de CSP'de bir dış kaynak demekti.

   Renkler değişkende: operatör bütün gün bu ekrana bakıyor, kontrastı
   tek yerden ayarlamak istiyorum. */

:root {
    --bg:        #11151c;
    --bg-soft:   #171d26;
    --bg-card:   #1c232e;
    --bg-hover:  #222b38;
    --line:      #2b3543;
    --text:      #dde3ea;
    --text-dim:  #8b97a7;
    --accent:    #3d8bfd;
    --accent-dk: #2f6fcc;
    --ok:        #35b37e;
    --warn:      #d9a400;
    --danger:    #e2575b;
    --radius:    7px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.45 "Segoe UI", system-ui, -apple-system, sans-serif;
}

.hidden { display: none !important; }
.muted  { color: var(--text-dim); }
.error  { color: var(--danger); }
.right  { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------------- giriş ---------------- */

.login {
    display: grid;
    place-items: center;
    min-height: 100%;
    padding: 24px;
}

.login-card { width: 100%; max-width: 340px; }
.login-card h1 { margin: 0; font-size: 20px; }
.login-card p  { margin: 4px 0 18px; }

.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
}

label {
    display: block;
    margin: 12px 0 5px;
    font-size: 12px;
    color: var(--text-dim);
}

input, select, textarea {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-soft);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 5px;
    font: inherit;
}

/* Destek mesajı (§41): dikey büyüsün, yatayda taşmasın. */
textarea { resize: vertical; min-height: 68px; }

input:focus, select:focus, textarea:focus, button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

/* ---------------- kabuk ---------------- */

.shell {
    display: grid;
    grid-template-columns: 208px 1fr;
    height: 100%;
}

.side {
    display: flex;
    flex-direction: column;
    background: var(--bg-soft);
    border-right: 1px solid var(--line);
}

.brand {
    padding: 16px 18px;
    font-weight: 600;
    letter-spacing: .3px;
    border-bottom: 1px solid var(--line);
}

.side nav { flex: 1; padding: 8px 0; overflow-y: auto; }

.side nav a {
    display: block;
    padding: 9px 18px;
    color: var(--text-dim);
    text-decoration: none;
    border-left: 3px solid transparent;
}

.side nav a:hover { background: var(--bg-hover); color: var(--text); }

.side nav a.active {
    color: var(--text);
    background: var(--bg-hover);
    border-left-color: var(--accent);
}

.side-foot {
    padding: 12px 14px;
    border-top: 1px solid var(--line);
}

.who { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; word-break: break-all; }
.menu-empty { padding: 10px 18px; font-size: 13px; }

.main { display: flex; flex-direction: column; min-width: 0; }

.top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
}

.top h1 { margin: 0; font-size: 17px; font-weight: 600; }
.page-tools { display: flex; gap: 8px; align-items: center; }
.page { flex: 1; padding: 18px 20px; overflow: auto; min-width: 0; }

/* ---------------- düğmeler ---------------- */

.btn {
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--bg-card);
    color: var(--text);
    font: inherit;
    cursor: pointer;
}

.btn:hover:not(:disabled) { background: var(--bg-hover); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-dk); }
.btn.ok      { background: var(--ok); border-color: var(--ok); color: #06231a; }
.btn.danger  { background: var(--danger); border-color: var(--danger); color: #2a0a0b; }
.btn.ghost   { background: transparent; }
.btn.small   { padding: 4px 9px; font-size: 12px; }

.login-card .btn { width: 100%; margin-top: 18px; }

/* ---------------- filtre çubuğu ---------------- */

.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 14px;
}

.filters .f { display: flex; flex-direction: column; }
.filters .f label { margin: 0 0 4px; }
.filters .f input, .filters .f select { width: auto; min-width: 140px; }

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

.table-wrap {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow-x: auto;
}

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }

th, td {
    padding: 8px 11px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

th { background: var(--bg-soft); color: var(--text-dim); font-weight: 600; font-size: 12px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: var(--bg-hover); }
td.empty { text-align: center; color: var(--text-dim); padding: 28px; white-space: normal; }

.pager {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    font-size: 13px;
    color: var(--text-dim);
}

/* ---------------- durum etiketi ---------------- */

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 11px;
    font-size: 12px;
    border: 1px solid var(--line);
    background: var(--bg-soft);
}

/* Yatırım (Deposits.Status) */
.tag.s1 { color: var(--warn);    border-color: #4a3c10; background: #2a230d; }  /* bekliyor */
.tag.s2 { color: var(--accent);  border-color: #1d3c66; background: #12243d; }  /* işlemde */
.tag.s3 { color: var(--ok);      border-color: #1b4636; background: #0e2a20; }  /* onaylandı */
.tag.s4 { color: var(--danger);  border-color: #522326; background: #2d1315; }  /* reddedildi */
.tag.s5 { color: var(--text-dim); }                                             /* iade */
.tag.s6 { color: var(--text-dim); }                                             /* otomatik ret */

/* Taşeron durumu — satırın kendi hâli (§29) */
.tag.p0 { color: var(--danger); border-color: #522326; background: #2d1315; }    /* SOS */
.tag.p1 { color: var(--text-dim); }                                              /* pasif */
.tag.p2 { color: var(--warn);   border-color: #4a3c10; background: #2a230d; }    /* limit bitti */
.tag.p3 { color: var(--ok);     border-color: #1b4636; background: #0e2a20; }    /* aktif */

/* Hesap durumu — satırın kendi hâli, bir enum değil (§28) */
.tag.a0 { color: var(--text-dim); text-decoration: line-through; }               /* silindi */
.tag.a1 { color: var(--text-dim); }                                              /* pasif */
.tag.a2 { color: var(--warn);   border-color: #4a3c10; background: #2a230d; }    /* limit doldu */
.tag.a3 { color: var(--ok);     border-color: #1b4636; background: #0e2a20; }    /* aktif */

/* Çekim (Withdrawals.Status) — numaralar aynı, anlamları değil:
   burada 4 "Tamamlandı" (yeşil), yatırımda 4 "Reddedildi" (kırmızı). */
.tag.w1 { color: var(--text-dim); }                                             /* havuzda */
.tag.w2 { color: var(--warn);    border-color: #4a3c10; background: #2a230d; }  /* atandı */
.tag.w3 { color: var(--accent);  border-color: #1d3c66; background: #12243d; }  /* üzerine alındı */
.tag.w4 { color: var(--ok);      border-color: #1b4636; background: #0e2a20; }  /* tamamlandı */
.tag.w5 { color: var(--danger);  border-color: #522326; background: #2d1315; }  /* reddedildi */

/* ---------------- ayrıntı paneli ---------------- */

.drawer { position: fixed; inset: 0; z-index: 40; }
.backdrop { position: absolute; inset: 0; background: #0008; }

.drawer-body {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: min(560px, 100%);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-left: 1px solid var(--line);
}

.drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-content { padding: 18px; overflow-y: auto; flex: 1; }

.kv { display: grid; grid-template-columns: 136px 1fr; gap: 7px 12px; margin-bottom: 20px; }
.kv dt { color: var(--text-dim); font-size: 12px; }
.kv dd { margin: 0; word-break: break-word; }

.section-title {
    margin: 22px 0 9px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: var(--text-dim);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.timeline { list-style: none; margin: 0; padding: 0; }

.timeline li {
    padding: 8px 0 8px 14px;
    border-left: 2px solid var(--line);
    font-size: 13px;
}

.timeline .when { color: var(--text-dim); font-size: 12px; }

.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.plain li:last-child { border-bottom: 0; }
.plain .when { color: var(--text-dim); font-size: 12px; }

/* Onayın önündeki engel — düğmeye basmadan önce görünsün. */
.notice {
    margin: 0 0 16px;
    padding: 9px 12px;
    border-radius: 5px;
    border: 1px solid var(--line);
    background: var(--bg-soft);
    font-size: 13px;
}

.notice.warn { color: var(--warn); border-color: #4a3c10; background: #2a230d; }

.small { font-size: 12px; }

/* Eşit genişlikli yazı tipi — API anahtarı ve IP listesi için (§49).
   Oransal yazı tipinde `l` ile `1`, `0` ile `O` ayırt edilemiyor;
   operatör anahtarı gözle karşılaştırırken tam olarak bunu yapıyor. */
.mono {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
    word-break: break-all;
}

/* Kalan limit ve ret sayacı: operatörün önce görmesi gereken iki sayı. */
.strong, td.strong { font-weight: 600; }
.danger-text { color: var(--danger); }
.warn-text { color: var(--warn); }
.ok-text { color: var(--ok); }

/* ---------------- mutabakat özeti ---------------- */

.range { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.stat { padding: 12px 14px; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-dim); }
.stat-value { font-size: 18px; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Ayrıntı panelindeki ikinci süzgeç çubuğu daha dar. */
.filters.tight { gap: 8px; margin: 10px 0; }
.filters.tight select { min-width: 120px; }

/* Metin taşıyan özet kartları (işler ekranı) sayılardan küçük. */
.stat-value.small-value { font-size: 14px; }

/* Rapor sekmeleri (§38): rota değil, aynı ekranın üç tablosu — seçili
   olan `primary` sınıfını alıyor, ayrı bir vurgu kuralına gerek yok. */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }

/* Talep mesajı (§41): satır sonları korunuyor, uzun kelime kırılıyor.
   Metin dışarıdan geliyor ve textContent ile basılıyor — HTML değil. */
.ticket-body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; }

/* Maskeli ayar etiketi */
.tag.m1 { color: var(--text-dim); border-style: dashed; }

/* Site istisnası seçimi satır içinde */
select.mode { width: auto; min-width: 150px; padding: 3px 7px; font-size: 12px; }

/* Rol izin dökümü: uzun, tek blok hâlinde ve kırılabilir. */
.perm-list {
    margin-top: 6px;
    font-size: 11px;
    line-height: 1.6;
    color: var(--text-dim);
    word-break: break-word;
}

details summary { cursor: pointer; margin-top: 4px; }

/* ---------------- formlar ---------------- */

.grid2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 14px;
}

.grid2 .f { min-width: 0; }
.grid2 input, .grid2 select { width: 100%; }

.checks { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; }

.f.check { flex-direction: row; align-items: center; gap: 7px; }
.f.check input { width: auto; margin: 0; }
.f.check label { margin: 0; color: var(--text); font-size: 13px; }

.hint { font-size: 11px; color: var(--text-dim); margin-top: 3px; }

.edit-form { margin-top: 18px; }
.edit-form .actions { margin-top: 16px; }

/* Süzgeç çubuğundaki onay kutusu diğer alanlarla aynı hizada dursun:
   etiket üstte olmadığı için kendiliğinden yukarı kayıyordu. */
.filters .f.check { align-self: flex-end; height: 34px; margin: 0; }

@media (max-width: 560px) {
    .grid2 { grid-template-columns: 1fr; }
}

/* ---------------- dekont ---------------- */

.row-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.flag { color: var(--warn); font-size: 12px; margin-top: 3px; }

.uploader {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
    flex-wrap: wrap;
}

.uploader input[type="file"] {
    width: auto;
    flex: 1;
    min-width: 180px;
    padding: 6px 8px;
    font-size: 13px;
}

.receipt-image {
    display: block;
    max-width: 100%;
    max-height: 60vh;
    margin: 0 auto;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #fff;        /* dekontlar genelde beyaz zeminli taramalar */
}

.modal-body label { margin-top: 14px; }
.modal-body select { margin-bottom: 4px; }

/* ---------------- onay kutusu ---------------- */

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; }

.modal-body {
    position: relative;
    width: min(420px, calc(100% - 32px));
    max-height: calc(100% - 48px);
    overflow-y: auto;
}

.modal-body h2 { margin: 0 0 12px; font-size: 16px; }
.modal-body p { margin: 0 0 4px; }
.modal-body .actions { margin-top: 16px; }

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

.toasts {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 60;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: var(--bg-card);
    max-width: 380px;
    box-shadow: 0 6px 20px #0006;
}

.toast.ok   { border-color: #1b4636; }
.toast.bad  { border-color: #522326; }

/* ---------------- küçük ekran ---------------- */

@media (max-width: 760px) {
    .shell { grid-template-columns: 1fr; }
    .side { flex-direction: row; align-items: center; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
    .side nav { display: flex; padding: 0; }
    .side nav a { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; }
    .side nav a.active { border-left-color: transparent; border-bottom-color: var(--accent); }
    .brand, .who { display: none; }
    .side-foot { border-top: 0; margin-left: auto; }
    .kv { grid-template-columns: 1fr; gap: 2px 0; }
    .kv dd { margin-bottom: 8px; }
}
