/* =========================================================
   Hukuk CRM - Ana stil
   Renk değişkenleri PHP tarafından <body data-brand="#xxx">
   üzerinden override edilir.
   ========================================================= */
:root {
  --brand: #1264F3;
  --brand-700: #0d4ec0;
  --brand-50: #eef4ff;
  --bg: #f4f6fb;
  --card: #ffffff;
  --sidebar: #0f172a;
  --sidebar-active: var(--brand);
  --text: #0f172a;
  --text-2: #475569;
  --muted: #64748b;
  --line: #e5e7eb;
  --line-2: #f1f5f9;
  --ok: #10b981;
  --warn: #f59e0b;
  --err: #ef4444;
  --info: #3b82f6;
  --shadow: 0 1px 3px rgba(15,23,42,.04), 0 4px 16px rgba(15,23,42,.04);
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ============ Layout ============ */
.layout { display: flex; min-height: 100vh; }

/* ============ Sidebar ============ */
.sidebar {
  width: 240px;
  background: var(--sidebar);
  color: #cbd5e1;
  flex-shrink: 0;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  padding: 0 20px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-brand .logo {
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 18px;
  overflow: hidden;
}
.sidebar-brand .logo img { max-width: 100%; max-height: 100%; }
.sidebar-brand h1 { font-size: 15px; margin: 0; color: #fff; font-weight: 700; }
.sidebar-brand small { color: #94a3b8; font-size: 11px; letter-spacing: .5px; text-transform: uppercase; }

.sidebar-nav { padding: 0 12px; flex: 1; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; margin-bottom: 4px;
  color: #cbd5e1; border-radius: 8px;
  font-weight: 500; transition: background .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.sidebar-nav a.active { background: var(--brand); color: #fff; }
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-foot {
  padding: 14px 20px; font-size: 12px; color: #94a3b8;
  display: flex; align-items: center; gap: 8px;
}
.sidebar-foot .dot { width: 8px; height: 8px; background: var(--warn); border-radius: 50%; }

/* ============ Main ============ */
.main { flex: 1; min-width: 0; }
.topbar {
  background: #fff;
  padding: 14px 28px;
  display: flex; align-items: center; gap: 20px;
  border-bottom: 1px solid var(--line);
}
.topbar .title { flex: 1; min-width: 0; }
.topbar .title h2 { margin: 0; font-size: 22px; font-weight: 700; }
.topbar .title p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar .search {
  flex: 1; max-width: 480px;
  position: relative;
}
.topbar .search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg);
  font-size: 13px;
}
.topbar .search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.topbar .user {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--brand-50); color: var(--brand);
  display: flex; align-items: center; justify-content: center; font-weight: 600;
  text-decoration: none;
}

.content { padding: 24px 28px; }

/* ============ Alerts (üst bildirimler) ============ */
.banner {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px; border-radius: 10px; margin-bottom: 12px;
  font-size: 13px;
}
.banner-warn { background: #fffbeb; color: #92400e; border-left: 3px solid var(--warn); }
.banner-err  { background: #fef2f2; color: #991b1b; border-left: 3px solid var(--err); }
.banner-info { background: #eff6ff; color: #1e40af; border-left: 3px solid var(--info); }
.banner-ok   { background: #ecfdf5; color: #065f46; border-left: 3px solid var(--ok); }
.banner .actions { margin-left: auto; display: flex; gap: 8px; }

/* ============ Cards / Sections ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.card-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-h h3 { margin: 0; font-size: 16px; font-weight: 600; }
.card-h .meta { color: var(--muted); font-size: 12px; }

/* ============ Quick action cards ============ */
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.quick {
  background: #fff; border-radius: var(--radius); padding: 18px;
  display: flex; align-items: center; gap: 14px; cursor: pointer;
  border: 1px solid transparent; transition: border .15s, transform .15s;
  text-decoration: none; color: var(--text);
}
.quick:hover { border-color: var(--brand); text-decoration: none; }
.quick .icon { width: 38px; height: 38px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.quick .icon.blue   { background: #dbeafe; color: #1d4ed8; }
.quick .icon.green  { background: #d1fae5; color: #047857; }
.quick .icon.amber  { background: #fef3c7; color: #b45309; }
.quick .icon.purple { background: #ede9fe; color: #6d28d9; }
.quick .label { font-weight: 600; }

/* ============ Stat cards ============ */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat {
  background: #fff; border-radius: var(--radius); padding: 18px;
  position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px; }
.stat.b1::before { background: #3b82f6; }
.stat.b2::before { background: #10b981; }
.stat.b3::before { background: #f59e0b; }
.stat.b4::before { background: #ef4444; }
.stat .lbl { font-size: 11px; letter-spacing: .5px; color: var(--muted); text-transform: uppercase; font-weight: 600; }
.stat .val { font-size: 28px; font-weight: 700; margin: 6px 0 2px; }
.stat .sub { font-size: 12px; color: var(--muted); }
.stat .ic {
  position: absolute; right: 16px; top: 22px;
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.stat.b1 .ic { background: #dbeafe; color: #1d4ed8; }
.stat.b2 .ic { background: #d1fae5; color: #047857; }
.stat.b3 .ic { background: #fef3c7; color: #b45309; }
.stat.b4 .ic { background: #fee2e2; color: #b91c1c; }

/* ============ Lists in cards ============ */
.row-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0; border-bottom: 1px solid var(--line-2);
}
.row-item:last-child { border-bottom: 0; }
.row-item .date-pill {
  background: var(--brand); color: #fff; border-radius: 8px;
  width: 50px; text-align: center; padding: 8px 4px;
  font-size: 11px; line-height: 1.1; font-weight: 600; flex-shrink: 0;
}
.row-item .date-pill b { display: block; font-size: 16px; font-weight: 700; }
.row-item .info { flex: 1; min-width: 0; }
.row-item .info b { display: block; font-size: 14px; }
.row-item .info span { color: var(--muted); font-size: 12px; }
.row-item .dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.row-item .dot.red { background: var(--err); }
.row-item .dot.amber { background: var(--warn); }
.row-item .dot.gray { background: #94a3b8; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ============ Tables ============ */
.tbl {
  width: 100%; border-collapse: collapse; background: #fff;
  border-radius: var(--radius); overflow: hidden;
}
.tbl thead th {
  text-align: left; padding: 14px 16px; font-size: 11px;
  color: var(--muted); text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 1px solid var(--line);
  font-weight: 600;
}
.tbl tbody td { padding: 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #fafbfd; }
.tbl .actions { display: flex; gap: 6px; justify-content: flex-end; }
.tbl .icon-btn {
  width: 30px; height: 30px; border: 1px solid var(--line); background: #fff;
  border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.tbl .icon-btn:hover { background: var(--bg); }

/* ============ Badges ============ */
.badge { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-green { background: #d1fae5; color: #047857; }
.badge-amber { background: #fef3c7; color: #b45309; }
.badge-red   { background: #fee2e2; color: #b91c1c; }
.badge-gray  { background: #e5e7eb; color: #475569; }
.badge-blue  { background: #dbeafe; color: #1d4ed8; }
.badge-purple{ background: #ede9fe; color: #6d28d9; }

/* ============ Buttons & Forms ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 8px; border: none;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
  transition: filter .15s;
}
.btn:hover { text-decoration: none; }
.btn-pri { background: var(--brand); color: #fff; }
.btn-pri:hover { filter: brightness(1.05); }
.btn-ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--bg); }
.btn-danger { background: var(--err); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search-box { position: relative; flex: 1; min-width: 200px; max-width: 320px; }
.toolbar .search-box input {
  width: 100%; padding: 9px 14px 9px 36px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; font-size: 13px;
}
.toolbar .search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.tabs { display: flex; gap: 4px; background: #fff; padding: 4px; border-radius: 8px; }
.tabs a { padding: 7px 14px; font-size: 13px; color: var(--text-2); border-radius: 6px; font-weight: 500; }
.tabs a.active { background: var(--brand); color: #fff; }
.tabs a:hover:not(.active) { background: var(--bg); text-decoration: none; }

/* ============ Form ============ */
.form label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
.form input[type=text], .form input[type=email], .form input[type=password], .form input[type=date],
.form input[type=number], .form select, .form textarea, .form input[type=color] {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 13px; font-family: inherit; background: #f8fafc;
}
.form input[type=color] { padding: 4px; height: 40px; }
.form textarea { resize: vertical; min-height: 60px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ============ Modal ============ */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: none; align-items: center; justify-content: center; z-index: 50;
  padding: 20px;
}
.modal-mask.open { display: flex; }
.modal {
  background: #fff; border-radius: 14px;
  width: 100%; max-width: 560px; max-height: 90vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-h {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-h h3 { margin: 0; font-size: 16px; }
.modal-h .close { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1; }
.modal-b { padding: 18px 22px; }
.modal-f { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; }

/* ============ Client cards (Müvekkiller) ============ */
.client-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.client-card {
  background: #fff; border-radius: var(--radius); padding: 18px;
  box-shadow: var(--shadow);
}
.client-h { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.client-h .av {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}
.client-h .name { flex: 1; min-width: 0; }
.client-h .name b { display: block; font-size: 14px; }
.client-h .actions { display: flex; gap: 4px; }
.client-meta { font-size: 13px; color: var(--text-2); line-height: 1.9; }
.client-meta div { display: flex; gap: 8px; align-items: center; }
.client-meta svg { width: 14px; height: 14px; color: var(--muted); flex-shrink: 0; }
.client-foot { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line-2); font-size: 12px; color: var(--muted); }

/* ============ Kanban (Görevler) ============ */
.kanban { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kcol { background: #fff; border-radius: var(--radius); padding: 16px; }
.kcol-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.kcol-h b { font-size: 15px; }
.kcol-h .count {
  background: var(--brand-50); color: var(--brand);
  padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.ktask {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; margin-bottom: 10px;
}
.ktask-h { display: flex; align-items: flex-start; gap: 8px; }
.ktask-h .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.ktask-h .title { flex: 1; font-weight: 600; font-size: 14px; }
.ktask-h .icon-btn { width: 26px; height: 26px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.ktask .meta { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 12px; }
.ktask .move {
  display: block; width: 100%; margin-top: 12px;
  padding: 6px; background: var(--brand-50); color: var(--brand);
  border: none; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 600;
}

/* ============ Calendar ============ */
.cal {
  background: #fff; border-radius: var(--radius); padding: 24px;
}
.cal-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.cal-h h3 { margin: 0; font-size: 18px; }
.cal-h button {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; cursor: pointer;
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-grid .dow {
  font-size: 11px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .5px; text-align: left; padding: 8px 10px; font-weight: 600;
}
.cal-cell {
  aspect-ratio: 1; border-radius: 8px; padding: 10px;
  position: relative; cursor: pointer; transition: background .15s;
  font-size: 13px;
}
.cal-cell:hover { background: var(--bg); }
.cal-cell.empty { visibility: hidden; }
.cal-cell.today { background: var(--brand); color: #fff; }
.cal-cell.has-event::after {
  content: ""; position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand);
}
.cal-cell.today.has-event::after { background: #fff; }

/* ============ Stat trio (ödemeler üst) ============ */
.stat-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.stat-trio .stat .val { font-size: 32px; }

/* ============ Empty state ============ */
.empty {
  text-align: center; padding: 48px 20px; color: var(--muted);
}
.empty svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .5; }

/* ============ Responsive ============ */
@media (max-width: 1024px) {
  .quick-grid, .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .stat-trio { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { width: 70px; }
  .sidebar-brand h1, .sidebar-brand small, .sidebar-nav a span, .sidebar-foot span { display: none; }
  .sidebar-nav a { justify-content: center; padding: 11px 0; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar .search { order: 3; flex-basis: 100%; max-width: none; }
  .content { padding: 16px; }
  .quick-grid, .stat-grid { grid-template-columns: 1fr; }
  .form .row { grid-template-columns: 1fr; }
}
