/* ===========================
   CREDERE — UI
   =========================== */

:root {
  /* ===== Tema CLARO — blanco con tonalidad azul/teal del logo CREDERE ===== */
  --color-bg: #f4f8fc;
  --color-surface: #ffffff;
  --color-surface-2: #ffffff;
  --color-surface-elev: #f3f7fb;
  --color-text: #14233a;
  --color-text-secondary: #5b6b80;
  --color-text-tertiary: #8a98a8;
  --color-border: #d4dde7;
  --color-border-subtle: #e6edf4;
  --color-accent: #1f8fd6;
  --color-accent-hover: #18b6c4;
  --color-accent-pressed: #1670b8;
  --color-accent-contrast: #ffffff;        /* texto sobre botón accent */
  --gradient-accent: linear-gradient(135deg, #1f8fd6 0%, #18b6c4 100%);
  --color-success: #1f9d57;
  --color-warning: #c77700;
  --color-error: #d6322a;
  --color-info: #0a84c2;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 980px;

  --shadow-sm: 0 1px 2px rgba(20, 50, 90, 0.06), 0 1px 1px rgba(20, 50, 90, 0.03);
  --shadow-md: 0 4px 16px rgba(20, 50, 90, 0.08), 0 1px 2px rgba(20, 50, 90, 0.05);
  --shadow-lg: 0 14px 40px rgba(20, 50, 90, 0.12), 0 2px 8px rgba(20, 50, 90, 0.06);

  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);

  --font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
                 "Helvetica Neue", "Segoe UI", Roboto, Inter, system-ui, sans-serif;

  --container-width: 1120px;
  --nav-height: 72px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1100px 520px at 85% -8%, rgba(24, 182, 196, 0.07), transparent 60%),
    radial-gradient(900px 520px at -5% 8%, rgba(31, 143, 214, 0.08), transparent 55%),
    var(--color-bg);
  background-attachment: fixed;
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: opacity var(--transition-fast);
}
a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4 {
  margin: 0 0 0.5em;
  letter-spacing: -0.022em;
  font-weight: 600;
}
h1 { font-size: 40px; line-height: 1.1; letter-spacing: -0.03em; }
h2 { font-size: 28px; line-height: 1.2; }
h3 { font-size: 21px; line-height: 1.3; }
h4 { font-size: 17px; line-height: 1.4; font-weight: 600; }

p { margin: 0 0 1em; }

.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-small { font-size: 13px; }
.text-mono { font-family: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ===========================
   Layout
   =========================== */

.container {
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

.page {
  padding: 40px 0 80px;
  min-height: calc(100vh - var(--nav-height));
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0;
  font-size: 32px;
}

.page-header .subtitle {
  color: var(--color-text-secondary);
  font-size: 17px;
  margin-top: 4px;
}

/* ===========================
   Sidebar (menú lateral)
   =========================== */

:root { --sidebar-width: 240px; }

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: #fff;
  border-right: 1px solid var(--color-border-subtle);
  display: flex;
  flex-direction: column;
  z-index: 200;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 18px 18px 14px;
  font-size: 19px;
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--color-border-subtle);
}
.sidebar-brand:hover { text-decoration: none; opacity: 0.85; }
.sidebar-brand img { height: 54px; width: 54px; object-fit: contain; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 12px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-text);
  font-size: 14.5px;
  font-weight: 500;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  transition: background var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
}
.sidebar-link:hover {
  background: rgba(20, 50, 90, 0.05);
  text-decoration: none;
}
.sidebar-link.active {
  background: var(--gradient-accent);
  color: #fff;
  font-weight: 600;
}
.sidebar-link.active .notif-dot { background: #fff; color: var(--color-accent); }

.sidebar-user {
  border-top: 1px solid var(--color-border-subtle);
  padding: 14px;
}
.sidebar-user .su-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.sidebar-user .su-name { font-size: 14px; font-weight: 600; color: var(--color-text); }
.sidebar-logout {
  color: var(--color-error);
  border: 1px solid var(--color-border-subtle);
  justify-content: center;
}
.sidebar-logout:hover { background: rgba(214, 50, 42, 0.06); }

/* Barra superior (solo mobile) */
.mobile-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 150;
  align-items: center;
  gap: 12px;
  height: 60px;
  padding: 0 16px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--color-border-subtle);
}
.sidebar-toggle { background: none; border: none; padding: 6px; cursor: pointer; color: var(--color-text); display: inline-flex; }
.mtb-brand { display: flex; align-items: center; gap: 2px; font-weight: 700; font-size: 17px; color: var(--color-text); }
.mtb-brand img { height: 38px; width: 38px; object-fit: contain; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10, 20, 35, 0.4);
  z-index: 190;
}
.sidebar-overlay.open { display: block; }

/* El contenido se corre a la derecha del sidebar */
.app-main.with-sidebar { margin-left: var(--sidebar-width); }

/* ===========================
   Buttons
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  border: none;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition: background var(--transition-fast), transform var(--transition-fast),
              box-shadow var(--transition-fast), color var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gradient-accent);
  color: var(--color-accent-contrast);
  font-weight: 600;
  box-shadow: 0 8px 22px -10px rgba(45, 212, 191, 0.55);
}
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { filter: brightness(0.95); }

.btn-secondary {
  background: rgba(20, 50, 90, 0.06);
  color: var(--color-text);
}
.btn-secondary:hover { background: rgba(20, 50, 90, 0.10); }

.btn-ghost {
  background: transparent;
  color: var(--color-accent);
  padding: 8px 14px;
}
.btn-ghost:hover { background: rgba(31, 143, 214, 0.10); }

.btn-danger {
  background: var(--color-error);
  color: white;
}
.btn-danger:hover { background: #e0352b; }

.btn-whatsapp {
  background: #25d366;
  color: #04210f;
  font-weight: 600;
}
.btn-whatsapp:hover { filter: brightness(1.05); }

.btn-large { padding: 14px 28px; font-size: 16px; }
.btn-small { padding: 6px 12px; font-size: 13px; }

.btn-block { width: 100%; }

.btn.is-disabled, .btn:disabled { opacity: 0.5; pointer-events: none; cursor: not-allowed; }

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

/* ===========================
   Cards
   =========================== */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 28px;
  border: 1px solid var(--color-border-subtle);
}

.card-elev {
  box-shadow: var(--shadow-md);
}

.card-header {
  margin: -28px -28px 24px;
  padding: 22px 28px;
  border-bottom: 1px solid var(--color-border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-header h2, .card-header h3 { margin: 0; }

.card-footer {
  margin: 24px -28px -28px;
  padding: 18px 28px;
  border-top: 1px solid var(--color-border-subtle);
  background: rgba(20, 50, 90, 0.015);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Grid for stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  border: 1px solid var(--color-border-subtle);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.stat-label {
  color: var(--color-text-secondary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
}

/* ===========================
   Forms
   =========================== */

.form-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr;
}
.form-grid.cols-2 {
  grid-template-columns: 1fr 1fr;
}
.form-grid.cols-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-section {
  margin-bottom: 32px;
}
.form-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-subtle);
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-field label {
  font-size: 13px;
  color: var(--color-text-secondary);
  font-weight: 500;
}
.form-field .help {
  font-size: 12px;
  color: var(--color-text-tertiary);
  margin-top: 2px;
}

.form-field input[type="text"],
.form-field input[type="password"],
.form-field input[type="email"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field input[type="search"],
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 4px rgba(24, 182, 196, 0.18);
}

.form-field textarea {
  resize: vertical;
  min-height: 96px;
  font-family: inherit;
}

.form-field select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='%235b6b80' d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: 36px;
}

.form-field select[multiple] {
  background-image: none;
  padding: 8px;
  min-height: 140px;
}

.form-field .error-msg {
  color: var(--color-error);
  font-size: 12px;
  margin-top: 4px;
}

.form-field input.has-error,
.form-field select.has-error,
.form-field textarea.has-error {
  border-color: var(--color-error);
  box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.15);
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
}
.checkbox-field input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-accent);
}
.checkbox-field label { font-size: 14px; margin: 0; color: var(--color-text); }

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

/* ===========================
   Tables
   =========================== */

.table-wrap {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;          /* en mobile la tabla se desplaza para ver todos los datos */
  -webkit-overflow-scrolling: touch;
}

.nav-logout-mobile { display: none; }  /* en desktop el "Salir" está arriba a la derecha */

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th, .table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--color-border-subtle);
}
.table tbody tr:last-child td { border-bottom: none; }

.table th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  background: rgba(20, 50, 90, 0.025);
}

.table tbody tr {
  transition: background var(--transition-fast);
}
.table tbody tr:hover {
  background: rgba(31, 143, 214, 0.06);
}

.table .row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* ===========================
   Badges
   =========================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
}
.badge-success { background: rgba(31, 157, 87, 0.14); color: #1f8a3b; }
.badge-warning { background: rgba(199, 119, 0, 0.16); color: #b76900; }
.badge-error { background: rgba(214, 50, 42, 0.13); color: #c4302b; }
.badge-info { background: rgba(10, 132, 194, 0.14); color: #0a78a0; }
.badge-neutral { background: rgba(20, 50, 90, 0.07); color: var(--color-text-secondary); }
.badge-accent { background: rgba(31, 143, 214, 0.13); color: var(--color-accent); }

/* Globito de notificaciones sin leer */
.notif-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--color-error);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  margin-left: 2px;
  vertical-align: middle;
}

/* ===========================
   Flash messages
   =========================== */

.flash-stack {
  position: fixed;
  top: 72px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 380px;
}

.flash {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-subtle);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slide-in 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.flash-success { border-left: 3px solid var(--color-success); }
.flash-error   { border-left: 3px solid var(--color-error); }
.flash-info    { border-left: 3px solid var(--color-info); }
.flash-warning { border-left: 3px solid var(--color-warning); }

.flash-close {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--color-text-tertiary);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

@keyframes slide-in {
  from { transform: translateX(20px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ===========================
   Hero / Search
   =========================== */

.hero {
  text-align: center;
  padding: 60px 20px 40px;
}
.hero h1 {
  font-size: 52px;
  margin-bottom: 12px;
}
.hero p {
  font-size: 20px;
  color: var(--color-text-secondary);
  max-width: 580px;
  margin: 0 auto 32px;
}

.search-box {
  max-width: 520px;
  margin: 0 auto;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 8px;
  display: flex;
  gap: 8px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-subtle);
  transition: box-shadow var(--transition-base);
}
.search-box:focus-within {
  box-shadow: 0 12px 40px rgba(24, 182, 196, 0.22);
  border-color: var(--color-accent);
}
.search-box input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 18px;
  padding: 12px 18px;
  color: var(--color-text);
  font-family: inherit;
  letter-spacing: 0.02em;
}
.search-box input::placeholder {
  color: var(--color-text-tertiary);
}

/* ===========================
   Empty state
   =========================== */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-secondary);
}
.empty-state h3 {
  color: var(--color-text);
  margin-bottom: 8px;
}

/* ===========================
   Detail (cliente)
   =========================== */

.detail-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.detail-item {
  background: rgba(20, 50, 90, 0.025);
  border: 1px solid var(--color-border-subtle);
  padding: 14px 16px;
  border-radius: var(--radius-md);
}
.detail-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}
.detail-value {
  font-size: 15px;
  color: var(--color-text);
  font-weight: 500;
}

/* ===========================
   Auth page
   =========================== */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 480px at 80% 0%, rgba(24, 182, 196, 0.10), transparent 60%),
    radial-gradient(800px 480px at 0% 100%, rgba(31, 143, 214, 0.12), transparent 55%),
    var(--color-bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-subtle);
}
.auth-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 2px;
}
.auth-logo img {
  height: 200px;
  width: 200px;
  object-fit: contain;
  filter: drop-shadow(0 6px 18px rgba(31, 143, 214, 0.25));
}

.auth-card h1 {
  font-size: 30px;
  text-align: center;
  margin-top: 0;
  margin-bottom: 8px;
}
.auth-card .auth-subtitle {
  text-align: center;
  color: var(--color-text-secondary);
  margin-bottom: 32px;
  font-size: 15px;
}

/* ===========================
   Operation amount highlight
   =========================== */

.amount {
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}
.amount-large {
  font-size: 22px;
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
}

/* ===========================
   Operation list
   =========================== */

.op-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.op-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.op-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}
.op-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.op-meta {
  font-size: 13px;
  color: var(--color-text-secondary);
}
.op-obs {
  margin-top: 8px;
  font-size: 14px;
  color: var(--color-text-secondary);
  font-style: italic;
}

/* ===========================
   Client header (3-col)
   =========================== */

.client-header {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  margin-bottom: 20px;
}
.client-header-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 24px;
}
.client-header-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.client-header-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  font-weight: 600;
}
.client-header-value {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
}
.client-header-value-strong {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text);
}
.client-header-value-badge {
  font-size: 14px;
  margin-top: 2px;
}
.client-header-sub {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* ===========================
   Tabs
   =========================== */

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  padding: 6px;
  background: rgba(20, 50, 90, 0.05);
  border-radius: var(--radius-pill);
  width: fit-content;
}

.tab {
  background: transparent;
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast),
              box-shadow var(--transition-fast);
  white-space: nowrap;
}
.tab:hover {
  color: var(--color-text);
  background: rgba(20, 50, 90, 0.05);
}
.tab.active {
  background: var(--color-surface-2);
  color: var(--color-accent);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

.tab-content {
  display: none;
  animation: fade-in 200ms ease-out;
}
.tab-content.active {
  display: block;
}
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.data-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border-subtle);
}

/* ===========================
   Plus button (search empty state)
   =========================== */

.plus-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background: var(--color-accent);
  color: white;
  margin: 18px auto;
  transition: transform var(--transition-base), box-shadow var(--transition-base),
              background var(--transition-fast);
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.25);
}
.plus-button:hover {
  background: var(--color-accent-hover);
  transform: scale(1.05);
  box-shadow: 0 8px 22px rgba(0, 113, 227, 0.32);
  text-decoration: none;
}
.plus-button:active { transform: scale(0.97); }

/* ===========================
   Pad de firma
   =========================== */

.signature-wrap {
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  padding: 10px;
  background: rgba(255, 255, 255, 0.02);
  max-width: 620px;
}
.signature-pad {
  width: 100%;
  height: 200px;
  display: block;
  border-radius: var(--radius-sm);
  background: #ffffff;            /* pad blanco: el cliente firma como en papel */
  border: 1px solid var(--color-border-subtle);
  touch-action: none;
  cursor: crosshair;
}
.signature-actions {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* ===========================
   Footer
   =========================== */

.footer {
  text-align: center;
  padding: 32px 20px;
  color: var(--color-text-tertiary);
  font-size: 12px;
  border-top: 1px solid var(--color-border-subtle);
  margin-top: 60px;
}

/* ===========================
   Responsive
   =========================== */

/* En pantallas chicas el sidebar se esconde y se abre con el botón ☰ */
@media (max-width: 900px) {
  .mobile-topbar { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s var(--ease, ease);
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .app-main.with-sidebar { margin-left: 0; }
}

@media (max-width: 768px) {
  h1 { font-size: 30px; }
  .hero h1 { font-size: 36px; }
  .hero p { font-size: 17px; }

  .client-header-grid { grid-template-columns: 1fr; gap: 16px; }
  .client-header-value { font-size: 22px; }

  .tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .tab { flex-shrink: 0; }

  .form-grid.cols-2,
  .form-grid.cols-3 { grid-template-columns: 1fr; }

  .card { padding: 20px; }
  .card-header, .card-footer { margin-left: -20px; margin-right: -20px; padding-left: 20px; padding-right: 20px; }
  .card-header { margin-top: -20px; }
  .card-footer { margin-bottom: -20px; }

  .page { padding: 24px 0 60px; }

  .table { font-size: 13px; }
  .table th, .table td { padding: 10px 12px; white-space: nowrap; }
  /* En mobile NO ocultamos columnas: la tabla se desplaza horizontalmente
     dentro de .table-wrap para poder ver todos los detalles. */

  .op-card { grid-template-columns: 1fr; }

  .flash-stack { left: 16px; right: 16px; max-width: none; }
}
