:root {
  --bg: #0b1220; --surface: #121b2e; --surface-2: #19243b; --line: #243252;
  --text: #e8edf7; --muted: #8fa0c0; --navy: #004c97; --navy-2: #0a66c2;
  --gold: #f2b705; --ok: #2fbf71; --bad: #ef5b5b; --radius: 14px;
  --font: Ubuntu, "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--ok); } .neg { color: var(--bad); }

/* ---- düzen ---- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.side { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 16px; font-weight: 700; letter-spacing: .2px; }
.logo { width: 34px; height: 34px; border-radius: 10px; background: var(--navy); border-bottom: 4px solid var(--gold); display: grid; place-items: center; font-weight: 800; }
.badge-demo { font-size: 10px; background: var(--gold); color: #1a1400; padding: 1px 6px; border-radius: 99px; margin-left: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--muted); text-decoration: none; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.on { background: var(--navy); color: #fff; }
.side .who { margin-top: auto; padding: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.main { padding: 24px; max-width: 1100px; width: 100%; }
.head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }

/* ---- bileşenler ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .6px; }
.stat .v { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat.gold { border-color: var(--gold); }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.grow { flex: 1 1 200px; }
.btn { background: var(--navy); border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer; color: #fff; font-weight: 500; }
.btn:hover { background: var(--navy-2); }
.btn.gold { background: var(--gold); color: #1a1400; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--text); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.danger { background: transparent; border: 1px solid var(--bad); color: var(--bad); }
.btn.danger:hover { background: rgba(239, 91, 91, .12); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; align-items: end; }
.form .full { grid-column: 1 / -1; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: .5px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
.tablewrap { overflow-x: auto; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; background: var(--surface-2); }
.pill.ok { background: rgba(47, 191, 113, .16); color: var(--ok); }
.pill.bad { background: rgba(239, 91, 91, .16); color: var(--bad); }
.pill.gold { background: rgba(242, 183, 5, .16); color: var(--gold); }
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.feed li:last-child { border-bottom: 0; }
.crumb { color: var(--muted); text-decoration: none; font-size: 13px; }
.crumb:hover { color: var(--text); }
.secret { font: 700 28px/1 var(--font); letter-spacing: 6px; background: var(--bg); border: 1px dashed var(--gold); color: var(--gold); padding: 14px; border-radius: 12px; text-align: center; }
.empty { color: var(--muted); text-align: center; padding: 24px 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* ---- giriş ---- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 26px; }
.login form { display: grid; gap: 14px; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* ---- modal & toast ---- */
.overlay { position: fixed; inset: 0; background: rgba(3, 7, 15, .72); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px; width: 100%; max-width: 440px; max-height: 92vh; overflow: auto; }
.modal .actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
#toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 30; max-width: calc(100vw - 32px); }
.toast { background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--ok); padding: 10px 14px; border-radius: 10px; }
.toast.bad { border-left-color: var(--bad); }

/* ---- mobil ---- */
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; padding: 6px; z-index: 10; border-right: 0; border-top: 1px solid var(--line); justify-content: space-around; }
  .side .brand, .side .who { display: none; }
  .nav { display: flex; width: 100%; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; font-size: 11px; padding: 6px 8px; }
  .main { padding: 16px 16px 90px; }
  .hide-sm { display: none; }
}

/* ---- dekont şablonu düzenleyici ---- */
.tpl-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(360px, 1fr); gap: 16px; margin: 12px 0; align-items: start; }
@media (max-width: 900px) { .tpl-layout { grid-template-columns: 1fr; } }
.tpl-stage { position: relative; container-type: inline-size; cursor: crosshair; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; line-height: 0; }
.tpl-img { width: 100%; display: block; user-select: none; }
.tpl-mark { position: absolute; font-family: "Liberation Mono", ui-monospace, monospace; line-height: 1.1; white-space: nowrap; color: #0a3d91; background: rgba(242, 183, 5, .35); outline: 1px dashed #0a3d91; pointer-events: none; }
.tpl-mark.sel { background: rgba(47, 191, 113, .5); outline: 2px solid #0b7a43; }
.tpl-fields { display: flex; flex-direction: column; gap: 4px; max-height: 70vh; overflow: auto; }
.tpl-row { display: grid; grid-template-columns: minmax(110px, 1fr) auto 66px auto 66px auto 54px; gap: 4px 6px; align-items: center; padding: 4px 6px; border-radius: 8px; border: 1px solid transparent; }
.tpl-row.sel { border-color: var(--gold); background: var(--surface-2); }
.tpl-row input[type=number] { width: 100%; padding: 4px 6px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.tpl-name { display: flex; align-items: center; gap: 6px; min-width: 0; }
.linklike { background: none; border: 0; padding: 0; color: var(--text); cursor: pointer; text-align: left; font-size: 13px; }
