/* ================================================================
   CynChro Dashboard — Styles
   ================================================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg:            #f1f5f9;
  --surface:       #ffffff;
  --border:        #e2e8f0;
  --text:          #1e293b;
  --text-muted:    #64748b;
  --text-light:    #94a3b8;
  --primary:       #3b82f6;
  --primary-hover: #2563eb;
  --green:         #22c55e;
  --green-bg:      #f0fdf4;
  --yellow:        #facc15;
  --yellow-bg:     #fefce8;
  --red:           #ef4444;
  --red-bg:        #fef2f2;
  --gray:          #e5e7eb;
  --gray-bg:       #f9fafb;
  --blue:          #3b82f6;
  --blue-bg:       #eff6ff;
  --radius:        12px;
  --shadow-sm:     0 1px 3px rgba(0,0,0,0.06);
  --shadow:        0 1px 3px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);
  --shadow-lg:     0 4px 16px rgba(0,0,0,0.08), 0 8px 28px rgba(0,0,0,0.04);
  --font:          -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Screens --- */
.screen {
  min-height: 100vh;
}

.screen.hidden {
  display: none;
}

#app-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-content {
  padding: 32px 32px;
  flex: 1;
}

/* ================================================================
   LOGIN
   ================================================================ */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  text-align: center;
}

.login-logo {
  display: block;
  margin: 0 auto 12px;
}

.login-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  letter-spacing: -0.5px;
}

.login-subtitle {
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
  font-size: 0.95rem;
}

.field {
  display: block;
  margin-bottom: 20px;
}

.field span {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
}

.login-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrapper input {
  flex: 1;
  padding-right: 40px;
}

.password-toggle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px;
  line-height: 1;
  color: var(--text-muted);
  transition: color 0.15s;
}

.password-toggle:hover {
  color: var(--text);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, opacity 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-outline {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}

.btn-outline:hover:not(:disabled) {
  background: var(--gray-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
}

.btn-full {
  width: 100%;
}

.btn-danger {
  background: var(--red);
  color: #fff;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 0.8rem;
}

.form-error {
  color: var(--red);
  font-size: 0.85rem;
  margin-bottom: 16px;
  background: var(--red-bg);
  padding: 8px 12px;
  border-radius: 6px;
}

.hidden {
  display: none !important;
}

/* ================================================================
   TOP BAR
   ================================================================ */

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  flex-shrink: 0;
}

.topbar-logo {
  flex-shrink: 0;
  height: 28px;
  width: auto;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.topbar-nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  position: relative;
  padding: 6px 14px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  margin-left: 4px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: middle;
}

.nav-link:hover {
  background: var(--gray-bg);
  color: var(--text);
}

.nav-link.active {
  background: var(--blue-bg);
  color: var(--primary);
}

.topbar-role {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--gray-bg);
  padding: 4px 10px;
  border-radius: 20px;
}

/* ================================================================
   MAIN CONTENT
   ================================================================ */

.main-content {
  padding: 32px 32px;
}

/* --- Action cards (accesos rápidos arriba del detalle de proyecto) --- */
.action-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 24px;
  margin-bottom: 36px;
}

.action-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 200px;
  min-height: 140px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 20px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
}

.action-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

.action-card-icon {
  font-size: 2.5rem;
  line-height: 1;
}

.action-card-label {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

/* --- Dashboard Grid --- */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
}

.stage-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid var(--border);
}

.stage-card.card-not_started { background: #e5e7eb; border-color: #d1d5db; }
.stage-card.card-in_progress { background: #22c55e; border-color: #16a34a; }
.stage-card.card-paused      { background: #facc15; border-color: #eab308; }
.stage-card.card-cancelled   { background: #ef4444; border-color: #dc2626; }
.stage-card.card-completed   { background: #3b82f6; border-color: #2563eb; }

.stage-card.card-in_progress .stage-card-name,
.stage-card.card-cancelled .stage-card-name,
.stage-card.card-completed .stage-card-name {
  color: #fff;
}

.stage-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.stage-card-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

/* Feature cards (same style as stage cards) */
.feature-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 24px;
  cursor: pointer;
  transition: box-shadow 0.2s, transform 0.2s;
  border: 1px solid var(--border);
}

.feature-card.card-not_started { background: #e5e7eb; border-color: #d1d5db; }
.feature-card.card-in_progress { background: #22c55e; border-color: #16a34a; }
.feature-card.card-paused      { background: #facc15; border-color: #eab308; }
.feature-card.card-cancelled   { background: #ef4444; border-color: #dc2626; }
.feature-card.card-completed   { background: #3b82f6; border-color: #2563eb; }

.feature-card.card-in_progress .feature-card-name,
.feature-card.card-cancelled .feature-card-name,
.feature-card.card-completed .feature-card-name {
  color: #fff;
}

.feature-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.feature-card-name {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}

/* Semi-transparent badges on colored feature cards */
.card-in_progress .badge-in_progress,
.card-cancelled .badge-cancelled,
.card-completed .badge-completed {
  background: rgba(255,255,255,0.25);
}

.card-paused .badge-paused {
  background: rgba(0,0,0,0.08);
}

.stage-card-badge {
  display: inline-block;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Stage status colors */
.badge-not_started { background: #e5e7eb;  color: #374151; }
.badge-in_progress { background: #22c55e; color: #fff; }
.badge-paused      { background: #facc15; color: #713f12; }
.badge-cancelled   { background: #ef4444; color: #fff; }
.badge-completed   { background: #3b82f6; color: #fff; }

/* Pedidos: prioridad y estado */
.badge-baja      { background: #e5e7eb; color: #374151; }
.badge-media     { background: #facc15; color: #713f12; }
.badge-alta      { background: #ef4444; color: #fff; }
.badge-pendiente { background: #facc15; color: #713f12; }
.badge-visto     { background: #3b82f6; color: #fff; }
.badge-resuelto  { background: #22c55e; color: #fff; }

/* Semi-transparent badges on colored cards */
.card-in_progress .badge-in_progress,
.card-cancelled .badge-cancelled,
.card-completed .badge-completed {
  background: rgba(255,255,255,0.25);
}

.card-paused .badge-paused {
  background: rgba(0,0,0,0.08);
}

/* --- Stage Detail (3 columns) --- */
.stage-detail-header {
  margin-bottom: 28px;
}

.stage-detail-header h2 {
  font-size: 1.5rem;
  font-weight: 700;
}

.stage-detail-header .stage-card-badge {
  margin-left: 12px;
  vertical-align: middle;
}

.stage-actions {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.column {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  border: 1px solid var(--border);
}

.column-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--border);
}

.column-empty {
  color: var(--text-light);
  font-size: 0.85rem;
  text-align: center;
  padding: 24px 0;
}

.task-card {
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: box-shadow 0.15s;
  border: 1px solid var(--border);
}

.task-card:hover {
  box-shadow: var(--shadow);
}

.task-card.dragging {
  opacity: 0.4;
}

.column.drag-over {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
  background: var(--blue-bg);
}

.task-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.task-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.task-card-date {
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--success, #2e7d32);
}

/* --- Task Detail --- */
.task-detail h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.task-detail-meta {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 20px;
}

.task-detail-desc {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
  box-shadow: var(--shadow);
  line-height: 1.7;
  white-space: pre-wrap;
}

.updates-section h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.update-item {
  background: var(--surface);
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--primary);
}

.update-item .update-date {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-bottom: 4px;
}

.update-item .update-text {
  font-size: 0.9rem;
  color: var(--text);
}

/* --- Notifications --- */
.notifications-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}

.notifications-list h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid transparent;
}

.notification-item.clickable {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.notification-item.clickable:hover {
  border-color: var(--primary);
}

.notification-item.unread {
  background: var(--blue-bg);
  border-color: #bfdbfe;
}

.notification-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
  margin-top: 6px;
}

.notification-icon {
  font-size: 1.3rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.notification-body {
  flex: 1;
}

.notification-msg {
  font-size: 0.9rem;
  color: var(--text);
}

.notification-item.unread .notification-msg {
  font-weight: 700;
}

.notification-date {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 2px;
}

/* --- Tickets --- */
.tickets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.tickets-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

/* Documentos */
.documents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.documents-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

.documents-table-wrapper {
  overflow-x: auto;
}

.documents-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.documents-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}

.documents-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.documents-row-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

/* Tags */
.tag-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag-chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  white-space: nowrap;
}

.tag-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: middle;
  border: 1px solid var(--border);
}

.tag-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  padding: 4px 0;
}

.tag-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.ticket-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  gap: 16px;
  flex-wrap: wrap;
  border: 1px solid transparent;
}

.ticket-item.clickable {
  cursor: pointer;
  transition: border-color 0.15s;
}

.ticket-item.clickable:hover {
  border-color: var(--primary);
}

.ticket-info {
  flex: 1;
}

.ticket-title {
  font-weight: 600;
  font-size: 0.95rem;
}

.ticket-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.ticket-date {
  font-size: 0.75rem;
  color: var(--text-light);
  margin-top: 4px;
}

.ticket-badge {
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}

.badge-open       { background: var(--green-bg); color: #15803d; }
.badge-in_progress { background: var(--blue-bg);  color: #1d4ed8; }
.badge-closed      { background: var(--gray);     color: #374151; }

.ticket-item-highlight {
  animation: ticket-flash 1.6s ease-out;
}

@keyframes ticket-flash {
  0%, 30%  { box-shadow: 0 0 0 3px var(--primary); background: var(--blue-bg); }
  100%     { box-shadow: var(--shadow-sm); background: var(--surface); }
}

/* --- Profile --- */
.profile-container h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.profile-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.profile-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.profile-card p {
  color: var(--text-muted);
  line-height: 1.7;
}

.profile-budget {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-state .empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

.empty-state p {
  font-size: 1rem;
}

/* --- Spinner --- */
.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 0;
}

.spinner::after {
  content: "";
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ================================================================
   MODAL
   ================================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

.modal h3 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.modal .field {
  margin-bottom: 16px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ================================================================
   SECTION HEADER (shared)
   ================================================================ */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 700;
}

/* ================================================================
   ADMIN PANEL
   ================================================================ */

.admin-panel h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
}

.admin-tab {
  padding: 8px 20px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.admin-tab:hover {
  color: var(--text);
}

.admin-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.admin-stages {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-stage-row {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

.admin-stage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-stage-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-project-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--gray-bg);
  padding: 2px 10px;
  border-radius: 4px;
}

.admin-stage-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}

.admin-stage-actions {
  display: flex;
  gap: 8px;
}

.admin-features {
  border-top: 1px solid var(--border);
  padding: 16px 20px;
  background: var(--bg);
  min-height: 60px;
}

.admin-feature-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-feature-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-radius: 8px;
  border: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.admin-feature-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-feature-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text);
}

.admin-empty {
  color: var(--text-light);
  font-size: 0.85rem;
  text-align: center;
  padding: 16px 0;
}

.admin-users-actions {
  margin-bottom: 16px;
}

.admin-users-table-wrapper {
  overflow-x: auto;
}

.admin-users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-users-table th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border);
}

.admin-users-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-uid {
  color: var(--text-light);
  font-size: 0.8rem;
  width: 40px;
}

.admin-date {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
}

.admin-user-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  white-space: nowrap;
}

/* Impersonation banner */
#impersonation-banner {
  background: #fef3c7;
  color: #92400e;
  text-align: center;
  padding: 8px 16px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

#impersonation-banner .btn {
  padding: 4px 12px;
  font-size: 0.75rem;
}

/* ================================================================
   FOOTER
   ================================================================ */

.app-footer {
  text-align: center;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.8rem;
  background: var(--surface);
}

.app-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
}

.app-footer a:hover {
  text-decoration: underline;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */

/* --- ≤1200px: moderate desktop / small laptop --- */
@media (max-width: 1200px) {
  .main-content {
    padding: 24px 20px;
  }

  .dashboard-grid {
    gap: 20px;
  }

  .columns {
    gap: 20px;
  }
}

/* --- ≤900px: tablet landscape --- */
@media (max-width: 900px) {
  .main-content {
    padding: 20px 16px;
  }

  .columns {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .dashboard-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .topbar-nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
    justify-content: flex-start;
    padding-top: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-link {
    font-size: 0.8rem;
    padding: 5px 10px;
    white-space: nowrap;
  }

  .stage-card,
  .feature-card {
    padding: 20px 18px;
  }

  .admin-stage-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .admin-stage-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .topbar-logo {
    height: 22px;
  }
}

/* --- ≤768px: tablet portrait --- */
@media (max-width: 768px) {
  .topbar {
    padding: 10px 12px;
    gap: 6px;
  }

  .topbar-title {
    font-size: 0.95rem;
  }

  .topbar-role {
    display: none;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .stage-detail-header h2 {
    font-size: 1.2rem;
  }

  .task-detail h2,
  .notifications-list h2,
  .tickets-header h2,
  .profile-container h2,
  .admin-panel h2 {
    font-size: 1.15rem;
  }

  .app-footer {
    padding: 14px 16px;
    font-size: 0.75rem;
  }
}

/* --- ≤600px: large phone / small tablet --- */
@media (max-width: 600px) {
  .main-content {
    padding: 16px 12px;
  }

  .columns {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .topbar {
    padding: 8px 10px;
    gap: 4px;
  }

  .topbar-title {
    font-size: 0.9rem;
  }

  .topbar-right {
    gap: 6px;
  }

  .btn {
    padding: 8px 14px;
    font-size: 0.8rem;
  }

  .btn-sm {
    padding: 5px 10px;
    font-size: 0.75rem;
  }

  .nav-link {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  .stage-card,
  .feature-card {
    padding: 16px 14px;
  }

  .stage-card-name,
  .feature-card-name {
    font-size: 1rem;
  }

  .column {
    padding: 14px;
  }

  .login-card {
    padding: 28px 20px;
  }

  .login-title {
    font-size: 1.5rem;
  }

  .modal {
    padding: 20px 16px;
    margin: 8px;
    max-width: none;
    border-radius: 8px;
  }

  .modal h3 {
    font-size: 1rem;
  }

  .ticket-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .admin-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-tab {
    padding: 6px 14px;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .admin-feature-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .profile-card {
    padding: 20px;
  }

  .task-detail-desc {
    padding: 14px;
  }

  .topbar-logo {
    height: 18px;
  }

  .login-logo {
    width: 36px;
    height: 36px;
    margin-bottom: 8px;
  }

  .app-footer {
    padding: 12px 12px;
    font-size: 0.7rem;
  }
}

/* --- ≤480px: phone portrait --- */
@media (max-width: 480px) {
  .main-content {
    padding: 12px 8px;
  }

  .dashboard-grid {
    gap: 10px;
  }

  .topbar {
    padding: 6px 8px;
  }

  .topbar-title {
    font-size: 0.85rem;
  }

  .btn {
    padding: 7px 12px;
    font-size: 0.78rem;
  }

  .btn-outline {
    padding: 6px 10px;
    font-size: 0.75rem;
  }

  .stage-card,
  .feature-card {
    padding: 14px 12px;
  }

  .stage-card-name,
  .feature-card-name {
    font-size: 0.95rem;
    margin-bottom: 8px;
  }

  .login-card {
    padding: 24px 16px;
  }

  .login-title {
    font-size: 1.35rem;
  }

  .field input,
  .field textarea,
  .field select {
    font-size: 0.875rem;
    padding: 8px 12px;
  }

  .modal {
    padding: 16px 12px;
  }

  .modal-actions {
    flex-direction: column;
    gap: 8px;
  }

  .modal-actions .btn {
    width: 100%;
  }

  .stage-actions {
    flex-direction: column;
  }

  .stage-actions .btn {
    width: 100%;
  }

  .section-header {
    gap: 8px;
  }

  .section-header h2 {
    font-size: 1.1rem;
  }

  .notifications-list h2,
  .tickets-header h2,
  .profile-container h2 {
    font-size: 1.05rem;
  }

  .notification-item {
    padding: 12px 14px;
    gap: 10px;
  }

  .ticket-item {
    padding: 12px 14px;
  }

  .admin-stage-header {
    padding: 12px 14px;
  }

  .admin-features {
    padding: 12px 14px;
  }

  .admin-users-table th,
  .admin-users-table td {
    padding: 8px 10px;
    font-size: 0.75rem;
  }

  .topbar-logo {
    display: none;
  }

  .login-logo {
    width: 32px;
    height: 32px;
  }

  .app-footer {
    padding: 10px 8px;
    font-size: 0.68rem;
  }
}

/* ============================================================
   Panel de progreso (burn-up real) — dashboard
   ============================================================ */
.progress-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem 1.5rem 1.5rem;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
}
.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.progress-title {
  font-size: 1.15rem;
  margin: 0;
  color: var(--text);
}
.progress-sub {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.progress-pct {
  font-size: 2.1rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.progress-pct span {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.2rem;
}
.progress-bar {
  height: 10px;
  background: var(--gray);
  border-radius: 999px;
  overflow: hidden;
  margin: 1rem 0 1.25rem;
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--green));
  border-radius: 999px;
  transition: width 0.6s ease;
}
.progress-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.pstat {
  text-align: center;
  padding: 0.6rem 0.5rem;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.pstat-num {
  display: block;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.pstat-lbl {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.15rem;
}
.burnup-wrap {
  border-top: 1px solid var(--border);
  padding-top: 1rem;
}
.burnup-caption {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.burnup-chart {
  width: 100%;
  height: auto;
  display: block;
}
.burnup-chart .bu-grid {
  stroke: var(--border);
  stroke-width: 1;
}
.burnup-chart .bu-axis {
  fill: var(--text-light);
  font-size: 11px;
  font-family: var(--font);
}
.burnup-chart .bu-area {
  fill: var(--primary);
  opacity: 0.12;
}
.burnup-chart .bu-line {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.burnup-chart .bu-dot {
  fill: var(--surface);
  stroke: var(--primary);
  stroke-width: 2;
}
.progress-empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 1rem 0;
}

/* ============================================================
   Nuevo pedido (texto/audio/imágenes/documentos) — mobile-first
   ============================================================ */
.pedido-form {
  max-width: 560px;
  margin: 0 auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.pedido-form-title {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
}

.pedido-audio-row {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.pedido-mic-btn {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: #fff;
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s, transform 0.15s;
  touch-action: none; /* el navegador no debe interpretar el drag como scroll */
  user-select: none;
  -webkit-user-select: none;
}

.pedido-mic-btn:active {
  transform: scale(0.96);
}

.pedido-mic-btn.recording {
  background: var(--red);
  animation: pedido-mic-pulse 1.2s ease-in-out infinite;
}

.pedido-mic-btn.locked {
  animation: none;
}

@keyframes pedido-mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  50%      { box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); }
}

.pedido-audio-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pedido-audio-status {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pedido-audio-hint {
  font-size: 0.78rem;
  color: var(--text-light);
}

.pedido-attach-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.pedido-attach-hint {
  font-size: 0.8rem;
  color: var(--text-light);
}

.pedido-attachments-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 8px 6px 12px;
  font-size: 0.82rem;
  color: var(--text);
  max-width: 220px;
}

.attachment-chip .chip-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
}

.attachment-chip .chip-remove:hover {
  color: var(--red);
}

.pedido-priority-row {
  margin-bottom: 24px;
}

.pedido-priority-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.pedido-priority-options {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.priority-pill {
  padding: 8px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.priority-pill.active {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #1e293b;
}

.pedido-form-success {
  color: #16a34a;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 16px;
}

@media (max-width: 480px) {
  .pedido-form {
    padding: 18px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
}

/* ── Conversación de un pedido (admin ↔ cliente) ── */

.pedido-conversation {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.pedido-conversation-title {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 12px;
}

.pedido-conversation-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  max-height: 360px;
  overflow-y: auto;
}

.pedido-conversation-empty {
  color: var(--text-light);
  font-size: 0.85rem;
  text-align: center;
  padding: 12px 0;
}

.pedido-message {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
}

.pedido-message.mine {
  align-self: flex-end;
  background: var(--blue-bg);
  border-color: #bfdbfe;
}

.pedido-message-meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 4px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pedido-message-author {
  font-weight: 700;
  color: var(--text);
}

.pedido-message-body {
  font-size: 0.9rem;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.pedido-message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.pedido-message-attachment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  color: var(--text);
  cursor: pointer;
}

.pedido-message-attachment:hover {
  border-color: var(--primary);
}

.pedido-conversation-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 8px;
  background: var(--surface);
  color: var(--text);
}

.pedido-conversation-attach-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* ── Vista dedicada de un pedido, estilo WhatsApp ── */

.admin-stage-row.clickable {
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.admin-stage-row.clickable:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.pedido-detail-view {
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
}

.pedido-detail-header {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pedido-detail-header-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.pedido-detail-folio {
  font-weight: 700;
  color: var(--text-muted);
  background: var(--gray-bg);
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.pedido-detail-requested-by {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.pedido-detail-project {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.pedido-detail-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pedido-detail-status-pills {
  display: flex;
  gap: 6px;
}

.pedido-detail-status-pills .priority-pill {
  padding: 5px 14px;
  font-size: 0.78rem;
}

.pedido-detail-closed-note {
  font-size: 0.82rem;
  font-weight: 600;
  color: #16a34a;
}

.pedido-detail-messages {
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 20px;
  height: 55vh;
  min-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pedido-message.original {
  border-style: dashed;
}

.pedido-message-transcription {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
}

.pedido-message-audio {
  margin-top: 4px;
  width: 240px;
  max-width: 100%;
}

.pedido-detail-compose {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 12px 20px 16px;
}

.pedido-detail-compose textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--font);
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 8px;
  background: var(--surface);
  color: var(--text);
}

.pedido-detail-compose-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.pedido-detail-compose-attach {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}

.pedido-mic-btn-sm {
  width: 42px;
  height: 42px;
  font-size: 1.1rem;
  flex-shrink: 0;
}

.pedido-detail-audio-status {
  font-size: 0.78rem;
  color: var(--text-muted);
  flex-basis: 100%;
}

.pedido-detail-readonly-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 14px 20px;
  text-align: center;
  color: var(--text-light);
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .pedido-detail-messages {
    height: 60vh;
  }
}

/* ============================================================
   Admin: pestaña Pedidos
   ============================================================ */
.admin-pedido-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.admin-pedido-description {
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.admin-attachment-size {
  font-size: 0.78rem;
  color: var(--text-light);
}

.admin-pedido-status-row {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.admin-pedido-status-options .priority-pill {
  padding: 6px 16px;
  font-size: 0.82rem;
}

/* ============================================================
   Modal: instrucciones de instalación en iOS
   ============================================================ */
.ios-install-steps {
  margin: 0 0 16px;
  padding-left: 20px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.6;
}

.ios-install-steps li {
  margin-bottom: 8px;
}

.ios-install-note {
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ============================================================
   Admin: transcripción + preview de imágenes/audio en Pedidos
   ============================================================ */
.admin-pedido-transcription {
  background: var(--blue-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
}

.admin-pedido-transcription-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.admin-pedido-transcription p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.admin-empty-description {
  color: var(--text-light);
  font-style: italic;
}

.admin-attachment-image .admin-feature-info,
.admin-attachment-audio .admin-feature-info {
  flex-wrap: wrap;
}

.admin-image-thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
}

.admin-image-thumb.clickable {
  cursor: pointer;
}

.admin-audio-player {
  height: 36px;
  max-width: 260px;
}

.admin-attachment-error {
  font-size: 0.8rem;
  color: var(--text-light);
  font-style: italic;
}

/* ============================================================
   Menú hamburguesa (mobile) — el topbar tiene demasiados botones
   para caber en una fila angosta: Inicio/Notificaciones/Documentos/
   Tickets/Perfil/rol/Instalar app/Salir.
   ============================================================ */
.btn-hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-hamburger:hover {
  background: var(--gray-bg);
}

@media (max-width: 768px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding: 10px 16px;
  }

  .topbar-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .btn-hamburger {
    display: flex;
    margin-left: 0;
  }

  /* "Salir" queda siempre visible fuera del desplegable; el resto colapsa. */
  .topbar-right {
    display: none;
    order: 10;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    margin-left: 0;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }

  .topbar-right.open {
    display: flex;
  }

  .topbar-nav {
    flex-direction: column;
    gap: 2px;
    width: 100%;
  }

  .nav-link {
    width: 100%;
    text-align: left;
    padding: 10px 12px;
  }

  .topbar-role {
    align-self: flex-start;
  }

  #btn-install-app {
    width: 100%;
    justify-content: center;
  }
}
