/* ── Spin animation ─────────────────────────────────────────── */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { display: inline-block; animation: spin 0.9s linear infinite; }

/* ── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --accent:        #534AB7;
  --accent-light:  #EEEDFE;
  --accent-mid:    #AFA9EC;
  --accent-dark:   #3C3489;
  --success:       #0F6E56;
  --success-light: #EAF3DE;
  --warning:       #BA7517;
  --warning-light: #FAEEDA;
  --danger:        #A32D2D;
  --danger-light:  #FCEBEB;
  --danger-border: #F09595;

  --bg:            #ffffff;
  --bg-secondary:  #f6f6f4;
  --bg-tertiary:   #f0efec;
  --text:          #1a1a18;
  --text-secondary:#5a5a56;
  --text-tertiary: #9a9a94;
  --border:        rgba(0,0,0,0.10);
  --border-md:     rgba(0,0,0,0.18);

  --radius:        8px;
  --radius-lg:     12px;
  --font:          -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:     'SF Mono', 'Fira Code', monospace;

  --sidebar-w:     200px;
  --topbar-h:      48px;
}

body {
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg-tertiary);
  height: 100vh;
  overflow: hidden;
}

/* ── Layout ────────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--bg);
  border-right: 0.5px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo {
  padding: 16px;
  border-bottom: 0.5px solid var(--border);
}
.sidebar-logo-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.sidebar-logo-sub {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 1px;
}

.nav-section { padding: 6px 0; }

.nav-label {
  font-size: 10px;
  color: var(--text-tertiary);
  padding: 6px 16px 3px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-divider {
  height: 0.5px;
  background: var(--border);
  margin: 5px 14px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
}
.nav-item:hover { background: var(--bg-secondary); }
.nav-item i { font-size: 16px; flex-shrink: 0; }
.nav-item.active {
  background: var(--bg-secondary);
  color: var(--text);
  font-weight: 500;
  border-left: 2px solid var(--accent);
  padding-left: 14px;
}
.nav-item.active i { color: var(--accent); }

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 500;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

.sidebar-new-btn {
  margin-top: auto;
  padding: 12px 16px;
}
.btn-sidebar-new {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 9px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}
.btn-sidebar-new:hover {
  opacity: 0.88;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-footer-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
}
.sidebar-footer-role {
  font-size: 11px;
  color: var(--text-tertiary);
}

/* ── Main area ─────────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ── Topbar ────────────────────────────────────────────────── */
#topbar {
  height: var(--topbar-h);
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 12px;
}

.topbar-left { min-width: 0; }
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 1px;
}
.breadcrumb-link {
  cursor: pointer;
  transition: color 0.1s;
}
.breadcrumb-link:hover { color: var(--accent); }
.topbar-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#topbar-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Content ───────────────────────────────────────────────── */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

/* ── Detay sayfası sağ panel ───────────────────────────────── */
.detay-panel-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  line-height: 1.3;
  transition: background 0.1s;
}
.detay-panel-link:hover { background: var(--bg-secondary); }
.detay-panel-link i { font-size: 15px; color: var(--text-secondary); flex-shrink: 0; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 13px;
  font-family: var(--font);
  border-radius: var(--radius);
  border: 0.5px solid var(--border-md);
  cursor: pointer;
  transition: background 0.1s, opacity 0.1s;
  white-space: nowrap;
  font-weight: 400;
}
.btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}
.btn:active { opacity: 0.85; }
.btn i { font-size: 15px; }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dark); }

.btn-secondary {
  background: var(--bg-secondary);
  color: var(--text);
  border-color: var(--border-md);
}
.btn-secondary:hover { background: var(--bg-tertiary); }

.btn-danger {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger-border);
}
.btn-danger:hover { background: #f7c1c1; }
.btn-warning {
  background: var(--warning-light);
  color: var(--warning);
  border-color: #F5C97A;
}
.btn-warning:hover { background: #f5e2b0; }

.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-sm i { font-size: 13px; }

/* ── Firma Combobox ─────────────────────────────────────────── */
.combo-wrap {
  position: relative;
}
.combo-wrap input {
  width: 100%;
  box-sizing: border-box;
}
.combo-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #ffffff;
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  max-height: 220px;
  overflow-y: auto;
  z-index: 300;
}
.combo-item {
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.combo-item:hover, .combo-item.focused {
  background: var(--bg-secondary);
}
.combo-item .combo-vkn {
  font-size: 11px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  margin-left: auto;
}
.combo-empty {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-tertiary);
  text-align: center;
}
.combo-selected-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  padding: 3px 8px;
  background: var(--accent-light, #e8f0fe);
  color: var(--accent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

/* ── Accordion Steps (yeni denetim) ────────────────────────── */
.acc-step {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.acc-step.active {
  border-color: var(--accent-mid);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.acc-step.pending { opacity: 0.45; }

.acc-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  user-select: none;
}
.acc-header.clickable { cursor: pointer; }
.acc-header.clickable:hover { background: var(--bg-secondary); }

.acc-num {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0;
}
.acc-num.done    { background: var(--success); color: #fff; }
.acc-num.active  { background: var(--accent);  color: #fff; }
.acc-num.pending { background: var(--bg-tertiary); color: var(--text-tertiary); }

.acc-title { font-size: 14px; font-weight: 500; flex: 1; color: var(--text); }
.acc-summary { font-size: 12px; color: var(--text-tertiary); margin-right: 4px; }

.acc-chevron {
  font-size: 16px; color: var(--text-tertiary);
  transition: transform 0.2s; flex-shrink: 0;
}

.acc-body {
  overflow: hidden;
  max-height: 0;
  padding: 0 16px 0 50px;
  border-top: 0.5px solid transparent;
  transition: max-height 0.35s ease, padding-bottom 0.35s ease, border-color 0.35s ease;
}
.acc-body.open {
  max-height: 2000px;
  padding-bottom: 16px;
  border-top-color: var(--border);
}

/* ── Progress rows (işleniyor step) ────────────────────────── */
.prog-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 13px;
}
/* CSS-only state indicator — no icon font dependency */
.prog-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  transition: background 0.2s, border-color 0.2s;
}
.prog-dot.pending {
  border: 2px solid var(--border-md);
  background: transparent;
}
.prog-dot.active {
  border: 2px solid var(--accent);
  border-top-color: transparent;
  background: transparent;
  animation: spin 0.7s linear infinite;
}
.prog-dot.done {
  background: var(--success);
  border: 2px solid var(--success);
  color: #fff;
}
.prog-lbl { flex: 1; }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-weight: 500;
  white-space: nowrap;
}
.badge-devam     { background: #E6F1FB; color: #185FA5; }
.badge-tamam     { background: var(--success-light); color: var(--success); }
.badge-bekle     { background: var(--warning-light); color: var(--warning); }
.badge-kapali    { background: var(--bg-secondary); color: var(--text-tertiary); }
.badge-hata      { background: var(--danger-light); color: var(--danger); }
.badge-ymm       { background: #f3eeff; color: #7c3aed; }
.badge-ymm-rapor { background: #fff0eb; color: #c2410c; }

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
}
.card-title i { font-size: 15px; color: var(--accent); }

/* ── KPI Grid ──────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 12px;
}
.kpi-label {
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.kpi-value {
  font-size: 24px;
  font-weight: 500;
  color: var(--text);
}
.kpi-value.accent  { color: var(--accent); }
.kpi-value.success { color: var(--success); }
.kpi-value.warning { color: var(--warning); }
.kpi-value.danger  { color: #E24B4A; }

/* ── Two-col grid ──────────────────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Table ─────────────────────────────────────────────────── */
.table-card {
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.table-head {
  display: grid;
  padding: 8px 16px;
  border-bottom: 0.5px solid var(--border);
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 500;
  background: var(--bg-secondary);
}
.table-row {
  display: grid;
  padding: 10px 16px;
  border-bottom: 0.5px solid var(--border);
  align-items: center;
  font-size: 13px;
  transition: background 0.1s;
}
.table-row:last-child { border-bottom: none; }
.table-row:hover { background: var(--bg-secondary); }
.table-row.clickable { cursor: pointer; }

/* ── Progress ──────────────────────────────────────────────── */
.progress {
  height: 3px;
  background: var(--bg-secondary);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 5px;
}
.progress-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── Flow (process timeline) ───────────────────────────────── */
.flow { display: flex; flex-direction: column; }
.flow-item {
  display: flex;
  gap: 14px;
  position: relative;
  min-height: 36px;
}

/* Dikey bağlantı çizgisi — son item hariç */
.flow-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 11px;       /* dot merkezi: 12px - 0.5px */
  top: 28px;        /* dot altından başlar */
  bottom: 0;
  width: 1px;
  background: var(--border);
}
.flow-item.done::after   { background: #C0DD97; }
.flow-item.active::after { background: var(--accent-mid); }

/* Timeline dot (daire) */
.flow-dot {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1;
  margin-top: 2px;
  border: 2px solid var(--border);
  background: var(--bg);
}
.flow-dot.done    { background: var(--success-light); border-color: #C0DD97; }
.flow-dot.active  { background: var(--accent-light);  border-color: var(--accent-mid); }
.flow-dot.pending { background: var(--bg-secondary);  border-color: var(--border); }
.flow-dot i { font-size: 12px; }
.flow-dot.done i    { color: var(--success); }
.flow-dot.active i  { color: var(--accent); }
.flow-dot.pending i { color: var(--text-tertiary); }

.flow-body { flex: 1; padding-bottom: 18px; }
.flow-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.flow-title.pending { color: var(--text-tertiary); font-weight: 400; }
.flow-meta { font-size: 11px; color: var(--text-tertiary); }
.flow-detail {
  margin-top: 6px;
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Stepper ───────────────────────────────────────────────── */
.stepper {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
}
.stepper-step { display: flex; align-items: center; gap: 7px; }
.stepper-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
}
.stepper-num.done    { background: var(--success-light); color: var(--success); }
.stepper-num.active  { background: var(--accent); color: #fff; }
.stepper-num.pending { background: var(--bg-secondary); color: var(--text-tertiary); }
.stepper-label { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.stepper-label.active  { color: var(--text); font-weight: 500; }
.stepper-label.pending { color: var(--text-tertiary); }
.stepper-line { flex: 1; height: 0.5px; background: var(--border); margin: 0 8px; min-width: 20px; }
.stepper-line.done { background: var(--success); }

/* ── Form ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 5px;
}
input, select, textarea {
  width: 100%;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  border: 0.5px solid var(--border-md);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(83,74,183,0.12);
}

/* ── Upload area ───────────────────────────────────────────── */
.upload-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--bg);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
}
.upload-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: var(--bg-secondary);
}
.upload-icon.done { background: var(--success-light); }
.upload-icon i { font-size: 18px; color: var(--text-tertiary); }
.upload-icon.done i { color: var(--success); }
.upload-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.upload-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }
.upload-meta.done { color: var(--success); }

/* ── AI banner ─────────────────────────────────────────────── */
.ai-banner {
  background: var(--accent-light);
  border: 0.5px solid var(--accent-mid);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 12px;
  color: var(--accent);
}
.ai-banner i { font-size: 15px; flex-shrink: 0; margin-top: 1px; }

/* ── Info banner ───────────────────────────────────────────── */
.info-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 14px;
}
.info-banner.success {
  background: var(--success-light);
  color: var(--success);
  border: 0.5px solid #C0DD97;
}
.info-banner i { font-size: 15px; flex-shrink: 0; }

/* ── Denetim type cards ────────────────────────────────────── */
.type-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-card {
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.type-card:hover { border-color: var(--accent-mid); }
.type-card.selected {
  border: 2px solid var(--accent);
  background: var(--accent-light);
}
.type-card i { font-size: 20px; color: var(--text-tertiary); display: block; margin-bottom: 6px; }
.type-card.selected i { color: var(--accent); }
.type-card-name { font-size: 12px; font-weight: 500; color: var(--text); }
.type-card.selected .type-card-name { color: var(--accent-dark); }
.type-card-sub { font-size: 11px; color: var(--text-tertiary); }
.type-card.selected .type-card-sub { color: var(--accent); }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-md); border-radius: 3px; }

/* ── Loading state ─────────────────────────────────────────── */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-tertiary);
  font-size: 13px;
  gap: 8px;
}

/* ── Empty state ───────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-tertiary);
}
.empty i { font-size: 36px; display: block; margin-bottom: 10px; }
.empty-title { font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; }
.empty-sub { font-size: 13px; }

/* ── Toast ─────────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--text);
  color: var(--bg);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: slideIn 0.2s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
@keyframes slideIn {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
