/* ============================================
   Niyazibey CRM — Ana Stil Dosyası
   ============================================ */

:root {
  --bg: #f8f7f4;
  --surface: #ffffff;
  --surface2: #f2f0eb;
  --border: #e5e2d9;
  --border2: #d0ccc0;
  --text: #1a1a18;
  --text2: #6b6860;
  --text3: #9e9b94;
  --green: #1D9E75;
  --green-bg: #EAF6F0;
  --blue: #185FA5;
  --blue-bg: #E6F1FB;
  --red: #A32D2D;
  --red-bg: #FCEBEB;
  --amber: #854F0B;
  --amber-bg: #FAEEDA;
  --gold: #C8962E;
  --gold-light: #E8B84B;
  --brown: #4A2C0A;
  --brown2: #7A4A1A;
  --sidebar-w: 220px;
  --topnav-h: 48px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: var(--bg); color: var(--text); height: 100vh; overflow: hidden; font-size: 14px; }
.hidden { display: none !important; }

/* LOGIN */
.login-screen { position: fixed; inset: 0; background: var(--brown); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.login-box { background: var(--surface); border-radius: 16px; padding: 48px 40px; width: 360px; text-align: center; }
.login-logo { font-size: 22px; font-weight: 700; color: var(--brown); }
.login-sub { font-size: 12px; color: var(--text3); margin-bottom: 28px; margin-top: 4px; }
.login-box input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; margin-bottom: 10px; outline: none; background: var(--surface2); transition: border 0.2s; }
.login-box input:focus { border-color: var(--gold); }
.login-box button { width: 100%; padding: 12px; background: var(--brown); color: #fff; border: none; border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer; }
.login-box button:hover { background: var(--brown2); }
.login-err { color: var(--red); font-size: 12px; margin-top: 8px; min-height: 18px; }

/* APP LAYOUT */
.app { display: flex; flex-direction: column; height: 100vh; }
.workspace { display: flex; flex: 1; overflow: hidden; }

/* TOP NAV */
.topnav { height: var(--topnav-h); background: var(--brown); display: flex; align-items: center; padding: 0 16px; gap: 16px; border-bottom: 2px solid var(--gold); flex-shrink: 0; }
.brand { font-size: 14px; font-weight: 700; color: var(--gold-light); min-width: 180px; }
.brand small { display: block; font-size: 9px; font-weight: 400; color: rgba(255,255,255,0.4); text-transform: uppercase; letter-spacing: 0.05em; }
.topnav-center { flex: 1; display: flex; justify-content: center; }
.global-search { background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: 8px; padding: 7px 14px; font-size: 13px; color: rgba(255,255,255,0.7); width: 300px; outline: none; }
.global-search::placeholder { color: rgba(255,255,255,0.4); }
.global-search:focus { background: rgba(255,255,255,0.15); border-color: var(--gold); }
.topnav-right { display: flex; align-items: center; gap: 10px; }
.ai-badge { display: flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer; border: 1px solid; transition: all 0.2s; }
.ai-badge.ai-on { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.ai-badge.ai-off { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.5); border-color: rgba(255,255,255,0.2); }
.ai-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ai-badge.ai-on .ai-dot { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:0.3} }
.notif-btn { position: relative; width: 34px; height: 34px; border-radius: 8px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; }
.notif-dot { position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: #E24B4A; border: 1.5px solid var(--brown); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 5px 12px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.2); border-radius: 20px; cursor: pointer; }
.user-av { width: 26px; height: 26px; border-radius: 50%; background: var(--gold); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: var(--brown); }
.chip-name { font-size: 12px; color: rgba(255,255,255,0.85); font-weight: 500; }
.chip-role { font-size: 10px; color: rgba(255,255,255,0.4); }

/* SIDEBAR */
.sidebar { width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; overflow-y: auto; }
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-section { padding: 14px 14px 4px; font-size: 9px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.08em; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 8px 14px; cursor: pointer; font-size: 13px; color: var(--text2); border-left: 2px solid transparent; transition: all 0.12s; }
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--surface2); color: var(--brown); font-weight: 600; border-left-color: var(--gold); }
.nav-item.disabled { color: var(--text3); cursor: default; }
.nav-item.disabled:hover { background: none; }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }
.nav-badge { margin-left: auto; background: var(--red-bg); color: var(--red); font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; }
.nav-soon { margin-left: auto; font-size: 9px; color: var(--text3); background: var(--surface2); padding: 2px 6px; border-radius: 10px; }
.nav-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-left: auto; }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); }
.online-users { display: flex; flex-direction: column; gap: 6px; }
.online-user-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.online-av { width: 26px; height: 26px; border-radius: 50%; background: var(--brown); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--gold-light); }
.online-badge { font-size: 9px; padding: 1px 6px; border-radius: 8px; margin-left: auto; }
.online-badge.on { background: var(--green-bg); color: var(--green); }
.online-badge.off { background: var(--surface2); color: var(--text3); }

/* MAIN CONTENT */
.main-content { flex: 1; overflow: hidden; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
/* Mesajlar sayfası iç scroll (liste + sohbet) kendi alanlarında kalsın */
#page-messages.page { overflow: hidden; min-height: 0; }
/* Diğer sayfalar: fare tekerleği ana içerikte çalışsın */
.page:not(#page-messages) { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.page { flex: 1; display: flex; flex-direction: column; }
.page.hidden { display: none; }

/* PAGE TABS */
.page-tabs { height: 42px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; gap: 2px; flex-shrink: 0; }
.ptab { padding: 5px 14px; border-radius: 6px; font-size: 12px; color: var(--text2); cursor: pointer; transition: all 0.12s; }
.ptab:hover { background: var(--surface2); }
.ptab.active { background: var(--brown); color: #fff; font-weight: 600; }
.ptab.passive { color: var(--text3); font-style: italic; cursor: default; }
.ptab-sep { width: 1px; height: 18px; background: var(--border); margin: 0 6px; }
.tab-count { font-size: 10px; background: rgba(255,255,255,0.2); padding: 1px 5px; border-radius: 8px; margin-left: 3px; }
.page-actions { margin-left: auto; display: flex; gap: 8px; }
.page-header { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.page-header h2 { font-size: 18px; font-weight: 600; }

/* THREE COLUMN */
.three-col { display: flex; flex: 1; overflow: hidden; }
.col-list { width: 260px; border-right: 1px solid var(--border); display: flex; flex-direction: column; flex-shrink: 0; }
.col-search { padding: 10px; border-bottom: 1px solid var(--border); }
.col-search input { width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; background: var(--surface2); outline: none; }
.col-search-wrap { position: relative; padding: 10px; border-bottom: 1px solid var(--border); }
.col-search-wrap input { width: 100%; padding: 7px 30px 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 12px; background: var(--surface2); outline: none; box-sizing: border-box; }
.col-search-clear {
  position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  width: 24px; height: 24px; border: none; background: transparent; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--text3); border-radius: 4px;
  display: none; align-items: center; justify-content: center; padding: 0;
}
.col-search-clear:hover { background: var(--border); color: var(--text); }
.col-search-clear.visible { display: flex; }
.filter-chips { padding: 6px 10px; border-bottom: 1px solid var(--border); display: flex; gap: 4px; flex-wrap: wrap; }
.chip { font-size: 10px; padding: 3px 8px; border-radius: 10px; border: 1px solid var(--border); cursor: pointer; color: var(--text2); background: var(--surface); transition: all 0.12s; }
.chip:hover { border-color: var(--gold); }
.chip.on { background: var(--blue-bg); color: var(--blue); border-color: var(--blue); }
.chip.red { border-color: var(--red); color: var(--red); }
.chip.red.on { background: var(--red-bg); }
.list-items { flex: 1; overflow-y: auto; }
.col-chat { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.col-detail { width: 240px; border-left: 1px solid var(--border); overflow-y: auto; background: var(--surface); flex-shrink: 0; }
.detail-empty { padding: 20px; color: var(--text3); font-size: 13px; }

/* TICKET LIST ITEM */
.ticket-item { padding: 11px 14px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background 0.1s; border-left: 2px solid transparent; }
.ticket-item:hover { background: var(--surface2); }
.ticket-item.active { background: var(--surface2); border-left-color: var(--gold); }
.ti-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 3px; }
.ti-name-block { flex: 1; min-width: 0; }
.ti-name { font-size: 13px; font-weight: 600; color: var(--text); }
.ti-phone { font-size: 10px; color: var(--text3); font-weight: 400; margin-top: 2px; }
.ti-time { font-size: 10px; color: var(--text3); }
.ti-msg { font-size: 11px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 5px; }
.ti-tags { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.tag { font-size: 10px; padding: 1px 7px; border-radius: 10px; font-weight: 500; }
.t-satis { background: #EAF3DE; color: #3B6D11; }
.t-kargo { background: #E6F1FB; color: #185FA5; }
.t-sla { background: #FCEBEB; color: #A32D2D; }
.t-vip { background: #FAEEDA; color: #854F0B; }
.t-ai { background: #EEEDFE; color: #534AB7; }
.t-open { background: var(--blue-bg); color: var(--blue); }
.t-resolved { background: var(--green-bg); color: var(--green); }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: #E24B4A; margin-left: auto; flex-shrink: 0; }
.unread-count {
  margin-left: auto;
  flex-shrink: 0;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: #E24B4A;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.msg-media { margin-top: 8px; max-width: 100%; }
.msg-media-img { max-width: min(280px, 100%); max-height: 220px; border-radius: 10px; display: block; border: 1px solid var(--border2); object-fit: cover; }
.msg-media-video { max-width: min(280px, 100%); max-height: 240px; border-radius: 10px; border: 1px solid var(--border2); }
.msg-media-audio { width: min(280px, 100%); margin-top: 4px; }
.msg-doc-link { font-size: 12px; color: var(--blue); word-break: break-all; }
.msg-loc { font-size: 12px; color: var(--text2); }
.msg-loc-txt { margin-top: 6px; white-space: pre-wrap; word-break: break-word; }
.msg-extra-meta { margin-top: 8px; font-size: 10px; color: var(--text3); line-height: 1.35; font-family: ui-monospace, Menlo, monospace; }

/* CHAT */
.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text3); font-size: 14px; }
.chat-empty-icon { font-size: 48px; }
.chat-header { padding: 10px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; background: var(--surface); flex-shrink: 0; }
.chat-av { width: 36px; height: 36px; border-radius: 50%; background: var(--brown); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--gold-light); flex-shrink: 0; }
.chat-info .cname { font-size: 14px; font-weight: 600; }
.chat-info .cphone { font-size: 11px; color: var(--text2); }
.chat-hbtns { margin-left: auto; display: flex; gap: 6px; }
.messages-area { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.msg-row { display: flex; flex-direction: column; }
.msg-row.out { align-items: flex-end; }
.bubble { max-width: 72%; padding: 9px 13px; font-size: 13px; line-height: 1.55; word-break: break-word; }
.b-in { background: var(--surface); border: 1px solid var(--border); border-radius: 2px 12px 12px 12px; }
.b-out { background: var(--brown); color: #fff; border-radius: 12px 2px 12px 12px; }
.b-ai { background: #EEEDFE; border: 1px solid #AFA9EC; border-radius: 12px; color: #3C3489; }
.b-whisper { background: #FAEEDA; border: 1px dashed #EF9F27; border-radius: 12px; color: #633806; }
.b-note { background: #FFF9E6; border: 1px dashed var(--border2); border-radius: 12px; color: var(--text2); font-style: italic; }
.msg-meta { font-size: 10px; color: var(--text3); margin-top: 3px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.msg-row.out .wa-tick { font-size: 11px; letter-spacing: -2px; }
.msg-row.out .wa-tick.sent { opacity: 0.85; }
.msg-row.out .wa-tick.deliv { color: rgba(255,255,255,0.75); }
.msg-row.out .wa-tick.read { color: #a8e6ff; }
.meta-who { font-weight: 600; color: var(--text2); }
.meta-badge { font-size: 9px; padding: 1px 5px; border-radius: 8px; }
.mb-ai { background: #EEEDFE; color: #534AB7; }
.mb-whisper { background: #FAEEDA; color: #854F0B; }
.mb-note { background: #FFF9E6; color: #856404; }
.date-sep { text-align: center; font-size: 10px; color: var(--text3); padding: 4px 0; }

/* SETTINGS — sabit kaydet */
.settings-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  margin-top: 16px;
  background: linear-gradient(to top, var(--surface) 70%, transparent);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  z-index: 5;
}
.btn-save-fixed {
  min-width: 140px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

/* CHAT INPUT */
.chat-input-area { padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.input-mode-tabs { display: flex; gap: 3px; margin-bottom: 8px; }
.imt { font-size: 11px; padding: 4px 12px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; color: var(--text2); background: var(--surface); transition: all 0.12s; }
.imt:hover { background: var(--surface2); }
.imt.active { background: var(--brown); color: #fff; border-color: var(--brown); }
.imt.whisper-tab { border-color: var(--amber); color: var(--amber); }
.imt.whisper-tab.active { background: var(--amber-bg); color: var(--amber); border-color: var(--amber); }
.imt.note-tab { border-color: #856404; color: #856404; }
.imt.note-tab.active { background: #FFF9E6; color: #856404; }
.quick-tpls { display: flex; gap: 6px; margin-bottom: 8px; overflow-x: auto; padding-bottom: 2px; }
.qtpl { font-size: 11px; padding: 4px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text2); white-space: nowrap; flex-shrink: 0; }
.qtpl:hover { border-color: var(--gold); background: var(--surface2); }
.chat-textarea { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 13px; resize: none; background: var(--surface2); color: var(--text); height: 58px; outline: none; font-family: inherit; line-height: 1.5; }
.chat-textarea:focus { border-color: var(--gold); }
.input-actions { display: flex; gap: 6px; margin-top: 8px; align-items: center; }

/* RIGHT DETAIL PANEL */
.rp-section { padding: 14px; border-bottom: 1px solid var(--border); }
.rp-title { font-size: 10px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; }
.rp-title a { font-size: 11px; color: var(--blue); font-weight: 400; text-transform: none; letter-spacing: 0; cursor: pointer; }
.info-row { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; }
.info-label { color: var(--text3); }
.info-val { color: var(--text); font-weight: 500; text-align: right; }
.ltv-card { background: var(--green-bg); border: 1px solid var(--green); border-radius: 8px; padding: 10px; margin: 8px 0; text-align: center; }
.ltv-amount { font-size: 20px; font-weight: 700; color: var(--green); }
.ltv-label { font-size: 10px; color: var(--green); }
.vip-badge { display: inline-block; background: var(--amber-bg); color: var(--amber); font-size: 10px; font-weight: 700; padding: 2px 10px; border-radius: 10px; }
.sla-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; margin-bottom: 6px; }
.sla-time { font-weight: 700; font-size: 16px; }
.sla-time.danger { color: var(--red); }
.sla-bar { height: 5px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.sla-fill { height: 100%; background: var(--green); border-radius: 3px; transition: width 0.3s; }
.sla-fill.warn { background: var(--amber); }
.sla-fill.danger { background: var(--red); }
.status-badge { font-size: 10px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.sb-open { background: var(--blue-bg); color: var(--blue); }
.sb-high { background: var(--red-bg); color: var(--red); }
.sb-resolved { background: var(--green-bg); color: var(--green); }
.order-mini { background: var(--surface2); border-radius: 8px; padding: 10px; margin-top: 6px; }

/* BUTTONS */
.btn { padding: 6px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text2); font-size: 13px; font-weight: 500; cursor: pointer; transition: all 0.12s; }
.btn:hover { background: var(--surface2); }
.btn-primary { background: var(--brown); color: #fff; border-color: var(--brown); }
.btn-primary:hover { background: var(--brown2); }
.btn-sm { font-size: 11px; padding: 4px 10px; }
.btn-success { background: var(--green); color: #fff; border-color: var(--green); }
.btn-danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover { filter: brightness(0.95); }
.btn-send { background: var(--brown); color: #fff; border-color: var(--brown); font-weight: 600; }
.btn-send:hover { background: var(--brown2); }

/* TABLES */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { text-align: left; padding: 10px 14px; background: var(--surface2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text2); border-bottom: 1px solid var(--border); }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: var(--surface2); }
.data-table tr:last-child td { border-bottom: none; }

/* Otomasyon kuralları tablosu — aksiyon sütunu ve kaydırma */
.automation-rules-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.data-table.auto-rules-table { min-width: 720px; }
.data-table.auto-rules-table th:last-child,
.data-table.auto-rules-table td:last-child {
  min-width: 148px;
  white-space: normal;
}
.data-table.auto-rules-table .auto-rule-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.data-table.auto-rules-table .auto-rule-actions .btn {
  min-height: 32px;
  box-shadow: 0 1px 0 rgba(0,0,0,0.06);
}
.data-table.auto-rules-table td .rule-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.data-table.auto-rules-table td .rule-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--brown);
  cursor: pointer;
}
.table-wrap { overflow: auto; flex: 1; padding: 16px 20px; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text2); display: block; margin-bottom: 6px; }
.form-input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; background: var(--surface); color: var(--text); transition: border 0.2s; font-family: inherit; }
.form-input:focus { border-color: var(--gold); }
select.form-input { cursor: pointer; }
textarea.form-input { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* MODAL */
.modal-overlay { position: fixed; inset: 0; background: rgba(74,44,10,0.4); display: flex; align-items: center; justify-content: center; z-index: 500; padding: 12px; box-sizing: border-box; }
.modal-box { background: var(--surface); border-radius: 16px; width: 520px; max-width: min(520px, 100%); max-height: min(90vh, 900px); min-height: 0; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.2); }
.modal-box.modal-wide { width: min(780px, 100%); max-width: min(780px, 100%); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; flex-shrink: 0; }
.modal-title { font-size: 16px; font-weight: 700; color: var(--text); }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text3); padding: 4px 8px; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 16px 20px; overflow-y: auto; flex: 1 1 auto; min-height: 0; color: var(--text); }
.modal-body.modal-body--tall { max-height: calc(90vh - 140px); }
.modal-body input[type="checkbox"],
.modal-body input[type="radio"] { width: 17px; height: 17px; flex-shrink: 0; margin: 0; accent-color: var(--brown); cursor: pointer; }
.modal-body label { color: var(--text); cursor: pointer; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; flex-shrink: 0; background: var(--surface); position: relative; z-index: 2; }
.modal-footer .btn { min-height: 38px; padding: 8px 16px; }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 16px 20px; }
.stat-card { background: var(--surface); border-radius: 12px; padding: 18px; border-bottom: 3px solid var(--gold); }
.stat-label { font-size: 11px; color: var(--text2); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.stat-value { font-size: 32px; font-weight: 700; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--text3); margin-top: 4px; }

/* TOAST */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--brown); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 13px; font-weight: 500; animation: slideIn 0.3s ease; max-width: 300px; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--blue); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* SLA ALARM */
.sla-alarm { position: fixed; top: 60px; right: 20px; background: var(--red-bg); border: 1px solid var(--red); color: var(--red); padding: 12px 18px; border-radius: 10px; font-size: 13px; font-weight: 600; z-index: 400; cursor: pointer; animation: shake 0.5s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)}25%{transform:translateX(-5px)}75%{transform:translateX(5px)} }

/* SEARCH INPUT */
.search-input { padding: 8px 14px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; outline: none; background: var(--surface); min-width: 240px; }
.search-input:focus { border-color: var(--gold); }

/* LOADING */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; color: var(--text3); }
.spinner { width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.7s linear infinite; margin-right: 10px; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 40px; color: var(--text3); }

/* SETTINGS TABS */
.settings-tabs { display: flex; gap: 4px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.stab { padding: 7px 16px; border-radius: 8px; font-size: 13px; cursor: pointer; color: var(--text2); border: 1px solid var(--border); }
.stab:hover { background: var(--surface2); }
.stab.active { background: var(--brown); color: #fff; border-color: var(--brown); font-weight: 600; }
.settings-body { padding: 24px; overflow-y: auto; flex: 1; max-width: min(1040px, 100%); width: 100%; box-sizing: border-box; min-height: 0; }

/* Ayarlar sayfası — otomasyon tablosu kaydırılabilir, kaydet şeridi sabit */
#page-settings.page { min-height: 0; }
#page-settings #settingsContent {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
#page-settings .settings-tabs { flex-shrink: 0; }

/* Chat layout fix */
.col-chat { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
#chatWindow { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
#messagesArea { flex: 1 1 auto; overflow-y: auto; padding: 16px; min-height: 0; }
#chatInputArea { flex: 0 0 auto; border-top: 1px solid var(--border); padding: 12px; background: var(--bg); }

/* TRENDYOL */
.trendyol-layout { display: flex; flex-direction: column; gap: 16px; padding: 0 20px 24px; }
.card-panel.trendyol-settings { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.trendyol-h3 { font-size: 15px; margin: 0 0 8px; font-weight: 600; }
.trendyol-hint { font-size: 12px; color: var(--text3); margin: 0 0 12px; line-height: 1.45; }
.trendyol-options-grid { display: flex; flex-wrap: wrap; gap: 12px 20px; margin-bottom: 12px; }
.trendyol-options-grid .chk { font-size: 13px; display: flex; align-items: center; gap: 6px; cursor: pointer; }
.form-row-ty { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.trendyol-actions { display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.trendyol-tabs { flex-wrap: wrap; align-items: center; gap: 8px; }
.ty-select { max-width: 200px; font-size: 12px; padding: 6px 10px; }
.ty-list { display: flex; flex-direction: column; gap: 12px; min-height: 120px; }
.ty-card { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: var(--surface); }
.ty-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; font-size: 11px; color: var(--text3); }
.ty-id { font-weight: 700; color: var(--text); }
.ty-st { background: var(--blue-bg); color: var(--blue); padding: 2px 8px; border-radius: 6px; font-size: 10px; }
.ty-product { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }
.ty-q { font-size: 13px; line-height: 1.45; color: var(--text); white-space: pre-wrap; }
.ty-ans { margin-top: 8px; font-size: 12px; color: var(--text2); }
.ty-label { font-weight: 600; color: var(--text3); }
.ty-meta { margin-top: 8px; font-size: 11px; color: var(--text3); }
.ty-meta a { color: var(--blue); }
.ty-actions { margin-top: 10px; }
.ty-pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 12px 0; flex-wrap: wrap; }
.ty-page-info { font-size: 12px; color: var(--text3); }
.ty-footnote { margin-top: 12px; padding: 10px; background: var(--surface2); border-radius: 8px; }
.ty-ai-assist { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.ty-ai-assist .trendyol-hint { margin: 0; }
.ty-kb-list { display: grid; gap: 10px; }
.ty-kb-item { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.ty-kb-title { font-size: 13px; font-weight: 600; color: var(--text); display: flex; gap: 8px; align-items: baseline; }
.ty-kb-title small { font-size: 10px; color: var(--text3); text-transform: uppercase; }
.ty-kb-prod { font-size: 11px; color: var(--text3); margin-top: 2px; }
.ty-kb-content { margin-top: 6px; font-size: 12px; color: var(--text2); line-height: 1.45; white-space: pre-wrap; }
.ty-kb-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ty-kb-tags span { font-size: 10px; border: 1px solid var(--border); border-radius: 10px; padding: 2px 8px; color: var(--text3); }
.ty-kb-acts { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; }

/* Facebook & Instagram yorum listesi */
.ty-list .ty-q {
  display: block; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px;
  background: var(--surface);
}
.ty-q-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ty-q-meta { font-size: 12px; color: var(--text2); }
.ty-q-meta .muted { color: var(--text3); }
.ty-q-meta a { color: var(--blue); text-decoration: none; }
.ty-q-body { font-size: 13px; line-height: 1.45; color: var(--text); white-space: pre-wrap; margin-top: 4px; }
.ty-q-answer { margin-top: 8px; padding: 8px 10px; background: var(--green-bg, #e8f5e9); border-radius: 6px; font-size: 12px; color: var(--text2); }
.ty-qa-draft { margin-top: 8px; padding: 8px 10px; background: var(--surface2); border-left: 3px solid var(--blue); border-radius: 4px; font-size: 12px; color: var(--text2); white-space: pre-wrap; }
.ty-q-actions { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.ty-q-actions textarea.form-input { width: 100%; resize: vertical; min-height: 48px; }
.ty-q-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.ty-pager-info { font-size: 12px; color: var(--text3); }

.pill { display: inline-block; padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 600; }
.pill-ok { background: var(--green-bg, #e8f5e9); color: var(--green, #2e7d32); }
.pill-warn { background: var(--yellow-bg, #fff8e1); color: var(--orange, #f57c00); }
.pill-err { background: var(--red-bg, #ffebee); color: var(--red, #c62828); }
.pill-gray { background: var(--surface2); color: var(--text3); }

