/* ===================== Temel ===================== */
:root {
  --bg:        #f4f6f9;
  --surface:   #ffffff;
  --border:    #dfe4ec;
  --text:      #1a2233;
  --text-soft: #64708a;
  --text-mute: #8a94a8;

  --primary:      #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff4ff;

  /* İnoksan kurumsal renkleri (logo.svg) */
  --brand-red:  #ed1c24;
  --brand-dark: #231f20;

  --green:      #16a34a;
  --green-soft: #e8f6ed;
  --yellow:     #d97706;
  --yellow-soft:#fdf3e3;
  --red:        #dc2626;
  --red-soft:   #fdeded;
  --gray-soft:  #f1f3f7;

  --radius: 8px;
  --shadow: 0 1px 3px rgba(20,30,60,.08), 0 1px 2px rgba(20,30,60,.04);
  --shadow-lg: 0 10px 30px rgba(20,30,60,.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }

a { color: var(--primary); }

/* ===================== Giris ===================== */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  /* Logonun koyu grisinden kurumsal kirmiziya gecis */
  background: linear-gradient(135deg, var(--brand-dark) 0%, #3a3234 55%, #8f1519 100%);
  padding: 1rem;
}
.login-card {
  background: var(--surface);
  padding: 2.5rem 2.25rem;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 380px;
}
.login-logo {
  display: block; width: 190px; max-width: 70%;
  height: auto; margin: 0 auto 1.5rem;
}
.login-card h1 { text-align: center; font-size: 1.3rem; margin-bottom: .15rem; }
.login-sub {
  text-align: center; color: var(--text-mute);
  margin: 0 0 1.75rem; font-size: .85rem;
}
.login-card label {
  display: block; margin-bottom: .35rem;
  font-size: .8rem; font-weight: 600; color: var(--text-soft);
}
.login-card input {
  width: 100%; padding: .65rem .75rem; margin-bottom: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: .95rem; font-family: inherit;
}
.login-card input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

/* ===================== Ust bar ===================== */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  border-top: 3px solid var(--brand-red);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.25rem; height: 56px;
  position: sticky; top: 0; z-index: 40;
}
.topbar-left  { display: flex; align-items: center; gap: 1.5rem; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: .6rem; }

.brand {
  display: flex; align-items: center; gap: .7rem;
  text-decoration: none; color: var(--text); white-space: nowrap;
}
.brand-logo { height: 22px; width: auto; display: block; }
.brand-sep { width: 1px; height: 20px; background: var(--border); }
.brand-text { font-weight: 600; font-size: .95rem; letter-spacing: -.01em; }

.mainnav { display: flex; gap: .25rem; overflow-x: auto; }
.mainnav button {
  background: none; border: none; cursor: pointer;
  padding: .5rem .8rem; border-radius: var(--radius);
  font: inherit; font-size: .875rem; color: var(--text-soft);
  white-space: nowrap; position: relative;
}
.mainnav button:hover { background: var(--gray-soft); color: var(--text); }
.mainnav button.active { background: var(--primary-soft); color: var(--primary-dark); font-weight: 600; }
.nav-badge {
  display: inline-block; min-width: 18px; padding: 0 5px;
  margin-left: .35rem; border-radius: 9px;
  background: var(--red); color: #fff;
  font-size: .7rem; font-weight: 700; line-height: 18px; text-align: center;
}

.year-select {
  padding: .35rem .5rem; border: 1px solid var(--border);
  border-radius: var(--radius); font: inherit; font-size: .85rem;
  background: var(--surface); cursor: pointer;
}
.user-chip { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.2; }
.user-chip #user-name { font-weight: 600; font-size: .85rem; }
.user-role { font-size: .7rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: .3px; }

/* ===================== Yerlesim ===================== */
.view { padding: 1.5rem; max-width: 1600px; margin: 0 auto; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap;
}
.page-head p { margin: .15rem 0 0; color: var(--text-mute); font-size: .85rem; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
}
.card-head {
  padding: .85rem 1.1rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.card-head h2, .card-head h3 { margin: 0; }
.card-body { padding: 1.1rem; }
.card-body.tight { padding: 0; }

/* ===================== Ozet kartlari ===================== */
.stat-grid {
  display: grid; gap: 1rem; margin-bottom: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
}
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .9rem 1rem;
  box-shadow: var(--shadow); border-left: 4px solid var(--border);
}
.stat.green  { border-left-color: var(--green); }
.stat.yellow { border-left-color: var(--yellow); }
.stat.red    { border-left-color: var(--red); }
.stat.blue   { border-left-color: var(--primary); }
.stat.gray   { border-left-color: var(--text-mute); }

.stat-label { font-size: .75rem; color: var(--text-mute); text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; margin-top: .2rem; }
.stat-hint  { font-size: .75rem; color: var(--text-mute); margin-top: .1rem; }
.stat.clickable { cursor: pointer; transition: transform .12s, box-shadow .12s; }
.stat.clickable:hover { transform: translateY(-1px); box-shadow: var(--shadow-lg); }

/* ===================== Tablolar ===================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  background: #fafbfd; text-align: left; font-weight: 600;
  color: var(--text-soft); font-size: .75rem;
  text-transform: uppercase; letter-spacing: .3px;
  padding: .6rem .7rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 2; white-space: nowrap;
}
tbody td { padding: .6rem .7rem; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
tbody tr:hover { background: #fafbfd; }
tbody tr.clickable { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }

.kpi-name { font-weight: 500; max-width: 380px; }
.kpi-meta { font-size: .75rem; color: var(--text-mute); margin-top: .1rem; }

/* Tablodan dogrudan duzenlenebilen alanlar (yalnizca yonetici) */
.editable {
  cursor: pointer; border-radius: 3px; padding: 1px 3px; margin: -1px -3px;
  border-bottom: 1px dashed transparent; transition: background .12s, border-color .12s;
}
.editable:hover {
  background: var(--primary-soft); border-bottom-color: var(--primary);
  color: var(--primary-dark);
}
.editable:hover::after {
  content: ' ✎'; font-size: .7rem; opacity: .8;
}

/* ===================== Rozetler ===================== */
.badge {
  display: inline-block; padding: .15rem .5rem; border-radius: 20px;
  font-size: .72rem; font-weight: 600; white-space: nowrap;
}
.badge.green  { background: var(--green-soft);  color: var(--green); }
.badge.yellow { background: var(--yellow-soft); color: var(--yellow); }
.badge.red    { background: var(--red-soft);    color: var(--red); }
.badge.blue   { background: var(--primary-soft);color: var(--primary-dark); }
.badge.gray   { background: var(--gray-soft);   color: var(--text-soft); }

.dot {
  display: inline-block; width: 9px; height: 9px;
  border-radius: 50%; margin-right: .4rem; vertical-align: baseline;
}
.dot.green  { background: var(--green); }
.dot.yellow { background: var(--yellow); }
.dot.red    { background: var(--red); }
.dot.none   { background: #cbd2df; }

/* Aylik durum seridi */
.period-strip { display: flex; gap: 3px; }
.period-strip.with-values { gap: 2px; align-items: flex-start; }

/* Deger gosterimli sutun: ustte donem kutusu, altta gerceklesen */
.period-col {
  display: flex; flex-direction: column; align-items: center;
  gap: 2px; cursor: pointer; border-radius: 4px; padding: 1px;
}
.period-col:hover { background: var(--primary-soft); }
.period-col:hover .period-cell { border-color: var(--primary); }

.period-val {
  font-size: .62rem; font-variant-numeric: tabular-nums;
  line-height: 1.1; text-align: center; min-width: 24px;
  color: var(--text-soft); white-space: nowrap;
}
.period-val.green  { color: var(--green);  font-weight: 600; }
.period-val.yellow { color: var(--yellow); font-weight: 600; }
.period-val.red    { color: var(--red);    font-weight: 600; }
.period-val-empty  { color: #cbd2df; }

/* Genisleyen donem detayi */
tr.kpi-row.expanded { background: var(--primary-soft); }
tr.kpi-row .expand-caret {
  display: inline-block; transition: transform .15s;
  color: var(--text-mute); font-size: .7rem;
}
tr.kpi-row.expanded .expand-caret { transform: rotate(90deg); color: var(--primary); }

tr.detail-row > td { padding: 0; background: #fbfcfe; border-bottom: 1px solid var(--border); }
.detail-panel { padding: .9rem 1.1rem 1rem 2.6rem; }
.detail-panel h4 {
  margin: 0 0 .6rem; font-size: .8rem; color: var(--text-soft);
  text-transform: uppercase; letter-spacing: .3px;
}
.detail-grid {
  display: grid; gap: .45rem;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
}
.detail-cell {
  border: 1px solid var(--border); border-left-width: 3px;
  border-radius: var(--radius); padding: .4rem .55rem;
  background: var(--surface); cursor: pointer; transition: box-shadow .12s;
}
.detail-cell:hover { box-shadow: var(--shadow); border-color: var(--primary); }
.detail-cell.green  { border-left-color: var(--green); }
.detail-cell.yellow { border-left-color: var(--yellow); }
.detail-cell.red    { border-left-color: var(--red); }
.detail-cell.none   { border-left-color: #cbd2df; }
.detail-cell .dc-label {
  font-size: .68rem; color: var(--text-mute); text-transform: uppercase;
  letter-spacing: .3px; margin-bottom: .1rem;
}
.detail-cell .dc-value {
  font-size: .95rem; font-weight: 600; font-variant-numeric: tabular-nums;
}
.detail-cell.none .dc-value { color: var(--text-mute); font-weight: 400; font-size: .8rem; }
.detail-cell .dc-meta { font-size: .66rem; color: var(--text-mute); margin-top: .15rem; }
.detail-cell .dc-warn { color: var(--red); font-weight: 600; }
.period-cell {
  width: 22px; height: 22px; border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  font-size: .65rem; font-weight: 600;
  background: var(--gray-soft); color: var(--text-mute);
  cursor: pointer; border: 1px solid transparent; position: relative;
}
.period-cell:hover { border-color: var(--primary); }
.period-cell.green  { background: var(--green-soft);  color: var(--green); }
.period-cell.yellow { background: var(--yellow-soft); color: var(--yellow); }
.period-cell.red    { background: var(--red-soft);    color: var(--red); }
.period-cell.warn::after {
  content: ''; position: absolute; top: -2px; right: -2px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--red); border: 1.5px solid var(--surface);
}

/* Ilerleme cubugu */
.bar { height: 6px; background: var(--gray-soft); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; border-radius: 3px; background: var(--primary); }
.bar.green > span  { background: var(--green); }
.bar.yellow > span { background: var(--yellow); }
.bar.red > span    { background: var(--red); }

/* ===================== Butonlar ===================== */
.btn {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .5rem .9rem; border-radius: var(--radius);
  border: 1px solid transparent; cursor: pointer;
  font: inherit; font-size: .85rem; font-weight: 500;
  white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-default { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-default:hover:not(:disabled) { background: var(--gray-soft); }
.btn-ghost { background: none; color: var(--text-soft); }
.btn-ghost:hover:not(:disabled) { background: var(--gray-soft); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover:not(:disabled) { background: #15803d; }
.btn-sm { padding: .3rem .6rem; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; padding: .65rem; }

/* ===================== Formlar ===================== */
.form-row { margin-bottom: 1rem; }
.form-row label {
  display: block; margin-bottom: .3rem;
  font-size: .8rem; font-weight: 600; color: var(--text-soft);
}
.form-row .req { color: var(--red); }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: .55rem .7rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: .875rem; background: var(--surface); color: var(--text);
}
.form-row textarea { min-height: 84px; resize: vertical; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.form-row .hint { font-size: .75rem; color: var(--text-mute); margin-top: .25rem; }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: 1fr 1fr; }
.form-grid .full { grid-column: 1 / -1; }

.form-error {
  background: var(--red-soft); color: var(--red);
  padding: .6rem .8rem; border-radius: var(--radius);
  font-size: .82rem; margin-bottom: 1rem;
  border-left: 3px solid var(--red);
}

/* Filtre cubugu */
.filters {
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: center;
  margin-bottom: 1rem;
}
.filters input, .filters select {
  padding: .45rem .65rem; border: 1px solid var(--border);
  border-radius: var(--radius); font: inherit; font-size: .85rem;
  background: var(--surface);
}
.filters input[type=search] { min-width: 240px; }

/* ===================== Modal ===================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 3rem 1rem; z-index: 100; overflow-y: auto;
}
.modal {
  background: var(--surface); border-radius: 12px;
  box-shadow: var(--shadow-lg);
  width: 100%; max-width: 620px; margin: auto 0;
}
.modal.wide { max-width: 960px; }
.modal-head {
  padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
}
.modal-head h2 { margin: 0; font-size: 1.05rem; }
.modal-head .sub { font-size: .8rem; color: var(--text-mute); margin-top: .2rem; }
.modal-close {
  background: none; border: none; font-size: 1.5rem; line-height: 1;
  cursor: pointer; color: var(--text-mute); padding: 0 .25rem;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.35rem; }
.modal-foot {
  padding: .9rem 1.35rem; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: .6rem;
  background: #fbfcfe; border-radius: 0 0 12px 12px;
}

/* ===================== Uyari kutulari ===================== */
.alert {
  padding: .8rem 1rem; border-radius: var(--radius);
  font-size: .85rem; margin-bottom: 1rem; border-left: 3px solid;
}
.alert-red    { background: var(--red-soft);    border-color: var(--red);    color: #991b1b; }
.alert-yellow { background: var(--yellow-soft); border-color: var(--yellow); color: #92400e; }
.alert-green  { background: var(--green-soft);  border-color: var(--green);  color: #14532d; }
.alert-blue   { background: var(--primary-soft);border-color: var(--primary);color: #1e3a8a; }
.alert strong { display: block; margin-bottom: .2rem; }

/* ===================== Aksiyon / dosya ===================== */
.action-box {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: .9rem 1rem; margin-bottom: .8rem; background: #fbfcfe;
}
.action-box.overdue { border-left: 3px solid var(--red); }
.action-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 1rem; margin-bottom: .5rem;
}
.action-field { margin-bottom: .5rem; }
.action-field .lbl {
  font-size: .72rem; font-weight: 600; color: var(--text-mute);
  text-transform: uppercase; letter-spacing: .3px;
}
.action-field .val { white-space: pre-wrap; }

.file-list { list-style: none; padding: 0; margin: .5rem 0 0; }
.file-list li {
  display: flex; align-items: center; gap: .5rem;
  padding: .4rem .6rem; border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: .35rem;
  background: var(--surface); font-size: .82rem;
}
.file-list .fname { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .fsize { color: var(--text-mute); font-size: .75rem; }

.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 1.5rem; text-align: center; color: var(--text-mute);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark);
}

/* ===================== Bildirim ===================== */
.toast-wrap {
  position: fixed; bottom: 1.25rem; right: 1.25rem;
  display: flex; flex-direction: column; gap: .5rem; z-index: 200;
}
.toast {
  background: #1f2937; color: #fff;
  padding: .7rem 1rem; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: .85rem;
  max-width: 380px; animation: slidein .2s ease-out;
  border-left: 3px solid var(--primary);
}
.toast.success { border-left-color: var(--green); }
.toast.error   { border-left-color: var(--red); }
.toast.warn    { border-left-color: var(--yellow); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: none; } }

/* ===================== Yardimcilar ===================== */
.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--text-mute);
}
.empty .icon { font-size: 2rem; display: block; margin-bottom: .5rem; opacity: .6; }
.loading { text-align: center; padding: 2.5rem; color: var(--text-mute); }
.text-mute { color: var(--text-mute); }
.text-soft { color: var(--text-soft); }
.text-sm { font-size: .8rem; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.mt-1 { margin-top: .5rem; } .mt-2 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; } .flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-1 { gap: .5rem; } .gap-2 { gap: 1rem; }
.nowrap { white-space: nowrap; }

@media (max-width: 900px) {
  .view { padding: 1rem; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { height: auto; flex-wrap: wrap; padding: .6rem 1rem; gap: .5rem; }
  .topbar-left { width: 100%; }
  .user-chip { display: none; }
}
