/* ========== Tema değişkenleri ========== */
:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #3b5bdb;
  --primary-hover: #2f49b3;
  --accent: #8b5cf6;
  --success: #16a34a;
  --warning: #f59e0b;
  --danger: #dc2626;
  --info: #0891b2;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.08), 0 4px 10px rgba(0,0,0,.04);
  --radius: 10px;
  --radius-sm: 6px;
}
[data-theme="dark"] {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #172033;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --border: #334155;
  --primary: #6d8eff;
  --primary-hover: #8aa4ff;
  --accent: #a78bfa;
  --success: #22c55e;
  --warning: #fbbf24;
  --danger: #ef4444;
  --info: #06b6d4;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 25px rgba(0,0,0,.5);
}

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

#app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

/* ========== Sidebar ========== */
.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.logo {
  width: 42px; height: 42px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.brand-title { font-weight: 700; font-size: 16px; }
.brand-sub { color: var(--muted); font-size: 12px; }

.global-search {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font-size: 13px;
  outline: none;
  margin-bottom: 16px;
}
.global-search:focus { border-color: var(--primary); }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-size: 13.5px;
  user-select: none;
}
.nav-item:hover { background: var(--panel-2); }
.nav-item.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
}
.nav-item span { font-size: 16px; }
.nav-item[draggable="true"] {
  cursor: pointer;
}
.nav-item.nav-dragging {
  opacity: 0.4;
}
.nav-item.nav-drop-above {
  box-shadow: inset 0 2px 0 0 var(--primary);
}
.nav-item.nav-drop-below {
  box-shadow: inset 0 -2px 0 0 var(--primary);
}

.sidebar-footer { display: flex; gap: 6px; padding-top: 12px; border-top: 1px solid var(--border); margin-top: 8px; }
.sidebar-footer button { flex: 1; }

.sync-status {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-top: 8px;
  border-radius: var(--radius-sm); background: var(--panel-2); font-size: 12px;
  border: 1px solid var(--border);
}
.sync-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--muted);
  flex-shrink: 0; box-shadow: 0 0 0 2px var(--panel);
}
#syncBadge { color: var(--text); font-weight: 500; }

.mobile-only { display: none; }

/* ========== Mobil (≤ 900 px) ========== */
@media (max-width: 900px) {
  /* Layout: tek kolon */
  #app { grid-template-columns: 1fr; min-height: 100dvh; min-height: 100vh; }
  body { font-size: 14px; }

  /* Sidebar: dışarıdan kayan panel */
  .sidebar {
    position: fixed; top: 0; left: 0;
    width: 86vw; max-width: 320px;
    height: 100dvh; height: 100vh;
    z-index: 70;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: var(--shadow-lg);
    padding: 16px 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-backdrop {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 60;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .sidebar-backdrop.open { opacity: 1; pointer-events: auto; }
  .mobile-only { display: inline-flex !important; align-items: center; justify-content: center; }

  /* Topbar */
  .topbar {
    padding: 10px 14px;
    gap: 8px;
    min-height: 52px;
  }
  .page-title { font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-actions { gap: 6px; flex-shrink: 0; }
  .topbar-actions .today { display: none; }
  #addQuickBtn { padding: 7px 10px; font-size: 12.5px; }

  /* Main */
  .main { padding: 0; width: 100%; min-width: 0; max-width: 100vw; overflow-x: hidden; }
  .view { padding: 14px 14px 80px; }

  /* Grids → tek kolon */
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr !important; gap: 10px; }

  /* Stat kartları */
  .stat { padding: 12px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 18px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 11px; }

  /* Card padding */
  .card { padding: 14px; }
  .card-title { font-size: 14px; margin-bottom: 10px; }

  /* Form */
  .form-grid { grid-template-columns: 1fr !important; gap: 10px; }
  .field input, .field select, .field textarea {
    font-size: 16px; /* iOS zoom önler */
    padding: 10px 12px;
  }

  /* Toolbar (filtre bar) */
  .toolbar { gap: 6px; flex-wrap: wrap; }
  .toolbar input, .toolbar select { font-size: 14px; padding: 8px 10px; flex: 1 1 auto; min-width: 120px; }
  .toolbar input[id$="Q"] { flex: 1 1 100%; }
  .toolbar .btn-primary, .toolbar .btn-secondary { padding: 9px 12px; font-size: 12.5px; }
  .toolbar .spacer { display: none; }

  /* Tablolar — yatay scroll */
  .table-wrap { border-radius: 8px; }
  table.data th, table.data td { padding: 9px 10px; font-size: 12.5px; }
  table.data th { font-size: 10.5px; }
  .row-actions { gap: 2px; }
  .btn-icon { padding: 5px 7px; font-size: 14px; }

  /* Modal — neredeyse tam ekran */
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-height: 92dvh; max-height: 92vh;
    border-radius: 14px 14px 0 0;
    width: 100%; max-width: 100%;
  }
  .modal-lg, .modal-sm { max-width: 100%; }
  .modal-header { padding: 14px 16px; }
  .modal-title { font-size: 15px; }
  .modal-body { padding: 16px; }
  .modal-footer { padding: 12px 16px; flex-wrap: wrap; }
  .modal-footer button { flex: 1 1 auto; min-width: 100px; }

  /* Toast */
  .toast-root { left: 10px; right: 10px; bottom: 10px; }
  .toast { min-width: 0; padding: 10px 14px; font-size: 13px; }

  /* Takvim */
  .cal-header { flex-wrap: wrap; gap: 8px; }
  .cal-header > div:nth-child(2) { font-size: 15px !important; flex: 1 1 100%; text-align: center; order: -1; }
  .cal-grid { gap: 2px; }
  .cal-day { min-height: 60px; padding: 4px; font-size: 11px; }
  .cal-day-num { font-size: 11px; }
  .cal-event { font-size: 9.5px; padding: 1px 3px; }
  .cal-dow { padding: 4px; font-size: 9.5px; }

  /* Buton min dokunma alanı */
  .btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
    min-height: 38px;
  }

  /* Sidebar içi düzenleme */
  .sidebar-footer button { padding: 8px 6px; font-size: 14px; }
  .nav-item { padding: 11px 12px; font-size: 14px; }

  /* Notlar grid */
  .grid-3 .note-card { margin-bottom: 0; }
}

/* Çok küçük (≤ 380 px) */
@media (max-width: 380px) {
  .topbar { padding: 8px 10px; }
  .view { padding: 12px 10px 80px; }
  #addQuickBtn { padding: 6px 8px; font-size: 11.5px; }
  #addQuickBtn::before { content: '+'; }
  #addQuickBtn { font-size: 0; }
  #addQuickBtn::before { font-size: 18px; line-height: 1; }
  .cal-day { min-height: 52px; }
}

/* ========== Main ========== */
.main { padding: 0; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.page-title { font-size: 20px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.today { color: var(--muted); font-size: 13px; }

.view { padding: 24px 28px; }

/* ========== Buttons ========== */
.btn-primary, .btn-secondary, .btn-danger, .btn-ghost, .btn-icon {
  border: 0; cursor: pointer; font-size: 13px; font-weight: 500;
  padding: 8px 14px; border-radius: var(--radius-sm);
  transition: all .15s ease;
  font-family: inherit;
}
.btn-primary {
  background: var(--primary); color: white;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(.92); }
.btn-ghost {
  background: transparent; color: var(--text); padding: 6px 10px;
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--panel-2); }
.btn-icon {
  background: transparent; padding: 4px 8px; color: var(--muted);
}
.btn-icon:hover { background: var(--panel-2); color: var(--text); }

/* ========== Cards ========== */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-title {
  font-size: 15px; font-weight: 600; margin: 0 0 12px;
  display: flex; align-items: center; justify-content: space-between;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
@media (max-width: 1100px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
/* Eski 720px breakpoint kaldırıldı — yeni 900px breakpoint'i (aşağıda) ile çakışıyordu */

/* ========== Stat tiles ========== */
.stat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  background: var(--panel-2);
}
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { font-size: 22px; font-weight: 700; }

/* ========== Tables ========== */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); }
table.data {
  width: 100%; border-collapse: collapse;
}
table.data th, table.data td {
  padding: 11px 14px; text-align: left; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
table.data th {
  background: var(--panel-2); font-weight: 600;
  position: sticky; top: 0;
  color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em;
}
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--panel-2); }

.row-actions { display: flex; gap: 4px; justify-content: flex-end; }

/* ========== Forms ========== */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }
.field input, .field select, .field textarea {
  padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text); font-family: inherit; font-size: 13.5px;
  outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.field textarea { resize: vertical; min-height: 80px; }

/* ========== Filters bar ========== */
.toolbar {
  display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap;
}
.toolbar input, .toolbar select {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text); font-size: 13px; outline: none;
}
.toolbar .spacer { flex: 1; }

/* ========== Badges ========== */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  background: var(--panel-2); color: var(--muted); border: 1px solid var(--border);
}
.badge.success { background: rgba(22,163,74,.12); color: var(--success); border-color: rgba(22,163,74,.3); }
.badge.warning { background: rgba(245,158,11,.14); color: var(--warning); border-color: rgba(245,158,11,.3); }
.badge.danger  { background: rgba(220,38,38,.12); color: var(--danger); border-color: rgba(220,38,38,.3); }
.badge.info    { background: rgba(8,145,178,.12); color: var(--info); border-color: rgba(8,145,178,.3); }
.badge.primary { background: rgba(59,91,219,.12); color: var(--primary); border-color: rgba(59,91,219,.3); }

/* ========== Modal ========== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel); border-radius: var(--radius);
  width: 100%; max-width: 720px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
}
.modal-lg { max-width: 920px; }
.modal-sm { max-width: 460px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: 0; font-size: 22px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px 22px; }
.modal-footer {
  padding: 14px 22px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ========== Toasts ========== */
.toast-root { position: fixed; bottom: 22px; right: 22px; display: flex; flex-direction: column; gap: 10px; z-index: 200; }
.toast {
  padding: 12px 18px; border-radius: var(--radius-sm); background: var(--panel);
  box-shadow: var(--shadow-lg); border-left: 4px solid var(--primary);
  min-width: 240px; animation: slideIn .25s ease;
}
.toast.success { border-color: var(--success); }
.toast.danger { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ========== Calendar ========== */
.cal-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
}
.cal-dow {
  text-align: center; padding: 8px; font-weight: 600; font-size: 11px; color: var(--muted); text-transform: uppercase;
  min-width: 0;
}
.cal-day {
  background: var(--panel); border: 1px solid var(--border); border-radius: 8px;
  min-height: 130px; padding: 8px; cursor: pointer;
  display: flex; flex-direction: column; gap: 3px;
  font-size: 12px;
  min-width: 0;
  overflow: hidden;
  transition: all .15s ease;
}
.cal-day:hover { border-color: var(--primary); box-shadow: 0 2px 6px rgba(59,91,219,.1); }
.cal-day.today { border-color: var(--primary); border-width: 2px; background: rgba(59,91,219,.06); }
.cal-day.muted { opacity: .35; }
.cal-day-num { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.cal-event {
  background: var(--primary); color: white; border-radius: 4px;
  padding: 2px 6px; font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 100%;
  box-sizing: border-box;
}
.cal-event.hearing { background: var(--primary); }
.cal-event.deadline { background: var(--danger); }
.cal-event.task { background: var(--success); }
.cal-event.workorder { background: var(--accent); }

/* ========== Empty state ========== */
.empty {
  text-align: center; padding: 50px 20px; color: var(--muted);
}
.empty-icon { font-size: 44px; margin-bottom: 10px; }

/* ========== Misc ========== */
.muted { color: var(--muted); }
.flex { display: flex; }
.flex.gap { gap: 10px; }
.flex.center { align-items: center; justify-content: center; }
.flex.between { justify-content: space-between; align-items: center; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mt-3 { margin-top: 16px; }
.text-right { text-align: right; }
.right { text-align: right; }
.small { font-size: 12px; }
.bold { font-weight: 600; }
.danger-text { color: var(--danger); }
.success-text { color: var(--success); }
.warning-text { color: var(--warning); }
.kb { font-family: monospace; background: var(--panel-2); padding: 2px 6px; border-radius: 4px; font-size: 11px; border: 1px solid var(--border); }
/* ========== Defter / Workspace ========== */
.ws-toolbar {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.ws-toolbar button { padding: 6px 10px; font-size: 13px; min-width: 36px; }
.ws-toolbar .spacer { flex: 1; }
.ws-sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }

.ws-editor {
  min-height: 60vh;
  outline: none;
  font-size: 15px;
  line-height: 1.7;
  padding: 8px 4px;
  color: var(--text);
}
.ws-editor:focus { outline: none; }
.ws-editor h1, .ws-editor h2, .ws-editor h3 { margin: 1.2em 0 .4em; line-height: 1.3; }
.ws-editor h1 { font-size: 24px; }
.ws-editor h2 { font-size: 20px; }
.ws-editor h3 { font-size: 17px; }
.ws-editor p { margin: 0.4em 0; }
.ws-editor ul, .ws-editor ol { padding-left: 24px; margin: 0.5em 0; }
.ws-editor li { margin: 3px 0; }
.ws-editor blockquote {
  border-left: 4px solid var(--primary);
  padding: 4px 14px; margin: 0.5em 0;
  background: var(--panel-2); color: var(--muted);
  border-radius: 0 6px 6px 0;
}
.ws-editor strong { font-weight: 700; }

.mention {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, rgba(59,91,219,.12), rgba(139,92,246,.12));
  color: var(--primary);
  border: 1px solid rgba(59,91,219,.3);
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  user-select: none;
  vertical-align: baseline;
  transition: all .15s ease;
  white-space: nowrap;
}
.mention:hover {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-color: transparent;
}

.ws-mention-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  user-select: none;
}
.ws-mention-item.active,
.ws-mention-item:hover {
  background: var(--panel-2);
  border-color: var(--border);
}
.ws-mi-icon { font-size: 18px; flex-shrink: 0; }
.ws-mi-label { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Inline edit (dblclick → input/select) */
td.editable {
  cursor: pointer;
  position: relative;
}
td.editable:hover {
  background: var(--panel-2);
  box-shadow: inset 0 -1px 0 0 var(--primary);
}
.inline-editor {
  width: 100%;
  padding: 6px 8px;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
}
select.inline-editor { padding: 5px 6px; }

/* Yapılacaklar - hızlı ekleme */
.task-quick {
  display: flex; gap: 8px; align-items: center;
  padding: 14px 16px; margin-bottom: 14px;
  background: linear-gradient(90deg, rgba(22,163,74,.08), rgba(8,145,178,.08));
  border: 1px solid rgba(22,163,74,.3);
  border-radius: 10px;
}
.task-quick-input {
  flex: 1;
  padding: 10px 14px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}
.task-quick-input:focus { border-color: var(--success); box-shadow: 0 0 0 3px rgba(22,163,74,.15); }
.task-quick select, .task-quick input[type="date"] {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel); color: var(--text); font-size: 13px; outline: none;
}
.task-quick button { padding: 9px 14px; }

tr.tk-row.dragging { opacity: 0.4; }
tr.tk-row.drop-before td { box-shadow: inset 0 3px 0 0 var(--primary); }
tr.tk-row.drop-after td { box-shadow: inset 0 -3px 0 0 var(--primary); }

/* Toplu aksiyon bar (cari muhasebe vs.) */
.bulk-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px;
  background: linear-gradient(90deg, rgba(59,91,219,.08), rgba(139,92,246,.08));
  border: 1px solid rgba(59,91,219,.3);
  border-radius: 8px;
}
.bulk-bar strong { color: var(--primary); }
.bulk-bar button { padding: 6px 12px; font-size: 12.5px; }
.bulk-bar .btn-ghost { margin-left: auto; }

tr.tx-selected { background: rgba(59,91,219,.06); }
tr.tx-row.dragging { opacity: 0.4; }
tr.tx-row.drop-before td { box-shadow: inset 0 3px 0 0 var(--primary); }
tr.tx-row.drop-after td { box-shadow: inset 0 -3px 0 0 var(--primary); }

/* Cari hızlı ekleme satırı */
.tx-quick {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 14px;
  background: linear-gradient(90deg, rgba(22,163,74,.06), rgba(8,145,178,.06));
  border: 1px solid rgba(22,163,74,.25);
  border-radius: 8px;
}
.tx-quick input, .tx-quick select {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel); color: var(--text); font-size: 13.5px; outline: none;
}
.tx-quick #fqDate { width: 145px; }
.tx-quick #fqType { width: 90px; }
.tx-quick #fqDesc { flex: 1; min-width: 180px; }
.tx-quick #fqAmount { width: 110px; }
.tx-quick #fqMethod { width: 130px; }
.tx-quick button { padding: 8px 14px; }
.tx-quick input:focus, .tx-quick select:focus { border-color: var(--success); }

tr.tx-month-header td {
  background: linear-gradient(90deg, rgba(59,91,219,.08), rgba(139,92,246,.04));
  padding: 12px 16px !important;
  border-top: 2px solid var(--primary);
  border-bottom: 1px solid var(--border);
}
tr.tx-month-header:first-child td { border-top: 0; }
tr.tx-month-header td > * {
  display: inline-block;
  margin-right: 18px;
  vertical-align: baseline;
}
.tx-mh-name {
  font-size: 15px; font-weight: 700;
  color: var(--primary);
}

/* Dosya Listesi - sürükle-bırak sıralama */
.drag-handle {
  display: inline-block;
  cursor: grab;
  color: var(--muted);
  font-size: 14px;
  line-height: 1;
  user-select: none;
  padding: 6px 4px;
  letter-spacing: -2px;
  font-weight: 700;
  transition: color .15s ease;
}
.drag-handle:hover { color: var(--primary); }
.drag-handle:active { cursor: grabbing; }
tr.cs-row.dragging { opacity: 0.4; }
tr.cs-row.drop-before td { box-shadow: inset 0 3px 0 0 var(--primary); }
tr.cs-row.drop-after td { box-shadow: inset 0 -3px 0 0 var(--primary); }

/* Dosya Listesi - inline ofis no editor */
.cs-ofis-input {
  width: 70px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  outline: none;
  text-align: center;
}
.cs-ofis-input:hover { background: var(--panel-2); border-color: var(--border); }
.cs-ofis-input:focus { background: var(--panel); border-color: var(--primary); }
.cs-ofis-input::placeholder { color: var(--muted); font-weight: 400; }

/* Duruşmalar tablosu - inline note textarea */
.hr-table td { vertical-align: top; }
.hr-note-input {
  width: 100%;
  min-width: 180px;
  min-height: 50px;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  resize: vertical;
  outline: none;
  line-height: 1.4;
}
.hr-note-input:focus { border-color: var(--primary); background: var(--panel); }
.hr-note-input::placeholder { color: var(--muted); font-style: italic; }

/* İş Emirleri tablosu - inline note textarea */
.wo-table td { vertical-align: top; }
.wo-note-input {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  outline: none;
  line-height: 1.5;
}
.wo-note-input:focus { border-color: var(--primary); background: var(--panel); }
.wo-note-input::placeholder { color: var(--muted); font-style: italic; }

/* ========== Asistan (Chat) ========== */
.chat-container {
  display: flex; flex-direction: column;
  height: calc(100vh - 130px);
  max-height: 800px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.chat-welcome {
  text-align: center; padding: 30px 20px;
}
.chat-welcome-icon { font-size: 48px; margin-bottom: 8px; }
.chat-welcome h2 { margin: 8px 0; font-size: 22px; }
.chat-welcome p { margin-bottom: 18px; }
.chat-examples {
  display: grid; gap: 8px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  margin-top: 14px;
  text-align: left;
}
.chat-example {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  text-align: left;
  transition: all .15s ease;
}
.chat-example:hover {
  background: var(--primary); color: white; border-color: var(--primary);
  transform: translateY(-1px);
}
.chat-msg {
  display: flex; flex-direction: column; gap: 4px;
  max-width: 85%;
}
.chat-msg.user {
  align-self: flex-end; align-items: flex-end;
}
.chat-msg.assistant {
  align-self: flex-start; align-items: flex-start;
}
.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-msg.user .chat-bubble {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant .chat-bubble {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-action {
  padding: 0 4px;
  font-size: 11.5px;
}
.chat-action a {
  color: var(--primary); text-decoration: none; font-weight: 600;
}
.chat-action a:hover { text-decoration: underline; }
.chat-input-wrap {
  display: flex; gap: 8px; align-items: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--panel);
}
.chat-input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: none;
  outline: none;
  max-height: 140px;
}
.chat-input:focus { border-color: var(--primary); background: var(--panel); }
.chat-input-wrap button { padding: 10px 16px; font-size: 16px; }

/* ========== Ajanda (günlük plan) ========== */
.agenda-header {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: linear-gradient(135deg, rgba(59,91,219,.08), rgba(139,92,246,.08));
  border: 1px solid rgba(59,91,219,.2);
  border-radius: 12px;
}
.agenda-nav {
  display: flex; align-items: center; gap: 14px;
  flex: 1; min-width: 0;
}
.agenda-nav-arrow {
  width: 44px; height: 44px;
  font-size: 22px; font-weight: 700;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all .15s ease;
}
.agenda-nav-arrow:hover {
  background: var(--primary); color: white; border-color: var(--primary);
  transform: scale(1.05);
}
.agenda-nav-arrow:active { transform: scale(0.96); }
.agenda-title {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.agenda-day {
  font-size: 19px; font-weight: 700; color: var(--text);
  text-align: center;
}
.agenda-date {
  padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel); color: var(--muted); font-size: 12px;
  font-family: inherit; cursor: pointer;
}
.agenda-quicknav {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.agenda-quicknav button { padding: 6px 10px; font-size: 12.5px; }

.agenda-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.agenda-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.ag-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.ag-card-head {
  font-size: 14px; font-weight: 600;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.ag-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.ag-row:last-child { border-bottom: 0; }
.ag-row.done-row { opacity: 0.5; }
.ag-row.done-row .ag-body strong { text-decoration: line-through; }
.ag-row.overdue-row { background: rgba(220,38,38,.05); margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 6px; border-bottom-style: solid; }
.ag-time {
  flex-shrink: 0; min-width: 70px;
  font-weight: 600; color: var(--muted);
  font-size: 12px;
}
.ag-body { flex: 1; min-width: 0; }
.ag-body strong { font-weight: 600; font-size: 13.5px; }
.ag-amount { flex-shrink: 0; }

.ag-quick {
  display: flex; gap: 6px; align-items: center;
  margin-bottom: 10px;
}
.ag-quick input, .ag-quick select {
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--panel-2); color: var(--text); font-size: 13px; outline: none;
}
.ag-quick input[id="agQTitle"] { flex: 1; }
.ag-quick button { padding: 7px 12px; }

.ag-note {
  width: 100%;
  min-height: 140px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  box-sizing: border-box;
}
.ag-note:focus { border-color: var(--primary); background: var(--panel); }
.ag-note-large {
  min-height: 320px;
  font-size: 14.5px;
  line-height: 1.7;
  padding: 16px 18px;
}
.ag-note-card {
  padding: 16px 20px;
}
.ag-card-head .btn-ghost.small {
  padding: 3px 8px; font-size: 11.5px; margin-left: auto;
}

.ag-receivables { background: linear-gradient(180deg, rgba(245,158,11,.04), transparent); }

.ag-archive {
  margin-top: 10px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
}
.ag-archive summary {
  cursor: pointer;
  padding: 4px 0;
  user-select: none;
  list-style: none;
}
.ag-archive summary:hover { color: var(--text); }
.ag-archive summary::before {
  content: '▸ ';
  display: inline-block;
  transition: transform .15s ease;
}
.ag-archive[open] summary::before { transform: rotate(90deg); }
.ag-archive .ag-row { opacity: 0.65; }
.ag-archive .ag-row strong { text-decoration: line-through; color: var(--muted); }

@media (max-width: 900px) {
  .agenda-grid { grid-template-columns: 1fr; }
  .agenda-header { flex-direction: column; align-items: flex-start; }
  .ag-time { min-width: 60px; }
}

/* ========== Notlar — Klasör Layout (Minimalist) ========== */
.notes-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 18px;
  align-items: start;
}
.folder-list {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 8px;
  position: sticky;
  top: 80px;
}
.folder-section-title {
  padding: 4px 10px 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.folder-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  user-select: none;
  position: relative;
  margin-bottom: 2px;
  border: 1px solid transparent;
  transition: all .15s ease;
}
.folder-item:hover {
  background: var(--panel-2);
  border-color: var(--border);
}
.folder-item.active {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: white;
  border-color: transparent;
}
.folder-item.active .folder-count {
  background: rgba(255,255,255,.25);
  color: white;
}
.folder-icon { font-size: 16px; flex-shrink: 0; }
.folder-name {
  flex: 1; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.folder-count {
  background: var(--panel-2);
  color: var(--muted);
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}
.folder-edit {
  border: 0; background: transparent;
  color: inherit; opacity: 0;
  cursor: pointer;
  font-size: 16px; padding: 0 6px;
  line-height: 1;
  transition: opacity .15s;
  letter-spacing: 1px;
}
.folder-item:hover .folder-edit { opacity: 0.5; }
.folder-item:hover .folder-edit:hover { opacity: 1; }
.folder-item.active .folder-edit { color: white; }

.folder-add-btn {
  width: 100%;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted);
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
  margin-top: 8px;
  font-size: 12.5px;
  font-family: inherit;
  font-weight: 500;
  transition: all .15s ease;
}
.folder-add-btn:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: rgba(59,91,219,.04);
}

.notes-content {
  min-width: 0;
}
.notes-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 18px; flex-wrap: wrap;
}
.notes-title {
  margin: 0; font-size: 22px; font-weight: 700;
  display: flex; align-items: baseline; gap: 8px;
}
.notes-title .muted { font-weight: 500; font-size: 14px; }
.notes-header-actions {
  display: flex; gap: 8px; flex: 1; justify-content: flex-end; min-width: 0;
}
.notes-header-actions input {
  padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--panel); color: var(--text); font-size: 13.5px; outline: none;
  min-width: 220px;
}
.notes-header-actions input:focus { border-color: var(--primary); }

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.note-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all .2s ease;
  display: flex;
  flex-direction: column;
  min-height: 140px;
}
.note-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(59,91,219,.12);
  transform: translateY(-1px);
}
.note-card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.note-card h4 {
  margin: 0; font-size: 14.5px; font-weight: 600;
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-card .body {
  font-size: 12.5px; color: var(--muted);
  white-space: pre-wrap;
  display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  line-height: 1.5;
}
.note-card-meta {
  display: flex; flex-wrap: wrap; gap: 4px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  align-items: center;
}
.note-card-meta .badge { font-size: 10.5px; padding: 2px 7px; }
.note-card-meta .note-date {
  margin-left: auto; color: var(--muted); font-size: 11px;
}
.note-del { opacity: 0; transition: opacity .15s; }
.note-card:hover .note-del { opacity: 0.7; }
.note-del:hover { opacity: 1 !important; }

@media (max-width: 900px) {
  .notes-layout { grid-template-columns: 1fr; }
  .folder-list { position: static; }
  .notes-header-actions input { min-width: 0; flex: 1; }
}


.due-soon { color: var(--warning); font-weight: 600; }
.due-today { color: var(--danger); font-weight: 600; }
.overdue { color: var(--danger); font-weight: 700; }
