/* ==========================================================================
   E-İmza Yönetim Sistemi — Modern Açık Tema
   ========================================================================== */

:root {
  --bg: #f7f8fa;
  --bg-alt: #ffffff;
  --bg-sidebar: #ffffff;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --surface-3: #e5e7eb;
  --border: #e5e7eb;
  --border-soft: #f1f3f5;
  --text: #111827;
  --text-muted: #6b7280;
  --text-soft: #9ca3af;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --success: #059669;
  --success-soft: #ecfdf5;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --info: #0891b2;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 10px 25px rgba(15, 23, 42, 0.08), 0 4px 10px rgba(15, 23, 42, 0.04);
  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --sidebar-width: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/* ============ LOGIN ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(37,99,235,0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(37,99,235,0.06) 0%, transparent 50%),
    var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
  border: 1px solid var(--border);
}
.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: white;
  font-size: 26px;
  margin: 0 auto 20px;
  box-shadow: 0 8px 16px rgba(37, 99, 235, 0.24);
}
.login-title { text-align: center; font-size: 22px; font-weight: 600; margin-bottom: 6px; }
.login-subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.login-hint {
  margin-top: 20px;
  padding: 12px 14px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: #1e40af;
  line-height: 1.5;
}
.login-hint code { background: white; padding: 1px 5px; border-radius: 3px; font-family: "SF Mono", Monaco, monospace; font-size: 11px; }

/* ============ LAYOUT ============ */
.app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 50;
}

.sidebar-brand {
  padding: 20px 20px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-brand .logo {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 16px;
}
.sidebar-brand .brand-text { font-weight: 600; font-size: 15px; line-height: 1.2; }
.sidebar-brand .brand-text small { font-weight: 400; color: var(--text-muted); font-size: 11px; display: block; }

.sidebar-nav {
  flex: 1;
  padding: 14px 12px;
  overflow-y: auto;
}
.nav-label {
  padding: 12px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 0.15s ease;
  text-decoration: none;
}
.nav-link:hover { background: var(--surface-2); text-decoration: none; }
.nav-link.active { background: var(--primary-soft); color: var(--primary-hover); font-weight: 600; }
.nav-link .icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-link .badge-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--danger);
  color: white;
  min-width: 20px;
  text-align: center;
}

.sidebar-user {
  padding: 14px 16px;
  border-top: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}
.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #64748b 0%, #475569 100%);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  font-weight: 600;
}
.user-info { flex: 1; min-width: 0; }
.user-info .name { font-size: 13px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-info .role { font-size: 11px; color: var(--text-muted); }
.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
}
.logout-btn:hover { background: var(--surface-2); color: var(--danger); }

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
}

.topbar {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .title { font-size: 18px; font-weight: 600; }
.topbar .subtitle { font-size: 12px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.topbar .actions { display: flex; gap: 8px; align-items: center; }

.content { padding: 24px 28px 48px; max-width: 1400px; }

/* ============ CARDS / SURFACES ============ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }

/* ============ STAT CARDS ============ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.stat-card .stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.stat-card .stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}
.stat-card .stat-icon {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.stat-card.primary .stat-icon { background: var(--primary-soft); color: var(--primary); }
.stat-card.success .stat-icon { background: var(--success-soft); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-soft); color: var(--warning); }
.stat-card.danger .stat-icon { background: var(--danger-soft); color: var(--danger); }
.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}
.stat-card .stat-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ============ SECTION TITLE ============ */
.section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title .count {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ============ FORMS ============ */
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row.three { grid-template-columns: 1fr 1fr 1fr; }
.form-row.four { grid-template-columns: 1fr 1fr 1fr 1fr; }
.label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 5px;
}
.input, .select, .textarea {
  width: 100%;
  padding: 9px 12px;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.textarea { resize: vertical; min-height: 80px; }
.input::placeholder { color: var(--text-soft); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  line-height: 1.4;
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; }
.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--surface-2); text-decoration: none; }
.btn-danger {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; text-decoration: none; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon {
  width: 32px; height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
}
.btn-icon:hover { background: var(--surface-2); }
.btn-icon.wa { color: #25D366; }
.btn-icon.wa:hover { background: #25D366; color: white; border-color: #25D366; text-decoration: none; }
.btn-block { width: 100%; justify-content: center; padding: 10px 16px; }

/* ============ TABLE ============ */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table-scroll { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
thead th {
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th.sortable { cursor: pointer; user-select: none; }
thead th.sortable:hover { color: var(--text); background: var(--surface-3); }
thead th .sort-ind { opacity: 0.4; margin-left: 4px; font-size: 9px; }
tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr.clickable { cursor: pointer; transition: background 0.1s; }
tbody tr.clickable:hover { background: var(--surface-2); }
.cust-name { font-weight: 600; color: var(--text); }
.cust-sub { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; font-family: "SF Mono", Monaco, monospace; }
.mono { font-family: "SF Mono", Monaco, monospace; font-size: 12.5px; }

/* ============ BADGES ============ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 12px;
  line-height: 1.4;
}
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.muted { background: var(--surface-2); color: var(--text-muted); }
.badge.neutral { background: var(--primary-soft); color: var(--primary); }

.days-left { font-weight: 600; }
.days-left.ok { color: var(--success); }
.days-left.warn { color: var(--warning); }
.days-left.danger { color: var(--danger); }
.days-left.muted { color: var(--text-muted); }

/* ============ FILTER BAR ============ */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}
.filter-bar .form-group { margin: 0; }

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.count-info {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}

/* ============ REMINDERS ============ */
.reminder-groups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.rem-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.rem-group .rem-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.rem-group .rem-head h3 { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.rem-group .rem-head .count {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 600;
}
.rem-group.r30 .rem-head { border-left: 3px solid var(--danger); }
.rem-group.r30 .rem-head .count { background: var(--danger-soft); color: var(--danger); }
.rem-group.r60 .rem-head { border-left: 3px solid var(--warning); }
.rem-group.r60 .rem-head .count { background: var(--warning-soft); color: var(--warning); }
.rem-group.r90 .rem-head { border-left: 3px solid var(--primary); }
.rem-group.r90 .rem-head .count { background: var(--primary-soft); color: var(--primary); }
.rem-list { max-height: 320px; overflow-y: auto; }
.rem-item {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  transition: background 0.1s;
}
.rem-item:last-child { border-bottom: none; }
.rem-item:hover { background: var(--surface-2); }
.rem-item .info { min-width: 0; flex: 1; }
.rem-item .name { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rem-item .meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.rem-item .right { display: flex; align-items: center; gap: 8px; }
.rem-item .d-count { font-weight: 600; font-size: 13px; }

/* ============ MODAL ============ */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}
.modal-backdrop.open { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 760px;
  height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 25px 50px rgba(0,0,0,0.2);
  animation: slideUp 0.2s ease;
}
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Form modal'ın flex davranışını devralmalı */
#customerForm {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.modal-head {
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.modal-head h2 { font-size: 17px; font-weight: 600; }
.modal-head .close {
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.modal-head .close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 20px 22px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-foot {
  padding: 12px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  background: var(--surface-2);
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
}
.modal-foot .right { display: flex; gap: 8px; }

/* ============ NOTES (geliştirilmiş) ============ */
.notes-section {
  border-top: 1px solid var(--border-soft);
  margin-top: 16px;
  padding-top: 14px;
}
.notes-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.notes-header h3 { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.notes-header .note-count-badge {
  font-size: 11px;
  background: var(--surface-2);
  color: var(--text-muted);
  padding: 1px 7px;
  border-radius: 10px;
  font-weight: 500;
}
.notes-list {
  max-height: 120px;
  overflow-y: auto;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 3px;
}
.notes-list.empty {
  border-style: dashed;
  padding: 14px;
  text-align: center;
  color: var(--text-soft);
  font-size: 12px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.note-item {
  background: var(--bg-alt);
  border-left: 3px solid var(--primary);
  padding: 8px 10px 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: 4px;
  position: relative;
  transition: box-shadow 0.1s;
}
.note-item:last-child { margin-bottom: 0; }
.note-item:hover { box-shadow: 0 1px 3px rgba(0,0,0,0.06); }
.note-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-bottom: 3px;
  line-height: 1;
}
.note-text {
  font-size: 12.5px;
  color: var(--text);
  white-space: pre-wrap;
  line-height: 1.4;
  word-wrap: break-word;
}
.note-del {
  background: none;
  border: none;
  color: var(--text-soft);
  cursor: pointer;
  padding: 2px 5px;
  border-radius: 3px;
  font-size: 11px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s;
}
.note-item:hover .note-del { opacity: 1; }
.note-del:hover { background: var(--danger-soft); color: var(--danger); }
.note-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 8px;
}
.note-input-row .textarea {
  flex: 1;
  min-height: 36px;
  max-height: 80px;
  font-size: 13px;
  padding: 7px 10px;
  resize: none;
  line-height: 1.4;
}
.note-input-row .btn {
  flex-shrink: 0;
  height: 36px;
  padding: 0 14px;
  align-self: flex-start;
}
/* ============ ETİKETLER ============ */
.nav-tag {
  padding: 6px 12px !important;
  gap: 8px !important;
}
.nav-tag .tag-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.nav-tag .tag-name {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-tag .tag-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-soft);
  font-weight: 500;
}
.nav-tag.active .tag-count {
  color: var(--primary);
}

/* ============ ETİKET CHECKBOX LİSTESİ ============ */
.tag-checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-alt);
  min-height: 42px;
}
.tag-checkbox-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 8px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  background: var(--surface-2);
  transition: all 0.15s;
  user-select: none;
}
.tag-checkbox-item:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.tag-checkbox-item input[type=checkbox] {
  display: none;
}
.tag-checkbox-item.checked {
  color: white;
  border-color: transparent;
}
.tag-cb-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}
.tag-checkbox-item.checked .tag-cb-dot {
  background: rgba(255,255,255,0.6) !important;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 10px;
  color: white;
  line-height: 1.5;
}
.active-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--primary-soft);
  border: 1px solid #bfdbfe;
  border-radius: 14px;
  font-size: 12px;
  color: var(--primary);
  margin-bottom: 12px;
}
.active-filter-pill a {
  color: var(--primary);
  font-size: 14px;
  line-height: 1;
  text-decoration: none;
}

/* ============ DROP ZONE ============ */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 40px 20px;
  text-align: center;
  background: var(--surface-2);
  cursor: pointer;
  transition: all 0.15s;
}
.drop-zone:hover, .drop-zone.drag {
  border-color: var(--primary);
  background: var(--primary-soft);
}
.drop-zone .drop-icon {
  font-size: 32px;
  margin-bottom: 10px;
  color: var(--primary);
}
.drop-zone .drop-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.drop-zone .drop-hint { font-size: 12px; color: var(--text-muted); }

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 12px;
  border: 1px solid;
}
.alert-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: #a7f3d0;
}
.alert-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: #fecaca;
}
.alert-warning {
  background: var(--warning-soft);
  color: var(--warning);
  border-color: #fde68a;
}
.alert-info {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: #bfdbfe;
}
.alert ul { margin-left: 20px; margin-top: 6px; }

/* ============ WA PREVIEW ============ */
.wa-preview {
  background: #e5ddd5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40'%3E%3Ccircle cx='20' cy='20' r='1' fill='%23d4ccc3'/%3E%3C/svg%3E");
  padding: 16px;
  border-radius: var(--radius-sm);
}
.wa-bubble {
  background: #dcf8c6;
  padding: 10px 12px;
  border-radius: 8px;
  max-width: 80%;
  font-size: 13px;
  white-space: pre-wrap;
  box-shadow: 0 1px 1px rgba(0,0,0,0.1);
}
.tag-chip {
  display: inline-block;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: "SF Mono", Monaco, monospace;
  font-size: 11px;
  margin: 2px;
  cursor: pointer;
  color: var(--text);
}
.tag-chip:hover { background: var(--primary); color: white; border-color: var(--primary); }

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 36px; margin-bottom: 10px; opacity: 0.5; }
.empty-state .title { font-weight: 500; margin-bottom: 4px; }
.empty-state .sub { font-size: 12px; }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  transform: translateX(420px);
  transition: transform 0.3s ease;
  z-index: 200;
  max-width: 360px;
  border-left: 4px solid var(--primary);
}
.toast.show { transform: translateX(0); }
.toast.ok { border-left-color: var(--success); }
.toast.err { border-left-color: var(--danger); }

/* ============ MOBILE ============ */
.mobile-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  padding: 6px 10px;
  cursor: pointer;
  color: var(--text);
}

@media (max-width: 960px) {
  :root { --sidebar-width: 0px; }
  .mobile-toggle { display: inline-flex; }
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    transition: transform 0.25s ease;
    box-shadow: 0 0 30px rgba(0,0,0,0.2);
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .reminder-groups { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .form-row, .form-row.three, .form-row.four { grid-template-columns: 1fr; }
  .content { padding: 16px; }
  .topbar { padding: 12px 16px; }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 49;
  }
  .sidebar-overlay.show { display: block; }
}

@media (max-width: 520px) {
  .stat-grid { grid-template-columns: 1fr; }
  .filter-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .filter-bar button { grid-column: 1 / -1; }
  .modal { max-height: 100vh; border-radius: 0; }

  /* Mobil tablo → kart görünümü */
  .table-mobile thead { display: none; }
  .table-mobile tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    padding: 12px 14px;
    background: var(--surface);
    cursor: pointer;
  }
  .table-mobile tbody tr:active { background: var(--primary-soft); }
  .table-mobile tbody td {
    display: inline-block;
    border: none;
    padding: 2px 4px 2px 0;
    vertical-align: middle;
  }
  .table-mobile tbody td:first-child { display: block; width: 100%; padding-bottom: 6px; }
  .table-mobile tbody td:last-child  { float: right; }

  /* Mobil split panel → tek kolon */
  .split-panel { grid-template-columns: 1fr; height: auto; }
  .split-detail { display: none !important; }

  /* Topbar */
  .topbar .title { font-size: 15px; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

.modal-wide {
  max-width: 920px;
}
.modal-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.modal-col-form {
  padding: 16px 20px;
  overflow-y: auto;
  border-right: 1px solid var(--border-soft);
}
.modal-col-side {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg);
}
@media (max-width: 700px) {
  .modal-wide, .modal {
    max-width: 100%;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .modal-backdrop { padding: 0; align-items: flex-start; }
  .modal-head { flex-shrink: 0; }
  .modal-foot { flex-shrink: 0; }
  .modal-two-col {
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
  }
  .modal-col-form {
    border-right: none;
    border-bottom: 1px solid var(--border-soft);
    padding: 14px 16px;
    overflow: visible;
    flex-shrink: 0;
  }
  .modal-col-side {
    padding: 14px 16px;
    overflow: visible;
    flex-shrink: 0;
  }
}
.split-panel {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
  height: calc(100vh - 200px);
  min-height: 500px;
}
.split-list {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.split-detail {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
  gap: 10px;
  padding: 20px;
}
.detail-empty .icon { font-size: 32px; opacity: 0.4; }
.detail-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.detail-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.detail-name { font-size: 16px; font-weight: 700; }
.detail-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.detail-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border-soft);
}
.detail-info-item {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.detail-info-item:nth-child(odd) { border-right: 1px solid var(--border-soft); }
.detail-info-label { font-size: 10.5px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; }
.detail-info-value { font-size: 13px; color: var(--text); margin-top: 2px; font-weight: 500; }
.detail-section {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
}
.detail-section-title {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}
#detailNotesList {
  overflow-y: auto;
  max-height: 200px;
}
/* Aktif satır vurgusu */
tbody tr.row-active { background: var(--primary-soft) !important; }
tbody tr.row-active .cust-name { color: var(--primary); }

@media (max-width: 960px) {
  .split-panel { grid-template-columns: 1fr; height: auto; }
  .split-detail { min-height: 400px; }
}

/* ============ SMS LOG ============ */
.sms-msg-preview {
  max-width: 320px;
  cursor: default;
}
.sms-msg-preview .msg-short,
.sms-msg-preview .msg-full {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
