/* === DESIGN TOKENS === */
:root {
  --bg-primary: #0a0a1a;
  --bg-secondary: #111128;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-hover: rgba(255,255,255,0.07);
  --bg-glass: rgba(255,255,255,0.06);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.15);
  --text-primary: #f0f0f5;
  --text-secondary: #8b8ba3;
  --text-muted: #5a5a7a;
  --accent: #6366f1;
  --accent-glow: rgba(99,102,241,0.3);
  --green: #00b050;
  --green-bg: rgba(0,176,80,0.12);
  --yellow: #4472c4;
  --yellow-bg: rgba(68,114,196,0.12);
  --orange: #ffc000;
  --orange-bg: rgba(255,192,0,0.12);
  --red: #ff0000;
  --red-bg: rgba(255,0,0,0.12);
  --blue: #3b82f6;
  --blue-bg: rgba(59,130,246,0.12);
  --purple: #a855f7;
  --purple-bg: rgba(168,85,247,0.12);
  --sidebar-w: 240px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.3);
  --transition: 0.2s ease;
  --font: 'Inter', -apple-system, sans-serif;
}

/* === RESET === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg-primary); color: var(--text-primary); min-height: 100vh; display: flex; overflow-x: hidden; }
a { color: inherit; text-decoration: none; }
button { font-family: var(--font); cursor: pointer; border: none; outline: none; }
input, select, textarea { font-family: var(--font); outline: none; }
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* === SIDEBAR === */
.sidebar {
  width: var(--sidebar-w); height: 100vh; position: fixed; left: 0; top: 0; z-index: 100;
  background: var(--bg-secondary); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 20px 12px;
}
.sidebar-logo { display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 32px; }
.logo-img { width: 38px; height: 38px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(239,68,68,0.3)); }
.logo-text { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); }
.logo-accent { color: #ef4444; font-weight: 800; }
.sidebar-nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--radius-sm);
  color: var(--text-secondary); transition: var(--transition); font-weight: 500;
}
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.nav-item.active { background: rgba(99,102,241,0.12); color: var(--accent); }
.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.api-status { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); }
.status-dot.connected { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.running { animation: pulse-dot 1.5s ease-in-out infinite; }
@keyframes pulse-dot { 0%, 100% { box-shadow: 0 0 6px var(--green); } 50% { box-shadow: 0 0 14px var(--green), 0 0 20px var(--green); } }

/* === MAIN CONTENT === */
.main-content { margin-left: var(--sidebar-w); flex: 1; padding: 28px 32px; min-height: 100vh; }

/* === PAGE HEADER === */
.page-header { margin-bottom: 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.page-header h1 { font-size: 1.75rem; font-weight: 700; margin-bottom: 6px; }
.page-header p { color: var(--text-secondary); font-size: 0.95rem; }
.page-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  max-width: 100%;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.page-header-actions::-webkit-scrollbar {
  display: none;
}
.page-header-actions .btn {
  flex-shrink: 0 !important;
  white-space: nowrap !important;
}

/* === CARDS === */
.card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; backdrop-filter: blur(12px); transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-size: 1rem; font-weight: 600; }

/* === KPI GRID === */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr; }
}
.kpi-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; position: relative; overflow: hidden;
}
.kpi-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), #a855f7);
}
.kpi-card.green::before { background: linear-gradient(90deg, #00b050, #33cc66); }
.kpi-card.yellow::before { background: linear-gradient(90deg, #4472c4, #6a93d4); }
.kpi-card.orange::before { background: linear-gradient(90deg, #ffc000, #ffd54f); }
.kpi-card.red::before { background: linear-gradient(90deg, #ff0000, #ff4444); }
.kpi-card.blue::before { background: linear-gradient(90deg, var(--blue), #60a5fa); }
.kpi-card.purple::before { background: linear-gradient(90deg, var(--purple), #c084fc); }
.kpi-label { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 8px; text-transform: uppercase; letter-spacing: 0.5px; }
.kpi-value { font-size: 2rem; font-weight: 800; line-height: 1; }
.kpi-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 6px; }

/* === GRID LAYOUTS === */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 24px; }

/* === TABLE === */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 12px 16px; text-align: left; font-weight: 600; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-secondary);
  background: rgba(255,255,255,0.02); border-bottom: 1px solid var(--border); white-space: nowrap;
}
tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
tbody tr { transition: var(--transition); }
tbody tr:hover { background: var(--bg-card-hover); }
tbody tr:last-child td { border-bottom: none; }

/* === BADGES === */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 20px; font-size: 0.75rem; font-weight: 600;
}
.badge-excellent { background: var(--green-bg); color: var(--green); }
.badge-good { background: rgba(68,114,196,0.12); color: #4472c4; }
.badge-acceptable { background: var(--orange-bg); color: var(--orange); }
.badge-unacceptable { background: var(--red-bg); color: var(--red); }
.badge-new { background: rgba(99,102,241,0.12); color: var(--accent); }
.badge-processing { background: rgba(168,85,247,0.12); color: #a855f7; }
.badge-error { background: var(--red-bg); color: var(--red); }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px;
  border-radius: var(--radius-sm); font-weight: 600; font-size: 0.85rem;
  transition: var(--transition); border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5558e6; box-shadow: 0 4px 16px var(--accent-glow); }
.btn-secondary { background: var(--bg-card); color: var(--text-primary); border-color: var(--border); }
.btn-secondary:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }
.btn-danger { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,0.2); }
.btn-danger:hover { background: rgba(239,68,68,0.2); }
.btn-success { background: var(--green-bg); color: var(--green); border-color: rgba(34,197,94,0.2); }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-pdf-export { background: linear-gradient(135deg, #ef4444, #f97316); color: #fff; border: none; gap: 6px; }
.btn-pdf-export:hover { box-shadow: 0 4px 16px rgba(239,68,68,0.35); transform: translateY(-1px); }
.btn-pdf-export:disabled { transform: none; box-shadow: none; }

/* === FORM INPUTS === */
.input-group { display: flex; flex-direction: column; gap: 6px; }
.input-group label { font-size: 0.8rem; color: var(--text-secondary); font-weight: 500; }
.input, select, textarea, input[type="date"] {
  color-scheme: dark;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; color: var(--text-primary); font-size: 0.9rem; transition: var(--transition);
}
.input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
select { cursor: pointer; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b8ba3' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
select option { background: #1a1a2e; color: var(--text-primary); padding: 8px 12px; }
textarea { resize: vertical; min-height: 80px; }
.form-row { display: flex; gap: 16px; margin-bottom: 16px; }
.form-row > * { flex: 1; }

/* === PROGRESS BAR === */
.progress-bar { height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.progress-fill.excellent { background: linear-gradient(90deg, #00b050, #33cc66); }
.progress-fill.good { background: linear-gradient(90deg, #4472c4, #6a93d4); }
.progress-fill.acceptable { background: linear-gradient(90deg, #ffc000, #ffd54f); }
.progress-fill.unacceptable { background: linear-gradient(90deg, #ff0000, #ff4444); }

/* === EVALUATION BLOCKS === */
.eval-block { margin-bottom: 16px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.eval-block-header {
  display: flex; justify-content: space-between; align-items: center; padding: 14px 18px;
  background: rgba(255,255,255,0.02); cursor: pointer; transition: var(--transition);
}
.eval-block-header:hover { background: rgba(255,255,255,0.04); }
.eval-block-name { font-weight: 600; display: flex; align-items: center; gap: 10px; }
.eval-block-score { display: flex; align-items: center; gap: 12px; }
.eval-block-score .score-text { font-weight: 700; font-size: 0.95rem; }
.eval-block-body { padding: 0; max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.eval-block.open .eval-block-body { max-height: 2000px; }
.eval-block .chevron { transition: transform 0.3s; }
.eval-block.open .chevron { transform: rotate(180deg); }

.criteria-row {
  display: flex; align-items: center; justify-content: space-between; padding: 10px 18px;
  border-top: 1px solid var(--border); font-size: 0.85rem;
}
.criteria-row:hover { background: rgba(255,255,255,0.02); }
.criteria-name { flex: 1; color: var(--text-secondary); padding-right: 16px; }
.criteria-weight { width: 40px; text-align: center; color: var(--text-muted); font-size: 0.75rem; }
.criteria-score { width: 60px; text-align: center; font-weight: 700; }
.criteria-score.yes { color: var(--green); }
.criteria-score.no { color: var(--red); }
.criteria-score.na { color: var(--text-muted); }
.criteria-comment { font-size: 0.75rem; color: var(--text-muted); margin-top: 4px; font-style: italic; }

/* === MANUAL EVALUATION === */
.criteria-manual { display: flex; gap: 4px; align-items: center; min-width: 120px; }
.manual-opt { cursor: pointer; display: flex; }
.manual-opt input[type="radio"] { display: none; }
.manual-btn {
  padding: 3px 8px; border-radius: 4px; font-size: 0.7rem; font-weight: 600;
  border: 1px solid var(--border); color: var(--text-muted); background: transparent;
  transition: all 0.15s ease; user-select: none;
}
.manual-btn:hover { border-color: var(--border-hover); color: var(--text-secondary); }
.manual-opt input[type="radio"]:checked + .m-yes { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.manual-opt input[type="radio"]:checked + .m-no { background: var(--red-bg); color: var(--red); border-color: var(--red); }
.manual-opt input[type="radio"]:checked + .m-na { background: rgba(255,255,255,0.06); color: var(--text-secondary); border-color: var(--text-muted); }
.criteria-labels {
  background: rgba(255,255,255,0.02) !important; padding: 6px 18px !important;
  font-size: 0.7rem !important; text-transform: uppercase; letter-spacing: 0.5px;
  color: var(--text-muted) !important; font-weight: 600 !important; border-top: none !important;
}
.criteria-labels .criteria-name,
.criteria-labels .criteria-weight,
.criteria-labels .criteria-score { font-weight: 600; color: var(--text-muted); }
.btn-manual-save {
  background: linear-gradient(135deg, #10b981, #06b6d4); color: #fff; border: none; font-weight: 600;
}
.btn-manual-save:hover { box-shadow: 0 4px 16px rgba(16,185,129,0.35); transform: translateY(-1px); }
.btn-manual-save:disabled { transform: none; box-shadow: none; opacity: 0.6; }

/* === MODAL === */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center; padding: 32px;
}
.modal-overlay.active { display: flex; }
.modal-content {
  background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 1050px; width: 100%; max-height: 85vh; overflow-y: auto; padding: 28px;
  box-shadow: var(--shadow); animation: modalIn 0.25s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(20px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 1.3rem; font-weight: 700; }
.modal-close { width: 36px; height: 36px; border-radius: 50%; background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: var(--transition); }
.modal-close:hover { background: var(--red-bg); color: var(--red); border-color: rgba(239,68,68,0.3); }

/* === TOAST === */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 14px 20px; border-radius: var(--radius-sm); font-size: 0.85rem; font-weight: 500;
  box-shadow: var(--shadow); animation: toastIn 0.3s ease;
  display: flex; align-items: center; gap: 10px; min-width: 300px;
}
.toast-success { background: #0f2e1a; border: 1px solid rgba(34,197,94,0.3); color: var(--green); }
.toast-error { background: #2e0f0f; border: 1px solid rgba(239,68,68,0.3); color: var(--red); }
.toast-info { background: #0f1a2e; border: 1px solid rgba(99,102,241,0.3); color: var(--accent); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }

/* === SCORE CIRCLE === */
.score-circle { position: relative; width: 120px; height: 120px; }
.score-circle svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.score-circle circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.score-circle .bg { stroke: rgba(255,255,255,0.06); }
.score-circle .fill { transition: stroke-dashoffset 1s ease; }
.score-circle .value { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); font-size: 1.5rem; font-weight: 800; text-align: center; }
.score-circle .value small { display: block; font-size: 0.65rem; font-weight: 400; color: var(--text-secondary); }

/* === TOOLBAR === */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 20px; }
.toolbar .spacer { flex: 1; }

/* === EMPTY STATE === */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state svg { width: 64px; height: 64px; margin-bottom: 16px; opacity: 0.3; }
.empty-state h3 { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 8px; }

/* === LOADING === */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === OPERATOR LIST === */
.operator-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.operator-item:last-child { border-bottom: none; }
.operator-avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #a855f7); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.85rem; }
.operator-info { flex: 1; }
.operator-info .name { font-weight: 600; font-size: 0.9rem; }
.operator-info .hotel { font-size: 0.75rem; color: var(--text-muted); }
.operator-score { font-weight: 700; font-size: 1.1rem; }

/* === TRANSCRIPT === */
.transcript-box {
  background: rgba(0,0,0,0.3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 16px; max-height: 300px; overflow-y: auto; font-size: 0.85rem;
  line-height: 1.7; color: var(--text-secondary); white-space: pre-wrap;
}

/* === TABS === */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: var(--bg-card); border-radius: var(--radius-sm); padding: 4px; border: 1px solid var(--border); width: fit-content; }
.tab { padding: 8px 16px; border-radius: 6px; font-size: 0.85rem; font-weight: 500; color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.tab.active { background: var(--accent); color: #fff; }
.tab:hover:not(.active) { color: var(--text-primary); }

/* === PAGINATION === */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; flex-wrap: wrap; }
.pagination button { width: 36px; height: 36px; border-radius: var(--radius-sm); background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 0.85rem; transition: all 0.2s; }
.pagination button.active { background: var(--accent); color: #fff; border-color: var(--accent); font-weight: 600; box-shadow: 0 0 12px rgba(99,102,241,0.3); }
.pagination button:hover:not(.active):not(:disabled) { border-color: var(--accent); color: var(--text-primary); background: rgba(99,102,241,0.1); }
.pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.pagination-info { font-size: 0.82rem; color: var(--text-muted); margin-right: 12px; }
.pagination-dots { color: var(--text-muted); font-size: 0.9rem; padding: 0 2px; }

/* === ANIMATIONS === */
.fade-in { animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* === MOBILE MENU BUTTON === */
.mobile-menu-toggle {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 201;
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--bg-secondary); border: 1px solid var(--border);
  color: var(--text-primary); align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
  box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}
.mobile-menu-toggle:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.mobile-menu-toggle svg { width: 22px; height: 22px; }

/* === SIDEBAR OVERLAY (mobile) === */
.sidebar-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(2px); z-index: 99;
}
.sidebar-overlay.active { display: block; }

/* === MOBILE FILTER TOGGLE === */
.filters-toggle {
  display: none; padding: 10px 16px; border-radius: var(--radius-sm);
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-primary);
  font-weight: 500; font-size: 0.85rem; cursor: pointer; transition: var(--transition);
  text-align: left; width: 100%;
}
.filters-toggle:hover { border-color: var(--border-hover); }
.filters-body { display: contents; }

/* === PERIOD FILTER === */
.dash-period-filter {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin-bottom: 24px; padding: 14px 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); backdrop-filter: blur(12px);
}
.period-btns {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.period-btn {
  padding: 7px 16px; border-radius: 20px;
  background: transparent; border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 0.82rem; font-weight: 500;
  cursor: pointer; transition: all 0.25s ease;
}
.period-btn:hover {
  border-color: var(--accent); color: var(--text-primary);
  background: rgba(99,102,241,0.08);
}
.period-btn.active {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
  box-shadow: 0 2px 12px var(--accent-glow);
}
.period-custom {
  display: flex; align-items: center; gap: 10px;
  animation: fadeIn 0.3s ease;
}
.period-date-input {
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 12px;
  color: var(--text-primary); font-size: 0.82rem;
  font-family: var(--font); transition: var(--transition);
}
.period-date-input:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow);
}
.period-date-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
}
.period-label {
  margin-left: auto; font-size: 0.82rem; color: var(--text-muted);
  font-weight: 500;
}

/* === Action buttons in table === */
.actions-cell { white-space: nowrap; position: relative; }
.actions-cell .btn { margin-right: 2px; }
.btn-icon { display: none; }
.btn-label { display: inline; }

/* Desktop: show action-desktop, hide action-mobile */
.action-mobile { display: none !important; }
.action-desktop { display: inline-flex !important; }

/* === Mobile Bottom Sheet === */
#mobile-bottom-sheet {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 2000;
  pointer-events: none;
}
#mobile-bottom-sheet.bs-active { pointer-events: auto; }
.bs-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); opacity: 0; transition: opacity 0.2s ease;
}
#mobile-bottom-sheet.bs-active .bs-overlay { opacity: 1; }
.bs-panel {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: var(--bg-secondary); border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0; padding: 8px 0 16px;
  transform: translateY(100%); transition: transform 0.25s cubic-bezier(0.32, 0.72, 0, 1);
  max-height: 70vh; overflow-y: auto;
}
#mobile-bottom-sheet.bs-active .bs-panel { transform: translateY(0); }
.bs-handle {
  width: 36px; height: 4px; background: rgba(255,255,255,0.2);
  border-radius: 2px; margin: 4px auto 12px;
}
.bs-title {
  padding: 4px 20px 14px; font-size: 0.8rem; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}
.bs-item {
  padding: 16px 20px; font-size: 0.95rem; font-weight: 500;
  color: var(--text-primary); cursor: pointer;
  display: flex; align-items: center; gap: 12px;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.bs-item:active { background: var(--bg-card-hover); }
.bs-item:not(:last-child) { border-bottom: 1px solid var(--border); }
.bs-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.bs-item-danger { color: var(--red); }
.bs-cancel {
  margin-top: 8px; text-align: center; justify-content: center;
  color: var(--text-secondary); font-weight: 600;
  border-top: 6px solid rgba(255,255,255,0.04) !important;
}

/* === RESPONSIVE === */
@media (max-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  /* --- Global Viewport Containment --- */
  html, body {
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  /* --- Mobile Menu Button --- */
  .mobile-menu-toggle { display: flex; }

  /* --- Sidebar: FULLY HIDDEN by default --- */
  .sidebar {
    transform: translateX(-100%) !important; transition: transform 0.3s ease;
    z-index: 200; width: 260px; box-shadow: 4px 0 24px rgba(0,0,0,0.4);
    padding: 20px 12px;
  }
  .sidebar.open { transform: translateX(0) !important; }
  .sidebar .logo-text { display: inline !important; }
  .sidebar .nav-item span { display: inline !important; }
  .sidebar-footer span { display: inline !important; }

  /* --- Main content: FULL WIDTH, no sidebar margin --- */
  .main-content {
    margin-left: 0 !important;
    padding: 56px 10px 20px !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
  }

  /* --- Page header --- */
  .page-header { width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; flex-direction: column; align-items: flex-start; gap: 10px; margin-bottom: 16px; overflow: hidden; }
  .page-header h1 { font-size: 1.25rem; word-break: break-word; }
  .page-header p { font-size: 0.82rem; display: none; }
  .page-header > div:last-child,
  .page-header-actions {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }
  .page-header > div:last-child::-webkit-scrollbar,
  .page-header-actions::-webkit-scrollbar { display: none !important; }
  .page-header > div:last-child .btn,
  .page-header > div:last-child .btn-sm,
  .page-header-actions .btn,
  .page-header-actions .btn-sm {
    flex: 1 1 calc(50% - 6px) !important;
    padding: 8px 6px !important;
    font-size: 0.72rem !important;
    white-space: normal !important;
    word-break: break-word !important;
    text-align: center !important;
    justify-content: center !important;
    min-width: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* --- Settings Page Mobile Adaptation --- */
  .settings-page { width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; padding-bottom: 30px !important; }
  .settings-page div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .settings-page div[style*="grid-column: span 2"] { grid-column: span 1 !important; }
  .settings-page div[style*="position: sticky"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 12px !important;
    text-align: center !important;
    position: relative !important;
    bottom: 0 !important;
  }
  .settings-page button { width: 100% !important; }

  /* --- Period Filter (mobile) --- */
  .dash-period-filter { width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; padding: 10px 12px; gap: 10px; flex-direction: column; margin-bottom: 16px; }
  .period-btns { display: flex !important; flex-wrap: wrap !important; gap: 6px !important; width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; overflow: visible !important; }
  .period-btns::-webkit-scrollbar { display: none !important; }
  .period-btn { padding: 6px 10px !important; font-size: 0.72rem !important; white-space: nowrap !important; flex: 1 1 auto !important; text-align: center !important; justify-content: center !important; }
  .period-label { margin-left: 0; font-size: 0.75rem; }
  .period-custom { width: 100%; }
  .period-date-input { flex: 1; padding: 6px 8px; font-size: 0.78rem; }

  /* --- Cards: prevent overflow --- */
  .card { overflow: hidden; max-width: 100%; box-sizing: border-box; }

  /* --- KPI Grid --- */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-value { font-size: 1.4rem; }

  /* --- Grids --- */
  .grid-2 { grid-template-columns: 1fr; gap: 14px; }
  .grid-3 { grid-template-columns: 1fr; gap: 14px; }

  /* --- Toolbar / Filters --- */
  .toolbar { flex-direction: column; align-items: stretch; gap: 8px; width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; }
  .toolbar .spacer { display: none; }
  .filters-toggle { display: block; }
  .filters-body { display: none !important; flex-direction: column; gap: 8px; width: 100% !important; }
  .filters-body.open { display: flex !important; }
  .filters-body input, .filters-body select { width: 100% !important; max-width: 100% !important; box-sizing: border-box !important; }
  .toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; width: 100% !important; }

  /* --- TABLES: SMOOTH RESPONSIVE SCROLL FOR MOBILE --- */
  .table-wrap {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: var(--radius-sm);
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  table {
    table-layout: auto !important;
    width: 100% !important;
  }
  thead th { padding: 8px 8px; font-size: 0.75rem; white-space: nowrap; }
  tbody td { padding: 10px 8px; font-size: 0.82rem; white-space: nowrap; }
  .checklist-role-tabs { flex-wrap: wrap !important; gap: 8px !important; }
  .role-tab-btn, .analytics-tab-btn { flex: 1 1 auto !important; text-align: center !important; justify-content: center !important; }

  /* Hide columns on mobile */
  .mobile-hide { display: none !important; }
  .mobile-hide-id { display: none !important; }

  /* Actions: single "..." button on mobile with dropdown menu */
  .action-desktop { display: none !important; }
  .action-mobile { display: inline-flex !important; }
  .actions-cell { white-space: nowrap !important; position: relative; }
  .actions-cell .btn.action-mobile { padding: 6px 10px !important; min-width: 32px; font-size: 1rem; font-weight: 700; }
  /* --- Buttons --- */
  .btn-sm { padding: 8px 12px; font-size: 0.8rem; }

  /* --- Forms --- */
  .form-row { flex-direction: column; gap: 12px; }

  /* --- Modal: near-fullscreen on mobile --- */
  .modal-overlay { padding: 6px !important; }
  .modal-content { max-width: 100% !important; width: 100% !important; max-height: 94vh; padding: 14px !important; border-radius: var(--radius-sm); box-sizing: border-box !important; }
  .modal-header h2 { font-size: 1.05rem; }

  /* --- Score Circle --- */
  .score-circle { width: 90px; height: 90px; }
  .score-circle .value { font-size: 1.2rem; }
  .score-circle .value small { font-size: 0.55rem; }

  /* --- Eval blocks --- */
  .eval-block-header { padding: 12px 12px; }
  .eval-block-name { font-size: 0.82rem; gap: 6px; }
  .eval-block-score .progress-bar { width: 50px !important; }
  .eval-block-score .score-text { font-size: 0.8rem; }
  .criteria-row { padding: 8px 12px; flex-wrap: wrap; }
  .criteria-name { font-size: 0.78rem; min-width: 0; }
  .criteria-weight { width: 28px; font-size: 0.68rem; }
  .criteria-score { width: 50px; font-size: 0.72rem; }
  .criteria-manual { min-width: 80px; gap: 2px; }
  .manual-btn { padding: 2px 5px; font-size: 0.6rem; }
  .criteria-labels { display: none !important; }

  /* --- Tabs --- */
  .tabs { width: 100%; flex-wrap: wrap; }
  .tab { flex: 1 1 auto; text-align: center; padding: 8px 8px; font-size: 0.78rem; }

  /* --- Toast --- */
  .toast-container { bottom: 16px; right: 10px; left: 10px; }
  .toast { min-width: unset; font-size: 0.8rem; padding: 10px 12px; }

  /* --- Pagination --- */
  .pagination { gap: 3px; }
  .pagination button { width: 30px; height: 30px; font-size: 0.75rem; }
  .pagination-info { font-size: 0.72rem; width: 100%; text-align: center; margin: 0 0 6px; }

  /* --- Dashboard inline widths override --- */
  .dash-label { width: auto !important; min-width: 70px; flex-shrink: 0; font-size: 0.75rem !important; }
  .dash-value { width: auto !important; min-width: 40px; flex-shrink: 0; }

  /* --- Transcript --- */
  .transcript-box { max-height: 250px; font-size: 0.8rem; padding: 12px; }

  /* --- Export --- */
  .export-card { max-width: 100% !important; }
}

@media (max-width: 480px) {
  .main-content { padding: 52px 6px 14px !important; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .kpi-card { padding: 10px; }
  .kpi-value { font-size: 1.2rem; }
  .kpi-label { font-size: 0.68rem; }
  .kpi-sub { font-size: 0.68rem; }
  .page-header h1 { font-size: 1.1rem; }
  .card { padding: 10px; }
  .btn { padding: 6px 10px; font-size: 0.78rem; }

  /* Period filter compact */
  .dash-period-filter { padding: 6px 8px; }
  .period-btn { padding: 5px 8px; font-size: 0.7rem; }

  /* Eval detail: stack vertically */
  .eval-detail-top { flex-direction: column !important; align-items: center !important; text-align: center; }
  .eval-detail-info { min-width: unset !important; }
}

/* === OPERATOR DASHBOARD === */
.grid-2-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 768px) { .grid-2-cols { grid-template-columns: 1fr; } }

.points-list { list-style: none; padding: 0; }
.point-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.point-item:hover { background: var(--bg-card-hover); }
.point-item:last-child { border-bottom: none; }
.point-icon { font-size: 1rem; flex-shrink: 0; }
.point-text { flex: 1; font-size: 0.88rem; color: var(--text-primary); line-height: 1.4; }
.point-count { font-size: 0.82rem; font-weight: 600; flex-shrink: 0; padding: 2px 8px; border-radius: 10px; background: var(--bg-glass); }

.comment-item {
  padding: 14px; border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}
.comment-item:hover { background: var(--bg-card-hover); }
.comment-item:last-child { border-bottom: none; }
.comment-meta { display: flex; justify-content: space-between; margin-bottom: 8px; }
.comment-date { font-size: 0.82rem; color: var(--text-muted); }
.comment-score { font-size: 0.82rem; font-weight: 600; padding: 2px 8px; border-radius: 8px; }
.comment-text { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; }

.score-badge { padding: 3px 10px; border-radius: 8px; font-size: 0.82rem; font-weight: 600; }
.score-excellent { background: var(--green-bg); color: var(--green); }
.score-good { background: rgba(59,130,246,0.12); color: #3b82f6; }
.score-acceptable { background: var(--yellow-bg); color: var(--yellow); }
.score-bad { background: var(--red-bg); color: var(--red); }

.page-subtitle { color: var(--text-muted); font-size: 0.88rem; margin-top: 4px; }
.empty-state { color: var(--text-muted); text-align: center; padding: 24px; font-size: 0.9rem; }
.error-state { color: var(--red); text-align: center; padding: 24px; }

.stat-value.positive { color: var(--green); }
.stat-value.negative { color: var(--red); }

.topic-cell { max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.clickable-row:hover { background: var(--bg-card-hover); }

/* === USERS MANAGEMENT === */
.header-actions { display: flex; gap: 10px; }
.role-badge { padding: 3px 10px; border-radius: 8px; font-size: 0.82rem; font-weight: 500; }
.role-admin { background: rgba(99,102,241,0.15); color: #818cf8; }
.role-operator { background: rgba(34,197,94,0.12); color: #22c55e; }
.status-active { color: var(--green); font-size: 0.88rem; }
.status-inactive { color: var(--red); font-size: 0.88rem; }
.actions-cell { white-space: nowrap; text-align: center; }

/* Action buttons - visible with background */
.btn-action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: none; border-radius: 8px;
  font-size: 1rem; cursor: pointer; transition: all var(--transition);
  margin: 0 2px;
}
.btn-edit { background: rgba(99,102,241,0.15); }
.btn-edit:hover { background: rgba(99,102,241,0.3); transform: scale(1.1); }
.btn-password { background: rgba(234,179,8,0.15); }
.btn-password:hover { background: rgba(234,179,8,0.3); transform: scale(1.1); }
.btn-delete { background: rgba(239,68,68,0.12); }
.btn-delete:hover { background: rgba(239,68,68,0.25); transform: scale(1.1); }

/* Pagination */
.users-pagination {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 16px; border-top: 1px solid var(--border);
}
.pagination-info { font-size: 0.85rem; color: var(--text-muted); }
.btn-sm { padding: 6px 14px; font-size: 0.82rem; }

.modal-form .form-group { margin-bottom: 16px; }
.modal-form .form-group label { display: block; font-size: 0.82rem; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px; }
.modal-form .form-group input,
.modal-form .form-group select {
  width: 100%; padding: 10px 14px; background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary); font-size: 0.9rem; transition: border-color var(--transition);
}
.modal-form .form-group input:focus,
.modal-form .form-group select:focus { border-color: var(--accent); }
.modal-form .form-group small { display: block; margin-top: 4px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* === OPERATOR READONLY MODE — hide edit controls === */
.eval-readonly .btn-manual-save,
.eval-readonly .btn-pdf-export,
.eval-readonly .btn-save-comment,
.eval-readonly textarea { display: none !important; }
.eval-readonly:not(.has-manual-eval) .criteria-manual,
.eval-readonly:not(.has-manual-eval) #manual-circle-container { display: none !important; }
.eval-readonly .manual-opt { pointer-events: none !important; }
.eval-readonly .comment-save-btn { display: none !important; }
.eval-readonly button[onclick*="saveComment"] { display: none !important; }
.eval-readonly button[onclick*="recalculate"] { display: none !important; }
.eval-readonly .manual-btns { display: none !important; }

/* === OPERATOR DASHBOARD === */
.op-kpi-grid {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px;
}
@media (max-width: 1100px) { .op-kpi-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 700px) { .op-kpi-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 500px) { .op-kpi-grid { grid-template-columns: 1fr; } }

.op-kpi-card {
  display: flex; align-items: center; gap: 16px; padding: 20px 24px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  transition: transform 0.2s, box-shadow 0.2s;
}
.op-kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.15); }

.op-kpi-icon {
  display: flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: 12px; font-size: 1.4rem; flex-shrink: 0;
}

.op-kpi-data { min-width: 0; }
.op-kpi-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; color: var(--text-primary); }
.op-kpi-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.trend-up { color: #10b981 !important; }
.trend-down { color: #ef4444 !important; }

.op-two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .op-two-cols { grid-template-columns: 1fr; } }

.op-points-list { list-style: none; padding: 0; margin: 0; }
.op-point-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.op-point-item:last-child { border-bottom: none; }
.op-point-icon { flex-shrink: 0; font-size: 0.9rem; }
.op-point-text { flex: 1; font-size: 0.88rem; color: var(--text-secondary); line-height: 1.4; }
.op-point-count { flex-shrink: 0; font-size: 0.82rem; font-weight: 600; }

.op-comment-item {
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.op-comment-item:last-child { border-bottom: none; }
.op-comment-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.op-comment-date { font-size: 0.8rem; color: var(--text-muted); }
.op-comment-score { font-size: 0.82rem; font-weight: 600; padding: 2px 8px; border-radius: 6px; }
.op-comment-text { font-size: 0.88rem; color: var(--text-secondary); line-height: 1.5; }

.score-excellent { background: rgba(16,185,129,0.12); color: #10b981; }
.score-good { background: rgba(234,179,8,0.12); color: #eab308; }
.score-acceptable { background: rgba(249,115,22,0.12); color: #f97316; }
.score-poor { background: rgba(239,68,68,0.12); color: #ef4444; }

/* === USERS MOBILE CARDS === */
.users-cards-mobile { display: none; }

.user-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.user-card:last-child { margin-bottom: 0; }
.user-card:active { transform: scale(0.99); }

.user-card-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.user-card-avatar {
  width: 40px; height: 40px; border-radius: 10px;
  background: rgba(99,102,241,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; flex-shrink: 0;
}
.user-card-title { flex: 1; min-width: 0; }
.user-card-name {
  font-size: 0.95rem; font-weight: 600; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card-email {
  font-size: 0.78rem; color: var(--text-muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-card-status { font-size: 1.1rem; flex-shrink: 0; }

.user-card-details {
  display: flex; flex-direction: column; gap: 8px;
  padding: 10px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.user-card-row {
  display: flex; justify-content: space-between; align-items: center;
}
.user-card-label {
  font-size: 0.78rem; color: var(--text-muted); font-weight: 500;
}
.user-card-val {
  font-size: 0.82rem; color: var(--text-secondary); font-weight: 500;
}

.user-card-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}

/* Outline button variants */
.btn-outline {
  background: transparent !important;
  border: 1px solid var(--border) !important;
  color: var(--text-secondary) !important;
}
.btn-outline:hover {
  background: rgba(99,102,241,0.1) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}
.btn-outline-warn {
  border-color: rgba(234,179,8,0.3) !important;
  color: #eab308 !important;
}
.btn-outline-warn:hover {
  background: rgba(234,179,8,0.1) !important;
  border-color: #eab308 !important;
}
.btn-outline-danger {
  border-color: rgba(239,68,68,0.25) !important;
  color: #ef4444 !important;
}
.btn-outline-danger:hover {
  background: rgba(239,68,68,0.1) !important;
  border-color: #ef4444 !important;
}

.emails-table-desktop, .appeals-table-desktop { display: block; }
.emails-cards-mobile, .appeals-cards-mobile { display: none; }

@media (max-width: 768px) {
  .users-table-desktop, .emails-table-desktop, .appeals-table-desktop { display: none !important; }
  .users-cards-mobile, .emails-cards-mobile, .appeals-cards-mobile { display: block !important; padding: 4px; }

  .users-pagination {
    flex-direction: column; gap: 10px; padding: 12px;
  }
  .users-pagination .btn { width: 100%; text-align: center; }
}

