:root {
  --brand-dark: #131b2c;   /* logodaki "C" */
  --brand-blue: #3459f2;   /* logodaki "K" */
  --banner-h: 64px;
  --sidebar-w: 232px;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --text: #1d2330;
  --muted: #5f6b7a;
  --border: #dde1e7;
  --primary: #3459f2;
  --primary-hover: #2747cc;
  --danger: #b42318;
  --warn: #b54708;
  --ok: #067647;
  --ins-bg: #dcfae6;
  --del-bg: #fee4e2;
  --chip: #eef2f6;
  --radius: 8px;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 1rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
h3 { font-size: .95rem; margin: 1rem 0 .5rem; }

/* Sabit üst banner */
.banner {
  position: fixed; top: 0; left: 0; right: 0; height: var(--banner-h); z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0 1.25rem; background: #fff; border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(19, 27, 44, .06);
}
.banner .brand { display: flex; align-items: center; gap: .7rem; color: var(--brand-dark);
                 font-weight: 700; font-size: 1.1rem; text-decoration: none; }
.banner .brand img { height: 40px; width: auto; mix-blend-mode: multiply; /* logonun açık gri zeminini gizler */ }
.banner .brand .name { display: flex; flex-direction: column; line-height: 1.1; }
.banner .brand small { color: var(--muted); font-weight: 400; font-size: .72rem; letter-spacing: .02em; }
.lang-switch { display: flex; gap: 2px; margin: 0 .4rem 0 0; padding: 2px; border: 1px solid var(--border);
               border-radius: 8px; background: #fff; }
.lang-switch button { display: flex; align-items: center; gap: .3rem; border: 0; background: transparent;
                      padding: .25rem .45rem; border-radius: 6px; cursor: pointer; font: inherit; font-size: .75rem;
                      color: var(--muted); opacity: .75; }
.lang-switch button:hover { background: var(--chip); opacity: 1; }
.lang-switch button.active { background: rgba(52, 89, 242, .1); color: var(--brand-dark); font-weight: 600; opacity: 1; }
.lang-switch img { border-radius: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .12); display: block; }
.login-lang { display: flex; justify-content: flex-end; margin-bottom: .5rem; }
.banner .user { display: flex; align-items: center; gap: .6rem; font-size: .85rem; }
.banner .user form { margin: 0; }
.banner .who { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; font-weight: 500; }
.banner .roles { color: var(--muted); font-size: .75rem; font-weight: 400; }

/* Sol menü */
.sidebar {
  position: fixed; top: var(--banner-h); bottom: 0; left: 0; width: var(--sidebar-w); z-index: 10;
  background: var(--brand-dark); overflow-y: auto; padding: 1rem .75rem;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar a { color: #c9d1e3; padding: .55rem .75rem; border-radius: 6px; border-left: 3px solid transparent;
             display: flex; align-items: center; justify-content: space-between; }
.sidebar a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sidebar a.active { background: rgba(52, 89, 242, .18); color: #fff; border-left-color: var(--brand-blue);
                    font-weight: 600; }
.sidebar .nav-section { color: #7e8aa6; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em;
                        margin: 1.1rem .75rem .35rem; }
.badge { display: inline-block; min-width: 1.4em; padding: 0 .4em; border-radius: 999px; background: var(--danger);
         color: #fff; font-size: .75rem; text-align: center; }

main { max-width: 1280px; margin: 0 auto; padding: 1.25rem; }
body.has-shell main { margin: 0 0 0 var(--sidebar-w); max-width: none; padding: calc(var(--banner-h) + 1.25rem) 1.5rem 2rem; }

@media (max-width: 900px) {
  .banner { padding: 0 1rem; }
  .banner .who { display: none; }
  .banner .brand .name { font-size: 1rem; }
  .banner .brand small { display: none; }
  .lang-switch span { display: none; }
  .card { overflow-x: auto; }
  .sidebar { position: fixed; top: var(--banner-h); bottom: auto; right: 0; width: auto; padding: .4rem .5rem; }
  .sidebar nav { flex-direction: row; overflow-x: auto; white-space: nowrap; }
  .sidebar .nav-section { display: none; }
  body.has-shell main { margin-left: 0; padding-top: calc(var(--banner-h) + 3.6rem); }
}
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem;
        margin-bottom: 1rem; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: 2fr 1fr; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; }
.stat .n { font-size: 1.5rem; font-weight: 600; }
.stat .l { color: var(--muted); font-size: .8rem; }
.stat.alert .n { color: var(--danger); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: .8rem; }
tr.overdue td { background: #fff1f0; }
td.num, th.num { text-align: right; white-space: nowrap; }

.status { display: inline-block; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; background: var(--chip);
          white-space: nowrap; }
.status.draft { background: #eef2f6; }
.status.legal_review, .status.management_approval { background: #e0ecfb; color: #184c87; }
.status.revision { background: #fef0c7; color: #93370d; }
.status.approved, .status.signed { background: #dcfae6; color: #085d3a; }
.status.cancelled, .status.expired { background: #f2f4f7; color: #667085; text-decoration: line-through; }
.chip { display: inline-block; padding: 0 .45rem; border-radius: 4px; background: var(--chip); font-size: .78rem; }
.chip.warn { background: #fef0c7; color: #93370d; }
.chip.lock { background: #e0ecfb; color: #184c87; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.danger { color: var(--danger); }

form p { margin: 0 0 .75rem; }
label { display: block; font-weight: 500; margin-bottom: .2rem; }
input[type=text], input[type=number], input[type=date], input[type=email], input[type=password], select, textarea {
  width: 100%; max-width: 520px; padding: .4rem .55rem; border: 1px solid var(--border); border-radius: 6px;
  font: inherit; background: #fff;
}
input[type=checkbox] { margin-right: .4rem; }
input.confidential { background: #fffaeb; }
.helptext, .help { display: block; color: var(--muted); font-size: .8rem; }
.errorlist { color: var(--danger); margin: .2rem 0; padding-left: 1rem; font-size: .85rem; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: .25rem 1.25rem; }
.inline-form { display: flex; gap: .5rem; align-items: end; flex-wrap: wrap; }
.inline-form p { margin: 0; }

.btn { display: inline-block; padding: .42rem .9rem; border-radius: 6px; border: 1px solid var(--border);
       background: #fff; color: var(--text); font: inherit; cursor: pointer; text-decoration: none; }
.btn:hover { background: #f2f4f7; text-decoration: none; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-hover); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.small { padding: .2rem .55rem; font-size: .82rem; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .6rem .9rem; border-radius: 6px; margin-bottom: .4rem; background: #e0ecfb; }
.messages li.success { background: #dcfae6; }
.messages li.warning { background: #fef0c7; }
.messages li.error { background: #fee4e2; }

.notice { padding: .6rem .9rem; border-radius: 6px; background: #fef0c7; margin-bottom: 1rem; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .25rem 1rem; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: .4rem 0 .4rem 1rem; border-left: 3px solid var(--border); margin-left: .3rem; }
.timeline li.pending { border-color: var(--primary); }
.timeline li.approved, .timeline li.auto { border-color: var(--ok); }
.timeline li.revision { border-color: var(--warn); }

.comment { border-bottom: 1px solid var(--border); padding: .5rem 0; }
.comment .meta { color: var(--muted); font-size: .8rem; }
.comment .body { white-space: pre-wrap; }

.diff td { font-family: Georgia, "Times New Roman", serif; font-size: .95rem; line-height: 1.55; }
.diff tr.equal td { color: #475467; }
.diff tr.changed td, .diff tr.inserted td, .diff tr.deleted td { background: #fffdf5; }
.diff ins { background: var(--ins-bg); text-decoration: none; }
.diff del { background: var(--del-bg); color: #912018; }
.diff.only-changes tr.equal { display: none; }
.diff th { font-family: inherit; }

details summary { cursor: pointer; color: var(--primary); }
.pagination { margin-top: .75rem; display: flex; gap: .5rem; align-items: center; }
.login { max-width: 380px; margin: 8vh auto; }

/* ---- Dashboard görselleri ---- */
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .75rem; }
.card-head h2 { margin: 0; }

.pipeline { display: flex; gap: 4px; }
.pipeline .stage {
  flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: .1rem;
  padding: .7rem 1.4rem .7rem 1.5rem; color: var(--brand-dark); text-decoration: none;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%, 14px 50%);
  transition: filter .15s;
}
.pipeline .stage:first-child { clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 0 100%);
                               border-radius: 6px 0 0 6px; padding-left: 1rem; }
.pipeline .stage:last-child { clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%, 14px 50%); border-radius: 0 6px 6px 0; }
.pipeline .stage:hover { filter: brightness(.95); text-decoration: none; }
.pipeline .stage.empty { opacity: .55; }
.stage-label { font-size: .78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-n { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stage-eur { font-size: .74rem; color: rgba(19, 27, 44, .7); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-draft { background: #eef1f6; }
.stage-revision { background: #fdecc8; }
.stage-legal { background: #dce6fe; }
.stage-management { background: #c3d2fd; }
.stage-approved { background: #d3f4e0; }

.admin-top { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 1rem; margin-bottom: 1rem; }
.admin-top .card { margin: 0; }
.admin-top .stats { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.ring-wrap { display: flex; align-items: center; gap: 1rem; }
.ring-bg { fill: none; stroke: var(--chip); stroke-width: 10; }
.ring-fg { fill: none; stroke-width: 10; stroke-linecap: round; }
.ring-fg.ok { stroke: #12a150; }
.ring-fg.warn { stroke: #f0a020; }
.ring-fg.late { stroke: var(--danger); }
.ring-pct { font-size: 20px; font-weight: 700; text-anchor: middle; fill: var(--brand-dark); }
.ring-sub { font-size: 9px; text-anchor: middle; fill: var(--muted); }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; margin-right: .35rem; }
.dot.ok { background: #12a150; }
.dot.late { background: var(--danger); }

@media (max-width: 900px) {
  .pipeline { flex-direction: column; gap: 3px; }
  .pipeline .stage, .pipeline .stage:first-child, .pipeline .stage:last-child { clip-path: none; border-radius: 6px;
    flex-direction: row; align-items: baseline; gap: .6rem; padding: .5rem .8rem; }
  .stage-n { font-size: 1.2rem; order: -1; }
  .admin-top { grid-template-columns: 1fr; }
}

/* ---- İkonlu sayaçlar ---- */
.icon { width: 1em; height: 1em; display: block; }
.stat-icon { display: flex; align-items: center; justify-content: space-between; gap: .6rem; color: inherit;
             text-decoration: none; }
a.stat-icon:hover { border-color: #b9c3d6; text-decoration: none; }
.stat-icon .n { color: var(--brand-dark); }
.ic { flex: none; width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center;
      justify-content: center; font-size: 24px; }
.tone-draft .ic, .ic.tone-draft { background: #eef1f6; color: #3d4659; }
.tone-revision .ic, .ic.tone-revision { background: #fdecc8; color: #8a5300; }
.tone-legal .ic, .ic.tone-legal { background: #dce6fe; color: #2747cc; }
.tone-management .ic, .ic.tone-management { background: #c3d2fd; color: #1c35a0; }
.tone-approved .ic, .ic.tone-approved { background: #d3f4e0; color: #0d7a3d; }
.tone-muted .ic, .ic.tone-muted { background: #f0f1f4; color: #5f6b7a; }
.tone-late .ic, .ic.tone-late { background: #fee4e2; color: var(--danger); }
.stat.alert { border-color: #f5b8b2; }
.stat.alert .n { color: var(--danger); }

/* ---- Legal göstergeleri ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .85rem 1rem; }
.kpi-alert { border-color: #f5b8b2; }
.kpi-head { display: flex; justify-content: space-between; align-items: center; color: var(--muted); font-size: .82rem;
            margin-bottom: .2rem; }
.kpi-head .ic { width: 34px; height: 34px; font-size: 19px; border-radius: 8px; }
.kpi-n { font-size: 1.6rem; font-weight: 600; color: var(--brand-dark); line-height: 1.2; }
.kpi-n.danger { color: var(--danger); }
.kpi-n small { font-size: .78rem; font-weight: 400; color: var(--muted); }
.kpi-n small.up { color: #0d7a3d; }
.kpi-n small.down { color: #8a5300; }
.kpi-sub { font-size: .8rem; color: var(--muted); margin-top: .2rem; }
.seg { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; margin: .6rem 0 .45rem; }
.seg .fresh, .dot.fresh { background: var(--brand-blue); }
.seg .aging, .dot.aging { background: #8da4f8; }
.seg .late, .dot.late { background: var(--danger); }
.seg .none { background: var(--chip); }
.legend { display: flex; flex-wrap: wrap; gap: .3rem .8rem; font-size: .75rem; color: var(--muted); }
.legend .dot { display: inline-block; width: .55rem; height: .55rem; margin-right: .3rem; border-radius: 50%; }
.spark { display: block; width: 100%; height: 34px; margin-top: .5rem; }
.spark rect { fill: #9fdcb8; }
.spark rect.cur { fill: #0d7a3d; }
.target { position: relative; height: 10px; border-radius: 5px; background: var(--chip); margin: .75rem 0 .35rem; }
.target .fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; }
.target .fill.ok { background: #12a150; }
.target .fill.warn { background: #f0a020; }
.target .fill.late { background: var(--danger); }
.target .goal { position: absolute; right: -1px; top: -4px; width: 2px; height: 18px; background: #5f6b7a; }
