:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --panel-2: #f0f2f5;
  --line: #e2e5ea;
  --line-strong: #cfd4dc;
  --text: #1c2430;
  --muted: #667085;
  --accent: #1f5fbf;
  --accent-soft: #e6eefb;
  --ok: #1e7f4f;
  --ok-soft: #e3f4ea;
  --warn: #9a5b00;
  --warn-soft: #fdf1dc;
  --bad: #b42318;
  --bad-soft: #fde8e6;
  --sub: #6941c6;
  --sub-soft: #efe9fb;
  --shadow: 0 8px 30px rgba(16, 24, 40, .14);
  --radius: 8px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12151a; --panel: #1a1e25; --panel-2: #222731; --line: #2c323d; --line-strong: #3a4250;
    --text: #e6e9ee; --muted: #98a2b3; --accent: #6ea3ff; --accent-soft: #1d2b44;
    --ok: #4cc38a; --ok-soft: #173126; --warn: #f0b04d; --warn-soft: #382a12;
    --bad: #f97066; --bad-soft: #3d1a17; --sub: #b69cf5; --sub-soft: #2a2140;
    --shadow: 0 8px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12151a; --panel: #1a1e25; --panel-2: #222731; --line: #2c323d; --line-strong: #3a4250;
  --text: #e6e9ee; --muted: #98a2b3; --accent: #6ea3ff; --accent-soft: #1d2b44;
  --ok: #4cc38a; --ok-soft: #173126; --warn: #f0b04d; --warn-soft: #382a12;
  --bad: #f97066; --bad-soft: #3d1a17; --sub: #b69cf5; --sub-soft: #2a2140;
  --shadow: 0 8px 30px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 13px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  display: flex; flex-direction: column;
}
button, input, select, textarea { font: inherit; color: inherit; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 12px; }

/* Üst çubuk */
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 10px 16px;
  background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand-title { font-weight: 700; font-size: 15px; }
.brand-sub { color: var(--muted); font-size: 12px; max-width: 360px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpis { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
.kpi .l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .03em; }
.kpi .v { font-weight: 650; font-variant-numeric: tabular-nums; }
.actions { display: flex; gap: 8px; align-items: center; }
.btn {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--panel-2); }
.btn:disabled { opacity: .4; cursor: default; background: var(--panel); }
.undo-grp { display: flex; }
.undo-grp .btn { padding: 6px 10px; font-size: 15px; line-height: 1; }
.undo-grp .btn:first-child { border-radius: 6px 0 0 6px; }
.undo-grp .btn:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.btn.danger { color: var(--bad); }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); min-width: 210px; padding: 4px; z-index: 30;
}
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px; border-radius: 5px; cursor: pointer; }
.menu button:hover { background: var(--panel-2); }
.menu button.danger { color: var(--bad); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* Yerleşim */
.layout { flex: 1; display: flex; min-height: 0; }
.sidebar {
  width: 330px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line);
  overflow: auto; padding: 8px 6px 40px;
}
.main { flex: 1; overflow: auto; padding: 16px 20px 80px; min-width: 0; }

/* Ağaç */
.nav-item, .tree-row {
  display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; cursor: pointer;
  user-select: none;
}
.nav-item:hover, .tree-row:hover { background: var(--panel-2); }
.nav-item.active, .tree-row.active { background: var(--accent-soft); color: var(--accent); }
.nav-item .count { margin-left: auto; }
.tree-row .caret { width: 14px; text-align: center; color: var(--muted); flex-shrink: 0; font-size: 10px; }
.tree-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-row .tot { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tree-row .tools { display: none; gap: 2px; }
.tree-row:hover .tools { display: flex; }
.tree-row:hover .tot { display: none; }
.tree-row .tools button { border: 0; background: none; cursor: pointer; padding: 0 4px; color: var(--muted); border-radius: 4px; }
.tree-row .tools button:hover { background: var(--line); color: var(--text); }
.tree-row.drop { outline: 2px dashed var(--accent); }
.sec-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 8px 4px; }
.badge {
  display: inline-block; padding: 0 7px; border-radius: 10px; font-size: 11px; line-height: 18px;
  background: var(--panel-2); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.sub { background: var(--sub-soft); color: var(--sub); }
.badge.acc { background: var(--accent-soft); color: var(--accent); }

/* Ana içerik */
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.page-head h1 { font-size: 19px; margin: 0; }
.crumbs { color: var(--muted); font-size: 12px; margin-bottom: 2px; }
.page-head .stats { display: flex; gap: 16px; margin-left: auto; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tab { padding: 7px 14px; border: 0; background: none; cursor: pointer; border-bottom: 2px solid transparent; color: var(--muted); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.filters { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { width: 280px; }
input[type=text], input[type=search], input[type=number], select, textarea {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 6px; padding: 5px 8px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }

table.grid { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.grid th {
  position: sticky; top: -16px; z-index: 2; background: var(--panel-2); text-align: left; font-weight: 600;
  font-size: 12px; color: var(--muted); padding: 7px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
.grid td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.grid tr:last-child td { border-bottom: 0; }
.grid tr.item:hover td { background: var(--panel-2); }
.grid tr.item.sel td { background: var(--accent-soft); }
.grid tr.grp td { background: var(--panel-2); font-weight: 650; font-size: 12px; }
.grid tr.grp .share { margin-left: 8px; padding: 1px 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 600; font-size: 11px; }
.grid td.poz { white-space: nowrap; }
.grid td.ad { min-width: 280px; }
.grid .exp { border: 0; background: none; cursor: pointer; color: var(--muted); width: 18px; padding: 0; }
.teklif-in { width: 110px; text-align: right; font-variant-numeric: tabular-nums; padding: 3px 6px; }
.teklif-in.changed { border-color: var(--warn); }
.grid select.durum { padding: 2px 4px; font-size: 12px; }
.diff-up { color: var(--ok); }
.diff-down { color: var(--bad); }
tr.detail > td { background: var(--bg); padding: 10px 12px 14px 34px; }
tr[draggable=true] { cursor: grab; }

/* Analiz ağacı */
.an { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.an + .an { margin-top: 8px; }
.an-head { display: flex; gap: 10px; align-items: center; padding: 7px 10px; background: var(--panel-2); border-bottom: 1px solid var(--line); font-size: 12px; flex-wrap: wrap; }
.an table { width: 100%; border-collapse: collapse; }
.an td { padding: 4px 10px; border-bottom: 1px dashed var(--line); font-size: 12px; vertical-align: top; }
.an tr.g td { font-weight: 650; color: var(--muted); background: transparent; padding-top: 8px; border-bottom: 0; text-transform: uppercase; font-size: 11px; letter-spacing: .03em; }
.an tr.note td { color: var(--muted); font-style: italic; border-bottom: 0; }
.an tr.foot td { border-bottom: 0; font-weight: 600; }
.an tr.sub > td { padding: 6px 10px 10px 28px; border-bottom: 1px dashed var(--line); }
.an .subbtn { border: 1px solid var(--sub-soft); background: var(--sub-soft); color: var(--sub); border-radius: 10px; cursor: pointer; font-size: 11px; padding: 0 7px; }
.an details { padding: 6px 10px 10px; font-size: 12px; color: var(--muted); }
.an details summary { cursor: pointer; }
.an details p { white-space: pre-wrap; margin: 6px 0 0; }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--panel); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* İnceleme */
.rv-section { margin-bottom: 22px; }
.rv-section h2 { font-size: 15px; margin: 0 0 8px; display: flex; gap: 8px; align-items: center; }
.rv-section h2 .btn { margin-left: auto; }
.sugs { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.sug {
  border: 1px solid var(--line-strong); background: var(--panel); border-radius: 14px; padding: 2px 10px;
  cursor: pointer; font-size: 12px; text-align: left;
}
.sug:hover { border-color: var(--accent); color: var(--accent); }
.sug.best { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.sug .why { display: block; font-size: 11px; color: var(--muted); }
.hint { font-size: 12px; color: var(--sub); margin-top: 3px; }
.chg { font-size: 12px; }
.chg .old { color: var(--bad); text-decoration: line-through; }
.chg .new { color: var(--ok); }
.chg label { display: flex; gap: 6px; align-items: baseline; }
.callout { background: var(--accent-soft); color: var(--text); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 14px; font-size: 12.5px; }
.callout.warn { background: var(--warn-soft); }

/* Toplu işlem çubuğu */
.bulkbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; background: var(--text); color: var(--bg);
  border-radius: 10px; padding: 8px 10px 8px 16px; display: flex; gap: 10px; align-items: center; box-shadow: var(--shadow); z-index: 20;
}
.bulkbar select { background: var(--bg); color: var(--text); }
.bulkbar .btn { background: var(--bg); color: var(--text); border-color: var(--bg); }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(15, 20, 30, .45); display: flex; align-items: flex-start; justify-content: center; padding: 60px 16px; z-index: 40; overflow: auto; }
.modal { background: var(--panel); border-radius: 10px; box-shadow: var(--shadow); width: min(640px, 100%); padding: 18px 20px; }
.modal h3 { margin: 0 0 12px; font-size: 16px; }
.form { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; align-items: center; }
.form label { color: var(--muted); font-size: 12px; }
.form .full { grid-column: 1 / -1; }
.form input, .form select, .form textarea { width: 100%; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.girdi-list td { padding: 3px 6px; }
.toast {
  position: fixed; right: 18px; bottom: 18px; background: var(--text); color: var(--bg); padding: 10px 14px;
  border-radius: 8px; box-shadow: var(--shadow); z-index: 50; max-width: 420px;
}
.drop-hint {
  position: fixed; inset: 12px; border: 3px dashed var(--accent); border-radius: 14px; background: color-mix(in srgb, var(--accent-soft) 85%, transparent);
  display: flex; align-items: center; justify-content: center; font-size: 18px; font-weight: 600; color: var(--accent); z-index: 60; pointer-events: none;
}
.bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--accent); }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; max-height: 40vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .main { padding: 12px 16px 80px; }
  .filters input[type=search] { width: 100%; }
}

.proj-line { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.proj-sel { max-width: 340px; font-weight: 600; padding: 3px 6px; }

/* ===== Mod sekmeleri ===== */
.topbar { padding-bottom: 0; row-gap: 8px; }
.kpi .v { white-space: nowrap; }
.modes { order: 10; flex-basis: 100%; display: flex; gap: 4px; margin: 0 -16px; padding: 0 12px; border-top: 1px solid var(--line); overflow-x: auto; }
.mode { border: 0; border-bottom: 2px solid transparent; background: none; padding: 8px 12px 7px; cursor: pointer; color: var(--muted); white-space: nowrap; font-weight: 500; }
.mode:hover { color: var(--text); }
.mode.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 650; }
body.plan-mode .sidebar { display: none; }
.teklif-in.gercek { width: 96px; }
.teklif-in.over { border-color: var(--bad); color: var(--bad); }
.gd { font-size: 11px; margin-top: 2px; }
.h2 { font-size: 15px; margin: 22px 0 8px; }
.stats-row { display: flex; gap: 22px; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 8px; }
.crumbs a { color: var(--accent); }
tr.item.crit td:nth-child(2) { box-shadow: inset 3px 0 0 var(--bad); }
tr.item.late td { background: var(--bad-soft); }
input.tiny { width: 64px; text-align: right; padding: 2px 5px; font-variant-numeric: tabular-nums; }

/* Aktivite düzenleyici */
.ed { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.ed h4 { margin: 14px 0 6px; font-size: 13px; }
.ed-grid { display: grid; grid-template-columns: 120px minmax(160px, 1fr) 120px minmax(160px, 1fr); gap: 6px 10px; align-items: center; }
.ed-grid label { color: var(--muted); font-size: 12px; }
.ed-grid input, .ed-grid select { min-width: 0; width: 100%; }
.ed-info { margin-top: 10px; font-size: 12.5px; background: var(--panel-2); border-radius: 6px; padding: 7px 10px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; gap: 4px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 2px 4px 2px 10px; font-size: 12px; }
.chip input.tiny { width: 40px; }
.chip button { border: 0; background: none; cursor: pointer; color: var(--muted); }
.row-add { display: flex; gap: 6px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
table.grid.sub th { position: static; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.days { display: flex; gap: 10px; flex-wrap: wrap; }
.days label { color: var(--text); }

/* Gantt */
.gantt { overflow: auto; max-height: calc(100vh - 250px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.g-inner { position: relative; }
.g-row { display: flex; height: 30px; border-bottom: 1px solid var(--line); }
.g-row.g-grp { background: var(--panel-2); font-weight: 650; font-size: 12px; }
.g-row.g-grp .g-left { background: var(--panel-2); }
.g-left { position: sticky; left: 0; z-index: 2; background: var(--panel); flex-shrink: 0; display: grid;
  grid-template-columns: 56px 1fr 40px 46px 46px; gap: 6px; align-items: center; padding: 0 8px; font-size: 12px; border-right: 1px solid var(--line-strong); }
.g-grp .g-left { display: flex; }
.g-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.g-tl { position: relative; flex-shrink: 0; }
.g-head { display: flex; position: sticky; top: 0; z-index: 4; background: var(--panel-2); height: 44px; border-bottom: 1px solid var(--line-strong); }
.g-head .g-left { background: var(--panel-2); font-weight: 600; color: var(--muted); z-index: 5; }
.g-mrow, .g-drow { position: relative; height: 22px; }
.g-m { position: absolute; top: 0; height: 22px; border-left: 1px solid var(--line-strong); font-size: 11px; font-weight: 600; padding: 3px 4px; white-space: nowrap; overflow: hidden; }
.g-d { position: absolute; top: 0; height: 22px; border-left: 1px solid var(--line); font-size: 10px; color: var(--muted); padding: 4px 2px; overflow: hidden; white-space: nowrap; }
.g-d.off { background: var(--line); }
.g-bar { position: absolute; top: 7px; height: 16px; border-radius: 4px; background: var(--accent); cursor: pointer; overflow: hidden; opacity: .85; }
.g-bar:hover { opacity: 1; outline: 2px solid var(--panel); }
.g-bar.crit { background: var(--bad); }
.g-bar.idari { background: var(--sub); }
.g-bar.idari.crit { box-shadow: inset 0 0 0 2px var(--bad); }
.g-bar i { display: block; height: 100%; background: rgba(0, 0, 0, .35); }
.g-lab { position: absolute; top: 7px; font-size: 11px; color: var(--muted); white-space: nowrap; pointer-events: none; }
.g-line { position: absolute; top: 44px; bottom: 0; width: 0; z-index: 1; pointer-events: none; }
.g-line.today { border-left: 2px solid var(--accent); }
.g-line.soz { border-left: 2px dashed var(--bad); }
.legend { display: inline-flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.lg { display: inline-block; width: 18px; height: 10px; border-radius: 3px; margin-right: 3px; vertical-align: middle; }
.lg.bar { background: var(--accent); }
.lg.bar.crit { background: var(--bad); }
.lg.bar.idari { background: var(--sub); }
.lg.prog { background: linear-gradient(90deg, rgba(0, 0, 0, .45) 50%, var(--accent) 50%); }
.lg.line { width: 0; height: 14px; border-radius: 0; }
.lg.line.today { border-left: 2px solid var(--accent); }
.lg.line.soz { border-left: 2px dashed var(--bad); }

/* Sevkiyat pivot */

/* Takip */
table.tk td.off, table.tk th.off { background: var(--panel-2); }
table.tk .pl { font-size: 10.5px; color: var(--muted); min-height: 14px; }
.prog { position: relative; height: 8px; width: 110px; background: var(--panel-2); border-radius: 4px; overflow: hidden; margin-left: auto; margin-bottom: 2px; }
.prog i { position: absolute; left: 0; top: 0; height: 100%; }
.prog i.p { background: color-mix(in srgb, var(--s1) 35%, transparent); }
.prog i.e { background: var(--s2); height: 50%; top: 25%; }

/* S-eğrisi: iki seri, doğrulanmış palet (mavi / turuncu) */
:root { --s1: #2a78d6; --s2: #eb6834; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --s1: #3987e5; --s2: #d95926; } }
:root[data-theme="dark"] { --s1: #3987e5; --s2: #d95926; }
.sc-wrap { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.scurve { width: 100%; max-width: 1100px; height: auto; display: block; }
.sc-legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.sw.s1 { background: var(--s1); }
.sw.s2 { background: var(--s2); }
.sc-grid { stroke: var(--line); stroke-width: 1; }
.sc-base { stroke: var(--line-strong); stroke-width: 1; }
.sc-tick { stroke: var(--line-strong); }
.sc-ax { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.sc-lab { fill: var(--text); font-size: 12px; font-weight: 600; }
.sc-l { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sc-l.s1 { stroke: var(--s1); }
.sc-l.s2 { stroke: var(--s2); }
.sc-today { stroke: var(--muted); stroke-dasharray: 3 3; }
.sc-cross { stroke: var(--muted); stroke-width: 1; }
.sc-dot { stroke: var(--panel); stroke-width: 2; }
.sc-dot.s1 { fill: var(--s1); }
.sc-dot.s2 { fill: var(--s2); }
.sc-hit { fill: transparent; cursor: crosshair; }
.sc-tip {
  position: absolute; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow);
  padding: 6px 10px; font-size: 12px; pointer-events: none; min-width: 180px; font-variant-numeric: tabular-nums;
}
@media (max-width: 900px) {
  .ed-grid { grid-template-columns: 110px 1fr; }
  .two { grid-template-columns: 1fr; }
}

/* ================= Yönetim paneli ================= */
/* Gerçekleşen = mavi (vurgu), plan = gri (referans). Kırmızı/sarı/yeşil yalnız durum için. */
:root { --pn-act: #2a78d6; --pn-plan: #85837c; --pn-plan-f: #a8a69e; --pn-cur: #eef0f3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --pn-act: #3987e5; --pn-plan: #8f8d86; --pn-plan-f: #6b6a64; --pn-cur: #232833; } }
:root[data-theme="dark"] { --pn-act: #3987e5; --pn-plan: #8f8d86; --pn-plan-f: #6b6a64; --pn-cur: #232833; }
.pn { max-width: 2200px; margin: 0 auto; }
.pn-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pn-scope { color: var(--accent); font-weight: 600; }
.pn-all { font-weight: 600; }
.pn-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 10px; }
.pn-head h1 { font-size: 19px; margin: 0; }
.pn-exit { margin-left: auto; }
.pn-filters label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.pn-filters .btn svg { vertical-align: -2px; margin-right: 4px; }
.pn .mut { display: block; color: var(--muted); font-size: 12px; }

/* Üst bant: ana durum bloğu + 4 kutu */
.pn-top { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 4fr); gap: 10px; margin-bottom: 10px; }
.pn-hero { display: flex; gap: 14px; align-items: center; border-radius: var(--radius); padding: 14px 18px; border: 1px solid var(--line); background: var(--panel); }
.pn-hero.ok { background: var(--ok-soft); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.pn-hero.warn { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.pn-hero.bad { background: var(--bad-soft); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.pn-hero-ic i { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; font-style: normal; font-size: 22px; font-weight: 700; color: #fff; background: var(--muted); }
.pn-hero.ok .pn-hero-ic i { background: var(--ok); }
.pn-hero.warn .pn-hero-ic i { background: var(--warn); }
.pn-hero.bad .pn-hero-ic i { background: var(--bad); }
.pn-hero-tx { min-width: 0; }
.pn-hero .lab { font-size: 12px; font-weight: 700; letter-spacing: .08em; }
.pn-hero.ok .lab { color: var(--ok); }
.pn-hero.warn .lab { color: var(--warn); }
.pn-hero.bad .lab { color: var(--bad); }
.pn-hero .big { font-size: clamp(22px, 2vw, 30px); font-weight: 700; line-height: 1.15; margin: 2px 0 4px; }
.pn-hero .line { font-size: 13px; line-height: 1.45; }

.pn-st { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--text); }
.pn-st i, .pn-dot-st i { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; font-style: normal; font-size: 11px; color: #fff; background: var(--muted); }
.pn-st.ok i, .pn-dot-st.ok i { background: var(--ok); }
.pn-st.warn i, .pn-dot-st.warn i { background: var(--warn); }
.pn-st.bad i, .pn-dot-st.bad i { background: var(--bad); }
.pn-dot-st.na i { background: var(--line-strong); }
.pn-st.sm i { width: 15px; height: 15px; font-size: 9px; }
.pn-st.ok { color: var(--ok); }
.pn-st.warn { color: var(--warn); }
.pn-st.bad { color: var(--bad); }
.pn-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.pn-tile { background: var(--panel); border: 1px solid var(--line); border-top: 3px solid var(--line); border-radius: var(--radius); padding: 10px 14px; min-width: 0; }
.pn-tile.st-ok { border-top-color: var(--ok); }
.pn-tile.st-warn { border-top-color: var(--warn); }
.pn-tile.st-bad { border-top-color: var(--bad); }
.pn-tile.st-bad .v { color: var(--bad); }
.pn-tile .l { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn-tile .v { font-size: clamp(20px, 1.8vw, 28px); font-weight: 700; margin: 2px 0 6px; white-space: nowrap; }
.pn-tile .s { font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; }
.pn-meter { position: relative; height: 10px; background: var(--panel-2); border-radius: 5px; }
.pn-meter i.f { position: absolute; left: 0; top: 0; height: 100%; background: var(--pn-act); border-radius: 5px; }
.pn-meter i.m { position: absolute; top: -3px; width: 3px; height: 16px; margin-left: -1.5px; background: var(--pn-plan); border-radius: 1px; box-shadow: 0 0 0 2px var(--panel); }
.pn-tile .pn-meter { margin-bottom: 3px; }
.sw.act { background: var(--pn-act); }
.sw.plan { background: var(--pn-plan); }
.sw.plan-f { background: var(--pn-plan-f); }
.sw.cur { background: var(--pn-cur); border: 1px solid var(--line-strong); }
.sw.gap { background: color-mix(in srgb, var(--bad) 22%, transparent); height: 10px; width: 14px; }
.pn-tick { display: inline-block; width: 3px; height: 12px; background: var(--pn-plan); vertical-align: middle; margin-right: 5px; border-radius: 1px; }

.pn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.pn-card { position: relative; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; min-width: 0; min-height: 0; break-inside: avoid; }
.pn-card:not(.pn-wide) { height: 340px; }
.pn-card.pn-wide { grid-column: 1 / -1; }
.pn-card header { display: flex; align-items: center; gap: 8px; }
.pn-card h2 { font-size: 15px; margin: 0; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn-icon { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 1px solid transparent; border-radius: 6px; background: none;
  color: var(--muted); cursor: pointer; flex: none; }
.pn-icon:hover, .pn-icon:focus-visible { color: var(--text); background: var(--panel-2); border-color: var(--line); outline: none; }
.pn-sub { font-size: 12px; color: var(--muted); margin: 2px 0 6px; }
.pn-legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 2px 0 4px; align-items: center; }
.sw.blk { height: 10px; width: 10px; border-radius: 2px; }
.pn-chart { position: relative; min-height: 0; overflow: hidden; }
.pn-chart[data-chart="sc"] { height: 300px; }
.pn-chart[data-chart="mb"] { height: 250px; }
.pn-chart svg { display: block; }
.pn-fit { flex: 1; min-height: 0; overflow: hidden; }
.pn-more { font-size: 12px; padding-top: 6px; }
.pn .pn-gl { stroke: var(--line); stroke-width: 1; }
.pn .pn-base { stroke: var(--line-strong); stroke-width: 1; }
.pn .pn-ax { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.pn .pn-lab { font-size: 12.5px; font-weight: 700; }
.pn .pn-lab.act { fill: var(--pn-act); }
.pn .pn-lab.plan { fill: var(--muted); font-weight: 600; }
.pn .pn-l { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.pn .pn-l.act { stroke: var(--pn-act); stroke-width: 3; }
.pn .pn-l.plan { stroke: var(--pn-plan); stroke-width: 2; }
.pn .pn-gap.bad { fill: color-mix(in srgb, var(--bad) 22%, transparent); }
.pn .pn-gap.ok { fill: color-mix(in srgb, var(--ok) 20%, transparent); }
.pn .pn-end { fill: var(--pn-act); stroke: var(--panel); stroke-width: 2; }
.pn .pn-now { stroke: var(--muted); stroke-width: 1; }
.pn .pn-cross { stroke: var(--muted); stroke-width: 1; }
.pn .pn-dot { stroke: var(--panel); stroke-width: 2; }
.pn .pn-dot.plan { fill: var(--pn-plan); }
.pn .pn-dot.act { fill: var(--pn-act); }
.pn .pn-hit { fill: transparent; }
.pn .pn-bar.plan { fill: var(--pn-plan-f); }
.pn .pn-bar.act { fill: var(--pn-act); }
.pn .pn-curm { fill: var(--pn-cur); }
.pn-table { margin-top: 6px; font-size: 12px; }
.pn-table summary { cursor: pointer; color: var(--accent); }
.pn-table table { margin-top: 6px; }
.pn-row { display: grid; grid-template-columns: 20px minmax(0, 1.3fr) minmax(0, 1fr) 52px; gap: 10px; align-items: center; padding: 8px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.pn-row.click { cursor: pointer; border-radius: 4px; }
.pn-row.click:hover { background: var(--panel-2); }
.pn-row .n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn-row .v { text-align: right; font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; }
.pn-row .pn-meter { height: 12px; border-radius: 6px; }
.pn-late { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 7px 4px; border-top: 1px solid var(--line); font-size: 13px; }
.pn-late .n { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pn-late .d { text-align: right; white-space: nowrap; }
.pn-late .d b { font-size: 17px; }
.pn-tbl { font-size: 12.5px; }
.pn-tbl td.tx { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; }
.pn-tbl td, .pn-tbl th { white-space: nowrap; }
.pn-ok { padding: 18px 0; }
.pn-pair { display: flex; gap: 32px; margin: 6px 0 10px; }
.pn-pair .v { font-size: 34px; font-weight: 700; line-height: 1.1; }
.pn-pair .v.bad { color: var(--bad); }
.pn-pair .l { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.pn-card:not(.pn-max) .pn-detail { display: none; }
.pn-foot { font-size: 11.5px; margin: 10px 0 4px; }
.pn-tip { position: fixed; z-index: 90; background: var(--panel); border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow);
  padding: 8px 11px; font-size: 12.5px; pointer-events: none; min-width: 190px; max-width: 340px; font-variant-numeric: tabular-nums; line-height: 1.6; }

/* Büyütülmüş kart: ekranı kaplar, grafik kutuyu doldurur, listeler tam görünür */
.pn-back { position: fixed; inset: 0; z-index: 70; background: rgba(16, 24, 40, .45); }
.pn-card.pn-max { position: fixed; inset: 24px; z-index: 80; height: auto !important; box-shadow: var(--shadow); padding: 16px 20px; }
.pn-card.pn-max h2 { font-size: 18px; }
.pn-card.pn-max .pn-chart { flex: 1; height: auto; }
.pn-card.pn-max .pn-fit { overflow: auto; }
.pn-card.pn-max .pn-tbl { font-size: 13.5px; }
.pn-card.pn-max .pn-tbl td.tx { white-space: normal; }

/* Sunum modu: uygulama çerçevesi gizli, tek ekran, kaydırma yok, yazılar bir kademe büyük */
:is(body.pn-present, body.pn-print) .topbar, :is(body.pn-present, body.pn-print) .pn-filters, :is(body.pn-present, body.pn-print) .pn-table, :is(body.pn-present, body.pn-print) .toast, :is(body.pn-present, body.pn-print) .pn-foot { display: none !important; }
:is(body.pn-present, body.pn-print) .main { padding: 14px 18px; overflow: hidden; }
:is(body.pn-present, body.pn-print) .pn { max-width: none; height: calc(100vh - 28px); display: flex; flex-direction: column; }
:is(body.pn-present, body.pn-print) .pn-head { margin-bottom: 8px; }
:is(body.pn-present, body.pn-print) .pn-head h1 { font-size: 24px; }
:is(body.pn-present, body.pn-print) .pn-head .crumbs { font-size: 13px; }
body.pn-present .pn-pbtns { margin-left: auto; display: flex; align-items: center; gap: 8px; opacity: .3; transition: opacity .15s; }
body.pn-present .pn-pbtns:hover, body.pn-present .pn-pbtns:focus-within { opacity: 1; }
body.pn-present .pn-exit { margin-left: 0; }
.pn-ref svg { vertical-align: -2px; margin-right: 4px; }
.pn-ref.busy svg { animation: pn-spin .8s linear infinite; }
@keyframes pn-spin { to { transform: rotate(360deg); } }
.pn-ref-t { font-size: 12px; color: var(--muted); }
:is(body.pn-present, body.pn-print) .pn-top { margin-bottom: 8px; }
:is(body.pn-present, body.pn-print) .pn-hero .line, :is(body.pn-present, body.pn-print) .pn-tile .s { font-size: 13.5px; }
:is(body.pn-present, body.pn-print) .pn-tile .l { font-size: 12px; }
:is(body.pn-present, body.pn-print) .pn .mut { font-size: 13px; }
:is(body.pn-present, body.pn-print) .pn-grid { flex: 1; min-height: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-template-rows: minmax(0, 1.25fr) minmax(0, 1fr); gap: 8px; }
:is(body.pn-present, body.pn-print) .pn-card { height: auto; padding: 10px 14px; }
:is(body.pn-present, body.pn-print) .pn-card h2 { font-size: 16px; }
:is(body.pn-present, body.pn-print) .pn-card.pn-wide { grid-column: span 2; }
:is(body.pn-present, body.pn-print) .pn-card:not(.pn-max) .pn-sub { display: none; }
:is(body.pn-present, body.pn-print) .pn-legend { font-size: 13px; }
:is(body.pn-present, body.pn-print) .pn-chart { flex: 1; height: auto; }
:is(body.pn-present, body.pn-print) .pn .pn-ax { font-size: 12.5px; }
:is(body.pn-present, body.pn-print) .pn .pn-lab { font-size: 14px; }
:is(body.pn-present, body.pn-print) .pn-row, :is(body.pn-present, body.pn-print) .pn-late, :is(body.pn-present, body.pn-print) .pn-tbl { font-size: 14px; }
@media screen and (max-height: 860px) {
  body.pn-present:not(.pn-print) .pn-head h1 { font-size: 20px; }
  body.pn-present:not(.pn-print) .pn-hero { padding: 10px 14px; }
}

@media screen and (max-width: 1200px) { body:not(.pn-print) .pn-top { grid-template-columns: 1fr; } }
@media screen and (max-width: 800px) { body:not(.pn-print) .pn-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } body:not(.pn-print) .pn-grid { grid-template-columns: 1fr; } }
/* Yazdırma: sunum düzeni 1400×960 px tuvalde çizilir, A4 yatay (277×190 mm) tek sayfaya ölçeklenir */
body.pn-print .main { padding: 0; overflow: hidden; }
body.pn-print .pn { width: 1400px; height: 960px; max-width: none; }
body.pn-print .pn-pbtns, body.pn-print .pn-all, body.pn-print .pn-icon, body.pn-print .pn-back, body.pn-print .pn-tip { display: none !important; }
@media print {
  @page { size: A4 landscape; margin: 10mm; }
  /* Kâğıtta her zaman açık tema */
  :root:not([data-theme="__"]), :root[data-theme] {
    --bg: #ffffff; --panel: #ffffff; --panel-2: #f0f2f5; --line: #e2e5ea; --line-strong: #cfd4dc; --text: #1c2430; --muted: #667085;
    --accent: #1f5fbf; --accent-soft: #e6eefb; --ok: #1e7f4f; --ok-soft: #e3f4ea; --warn: #9a5b00; --warn-soft: #fdf1dc; --bad: #b42318; --bad-soft: #fde8e6;
    --pn-act: #2a78d6; --pn-plan: #85837c; --pn-plan-f: #a8a69e; --pn-cur: #eef0f3; color-scheme: light;
  }
  body.plan-mode .topbar, .pn-filters, .pn-tip, .pn-table, .toast, .pn-icon, .pn-pbtns, .pn-all, .pn-back { display: none !important; }
  html, body { height: auto !important; overflow: hidden !important; background: #fff !important; }
  body.pn-print .layout, body.pn-print .main { display: block; height: 715px !important; overflow: hidden !important; padding: 0 !important; background: #fff !important; }
  body.pn-print .pn { transform: scale(.745); transform-origin: 0 0; }
  .pn { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pn-card, .pn-tile { border-color: #ccc; break-inside: avoid; }
}

/* Giriş paneli ve oturum (sunucu modu) */
body.auth-on > :not(.auth):not(.toast) { visibility: hidden; }
.auth { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(1200px 600px at 20% 0%, var(--accent-soft), transparent 60%), var(--bg); overflow: auto; }
.auth-card { width: min(380px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
  padding: 28px 28px 22px; display: flex; flex-direction: column; gap: 12px; }
.auth-brand { font-size: 22px; font-weight: 700; letter-spacing: -.01em; }
.auth-brand::before { content: ""; display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: var(--accent); margin-right: 9px; vertical-align: 2px; }
.auth-hello { font-size: 14px; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
.auth-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.auth-field input { padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--panel); font-size: 14px; color: var(--text); }
.auth-field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.auth-err { background: var(--bad-soft); color: var(--bad); border-radius: 7px; padding: 8px 10px; font-size: 12.5px; }
.auth-btn { padding: 10px; font-size: 14px; font-weight: 600; margin-top: 4px; }
.auth-btn:disabled { opacity: .6; cursor: progress; }
.auth-foot { color: var(--muted); font-size: 12px; text-align: center; }

.user-btn { display: flex; align-items: center; gap: 7px; padding: 4px 10px 4px 4px; }
.user-btn .avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700; }
.user-btn .uname { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
#userDrop { right: 0; left: auto; min-width: 230px; }
.menu-head { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head .muted { font-size: 12px; margin-bottom: 6px; }

.sync { font-size: 12px; color: var(--muted); white-space: nowrap; padding: 3px 8px; border-radius: 10px; }
.sync.saved { color: var(--ok); }
.sync.saving, .sync.dirty { color: var(--muted); }
.sync.offline, .sync.conflict, .sync.error { background: var(--warn-soft); color: var(--warn); }
.sync.ro { background: var(--panel-2); }

/* İzleyici: düzenleme düğmeleri gizli (sunucu da değişikliği reddeder) */
body.ro [data-act="upload"], body.ro [data-act="new-poz"], body.ro [data-act="new-cat"], body.ro [data-act="new-project"],
body.ro [data-act="import-json"], body.ro [data-act="metraj-yukle"], body.ro .undo-grp, body.ro .tree-row .tools { display: none !important; }
body.ro #main .teklif-in, body.ro #main select.durum { pointer-events: none; background: transparent; border-color: transparent; }

.welcome { max-width: 560px; margin: 80px auto; text-align: center; }
.welcome h1 { font-size: 22px; margin: 0 0 8px; }
.welcome p { color: var(--muted); }
.welcome-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.modal.wide { width: min(920px, 100%); }
.grid.users input[type="text"] { width: 100%; min-width: 120px; }
.grid.users tr.pasif td { opacity: .55; }
.callout.ok-box { background: var(--ok-soft); }
.callout code.pw { font: 600 15px ui-monospace, "Cascadia Mono", Consolas, monospace; background: var(--panel); padding: 2px 8px; border-radius: 5px; margin: 0 4px; user-select: all; }
