:root {
  --bg: #f5f6f8; --card: #fff; --ink: #1d2433; --muted: #6b7385; --line: #e2e5eb;
  --accent: #1f5fbf; --accent-soft: #e7effb; --ok: #1e7a46; --ok-soft: #e3f4ea;
  --err: #b42318; --err-soft: #fdecea; --warn: #9a6700; --warn-soft: #fff4d6;
}
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.45 system-ui, "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: 1.4rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.02rem; margin: 0 0 .8rem; }
main { max-width: none; margin: 0; padding: 1.2rem 1.5rem 3rem; }

/* Sol menü */
body.has-side main { margin-left: 240px; }
.side { position: fixed; inset: 0 auto 0 0; width: 240px; background: #16243f; color: #fff; display: flex; flex-direction: column; overflow-y: auto; z-index: 50; }
.side .logo { display: block; padding: 1.2rem 1.3rem 1rem; }
.side .logo img { width: 130px; display: block; }
.side .logo small { display: block; color: #8fa0bf; font-size: .72rem; letter-spacing: .08em; margin-top: .35rem; }
.side .logo:hover { text-decoration: none; }
.side nav { flex: 1; padding: .3rem .6rem; }
.side a, .side .me button { display: flex; align-items: center; gap: .8rem; padding: .62rem .8rem; border-radius: 10px; color: #e6ebf5; font-weight: 600; font-size: .9rem; margin: .1rem 0; }
.side a svg, .side .me button svg { width: 20px; height: 20px; flex: none; }
.side a:hover, .side .me button:hover { background: #22345a; text-decoration: none; }
.side a.on { background: #2f5394; color: #fff; }
.side .sec { color: #8fa0bf; font-size: .72rem; font-weight: 700; letter-spacing: .08em; padding: 1.2rem .8rem .4rem; }
.side .me { border-top: 1px solid #263a63; padding: .7rem .6rem 1rem; }
.side .me .who { padding: .2rem .8rem .5rem; display: flex; flex-direction: column; }
.side .me .who span { color: #8fa0bf; font-size: .78rem; }
.side .me form { margin: 0; }
.side .me button { width: 100%; background: none; border: 0; cursor: pointer; font: inherit; font-weight: 600; font-size: .9rem; text-align: left; }
.side .ver { color: #6f82a6; font-size: .75rem; padding: .6rem .8rem 0; }
.menu-btn { display: none; }
/* giriş ve doğrulama */
.auth-card { margin-top: 8vh; }
.auth-logo { width: 120px; display: block; margin-bottom: .6rem; }
.auth-card .steps { padding-left: 1.2rem; }
.auth-card .qr { text-align: center; margin: .8rem 0; }
.auth-card .qr img { background: #fff; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.auth-card .secret { display: block; word-break: break-all; background: var(--bg); padding: .4rem; border-radius: 6px; }
.code-input { font-size: 1.4rem; letter-spacing: .3em; text-align: center; }
.err-text { color: var(--err); }
@media (max-width: 900px) {
  body.has-side main { margin-left: 0; padding-top: 3.4rem; }
  .side { transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.3); }
  body.menu-open .side { transform: none; }
  .menu-btn { display: block; position: fixed; top: .6rem; left: .6rem; z-index: 60; background: #16243f; color: #fff; border: 0; border-radius: 8px; font-size: 1.3rem; padding: .25rem .65rem; cursor: pointer; }
}
.tag { font-size: .72rem; background: #2a3858; padding: .1rem .45rem; border-radius: 99px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 1.1rem 1.2rem; margin-bottom: 1.2rem; }
.narrow { max-width: 460px; margin: 2rem auto; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1.2rem; align-items: start; }
.cols > .card { margin-bottom: 0; }
.cols + .card, .card + .cols { margin-top: 1.2rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: .75rem; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
.grid-form .wide { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: .25rem; font-weight: 500; font-size: .86rem; }
label.check { flex-direction: row; align-items: center; gap: .4rem; font-weight: 400; }
input, select, textarea { font: inherit; padding: .45rem .55rem; border: 1px solid #c9ced8; border-radius: 6px; background: #fff; color: var(--ink); width: 100%; }
input[type=checkbox], input[type=radio] { width: auto; margin: 0; }
textarea { resize: vertical; font-family: inherit; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
button, .btn { font: inherit; padding: .45rem .9rem; border-radius: 6px; border: 1px solid #c9ced8; background: #fff; color: var(--ink); cursor: pointer; display: inline-block; }
button:hover, .btn:hover { background: #f0f2f6; text-decoration: none; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { background: #184e9f; }
button.danger { color: var(--err); border-color: #f0b8b2; }
button[disabled] { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); }
form.inline { display: inline; margin-left: .5rem; }
.inline-form { display: flex; gap: .5rem; }
.inline-form input { width: 240px; }

.filters { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: .9rem; }
.filters input { width: 340px; }
.search { position: relative; }
.suggest { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; width: 560px; max-height: 420px; overflow: auto;
  margin: 0; padding: .25rem 0; list-style: none; background: #fff; border: 1px solid #c9ced8; border-radius: 8px; box-shadow: 0 8px 24px rgba(20, 30, 50, .15); }
.suggest li { padding: .45rem .75rem; cursor: pointer; display: flex; gap: .5rem; align-items: baseline; }
.suggest li b { color: var(--accent); font-weight: 600; min-width: 64px; }
.suggest li .meta { margin-left: auto; font-size: .76rem; color: var(--muted); white-space: nowrap; }
.suggest li.on, .suggest li:hover { background: var(--accent-soft); }
.suggest li.cancelled { color: #9aa1ae; }
.suggest li.empty { color: var(--muted); cursor: default; }
a.sort { color: inherit; display: inline-flex; gap: .3rem; align-items: center; white-space: nowrap; }
a.sort span { color: #a3abba; font-size: .75rem; }
a.sort.on span { color: var(--accent); }
a.sort:hover { text-decoration: none; color: var(--accent); }
.filters select { width: auto; }

table.grid { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.grid th, .grid td { padding: .45rem .6rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.grid th { background: #f0f2f6; font-weight: 600; font-size: .82rem; color: #3b4357; position: sticky; top: 0; }
.grid tbody tr:hover { background: #f8fafd; }
.grid tr[onclick] { cursor: pointer; }
.grid.compact td, .grid.compact th { padding: .3rem .5rem; font-size: .86rem; }
.grid input, .grid select { padding: .3rem .4rem; }
.narrowtable { max-width: 420px; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr.cancelled td { color: #9aa1ae; text-decoration: line-through; }
tr.cancelled td:last-child { text-decoration: none; }
tr.current { background: var(--accent-soft); }
tr.late { background: var(--err-soft); }
td.warn { color: var(--err); font-weight: 600; }
.nowrap { white-space: nowrap; }
.scroll { max-height: 420px; overflow: auto; }

.pill { display: inline-block; font-size: .72rem; font-weight: 600; padding: .08rem .5rem; border-radius: 99px; background: #eceff3; color: #3b4357; vertical-align: middle; }
.pill.elab { background: #e6f4ff; color: #0b5cad; }
.pill.dis { background: #f1e9ff; color: #5b2bb5; }
.pill.best { background: var(--ok-soft); color: var(--ok); }
.pill.cancel { background: var(--err-soft); color: var(--err); }
.pill.st-bekliyor { background: var(--warn-soft); color: var(--warn); }
.pill.st-yanitlandi { background: var(--ok-soft); color: var(--ok); }
.pill.mail-sahte { background: #eceff3; }
.pill.mail-gonderildi { background: var(--ok-soft); color: var(--ok); }
.pill.mail-hata { background: var(--err-soft); color: var(--err); }

.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.flash.ok { background: var(--ok-soft); border-color: #b6dfc6; color: var(--ok); }
.flash.err { background: var(--err-soft); border-color: #f0b8b2; color: var(--err); }
.hint { font-weight: 400; font-size: .82rem; color: var(--warn); background: var(--warn-soft); padding: .35rem .6rem; border-radius: 6px; margin: 0; }
.status-card { border: 2px solid var(--accent); border-top-width: 6px; }
.status-card.is-cancelled { border-color: var(--err); }
.status-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .9rem; }
.status-head h2 { margin: 0; font-size: 1.15rem; }
.status-badge { font-weight: 700; font-size: .8rem; letter-spacing: .06em; padding: .25rem .8rem; border-radius: 99px; }
.status-badge.on { background: var(--ok-soft); color: var(--ok); }
.status-badge.off { background: var(--err-soft); color: var(--err); }
.status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .7rem; margin-bottom: .9rem; }
.tile { background: #f5f8fd; border: 1px solid #dbe4f3; border-radius: 8px; padding: .65rem .8rem; }
.tile-label { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: .2rem; }
.tile-value { font-size: 1.05rem; font-weight: 600; }
.tile-value.big { font-size: 1.35rem; font-weight: 700; color: #17223b; }
.tile-sub { font-size: .82rem; color: var(--muted); margin-top: .15rem; }
.tile-sub.warn { color: var(--err); font-weight: 600; }
.loc { display: inline-block; font-size: 1.1rem; font-weight: 700; padding: .15rem .7rem; border-radius: 6px; }
.loc.elab { background: #e6f4ff; color: #0b5cad; }
.loc.dis { background: #f1e9ff; color: #5b2bb5; }
details.change { margin-top: .9rem; border-top: 1px solid var(--line); padding-top: .7rem; }
details.change summary { cursor: pointer; color: var(--accent); font-weight: 600; margin-bottom: .7rem; }
/* Karşılaştırma */
.steps { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.steps .step { background: var(--accent-soft); color: var(--accent); font-weight: 600; padding: .3rem .7rem; border-radius: 6px; font-size: .85rem; }
.steps .arrow { color: var(--muted); }
fieldset.fs { border: 1px solid var(--line); border-radius: 8px; padding: .6rem .8rem; }
fieldset.fs legend { font-weight: 600; font-size: .86rem; padding: 0 .3rem; }
.filters select { width: auto; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem 1rem; }
.scroll-x { overflow-x: auto; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(transparent, var(--bg) 30%); padding: 1rem 0 .5rem; }
table.match tr.saved { background: var(--ok-soft); }
table.match tr.auto { background: #f3f8ff; }
.match-cell { display: flex; gap: .5rem; align-items: center; }
.match-cell select { font-size: .82rem; }
.match-cell .ara-btn { white-space: nowrap; }
.ara-box { position: relative; margin-top: .35rem; }
.inline-suggest { width: 100%; }
.cmp-wrap { overflow: auto; max-height: 75vh; border: 1px solid var(--line); border-radius: 8px; }
table.cmp { border: 0; }
table.cmp th { position: sticky; top: 0; z-index: 2; }
table.cmp .sticky-col { position: sticky; left: 0; background: #fff; z-index: 1; min-width: 240px; max-width: 320px; }
table.cmp th.sticky-col { z-index: 3; background: #f0f2f6; }
table.cmp td.cell { min-width: 120px; padding: 0; }
table.cmp td.empty-cell { background: #fafbfc; }
.cell-pick { display: flex; flex-direction: row; gap: .4rem; align-items: flex-start; padding: .35rem .45rem; font-weight: 400; cursor: pointer; height: 100%; }
.cell-pick input { margin-top: .2rem; }
td.cell.is-cur { background: var(--accent-soft); }
td.cell.is-best { box-shadow: inset 0 0 0 2px #3aa169; }
td.cell:has(input:checked) { background: #fff4c2; }
tr.picked .sticky-col { border-left: 4px solid #e0a400; }
.legend { font-size: .75rem; padding: .05rem .4rem; border-radius: 4px; }
.legend.cur { background: var(--accent-soft); }
.legend.best { box-shadow: inset 0 0 0 2px #3aa169; }
.src { display: inline-block; font-size: .68rem; font-weight: 700; padding: 0 .35rem; border-radius: 4px; margin-top: .15rem; }
.src-liste { background: #e7f0ff; color: #1f5fbf; }
.src-program { background: #e3f4ea; color: #1e7a46; }
.src-excel { background: #f1f1f1; color: #555; }
.gain { color: var(--ok); font-weight: 600; }
.loss { color: var(--err); font-weight: 600; }
.danger-link { color: var(--err); }
.lab-code { font-size: .85rem; font-weight: 600; color: var(--muted); margin-top: .15rem; }
.tl-equiv { font-weight: 600; font-size: .84rem; color: var(--ok); background: var(--ok-soft); padding: .3rem .55rem; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .8rem; font-weight: 400; }
.center { text-align: center; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: .35rem 1rem; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .3rem .8rem; max-height: 320px; overflow: auto; margin-bottom: .9rem; }
.tabs { display: flex; gap: .3rem; margin-bottom: .8rem; }
.tabs a { padding: .35rem .8rem; border-radius: 6px; border: 1px solid var(--line); background: #fff; }
.tabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.pager { display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }
iframe.mailframe { width: 100%; height: 760px; border: 1px solid var(--line); border-radius: 8px; background: #fff; margin-top: .8rem; }
pre.mailbody { white-space: pre-wrap; background: #f8f9fb; border: 1px solid var(--line); border-radius: 8px; padding: 1rem; font: inherit; }

fieldset.plain { display: contents; border: 0; padding: 0; margin: 0; }

/* Kullanıcılar ve yetki matrisi */
tr.is-off td { color: #9aa1ae; }
tr.is-off td input, tr.is-off td select { opacity: .7; }
.perm-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin: .4rem 0 .8rem; }
.perm-head h2 { margin: 0 0 .2rem; font-size: 1.05rem; }
.perm-head p { margin: 0; max-width: 70ch; }
.perm-save { display: flex; align-items: center; gap: .8rem; flex-shrink: 0; }
.perm-save #dirty { color: #a26a00; font-weight: 600; }
.perm-wrap { overflow: auto; max-height: calc(100vh - 13rem); background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
table.perm { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .9rem; }
table.perm th, table.perm td { padding: .5rem .8rem; border-bottom: 1px solid var(--line); background: var(--card); }
table.perm thead th { position: sticky; top: 0; z-index: 2; font-weight: 600; color: #3b4357; border-bottom: 1px solid #d5d9e1; }
table.perm .perm-name { position: sticky; left: 0; z-index: 1; text-align: left; font-weight: 400; min-width: 260px; width: 30%; }
table.perm thead .perm-name { z-index: 3; color: var(--muted); }
table.perm .perm-user { text-align: center; min-width: 130px; vertical-align: bottom; }
table.perm .u-name { white-space: nowrap; }
table.perm .u-meta { min-height: 1.1rem; margin-top: .15rem; }
table.perm td { text-align: center; }
table.perm tr.perm-group th, table.perm tr.perm-group td { background: #f7f8fa; padding-top: .55rem; padding-bottom: .4rem; }
table.perm tr.perm-group th { font-weight: 700; color: var(--ink); }
table.perm .perm-item { padding-left: 1.6rem; color: #3b4357; }
table.perm .perm-desc { display: block; font-size: .76rem; color: var(--muted); }
table.perm .grp-toggle { font-size: .78rem; color: var(--muted); }
table.perm .grp-toggle:hover { color: var(--accent); }
table.perm tbody tr:not(.perm-group):hover th, table.perm tbody tr:not(.perm-group):hover td { background: #f5f8fd; }
table.perm .is-off { opacity: .55; }
table.perm td.is-dirty { box-shadow: inset 0 0 0 2px #e0a400; }
table.perm input[type=checkbox] { width: 1.1rem; height: 1.1rem; cursor: pointer; accent-color: var(--accent); }
table.perm input[type=checkbox]:disabled { cursor: not-allowed; }
@media (max-width: 700px) { .perm-head { flex-direction: column; } table.perm .perm-name { min-width: 180px; } }
