/* ==========================================================================
   Şirketim CRM — stylesheet
   ========================================================================== */

:root{
  --purple: #6161ff;
  --purple-dark: #4b3fd6;
  --purple-light: #eef0ff;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --border: #e4e6ef;
  --text: #172b4d;
  --text-soft: #676879;
  --text-faint: #9699a6;
  --danger: #e2445c;
  --success: #00c875;
  --warning: #fdab3d;
  --info: #579bfc;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.14);
  --sidebar-w: 250px;
  --topbar-h: 64px;
}

[data-theme="dark"]{
  --purple: #7c7cff;
  --purple-dark: #6161ff;
  --purple-light: #23244a;
  --bg: #14151f;
  --surface: #1c1e2b;
  --border: #2c2e42;
  --text: #eceefb;
  --text-soft: #b0b3c8;
  --text-faint: #7a7d95;
  --shadow: 0 2px 8px rgba(0,0,0,0.35);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}

*, *::before, *::after{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  transition: background .2s ease, color .2s ease;
}
button, input, select, textarea{ font-family: inherit; font-size: 14px; color: inherit; }
button{ cursor:pointer; }
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background: var(--border); border-radius: 8px; }
::-webkit-scrollbar-track{ background: transparent; }

/* ---------- App shell ---------- */
.app-shell{ display:flex; height:100vh; overflow:hidden; }

/* ---------- Sidebar ---------- */
.sidebar{
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display:flex; flex-direction:column;
  transition: width .18s ease, min-width .18s ease;
}
.sidebar.collapsed{ width:64px; min-width:64px; }
.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-count,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .sidebar-search,
.sidebar.collapsed .sidebar-footer-text{ display:none; }
.sidebar.collapsed #collapseSidebarBtn{ transform: rotate(180deg); }

.sidebar-header{
  display:flex; align-items:center; justify-content:space-between;
  padding: 16px 14px; border-bottom:1px solid var(--border);
}
.brand{ display:flex; align-items:center; gap:10px; min-width:0; }
.brand-logo{ width:32px; height:32px; border-radius:8px; flex-shrink:0; display:block; user-select:none; }
.brand-name{ font-weight:700; font-size:15px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.icon-btn{
  background:transparent; border:1px solid transparent; border-radius:6px;
  width:30px; height:30px; display:flex; align-items:center; justify-content:center;
  color: var(--text-soft); transition: background .15s, transform .18s;
}
.icon-btn:hover{ background: var(--purple-light); color: var(--purple); }

.sidebar-search{ padding: 10px 14px; }
.sidebar-search input{
  width:100%; padding:8px 10px; border:1px solid var(--border); border-radius:8px;
  background: var(--bg); color: var(--text);
}
.sidebar-search input:focus{ outline:2px solid var(--purple); outline-offset:-1px; }
.global-search-results{
  position:absolute; top: calc(100% + 4px); left:10px; right:10px; background: var(--surface);
  border:1px solid var(--border); border-radius:8px; box-shadow: var(--shadow-lg); z-index:30;
  max-height:360px; overflow-y:auto; display:none;
}
.global-search-results.show{ display:block; }
.gsr-item{ display:flex; align-items:center; gap:8px; padding:9px 12px; border-bottom:1px solid var(--border); }
.gsr-item:last-child{ border-bottom:none; }
.gsr-item:hover{ background: var(--purple-light); cursor:pointer; }
.gsr-type{ font-size:15px; }
.gsr-main{ flex:1; min-width:0; }
.gsr-title{ font-weight:600; font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.gsr-sub{ font-size:11.5px; color: var(--text-faint); }
.gsr-empty{ padding:14px; text-align:center; color: var(--text-faint); font-size:13px; }

.sidebar-nav{ flex:1; overflow-y:auto; padding: 4px 10px; }
.nav-section-title{
  font-size:11px; text-transform:uppercase; letter-spacing:.05em;
  color: var(--text-faint); font-weight:700; padding: 14px 8px 6px;
}
.nav-item{
  width:100%; display:flex; align-items:center; gap:10px;
  background:transparent; border:none; border-radius:8px;
  padding:9px 8px; margin-bottom:2px; text-align:left; color: var(--text-soft);
  font-weight:500; transition: background .12s, color .12s;
}
.nav-item:hover{ background: var(--bg); color: var(--text); }
.nav-item.active{ background: var(--purple-light); color: var(--purple); font-weight:700; }
.nav-icon{ font-size:16px; width:20px; text-align:center; flex-shrink:0; }
.nav-label{ flex:1; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.nav-count{
  font-size:11px; background: var(--border); color: var(--text-soft);
  padding:1px 7px; border-radius:10px; font-weight:700;
}
.nav-item.active .nav-count{ background: var(--purple); color:#fff; }

.sidebar-footer{
  padding:10px 14px; border-top:1px solid var(--border);
  display:flex; align-items:center; gap:8px;
}
.sidebar-footer-text{ font-size:11px; color: var(--text-faint); }

/* ---------- Main content ---------- */
.main-content{ flex:1; display:flex; flex-direction:column; min-width:0; }

.topbar{
  height: var(--topbar-h); min-height: var(--topbar-h);
  display:flex; align-items:center; justify-content:space-between;
  padding: 0 24px; border-bottom:1px solid var(--border); background: var(--surface);
}
.topbar-left h1{ font-size:20px; margin:0; }
.view-subtitle{ color: var(--text-soft); font-size:13px; }
.topbar-left{ display:flex; flex-direction:column; gap:2px; }
.topbar-right{ display:flex; gap:10px; }

.view-toolbar{
  display:flex; align-items:center; justify-content:space-between;
  padding: 12px 24px; border-bottom:1px solid var(--border); gap:12px; flex-wrap:wrap;
  background: var(--surface);
}
.toolbar-left, .toolbar-right{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

.view-switch{ display:flex; background: var(--bg); border-radius:8px; padding:3px; border:1px solid var(--border); }
.view-switch-btn{ background:transparent; border:none; padding:6px 12px; border-radius:6px; color: var(--text-soft); font-weight:600; }
.view-switch-btn.active{ background: var(--surface); color: var(--purple); box-shadow: var(--shadow); }

.board-search, .filter-select{
  padding:7px 10px; border:1px solid var(--border); border-radius:8px; background: var(--surface); color:var(--text);
}
.board-search{ min-width:220px; }

.content-area{ flex:1; overflow:auto; padding:22px 24px; }

/* ---------- Buttons ---------- */
.btn{
  border:1px solid var(--border); background: var(--surface); color: var(--text);
  padding:8px 14px; border-radius:8px; font-weight:600; display:inline-flex; align-items:center; gap:6px;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover{ border-color: var(--purple); }
.btn:active{ transform: scale(.97); }
.btn-primary{ background: var(--purple); border-color: var(--purple); color:#fff; }
.btn-primary:hover{ background: var(--purple-dark); border-color: var(--purple-dark); }
.btn-danger{ background: var(--danger); border-color: var(--danger); color:#fff; }
.btn-danger:hover{ filter: brightness(0.92); }
.btn-ghost{ background:transparent; border-color:transparent; }
.btn-ghost:hover{ background: var(--bg); border-color:transparent; }
.btn-sm{ padding:5px 10px; font-size:12.5px; }
.btn:disabled{ opacity:.5; cursor:not-allowed; }

/* ---------- Dashboard ---------- */
.dash-grid{ display:grid; grid-template-columns: repeat(4, 1fr); gap:16px; margin-bottom:22px; }
@media (max-width:1100px){ .dash-grid{ grid-template-columns: repeat(2,1fr); } }
.stat-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding:16px 18px; box-shadow: var(--shadow);
}
.stat-card .stat-label{ font-size:12.5px; color: var(--text-soft); font-weight:600; text-transform:uppercase; letter-spacing:.03em; }
.stat-card .stat-value{ font-size:26px; font-weight:800; margin-top:6px; }
.stat-card .stat-sub{ font-size:12px; color: var(--text-faint); margin-top:4px; }
.stat-card.accent-purple .stat-value{ color: var(--purple); }
.stat-card.accent-success .stat-value{ color: var(--success); }
.stat-card.accent-danger .stat-value{ color: var(--danger); }
.stat-card.accent-warning .stat-value{ color: var(--warning); }

.dash-panels{ display:grid; grid-template-columns: 1.3fr 1fr; gap:16px; margin-bottom:22px; }
@media (max-width:1100px){ .dash-panels{ grid-template-columns: 1fr; } }
.panel-card{
  background: var(--surface); border:1px solid var(--border); border-radius: var(--radius);
  padding:18px; box-shadow: var(--shadow);
}
.panel-card h3{ margin:0 0 14px 0; font-size:15px; }
.panel-card .panel-empty{ color: var(--text-faint); font-size:13px; padding: 20px 0; text-align:center; }

.task-mini-row{
  display:flex; align-items:center; gap:10px; padding:8px 0; border-bottom:1px solid var(--border);
  font-size:13px;
}
.task-mini-row:last-child{ border-bottom:none; }
.task-mini-title{ flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.task-mini-date{ color: var(--text-faint); font-size:12px; }

/* ---------- Table (board grid) ---------- */
.group-block{ margin-bottom:22px; border-radius: var(--radius); overflow:hidden; border:1px solid var(--border); }
.group-header{
  display:flex; align-items:center; gap:10px; padding:10px 14px; cursor:pointer;
  background: var(--surface); border-left: 6px solid var(--purple);
}
.group-header .group-title{ font-weight:700; flex:1; }
.group-header .group-count{ font-size:12px; color: var(--text-soft); background: var(--bg); padding:2px 8px; border-radius:10px; }
.group-header .group-toggle{ transition: transform .15s ease; color: var(--text-soft); }
.group-header.collapsed .group-toggle{ transform: rotate(-90deg); }
.group-body.collapsed{ display:none; }

.data-table{ width:100%; border-collapse:collapse; background: var(--surface); }
.data-table thead th{
  text-align:left; font-size:11.5px; text-transform:uppercase; letter-spacing:.03em;
  color: var(--text-soft); font-weight:700; padding:9px 12px; border-bottom:1px solid var(--border);
  background: var(--bg); cursor:pointer; user-select:none; white-space:nowrap;
}
.data-table thead th:hover{ color: var(--purple); }
.data-table thead th .sort-arrow{ margin-left:4px; opacity:.6; }
.data-table tbody td{ padding:10px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
.data-table tbody tr{ transition: background .1s; }
.data-table tbody tr:hover{ background: var(--purple-light); }
.data-table tbody tr:last-child td{ border-bottom:none; }
.row-name-cell{ font-weight:600; cursor:pointer; }
.row-name-cell:hover{ color: var(--purple); text-decoration:underline; }
.row-actions{ display:flex; gap:4px; opacity:0; transition:opacity .1s; }
.data-table tbody tr:hover .row-actions{ opacity:1; }

.add-row-btn{
  width:100%; text-align:left; padding:9px 16px; background: var(--surface); border:none;
  color: var(--text-faint); font-weight:600; border-top: 1px dashed var(--border);
}
.add-row-btn:hover{ color: var(--purple); background: var(--purple-light); }

/* ---------- Status / priority pills ---------- */
.pill{
  display:inline-flex; align-items:center; justify-content:center; padding:5px 10px;
  border-radius:6px; font-size:12.5px; font-weight:700; color:#fff; white-space:nowrap;
  min-width:90px; text-align:center; border:none;
}
.pill-select{ appearance:none; -webkit-appearance:none; cursor:pointer; }

.pill-new{ background:#579bfc; }
.pill-contacted{ background:#a25ddc; }
.pill-proposal{ background:#fdab3d; }
.pill-negotiation{ background:#ff642e; }
.pill-won{ background:#00c875; }
.pill-lost{ background:#e2445c; }

.pill-low{ background:#a1d5ff; color:#1a3f66;}
.pill-orta{ background:#fdab3d; }
.pill-yüksek{ background:#e2445c; }

.pill-todo{ background:#c4c4c4; color:#333; }
.pill-progress{ background:#579bfc; }
.pill-done{ background:#00c875; }

.pill-lead{ background:#579bfc; }
.pill-musteri{ background:#00c875; }
.pill-partner{ background:#a25ddc; }

/* ---------- Avatar ---------- */
.avatar{
  width:26px; height:26px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center;
  color:#fff; font-size:11px; font-weight:700; flex-shrink:0;
}
.person-cell{ display:flex; align-items:center; gap:8px; }

/* ---------- Kanban ---------- */
.kanban-board{ display:flex; gap:16px; overflow-x:auto; padding-bottom:10px; align-items:flex-start; }
.kanban-col{
  min-width:280px; max-width:280px; background: var(--bg); border-radius: var(--radius);
  border:1px solid var(--border); display:flex; flex-direction:column; max-height: calc(100vh - 230px);
}
.kanban-col-header{
  padding:12px 14px; font-weight:700; display:flex; align-items:center; gap:8px;
  border-bottom:2px solid var(--border); border-radius: var(--radius) var(--radius) 0 0;
}
.kanban-col-count{ background: rgba(255,255,255,.5); border-radius:10px; padding:1px 8px; font-size:12px; }
.kanban-col-body{ flex:1; overflow-y:auto; padding:10px; display:flex; flex-direction:column; gap:8px; min-height:60px; }
.kanban-col-body.drag-over{ background: var(--purple-light); }
.kanban-card{
  background: var(--surface); border:1px solid var(--border); border-radius:8px; padding:10px 12px;
  cursor:grab; box-shadow: var(--shadow); transition: box-shadow .12s, transform .12s;
}
.kanban-card:hover{ box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.kanban-card.dragging{ opacity:.4; }
.kanban-card-title{ font-weight:700; margin-bottom:6px; }
.kanban-card-meta{ display:flex; align-items:center; justify-content:space-between; font-size:12px; color: var(--text-soft); margin-top:6px;}
.kanban-card-value{ font-weight:700; color: var(--purple); }
.kanban-add-btn{ padding:8px 10px; text-align:left; color: var(--text-faint); font-weight:600; background:transparent; border:none; border-radius:6px; }
.kanban-add-btn:hover{ background: var(--surface); color: var(--purple); }

/* ---------- Empty state ---------- */
.empty-state{ text-align:center; padding:60px 20px; color: var(--text-faint); }
.empty-state .empty-icon{ font-size:42px; margin-bottom:10px; }
.empty-state .empty-title{ font-weight:700; font-size:16px; color: var(--text-soft); margin-bottom:4px; }

/* ---------- Detail panel ---------- */
.overlay{
  position:fixed; inset:0; background: rgba(20,20,30,.35); display:none; z-index:40;
  backdrop-filter: blur(1px);
}
.overlay.show{ display:block; }
.detail-panel{
  position:fixed; top:0; right:-480px; width:460px; height:100vh; background: var(--surface);
  box-shadow: var(--shadow-lg); z-index:50; transition: right .22s ease; overflow-y:auto;
  border-left:1px solid var(--border);
}
.detail-panel.show{ right:0; }
.detail-header{
  display:flex; align-items:center; justify-content:space-between; padding:18px 20px;
  border-bottom:1px solid var(--border); position:sticky; top:0; background: var(--surface); z-index:2;
}
.detail-header h2{ margin:0; font-size:17px; }
.detail-body{ padding:20px; }
.form-group{ margin-bottom:16px; }
.form-group label{ display:block; font-size:12.5px; font-weight:700; color: var(--text-soft); margin-bottom:6px; text-transform:uppercase; letter-spacing:.02em; }
.form-group input, .form-group select, .form-group textarea{
  width:100%; padding:9px 11px; border:1px solid var(--border); border-radius:8px; background: var(--bg); color:var(--text);
}
.form-group textarea{ resize:vertical; min-height:70px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus{ outline:2px solid var(--purple); outline-offset:-1px; }
.form-row{ display:flex; gap:12px; }
.form-row .form-group{ flex:1; }

.detail-section-title{
  font-size:13px; font-weight:700; text-transform:uppercase; letter-spacing:.03em; color: var(--text-soft);
  margin: 22px 0 10px; padding-top:16px; border-top:1px solid var(--border);
}
.note-item{ background: var(--bg); border-radius:8px; padding:10px 12px; margin-bottom:8px; }
.note-item .note-meta{ font-size:11.5px; color: var(--text-faint); margin-bottom:4px; display:flex; justify-content:space-between; }
.note-item .note-text{ font-size:13px; white-space:pre-wrap; }
.note-add-row{ display:flex; gap:8px; margin-top:10px; }
.note-add-row textarea{ flex:1; min-height:40px; }

.linked-list{ display:flex; flex-direction:column; gap:6px; }
.linked-item{
  display:flex; align-items:center; justify-content:space-between; background: var(--bg);
  padding:8px 10px; border-radius:8px; font-size:13px;
}
.linked-item .linked-name{ font-weight:600; }

.detail-footer{
  position:sticky; bottom:0; background: var(--surface); border-top:1px solid var(--border);
  padding:14px 20px; display:flex; justify-content:space-between; gap:10px;
}

/* ---------- Confirm modal ---------- */
.confirm-modal{
  position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); background: var(--surface);
  border-radius:12px; box-shadow: var(--shadow-lg); padding:22px; width:360px; z-index:70; display:none;
}
.confirm-modal.show{ display:block; }
.confirm-modal h3{ margin:0 0 8px; font-size:16px; }
.confirm-modal p{ margin:0 0 18px; color: var(--text-soft); font-size:13.5px; }
.confirm-modal .confirm-actions{ display:flex; justify-content:flex-end; gap:10px; }
.confirm-modal p.confirm-detail{ margin-top:-10px; padding:9px 11px; border-radius:6px; background: rgba(253,171,61,.16); color: var(--text); font-size:12.5px; }
.backup-warn{ color: var(--warning, #fdab3d); font-weight:600; cursor:pointer; }
.backup-warn:hover{ text-decoration:underline; }
.backup-ok{ color: var(--success, #00c875); font-weight:600; }
.backup-list{ margin-top:10px; max-height:180px; overflow-y:auto; border:1px solid var(--border); border-radius:8px; }
.backup-list-row{ display:flex; align-items:center; gap:8px; padding:7px 10px; font-size:12.5px; border-bottom:1px solid var(--border); }
.backup-list-row:last-child{ border-bottom:none; }
.backup-list-row .bl-name{ flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-family:Consolas,monospace; }
.backup-list-row .bl-meta{ color: var(--text-faint); white-space:nowrap; }
.backup-status{ display:inline-block; padding:2px 9px; border-radius:20px; font-size:12px; font-weight:700; }
.backup-status.on{ background: rgba(0,200,117,.15); color: var(--success, #00c875); }
.backup-status.paused, .backup-status.error{ background: rgba(253,171,61,.18); color: var(--warning); }
.backup-status.off, .backup-status.unsupported{ background: rgba(150,150,150,.15); color: var(--text-faint); }
.settings-select{ padding:6px 8px; border:1px solid var(--border); border-radius:6px; background: var(--surface); color: var(--text); font-size:13px; }

/* ---------- Settings ---------- */
.settings-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
@media (max-width:900px){ .settings-grid{ grid-template-columns:1fr; } }
.settings-card{ background: var(--surface); border:1px solid var(--border); border-radius: var(--radius); padding:20px; box-shadow: var(--shadow); }
.settings-card h3{ margin-top:0; }
.settings-card p{ color: var(--text-soft); font-size:13px; line-height:1.5; }
.owner-chip{
  display:inline-flex; align-items:center; gap:6px; background: var(--bg); border:1px solid var(--border);
  padding:5px 10px; border-radius:20px; margin:4px 6px 0 0; font-size:13px; font-weight:600;
}
.owner-chip button{ background:none; border:none; color: var(--text-faint); font-weight:900; }
.owner-chip button:hover{ color: var(--danger); }
.add-owner-row{ display:flex; gap:8px; margin-top:12px; }
.add-owner-row input{ flex:1; padding:8px 10px; border:1px solid var(--border); border-radius:8px; background: var(--bg); color:var(--text); }

/* ---------- Toast ---------- */
.toast-container{ position:fixed; bottom:20px; right:20px; z-index:100; display:flex; flex-direction:column; gap:8px; }
.toast{
  background: var(--text); color: var(--surface); padding:11px 16px; border-radius:8px; font-size:13.5px;
  box-shadow: var(--shadow-lg); animation: toast-in .18s ease; max-width:320px;
}
.toast.toast-success{ background: var(--success); color:#fff; }
.toast.toast-danger{ background: var(--danger); color:#fff; }
@keyframes toast-in{ from{ opacity:0; transform:translateY(8px);} to{opacity:1; transform:translateY(0);} }

/* ---------- Charts (SVG based) ---------- */
.chart-legend{ display:flex; flex-wrap:wrap; gap:10px; margin-top:12px; font-size:12px; }
.chart-legend-item{ display:flex; align-items:center; gap:6px; color: var(--text-soft); }
.chart-legend-dot{ width:10px; height:10px; border-radius:3px; }
.bar-row{ display:flex; align-items:center; gap:10px; margin-bottom:10px; }
.bar-row .bar-label{ width:110px; font-size:12.5px; color: var(--text-soft); flex-shrink:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.bar-track{ flex:1; background: var(--bg); border-radius:6px; height:16px; overflow:hidden; }
.bar-fill{ height:100%; border-radius:6px; transition: width .3s ease; }
.bar-row .bar-value{ width:80px; text-align:right; font-size:12.5px; font-weight:700; flex-shrink:0; }

/* ---------- Misc ---------- */
.text-faint{ color: var(--text-faint); }
.hidden{ display:none !important; }
.mt-0{ margin-top:0; }
.field-hint{ font-size:12px; color: var(--text-faint); margin-top:4px; }

/* ---------- Taşıma şeridi (eski file:// sayfası) ---------- */
.migration-banner{ display:flex; align-items:center; gap:12px; padding:10px 16px; background: rgba(97,97,255,.10); border-bottom:1px solid var(--border); font-size:13px; color: var(--text); }
.migration-banner > span{ flex:1; }
