:root {
  --bg: #f5f6f8; --card: #fff; --ink: #16181d; --muted: #6b7280;
  --line: #e5e7eb; --brand: #111; --accent: #2563eb;
  --red: #dc2626; --green: #16a34a; --amber: #d97706; --purple: #7c3aed;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; }
a { color: var(--accent); text-decoration: none; }

/* Yerleşim */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #111; color: #eee; padding: 18px 14px; flex-shrink: 0; }
.sidebar .logo { text-align: center; margin-bottom: 22px; }
.sidebar .logo img { width: 130px; filter: invert(1); }
.sidebar nav a { display: block; color: #cfcfcf; padding: 9px 12px; border-radius: 8px; margin-bottom: 3px; }
.sidebar nav a:hover { background: #222; color: #fff; }
.sidebar nav a.active { background: #2b2b2b; color: #fff; font-weight: bold; }
.sidebar .whoami { margin-top: 26px; font-size: 12px; color: #9ca3af; padding: 0 12px; line-height: 1.7; }
.sidebar .whoami a { color: #9ca3af; }
.role-tag { background: #2b2b2b; color: #d1d5db; border-radius: 999px; padding: 1px 8px; font-size: 11px; }

/* Rol izin ızgarası */
.perm-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.perm-group { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.perm-title { font-size: 12px; font-weight: bold; color: var(--muted); text-transform: uppercase;
              letter-spacing: .4px; margin-bottom: 6px; }
.perm-item { display: flex; gap: 7px; align-items: flex-start; font-size: 13px; color: var(--ink);
             margin-bottom: 4px; cursor: pointer; }
.perm-item input { width: auto; margin: 2px 0 0; flex: 0 0 auto; }
code { background: #f3f4f6; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
/* min-width:0 olmadan flex öğesi içeriğinden küçülemez ve geniş tablolar sayfayı taşırır */
.main { flex: 1; min-width: 0; padding: 24px 28px; max-width: 1250px; }
h1 { font-size: 21px; margin: 0 0 18px; }
h2 { font-size: 16px; margin: 22px 0 10px; }

/* Kartlar ve tablolar */
/* Geniş tablolar sayfayı değil kendi kartını kaydırsın */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
        padding: 16px 18px; margin-bottom: 16px; overflow-x: auto; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .label { color: var(--muted); font-size: 12px; }
.stat .value { font-size: 22px; font-weight: bold; margin-top: 4px; }
.stat.red .value { color: var(--red); } .stat.green .value { color: var(--green); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }

/* Uzun listeler: tablo kendi içinde dikey kayar, başlık satırı sabit kalır.
   Kayıt sayısı arttıkça sayfa uzayıp gezinmeyi zorlaştırmasın. */
.scroll-y { max-height: 62vh; overflow-y: auto; overflow-x: auto; }
.scroll-y table { border-collapse: separate; border-spacing: 0; }
.scroll-y th { position: sticky; top: 0; z-index: 2; background: var(--card);
               box-shadow: inset 0 -1px 0 var(--line); }
.scroll-y tr.total td { position: sticky; bottom: 0; background: var(--card);
                        box-shadow: inset 0 1px 0 var(--ink); }

/* Yatay kayan şerit — ay/etiket listeleri uzayınca */
.scroll-x { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.scroll-x > * { flex: 0 0 auto; }
.month-picker { display: flex; flex-direction: column; gap: 10px; }
.year-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.picker-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
tr.total td { font-weight: bold; border-top: 2px solid var(--ink); }
tr.overdue td { background: #fef2f2; }
.num { text-align: right; white-space: nowrap; }

/* Rozetler */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; white-space: nowrap; }
.badge-gray { background: #f3f4f6; color: #374151; } .badge-blue { background: #dbeafe; color: #1d4ed8; }
.badge-amber { background: #fef3c7; color: #b45309; } .badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; } .badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-dark { background: #111; color: #fff; }

/* Formlar */
form.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; align-items: end; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 3px; }
input, select, textarea { width: 100%; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 7px; font: inherit; background: #fff; }
textarea { min-height: 54px; }
button, .btn { background: var(--brand); color: #fff; border: 0; padding: 8px 15px; border-radius: 7px; font: inherit; cursor: pointer; }
button.secondary, .btn.secondary { background: #fff; color: var(--ink); border: 1px solid #d1d5db; }
button.small { padding: 4px 9px; font-size: 12px; }
button.danger { background: var(--red); }
button.small.danger { background: var(--red); color: #fff; border: 0; }

/* Araç çubuğu: arama, filtre, dışa aktarma */
.toolbar { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.filter-form { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.filter-form input, .filter-form select { width: auto; padding: 5px 8px; font-size: 13px; }
.filter-form input[type=search] { min-width: 190px; }
a.btn.small { padding: 4px 9px; font-size: 12px; display: inline-block; }

/* Satır içi eylemler */
.row-actions { display: flex; gap: 5px; align-items: flex-start; flex-wrap: nowrap; white-space: nowrap; }
.row-actions form { display: inline; }
td.row-actions { width: 1%; }
tr.row-active > td { background: #fffbeb; }
.task-active { outline: 2px solid var(--accent); }

/* Açılır satır içi düzenleme */
.inline-edit summary { list-style: none; display: inline-block; }
.inline-edit summary::-webkit-details-marker { display: none; }
.inline-edit-form { margin-top: 8px; padding: 10px; background: #f9fafb;
                    border: 1px solid var(--line); border-radius: 8px; min-width: 320px; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.ok { background: #dcfce7; color: #166534; } .flash.err { background: #fee2e2; color: #991b1b; }

/* Kanban */
.kanban { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; align-items: start; }
/* Kolon uzayınca kendi içinde kayar — pano hep tek ekranda kalsın */
.kanban .col { background: #eef0f3; border-radius: 10px; padding: 10px;
               max-height: 72vh; overflow-y: auto; }
.kanban .col h3 { position: sticky; top: -10px; background: #eef0f3; margin: -2px -4px 8px;
                  padding: 4px 4px 6px; z-index: 1; }
.kanban .col h3 { font-size: 13px; margin: 2px 4px 10px; display: flex; justify-content: space-between; }
.kanban .col h3 .count { color: var(--muted); font-weight: normal; }
.kanban .col.wip-full h3 { color: var(--red); }
.task { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; }
.task .t-title { font-weight: bold; margin-bottom: 4px; }
.task .t-meta { font-size: 12px; color: var(--muted); }
.task.overdue { border-left: 4px solid var(--red); }
.task.wait-warn { border-left: 4px solid var(--amber); }
.task.wait-late { border-left: 4px solid var(--red); background: #fef2f2; }
.task form { margin-top: 7px; display: flex; gap: 5px; flex-wrap: wrap; }
.task select { width: auto; font-size: 12px; padding: 3px 5px; }

/* Görev kontrol listesi */
.checklist { margin-top: 7px; border-top: 1px dashed var(--line); padding-top: 6px; }
.checklist .cl-head { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.task form.cl-item { margin: 0 0 2px; display: flex; gap: 5px; flex-wrap: nowrap;
                     align-items: flex-start; font-size: 12px; line-height: 1.35; }
.task form.cl-item span { flex: 1; min-width: 0; }
.cl-btn { background: none; border: 0; padding: 0; font-size: 13px; line-height: 1.35;
          cursor: pointer; color: var(--ink); flex: 0 0 auto; }
.cl-done { color: var(--muted); text-decoration: line-through; }

/* ---------------------------------------------------------------- Grafikler */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { font-size: 11px; fill: var(--muted); font-family: Arial, Helvetica, sans-serif; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { stroke: var(--card); stroke-width: 2; transition: r .12s; }
.chart .dot:hover { r: 6.5; }
.chart .point-label { font-size: 11px; font-weight: bold; font-family: Arial, Helvetica, sans-serif; }
.chart-empty { color: var(--muted); font-size: 13px; margin: 12px 0; }

.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
             flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.card-head-note { font-size: 12px; color: var(--muted); }

.legend-row { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 5px; }
.legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Yatay çubuklar */
.hbars { display: flex; flex-direction: column; gap: 7px; }
.hbar-row { display: grid; grid-template-columns: minmax(72px, 118px) minmax(60px, 1fr) minmax(84px, auto);
            gap: 10px; align-items: center; font-size: 13px; }
.hbar-label { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { background: #eef0f3; border-radius: 4px; height: 18px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 4px; }
.hbar-value { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hbar-note { color: var(--muted); font-size: 12px; }

/* Sparkline */
.spark { width: 90px; height: 26px; }
.spark polyline { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }

/* Grafiğin tablo görünümü — erişilebilirlik için */
.chart-table { margin-top: 12px; }
.chart-table summary { cursor: pointer; font-size: 12px; color: var(--muted); }
.chart-table table { margin-top: 8px; }

.col-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.col-2 > .card { margin-bottom: 0; }
.muted-note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.h1-sub { font-size: 14px; font-weight: normal; color: var(--muted); margin-left: 6px; }
.stat .sub { font-size: 12px; color: var(--muted); margin-top: 5px; min-height: 18px; }
.delta { font-weight: bold; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); }

/* Login */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #111; }
.login-card { background: #fff; padding: 36px; border-radius: 14px; width: 330px; }
.login-card img { width: 160px; display: block; margin: 0 auto 20px; }
.login-card button { width: 100%; margin-top: 6px; }
