/* Ensa Deri — arayüz */

:root {
  --bg:            #f4f5f7;
  --surface:       #ffffff;
  --surface-2:     #fafafa;
  --border:        #e3e5e9;
  --border-strong: #cbd0d8;
  --text:          #14171c;
  --text-2:        #5b6472;
  --text-3:        #8b93a1;
  --accent:        #0f5c63;
  --accent-soft:   #e4f1f1;
  --accent-text:   #0b464b;
  --pos:           #0b7a45;
  --pos-soft:      #e3f5eb;
  --neg:           #b3261e;
  --neg-soft:      #fdeceb;
  --warn:          #8a5a00;
  --warn-soft:     #fdf3de;
  --radius:        9px;
  --radius-sm:     6px;
  --shadow:        0 1px 2px rgba(16,20,28,.05), 0 1px 3px rgba(16,20,28,.04);
  --shadow-lg:     0 8px 28px rgba(16,20,28,.13);
  --side-w:        228px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "Segoe UI Mono", Menlo, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #121417;
    --surface:       #1a1d21;
    --surface-2:     #202429;
    --border:        #2b2f36;
    --border-strong: #3d434c;
    --text:          #e8eaed;
    --text-2:        #a5adba;
    --text-3:        #7b8493;
    --accent:        #4ec3cc;
    --accent-soft:   #0f3033;
    --accent-text:   #7fd8df;
    --pos:           #4ade80;
    --pos-soft:      #10281a;
    --neg:           #f87171;
    --neg-soft:      #2b1414;
    --warn:          #fbbf24;
    --warn-soft:     #2c2110;
    --shadow:        0 1px 2px rgba(0,0,0,.4);
    --shadow-lg:     0 8px 28px rgba(0,0,0,.5);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem; border-radius: 0 0 var(--radius) 0;
}
.skip:focus { left: 0; }

/* ------------------------------------------------------------------ iskelet */

.shell { display: flex; min-height: 100vh; }

.side {
  width: var(--side-w);
  flex: 0 0 var(--side-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 30;
}

.side__brand {
  display: flex; align-items: center; gap: .6rem;
  padding: 1rem 1rem .9rem;
  border-bottom: 1px solid var(--border);
}
.side__mark {
  width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
  flex: 0 0 auto;
}
@media (prefers-color-scheme: dark) { .side__mark { color: #0b1416; } }
.side__name { font-weight: 650; letter-spacing: -.01em; font-size: 14.5px; }

.nav { flex: 1; overflow-y: auto; padding: .6rem .5rem 1rem; }

.nav__group {
  font-size: 10.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--text-3);
  padding: .9rem .6rem .35rem;
}
.nav__group:first-child { padding-top: .3rem; }

.nav__item {
  display: flex; align-items: center; gap: .6rem;
  padding: .46rem .6rem;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-weight: 500;
  line-height: 1.3;
}
.nav__item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav__item svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: .8; }
.nav__item.is-active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
.nav__item.is-active svg { opacity: 1; }

.side__foot { border-top: 1px solid var(--border); padding: .75rem 1rem; }
.side__rate { display: flex; justify-content: space-between; align-items: baseline; font-size: 12.5px; }
.side__rate span { color: var(--text-3); }
.side__rate strong { font-variant-numeric: tabular-nums; }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.top {
  display: flex; align-items: center; gap: .8rem;
  padding: 0 1.25rem;
  height: 54px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.top__burger {
  display: none; background: none; border: 0; color: var(--text-2); cursor: pointer; padding: .3rem;
}
.top__burger svg { width: 21px; height: 21px; }
.top__title { font-size: 16px; font-weight: 650; margin: 0; letter-spacing: -.015em; }
.top__spacer { flex: 1; }

.top__search { position: relative; display: flex; align-items: center; }
.top__search svg {
  position: absolute; left: .55rem; width: 15px; height: 15px; color: var(--text-3); pointer-events: none;
}
.top__search input {
  width: 190px; padding: .38rem .6rem .38rem 1.9rem;
  border: 1px solid var(--border); border-radius: 7px;
  background: var(--surface-2); color: var(--text); font-size: 13px;
}
.top__search input:focus { outline: 2px solid var(--accent); outline-offset: -1px; width: 240px; }
.top__search input { transition: width .15s ease; }

.top__user { display: flex; align-items: center; gap: .6rem; }
.top__name { font-size: 13px; color: var(--text-2); font-weight: 500; }

.main { padding: 1.25rem; flex: 1; max-width: 1500px; width: 100%; }

.nav-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 25;
}

@media (max-width: 900px) {
  .side {
    position: fixed; left: 0; top: 0; transform: translateX(-100%);
    transition: transform .18s ease; box-shadow: var(--shadow-lg);
  }
  body.nav-open .side { transform: none; }
  .top__burger { display: block; }
  .top__search input { width: 130px; }
  .top__search input:focus { width: 160px; }
  .main { padding: 1rem .8rem; }
}
@media (max-width: 560px) {
  .top__search { display: none; }
  .top__name { display: none; }
}

/* ------------------------------------------------------------------ parçalar */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card__head {
  display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
}
.card__title { font-size: 14px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
.card__sub { font-size: 12.5px; color: var(--text-3); }
.card__body { padding: 1rem; }
.card__body--flush { padding: 0; }
.card__foot {
  padding: .65rem 1rem; border-top: 1px solid var(--border);
  background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius);
  font-size: 12.5px; color: var(--text-2);
}
.spacer { flex: 1; }

/* istatistik kutuları */
.stats { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 1rem; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .8rem .9rem; box-shadow: var(--shadow);
}
.stat__label { font-size: 11.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; color: var(--text-3); }
.stat__value { font-size: 22px; font-weight: 650; letter-spacing: -.02em; margin-top: .25rem; font-variant-numeric: tabular-nums; }
.stat__value small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: .15rem; }
.stat__meta { font-size: 12px; color: var(--text-3); margin-top: .2rem; }
.stat--pos .stat__value { color: var(--pos); }
.stat--neg .stat__value { color: var(--neg); }
.stat--accent .stat__value { color: var(--accent-text); }

/* tablolar */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: .5rem .7rem; text-align: left; border-bottom: 1px solid var(--border); }
.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2);
  font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--text-3); white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .num--strong { font-weight: 650; }
.tbl .date { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tbl .shrink { width: 1%; white-space: nowrap; }
.tbl tfoot td { font-weight: 650; background: var(--surface-2); border-top: 2px solid var(--border-strong); }
.tbl--dense th, .tbl--dense td { padding: .35rem .6rem; }
.tbl .row-muted td { color: var(--text-3); }
.tbl .row-flag { box-shadow: inset 3px 0 0 var(--warn); }

.pos { color: var(--pos); }
.neg { color: var(--neg); }
.mut { color: var(--text-3); }

/* rozetler */
.badge {
  display: inline-block; padding: .1rem .42rem; border-radius: 5px;
  font-size: 11px; font-weight: 650; letter-spacing: .01em;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.badge--pos  { background: var(--pos-soft);  color: var(--pos);  border-color: transparent; }
.badge--neg  { background: var(--neg-soft);  color: var(--neg);  border-color: transparent; }
.badge--warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge--info { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

/* butonlar */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .42rem .8rem; border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 550; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn svg { width: 15px; height: 15px; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-text); border-color: var(--accent-text); color: #fff; }
@media (prefers-color-scheme: dark) {
  .btn--primary { color: #08181a; }
  .btn--primary:hover { color: #08181a; }
}
.btn--ghost { border-color: transparent; background: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--danger { color: var(--neg); border-color: var(--border); }
.btn--danger:hover { background: var(--neg-soft); border-color: var(--neg); }
.btn--sm { padding: .25rem .55rem; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* form */
.field { display: flex; flex-direction: column; gap: .28rem; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: var(--text-2); }
.field small { font-size: 11.5px; color: var(--text-3); }

input[type=text], input[type=search], input[type=password], input[type=number],
input[type=date], select, textarea {
  padding: .42rem .55rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit; font-size: 13px;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
input[type=number], .inp-num { text-align: right; font-variant-numeric: tabular-nums; }
textarea { resize: vertical; min-height: 60px; }

.form-grid { display: grid; gap: .7rem; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.form-bar {
  display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end;
}
.form-bar .field { flex: 1 1 130px; }
.form-bar .field--wide { flex: 3 1 220px; }
.form-bar .field--narrow { flex: 0 1 110px; }

/* satır içi ekleme formu */
.tbl .inline-form td { background: var(--accent-soft); }
@media (prefers-color-scheme: dark) { .tbl .inline-form td { background: var(--surface-2); } }
.tbl .inline-form input, .tbl .inline-form select { padding: .3rem .4rem; font-size: 12.5px; }

/* uyarı kutuları */
.alert {
  padding: .6rem .85rem; border-radius: var(--radius); margin-bottom: 1rem;
  font-size: 13px; border: 1px solid transparent;
}
.alert--success { background: var(--pos-soft); color: var(--pos); }
.alert--error   { background: var(--neg-soft); color: var(--neg); }
.alert--warning { background: var(--warn-soft); color: var(--warn); }
.alert--info    { background: var(--accent-soft); color: var(--accent-text); }

.empty { padding: 2.5rem 1rem; text-align: center; color: var(--text-3); }
.empty strong { display: block; color: var(--text-2); font-size: 14px; margin-bottom: .25rem; }

/* sekmeler */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); padding: 0 1rem; }
.tabs a {
  padding: .55rem .8rem; font-size: 13px; font-weight: 600; color: var(--text-2);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.is-active { color: var(--accent-text); border-bottom-color: var(--accent); }

/* filtre çubuğu */
.filters {
  display: flex; gap: .5rem; flex-wrap: wrap; align-items: center;
  padding: .7rem 1rem; border-bottom: 1px solid var(--border); background: var(--surface-2);
  border-radius: var(--radius) var(--radius) 0 0;
}
.filters input, .filters select { width: auto; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .25rem .6rem; border-radius: 20px; font-size: 12.5px; font-weight: 550;
  border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface);
}
.chip:hover { text-decoration: none; background: var(--surface-2); }
.chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) { .chip.is-active { color: #08181a; } }

/* sayfalama */
.pagination { display: flex; gap: .3rem; align-items: center; justify-content: center; padding: .8rem; flex-wrap: wrap; }
.pagination a, .pagination span {
  min-width: 30px; padding: .25rem .5rem; text-align: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 12.5px; color: var(--text-2);
}
.pagination a:hover { background: var(--surface-2); text-decoration: none; }
.pagination .is-active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 650; }
@media (prefers-color-scheme: dark) { .pagination .is-active { color: #08181a; } }

/* giriş ekranı */
.is-bare { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.login { width: 100%; max-width: 360px; }
.login__brand { text-align: center; margin-bottom: 1.5rem; }
.login__mark {
  width: 46px; height: 46px; border-radius: 12px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 22px; font-weight: 700; margin: 0 auto .6rem;
}
.login__title { font-size: 18px; font-weight: 650; margin: 0; letter-spacing: -.02em; }
.login__sub { font-size: 13px; color: var(--text-3); margin-top: .2rem; }
.login .card__body { display: grid; gap: .85rem; }

/* ayrıntı başlığı */
.page-head {
  display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem;
}
.page-head__main { min-width: 0; }
.page-head h2 { font-size: 19px; font-weight: 650; margin: 0 0 .2rem; letter-spacing: -.02em; }
.page-head__meta { font-size: 12.5px; color: var(--text-3); display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: .3rem 1rem; font-size: 13px; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

/* iki sütun düzeni */
.cols { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }
.cols--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 820px) { .cols--2 { grid-template-columns: 1fr; } }

/* mini çubuk grafik */
.bars { display: flex; align-items: flex-end; gap: 3px; height: 52px; }
.bars__b { flex: 1; background: var(--accent-soft); border-radius: 2px 2px 0 0; min-height: 2px; position: relative; }
.bars__b[data-neg] { background: var(--neg-soft); }

details.help { font-size: 12.5px; color: var(--text-2); margin-top: .5rem; }
details.help summary { cursor: pointer; color: var(--text-3); }

/* düzenleme penceresi (satır başına form yerine tek paylaşımlı pencere) */
dialog.modal {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
  padding: 0;
  width: min(520px, 94vw);
  max-height: 88vh;
}
dialog.modal::backdrop { background: rgba(10,14,20,.45); }
dialog.modal .card__head { border-radius: var(--radius) var(--radius) 0 0; }
dialog.modal .card__body { max-height: 62vh; overflow-y: auto; }
dialog.modal .modal__foot {
  display: flex; gap: .5rem; align-items: center;
  padding: .7rem 1rem; border-top: 1px solid var(--border); background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}
.modal__close {
  background: none; border: 0; color: var(--text-3); font-size: 20px; line-height: 1;
  cursor: pointer; padding: .1rem .35rem; border-radius: var(--radius-sm);
}
.modal__close:hover { background: var(--surface-2); color: var(--text); }

@media print {
  .side, .top, .filters, .btn, .pagination { display: none !important; }
  .main { padding: 0; }
  .card { border: 0; box-shadow: none; }
}
