/*
THESIS: A working document desk, not a generic SaaS dashboard; the living PDF is the primary object.
OWN-WORLD: Crisp white paper, ink-blue rules, MYOS magenta for committed actions, and institutional aqua as a quiet supporting note.
STORY: Staff complete a budget once, see the final document immediately, and export the original PDF with precise overlay data and digital signatures.
FIRST VIEWPORT: A narrow institutional rail leads into one continuous editor sheet and a tall, anchored PDF preview; generation stays top-right.
FORM: Operate-mode split editor and proof sheet, chosen for side-by-side certainty at the reception desk.
*/
:root {
  --ink: #18223b;
  --blue: #1e438e;
  --magenta: #e90083;
  --aqua: #49b99f;
  --canvas: #f5f7fb;
  --paper: #ffffff;
  --muted: #65708a;
  --rule: #dce3ef;
  --soft: #edf1f8;
  --shadow: 0 16px 34px rgba(24, 34, 59, 0.10);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
}

.app-shell { min-height: 100vh; display: flex; }

/* Sidebar */
.sidebar {
  width: 250px;
  background: #fff;
  border-right: 1px solid var(--rule);
  padding: 24px 16px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  box-shadow: 2px 0 10px rgba(24, 34, 59, 0.02);
}
.brand-link {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
  padding: 4px 6px 20px;
  border-bottom: 1px solid var(--rule);
}
.brand-docly-img {
  max-width: 170px;
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
  transition: transform 0.18s ease;
}
.brand-docly-img:hover {
  transform: scale(1.03);
}

.nav-list {
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.nav-item {
  border: 0;
  background: none;
  color: #53617c;
  cursor: pointer;
  text-align: left;
  padding: 11px 14px;
  border-radius: 10px;
  font: 700 13.5px inherit;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.15s ease;
}
.nav-item:hover {
  background: #f4f7fc;
  color: var(--blue);
}
.nav-item.active {
  background: #eaf0fb;
  color: var(--blue);
  box-shadow: inset 3px 0 0 var(--magenta);
}
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
}
.sidebar-footer {
  margin-top: 8px;
  border-top: none;
  padding: 4px 6px 0;
  color: #94a3b8;
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.presence-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--aqua);
  margin-right: 6px;
}

/* Mobile App Components (Hidden on Desktop) */
.mobile-app-header {
  display: none;
}
.mobile-bottom-nav {
  display: none;
}
.mobile-app-drawer-backdrop {
  display: none;
}

/* Main Content */
.main-content {
  width: calc(100% - 245px);
  padding: 38px 46px 60px;
}
.view { display: none; max-width: 1500px; margin: auto; }
.view.active-view { display: block; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 30px;
  gap: 18px;
}
.kicker {
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--blue);
  font-weight: 800;
  margin: 0 0 8px;
}
.topbar h1 {
  font-size: 32px;
  letter-spacing: -.035em;
  line-height: 1;
  margin: 0;
}
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.template-pill, .status-badge {
  font-size: 11px;
  font-weight: 800;
  color: var(--blue);
  background: #eaf0fb;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.3;
}
.primary-button {
  background: var(--magenta);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 13px 16px;
  min-height: 44px;
  font-weight: 800;
  cursor: pointer;
  font: inherit;
  box-shadow: 0 7px 14px rgba(233,0,131,.18);
  transition: background 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.primary-button:hover { background: #c80070; transform: translateY(-1px); }
.primary-button:active { transform: translateY(0); }
.quiet-button {
  border: 1px solid var(--rule);
  background: #fff;
  color: var(--blue);
  font: 700 12px inherit;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  transition: all 0.15s;
}
/* Branch / Brand Base Template Switcher */
.branch-selector-bar {
  background: #ffffff;
  border: 1px solid #d4deed;
  border-radius: 12px;
  padding: 14px 20px;
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  box-shadow: 0 4px 14px rgba(24, 34, 59, 0.04);
}
.branch-selector-info strong {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
}
.branch-selector-info p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.branch-actions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.branch-switcher-pills {
  display: inline-flex;
  background: #edf2f8;
  padding: 3px;
  border-radius: 999px;
  gap: 3px;
  border: 1px solid #d0dcee;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(226, 232, 240, 0.5);
  padding: 4px;
  border-radius: 999px;
  flex-wrap: wrap;
}
.branch-btn-group {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  padding: 4px 6px 4px 12px;
  gap: 6px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.branch-btn-group:hover {
  border-color: #93c5fd;
  background: #ffffff;
}
.branch-btn-group.active {
  border-color: #1e438e;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(30, 67, 142, 0.16);
}
.branch-btn {
  border: none;
  background: transparent;
  padding: 4px 2px;
  font-weight: 800;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s ease;
  white-space: nowrap;
  pointer-events: none;
}
.branch-btn:hover {
  color: #0f172a;
}
.branch-btn-group.active .branch-btn {
  color: #1e438e;
}
.branch-radio {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  display: inline-block;
  transition: background 0.15s;
  pointer-events: none;
}
.branch-btn-group.active .branch-radio,
.branch-btn.active .branch-radio {
  background: #db2777;
}
.branch-edit-btn {
  border: none;
  background: #f1f5f9;
  color: #64748b;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
  pointer-events: auto;
}
.branch-edit-btn:hover {
  color: #1e438e;
  background: #e2e8f0;
  transform: scale(1.08);
}
.btn-add-branch-active {
  background: #eff6ff;
  border: 1.5px solid #93c5fd;
  color: #1e438e;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-add-branch-active:hover {
  background: #1e438e;
  border-color: #1e438e;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 67, 142, 0.2);
}
.btn-add-branch-pro {
  background: #ffffff;
  border: 1px dashed #94a3b8;
  color: #475569;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 800;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.btn-add-branch-pro:hover {
  border-color: var(--magenta);
  color: var(--magenta);
  background: #fdf5f9;
}
.btn-active-tpl {
  background: #059669 !important;
  color: #ffffff !important;
}
.btn-action-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fdf2f8;
  color: var(--magenta);
  border: 1.5px solid #fbcfe8;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  transition: all 0.15s ease;
}
.btn-action-add:hover {
  background: var(--magenta);
  border-color: var(--magenta);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(219, 39, 119, 0.2);
}
.btn-action-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #fef2f2;
  color: #dc2626;
  border: 1.5px solid #fecaca;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-action-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.2);
}
.btn-action-secondary-sm {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f8fafc;
  color: #475569;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-action-secondary-sm:hover {
  background: #eff6ff;
  color: #1e438e;
  border-color: #93c5fd;
}

/* Document Type Selector Strip */
.doc-type-selector {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
  background: #f1f5fb;
  border: 1px solid #d4deed;
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 22px;
}
.doc-type-btn {
  border: 1px solid transparent;
  background: transparent;
  padding: 10px 12px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  font: inherit;
}
.doc-type-btn:hover {
  background: #e7eef8;
}
.doc-type-btn.active {
  background: #ffffff;
  border-color: #cbd9ee;
  box-shadow: 0 4px 12px rgba(24, 34, 59, 0.08);
}
.doc-type-btn.disabled-pro {
  opacity: 0.52;
  background: #edf1f7;
  border-color: #dde3ed;
  cursor: not-allowed;
  filter: grayscale(0.85);
}
.doc-type-btn.disabled-pro:hover {
  background: #edf1f7;
  border-color: #dde3ed;
  box-shadow: none;
}
.doc-type-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pro-lock-badge {
  font-size: 9px;
  font-weight: 900;
  padding: 1px 5px;
  border-radius: 4px;
  background: #cbd5e1;
  color: #334155;
  letter-spacing: 0.03em;
}
.doc-type-icon {
  font-size: 20px;
  line-height: 1;
  flex-shrink: 0;
}
.doc-type-info strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
  font-weight: 800;
}
.doc-type-btn.active .doc-type-info strong {
  color: var(--blue);
}
.doc-type-info small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 1px;
}

/* Universal Template Preset Configuration Bar */
.template-preset-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 18px;
  box-sizing: border-box;
}

.preset-bar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.preset-icon-badge {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: #eff6ff;
  color: #1e438e;
  border: 1px solid #bfdbfe;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preset-bar-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.preset-bar-text strong {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-bar-text small {
  font-size: 11px;
  color: #64748b;
  font-weight: 500;
}

.preset-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-preset-reset {
  height: 30px;
  padding: 0 10px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 7px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-preset-reset:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

.btn-preset-save {
  height: 30px;
  padding: 0 12px;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 7px;
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%);
  border: none;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(30, 67, 142, 0.18);
  transition: all 0.15s ease;
}

.btn-preset-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(30, 67, 142, 0.28);
}

.btn-preset-save.saved-success {
  background: #10b981 !important;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.25) !important;
}

@media (max-width: 640px) {
  .template-preset-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .preset-bar-actions {
    justify-content: flex-end;
    width: 100%;
  }
  .btn-preset-save, .btn-preset-reset {
    flex: 1;
    justify-content: center;
  }
}
.doc-specific-section {
  animation: fadeIn 0.18s ease-out;
}

/* Rx / Prescription row in editor */
.rx-row {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr 24px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid #edf0f5;
}
.rx-row input {
  width: 100%;
  border: 1px solid #d3dbe8;
  border-radius: 7px;
  height: 37px;
  padding: 0 9px;
  color: var(--ink);
  font: 500 13px inherit;
  outline: none;
}
.rx-row input:focus { border-color: var(--blue); }

/* Budget Layout */
.budget-layout {
  display: grid;
  grid-template-columns: minmax(530px, 1fr) minmax(390px, .73fr);
  gap: 30px;
  align-items: start;
}
.editor-sheet, .manage-sheet, .history-sheet {
  background: var(--paper);
  border-radius: 14px;
  border: 1px solid var(--rule);
  box-shadow: var(--shadow);
}
.editor-sheet { padding: 30px; }
.sheet-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 25px;
}
.sheet-heading h2, .preview-header h2, .template-card h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: -.02em;
}
.sheet-heading p, .template-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.save-state {
  font-size: 11px;
  color: var(--aqua);
  font-weight: 750;
  padding-top: 4px;
}
.form-section {
  border: 0;
  border-top: 1px solid var(--rule);
  padding: 21px 0 0;
  margin: 0 0 23px;
}
.form-section legend {
  padding: 0;
  margin: 0 0 14px;
  font-weight: 800;
  font-size: 13px;
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 7px; font-size: 12px; font-weight: 700; color: #46536d; }
.field-wide { grid-column: span 2; }
.field input, .field textarea {
  border: 1px solid #cbd5e5;
  background: #fff;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 11px;
  color: var(--ink);
  font: 500 14px inherit;
  outline: none;
  width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field select, select.field-select {
  border: 1.5px solid #cbd5e1;
  background-color: #ffffff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%231e438e' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px 16px;
  border-radius: 10px;
  min-height: 46px;
  padding: 0 42px 0 14px;
  color: #0f172a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  outline: none;
  width: 100%;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: all 0.2s ease;
}
.field select:hover, select.field-select:hover {
  border-color: #94a3b8;
  background-color: #f8fafc;
}
.field select:focus, select.field-select:focus {
  border-color: #1e438e;
  box-shadow: 0 0 0 3px rgba(30, 67, 142, 0.12), 0 2px 4px rgba(15, 23, 42, 0.06);
  background-color: #ffffff;
}
.field select option, select.field-select option {
  background-color: #ffffff;
  color: #0f172a;
  padding: 12px 14px;
  font-weight: 600;
  font-size: 14px;
}
.field textarea { padding: 10px 11px; resize: vertical; }
.field input:focus, .field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #eaf0fb;
}

/* Premium Custom Date Picker */
.field-date-custom {
  position: relative;
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #46536d;
}
.custom-date-picker {
  position: relative;
  width: 100%;
}
.date-picker-trigger {
  width: 100%;
  border: 1px solid #cbd5e5;
  background: #ffffff;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  transition: all 0.15s ease;
}
.date-picker-trigger:hover {
  border-color: var(--blue);
  background: #fbfdff;
}
.date-picker-trigger:focus, .date-picker-trigger.active {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #eaf0fb;
  outline: none;
}
.picker-date-text {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}
.picker-date-text strong {
  font-weight: 600;
  color: var(--ink);
}
.cal-icon {
  font-size: 16px;
  line-height: 1;
}
.chevron-icon {
  font-size: 11px;
  color: var(--muted);
  transition: transform 0.2s ease;
}
.date-picker-trigger.active .chevron-icon, .custom-select-trigger.active .chevron-icon {
  transform: rotate(180deg);
}

/* Calendar Popover */
.calendar-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 310px;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #d8e2f0;
  box-shadow: 0 18px 45px rgba(24, 34, 59, 0.18);
  padding: 16px;
  z-index: 600;
  animation: slideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.calendar-popover[hidden] { display: none; }
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal-month-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
  text-transform: capitalize;
}
.cal-nav-btn {
  background: #f0f4fa;
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-nav-btn:hover {
  background: var(--blue);
  color: #fff;
}
.cal-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eef2f8;
}
.cal-preset-btn {
  background: #f5f8fc;
  border: 1px solid #e1e8f5;
  color: #4a5873;
  padding: 4px 8px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.cal-preset-btn:hover {
  background: #eaf0fb;
  color: var(--blue);
  border-color: var(--blue);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  margin-bottom: 6px;
}
.cal-days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day {
  aspect-ratio: 1;
  border: 0;
  background: transparent;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.12s;
}
.cal-day:hover:not(.empty) {
  background: #eaf2fd;
  color: var(--blue);
}
.cal-day.today {
  position: relative;
  font-weight: 800;
  color: var(--blue);
}
.cal-day.today::after {
  content: '';
  position: absolute;
  bottom: 3px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--magenta);
}
.cal-day.selected {
  background: var(--magenta) !important;
  color: #ffffff !important;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(233, 0, 131, 0.3);
}
.cal-day.selected::after {
  background: #fff;
}
.cal-day.other-month {
  color: #b0bccf;
}

/* Premium Custom Select for Professionals */
.field-prof-custom {
  position: relative;
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: #46536d;
}
.custom-select-container {
  position: relative;
  width: 100%;
}
.custom-select-trigger {
  width: 100%;
  border: 1px solid #cbd5e5;
  background: #fbfcfe;
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: all 0.15s;
}
.custom-select-trigger:hover {
  border-color: var(--blue);
  background: #ffffff;
}
.custom-select-trigger:focus, .custom-select-trigger.active {
  border-color: var(--blue);
  background: #ffffff;
  box-shadow: 0 0 0 3px #eaf0fb;
  outline: none;
}
.trigger-prof-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.trigger-text strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
}
.trigger-text small {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}
.trigger-right-side {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Custom Select Dropdown Menu */
.custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: #ffffff;
  border-radius: 12px;
  border: 1px solid #d8e2f0;
  box-shadow: 0 20px 45px rgba(24, 34, 59, 0.2);
  z-index: 600;
  overflow: hidden;
  animation: slideUp 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.custom-select-menu[hidden] { display: none; }
.select-items-list {
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
}
.select-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s;
}
.select-option:hover {
  background: #f2f7ff;
}
.select-option.selected {
  background: #eaf0fb;
}
.select-option .doctor-avatar {
  width: 34px;
  height: 34px;
  font-size: 11px;
}
.select-option-info {
  flex: 1;
}
.select-option-info strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}
.select-option-info p {
  margin: 2px 0 0;
  font-size: 11px;
  color: var(--muted);
}
.select-option-check {
  color: var(--blue);
  font-weight: 900;
  font-size: 15px;
}
.select-menu-footer {
  padding: 10px 14px;
  background: #f8fafe;
  border-top: 1px solid #edf2fa;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sig-status-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 6px;
  background: #eef2f9;
  color: var(--muted);
}
.sig-status-badge.has-sig {
  background: #e6f7f2;
  color: #0b7a5e;
}

/* Custom Branch Style Select */
.branch-style-icon-preview {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
#customBranchStyleSelect .custom-select-trigger {
  min-height: 46px;
  padding: 8px 14px;
}
#customBranchStyleSelect .custom-select-menu {
  top: calc(100% + 4px);
  z-index: 999;
}
#customBranchStyleSelect .select-option {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
#customBranchStyleSelect .select-option:hover {
  background: #f1f5f9;
}
#customBranchStyleSelect .select-option.selected {
  background: #e0f2fe;
}

/* Treatments table */
.legend-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.legend-row legend { margin: 0; }
.text-button {
  border: 0;
  background: transparent;
  color: var(--magenta);
  font: 800 12px inherit;
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s;
}
.text-button:hover { opacity: 0.8; text-decoration: underline; }
.treatment-head, .treatment-row {
  display: grid;
  grid-template-columns: minmax(145px, 1.55fr) minmax(100px, .8fr) minmax(100px, .8fr) 24px;
  gap: 8px;
  align-items: center;
}
.treatment-head {
  font-size: 10px;
  color: var(--muted);
  font-weight: 800;
  letter-spacing: .04em;
  padding: 0 0 8px;
}
.treatment-row {
  padding: 8px 0;
  border-top: 1px solid #edf0f5;
}
.treatment-row input {
  width: 100%;
  border: 1px solid #d3dbe8;
  border-radius: 7px;
  height: 37px;
  padding: 0 9px;
  color: var(--ink);
  font: 500 13px inherit;
  outline: none;
}
.treatment-row input:focus { border-color: var(--blue); }
.delete-row {
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: #8490a8;
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 4px;
}
.delete-row:hover { color: var(--magenta); background: #fdf0f7; }

/* Totals Strip */
.totals-strip {
  display: grid;
  grid-template-columns: 1fr 1fr 1.1fr;
  border: 1px solid #cbd9ee;
  border-radius: 10px;
  overflow: hidden;
  margin: 2px 0 22px;
}
.totals-strip > div {
  padding: 14px 15px;
  border-right: 1px solid #cbd9ee;
  display: grid;
  gap: 5px;
  background: #f6f9fe;
}
.totals-strip > div:last-child { border: 0; }
.totals-strip span { font-size: 10px; color: var(--muted); font-weight: 800; }
.totals-strip strong { font-size: 16px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.totals-strip .savings { background: #e8f8f2; }
.totals-strip .savings strong { color: #13775f; }
.observations { margin-top: 0; }

.input-secret-key {
  -webkit-text-security: disc;
  font-family: monospace, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas;
  letter-spacing: 2px;
}

/* Preview Column & Overlay */
.preview-column { position: sticky; top: 28px; }
.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 14px;
}
.preview-header h2 { font-size: 17px; }
#previewBranchSwitcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: none;
  padding: 0;
  flex-wrap: wrap;
}
#previewBranchSwitcher .branch-btn-group {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  padding: 3px 6px 3px 10px;
  gap: 4px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
#previewBranchSwitcher .branch-btn-group:hover {
  border-color: #93c5fd;
  background: #ffffff;
}
#previewBranchSwitcher .branch-btn-group.active {
  border-color: #3b82f6;
  background: #ffffff;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.18);
}
#previewBranchSwitcher .branch-btn-group .branch-btn {
  font-size: 11.5px;
  font-weight: 800;
  color: #334155;
  white-space: nowrap;
  padding: 2px 0;
}
#previewBranchSwitcher .branch-btn-group.active .branch-btn {
  color: #1e40af;
}
#previewBranchSwitcher .branch-edit-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  padding: 0;
}
#previewBranchSwitcher .branch-edit-btn:hover {
  background: #e2e8f0;
  color: #1e438e;
}
.preview-paper-wrap {
  padding: 15px;
  background: #e9eef7;
  border: 1px solid #d4deed;
  border-radius: 14px;
  box-shadow: 0 15px 30px rgba(24,34,59,.08);
}
.preview-paper {
  position: relative;
  line-height: 1;
  width: 100%;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 18px rgba(24,34,59,.15);
  container-type: inline-size;
}
.preview-paper > img { display: block; width: 100%; height: auto; }

/* Overlay Rendered Elements */
.document-overlay {
  position: absolute;
  inset: 0;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  color: #171717;
  pointer-events: none;
}
.document-overlay .pdf-date {
  position: absolute;
  left: 8%;
  top: 18.8%;
  font-size: 1.85cqw;
  font-weight: 700;
  color: #18223b;
}
.document-overlay .pdf-patient {
  position: absolute;
  left: 8%;
  top: 22%;
  font-size: 1.85cqw;
  font-weight: 700;
  color: #18223b;
  max-width: 84%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.document-overlay .pdf-dni {
  position: absolute;
  left: 8%;
  top: 25.2%;
  font-size: 1.85cqw;
  font-weight: 700;
  color: #18223b;
}
.document-overlay .pdf-table {
  position: absolute;
  left: 8%;
  top: 31%;
  width: 80%;
  font-size: 1.7cqw;
}
.pdf-table-header, .pdf-treatment, .pdf-total {
  display: grid;
  grid-template-columns: 1.65fr .8fr .8fr;
  gap: 3px;
}
.pdf-table-header {
  font-size: .95em;
  color: #1e438e;
  font-weight: 800;
  border-bottom: 1.5px solid #1e438e;
  padding-bottom: 4px;
}
.pdf-treatment {
  padding: 5px 0;
  border-bottom: 1px solid rgba(24,34,59,.16);
}
.pdf-total { font-weight: 800; padding-top: 6px; font-size: 1.05em; }
.pdf-saving { margin-top: 7px; color: #13775f; font-weight: 700; font-size: .95em; }
.pdf-observation {
  position: absolute;
  left: 8%;
  top: 64%;
  width: 48%;
  font-size: 1.35cqw;
  color: #1e293b;
  line-height: 1.3;
}
.pdf-observation strong {
  color: #1e438e;
  font-weight: 800;
}

/* Rx Overlay Styles */
.pdf-rx-body {
  position: absolute;
  left: 8%;
  top: 31%;
  width: 80%;
  font-size: 1.6cqw;
  color: #18223b;
}
.pdf-rx-heading {
  font-size: 1.8cqw;
  font-weight: 900;
  color: #1e438e;
  margin-bottom: 8px;
  border-bottom: 1.5px solid #1e438e;
  padding-bottom: 4px;
  display: flex;
  justify-content: space-between;
}
.pdf-rx-item {
  padding: 6px 0;
  border-bottom: 1px solid rgba(24, 34, 59, 0.12);
}
.pdf-rx-item strong {
  color: #18223b;
  font-size: 1.05em;
  display: block;
}
.pdf-rx-item small {
  color: #4a5568;
  font-size: 0.9em;
  display: block;
  margin-top: 2px;
}
.pdf-rx-instructions {
  margin-top: 14px;
  background: rgba(240, 246, 255, 0.7);
  padding: 8px 12px;
  border-radius: 6px;
  border-left: 3px solid #1e438e;
  font-size: 0.9em;
  line-height: 1.35;
}

/* Consent Overlay Styles */
.pdf-consent-body {
  position: absolute;
  left: 8%;
  top: 31%;
  width: 82%;
  font-size: 1.45cqw;
  color: #1e293b;
  line-height: 1.4;
}
.pdf-consent-heading {
  font-size: 1.6cqw;
  font-weight: 900;
  color: #1e438e;
  margin-bottom: 10px;
  border-bottom: 1.5px solid #1e438e;
  padding-bottom: 4px;
}
.pdf-consent-box {
  background: rgba(248, 250, 253, 0.85);
  border: 1px solid rgba(30, 67, 142, 0.18);
  border-radius: 6px;
  padding: 10px 12px;
  margin: 8px 0;
}
.pdf-consent-box strong { color: #1e438e; }

/* Certificate Overlay Styles */
.pdf-cert-body {
  position: absolute;
  left: 8%;
  top: 31%;
  width: 82%;
  font-size: 1.55cqw;
  color: #1e293b;
  line-height: 1.45;
}
.pdf-cert-heading {
  font-size: 1.7cqw;
  font-weight: 900;
  color: #1e438e;
  text-align: center;
  margin-bottom: 14px;
  border-bottom: 1.5px solid #1e438e;
  padding-bottom: 5px;
}
.pdf-cert-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
  background: #f7fafc;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

/* Indications Overlay Styles */
.pdf-indications-body,
.pdf-study-body,
.pdf-referral-body,
.pdf-hc-body,
.pdf-data-body,
.pdf-evolution-body,
.pdf-appointment-body {
  position: absolute;
  left: 8%;
  top: 31%;
  width: 82%;
  font-size: 1.4cqw;
  color: #1e293b;
  line-height: 1.4;
}
.pdf-doc-heading {
  font-size: 1.55cqw;
  font-weight: 900;
  color: #1e438e;
  margin-bottom: 10px;
  border-bottom: 1.5px solid #1e438e;
  padding-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.pdf-box-item {
  background: rgba(248, 250, 253, 0.85);
  border: 1px solid rgba(30, 67, 142, 0.18);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 6px 0;
}
.pdf-box-item strong {
  color: #1e438e;
}
.pdf-appointment-badge {
  background: #eff6ff;
  border: 1.5px solid #1e438e;
  border-radius: 8px;
  padding: 10px 14px;
  margin: 10px 0;
  display: flex;
  justify-content: space-around;
  align-items: center;
}

/* Discount % Control Box */
.discount-control-box {
  margin: 0 0 16px;
  padding: 14px 16px;
  background: #f4fbf8;
  border: 1px solid #c9ede2;
  border-radius: 11px;
}
.discount-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.discount-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.discount-badge-icon {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  max-width: 32px;
  max-height: 32px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: var(--aqua);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
}
.discount-title strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}
.discount-title small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}
.applied-discount-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  border-radius: 6px;
  background: #e1f5ee;
  color: #0b7a5e;
  white-space: nowrap !important;
  flex-shrink: 0 !important;
  line-height: 1.2;
}
.discount-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}
.discount-chip {
  border: 1px solid #bcead9;
  background: #ffffff;
  color: #106650;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}
.discount-chip:hover {
  background: #e8f8f2;
  border-color: var(--aqua);
}
.discount-chip.active {
  background: #12876b;
  color: #ffffff;
  border-color: #12876b;
  box-shadow: 0 3px 8px rgba(18, 135, 107, 0.25);
}
.custom-discount-wrap {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #bcead9;
  border-radius: 20px;
  padding: 0 10px 0 8px;
  height: 32px;
}
.custom-discount-wrap input {
  width: 48px;
  border: 0;
  outline: none;
  font: 700 12px inherit;
  color: var(--ink);
  padding: 0;
}
.custom-discount-wrap span {
  font-size: 12px;
  font-weight: 800;
  color: #106650;
}

/* Promo Tag Badge on Document (Under Logo) */
.document-overlay .pdf-promo-badge {
  position: absolute;
  right: 8%;
  top: 16.8%;
  width: 36%;
  background: linear-gradient(135deg, #e90083 0%, #ff2a6d 100%);
  color: #ffffff;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 1.75cqw;
  font-weight: 900;
  letter-spacing: 0.05em;
  box-shadow: 0 5px 16px rgba(233, 0, 131, 0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  transform: rotate(-1.5deg);
  border: 2px solid #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: popIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes popIn {
  0% { transform: scale(0.8) rotate(-5deg); opacity: 0; }
  100% { transform: scale(1) rotate(-1.5deg); opacity: 1; }
}

/* Promo Tag Section in Form */
.promo-tag-section {
  margin: 4px 0 20px;
  padding: 14px 16px;
  background: #fdf5f9;
  border: 1px dashed #f2b8d9;
  border-radius: 11px;
}
.promo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}
.promo-chip {
  border: 1px solid #e8d0e2;
  background: #fff;
  color: #632a52;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.promo-chip:hover {
  background: #fef0f7;
  border-color: var(--magenta);
}
.promo-chip.active {
  background: var(--magenta);
  color: #fff;
  border-color: var(--magenta);
  box-shadow: 0 3px 8px rgba(233, 0, 131, 0.22);
}
.custom-tag-wrap input {
  border: 1px solid #cbd5e5;
  background: #fff;
  border-radius: 8px;
  height: 38px;
  padding: 0 11px;
  color: var(--ink);
  font: 600 13px inherit;
  width: 100%;
  outline: none;
}
.custom-tag-wrap input:focus {
  border-color: var(--magenta);
  box-shadow: 0 0 0 3px #fdeaf4;
}

/* Professional & Signature Box in Document */
.document-overlay .pdf-professional {
  position: absolute;
  left: 56%;
  top: 64%;
  width: 36%;
  font-size: 1.4cqw;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.pdf-signature-img {
  max-height: 52px;
  max-width: 84%;
  height: auto;
  object-fit: contain;
  margin-bottom: 2px;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.06));
}
.pdf-signature-line {
  width: 75%;
  height: 1px;
  background: rgba(24, 34, 59, 0.35);
  margin: 3px auto 5px;
}
.pdf-doctor-name {
  display: block;
  font-size: 1.75cqw;
  font-weight: 800;
  color: #18223b;
  line-height: 1.2;
}
.pdf-doctor-license {
  display: block;
  font-size: 1.4cqw;
  color: #46536d;
  font-weight: 600;
  margin-top: 2px;
}
.preview-caption { color: var(--muted); font-size: 11px; margin: 10px 2px 0; }

.manage-sheet { overflow: hidden; }

/* Template Hub & Dropzone */
.template-upload-dropzone {
  background: #f6f9fe;
  border: 2px dashed #b9cde8;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 22px;
  transition: all 0.2s ease;
  cursor: pointer;
}
.template-upload-dropzone:hover, .template-upload-dropzone.dragover {
  border-color: var(--magenta);
  background: #fdf5f9;
  box-shadow: 0 4px 14px rgba(233, 0, 131, 0.1);
}
.dropzone-content {
  display: flex;
  align-items: center;
  gap: 16px;
}
.dropzone-icon {
  font-size: 28px;
  flex-shrink: 0;
}
.dropzone-text {
  flex: 1;
}
.dropzone-text strong {
  display: block;
  font-size: 14px;
  color: var(--ink);
}
.dropzone-text p {
  margin: 3px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Template Cards Grid */
.template-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 18px;
}
.template-hub-card {
  background: #ffffff;
  border: 1px solid #e1e8f5;
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(24, 34, 59, 0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.template-hub-card:hover {
  border-color: #cbd9ee;
  box-shadow: 0 12px 30px rgba(24, 34, 59, 0.09);
}
.template-hub-card.active-template-card {
  border-color: #d2e1f8;
  box-shadow: 0 8px 25px rgba(30, 67, 142, 0.1);
}
.template-hub-card.disabled-pro-card {
  background: #fbfcfe;
  border-color: #e2e8f0;
  box-shadow: none;
  opacity: 0.65;
  filter: grayscale(0.75);
}
.template-hub-card.disabled-pro-card:hover {
  border-color: #e2e8f0;
  box-shadow: none;
  transform: none;
}
.status-badge.pro-badge {
  background: #edf2f7;
  color: #475569;
  border: 1px solid #cbd5e1;
  font-weight: 800;
  white-space: nowrap;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 9px;
  line-height: 1.2;
}
.pro-disabled-btn {
  background: #94a3b8 !important;
  color: #ffffff !important;
  cursor: not-allowed !important;
  opacity: 0.75;
  white-space: nowrap;
}
.template-card-body {
  padding: 18px 20px;
  display: flex;
  gap: 16px;
  flex: 1;
}
.template-card-thumb-wrap {
  width: 92px;
  height: 124px;
  background: #f0f4fa;
  border: 1px solid #d5e0f0;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(24, 34, 59, 0.08);
  cursor: pointer;
}
.template-card-thumb-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-zoom-overlay {
  position: absolute;
  inset: 0;
  background: rgba(24, 34, 59, 0.45);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
  opacity: 0;
  transition: opacity 0.15s;
}
.template-card-thumb-wrap:hover .thumb-zoom-overlay {
  opacity: 1;
}
.template-card-main {
  flex: 1;
  min-width: 0;
}
.template-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.template-card-main h3 {
  margin: 0;
  font-size: 14.5px;
  color: var(--ink);
  line-height: 1.25;
  flex: 1;
  min-width: 0;
}
.template-card-main p {
  margin: 4px 0 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.template-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}
.meta-pill {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 4px;
  background: #f0f4fa;
  color: #4a5873;
  white-space: nowrap;
  flex-shrink: 0;
}
.meta-pill.highlight {
  background: #e6f7f2;
  color: #0b7a5e;
}
.template-card-footer {
  padding: 12px 20px;
  background: #f9fbfe;
  border-top: 1px solid #edf2fa;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}
.template-card-footer > div:first-child {
  font-size: 11px;
  color: #64748b;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}
.template-footer-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.template-footer-actions button {
  white-space: nowrap;
}

/* Template Preview Modal */
.modal-preview-sheet {
  max-width: 780px;
  width: 92%;
}
.modal-preview-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
  padding: 22px;
}
.preview-modal-paper-wrap {
  background: #e9eef7;
  border: 1px solid #d4deed;
  border-radius: 10px;
  padding: 12px;
  box-shadow: 0 10px 20px rgba(24, 34, 59, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-modal-paper-wrap img {
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  box-shadow: 0 6px 14px rgba(24, 34, 59, 0.14);
}
.preview-modal-meta {
  display: flex;
  flex-direction: column;
}
.preview-modal-meta h4 {
  font-size: 18px;
  margin: 0 0 6px;
  color: var(--ink);
}
.preview-modal-meta p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
  margin: 0 0 14px;
}
.meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: auto;
}
.preview-modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 20px;
}

/* Professionals Cards View */
.professional-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--rule);
  background: #ffffff;
  transition: background 0.15s ease;
}
.professional-card:hover {
  background: #f8fafc;
}
.professional-card:last-child {
  border: 0;
}
.professional-card .doctor-avatar {
  width: 44px;
  height: 44px;
  font-size: 14px;
  font-weight: 800;
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%);
  color: #ffffff;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(30, 67, 142, 0.15);
  flex-shrink: 0;
}
.prof-info {
  flex: 1;
  min-width: 0;
}
.prof-info strong {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
  display: block;
  letter-spacing: -0.2px;
}
.prof-info p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
}
.prof-sig-preview {
  width: 120px;
  height: 46px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  overflow: hidden;
  flex-shrink: 0;
  transition: border-color 0.15s ease;
}
.prof-sig-preview.has-sig {
  border-color: #93c5fd;
  background: #ffffff;
}
.prof-sig-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.prof-sig-empty {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  text-align: center;
}
.prof-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.prof-actions .quiet-button {
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 7px;
}
.prof-delete-btn {
  color: #dc2626 !important;
  border-color: #fecaca !important;
  background: #fef2f2 !important;
  transition: all 0.15s ease;
}
.prof-delete-btn:hover {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border-color: #fca5a5 !important;
}

/* Unified Topbar Action Buttons */
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-btn {
  height: 42px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  line-height: 1;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.topbar-btn svg {
  flex-shrink: 0;
}

/* 1. Imprimir Button (PRO) */
.btn-print-pro {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
  cursor: pointer;
}
.btn-print-pro:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

/* 2. WhatsApp Button (PRO) - Official WhatsApp Green */
.btn-whatsapp-pro {
  background: #25D366;
  border-color: #20ba5a;
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.28);
  cursor: pointer;
}
.btn-whatsapp-pro:hover {
  background: #20ba5a;
  box-shadow: 0 6px 18px rgba(37, 211, 102, 0.35);
}

/* 3. Generar PDF Button (Active Primary) */
.btn-generate-pdf {
  background: var(--magenta);
  border-color: var(--magenta);
  color: #ffffff;
  box-shadow: 0 7px 14px rgba(233, 0, 131, 0.22);
}
.btn-generate-pdf:hover {
  background: #c80070;
  border-color: #c80070;
  transform: translateY(-1px);
}
.btn-generate-pdf:active {
  transform: translateY(0);
}
.btn-generate-pdf:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
  filter: saturate(0.85);
}

/* PRO Badges inside buttons */
.pro-lock-badge-sm {
  font-size: 9.5px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.btn-print-pro .pro-lock-badge-sm {
  background: #e2e8f0;
  color: #475569;
  border: 1px solid #cbd5e1;
}
.btn-whatsapp-pro .pro-lock-badge-sm {
  background: rgba(0, 0, 0, 0.15);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

/* History View */
.history-sheet {
  background: #ffffff;
  border: 1px solid #e1e8f5;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(24, 34, 59, 0.04);
  overflow: hidden;
}
.history-head, .history-row {
  display: grid;
  grid-template-columns: 0.85fr 1.3fr 1.1fr 1.3fr 0.9fr 0.95fr 1.1fr;
  gap: 12px;
  align-items: center;
  padding: 14px 20px;
}
.history-head {
  background: #f4f7fb;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 800;
}
.history-head-sort {
  background: transparent;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: 10.5px;
  letter-spacing: .06em;
  color: #64748b;
  font-weight: 800;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  text-align: left;
  transition: color 0.15s ease;
  user-select: none;
}
.history-head-sort:hover {
  color: #1e438e;
}
.history-head-sort.active {
  color: #1e438e;
}
.history-head-sort svg {
  color: currentColor;
  flex-shrink: 0;
}
.history-load-more-bar {
  padding: 16px 20px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
  display: flex;
  justify-content: center;
  align-items: center;
}
.btn-history-load-more {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: #1e438e;
  font-weight: 800;
  font-size: 12.5px;
  padding: 9px 22px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.15s ease;
}
.btn-history-load-more:hover {
  background: #eff6ff;
  border-color: #1e438e;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(30, 67, 142, 0.1);
}
.history-row { border-top: 1px solid var(--rule); font-size: 13px; }
.history-row strong { font-variant-numeric: tabular-nums; }
.history-row .status-badge {
  display: inline-flex;
  width: fit-content;
  max-width: max-content;
  padding: 4px 10px;
  border-radius: 999px;
  justify-self: start;
  align-self: center;
  white-space: nowrap;
}
.btn-history-download {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  white-space: nowrap;
  justify-self: end;
  opacity: 0.85;
  transition: all 0.15s;
}
.btn-history-download:hover {
  background: #f1f5f9;
  color: #334155;
}

/* Modal Styling */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  padding: 20px;
  animation: fadeIn 0.15s ease-out;
}
#resetPasswordModal.modal-backdrop {
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 100000;
}
.modal-backdrop[hidden] { display: none !important; }
.modal-sheet {
  background: #fff;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 20px 45px rgba(24, 34, 59, 0.22);
  border: 1px solid var(--rule);
  overflow: hidden;
  animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { margin: 0; font-size: 17px; color: var(--ink); }
.modal-close {
  background: #f1f5f9;
  border: 0;
  font-size: 15px;
  color: #64748b;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  line-height: 1;
  padding: 0;
  transition: all 0.2s ease;
}
.modal-close:hover,
.modal-close:active { color: var(--ink); background: #e2e8f0; transform: scale(1.05); }
.modal-body {
  padding: 22px;
  display: grid;
  gap: 16px;
}

/* Signature Dropzone */
.sig-dropzone {
  border: 2px dashed #cbd5e5;
  border-radius: 10px;
  padding: 18px;
  background: #fbfcfe;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}
.sig-dropzone:hover, .sig-dropzone.dragover {
  border-color: var(--blue);
  background: #f2f7ff;
}

/* Branch Custom PDF Dropzone */
.branch-pdf-dropzone {
  border: 2px dashed #cbd5e5;
  border-radius: 10px;
  padding: 14px 16px;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.15s ease;
}
.branch-pdf-dropzone:hover, .branch-pdf-dropzone.dragover {
  border-color: var(--magenta);
  background: #fdf5f9;
}
.branch-pdf-info {
  display: flex;
  align-items: center;
  gap: 12px;
}
.branch-pdf-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.branch-pdf-text {
  flex: 1;
  min-width: 0;
}
.branch-pdf-text strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 2px;
}
.branch-pdf-text small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
  display: block;
}
.sig-prompt-icon {
  font-size: 26px;
  color: var(--blue);
  margin-bottom: 6px;
}
.sig-upload-prompt p {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--ink);
}
.sig-upload-prompt small {
  color: var(--muted);
  font-size: 11px;
}
.sig-preview-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.sig-preview-wrap[hidden],
.sig-upload-prompt[hidden] {
  display: none !important;
}
.sig-img-container {
  max-width: 220px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border: 1px solid #e0e6f0;
  border-radius: 6px;
  padding: 6px;
}
.sig-img-container img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.remove-sig-btn {
  color: #d12953;
  font-size: 12px;
}

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

/* Modal Actions (Branch & Professional) - Unified Height and Alignment across Desktop & Mobile */
.modal-actions.branch-modal-actions,
.modal-actions.prof-modal-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  margin-top: 18px !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.branch-modal-actions .btn-action-danger,
.prof-modal-actions .btn-action-danger {
  flex: 0 0 auto !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  padding: 0 14px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border-radius: 9px !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  margin: 0 !important;
  border: 1.5px solid #fecaca !important;
  background: #fef2f2 !important;
  color: #dc2626 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

.branch-modal-actions .btn-action-danger:hover,
.prof-modal-actions .btn-action-danger:hover {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
  transform: translateY(-1px) !important;
}

.branch-modal-btns-right,
.prof-modal-btns-right {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  margin-left: auto !important;
}

.branch-modal-btns-right .quiet-button,
.branch-modal-btns-right .primary-button,
.prof-modal-btns-right .quiet-button,
.prof-modal-btns-right .primary-button {
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  padding: 0 18px !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 9px !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  margin: 0 !important;
}

/* History Topbar Actions - Exact Same Height and Alignment */
.history-topbar-actions {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  flex-wrap: wrap !important;
}

#historyRetentionPill {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  display: inline-flex !important;
  align-items: center !important;
  padding: 0 12px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  border-radius: 8px !important;
  background: #f1f5f9 !important;
  color: #475569 !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  margin: 0 !important;
}

#downloadBackupBtn {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 13px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  margin: 0 !important;
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%) !important;
  color: #ffffff !important;
  border: none !important;
  box-shadow: 0 2px 6px rgba(30, 67, 142, 0.2) !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

#downloadBackupBtn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 4px 10px rgba(30, 67, 142, 0.3) !important;
}

#clearHistoryBtn {
  height: 34px !important;
  min-height: 34px !important;
  max-height: 34px !important;
  padding: 0 13px !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  white-space: nowrap !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  border-radius: 8px !important;
  box-sizing: border-box !important;
  line-height: 1 !important;
  margin: 0 !important;
  border: 1.5px solid #fecaca !important;
  background: #fef2f2 !important;
  color: #dc2626 !important;
  cursor: pointer !important;
  transition: all 0.15s ease !important;
}

#clearHistoryBtn:hover {
  background: #fee2e2 !important;
  border-color: #fca5a5 !important;
  color: #b91c1c !important;
  transform: translateY(-1px) !important;
}

/* Plan PRO Upgrade Modal */
.modal-pro-sheet {
  max-width: 580px;
  background: #ffffff;
  border-radius: 16px;
  border: 1px solid #dbe6f6;
  box-shadow: 0 25px 60px rgba(24, 34, 59, 0.25);
}
.pro-modal-header {
  padding: 20px 24px 10px;
  border-bottom: 0;
}
.pro-modal-header-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #1e438e 0%, #0d2352 100%);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  box-shadow: 0 3px 10px rgba(30, 67, 142, 0.25);
}
.pro-crown-icon { font-size: 14px; }
.pro-modal-body {
  padding: 10px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.pro-modal-h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.pro-modal-desc {
  margin: 0;
  color: #4a5568;
  font-size: 13.5px;
  line-height: 1.45;
}
.pro-modal-desc strong {
  color: var(--ink);
}
.pro-features-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 4px 0;
}
.pro-feat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  transition: all 0.15s ease;
}
.pro-feat-card:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}
.pro-feat-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1;
}
.pro-feat-card strong {
  display: block;
  font-size: 12.5px;
  color: var(--ink);
  margin-bottom: 2px;
}
.pro-feat-card small {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
  display: block;
}
.pro-cta-banner {
  background: linear-gradient(135deg, #fdf2f8 0%, #eaf0fb 100%);
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.pro-cta-info strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
  margin-bottom: 2px;
}
.pro-cta-info small {
  font-size: 11.5px;
  color: var(--muted);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 25px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 12px 24px rgba(24,34,59,.25);
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s;
  z-index: 2000;
}
/* Sidebar User & Auth Section */
.sidebar-user-section {
  padding: 12px 0 0;
  border-top: 1px solid #f1f5f9;
  margin-top: auto;
}
.sidebar-auth-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sidebar-auth-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}
.sidebar-auth-btn:hover {
  background: var(--blue);
  border-color: var(--blue);
}
.sidebar-mode-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  padding-left: 2px;
}
.sidebar-user-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
.user-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  background: linear-gradient(135deg, #1e438e 0%, #0f2b66 100%);
  color: #ffffff;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  flex-shrink: 0;
}
.user-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.user-details strong {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}
.plan-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 4px;
  width: fit-content;
  margin-top: 3px;
  background: #e0f2fe;
  color: #0369a1;
  border: 1px solid #bae6fd;
}
.plan-tag.plan-pro {
  background: #fdf2f8;
  color: #db2777;
  border: 1px solid #fbcfe8;
}
.plan-tag.plan-enterprise {
  background: #ede9fe;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}
.user-logout-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0 0;
  transition: color 0.15s ease;
}
.user-logout-btn:hover {
  color: #dc2626;
}

/* Auth Modal Specific Styles */
.auth-modal-sheet {
  max-width: 440px;
  padding: 32px 28px 24px;
  border-radius: 18px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.18), 0 4px 12px rgba(15, 23, 42, 0.08);
  border: 1px solid #e2e8f0;
}
.auth-modal-header {
  position: relative;
  margin-bottom: 20px;
  padding: 4px 38px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.auth-modal-header .modal-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-modal-header .modal-close:hover,
.auth-modal-header .modal-close:active {
  background: #e2e8f0;
  color: #0f172a;
}
.auth-header-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  width: 100%;
}
.auth-logo-img {
  height: 34px;
  width: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
}
.auth-header-sub {
  margin: 0;
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
  text-align: center;
}
.auth-tabs-wrap {
  margin-bottom: 22px;
}
.auth-tabs {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
  border: 1px solid #e2e8f0;
}
.auth-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-tab-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.auth-modal-body form {
  display: flex;
  flex-direction: column;
}
.auth-modal-body form[hidden] {
  display: none !important;
}
.auth-modal-sheet .field,
.auth-modal-body .field {
  display: flex !important;
  flex-direction: column !important;
  margin: 0 0 20px 0 !important;
  padding: 0 !important;
}
.auth-modal-sheet .field span,
.auth-modal-body .field span {
  display: block !important;
  font-size: 13.5px !important;
  font-weight: 700 !important;
  color: #0f172a !important;
  letter-spacing: -0.01em !important;
  line-height: 1.3 !important;
  margin: 0 0 9px 0 !important;
}
.auth-modal-sheet .field input,
.auth-modal-body .field input {
  height: 48px !important;
  padding: 12px 16px !important;
  font-size: 14.5px !important;
  border-radius: 10px !important;
  border: 1.5px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
  transition: all 0.2s ease !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}
.auth-modal-sheet .field input:focus,
.auth-modal-body .field input:focus {
  border-color: #1e438e !important;
  outline: none !important;
  box-shadow: 0 0 0 3.5px rgba(30, 67, 142, 0.16) !important;
}
.password-input-wrap {
  position: relative !important;
  width: 100% !important;
  display: flex !important;
  align-items: center !important;
  margin: 0 !important;
}
.password-input-wrap input {
  width: 100% !important;
  padding-right: 48px !important;
}
.toggle-password-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.toggle-password-btn:hover {
  color: #1e438e;
  background: #f1f5f9;
}
.auth-submit-btn {
  width: 100% !important;
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%) !important;
  color: #ffffff !important;
  border: none !important;
  font-weight: 800 !important;
  font-size: 15px !important;
  height: 50px !important;
  padding: 13px 20px !important;
  border-radius: 10px !important;
  cursor: pointer !important;
  transition: all 0.2s ease !important;
  box-shadow: 0 4px 14px rgba(30, 67, 142, 0.28) !important;
  margin-top: 10px !important;
  margin-bottom: 4px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
}
.auth-submit-btn:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 6px 18px rgba(30, 67, 142, 0.38) !important;
}
.auth-switch-prompt {
  text-align: center;
  font-size: 13px;
  color: #64748b;
  margin-top: 12px;
}
.auth-switch-link {
  background: none;
  border: none;
  color: #1e438e;
  font-weight: 800;
  cursor: pointer;
  text-decoration: underline;
  padding: 0 2px;
  font-size: inherit;
}
.auth-switch-link:hover {
  color: #db2777;
}
.auth-modal-footer {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
  text-align: center;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
}
.auth-error-msg {
  padding: 8px 12px;
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: 6px;
  font-size: 12px;
  margin-top: 6px;
}

.auth-match-msg {
  padding: 8px 12px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1.35;
}
.auth-match-msg[hidden] {
  display: none !important;
}

.password-requirements-hint {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 500;
  line-height: 1.35;
  margin-top: -4px;
  margin-bottom: 8px;
}

.auth-success-msg {
  padding: 12px 14px;
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  margin-top: 10px;
  line-height: 1.45;
}

.field-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.field-header-row span {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.auth-forgot-link {
  background: none;
  border: none;
  color: #1e438e;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  transition: color 0.15s ease;
}

.auth-forgot-link:hover {
  color: #db2777;
  text-decoration: underline;
}

.user-actions-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
  flex-wrap: wrap;
}

.user-action-subtle-btn {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 0;
  transition: color 0.15s ease;
}

.user-action-subtle-btn:hover {
  color: #1e438e;
}

/* ============================================================== */
/* LANDING PAGE STYLES                                            */
/* ============================================================== */
/* Zero-Flash Workspace Switch */
html.docly-app-active #landingPage {
  display: none !important;
}
html.docly-app-active #appShell {
  display: flex !important;
}

.landing-page {
  min-height: 100vh;
  background: radial-gradient(100% 100% at 50% 0%, #f8fafc 0%, #ffffff 100%);
  color: var(--ink);
  font-family: inherit;
}
.landing-navbar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05);
  transition: all 0.2s ease;
  width: 100%;
}
.landing-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}
.nav-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.landing-brand .landing-logo-img {
  height: 38px;
  width: auto;
  object-fit: contain;
  display: block;
}
.landing-nav-links {
  display: none !important;
}
.landing-nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.landing-btn-secondary {
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.landing-btn-secondary:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #f8fafc;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(30, 67, 142, 0.12);
}
.landing-btn-primary {
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%);
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(30, 67, 142, 0.25);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.landing-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(30, 67, 142, 0.35);
}

/* Universal Hamburger Toggle Button */
.landing-hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  color: #0f172a;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  padding: 0;
}
.landing-hamburger-btn:hover,
.landing-hamburger-btn:active {
  background: #eff6ff;
  border-color: #93c5fd;
  color: var(--blue);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(30, 67, 142, 0.12);
}
.landing-hamburger-btn .hamburger-icon-open {
  display: block;
}
.landing-hamburger-btn .hamburger-icon-close {
  display: none;
}
.landing-hamburger-btn.open .hamburger-icon-open {
  display: none;
}
.landing-hamburger-btn.open .hamburger-icon-close {
  display: block;
  color: var(--blue);
}

/* Universal Dropdown Menu */
.landing-mobile-menu {
  display: block;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.08);
  transition: max-height 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease, padding 0.3s ease;
  padding: 0;
}
.landing-mobile-menu.open {
  max-height: 520px;
  opacity: 1;
  padding: 20px 0 24px;
}
.landing-menu-inner {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.landing-mobile-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  text-decoration: none;
  transition: all 0.2s ease;
}
.mobile-nav-link:hover,
.mobile-nav-link:active {
  background: #eff6ff;
  border-color: #93c5fd;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(30, 67, 142, 0.08);
}
.nav-link-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.nav-link-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nav-link-text strong {
  font-size: 13.5px;
  font-weight: 800;
  color: #0f172a;
}
.nav-link-text span {
  font-size: 11.5px;
  color: #64748b;
  font-weight: 500;
}
.mobile-menu-divider {
  display: none;
}
.mobile-menu-actions {
  display: none;
}

/* Hero */
.landing-hero {
  padding: 70px 0 90px;
}
.hero-container {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 48px;
  align-items: center;
}
.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #e0f2fe;
  color: #0369a1;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 20px;
  border: 1px solid #bae6fd;
}
.hero-badge-sparkle {
  font-size: 14px;
}
.hero-title {
  font-size: 44px;
  font-weight: 900;
  line-height: 1.15;
  color: #0f172a;
  margin: 0 0 20px;
  letter-spacing: -0.5px;
  animation: heroTitleEntrance 0.85s cubic-bezier(0.16, 1, 0.3, 1) both;
}

@keyframes heroTitleEntrance {
  0% {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.gradient-text {
  background: linear-gradient(135deg, #1e438e 0%, #2563eb 25%, #0ea5e9 50%, #db2777 75%, #1e438e 100%);
  background-size: 250% 250%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: subtleGradientShift 6s ease-in-out infinite alternate;
  display: inline-block;
}

@keyframes subtleGradientShift {
  0% {
    background-position: 0% 50%;
    filter: drop-shadow(0 2px 10px rgba(30, 67, 142, 0.15));
  }
  50% {
    background-position: 100% 50%;
    filter: drop-shadow(0 2px 14px rgba(219, 39, 119, 0.22));
  }
  100% {
    background-position: 0% 50%;
    filter: drop-shadow(0 2px 10px rgba(30, 67, 142, 0.15));
  }
}
.hero-subtitle {
  font-size: 17px;
  color: #475569;
  line-height: 1.55;
  margin: 0 0 32px;
}
.hero-cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 28px;
}
.landing-btn-hero-primary {
  background: linear-gradient(135deg, #db2777 0%, #be185d 100%);
  color: #ffffff;
  border: none;
  font-weight: 800;
  font-size: 16px;
  padding: 16px 28px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(219, 39, 119, 0.3);
  transition: all 0.2s ease;
}
.landing-btn-hero-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(219, 39, 119, 0.4);
}
.landing-btn-hero-demo {
  background: #ffffff;
  color: #1e438e;
  border: 2px solid #cbd5e1;
  font-weight: 800;
  font-size: 15px;
  padding: 14px 24px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.landing-btn-hero-demo:hover {
  border-color: #1e438e;
  background: #f8fafc;
  transform: translateY(-1px);
}
.hero-trust {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}
.hero-visual {
  position: relative;
}
.hero-card-preview {
  background: #ffffff;
  border-radius: 14px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.14), 0 4px 12px rgba(15, 23, 42, 0.06);
  border: 1px solid #e2e8f0;
  overflow: hidden;
  transform: perspective(1000px) rotateY(-4deg) rotateX(2deg);
  transition: transform 0.3s ease;
}
.hero-card-preview:hover {
  transform: none;
}
.hero-preview-top {
  background: #f8fafc;
  padding: 10px 14px;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.hero-preview-top .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }
.preview-url {
  margin-left: 10px;
  font-size: 11px;
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.preview-live-pill {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: #047857;
  background: #ecfdf5;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid #a7f3d0;
  white-space: nowrap;
  flex-shrink: 0;
}
.live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 rgba(16, 185, 129, 0.4);
  animation: livePulseDot 1.8s infinite;
}
@keyframes livePulseDot {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.hero-doc-canvas {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: #ffffff;
}
.hero-preview-img {
  width: 100%;
  height: auto;
  display: block;
}

/* Live Autocompleting Document Simulation */
.doc-animated-layer {
  position: absolute;
  top: 13.8%;
  left: 6.5%;
  right: 6.5%;
  bottom: 27%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 9px;
  z-index: 5;
  pointer-events: none;
  font-family: inherit;
}

/* 1. Meta Fields */
.doc-anim-meta {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 1.7fr;
  gap: 6px;
  padding: 6px 8px;
  background: rgba(248, 250, 252, 0.88);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 6px;
  animation: animMetaReveal 9s infinite;
}
.doc-anim-field {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.doc-field-lbl {
  font-size: 7.5px;
  font-weight: 800;
  color: #64748b;
  letter-spacing: 0.04em;
}
.doc-field-val {
  font-size: 9.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.typing-cursor {
  display: inline-block;
  width: 2px;
  height: 10px;
  background: #1e438e;
  vertical-align: middle;
  animation: cursorBlink 0.7s infinite;
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* 2. Table */
.doc-anim-table {
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.03);
  animation: animTableReveal 9s infinite;
}
.doc-anim-tr {
  display: grid;
  grid-template-columns: 1.8fr 0.9fr 0.9fr;
  align-items: center;
  padding: 4.5px 8px;
  font-size: 9px;
  border-bottom: 1px solid #f1f5f9;
}
.doc-anim-tr:last-child {
  border-bottom: none;
}
.doc-anim-th {
  background: #f8fafc;
  font-size: 7.5px;
  font-weight: 800;
  color: #475569;
  letter-spacing: 0.03em;
}
.col-name {
  color: #1e293b;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.col-price {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tr-list {
  color: #94a3b8;
  text-decoration: line-through;
  font-size: 8px;
}
.tr-cash {
  color: #1e438e;
  font-weight: 800;
}

/* 3. Summary */
.doc-anim-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  background: rgba(240, 253, 244, 0.92);
  border: 1px solid rgba(187, 247, 208, 0.9);
  border-radius: 6px;
  animation: animSummaryReveal 9s infinite;
}
.anim-savings-pill {
  font-size: 8.5px;
  font-weight: 800;
  color: #047857;
  display: flex;
  align-items: center;
  gap: 4px;
}
.anim-totals-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}
.anim-total-row {
  display: flex;
  gap: 6px;
  font-size: 8px;
  color: #64748b;
}
.anim-total-row.main {
  font-size: 10.5px;
  color: #0f172a;
}
.anim-total-row strong.cash-val {
  color: #1e438e;
  font-weight: 900;
}
.anim-total-row strong.old-price {
  text-decoration: line-through;
  color: #94a3b8;
}

/* 4. Signature */
.doc-anim-signature {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0 10px;
  margin-top: 10px;
  margin-bottom: 2px;
  animation: animSigReveal 9s infinite;
}
.anim-sig-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.anim-sig-svg {
  width: 88px;
  height: 23px;
}
.sig-path {
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: drawSigPath 9s infinite ease-out;
}
.anim-sig-line {
  width: 100px;
  height: 1px;
  background: #94a3b8;
  margin: 1px 0 2px;
}
.anim-sig-name {
  font-size: 8.5px;
  font-weight: 800;
  color: #0f172a;
}
.anim-sig-doc {
  font-size: 7px;
  color: #64748b;
  font-weight: 600;
}

/* Keyframe animations staggered strictly from top to bottom across 9s */
@keyframes animMetaReveal {
  0%, 4% { opacity: 0; transform: translateY(-6px); }
  8%, 92% { opacity: 1; transform: translateY(0); }
  96%, 100% { opacity: 0; transform: translateY(-6px); }
}

@keyframes animTableReveal {
  0%, 13% { opacity: 0; transform: translateY(-4px); }
  17%, 92% { opacity: 1; transform: translateY(0); }
  96%, 100% { opacity: 0; transform: translateY(-4px); }
}

.anim-row-1 {
  animation: animRow1 9s infinite;
}
@keyframes animRow1 {
  0%, 17% { opacity: 0; transform: translateX(-8px); background: transparent; }
  21% { opacity: 1; transform: translateX(0); background: #eff6ff; }
  26%, 92% { opacity: 1; transform: translateX(0); background: #ffffff; }
  96%, 100% { opacity: 0; }
}

.anim-row-2 {
  animation: animRow2 9s infinite;
}
@keyframes animRow2 {
  0%, 29% { opacity: 0; transform: translateX(-8px); background: transparent; }
  33% { opacity: 1; transform: translateX(0); background: #eff6ff; }
  38%, 92% { opacity: 1; transform: translateX(0); background: #ffffff; }
  96%, 100% { opacity: 0; }
}

.anim-row-3 {
  animation: animRow3 9s infinite;
}
@keyframes animRow3 {
  0%, 41% { opacity: 0; transform: translateX(-8px); background: transparent; }
  45% { opacity: 1; transform: translateX(0); background: #eff6ff; }
  50%, 92% { opacity: 1; transform: translateX(0); background: #ffffff; }
  96%, 100% { opacity: 0; }
}

@keyframes animSummaryReveal {
  0%, 54% { opacity: 0; transform: translateY(6px) scale(0.97); }
  58% { opacity: 1; transform: translateY(0) scale(1.02); }
  62%, 92% { opacity: 1; transform: translateY(0) scale(1); }
  96%, 100% { opacity: 0; transform: translateY(6px); }
}

@keyframes drawSigPath {
  0%, 66% { stroke-dashoffset: 200; }
  76%, 92% { stroke-dashoffset: 0; }
  96%, 100% { stroke-dashoffset: 200; }
}

@keyframes animSigReveal {
  0%, 66% { opacity: 0; transform: translateY(4px); }
  70%, 92% { opacity: 1; transform: translateY(0); }
  96%, 100% { opacity: 0; transform: translateY(4px); }
}

/* Features */
.landing-features {
  padding: 90px 0;
  background: #ffffff;
  border-top: 1px solid #f1f5f9;
}
.section-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 50px;
}
.section-kicker {
  font-size: 12px;
  font-weight: 800;
  color: #db2777;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.section-title {
  font-size: 32px;
  font-weight: 900;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.5px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 24px;
}
.feature-card {
  padding: 28px 24px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  transition: transform 0.2s, box-shadow 0.2s;
}
.feature-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
  background: #ffffff;
}
.feature-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 16px;
}
.feature-card h3 {
  font-size: 17px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 10px;
}
.feature-card p {
  font-size: 13px;
  color: #64748b;
  line-height: 1.5;
  margin: 0;
}

/* Pricing */
.landing-pricing {
  padding: 90px 0 110px;
  background: #f8fafc;
  border-top: 1px solid #f1f5f9;
}
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  max-width: 1140px;
  margin: 0 auto;
}
.pricing-card {
  background: #ffffff;
  border-radius: 16px;
  padding: 36px 28px;
  border: 1px solid #e2e8f0;
  position: relative;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
  display: flex;
  flex-direction: column;
}
.pricing-card.featured-pro {
  border: 2px solid #db2777;
  box-shadow: 0 16px 36px rgba(219, 39, 119, 0.12);
}
.pricing-badge-pro {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #db2777 0%, #be185d 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(219, 39, 119, 0.3);
  white-space: nowrap;
}
.pricing-card.featured-enterprise {
  border: 2px solid #7c3aed;
  box-shadow: 0 16px 36px rgba(124, 58, 237, 0.12);
}
.pricing-badge-enterprise {
  position: absolute;
  top: -14px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 14px;
  border-radius: 20px;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
  white-space: nowrap;
}
.pricing-badge {
  font-size: 12px;
  font-weight: 800;
  color: #64748b;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.pricing-title {
  font-size: 18px;
  font-weight: 900;
  color: #db2777;
  margin-bottom: 4px;
}
.enterprise-title {
  color: #7c3aed !important;
}
.pricing-price-box {
  margin-bottom: 12px;
}
.pricing-price {
  font-size: 36px;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 4px;
}
.pricing-price span {
  font-size: 14px;
  font-weight: 600;
  color: #94a3b8;
}
.pricing-annual-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.annual-pill {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 12px;
}
.annual-price {
  font-size: 11px;
  font-weight: 700;
  color: #059669;
}
.pricing-desc {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 24px;
  min-height: 40px;
}
.pricing-list {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}
.pricing-list li {
  font-size: 13px;
  color: #334155;
  line-height: 1.4;
}
.pricing-btn {
  width: 100%;
  padding: 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}
.pricing-btn.free-btn {
  background: #f1f5f9;
  color: var(--ink);
}
.pricing-btn.free-btn:hover {
  background: #e2e8f0;
}
.pricing-btn.pro-btn {
  background: linear-gradient(135deg, #db2777 0%, #be185d 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(219, 39, 119, 0.25);
}
.pricing-btn.pro-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(219, 39, 119, 0.35);
}
.pricing-btn.enterprise-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.25);
}
.pricing-btn.enterprise-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(124, 58, 237, 0.35);
}

/* ============================================================== */
/* NEW LANDING PAGE SECTIONS STYLES                               */
/* ============================================================== */

/* 1. Specialties Bar */
.landing-specialties-bar {
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  padding: 22px 0 24px;
}
.specialties-title {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #64748b;
  margin: 0 0 14px;
}
.specialties-scroll-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}
.specialty-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 8px 16px;
  border-radius: 30px;
  font-size: 12.5px;
  font-weight: 700;
  color: #334155;
  transition: all 0.2s ease;
  white-space: nowrap;
}
.specialty-pill svg {
  color: var(--blue);
  flex-shrink: 0;
}
.specialty-pill:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: var(--blue);
  transform: translateY(-1px);
}

/* 2. How It Works */
.landing-how-it-works {
  padding: 95px 0 85px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.section-subtitle {
  font-size: 15px;
  color: #64748b;
  margin: 12px 0 0;
  line-height: 1.5;
}
.how-steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 28px;
}
.how-step-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
  padding: 36px 28px;
  position: relative;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.how-step-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.06);
  border-color: #cbd5e1;
}
.step-num-badge {
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 28px;
  font-weight: 900;
  color: #e2e8f0;
  letter-spacing: -1px;
}
.how-step-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.how-step-card h3 {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 12px;
  letter-spacing: -0.2px;
}
.how-step-card p {
  font-size: 13.5px;
  color: #64748b;
  line-height: 1.55;
  margin: 0;
}

/* 3. Document Showcase */
.landing-doc-showcase {
  padding: 95px 0 100px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}
.doc-showcase-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}
.doc-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #f1f5f9;
  border: 1.5px solid #e2e8f0;
  color: #475569;
  padding: 10px 20px;
  border-radius: 30px;
  font-weight: 800;
  font-size: 13.5px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.doc-tab-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.doc-tab-btn.active {
  background: var(--blue);
  color: #ffffff;
  border-color: var(--blue);
  box-shadow: 0 4px 14px rgba(30, 67, 142, 0.25);
}
.doc-showcase-panels {
  max-width: 1060px;
  margin: 0 auto;
}
.doc-showcase-panel {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 40px;
  align-items: center;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: 44px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.04);
}
.showcase-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.showcase-badge {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.showcase-info h3 {
  font-size: 24px;
  font-weight: 900;
  color: #0f172a;
  margin: 0 0 14px;
  letter-spacing: -0.4px;
  line-height: 1.3;
}
.showcase-info p {
  font-size: 14px;
  color: #64748b;
  line-height: 1.6;
  margin: 0 0 20px;
}
.showcase-features-list {
  list-style: none;
  padding: 0;
  margin: 0 0 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.showcase-features-list li {
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 8px;
}
.showcase-mockup-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.06);
}
.mockup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.mockup-header strong {
  font-size: 14px;
  color: #0f172a;
}
.status-pill {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 12px;
}
.status-active {
  background: #ecfdf5;
  color: #059669;
}
.mockup-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}
.mockup-tr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: #334155;
  padding: 6px 0;
  border-bottom: 1px dashed #f1f5f9;
}
.mockup-tr em {
  font-style: normal;
  color: #64748b;
  font-size: 12px;
}
.mockup-total-bar {
  background: #eff6ff;
  border-radius: 8px;
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
  color: #1e40af;
}

/* 4. Security Section */
.landing-security {
  padding: 85px 0 95px;
  background: #f8fafc;
  border-top: 1px solid #e2e8f0;
}
.security-box {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  border-radius: 24px;
  padding: 56px 48px;
  color: #ffffff;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
}
.security-header {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 44px;
}
.security-badge {
  display: inline-block;
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(96, 165, 250, 0.3);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 14px;
}
.security-header h2 {
  font-size: 30px;
  font-weight: 900;
  color: #ffffff;
  margin: 0 0 12px;
  letter-spacing: -0.5px;
}
.security-header p {
  font-size: 14.5px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.55;
}
.security-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
}
.security-card {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 26px 22px;
  transition: all 0.25s ease;
}
.security-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(96, 165, 250, 0.4);
}
.security-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.25);
  color: #60a5fa;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.security-card h3 {
  font-size: 16.5px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 10px;
}
.security-card p {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  margin: 0;
}

/* 5. FAQ Section */
.landing-faq {
  padding: 95px 0 105px;
  background: #ffffff;
  border-top: 1px solid #e2e8f0;
}
.faq-accordion {
  max-width: 840px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.faq-item {
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 14px;
  overflow: hidden;
  transition: all 0.2s ease;
}
.faq-item.active {
  border-color: #93c5fd;
  background: #ffffff;
  box-shadow: 0 6px 20px rgba(30, 67, 142, 0.06);
}
.faq-question {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  background: none;
  border: none;
  font-size: 15.5px;
  font-weight: 800;
  color: #0f172a;
  text-align: left;
  cursor: pointer;
  gap: 16px;
  font-family: inherit;
  transition: color 0.15s ease;
}
.faq-question:hover {
  color: var(--blue);
}
.faq-chevron {
  transition: transform 0.25s ease;
  flex-shrink: 0;
  color: #64748b;
}
.faq-item.active .faq-chevron {
  transform: rotate(180deg);
  color: var(--blue);
}
.faq-answer {
  display: none;
  padding: 0 24px 22px;
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
}
.faq-answer p {
  margin: 0;
}

/* 6. Final CTA Banner */
.landing-final-cta {
  padding: 20px 0 90px;
  background: #ffffff;
}
.final-cta-card {
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%);
  border-radius: 24px;
  padding: 64px 44px;
  color: #ffffff;
  text-align: center;
  box-shadow: 0 20px 48px rgba(13, 40, 97, 0.25);
  position: relative;
  overflow: hidden;
}
.final-cta-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 16px;
}
.final-cta-content h2 {
  font-size: 32px;
  font-weight: 900;
  margin: 0 0 14px;
  letter-spacing: -0.5px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.25;
}
.final-cta-content p {
  font-size: 15.5px;
  color: #cbd5e1;
  max-width: 600px;
  margin: 0 auto 32px;
  line-height: 1.55;
}
.final-cta-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.final-cta-btn-primary {
  background: linear-gradient(135deg, #db2777 0%, #be185d 100%);
  color: #ffffff;
  border: none;
  font-weight: 800;
  font-size: 15px;
  min-width: 220px;
  height: 50px;
  padding: 0 28px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(219, 39, 119, 0.3);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
}
.final-cta-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 30px rgba(219, 39, 119, 0.4);
}
.final-cta-btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  font-weight: 800;
  font-size: 15px;
  min-width: 220px;
  height: 50px;
  padding: 0 28px;
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
}
.final-cta-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.22);
  border-color: rgba(255, 255, 255, 0.6);
  transform: translateY(-2px);
}
.final-cta-trust {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 600;
}

@media (max-width: 900px) {
  .security-box {
    padding: 40px 24px;
  }
  .final-cta-card {
    padding: 44px 24px;
  }
  .final-cta-content h2 {
    font-size: 26px;
  }
}

@media (max-width: 600px) {
  .final-cta-actions {
    flex-direction: column;
    width: 100%;
    max-width: 320px;
    margin: 0 auto 24px;
    gap: 12px;
  }
  .final-cta-btn-primary,
  .final-cta-btn-secondary {
    width: 100%;
    min-width: unset;
    height: 48px;
    font-size: 14.5px;
    padding: 0 20px;
  }
  .faq-question {
    font-size: 14.5px;
    padding: 16px 18px;
  }
  .faq-answer {
    padding: 0 18px 18px;
    font-size: 13.5px;
  }
}

/* ============================================================== */
/* METRICS & USAGE DASHBOARD STYLES                               */
/* ============================================================== */
.metrics-usage-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}
.metrics-usage-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.metrics-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: var(--muted);
  text-transform: uppercase;
}
.metrics-counter {
  font-size: 24px;
  font-weight: 900;
  color: var(--ink);
  margin-top: 4px;
}
.metrics-counter strong {
  color: var(--blue);
}
.metrics-reset-info {
  font-size: 12px;
  color: #64748b;
  background: #f8fafc;
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
}
.metrics-progress-track {
  height: 12px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 10px;
  border: 1px solid #e2e8f0;
}
.metrics-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #1e438e 0%, #db2777 100%);
  border-radius: 10px;
  transition: width 0.4s ease;
}
.metrics-usage-foot {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #64748b;
  font-weight: 600;
}

/* KPI Cards Grid */
.metrics-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.metrics-kpi-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}
.kpi-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.kpi-content {
  display: flex;
  flex-direction: column;
}
.kpi-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
}
.kpi-value {
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
  margin: 2px 0;
}
.kpi-sub {
  font-size: 11px;
  color: #94a3b8;
}

/* Breakdown Grid */
.metrics-breakdown-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 20px;
}
.metrics-breakdown-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.03);
}
.metrics-breakdown-card h3 {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  margin: 0 0 18px;
}
.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.breakdown-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.breakdown-meta {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}
.breakdown-bar-track {
  height: 8px;
  background: #f1f5f9;
  border-radius: 6px;
  overflow: hidden;
}
.breakdown-bar-fill {
  height: 100%;
  border-radius: 6px;
  transition: width 0.3s ease;
}
.plan-limits-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.plan-limit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 13px;
}
.plan-limit-row strong {
  color: var(--ink);
}

/* Modal Plans Compare (PRO & Enterprise) */
.modal-plans-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}
.modal-plan-card {
  background: #ffffff;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
}
.featured-pro-card {
  border: 2px solid #db2777;
  background: #fff;
}
.featured-enterprise-card {
  border: 2px solid #7c3aed;
  background: #fff;
}
.m-plan-head {
  margin-bottom: 14px;
}
.m-plan-badge {
  font-size: 11px;
  font-weight: 800;
  color: #db2777;
  display: inline-block;
  margin-bottom: 4px;
}
.enterprise-badge {
  color: #7c3aed !important;
}
.m-plan-price {
  font-size: 26px;
  font-weight: 900;
  color: var(--ink);
}
.m-plan-price span {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
}
.m-plan-annual {
  font-size: 11px;
  font-weight: 700;
  color: #059669;
  display: block;
}
.m-plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.m-plan-features li {
  font-size: 12px;
  color: #334155;
  line-height: 1.35;
}
.pro-select-btn {
  background: linear-gradient(135deg, #db2777 0%, #be185d 100%);
  width: 100%;
}
.enterprise-select-btn {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  width: 100%;
}

/* Footer */
.landing-footer {
  background: #0f172a;
  color: #94a3b8;
  padding: 50px 0 24px;
}
.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
  padding-bottom: 30px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.footer-left p {
  margin: 8px 0 0;
  font-size: 13px;
  color: #64748b;
}
.footer-logo-img {
  height: 32px;
  filter: brightness(0) invert(1);
}
.footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}
.footer-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}
.footer-btn-primary {
  background: linear-gradient(135deg, #1e438e 0%, #2563eb 100%);
  color: #ffffff;
  border: none;
  font-weight: 700;
  font-size: 14px;
  padding: 10px 22px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
}
.footer-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.45);
}
.footer-bottom {
  text-align: center;
  font-size: 12px;
  padding-top: 20px;
  color: #64748b;
}

/* Prevent sideways scrolling at 13-inch widths */
.editor-sheet, .field, .field input, .field select, .field textarea, .treatment-row input { min-width: 0; }

/* Responsive Queries */
@media (max-width: 1320px) {
  .main-content { padding: 30px; }
  .budget-layout { grid-template-columns: 1fr; }
  .preview-column { position: static; }
  .preview-paper-wrap { max-width: 620px; }
}

@media (max-width: 900px) {
  .landing-hero {
    padding: 24px 0 60px;
  }
  .hero-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
    text-align: center;
  }
  .hero-visual {
    order: 1;
    width: 100%;
  }
  .hero-content {
    order: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  .hero-cta-group {
    justify-content: center;
    width: 100%;
  }
  .hero-trust {
    justify-content: center;
  }
  .hero-card-preview {
    transform: none;
    max-width: 540px;
    margin: 0 auto;
  }
}

@media (max-width: 780px) {
  /* Mobile App Shell Layout */
  .app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: 100%;
    overflow: visible;
  }
  .sidebar {
    display: none !important;
  }
  .mobile-app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 52px;
    padding: 0 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid #e2e8f0;
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    z-index: 999;
    width: 100%;
    box-sizing: border-box;
    gap: 8px;
  }
  .mobile-app-brand .mobile-brand-img {
    height: 24px;
    width: auto;
    object-fit: contain;
    display: block;
  }
  .mobile-app-clinic-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0 10px;
    height: 32px;
    min-height: 32px;
    max-height: 32px;
    border-radius: 20px;
    max-width: 220px;
    flex: 1;
    box-sizing: border-box;
  }
  .mobile-clinic-name {
    font-size: 11.5px;
    font-weight: 800;
    color: #0f172a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    line-height: 1;
    margin: 0;
    padding: 0;
    display: inline-flex;
    align-items: center;
  }
  .mobile-app-clinic-pill .plan-tag {
    font-size: 9px;
    font-weight: 800;
    padding: 3px 6px;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    margin: 0 !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 5px;
    box-sizing: border-box;
  }
  .mobile-app-hamburger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
    flex-shrink: 0;
  }
  .mobile-app-hamburger-btn:active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: var(--blue);
  }
  .mobile-app-drawer-backdrop {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(15, 23, 42, 0.65) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    z-index: 99999 !important;
    display: none !important;
    justify-content: flex-end !important;
    align-items: stretch !important;
    box-sizing: border-box !important;
  }
  .mobile-app-drawer-backdrop.open {
    display: flex !important;
  }
  .mobile-app-drawer {
    background: #ffffff !important;
    width: 85vw !important;
    max-width: 320px !important;
    height: 100vh !important;
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.3) !important;
    box-sizing: border-box !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    padding: 20px 18px 36px !important;
    z-index: 100000 !important;
    transform: translateX(0) !important;
    animation: drawerSlideInRight 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  }
  @keyframes drawerSlideInRight {
    from {
      transform: translateX(100%);
    }
    to {
      transform: translateX(0);
    }
  }
  .drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 16px;
    border-bottom: 1px solid #f1f5f9;
  }
  .drawer-user-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
  }
  .drawer-plan-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    flex-wrap: wrap;
  }
  .drawer-user-email {
    font-size: 11px;
    color: #64748b;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .drawer-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #475569;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
  }
  .drawer-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 16px;
    flex: 1;
  }
  .drawer-section-label {
    font-size: 10px;
    font-weight: 800;
    color: #94a3b8;
    letter-spacing: 0.08em;
    margin: 6px 0 2px 4px;
  }
  .drawer-nav-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .drawer-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: #334155;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    text-align: left;
    transition: all 0.15s ease;
  }
  .drawer-nav-item svg {
    stroke: #64748b;
    flex-shrink: 0;
  }
  .drawer-nav-item:hover,
  .drawer-nav-item:active {
    background: #f1f5f9;
    color: #0f172a;
  }
  .drawer-nav-item.active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: var(--blue);
  }
  .drawer-nav-item.active svg {
    stroke: var(--blue);
  }
  .drawer-divider {
    height: 1px;
    background: #e2e8f0;
    margin: 12px 0 6px;
  }
  .drawer-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 44px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s ease;
    border: none;
    margin-bottom: 4px;
  }
  .drawer-action-btn.upgrade {
    background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(30, 67, 142, 0.25);
  }
  .drawer-action-btn.secondary {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
  }
  .drawer-action-btn.logout {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    margin-top: 6px;
  }
  .drawer-action-btn.logout:active {
    background: #fee2e2;
  }

  /* Main Content Full Width on Mobile */
  .main-content {
    width: 100% !important;
    max-width: 100vw;
    padding: 14px 12px 84px !important;
    margin: 0 !important;
    box-sizing: border-box;
  }
  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
  }
  .kicker {
    font-size: 9.5px;
    letter-spacing: 0.08em;
    margin: 0 0 2px;
  }
  .topbar h1 {
    font-size: 20px;
    letter-spacing: -0.025em;
    line-height: 1.15;
    margin: 0;
  }
  .topbar-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
    align-items: center;
  }
  .template-pill {
    grid-column: 1 / -1;
    width: fit-content;
    font-size: 10.5px;
    padding: 3px 8px;
    margin-bottom: 2px;
  }
  .topbar-btn {
    height: 38px;
    min-height: 38px;
    padding: 0 4px;
    font-size: 11px;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
    border-radius: 8px;
    justify-content: center;
  }
  .topbar-btn svg {
    width: 13px;
    height: 13px;
  }
  .topbar-btn span:first-of-type {
    font-size: 11px;
    font-weight: 700;
  }
  .pro-lock-badge-sm {
    font-size: 7.5px;
    font-weight: 800;
    padding: 1.5px 4px;
    gap: 2px;
    border-radius: 4px;
  }
  .pro-lock-badge-sm svg {
    width: 7px;
    height: 7px;
  }
  .editor-sheet {
    padding: 14px 12px;
    border-radius: 12px;
  }
  .sheet-heading {
    margin-bottom: 14px;
  }
  .sheet-heading h2 {
    font-size: 15px;
  }
  .sheet-heading p {
    font-size: 11.5px;
    margin: 3px 0 0;
  }
  .field {
    gap: 5px;
  }
  .field span {
    font-size: 11.5px;
    font-weight: 700;
  }
  .field input,
  .field select,
  .field textarea {
    height: 40px;
    font-size: 13px;
    padding: 0 10px;
    border-radius: 8px;
  }
  .field textarea {
    height: auto;
    padding: 8px 10px;
  }
  .field-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .field-wide,
  .professional-summary {
    grid-column: span 1;
  }
  .treatment-head {
    display: none;
  }
  .treatment-row {
    display: grid;
    grid-template-columns: 1fr 1fr 34px;
    grid-template-areas:
      "name name name"
      "price-list price-cash delete";
    gap: 6px;
    padding: 10px 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    margin-bottom: 6px;
  }
  .treatment-row input:first-child {
    grid-area: name;
    width: 100%;
    height: 38px;
    font-size: 12.5px;
  }
  .treatment-row input:nth-child(2) {
    grid-area: price-list;
    width: 100%;
    height: 38px;
    font-size: 12.5px;
  }
  .treatment-row input:nth-child(3) {
    grid-area: price-cash;
    width: 100%;
    height: 38px;
    font-size: 12.5px;
  }
  .treatment-row button.row-remove,
  .treatment-row button:last-child {
    grid-area: delete;
    height: 38px;
    width: 34px;
    border-radius: 8px;
  }
  .totals-strip {
    display: grid;
    grid-template-columns: 1fr;
    border-radius: 10px;
    overflow: hidden;
    border: 1.5px solid #cbd9ee;
    margin-top: 12px;
  }
  .totals-strip > div {
    border-right: none;
    border-bottom: 1px solid #cbd9ee;
    padding: 10px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
  }
  .totals-strip > div:last-child {
    border-bottom: none;
  }
  .totals-strip span {
    margin-bottom: 0;
    font-size: 11.5px;
  }
  .totals-strip strong {
    font-size: 14px;
  }
  .totals-strip .grand-total strong {
    font-size: 16px;
  }
  .template-hub-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .professional-card {
    flex-wrap: wrap;
    padding: 14px 12px;
    gap: 12px;
  }
  .prof-info strong {
    font-size: 14px;
  }
  .prof-info p {
    font-size: 11.5px;
  }
  .prof-sig-preview {
    width: 90px;
    height: 38px;
  }
  .prof-actions {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    gap: 4px !important;
    margin-top: 8px !important;
    flex-wrap: nowrap !important;
  }
  .prof-actions .quiet-button {
    flex: 1 1 auto !important;
    padding: 6px 2px !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    height: 32px !important;
    white-space: nowrap !important;
    text-align: center !important;
    justify-content: center !important;
    border-radius: 6px !important;
  }
  .prof-actions .quiet-button[data-action="quick-sig"] {
    flex: 1.35 1 auto !important;
    font-size: 10px !important;
  }
  .history-head {
    display: none;
  }
  .history-row {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 12px;
    border-radius: 10px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    margin-bottom: 8px;
  }
  .history-head span:nth-child(3),
  .history-head span:nth-child(5),
  .history-row span:nth-child(3),
  .history-row span:nth-child(5) {
    display: none;
  }
  #clearHistoryBtn,
  .topbar .btn-action-danger {
    width: fit-content !important;
    max-width: max-content !important;
    align-self: flex-start !important;
    display: inline-flex !important;
    padding: 7px 12px !important;
    height: 34px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
  }

  /* Document Type Selector Mobile Carousel */
  .doc-type-selector {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 8px;
    padding: 6px;
    scrollbar-width: none;
    margin-bottom: 16px;
  }
  .doc-type-selector::-webkit-scrollbar {
    display: none;
  }
  .doc-type-btn {
    flex: 0 0 155px;
    padding: 8px 10px;
    gap: 8px;
  }
  .doc-type-btn .doc-type-texts strong {
    font-size: 12px;
  }
  .doc-type-btn .doc-type-texts small {
    font-size: 10px;
  }

  /* Budget Layout & Preview Column on Mobile */
  .budget-layout {
    grid-template-columns: 1fr !important;
    gap: 20px;
  }
  .preview-column {
    width: 100% !important;
    max-width: 100% !important;
    position: static !important;
  }
  .preview-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    margin: 0 0 12px !important;
  }
  .preview-header > div:first-child {
    width: 100% !important;
  }
  #previewBranchSwitcher {
    width: 100% !important;
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
  }
  #previewBranchSwitcher .branch-btn-group {
    flex: 1 1 calc(50% - 4px) !important;
    min-width: 140px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 999px !important;
    padding: 8px 10px 8px 14px !important;
    gap: 8px !important;
    min-height: 42px !important;
    box-sizing: border-box !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
  }
  #previewBranchSwitcher .branch-btn-group.active {
    border-color: #1e438e !important;
    background: #eff6ff !important;
    box-shadow: 0 2px 8px rgba(30, 67, 142, 0.18) !important;
  }
  #previewBranchSwitcher .branch-btn-group .branch-btn {
    flex: 1 !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    color: #334155 !important;
    white-space: nowrap !important;
    pointer-events: none !important;
  }
  #previewBranchSwitcher .branch-btn-group.active .branch-btn {
    color: #1e438e !important;
  }
  #previewBranchSwitcher .branch-edit-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 26px !important;
    height: 26px !important;
    border-radius: 50% !important;
    background: #f1f5f9 !important;
    color: #64748b !important;
    border: none !important;
    cursor: pointer !important;
    padding: 0 !important;
    flex-shrink: 0 !important;
    pointer-events: auto !important;
  }
  .discount-head {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    gap: 8px !important;
  }
  .discount-title {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    min-width: 0 !important;
  }
  .discount-title strong {
    font-size: 12.5px !important;
    line-height: 1.25 !important;
  }
  .discount-title small {
    font-size: 10.5px !important;
  }
  .applied-discount-pill {
    font-size: 10.5px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    padding: 4px 8px !important;
    margin-top: 2px !important;
  }
  .preview-paper-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box;
  }
  #previewCanvas {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    display: block;
  }

  /* Sedes & Sucursales Banner on Mobile */
  .branch-selector-bar {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 14px !important;
    padding: 14px !important;
    margin-bottom: 16px !important;
  }
  .branch-selector-info {
    width: 100% !important;
  }
  .branch-actions-row {
    flex-direction: column !important;
    align-items: stretch !important;
    width: 100% !important;
    gap: 10px !important;
  }
  .branch-switcher-pills {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    width: 100% !important;
    gap: 6px !important;
    padding: 4px !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
  }
  .branch-btn-group {
    width: 100% !important;
    justify-content: space-between !important;
    min-width: 0 !important;
    padding: 4px 8px !important;
    box-sizing: border-box !important;
  }
  .branch-btn {
    font-size: 11.5px !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }
  .btn-add-branch-active {
    width: 100% !important;
    height: 40px !important;
    justify-content: center !important;
    font-size: 13px !important;
    border-radius: 8px !important;
  }

  /* Template Cards on Mobile */
  .template-cards-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .template-hub-card {
    border-radius: 12px !important;
  }
  .template-card-body {
    padding: 14px 12px !important;
    gap: 12px !important;
  }
  .template-card-thumb-wrap {
    width: 76px !important;
    height: 106px !important;
  }
  .template-card-main h3 {
    font-size: 14px !important;
  }
  .template-card-main p {
    font-size: 11.5px !important;
  }
  .template-card-footer {
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 12px 14px !important;
    gap: 10px !important;
  }
  .template-card-footer > div:first-child {
    text-align: center !important;
    font-size: 11.5px !important;
    white-space: normal !important;
    overflow: visible !important;
  }
  .template-footer-actions {
    display: flex !important;
    width: 100% !important;
    gap: 8px !important;
  }
  .template-footer-actions button {
    flex: 1 !important;
    height: 38px !important;
    justify-content: center !important;
    font-size: 12px !important;
  }

  /* Modal Vista Previa Plantilla on Mobile */
  .modal-preview-sheet {
    width: 94vw !important;
    max-width: 440px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 0 !important;
  }
  .modal-preview-body {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    padding: 16px !important;
  }
  .preview-modal-paper-wrap {
    max-height: 260px !important;
    padding: 10px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f1f5f9 !important;
  }
  .preview-modal-paper-wrap img {
    max-height: 240px !important;
    max-width: 100% !important;
    object-fit: contain !important;
  }
  .preview-modal-meta {
    text-align: left !important;
    gap: 10px !important;
  }
  .preview-modal-meta h4 {
    font-size: 16px !important;
    margin: 0 !important;
  }
  .preview-modal-meta p {
    font-size: 12.5px !important;
    margin: 0 !important;
    line-height: 1.4 !important;
  }
  .preview-modal-actions {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    gap: 8px !important;
    margin-top: 14px !important;
  }
  .preview-modal-actions button {
    width: 100% !important;
    height: 42px !important;
    justify-content: center !important;
    font-size: 13.5px !important;
  }

  /* Metrics on Mobile */
  .metrics-usage-card {
    padding: 16px 14px !important;
    border-radius: 12px !important;
    margin-bottom: 14px !important;
  }
  .metrics-usage-head {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
  }
  .metrics-counter {
    font-size: 16px !important;
  }
  .metrics-reset-info {
    font-size: 11px !important;
    margin-top: 2px !important;
  }
  .metrics-usage-foot {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
    font-size: 11.5px !important;
  }
  .metrics-kpi-grid {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    margin-bottom: 16px !important;
  }
  .metrics-kpi-card {
    padding: 12px 10px !important;
    border-radius: 10px !important;
    gap: 10px !important;
  }
  .metrics-kpi-card .kpi-icon {
    width: 36px !important;
    height: 36px !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
  }
  .metrics-kpi-card .kpi-icon svg {
    width: 18px !important;
    height: 18px !important;
  }
  .kpi-label {
    font-size: 10.5px !important;
  }
  .kpi-value {
    font-size: 18px !important;
  }
  .kpi-sub {
    font-size: 9.5px !important;
  }
  .metrics-breakdown-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }
  .metrics-breakdown-card {
    padding: 16px 14px !important;
    border-radius: 12px !important;
  }
  .metrics-breakdown-card h3 {
    font-size: 14.5px !important;
    margin-bottom: 12px !important;
  }
  .breakdown-meta {
    font-size: 12px !important;
  }
  .plan-limit-row {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
  }
  .plan-limit-row span {
    color: #64748b !important;
    font-size: 11.5px !important;
  }
  .plan-limit-row strong {
    font-size: 11.5px !important;
    white-space: nowrap !important;
    text-align: right !important;
  }

  /* Modal Pro Upgrade on Mobile */
  .modal-pro-sheet {
    width: 94vw !important;
    max-width: 440px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    padding: 0 !important;
    border-radius: 16px !important;
  }
  .pro-modal-body {
    padding: 16px !important;
  }
  .pro-modal-h2 {
    font-size: 18px !important;
    line-height: 1.25 !important;
    margin-bottom: 8px !important;
  }
  .pro-modal-desc {
    font-size: 12.5px !important;
    line-height: 1.45 !important;
    margin-bottom: 14px !important;
  }
  .modal-plans-compare {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    margin-top: 14px !important;
  }
  .modal-plan-card {
    padding: 16px !important;
    border-radius: 12px !important;
  }
  .m-plan-price {
    font-size: 24px !important;
  }
  .m-plan-features {
    gap: 7px !important;
    margin-bottom: 16px !important;
  }
  .m-plan-features li {
    font-size: 12px !important;
  }
  .pro-select-btn,
  .enterprise-select-btn {
    height: 42px !important;
    font-size: 13.5px !important;
    justify-content: center !important;
  }

  /* Mobile Modals General */
  .modal-sheet {
    width: 92vw !important;
    max-width: 440px !important;
    margin: 16px auto !important;
    border-radius: 16px !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .modal-sheet:has(.modal-header),
  .modal-sheet:has(.modal-body) {
    padding: 0 !important;
  }
  #logoutConfirmModal .modal-sheet,
  #pdfSizeLimitModal .modal-sheet,
  #confirmModal .modal-sheet {
    padding: 28px 22px 26px !important;
    max-width: 390px !important;
  }
  .modal-header {
    padding: 14px 16px !important;
  }
  .modal-body {
    padding: 16px !important;
    gap: 12px !important;
    box-sizing: border-box !important;
  }
  .modal-body .field-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  .modal-body .field input,
  .modal-body .field textarea {
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .auth-modal-sheet {
    padding: 22px 18px 20px !important;
    position: relative !important;
    max-height: 90vh;
    overflow-y: auto;
  }
  .auth-modal-header {
    padding: 4px 38px 14px !important;
    margin-bottom: 16px !important;
  }
  .auth-modal-header .modal-close {
    top: 6px !important;
    right: 6px !important;
    width: 36px !important;
    height: 36px !important;
    font-size: 16px !important;
  }
  .auth-tabs {
    gap: 6px;
  }
  .auth-tab-btn {
    padding: 8px 12px;
    font-size: 13px;
  }

  /* Modal Actions (Branch & Professional) on Mobile (single line, exact same height and alignment) */
  .branch-modal-actions,
  .prof-modal-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    flex-wrap: nowrap !important;
    margin-top: 14px !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }
  .branch-modal-actions .btn-action-danger,
  .prof-modal-actions .btn-action-danger {
    flex: 0 0 auto !important;
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0 10px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    margin: 0 !important;
    border: 1.5px solid #fecaca !important;
    background: #fef2f2 !important;
    color: #dc2626 !important;
  }
  .branch-modal-actions .btn-action-danger[style*="display: none"],
  .prof-modal-actions .btn-action-danger[style*="display: none"],
  .branch-modal-actions .btn-action-danger[style*="display:none"],
  .prof-modal-actions .btn-action-danger[style*="display:none"],
  .branch-modal-actions .btn-action-danger[hidden],
  .prof-modal-actions .btn-action-danger[hidden] {
    display: none !important;
  }
  .branch-modal-actions .btn-action-danger svg,
  .prof-modal-actions .btn-action-danger svg {
    width: 13px !important;
    height: 13px !important;
    flex-shrink: 0 !important;
  }
  .branch-modal-btns-right,
  .prof-modal-btns-right {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin-left: auto !important;
  }
  .branch-modal-btns-right .quiet-button,
  .branch-modal-btns-right .primary-button,
  .prof-modal-btns-right .quiet-button,
  .prof-modal-btns-right .primary-button {
    height: 38px !important;
    min-height: 38px !important;
    max-height: 38px !important;
    padding: 0 12px !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 8px !important;
    box-sizing: border-box !important;
    line-height: 1 !important;
    margin: 0 !important;
  }

  /* Landing Page Mobile Adaptation */
  .landing-container {
    padding: 0 16px;
  }
  .nav-container {
    height: 64px;
  }
  .landing-nav-links {
    display: none !important;
  }
  .landing-nav-actions #landingLoginBtn,
  .landing-nav-actions #landingRegisterBtn {
    display: none !important;
  }
  .landing-hamburger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 9px;
    color: #0f172a;
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
  }
  .landing-hamburger-btn:hover,
  .landing-hamburger-btn:active {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: var(--blue);
  }
  .landing-hamburger-btn .hamburger-icon-open {
    display: block;
  }
  .landing-hamburger-btn .hamburger-icon-close {
    display: none;
  }
  .landing-hamburger-btn.open .hamburger-icon-open {
    display: none;
  }
  .landing-hamburger-btn.open .hamburger-icon-close {
    display: block;
    color: var(--blue);
  }
  .landing-mobile-menu {
    display: block;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid #e2e8f0;
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.08);
    transition: max-height 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, padding 0.3s ease;
    padding: 0 16px;
  }
  .landing-mobile-menu.open {
    max-height: 80vh;
    opacity: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 12px 16px 20px;
  }
  .landing-mobile-nav {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .mobile-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #334155;
    font-weight: 700;
    font-size: 13.5px;
    text-decoration: none;
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    transition: all 0.15s ease;
  }
  .mobile-nav-link:hover,
  .mobile-nav-link:active {
    background: #eff6ff;
    color: var(--blue);
    border-color: #bfdbfe;
  }
  .nav-link-icon {
    width: 36px;
    height: 36px;
  }
  .mobile-menu-divider {
    display: block;
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
  }
  .mobile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .mobile-menu-btn {
    width: 100%;
    height: 44px;
    font-size: 14.5px;
    font-weight: 800;
    justify-content: center;
    border-radius: 9px;
  }
  .landing-brand .landing-logo-img {
    height: 30px;
  }
  .landing-hero {
    padding: 36px 0 54px;
  }
  .hero-badge {
    font-size: 11px;
    padding: 5px 12px;
    margin-bottom: 16px;
    line-height: 1.35;
    text-align: center;
  }
  .hero-title {
    font-size: 30px;
    line-height: 1.2;
    margin-bottom: 14px;
    letter-spacing: -0.3px;
  }
  .hero-subtitle {
    font-size: 14.5px;
    line-height: 1.55;
    margin-bottom: 22px;
  }
  .hero-cta-group {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }
  .landing-btn-hero-primary,
  .landing-btn-hero-demo {
    width: 100%;
    justify-content: center;
    font-size: 14.5px;
    padding: 13px 20px;
  }
  .hero-trust {
    flex-direction: column;
    gap: 8px;
    align-items: center;
    font-size: 11.5px;
  }
  .landing-features {
    padding: 50px 0;
  }
  .section-header {
    margin-bottom: 30px;
  }
  .section-title {
    font-size: 24px;
    line-height: 1.25;
  }
  .features-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .feature-card {
    padding: 20px 18px;
  }
  .landing-pricing {
    padding: 50px 0 70px;
  }
  .pricing-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .pricing-card {
    padding: 28px 20px;
  }
  .pricing-price {
    font-size: 32px;
  }
  .footer-container {
    flex-direction: column;
    text-align: center;
    gap: 24px;
    padding-bottom: 36px;
  }
  .footer-left {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .footer-right {
    flex-direction: column;
    width: 100%;
    gap: 12px;
    margin-bottom: 6px;
  }
  .footer-btn-secondary,
  .footer-btn-primary {
    width: 100%;
    justify-content: center;
  }
  .footer-bottom {
    padding-top: 24px;
  }
}

@media (max-width: 600px) {
  .hero-preview-top {
    padding: 8px 10px;
    gap: 6px;
  }
  .preview-url {
    font-size: 9.5px;
    margin-left: 4px;
  }
  .preview-live-pill {
    font-size: 9.5px;
    padding: 2.5px 7px;
    gap: 4px;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }
  .doc-animated-layer {
    gap: 6px;
  }
  .doc-anim-meta {
    grid-template-columns: 1.35fr 0.85fr 1.6fr !important;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 5px;
  }
  .doc-field-lbl {
    font-size: 6px;
  }
  .doc-field-val {
    font-size: 7.5px;
  }
  .typing-cursor {
    height: 8px;
  }
  .doc-anim-table {
    border-radius: 5px;
  }
  .doc-anim-tr {
    grid-template-columns: 1.8fr 0.85fr 0.85fr !important;
    padding: 3.5px 6px;
    font-size: 7.5px;
  }
  .doc-anim-th {
    font-size: 6.5px;
  }
  .tr-list {
    font-size: 6.5px;
  }
  .doc-anim-summary {
    padding: 4px 6px;
    border-radius: 5px;
  }
  .anim-savings-pill {
    font-size: 7px;
    gap: 3px;
  }
  .anim-total-row {
    font-size: 6.5px;
  }
  .anim-total-row.main {
    font-size: 8px;
  }
  .doc-anim-signature {
    margin-top: 6px;
    padding: 0 6px;
  }
  .anim-sig-svg {
    width: 68px;
    height: 18px;
  }
  .doc-sig-name {
    font-size: 7px;
  }
  .doc-sig-spec {
    font-size: 5.5px;
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 26px;
  }
  .hero-subtitle {
    font-size: 13.5px;
  }
}

/* ============================================================== */
/* IMPERSONATION & SUPPORT MODE BANNER                            */
/* ============================================================== */
.impersonation-banner {
  position: sticky;
  top: 0;
  z-index: 9999;
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%);
  color: #ffffff;
  padding: 8px 16px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.2);
  border-bottom: 2px solid #60a5fa;
}
.impersonation-banner-inner {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.impersonation-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
}
.impersonation-info strong {
  font-weight: 800;
  color: #93c5fd;
}
.btn-exit-impersonation {
  background: #ffffff;
  color: #0f172a;
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-exit-impersonation:hover {
  background: #fee2e2;
  color: #dc2626;
}

.admin-nav-pill {
  font-size: 9px;
  font-weight: 900;
  background: #eff6ff;
  color: #1e438e;
  border: 1px solid #bfdbfe;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: auto;
  letter-spacing: 0.04em;
}

/* ============================================================== */
/* CLIENT BILLING & SUBSCRIPTION PORTAL STYLES                    */
/* ============================================================== */
.billing-status-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 28px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
.billing-status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.billing-plan-info {
  display: flex;
  align-items: center;
  gap: 14px;
}
.plan-badge-lg {
  font-size: 13px;
  font-weight: 900;
  padding: 6px 14px;
  border-radius: 8px;
  letter-spacing: 0.04em;
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}
.plan-badge-lg.pro {
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%);
  color: #ffffff;
  border: none;
}
.plan-badge-lg.enterprise {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.4);
}
.billing-plan-info h3 {
  margin: 0 0 2px;
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
}
.billing-plan-info p {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

.subscription-countdown-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}
.countdown-labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
}
.countdown-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  color: #0f172a;
}
.countdown-expiry {
  color: #64748b;
  font-weight: 600;
}
.countdown-track {
  height: 9px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.countdown-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  transition: width 0.4s ease;
}
.countdown-fill.warning {
  background: linear-gradient(90deg, #f59e0b 0%, #d97706 100%);
}
.countdown-fill.danger {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
}

.billing-quick-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.billing-metric-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}
.billing-metric-item small {
  display: block;
  font-size: 11px;
  color: #64748b;
  margin-bottom: 4px;
  font-weight: 600;
}
.billing-metric-item strong {
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

/* Billing Plans Matrix */
.billing-cycle-toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}
.cycle-toggle-pill {
  display: flex;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 4px;
}
.cycle-btn {
  border: none;
  background: transparent;
  padding: 6px 18px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.cycle-btn.active {
  background: #ffffff;
  color: #0f172a;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.discount-tag {
  font-size: 10px;
  font-weight: 900;
  background: #dcfce7;
  color: #15803d;
  padding: 2px 6px;
  border-radius: 999px;
}

.billing-pricing-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 36px;
}
.billing-plan-card {
  position: relative;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}
.billing-plan-card.featured {
  border: 2px solid #1e438e;
  box-shadow: 0 8px 24px rgba(30, 67, 142, 0.12);
}
.billing-plan-card.enterprise {
  background: #0f172a;
  color: #ffffff;
  border-color: #1e293b;
}
.billing-plan-card.enterprise .b-plan-name {
  color: #fbbf24;
}
.billing-plan-card.enterprise .b-plan-price {
  color: #ffffff;
}
.billing-plan-card.enterprise .b-plan-header p {
  color: #94a3b8;
}
.billing-plan-card.enterprise .b-plan-features li {
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.08);
}
.popular-ribbon {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.05em;
  padding: 3px 12px;
  border-radius: 999px;
}

.b-plan-name {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  display: block;
  margin-bottom: 6px;
}
.b-plan-price {
  font-size: 28px;
  font-weight: 900;
  color: #0f172a;
  margin-bottom: 8px;
}
.b-plan-price span {
  font-size: 14px;
  font-weight: 500;
  color: #64748b;
}
.b-plan-header p {
  font-size: 12.5px;
  color: #64748b;
  margin: 0 0 16px;
  line-height: 1.4;
  min-height: 36px;
}
.b-plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  flex: 1;
}
.b-plan-features li {
  font-size: 12.5px;
  color: #334155;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}
.check-icon {
  color: #10b981;
  font-weight: 800;
}
.btn-plan-action {
  width: 100%;
  height: 42px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 800;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  transition: all 0.15s ease;
}
.btn-plan-action.current {
  background: #f1f5f9;
  color: #64748b;
  cursor: default;
}
.btn-plan-action.primary {
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(30, 67, 142, 0.25);
}
.btn-plan-action.primary:hover {
  transform: translateY(-1px);
}
.btn-plan-action.dark {
  background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
  color: #0f172a;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.25);
}

/* Invoices Table */
.invoices-header {
  margin-bottom: 14px;
}
.invoices-header h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}
.invoices-header p {
  margin: 0;
  font-size: 12.5px;
  color: #64748b;
}
.invoices-table-wrap {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.invoices-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
.invoices-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.invoices-table td {
  padding: 14px 18px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  white-space: nowrap;
}

/* ============================================================== */
/* SUPERADMIN BACKEND CONSOLE STYLES                              */
/* ============================================================== */
.admin-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
}
.admin-pill {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
  font-weight: 800;
}
.btn-admin-refresh {
  height: 34px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #334155;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-admin-refresh:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.admin-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.admin-kpi-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04);
}
.kpi-icon-badge {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.kpi-info {
  display: flex;
  flex-direction: column;
}
.kpi-info small {
  font-size: 11.5px;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 2px;
}
.kpi-info strong {
  font-size: 20px;
  font-weight: 900;
  color: #0f172a;
}
.kpi-subtext {
  font-size: 11px;
  color: #94a3b8;
  font-weight: 500;
}

.admin-subtabs-nav {
  display: flex;
  gap: 10px;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 20px;
}
.admin-tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 700;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.admin-tab-btn:hover {
  color: #1e293b;
}
.admin-tab-btn.active {
  color: #1e438e;
  border-bottom-color: #1e438e;
}

.admin-table-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.admin-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 12px;
  width: 340px;
}
.admin-search-box input {
  border: none;
  outline: none;
  width: 100%;
  height: 38px;
  font-size: 13px;
  background: transparent;
}
.admin-filter-chips {
  display: flex;
  gap: 6px;
}
.admin-chip {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  color: #475569;
  cursor: pointer;
}
.admin-chip.active {
  background: #1e438e;
  border-color: #1e438e;
  color: #ffffff;
}

.admin-table-container {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.admin-data-table {
  width: 100%;
  min-width: 780px;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
.admin-data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  white-space: nowrap;
}
.admin-data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  white-space: nowrap;
}

.admin-card-section {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
}
.admin-sec-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 14px;
}
.sec-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
.admin-sec-header h3 {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}
.admin-sec-header p {
  margin: 0;
  font-size: 12.5px;
  color: #64748b;
}

.gateway-config-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 16px;
  margin-top: 14px;
}
.gateway-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: #475569;
  margin-top: 10px;
  cursor: pointer;
}
.admin-settings-submit-bar {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
.btn-save-settings {
  height: 42px;
  padding: 0 20px;
  font-size: 13px;
  font-weight: 800;
  border-radius: 8px;
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%);
  color: #ffffff;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(30, 67, 142, 0.25);
  transition: all 0.15s ease;
}

/* Gateway Option Card in Checkout Modal */
.gateway-option-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #ffffff;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.gateway-option-card:hover {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.gateway-option-card:has(input:checked) {
  border-color: #1e438e;
  background: #eff6ff;
}
.gateway-option-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@media (max-width: 1024px) {
  .admin-kpi-grid, .billing-pricing-grid {
    grid-template-columns: 1fr;
  }
  .billing-quick-metrics {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================== */
/* SUPERADMIN PLAN SIMULATOR (SIDEBAR TESTING COMPONENT)          */
/* ============================================================== */
.admin-plan-simulator {
  margin-top: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.admin-plan-simulator .sim-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.admin-plan-simulator .sim-pills-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
}
.sim-pill-btn {
  height: 26px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #475569;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.sim-pill-btn:hover {
  background: #f1f5f9;
  color: #0f172a;
  border-color: #94a3b8;
}
.sim-pill-btn.active {
  background: linear-gradient(135deg, #1e438e 0%, #0d2861 100%) !important;
  color: #ffffff !important;
  border-color: #1e438e !important;
  box-shadow: 0 2px 5px rgba(30, 67, 142, 0.25);
}

/* ============================================================== */
/* DOCLY PREMIUM CUSTOM SELECT COMPONENT (ZERO OS NATIVE SELECT)  */
/* ============================================================== */
.docly-custom-select-wrap {
  position: relative;
  width: 100%;
}
.docly-custom-select-trigger {
  width: 100%;
  min-height: 44px;
  padding: 0 11px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: #0f172a;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: all 0.2s ease;
  box-sizing: border-box;
  white-space: nowrap;
}
.docly-custom-select-trigger:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.docly-custom-select-trigger:focus,
.docly-custom-select-trigger.active {
  border-color: #1e438e;
  box-shadow: 0 0 0 3px rgba(30, 67, 142, 0.12), 0 2px 4px rgba(15, 23, 42, 0.06);
  outline: none;
}
.docly-custom-select-trigger .trigger-content {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docly-custom-select-trigger .trigger-content span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docly-custom-select-trigger .trigger-chevron {
  color: #64748b;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}
.docly-custom-select-trigger.active .trigger-chevron {
  transform: rotate(180deg);
  color: #1e438e;
}

.docly-custom-select-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  min-width: 220px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 14px 35px -4px rgba(15, 23, 42, 0.22), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  padding: 6px;
  z-index: 2500 !important;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-sizing: border-box;
}
.docly-custom-select-menu[hidden] {
  display: none !important;
}

.docly-select-option {
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  transition: all 0.12s ease;
  white-space: nowrap;
}
.docly-select-option:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.docly-select-option.selected {
  background: #eff6ff;
  color: #1e438e;
  font-weight: 700;
}
.docly-select-option .option-left {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docly-select-option .option-check {
  color: #1e438e;
  opacity: 0;
  flex-shrink: 0;
}
.docly-select-option.selected .option-check {
  opacity: 1;
}

/* Status Indicator Dots (Vector SVG Based - Zero Emojis) */
.status-dot-svg {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-dot-active {
  background: #16a34a;
  box-shadow: 0 0 0 2px #dcfce7;
}
.status-dot-past_due {
  background: #d97706;
  box-shadow: 0 0 0 2px #fef3c7;
}
.status-dot-expired {
  background: #dc2626;
  box-shadow: 0 0 0 2px #fee2e2;
}
.status-dot-canceled {
  background: #64748b;
  box-shadow: 0 0 0 2px #f1f5f9;
}

/* ============================================================== */
/* DOCLY PREMIUM CALENDAR POPOVER FOR ADMIN MODAL                */
/* ============================================================== */
.admin-date-picker-wrap {
  position: relative;
  width: 100%;
}
.admin-calendar-popover {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  left: auto;
  width: 280px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 14px 35px -4px rgba(15, 23, 42, 0.22), 0 8px 10px -6px rgba(15, 23, 42, 0.1);
  padding: 12px;
  z-index: 2500 !important;
  box-sizing: border-box;
}
.admin-calendar-popover[hidden] {
  display: none !important;
}

/* Modal overflow fix so floating popovers never get clipped */
#adminLicenseModal .modal-sheet {
  overflow: visible !important;
}
#adminLicenseModal .modal-body {
  overflow: visible !important;
  padding-bottom: 24px !important;
}

/* Admin Form Fields generous spacing */
.admin-form-fields {
  display: flex !important;
  flex-direction: column !important;
  gap: 20px !important;
  margin-top: 14px !important;
}
.admin-card-section {
  padding: 24px !important;
  margin-bottom: 24px !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 14px !important;
}
.admin-card-section .field-grid {
  gap: 18px !important;
}

/* ============================================================== */
/* PRINT MEDIA STYLES: ISOLATE PDF DOCUMENT ONLY                 */
/* ============================================================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 0;
  }
  html, body {
    background: #ffffff !important;
    margin: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    height: 100% !important;
    overflow: visible !important;
  }
  .app-sidebar,
  .topbar,
  .doc-type-selector,
  .docly-impersonation-banner,
  .editor-column,
  .preview-top-actions,
  .preview-footer-note,
  .modal-backdrop,
  .auth-overlay,
  .btn-branch-switcher,
  .landing-view,
  .admin-dashboard,
  .billing-view {
    display: none !important;
    visibility: hidden !important;
  }
  .app-layout {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  .app-main-content,
  .workspace-view,
  .document-editor-grid,
  .preview-column {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
  }
  .pdf-preview-box,
  .pdf-canvas-container,
  #pdfPreviewWrapper {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    border: none !important;
    background: #ffffff !important;
  }
  #templatePreview {
    display: block !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    object-fit: contain !important;
    box-shadow: none !important;
    border: none !important;
  }
}

/* -------------------------------------------------------------
   MODAL EDITOR DE FIRMA DIGITAL (Quitar Fondo & Recorte)
------------------------------------------------------------- */
.sig-editor-modal-sheet {
  max-width: 840px !important;
  width: 95% !important;
}

.sig-editor-layout {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 18px;
  align-items: start;
}

@media (max-width: 768px) {
  .sig-editor-layout {
    grid-template-columns: 1fr;
  }
}

.sig-editor-preview-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sig-canvas-wrapper {
  background-color: #f8fafc;
  background-image: 
    linear-gradient(45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(-45deg, #e2e8f0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e2e8f0 75%),
    linear-gradient(-45deg, transparent 75%, #e2e8f0 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
  border: 1.5px dashed #cbd5e1;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  max-height: 360px;
  overflow: auto;
}

.sig-canvas-wrapper canvas {
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  border-radius: 6px;
  background: transparent;
}

.sig-editor-info-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.sig-editor-controls-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sig-control-card, .sig-tools-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
}

.sig-card-title {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.sig-toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  color: #0f172a;
}

.sig-toggle-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #1e438e;
  cursor: pointer;
}

.sig-slider-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.sig-slider-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #475569;
  font-weight: 500;
}

.sig-slider-val {
  font-weight: 700;
  color: #1e438e;
}

.sig-range-slider {
  width: 100%;
  accent-color: #1e438e;
  cursor: pointer;
}

.sig-help-text {
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
}

.sig-ink-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}

.sig-ink-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sig-ink-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
}

.sig-ink-btn.active {
  background: #eff6ff;
  border-color: #1e438e;
  color: #1e438e;
  box-shadow: 0 0 0 1px #1e438e;
}

.sig-ink-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sig-tools-btn-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sig-tool-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sig-tool-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
  color: #0f172a;
}

.sig-tool-btn.active {
  background: #eff6ff;
  border-color: #1e438e;
  color: #1e438e;
  box-shadow: 0 0 0 1px #1e438e;
}

.sig-mini-btn {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s ease;
}

.sig-mini-btn:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #0f172a;
}

.sig-mini-btn.active {
  background: #1e438e;
  border-color: #1e438e;
  color: #ffffff;
}

.sig-canvas-container {
  position: relative;
  display: inline-block;
  user-select: none;
  touch-action: none;
}

.sig-crop-box {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px dashed #1e438e;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.45), 0 0 12px rgba(30, 67, 142, 0.3);
  cursor: move;
  box-sizing: border-box;
  z-index: 10;
}

.sig-crop-grid-line {
  position: absolute;
  pointer-events: none;
  opacity: 0.4;
}

.sig-crop-grid-line.h-1 {
  top: 33.33%;
  left: 0;
  right: 0;
  height: 1px;
  background: #ffffff;
}

.sig-crop-grid-line.h-2 {
  top: 66.66%;
  left: 0;
  right: 0;
  height: 1px;
  background: #ffffff;
}

.sig-crop-grid-line.v-1 {
  left: 33.33%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #ffffff;
}

.sig-crop-grid-line.v-2 {
  left: 66.66%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #ffffff;
}

.sig-crop-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #ffffff;
  border: 2px solid #1e438e;
  border-radius: 2px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  z-index: 20;
}

.sig-crop-handle.handle-tl { top: -6px; left: -6px; cursor: nwse-resize; }
.sig-crop-handle.handle-tr { top: -6px; right: -6px; cursor: nesw-resize; }
.sig-crop-handle.handle-bl { bottom: -6px; left: -6px; cursor: nesw-resize; }
.sig-crop-handle.handle-br { bottom: -6px; right: -6px; cursor: nwse-resize; }
.sig-crop-handle.handle-t { top: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; width: 16px; border-radius: 4px; }
.sig-crop-handle.handle-b { bottom: -6px; left: 50%; transform: translateX(-50%); cursor: ns-resize; width: 16px; border-radius: 4px; }
.sig-crop-handle.handle-l { left: -6px; top: 50%; transform: translateY(-50%); cursor: ew-resize; height: 16px; border-radius: 4px; }
.sig-crop-handle.handle-r { right: -6px; top: 50%; transform: translateY(-50%); cursor: ew-resize; height: 16px; border-radius: 4px; }

/* -------------------------------------------------------------
   MESA DE AYUDA & SOPORTE TÉCNICO
------------------------------------------------------------- */
.support-grid-layout {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1024px) {
  .support-grid-layout {
    grid-template-columns: 1fr;
  }
}

.support-form-card,
.support-history-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.support-form-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.support-form-body .field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.support-form-body .field > span {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
  display: block;
}

.support-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.support-card-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* Custom Support Category Dropdown */
#customSupportCategorySelect {
  position: relative;
  width: 100%;
}

#customSupportCategorySelect .custom-select-trigger {
  width: 100%;
  height: 46px;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: all 0.15s ease;
}

#customSupportCategorySelect .custom-select-trigger:hover,
#customSupportCategorySelect .custom-select-trigger[aria-expanded="true"] {
  border-color: #1e438e;
  box-shadow: 0 0 0 3px rgba(30, 67, 142, 0.08);
}

#customSupportCategorySelect .custom-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  min-width: 340px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.16);
  padding: 6px;
  z-index: 9999;
}

.support-select-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
}

.support-select-option:hover {
  background: #eff6ff !important;
}

.support-select-option.active {
  background: #e0f2fe;
}

.support-select-option-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}

.support-select-option:hover .support-select-option-icon {
  background: #ffffff;
}

.support-select-option-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.support-select-option-text strong {
  font-size: 13px;
  font-weight: 700;
  color: #0f172a;
  display: block;
}

.support-select-option-text small {
  font-size: 11.5px;
  color: #64748b;
  display: block;
}

.support-dropzone {
  background: #f8fafc;
  border: 1.5px dashed #cbd5e1;
  border-radius: 10px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.support-dropzone:hover,
.support-dropzone.dragover {
  background: #eff6ff;
  border-color: #1e438e;
}

.support-thumbs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.support-thumb-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  overflow: hidden;
  background: #0f172a;
}

.support-thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.support-thumb-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.75);
  color: #ffffff;
  border: none;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.support-thumb-remove:hover {
  background: #dc2626;
}

/* Tickets List in Client View */
.support-tickets-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 600px;
  overflow-y: auto;
  padding-right: 4px;
}

.support-ticket-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s ease;
}

.support-ticket-item:hover {
  border-color: #cbd5e1;
}

.support-ticket-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.support-ticket-subject {
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
  margin: 0 0 2px;
}

.support-ticket-meta {
  font-size: 11.5px;
  color: #64748b;
}

.support-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.support-badge.open {
  background: #fef3c7;
  color: #b45309;
}

.support-badge.answered {
  background: #dcfce7;
  color: #15803d;
}

.support-badge.closed {
  background: #f1f5f9;
  color: #475569;
}

.support-ticket-msg {
  font-size: 13px;
  color: #334155;
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
}

.support-ticket-images {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.support-img-thumb {
  width: 54px;
  height: 54px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid #cbd5e1;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.support-img-thumb:hover {
  transform: scale(1.05);
  border-color: #1e438e;
}

.support-official-reply {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 4px;
}

.support-reply-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.support-reply-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #1e438e;
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}

.support-reply-title {
  font-size: 12px;
  font-weight: 800;
  color: #1e40af;
}

.support-reply-time {
  font-size: 11px;
  color: #64748b;
  margin-left: auto;
}

.support-reply-text {
  font-size: 13px;
  color: #1e293b;
  line-height: 1.45;
  margin: 0;
  white-space: pre-wrap;
}

/* SuperAdmin Tickets Management */
.admin-tickets-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.admin-ticket-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.admin-ticket-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-reply-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-reply-textarea {
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  resize: vertical;
}

.admin-reply-textarea:focus {
  border-color: #1e438e;
  outline: none;
  background: #ffffff;
}

/* Selector Segmentado de Filtros de Tickets */
.admin-ticket-filters {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.admin-filter-pill {
  border: none;
  background: transparent;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 700;
  color: #64748b;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.admin-filter-pill svg {
  color: currentColor;
  flex-shrink: 0;
}

.admin-filter-pill:hover {
  color: #0f172a;
  background: rgba(255, 255, 255, 0.65);
}

.admin-filter-pill.active {
  background: #ffffff;
  color: #1e438e;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
}

.admin-pill-badge {
  font-size: 10.5px;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 10px;
  line-height: 1.3;
}

.admin-pill-badge.pending {
  background: #fee2e2;
  color: #dc2626;
}

.admin-filter-pill.active .admin-pill-badge.pending {
  background: #dc2626;
  color: #ffffff;
}



