/* =========================================================
   DP CRM - Tasarim Token Sistemi
   Palet: graphite/paper zemin + signal (royal mavi) + amber (bronz) vurgu
   Tipografi: Sora (baslik) / IBM Plex Sans (govde) / IBM Plex Mono (veri)
   Imza ogesi: KPI ve durum gostergelerinde kullanilan "activity ring"
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@500;600;700;800&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --ink: #14171C;
  --paper: #F1F3F7;
  --paper-2: #FFFFFF;
  --paper-3: #E6E9F0;
  --slate: #5B6472;
  --slate-2: #8891A0;
  --line: #DDE1E9;

  --signal: #2F5FE0;
  --signal-ink: #1E3FA3;
  --signal-soft: #E7EDFC;

  --amber: #B98A2E;
  --amber-soft: #F7EEDB;

  --success: #17915E;
  --success-soft: #E2F5EC;
  --warning: #C97A1E;
  --warning-soft: #FBEEDD;
  --danger: #D6455B;
  --danger-soft: #FBE6EA;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 23, 28, 0.06), 0 1px 1px rgba(20,23,28,0.04);
  --shadow-md: 0 8px 24px rgba(20, 23, 28, 0.10);
  --shadow-lg: 0 20px 48px rgba(20, 23, 28, 0.16);

  --font-display: 'Sora', 'IBM Plex Sans', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 76px;
  --topbar-h: 64px;
  --bottomnav-h: 64px;

  color-scheme: light;
}

html[data-theme="dark"] {
  --ink: #EDEFF3;
  --paper: #0E1116;
  --paper-2: #171B23;
  --paper-3: #1F2430;
  --line: #2A2F3B;

  --signal: #5B84EE;
  --signal-ink: #C7D5FC;
  --signal-soft: #1B2740;

  --amber: #D6AD5C;
  --amber-soft: #34291A;

  --success: #34C58C;
  --success-soft: #12301F;
  --warning: #E0A24B;
  --warning-soft: #332312;
  --danger: #F0748A;
  --danger-soft: #351A20;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .2s ease, color .2s ease;
}
h1, h2, h3, h4, .display { font-family: var(--font-display); letter-spacing: -0.01em; }
h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 19px; font-weight: 700; margin: 0; }
h3 { font-size: 15px; font-weight: 600; margin: 0; }
p { margin: 0 0 8px; }
a { color: var(--signal); text-decoration: none; }
code, .mono { font-family: var(--font-mono); }
button { font-family: inherit; }
::selection { background: var(--signal-soft); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ---------- Skip link / a11y ---------- */
.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--signal); color: #fff;
  padding: 8px 14px; border-radius: 0 0 8px 0; z-index: 999;
}
.skip-link:focus { left: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--paper-2); color: var(--ink);
  padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all .15s ease; white-space: nowrap;
}
.btn:hover { border-color: var(--slate-2); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--signal); border-color: var(--signal); color: #fff; }
.btn-primary:hover { background: var(--signal-ink); border-color: var(--signal-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--radius-sm); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--slate); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--paper-2); color: var(--ink); font-size: 14px; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--signal); }
.field-hint { font-size: 12px; color: var(--slate-2); margin-top: 4px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }

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

.sidebar {
  width: var(--sidebar-w); background: var(--paper-2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40;
  transition: width .2s ease, transform .2s ease;
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px; border-bottom: 1px solid var(--line); }
.sidebar-brand .mark {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: conic-gradient(from 210deg, var(--signal), var(--amber), var(--signal));
  display: flex; align-items: center; justify-content: center; color: #fff; font-family: var(--font-display); font-weight: 800;
}
.sidebar-brand .name { font-family: var(--font-display); font-weight: 700; font-size: 15px; }
.sidebar-brand .sub { font-size: 11px; color: var(--slate-2); }
.sidebar.collapsed .brand-text { display: none; }

.nav-group { padding: 14px 12px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--slate-2); padding: 10px 10px 6px; font-weight: 700; }
.sidebar.collapsed .nav-label { display: none; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  color: var(--slate); font-weight: 600; font-size: 13.5px; cursor: pointer; margin-bottom: 2px; position: relative;
}
.nav-item svg { flex-shrink: 0; width: 18px; height: 18px; }
.nav-item:hover { background: var(--paper-3); color: var(--ink); }
.nav-item.active { background: var(--signal-soft); color: var(--signal-ink); }
.nav-item.active svg { color: var(--signal); }
.sidebar.collapsed .nav-item span { display: none; }
.nav-item .badge-count {
  margin-left: auto; background: var(--amber-soft); color: var(--amber); font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 20px;
}
.sidebar.collapsed .nav-item .badge-count { display: none; }

.sidebar-footer { padding: 14px; border-top: 1px solid var(--line); }
.collapse-toggle { width: 100%; }

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

.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 14px; padding: 0 20px;
  border-bottom: 1px solid var(--line); background: var(--paper-2); position: sticky; top: 0; z-index: 30;
}
.hamburger { display: none; }
.search-box { position: relative; flex: 1; max-width: 420px; }
.search-box input {
  width: 100%; padding: 9px 12px 9px 36px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); font-size: 13.5px;
}
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--slate-2); width: 16px; height: 16px; }
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--signal-soft); color: var(--signal-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0;
}

.content { padding: 22px; max-width: 1400px; width: 100%; margin: 0 auto; }

/* ---------- KPI Cards + signature activity ring ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px;
  display: flex; align-items: center; gap: 14px; box-shadow: var(--shadow-sm);
}
.kpi-card .kpi-text { min-width: 0; }
.kpi-card .kpi-value { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1; }
.kpi-card .kpi-label { font-size: 12px; color: var(--slate); margin-top: 6px; font-weight: 600; }

.ring { flex-shrink: 0; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 5; }
.ring .ring-track { stroke: var(--paper-3); }
.ring .ring-fill { stroke: var(--signal); stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.ring.amber .ring-fill { stroke: var(--amber); }
.ring.success .ring-fill { stroke: var(--success); }
.ring.danger .ring-fill { stroke: var(--danger); }

.panel { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
@media (max-width: 980px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Bars (weekly performance) ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 140px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar-track { width: 100%; max-width: 26px; background: var(--paper-3); border-radius: 6px; position: relative; height: 100%; display: flex; align-items: flex-end; overflow: hidden; }
.bar-fill { width: 100%; background: linear-gradient(180deg, var(--signal), var(--signal-ink)); border-radius: 6px 6px 0 0; }
.bar-label { font-size: 11px; color: var(--slate-2); font-weight: 600; }

/* ---------- Activity list ---------- */
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); margin-top: 6px; flex-shrink: 0; }
.activity-text { font-size: 13px; }
.activity-time { font-size: 11.5px; color: var(--slate-2); font-family: var(--font-mono); }

/* ---------- Badges / status pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.badge-bekliyor { background: var(--paper-3); color: var(--slate); }
.badge-devam_ediyor { background: var(--signal-soft); color: var(--signal-ink); }
.badge-test { background: var(--amber-soft); color: var(--amber); }
.badge-onay_bekliyor { background: var(--warning-soft); color: var(--warning); }
.badge-tamamlandi { background: var(--success-soft); color: var(--success); }
.badge-iptal { background: var(--danger-soft); color: var(--danger); }
.badge-active { background: var(--success-soft); color: var(--success); }
.badge-inactive { background: var(--danger-soft); color: var(--danger); }
.priority-yuksek { color: var(--danger); font-weight: 700; }
.priority-normal { color: var(--slate); font-weight: 700; }
.priority-dusuk { color: var(--success); font-weight: 700; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.toolbar .field { margin-bottom: 0; min-width: 160px; }
.toolbar-spacer { flex: 1; }
.chip { padding: 6px 13px; border-radius: 999px; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--slate); background: var(--paper-2); }
.chip.active { background: var(--signal); border-color: var(--signal); color: #fff; }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 640px; }
table.data-table th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--slate-2);
  padding: 12px 14px; background: var(--paper-3); border-bottom: 1px solid var(--line); white-space: nowrap;
}
table.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data-table tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--paper-3); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--slate); }
.empty-state h3 { margin-bottom: 6px; }

/* ---------- Kanban ---------- */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { flex: 0 0 270px; background: var(--paper-3); border-radius: var(--radius-md); padding: 10px; min-height: 200px; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 10px; font-weight: 700; font-size: 12.5px; }
.kanban-card {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px;
  margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow-sm); font-size: 13px;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card .kc-title { font-weight: 600; margin-bottom: 6px; }
.kanban-card .kc-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--slate-2); }
.kanban-col.drag-over { outline: 2px dashed var(--signal); outline-offset: -2px; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(10,12,16,.5); display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 16px; backdrop-filter: blur(2px);
}
.modal { background: var(--paper-2); border-radius: var(--radius-lg); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper-2); }
.modal-body { padding: 20px; }
.modal-foot { padding: 16px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Toast ---------- */
.toast-stack { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: var(--radius-sm); font-size: 13.5px;
  box-shadow: var(--shadow-md); display: flex; align-items: center; gap: 10px; min-width: 240px; animation: toast-in .25s ease;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Skeleton ---------- */
.skeleton { background: linear-gradient(90deg, var(--paper-3) 25%, var(--line) 37%, var(--paper-3) 63%); background-size: 400% 100%; animation: skeleton-loading 1.4s ease infinite; border-radius: 8px; }
@keyframes skeleton-loading { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
.skeleton-line { height: 12px; margin-bottom: 8px; }
.skeleton-card { height: 84px; border-radius: var(--radius-lg); }

/* ---------- Login screen (imza alani) ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
  background:
    radial-gradient(1000px 600px at 15% 10%, var(--signal-soft), transparent 60%),
    radial-gradient(900px 600px at 85% 90%, var(--amber-soft), transparent 60%),
    var(--paper);
}
.login-card { width: 100%; max-width: 400px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px 28px; box-shadow: var(--shadow-lg); }
.login-ring { display: flex; justify-content: center; margin-bottom: 8px; }
.login-title { text-align: center; margin-bottom: 4px; }
.login-sub { text-align: center; color: var(--slate); font-size: 13px; margin-bottom: 24px; }
.login-foot { text-align: center; margin-top: 18px; font-size: 12px; color: var(--slate-2); }

/* ---------- Theme toggle ---------- */
.theme-toggle { position: relative; }

/* ---------- Utility ---------- */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-slate { color: var(--slate); }
.text-sm { font-size: 12.5px; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ---------- Bottom nav (mobil) ---------- */
.bottom-nav { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); width: 260px; box-shadow: var(--shadow-lg);
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .hamburger { display: inline-flex; }
  .content { padding: 16px 14px 88px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: var(--bottomnav-h);
    background: var(--paper-2); border-top: 1px solid var(--line); z-index: 45; padding: 6px 4px;
  }
  .bottom-nav a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--slate); font-size: 10.5px; font-weight: 600; border-radius: 10px;
  }
  .bottom-nav a.active { color: var(--signal); }
  .bottom-nav svg { width: 20px; height: 20px; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(10,12,16,.45); z-index: 39; }
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar .field { min-width: 130px; flex: 1; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 26px 20px; }
}
