:root {
  --sidebar-bg: #14161a;
  --accent-teal: #16a394;
  --accent-teal-dark: #0e2e2b;
  --text-dark: #14161a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --bg-page: #f7f8fa;
  --amber: #f59e0b;
  --amber-bg: #fef3e2;
  --red: #dc2626;
  --red-bg: #fdecec;
  --green-bg: #e8f7f4;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif; background: var(--bg-page); color: var(--text-dark); }
.layout { display: flex; min-height: 100vh; }

.sidebar { width: 230px; background: var(--sidebar-bg); color: #d1d5db; padding: 24px 16px; flex-shrink: 0; }
.brand-title { color: #fff; font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.brand-sub { color: var(--accent-teal); font-weight: 600; font-size: 11px; }
.brand-network { font-size: 12px; color: #8b8f98; margin-top: 4px; margin-bottom: 24px; }
.nav-group-label { font-size: 10px; color: #6b6f78; letter-spacing: 1px; margin: 18px 0 6px 8px; }
.sidebar nav a { display: block; padding: 8px 10px; border-radius: 6px; color: #c7cad1; text-decoration: none; font-size: 14px; margin-bottom: 2px; }
.sidebar nav a:hover { background: #1f232a; }
.sidebar nav a.active { background: var(--accent-teal-dark); color: #fff; }

.content { flex: 1; padding: 28px 36px; }
.topbar h1 { font-size: 22px; margin: 0 0 18px; }
.back-link { color: var(--accent-teal); text-decoration: none; font-size: 14px; }

.kpi-row { display: flex; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.kpi-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 16px 20px; flex: 1; min-width: 150px; }
.kpi-value { font-size: 26px; font-weight: 700; }
.kpi-label { font-size: 13px; color: var(--text-muted); margin-top: 4px; }

.alert-banner { background: var(--red-bg); border: 1px solid #f5c2c2; color: var(--red); padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; }

.panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 20px; overflow: hidden; }
.panel-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; font-size: 12px; font-weight: 700; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.muted-count { font-weight: 400; color: var(--text-muted); font-size: 12px; }

.filters { display: flex; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.filters input, .filters select { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.filters input { flex: 1; min-width: 200px; }

.btn-primary { background: var(--accent-teal); color: #fff; border: none; padding: 8px 16px; border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 600; }
.btn-outline { background: transparent; border: 1px solid var(--red); color: var(--red); padding: 6px 12px; border-radius: 6px; cursor: pointer; font-size: 13px; }

.cases-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cases-table th { text-align: left; padding: 10px 18px; color: var(--text-muted); font-weight: 600; font-size: 11px; letter-spacing: 0.5px; border-bottom: 1px solid var(--border); }
.cases-table td { padding: 12px 18px; border-bottom: 1px solid var(--border); }
.cases-table tr:hover { background: var(--bg-page); }
.cases-table tr.row-vencido { border-left: 3px solid var(--red); }
.case-id { font-weight: 600; }
.empty { color: var(--text-muted); text-align: center; padding: 30px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; }
.pill-canal, .pill-area { background: #eef1f5; color: #374151; }
.pill-estado { font-weight: 600; }
.pill-nuevo { background: #e5f0ff; color: #1d4ed8; }
.pill-en_gestion { background: var(--amber-bg); color: #b45309; }
.pill-esperando_cliente { background: #f3e8ff; color: #7e22ce; }
.pill-resuelto { background: var(--green-bg); color: #0f766e; }
.pill-cerrado { background: #f0f0f0; color: #555; }
.pill-vencido { background: var(--red-bg); color: var(--red); font-weight: 600; padding: 4px 12px; border-radius: 20px; }

.ficha-panel { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 24px; max-width: 760px; }
.ficha-label { font-size: 11px; color: var(--text-muted); letter-spacing: 1px; }
.ficha-header h1, .ficha-panel > h1 { margin: 4px 0 18px; font-size: 22px; }
.ficha-datos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 24px; margin-bottom: 20px; }
.ficha-datos span { display: block; font-size: 11px; color: var(--text-muted); }
.ficha-datos strong { font-size: 14px; }
.ficha-datos label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-muted); }
.ficha-datos input, .ficha-datos select { padding: 7px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

.ficha-controls { display: flex; gap: 20px; align-items: center; margin-bottom: 24px; padding: 14px; background: var(--bg-page); border-radius: 8px; }
.ficha-controls label { font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 4px; }
.ficha-controls select, .ficha-controls input[type=text] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }

.section-title { font-size: 12px; letter-spacing: 1px; color: var(--text-muted); margin: 24px 0 12px; text-transform: uppercase; }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--border); }
.timeline li { padding: 0 0 16px 18px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-teal); }
.timeline p { margin: 0 0 4px; font-size: 14px; line-height: 1.5; }
.timeline-meta { font-size: 12px; color: var(--text-muted); }

.nota-form { display: flex; gap: 10px; margin-top: 16px; }
.nota-form textarea { flex: 1; min-height: 60px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-family: inherit; font-size: 13px; }

.bar-row { display: flex; align-items: center; gap: 12px; padding: 10px 18px; }
.bar-label { width: 160px; font-size: 13px; }
.bar-track { flex: 1; background: #eef1f5; border-radius: 4px; height: 10px; overflow: hidden; }
.bar-fill { background: var(--accent-teal); height: 100%; }
.bar-value { width: 30px; text-align: right; font-size: 13px; font-weight: 600; }

.modal-overlay { position: fixed; inset: 0; background: rgba(20,22,26,0.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal { background: #fff; border-radius: 10px; width: 500px; max-width: 100%; max-height: 88vh; overflow-y: auto; }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-muted); }
.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-body label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-muted); }
.modal-body input, .modal-body select, .modal-body textarea { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; font-family: inherit; }
.modal-body textarea { min-height: 70px; resize: vertical; }
.modal-footer { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-top: 1px solid var(--border); gap: 10px; }
.modal-error { color: var(--red); font-size: 12px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-dark); flex-direction: row !important; }

.quick-links { display: flex; flex-wrap: wrap; gap: 10px; padding: 16px 18px; }
.quick-links a { background: var(--bg-page); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; text-decoration: none; color: var(--text-dark); font-size: 13px; font-weight: 500; }
.quick-links a:hover { border-color: var(--accent-teal); color: var(--accent-teal); }

.checklist-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.checklist-critico span:first-child { color: var(--red); font-weight: 500; }
.checklist-options { display: flex; gap: 14px; font-size: 13px; }
.checklist-options label { display: flex; align-items: center; gap: 4px; }

.survey-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.scale-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.scale-buttons label { display: flex; align-items: center; gap: 3px; font-size: 12px; }
.scale-nps { max-width: 500px; }
.radio-pills { display: flex; gap: 14px; margin-bottom: 8px; font-size: 13px; }
.radio-pills label { display: flex; align-items: center; gap: 6px; }
.tag-checks { display: flex; flex-wrap: wrap; gap: 10px 18px; font-size: 13px; margin-bottom: 12px; }
.tag-checks label { display: flex; align-items: center; gap: 6px; }

.doc-category { padding: 14px 18px 6px; font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--text-muted); }
.doc-row { display: flex; align-items: center; gap: 16px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.doc-code { width: 40px; height: 40px; border-radius: 8px; background: var(--bg-page); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: var(--text-muted); flex-shrink: 0; }
.doc-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.doc-info strong { font-size: 14px; }
.doc-info span { font-size: 12px; color: var(--text-muted); }
.doc-tags { display: flex; gap: 8px; flex-shrink: 0; }
