/* =====================================================================
   OSEM Hukuk ERP — Tasarım Sistemi
   Siyah topbar, beyaz kartlar, amber vurgu; Inter + IBM Plex Mono.
   ===================================================================== */
:root {
  --bg: #f4f4f5;
  --surface: #ffffff;
  --ink: #18181b;
  --ink-soft: #52525b;
  --ink-faint: #a1a1aa;
  --line: #e4e4e7;
  --black: #0a0a0a;
  --amber: #f59e0b;
  --amber-dark: #b45309;
  --green: #16a34a;
  --red: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 1px 3px rgba(0, 0, 0, .08);
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
/* hidden özniteliği, display kuralı olan elemanlarda da her zaman gizlesin */
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* ----------------------------- Butonlar ----------------------------- */
.btn {
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .12s, border-color .12s, opacity .12s;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn { white-space: nowrap; }
.btn-primary { background: var(--amber); color: #1a1205; }
.btn-primary:hover { background: var(--amber-dark); color: #fff; }
.btn-ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .25); }
.btn-ghost:hover { background: rgba(255, 255, 255, .12); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--ink-faint); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--line); }
.btn-danger:hover { background: #fef2f2; border-color: var(--red); }
.btn-sm { padding: 5px 10px; font-size: 13px; }

/* ------------------------------ Uygulama düzeni ------------------------------ */
#app { display: flex; min-height: 100vh; }
.brand-mark { font-weight: 700; letter-spacing: 1px; }

/* ------------------------------ Sidebar ------------------------------ */
.sidebar {
  width: 236px; flex-shrink: 0; background: var(--surface);
  border-right: 1px solid var(--line); height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column; overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brand-logo {
  width: 34px; height: 34px; border-radius: 9px; background: var(--black); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: .3px; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .6px; }

.side-nav { flex: 1; padding: 6px 10px 16px; }
.nav-group { margin-top: 16px; }
.nav-group-label {
  font-size: 10.5px; font-weight: 600; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: .7px; padding: 4px 10px;
}
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px;
  color: var(--ink-soft); font-weight: 500; font-size: 14px; margin: 1px 0;
  transition: background .12s, color .12s;
}
.side-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .8; }
.side-link:hover { background: #f4f4f5; color: var(--ink); }
.side-link.active { background: #fff7ed; color: var(--amber-dark); }
.side-link.active svg { opacity: 1; }

.side-foot { padding: 10px; border-top: 1px solid var(--line); }
.collapse-btn {
  width: 100%; display: flex; align-items: center; gap: 8px; justify-content: center;
  background: transparent; border: none; color: var(--ink-soft); font-size: 13px;
  font-weight: 500; padding: 8px; border-radius: 8px; cursor: pointer;
}
.collapse-btn svg { width: 16px; height: 16px; }
.collapse-btn:hover { background: #f4f4f5; }

/* ------------------------------ Ana alan + üst çubuk ------------------------------ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 0 24px; height: 60px; position: sticky; top: 0; z-index: 10;
}
.crumb { font-size: 15px; font-weight: 600; color: var(--ink); }
.crumb .crumb-root { color: var(--ink-faint); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.role-pill {
  font-size: 12px; font-weight: 600; padding: 4px 12px; border-radius: 999px;
  border: 1px solid #fde68a; color: var(--amber-dark); background: #fffbeb;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--black); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.user-badge { font-size: 13.5px; color: var(--ink); font-weight: 500; }

/* Daraltılmış sidebar */
#app.sidebar-collapsed .sidebar { width: 66px; }
#app.sidebar-collapsed .brand-name,
#app.sidebar-collapsed .brand-sub,
#app.sidebar-collapsed .side-link span,
#app.sidebar-collapsed .nav-group-label,
#app.sidebar-collapsed .collapse-btn span { display: none; }
#app.sidebar-collapsed .side-link { justify-content: center; gap: 0; }
#app.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 18px 0 14px; }

@media (max-width: 760px) {
  .sidebar { width: 62px; }
  .brand-name, .brand-sub, .side-link span, .nav-group-label, .collapse-btn span { display: none; }
  .side-link { justify-content: center; gap: 0; }
  .sidebar-brand { justify-content: center; padding: 18px 0 14px; }
  .user-badge { display: none; }
  .topbar { padding: 0 16px; }
}

/* ------------------------------ Sayfa ------------------------------ */
.page { max-width: 1360px; margin: 0; padding: 26px 28px 60px; width: 100%; }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}
.page-head h1 { font-size: 22px; font-weight: 700; margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--ink-soft); }
.head-actions { display: flex; gap: 8px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------ Kart ------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.placeholder {
  color: var(--ink-soft);
  padding: 40px 20px;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.placeholder strong { color: var(--ink); }

/* ------------------------------ Tablo ------------------------------ */
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
}
table.data td { padding: 10px 12px; border-bottom: 1px solid var(--line); }
table.data tr:hover td { background: #fafafa; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* Sayısal sütun başlığı da sağa yaslı olsun (değerlerle hizalı), ama başlık fontu Inter kalsın */
table.data th.num { text-align: right; font-family: var(--font); }

/* ------------------------------ Rozet ------------------------------ */
.badge {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f4f4f5;
  color: var(--ink-soft);
  border: 1px solid var(--line);
}
.badge.amber { background: #fef3c7; color: var(--amber-dark); border-color: #fde68a; }
.badge.green { background: #dcfce7; color: #15803d; border-color: #bbf7d0; }
.badge.red   { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }

/* --------------------------- Giriş ekranı --------------------------- */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #ffffff 0%, var(--bg) 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 30px 28px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .10);
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand .brand-logo { width: 46px; height: 46px; border-radius: 12px; font-size: 22px; margin: 0 auto 12px; }
.login-brand .brand-name { color: var(--ink); font-size: 20px; font-weight: 700; letter-spacing: .3px; }
.login-brand .brand-sub { display: block; color: var(--ink-faint); font-size: 12px; margin-top: 2px; text-transform: uppercase; letter-spacing: .6px; }
.tabs {
  display: flex;
  gap: 4px;
  background: #f4f4f5;
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 18px;
}
.tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  border-radius: 7px;
  font-family: var(--font);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  color: var(--ink-soft);
}
.tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.auth-form .hint { font-size: 12px; color: var(--ink-faint); margin: 2px 0 0; text-align: center; }

/* ------------------------------ Form ------------------------------ */
input, select, textarea {
  font-family: var(--font);
  font-size: 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, .15);
}
textarea { resize: vertical; min-height: 80px; }

/* ------------------------------ Toast ------------------------------ */
.toast-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}
.toast {
  background: var(--ink);
  color: #fff;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  animation: toast-in .18s ease;
  max-width: 340px;
}
.toast.error { background: var(--red); }
.toast.success { background: var(--green); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------ Yükleniyor ------------------------------ */
.loading { color: var(--ink-soft); padding: 30px; text-align: center; }

/* ------------------------------ Modal ------------------------------ */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45);
  display: grid; place-items: center; padding: 20px; z-index: 50;
}
.modal-card {
  background: var(--surface); border-radius: 12px; width: 100%; max-width: 540px;
  max-height: 90vh; overflow: auto; box-shadow: 0 20px 50px rgba(0, 0, 0, .3);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close {
  border: none; background: transparent; font-size: 24px; line-height: 1;
  cursor: pointer; color: var(--ink-soft); padding: 0 4px;
}
.modal-body { padding: 20px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 14px 20px; border-top: 1px solid var(--line);
}

/* ------------------------------ Form grid ------------------------------ */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.form-grid .full { grid-column: 1 / -1; }

/* Çoklu değer alanı (ör. karşı taraflar) */
.multi-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.multi-row { display: flex; gap: 8px; align-items: center; }
.multi-row input { flex: 1; }

/* ------------------------------ Özet kartlar ------------------------------ */
.stat-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; border-left: 3px solid var(--line);
}
.stat-card.green { border-left-color: var(--green); }
.stat-card.red { border-left-color: var(--red); }
.stat-label { font-size: 12px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 22px; font-weight: 600; margin-top: 6px; }
.stat-card.green .stat-value { color: #15803d; }
.stat-card.red .stat-value { color: var(--red); }
.flt-label { color: var(--ink-soft); font-size: 13px; }
.stat-cards-4 { grid-template-columns: repeat(4, 1fr); }
.stat-link { display: block; transition: border-color .12s, transform .06s; }
.stat-link:hover { border-color: var(--amber); }
.stat-card.amber { border-left-color: var(--amber); }
.stat-card.amber .stat-value { color: var(--amber-dark); }
@media (max-width: 900px) { .stat-cards-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .stat-cards, .stat-cards-4 { grid-template-columns: 1fr; } }

/* ------------------------------ Akış ------------------------------ */
.flow-input { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.flow-input textarea { flex: 1; min-height: 52px; }
.flow-tabs { max-width: 460px; margin: 0 0 16px; }
.flow-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: start;
}
.flow-text { grid-column: 1; font-size: 14.5px; white-space: pre-wrap; }
.flow-meta { grid-column: 1; color: var(--ink-faint); font-size: 12.5px; }
.flow-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 8px; align-items: center; }
.flow-mini { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.flow-mini:last-of-type { border-bottom: none; }
.flow-mini-text { font-size: 14px; }
.flow-mini-time { color: var(--ink-faint); font-size: 12.5px; white-space: nowrap; }

/* Akış tablosu — e-tablo (Excel) görünümü: tam genişlik + hücre çizgileri */
.flow-count { color: var(--ink-soft); font-size: 13px; margin: 2px 0 10px; }
.flow-tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); }
.flow-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.flow-table th, table.flow-table td {
  border: 1px solid #e2e2e5; padding: 2px 12px; white-space: nowrap; vertical-align: middle; line-height: 1.3;
}
.flow-table .btn-sm { padding: 1px 8px; font-size: 12px; }
.flow-table .badge { padding: 0 7px; font-size: 11.5px; }
.flow-table thead th { background: #eef0f2; font-weight: 600; color: var(--ink); }
.flow-table th.sortable { cursor: pointer; user-select: none; }
.flow-table th.sortable:hover { background: #e5e7ea; }
.flow-table .flow-not { white-space: normal; width: 100%; }
.flow-table td.nowrap { color: var(--ink-soft); }
.flow-table .row-actions { flex-wrap: nowrap; }
/* Haftalık grup başlığı satırı */
tr.flow-group td { background: #eef0f2; font-weight: 600; font-size: 12px; color: var(--ink-soft); padding: 4px 12px; letter-spacing: .2px; }
/* Zaman filtresi kısayolu aktif durumu */
.btn.active-chip { background: var(--amber); color: #1a1205; border-color: var(--amber); }
/* Kompakt (dar) tablo — gelir-gider akış gibi */
table.data.tight th, table.data.tight td { padding: 2px 12px; line-height: 1.3; }
.tight .btn-sm { padding: 1px 8px; font-size: 12px; }
.tight .badge { padding: 0 7px; font-size: 11.5px; }
/* Durum satır renkleri — satırın tamamı renklenir (fare gelince de korunur) */
tr.flow-row.bekliyor td,
tr.flow-row.bekliyor:hover td { background: var(--surface); }
tr.flow-row.islendi td,
tr.flow-row.islendi:hover td { background: #86efac; }
tr.flow-row.iptal td,
tr.flow-row.iptal:hover td { background: #fee2e2; color: #991b1b; }
tr.flow-row.iptal .flow-not { text-decoration: line-through; }

/* ------------------------------ Kılavuz (SSS akordeon) ------------------------------ */
.faq-item { border-top: 1px solid var(--line); }
.faq-item:first-child { border-top: none; }
.faq-head { display: flex; align-items: center; gap: 10px; }
.faq-q {
  flex: 1; text-align: left; background: transparent; border: none; cursor: pointer;
  padding: 14px 2px; font-family: var(--font); font-size: 14.5px; font-weight: 500; color: var(--ink);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.faq-q:hover { color: var(--amber-dark); }
.faq-q .chev { color: var(--ink-faint); font-size: 18px; transition: transform .15s; }
.faq-item.open .faq-q .chev { transform: rotate(90deg); }
.faq-a { padding: 0 2px 16px; color: var(--ink-soft); white-space: pre-wrap; line-height: 1.65; }
.faq-admin { display: flex; gap: 8px; flex-shrink: 0; }

/* ------------------------------ Ajanda ------------------------------ */
.agenda-group { margin-bottom: 22px; }
.agenda-date { font-size: 13px; font-weight: 600; color: var(--ink-soft); margin: 0 0 8px; display: flex; gap: 10px; align-items: center; }
.agenda-date .rel { color: var(--amber-dark); font-weight: 600; }
.agenda-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 12px 16px; margin-bottom: 8px;
  display: grid; grid-template-columns: 52px 1fr auto; gap: 2px 14px; align-items: center;
}
.agenda-time { grid-row: 1; align-self: center; font-size: 14px; color: var(--ink); }
.agenda-main { min-width: 0; }
.agenda-title { font-weight: 500; }
.agenda-sub { color: var(--ink-faint); font-size: 12.5px; margin-top: 2px; }
.agenda-actions { display: flex; gap: 8px; align-items: center; }
.agenda-item.done .agenda-title { text-decoration: line-through; color: var(--ink-faint); }
@media (max-width: 640px) {
  .agenda-item { grid-template-columns: 46px 1fr; }
  .agenda-actions { grid-column: 1 / -1; margin-top: 8px; }
}

/* ------------------------------ Detay ------------------------------ */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.back-link { color: var(--ink-soft); font-weight: 500; }
.back-link:hover { color: var(--amber-dark); }
.info-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 24px; }
.info-grid .k { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .4px; }
.info-grid .v { font-size: 14px; }
.section-title { font-size: 15px; font-weight: 600; margin: 24px 0 10px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 24px 0 10px; }
.section-head .section-title { margin: 0; }
.mini-ozet { display: flex; flex-wrap: wrap; gap: 22px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.mini-ozet-label { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .4px; }
.mini-ozet-value { font-size: 18px; font-weight: 600; margin-top: 3px; }
.mini-ozet-item.green .mini-ozet-value { color: #15803d; }
.mini-ozet-item.red .mini-ozet-value { color: var(--red); }
.search-input { max-width: 280px; }
.empty-row { color: var(--ink-faint); padding: 16px 12px; text-align: center; }

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }
}
