:root {
  --bg: #f5f4f0; --panel: #ffffff; --ink: #1d1d1f; --muted: #6d6d72; --line: #e3e1da;
  --accent: #d6336c; --accent-ink: #fff; --ok: #1f8a4c; --warn: #b7791f; --err: #c53030; --run: #2b6cb0;
  --ok-bg: #e6f4ec; --warn-bg: #fdf3e1; --err-bg: #fde8e8; --run-bg: #e7effa; --wait-bg: #eeeeec;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141416; --panel: #1d1d20; --ink: #ececee; --muted: #9a9aa2; --line: #2e2e33;
    --ok-bg: #173323; --warn-bg: #3a2c12; --err-bg: #3d1a1a; --run-bg: #172a40; --wait-bg: #2a2a2e;
    --ok: #4cc782; --warn: #e3a743; --err: #f07272; --run: #6aa8ef;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 14px; }
h2 { font-size: 16px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 10px; }
code, pre.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
pre.code { background: var(--bg); border: 1px solid var(--line); padding: 10px; border-radius: 8px; white-space: pre-wrap; word-break: break-all; }

header.top { display: flex; align-items: center; gap: 22px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand.big { font-size: 18px; margin-bottom: 18px; justify-content: center; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: linear-gradient(135deg, #f58529, #dd2a7b, #8134af); }
header nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
header nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; }
header nav a.on, header nav a:hover { color: var(--ink); background: var(--bg); text-decoration: none; }
.me { color: var(--muted); white-space: nowrap; }
main { max-width: 1240px; margin: 0 auto; padding: 24px 16px 60px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card.narrow { max-width: 460px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat .k { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 26px; font-weight: 700; margin: 4px 0; }
.stat .v small { font-size: 13px; color: var(--muted); font-weight: 500; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + * { margin-top: 18px; }
@media (max-width: 900px) { .grid2 { grid-template-columns: 1fr; } }

.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.head-row h1, .head-row h2 { margin-bottom: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.red { color: var(--err); } .green { color: var(--ok); }
.nowrap { white-space: nowrap; }

.btn { display: inline-block; border: 1px solid var(--line); background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none !important; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--err); }
.btn.sm { padding: 4px 9px; font-size: 12.5px; font-weight: 500; }
.btn.full { width: 100%; padding: 11px; }
.actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }

input, select, textarea { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); border-color: var(--accent); }
label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 12px; }
label input, label select, label textarea { margin-top: 4px; font-weight: 400; }
label.radio { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
label.radio input { width: auto; margin-top: 4px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.inline-form { display: flex; gap: 10px; }
.inline-form input { max-width: 420px; }
.rule-form { max-width: 820px; }
#rule-form, #manual .rule-form { background: var(--bg); border: 1px dashed var(--line); padding: 16px; border-radius: var(--radius); margin-bottom: 16px; }
details { margin: 4px 0 12px; }
details summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }
details.help ol { padding-left: 20px; }
.svc-select { font-size: 13px; }
.svc-info { margin: -6px 0 12px; font-size: 12.5px; min-height: 18px; }
.est { margin: 4px 0 12px; font-weight: 600; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px; }
.filters select, .filters input { width: auto; min-width: 170px; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 14px; padding: 12px; }
legend { color: var(--muted); padding: 0 6px; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.dim td { opacity: .55; }
.tbl tr.errrow td { color: var(--err); font-size: 12.5px; background: var(--err-bg); padding: 5px 8px; }
.tbl td.clip { max-width: 320px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl td.actions { display: table-cell; white-space: nowrap; text-align: right; }
.tbl td.actions form, .tbl td.actions a { display: inline-block; margin-left: 4px; }
.scroll { overflow-x: auto; }
.plist { list-style: none; margin: 0; padding: 0; }
.plist li { padding: 7px 0; border-bottom: 1px solid var(--line); }
.plist li:last-child { border: 0; }

.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 99px; white-space: nowrap; vertical-align: middle; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-err { background: var(--err-bg); color: var(--err); }
.b-run { background: var(--run-bg); color: var(--run); }
.b-wait { background: var(--wait-bg); color: var(--muted); }

.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; border: 1px solid transparent; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.err { background: var(--err-bg); color: var(--err); }

.pager { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 12px; }
.pager a { padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; }
.pager a.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

body.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.auth-card.wide { max-width: 560px; }
.steps li { margin-bottom: 10px; }

@media (max-width: 700px) {
  header.top { padding: 10px 14px; gap: 10px; }
  .inline-form { flex-direction: column; }
  .tbl td.clip { max-width: 160px; }
}

/* --- Çoklu işlem formu --- */
.ops-form { background: var(--bg); border: 1px dashed var(--line); padding: 16px; border-radius: var(--radius); margin-bottom: 16px; }
.op-row { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 4px; margin-bottom: 10px; }
.op-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.op-no { font-weight: 700; font-size: 13px; color: var(--accent); }
.op-grid { display: grid; grid-template-columns: 2.4fr 1fr 1.2fr 1fr; gap: 10px; }
.op-grid label { margin-bottom: 8px; }
@media (max-width: 800px) { .op-grid { grid-template-columns: 1fr 1fr; } .op-svc { grid-column: 1 / -1; } }
.add-row { width: 100%; border-style: dashed; margin-bottom: 12px; }
.ops-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.est-total { font-weight: 700; }
.btn.xs { padding: 0 6px; font-size: 12px; line-height: 20px; }
.btn:disabled { opacity: .35; cursor: default; }
form.mv { display: inline-flex; gap: 2px; margin-right: 6px; vertical-align: middle; }
.bal-line { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--line); }
.bal-line:last-of-type { border-bottom: 0; }
.inline-form.step { margin-bottom: 14px; }
label.grow { flex: 1; max-width: 420px; }
.cat-select { font-size: 13px; margin-bottom: 6px; }
.cat-info { min-height: 18px; margin-bottom: 12px; }
optgroup { font-style: normal; font-weight: 700; }
