/* TehProf.kz Support — Design System v2 */
/* Clean, professional, comfortable for daily use */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

/* ═══ Light theme (default) ═══ */
:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-hover: #f8f9fb;
  --border: #dce1e6;
  --border-light: #ebeef1;
  --text: #1a1d21;
  --text-secondary: #555e68;
  --text-muted: #8c939b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37,99,235,0.07);
  --accent-text: #ffffff;
  --success: #16a34a;
  --success-bg: rgba(22,163,74,0.08);
  --warning: #ca8a04;
  --warning-bg: rgba(202,138,4,0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220,38,38,0.06);
  --info: #0284c7;
  --info-bg: rgba(2,132,199,0.07);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --header-bg: rgba(255,255,255,0.92);
  --header-border: var(--border-light);
  --input-bg: var(--surface);
  --badge-text: #fff;
}

/* ═══ Dark theme ═══ */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1115;
    --surface: #1a1d23;
    --surface-hover: #22262d;
    --border: #2d3139;
    --border-light: #23272e;
    --text: #e8eaed;
    --text-secondary: #adb3bc;
    --text-muted: #6e7681;
    --accent: #5b9cf6;
    --accent-hover: #7db4ff;
    --accent-light: rgba(91,156,246,0.1);
    --accent-text: #0f1115;
    --success: #4ade80;
    --success-bg: rgba(74,222,128,0.1);
    --warning: #facc15;
    --warning-bg: rgba(250,204,21,0.1);
    --danger: #f87171;
    --danger-bg: rgba(248,113,113,0.08);
    --info: #38bdf8;
    --info-bg: rgba(56,189,248,0.1);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
    --header-bg: rgba(15,17,21,0.92);
    --header-border: var(--border-light);
    --input-bg: #15171c;
  }
}

[data-theme="dark"] {
  --bg: #0f1115;
  --surface: #1a1d23;
  --surface-hover: #22262d;
  --border: #2d3139;
  --border-light: #23272e;
  --text: #e8eaed;
  --text-secondary: #adb3bc;
  --text-muted: #6e7681;
  --accent: #5b9cf6;
  --accent-hover: #7db4ff;
  --accent-light: rgba(91,156,246,0.1);
  --accent-text: #0f1115;
  --success: #4ade80;
  --success-bg: rgba(74,222,128,0.1);
  --warning: #facc15;
  --warning-bg: rgba(250,204,21,0.1);
  --danger: #f87171;
  --danger-bg: rgba(248,113,113,0.08);
  --info: #38bdf8;
  --info-bg: rgba(56,189,248,0.1);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5);
  --header-bg: rgba(15,17,21,0.92);
  --header-border: var(--border-light);
  --input-bg: #15171c;
}

[data-theme="light"] {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-hover: #f8f9fb;
  --border: #dce1e6;
  --border-light: #ebeef1;
  --text: #1a1d21;
  --text-secondary: #555e68;
  --text-muted: #8c939b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: rgba(37,99,235,0.07);
  --accent-text: #ffffff;
  --success: #16a34a;
  --success-bg: rgba(22,163,74,0.08);
  --warning: #ca8a04;
  --warning-bg: rgba(202,138,4,0.08);
  --danger: #dc2626;
  --danger-bg: rgba(220,38,38,0.06);
  --info: #0284c7;
  --info-bg: rgba(2,132,199,0.07);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
  --header-bg: rgba(255,255,255,0.92);
  --header-border: var(--border-light);
  --input-bg: var(--surface);
}

/* ═══ Base ═══ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; background: var(--bg); }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}

/* ═══ Clean background — subtle gradient instead of orbs ═══ */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  background: linear-gradient(135deg, var(--bg) 0%, var(--bg) 60%, rgba(37,99,235,0.03) 100%);
}

/* ═══ Layout ═══ */
.app-header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--header-border);
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
}
.app-header .logo { height: 36px; }
.app-header .title { font-size: 15px; font-weight: 600; color: var(--text); letter-spacing: -0.01em; }
.app-header .spacer { flex: 1; }
.app-content {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px clamp(16px, 3vw, 40px);
}
.app-content.wide { max-width: 1440px; }

/* ═══ Cards ═══ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 200ms ease, border-color 200ms ease;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-body { padding: 18px 22px; }
.card-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--border-light);
  font-weight: 600; font-size: 15px;
}

/* ═══ Buttons ═══ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: 500 13px/1.3 var(--font);
  cursor: pointer;
  transition: all 150ms ease;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary {
  background: var(--accent); color: var(--accent-text); border-color: var(--accent);
  box-shadow: 0 1px 2px rgba(37,99,235,0.2);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-hover); border-color: var(--accent-hover);
  box-shadow: 0 2px 6px rgba(37,99,235,0.3);
}
.btn-secondary {
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-hover); border-color: var(--accent); color: var(--accent); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { opacity: 0.9; }
.btn-ghost { background: transparent; color: var(--accent); }
.btn-ghost:hover:not(:disabled) { background: var(--accent-light); }
.btn-remove {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: var(--danger-bg); color: var(--danger); cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-remove:hover { background: var(--danger); color: #fff; }
.btn-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px; border: none;
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-close:hover { background: var(--surface-hover); color: var(--text); }
.btn-close-sm { width: 24px; height: 24px; border-radius: 6px; }
.btn-xs { padding: 3px 10px; font-size: 11px; border-radius: 6px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: var(--radius); }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }
.btn-success { background: #22c55e; color: #fff; border: none; }
.btn-success:hover:not(:disabled) { background: #16a34a; }

/* ═══ Status Badges ═══ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1.4;
  white-space: nowrap;
}
.badge::before {
  content: ''; display: block;
  width: 7px; height: 7px; border-radius: 50%;
}
.badge-new { background: var(--info-bg); color: var(--info); }
.badge-new::before { background: var(--info); }
.badge-in_progress, .badge-reopened { background: var(--warning-bg); color: var(--warning); }
.badge-in_progress::before, .badge-reopened::before { background: var(--warning); }
.badge-estimated { background: rgba(139,92,246,0.08); color: #7c3aed; }
.badge-estimated::before { background: #7c3aed; }
.badge-done { background: var(--success-bg); color: var(--success); }
.badge-done::before { background: var(--success); }
.badge-closed { background: rgba(140,147,155,0.1); color: var(--text-muted); }
.badge-closed::before { background: var(--text-muted); }
.badge-cancelled { background: var(--danger-bg); color: var(--danger); }
.badge-cancelled::before { background: var(--danger); }

/* Priority badges */
.priority { font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 6px; }
.priority-critical { background: var(--danger-bg); color: var(--danger); }
.priority-high { background: var(--warning-bg); color: var(--warning); }
.priority-medium { background: var(--info-bg); color: var(--info); }
.priority-low { background: rgba(140,147,155,0.08); color: var(--text-muted); }

/* ═══ Forms ═══ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.form-input, .form-textarea, .form-select {
  width: 100%;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: 14px/1.5 var(--font);
  color: var(--text);
  transition: border-color 200ms, box-shadow 200ms;
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.form-textarea { min-height: 100px; resize: vertical; }
.form-select { cursor: pointer; }

/* ═══ Table ═══ */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; padding: 12px 16px;
  font-weight: 600; font-size: 11px; color: var(--text-muted);
  border-bottom: 2px solid var(--border-light);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}
.table tr { cursor: pointer; transition: background 120ms ease; }
.table tr:hover { background: var(--accent-light); }
.table .subject { font-weight: 500; color: var(--accent); }
.table .subject.truncate { max-width: clamp(200px, 35vw, 500px); }
.table tr.error-resolved-row { cursor: default; }
.table tr.error-resolved-row:hover { background: transparent; }

/* ═══ Chat / Messages ═══ */
.messages { display: flex; flex-direction: column; gap: 12px; padding: 16px 0; }
.msg {
  max-width: 75%; padding: 12px 16px;
  border-radius: var(--radius) var(--radius) var(--radius) 4px;
  font-size: 14px; line-height: 1.55;
}
.msg-client {
  background: var(--accent-light); color: var(--text);
  align-self: flex-start;
}
.msg-support {
  background: var(--surface); border: 1px solid var(--border-light);
  align-self: flex-end;
  border-radius: var(--radius) var(--radius) 4px var(--radius);
}
.msg-system {
  align-self: center; text-align: center;
  font-size: 12px; color: var(--text-muted);
  padding: 6px 14px;
}
.msg-author { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.msg-time { font-size: 11px; color: var(--text-muted); margin-top: 6px; }

/* ═══ File chips ═══ */
.file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: var(--surface-hover);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-size: 12px; color: var(--accent);
  cursor: pointer; text-decoration: none;
  transition: background 150ms, border-color 150ms;
}
.file-chip:hover { background: var(--accent-light); border-color: var(--accent); }

/* ═══ Progress bar (hours) ═══ */
.hours-bar { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.hours-track {
  flex: 1; height: 6px;
  background: var(--border-light);
  border-radius: 3px; overflow: hidden;
}
.hours-fill {
  height: 100%; border-radius: 3px;
  background: var(--accent);
  transition: width 300ms ease;
}
.hours-fill.warning { background: var(--warning); }
.hours-fill.danger { background: var(--danger); }

/* ═══ Filter bar ═══ */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 14px 0;
}
.filter-chip {
  padding: 7px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; background: var(--surface);
  color: var(--text-secondary);
  transition: all 150ms ease;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.filter-chip.active {
  background: var(--accent); color: var(--accent-text);
  border-color: var(--accent);
  box-shadow: 0 1px 3px rgba(37,99,235,0.2);
}

/* ═══ Theme toggle ═══ */
.theme-toggle {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  cursor: pointer; color: var(--text-muted); font-size: 16px;
  transition: all 150ms;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-light); }

/* ═══ Empty state ═══ */
.empty-state {
  text-align: center; padding: 56px 24px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 44px; margin-bottom: 16px; opacity: 0.4; }
.empty-state .title { font-size: 17px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.empty-state .desc { font-size: 14px; margin-bottom: 20px; color: var(--text-muted); }

/* ═══ Loading ═══ */
.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-center { display: flex; justify-content: center; padding: 48px; }

/* ═══ Tabs ═══ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border-light); }
.tab {
  padding: 12px 18px;
  font-size: 13px; font-weight: 500;
  color: var(--text-muted);
  cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 150ms, border-color 150ms;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ═══ Modal ═══ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 560px; width: 100%;
  max-height: 80vh; overflow-y: auto;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h3 { font-size: 17px; font-weight: 600; }
.modal-body { padding: 22px; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border-light);
}

/* ═══ Stats cards (admin) ═══ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 18px;
}
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.stat-card .label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* ═══ Settings ═══ */
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; }
.setting-info .name { font-size: 14px; font-weight: 500; }
.setting-info .desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.toggle {
  position: relative; width: 42px; height: 24px;
  background: var(--border); border-radius: 12px;
  cursor: pointer; transition: background 200ms;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: ''; position: absolute;
  top: 2px; left: 2px;
  width: 20px; height: 20px;
  background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 200ms;
}
.toggle.on::after { transform: translateX(18px); }

/* ═══ Responsive ═══ */

/* Mobile — compact & touch-friendly */
@media (max-width: 640px) {
  html { font-size: 13px; }
  .app-header { padding: 8px 12px; gap: 8px; }
  .app-header .logo { height: 30px; }
  .app-header .title { font-size: 14px; }
  .app-content { padding: 14px 12px; }
  .card-body { padding: 12px 14px; }
  .card-header { padding: 12px 14px; font-size: 14px; }
  .filters { gap: 6px; padding: 10px 0; }
  .filter-chip { padding: 7px 12px; font-size: 12px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-card { padding: 14px; }
  .stat-card .value { font-size: 22px; }
  /* Touch targets min 44px */
  .btn { min-height: 42px; padding: 10px 16px; font-size: 14px; }
  .btn-sm { min-height: 36px; padding: 8px 12px; font-size: 13px; }
  /* Table — compact */
  .table th, .table td { padding: 10px 10px; font-size: 12px; }
  .table .subject.truncate { max-width: 160px; }
  /* Chat messages — wider on mobile */
  .msg { max-width: 90%; font-size: 14px; }
  /* Modal — near full-screen */
  .modal-overlay, .modal-backdrop { padding: 8px; }
  .modal-dialog, .modal-card { max-width: 100%; border-radius: var(--radius); }
  /* Forms — 16px to prevent iOS zoom */
  .form-input, .form-textarea, .form-select { font-size: 16px; padding: 12px 14px; }
  /* Stack layouts */
  .ticket-detail-grid { grid-template-columns: 1fr; gap: 12px; }
  .ticket-detail-sidebar { order: -1; }
  .ticket-list-layout { flex-direction: column; gap: 12px; }
  .ticket-list-sidebar { width: 100%; order: -1; position: static; }
  /* Empty state */
  .empty-state { padding: 36px 16px; }
  .empty-state .icon { font-size: 36px; }
  .empty-state .title { font-size: 16px; }
  /* Search full-width */
  .search-input { min-width: 0; width: 100%; }
}

/* Tablet */
@media (max-width: 800px) and (min-width: 641px) {
  .app-content { padding: 20px 16px; }
  .ticket-list-layout { flex-direction: column; gap: 14px; }
  .ticket-list-sidebar { width: 100%; order: -1; position: static; }
}

/* Large screens */
@media (min-width: 1200px) {
  .table td, .table th { padding: 14px 18px; }
  .table .subject.truncate { max-width: clamp(280px, 30vw, 500px); }
  .ticket-detail-grid { grid-template-columns: 1fr 320px; gap: 24px; }
  .ticket-list-sidebar { width: 300px; }
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}

@media (min-width: 1600px) {
  .table .subject.truncate { max-width: clamp(360px, 35vw, 600px); }
  .ticket-detail-grid { grid-template-columns: 1fr 360px; gap: 28px; }
}

/* ═══ Utilities ═══ */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mb-12 { margin-bottom: 12px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ═══ Language selector ═══ */
.lang-select {
  height: 34px;
  padding: 0 26px 0 10px;
  font: 600 12px/1 var(--font);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 150ms;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.lang-select:hover { color: var(--accent); border-color: var(--accent); }
.lang-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.lang-select option { background: var(--surface); color: var(--text); }

/* ═══ Search input in filters ═══ */
.search-input {
  padding: 8px 14px;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  font: 13px var(--font);
  color: var(--text);
  min-width: 200px;
  transition: border-color 200ms, box-shadow 200ms;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

/* ═══ Drop zone ═══ */
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; cursor: pointer;
  transition: border-color 150ms, background 150ms;
  position: relative;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent); background: var(--accent-light);
}
.drop-zone-input {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  width: 100%; height: 100%;
}
.drop-zone-label {
  font: 13px var(--font); color: var(--text-muted);
  pointer-events: none;
}
.drop-zone-files {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px;
  justify-content: center;
}
.file-chip {
  display: inline-flex; align-items: center;
  padding: 4px 10px; font: 11px var(--font);
  background: var(--surface-hover); border-radius: var(--radius-sm);
  color: var(--text-secondary);
}

/* ═══ Voice input button ═══ */
.btn-voice {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text-muted); cursor: pointer;
  transition: all 150ms; flex-shrink: 0;
}
.btn-voice:hover { color: var(--accent); border-color: var(--accent); }
.btn-voice.recording {
  color: #ef4444; border-color: #ef4444;
  animation: pulse-voice 1.2s ease-in-out infinite;
}
@keyframes pulse-voice {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
}
.msg-input-row {
  position: relative;
}
.msg-input-row .form-textarea { width: 100%; min-height: 40px; padding-right: 44px; }
.msg-input-row .btn-voice {
  position: absolute; bottom: 6px; right: 6px;
  width: 30px; height: 30px; z-index: 2;
}

/* ═══ Unread Badge ═══ */
.unread-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 10px; font-size: 11px; font-weight: 700;
  background: #ef4444; color: #fff; line-height: 1;
  margin-left: 6px; vertical-align: middle;
}
.ticket-id-cell { position: relative; white-space: nowrap; }

/* ═══ File Preview ═══ */
.file-preview {
  display: inline-block; border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; text-decoration: none; color: var(--text);
  max-width: 180px; transition: border-color 150ms;
}
.file-preview:hover { border-color: var(--accent); }
.file-preview-img {
  display: block; width: 100%; max-height: 120px; object-fit: cover;
  background: var(--surface-hover);
}
.file-preview-info {
  padding: 8px 10px; font-size: 11px; line-height: 1.3;
  display: flex; flex-direction: column; gap: 2px;
}
.file-preview-name {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500;
}
.file-type-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 20px; padding: 0 6px;
  border-radius: 4px; font-size: 10px; font-weight: 700;
  color: #fff; letter-spacing: 0.3px; flex-shrink: 0;
}

/* Attachment tabs */
.att-tabs {
  display: flex; gap: 4px; margin-bottom: 14px;
  border-bottom: 2px solid var(--border-light);
}
.att-tab {
  padding: 8px 16px; font-size: 13px; font-weight: 500;
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); cursor: pointer; transition: color .15s, border-color .15s;
  margin-bottom: -2px;
}
.att-tab:hover { color: var(--text); }
.att-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.att-panel { display: flex; flex-wrap: wrap; gap: 8px; }
.att-panel .file-chip,
.att-panel .file-preview { margin: 0; }

/* Settings gear button */
.btn-settings {
  width: 36px; height: 36px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); transition: transform .2s, background .15s;
}
.btn-settings:hover { transform: rotate(30deg); background: var(--surface-hover); }
.btn-settings svg { flex-shrink: 0; }

/* Message original text block */
.msg-original {
  margin-top: 8px; padding: 6px 10px;
  background: var(--surface-hover); border-left: 2px solid var(--text-muted);
  border-radius: 0 6px 6px 0; font-size: 12px; color: var(--text-muted);
  line-height: 1.4; opacity: 0.75;
}
.msg-original-label {
  font-weight: 600; font-size: 10px; text-transform: uppercase;
  margin-right: 4px; color: var(--text-muted);
}
/* Ticket original text */
.ticket-original-text {
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
  padding: 6px 10px; background: var(--surface-hover);
  border-left: 2px solid var(--text-muted); border-radius: 0 6px 6px 0;
  opacity: 0.75;
}

/* Two-column ticket detail layout */
.ticket-detail-grid {
  display: grid; grid-template-columns: 1fr 280px; gap: 18px;
}
.ticket-detail-main { min-width: 0; }
.ticket-detail-sidebar { min-width: 0; }
@media (max-width: 720px) {
  .ticket-detail-grid {
    grid-template-columns: 1fr;
  }
  .ticket-detail-sidebar { order: -1; }
}

/* ═══ Modal (admin) ═══ */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.45); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-card {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 100%; max-height: 90vh; overflow: auto;
}

/* ═══ Toast ═══ */
.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px; border-radius: var(--radius-sm);
  color: #fff; font-size: 13px; font-weight: 500;
  animation: toast-in 0.3s ease;
  max-width: 380px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast-success { background: #16a34a; }
.toast-error { background: var(--danger); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══ Ticket list two-column layout ═══ */
.ticket-list-layout {
  display: flex;
  gap: 22px;
  align-items: flex-start;
}
.ticket-list-main {
  flex: 1;
  min-width: 0;
}
.ticket-list-sidebar {
  width: 260px;
  flex-shrink: 0;
  position: sticky;
  top: 8px;
}
@media (max-width: 800px) {
  .ticket-list-layout { flex-direction: column; }
  .ticket-list-sidebar { width: 100%; order: -1; }
}
