/* SUN & SEA REAL ESTATE - Modern InmoContracts UI Stylesheet */

:root {
  --primary: #0f3460;
  --primary-hover: #162447;
  --primary-light: #e8f0fe;
  --accent: #008080;
  --accent-light: #e6f7f7;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #0f172a;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --bg-main: #f4f7fb;
  --card-bg: #ffffff;
  --radius-xl: 18px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.05), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 8px -2px rgba(15, 52, 96, 0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --shadow-lg: 0 12px 24px -4px rgba(15, 52, 96, 0.1), 0 4px 6px -2px rgba(0,0,0,0.03);
  --shadow-xl: 0 20px 30px -6px rgba(15, 52, 96, 0.12), 0 8px 12px -4px rgba(0,0,0,0.04);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: var(--bg-main);
  color: var(--slate-800);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Header */
.app-header {
  background: white;
  border-bottom: 1px solid var(--slate-200);
  padding: 0.5rem 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  width: 100%;
}

.header-inner {
  max-width: 1420px;
  margin: 0 auto;
  padding: 0 1.75rem;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: nowrap !important;
  gap: 0.75rem;
}

.nav-label-short {
  display: none;
}

.nav-label-full {
  display: inline;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.brand-logo-img {
  background: transparent;
  border: none;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
}

.brand-logo-img img {
  height: 42px;
  width: auto;
  object-fit: contain;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-badge-v5 {
  background: #334155;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 9999px;
  vertical-align: middle;
  letter-spacing: 0.5px;
}

.brand-subtitle {
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 500;
  margin-top: 1px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: nowrap !important;
  flex-shrink: 0;
}

.header-nav-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: nowrap !important;
  flex-shrink: 0;
}

/* Nav Segmented Capsule (Captación aesthetic) */
.nav-capsule {
  background: #38495a;
  border-radius: 12px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

.nav-capsule-btn {
  background: transparent;
  color: #cbd5e1;
  font-weight: 600;
  font-size: 0.83rem;
  border: none;
  border-radius: 8px;
  padding: 6px 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  font-family: inherit;
  text-decoration: none;
}

.nav-capsule-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-capsule-btn.active {
  background: #1e2631;
  color: #ffffff;
  font-weight: 700;
  box-shadow: inset 0 0 0 1.5px #38bdf8;
}

.nav-capsule-btn.active:hover {
  background: #25303e;
}

/* Preset / Ficha Ejemplo Pill */
.preset-select-pill {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 5px 24px 5px 10px;
  font-size: 0.81rem;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  font-family: inherit;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px;
  max-width: 135px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-select-pill:hover, .preset-select-pill:focus {
  background: #ffffff;
  border-color: #94a3b8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

/* Header User Pill */
.header-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #f8fafc;
  padding: 3px 10px 3px 4px;
  border-radius: 9999px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.header-user-pill .role-badge {
  background: #1e293b;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.header-user-pill .user-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: #1e293b;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-user-pill .user-divider {
  color: #cbd5e1;
  font-weight: 300;
}

.header-user-pill .user-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 0.85rem;
  transition: color 0.15s;
}

.header-user-pill .user-action-btn:hover {
  color: #0f172a;
}

.preset-select {
  max-width: 320px;
  font-size: 0.85rem;
  padding: 0.5rem 0.85rem;
  border: 1.5px solid #cbd5e1;
  border-radius: var(--radius-md);
  background: #f8fafc;
  font-weight: 600;
  color: var(--slate-800);
}

.preset-select:focus {
  border-color: var(--accent);
  background: white;
}

/* Main Layout */
.main-container {
  max-width: 1420px;
  margin: 1.75rem auto;
  padding: 0 1.75rem;
  width: 100%;
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.75rem;
  align-items: start;
}

/* Sidebar */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  position: sticky;
  top: 5.5rem;
}

.sidebar-card {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.card {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--slate-100);
}

.card-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--slate-900);
  letter-spacing: -0.01em;
}

.card-subtitle {
  font-size: 0.82rem;
  color: var(--slate-500);
  margin-top: 0.15rem;
}

/* Progress / Auditor */
.progress-container {
  margin: 1rem 0;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--slate-600);
  margin-bottom: 0.45rem;
}

.progress-track {
  width: 100%;
  height: 8px;
  background-color: var(--slate-100);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #10b981);
  width: 0%;
  transition: width 0.35s ease;
  border-radius: 999px;
}

.progress-fill.full {
  background: #10b981;
}

.audit-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 240px;
  overflow-y: auto;
}

.audit-item {
  font-size: 0.78rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 600;
}

.audit-item.ok {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.audit-item.missing {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.audit-item.warning {
  background-color: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.audit-item:hover {
  transform: translateX(2px);
}

/* Language Selector */
.lang-selector-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.lang-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.85rem;
  background: var(--slate-50);
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.2s;
}

.lang-checkbox-label:hover {
  background: white;
  border-color: var(--accent);
}

.lang-checkbox-label input[type="checkbox"],
.lang-checkbox-label input[type="radio"] {
  width: 17px;
  height: 17px;
  cursor: pointer;
  accent-color: var(--primary);
}

.lang-checkbox-label.active-lang {
  background: #f0fdf4;
  border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

/* Wizard Navigation */
.wizard-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.wizard-nav {
  display: flex;
  background: white;
  padding: 0.4rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  gap: 0.35rem;
}

.step-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 0.5rem;
  background: none;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--slate-500);
  cursor: pointer;
  transition: all 0.2s;
}

.step-btn:hover {
  background-color: var(--slate-50);
  color: var(--slate-800);
}

.step-btn.active {
  background-color: #0f172a;
  color: white;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
}

.step-badge {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--slate-200);
  color: var(--slate-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
}

.step-btn.active .step-badge {
  background-color: white;
  color: #0f172a;
}

/* Form Sections */
.form-section {
  display: none;
}

.form-section.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hero Card (Step 1) */
.contract-hero-card {
  background: linear-gradient(135deg, #f8fafc 0%, #edf4fc 100%);
  border: 2px solid #bfdbfe;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  gap: 1.5rem;
  align-items: center;
}

.hero-icon-box {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.hero-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 800;
  color: var(--primary);
  background: #dbeafe;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  margin-bottom: 0.4rem;
}

.hero-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--slate-900);
  margin-bottom: 0.4rem;
}

.hero-desc {
  font-size: 0.85rem;
  color: var(--slate-600);
  line-height: 1.5;
  margin-bottom: 0.85rem;
}

.hero-meta-row {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--slate-700);
  flex-wrap: wrap;
}

/* Form Blocks */
.form-block {
  background: var(--slate-50);
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.form-block-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.block-icon {
  font-size: 1.2rem;
}

.block-title {
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--primary);
}

.block-subtitle {
  font-size: 0.75rem;
  color: var(--slate-500);
}

.agency-block {
  background: #f0fdf4;
  border-color: #bbf7d0;
}

.agency-block .block-title {
  color: #15803d;
}

/* Form Controls */
.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
}

.form-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--slate-700);
  margin-bottom: 0.35rem;
}

.req {
  color: var(--danger);
}

.form-input, .form-select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--slate-200);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--slate-900);
  background-color: white;
  transition: all 0.2s;
}

.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.12);
}

.form-input.is-invalid {
  border-color: var(--danger);
  background-color: #fff5f5;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1rem;
}

.form-hint {
  font-size: 0.75rem;
  color: var(--slate-500);
  margin-top: 0.25rem;
}

/* REF Field Highlight */
.ref-highlight-group {
  background: #fdf2f8;
  border: 1.5px dashed #f472b6;
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.ref-input-container {
  display: flex;
  align-items: center;
  margin-top: 0.25rem;
}

.ref-badge-prefix {
  background: #db2777;
  color: white;
  font-weight: 800;
  font-size: 0.85rem;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-md) 0 0 var(--radius-md);
  letter-spacing: 0.05em;
}

.ref-input {
  border-top-left-radius: 0 !important;
  border-bottom-left-radius: 0 !important;
  font-size: 1rem !important;
  letter-spacing: 0.04em;
  color: #831843 !important;
  background: white;
}

/* Badges and Notices */
.security-shield-badge {
  background: #f0fdf4;
  color: #15803d;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid #bbf7d0;
}

.tenant-address-notice {
  background: #f0fdfa;
  border: 1px solid #99f6e4;
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  font-size: 0.8rem;
  color: #0f766e;
  margin-top: 0.5rem;
}

.tag-badge {
  background: var(--slate-100);
  color: var(--slate-700);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
}

.tag-badge-success {
  background: #dcfce7;
  color: #15803d;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
}

.checkbox-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--slate-700);
}

.checkbox-container input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 0.65rem 1.25rem;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
  box-shadow: 0 4px 10px rgba(15, 52, 96, 0.25);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  transform: translateY(-1px);
}

.btn-secondary {
  background-color: var(--slate-100);
  color: var(--slate-700);
  border: 1px solid var(--slate-200);
}

.btn-secondary:hover {
  background-color: var(--slate-200);
  color: var(--slate-900);
}

.btn-sm {
  padding: 0.45rem 0.85rem;
  font-size: 0.8rem;
}

.btn-lg {
  padding: 0.85rem 1.6rem;
  font-size: 0.95rem;
}

.btn.disabled, .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* A4 Preview Paper (WYSIWYG) */
.preview-notice {
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: var(--radius-md);
  padding: 0.85rem 1.15rem;
  font-size: 0.85rem;
  color: #0369a1;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.editor-toolbar {
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  border-bottom: none;
  border-top-left-radius: var(--radius-md);
  border-top-right-radius: var(--radius-md);
  padding: 0.5rem 0.85rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.toolbar-btn-group {
  display: flex;
  gap: 0.35rem;
}

.toolbar-btn {
  background: white;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--slate-700);
  cursor: pointer;
  transition: all 0.15s;
}

.toolbar-btn:hover {
  background: var(--slate-100);
  border-color: var(--slate-300);
}

.a4-preview-paper {
  background: white;
  border: 1px solid var(--slate-300);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  box-shadow: 0 10px 25px rgba(0,0,0,0.06);
  padding: 4rem 3.5rem;
  min-height: 650px;
  max-height: 750px;
  overflow-y: auto;
  outline: none;
  color: #000;
  font-family: 'Calibri', 'Times New Roman', serif;
}

.a4-preview-paper:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 128, 128, 0.15);
}

.emission-summary-box {
  background: #f8fafc;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-top: 1.5rem;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 1.5rem;
}

.modal-backdrop.open {
  display: flex;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

.modal-card {
  background: white;
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  max-width: 620px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--slate-100);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--slate-400);
  cursor: pointer;
  line-height: 1;
  padding: 0.2rem;
}

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

/* ============================================================
   RESPONSIVE DESIGN (TABLET & MOBILE OPTIMIZATIONS)
   ============================================================ */

/* Tablet & Mobile Breakpoint (<= 991px) */
@media (max-width: 991px) {
  .app-header {
    padding: 0.45rem 0;
  }

  .header-inner {
    padding: 0 1rem;
    flex-wrap: wrap !important;
    gap: 0.45rem;
  }

  .brand-logo {
    order: 1;
    gap: 0.5rem;
  }

  .brand-logo-img img {
    height: 36px;
  }

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

  .header-user-pill {
    order: 2;
  }

  .header-actions {
    order: 3;
    width: 100%;
    margin-top: 0.35rem;
  }

  .nav-label-short {
    display: inline !important;
  }

  .nav-label-full {
    display: none !important;
  }

  /* Fixed 2x3 Navigation Grid - No horizontal scrolling */
  .header-nav-group {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 5px !important;
    overflow-x: visible !important;
    padding: 0 !important;
  }

  .header-nav-group::-webkit-scrollbar {
    display: none;
  }

  .nav-capsule {
    display: contents !important;
  }

  .nav-capsule-btn {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    background: #38495a !important;
    color: #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 7px 4px !important;
    font-size: 0.77rem !important;
    font-weight: 600 !important;
    gap: 4px !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
  }

  .nav-capsule-btn.active {
    background: #1e2631 !important;
    color: #ffffff !important;
    box-shadow: inset 0 0 0 1.5px #38bdf8 !important;
  }

  .preset-btn-wrapper {
    width: 100% !important;
    display: flex !important;
  }

  .preset-select-pill {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    box-sizing: border-box !important;
    background-color: #38495a !important;
    color: #cbd5e1 !important;
    border: 1px solid #475569 !important;
    border-radius: 8px !important;
    padding: 7px 18px 7px 6px !important;
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    text-align: center !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23cbd5e1'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.5' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E") !important;
    background-position: right 6px center !important;
    background-size: 9px !important;
  }

  .preset-select-pill:focus, .preset-select-pill:hover {
    background-color: #1e2631 !important;
    color: #ffffff !important;
    border-color: #38bdf8 !important;
  }

  .preset-select-pill option {
    background-color: #ffffff !important;
    color: #1e293b !important;
  }

  .main-container {
    grid-template-columns: 1fr;
    padding: 0 1rem;
    margin: 1rem auto;
    gap: 1.25rem;
  }

  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
  }

  .wizard-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding: 0.35rem;
  }

  .wizard-nav::-webkit-scrollbar {
    display: none;
  }

  .step-btn {
    flex: 0 0 auto;
    min-width: auto;
    padding: 0.6rem 0.95rem;
    white-space: nowrap;
  }

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

/* Mobile Phones (<= 640px) */
@media (max-width: 640px) {
  .app-header {
    padding: 0.35rem 0;
  }

  .header-inner {
    padding: 0 0.65rem;
    gap: 0.35rem;
  }

  .brand-logo-img img {
    height: 30px;
  }

  .brand-title {
    font-size: 0.84rem;
  }

  .brand-badge-v5 {
    font-size: 0.62rem;
    padding: 1px 5px;
  }

  .brand-subtitle {
    display: none;
  }

  .header-user-pill {
    padding: 2px 7px 2px 3px;
    gap: 5px;
  }

  .header-user-pill .role-badge {
    font-size: 0.62rem;
    padding: 2px 5px;
  }

  .header-user-pill .user-name {
    max-width: 65px;
    font-size: 0.72rem;
  }

  .nav-capsule-btn {
    padding: 6px 2px !important;
    font-size: 0.72rem !important;
    gap: 3px !important;
    border-radius: 6px !important;
  }

  .preset-select-pill {
    padding: 6px 14px 6px 4px !important;
    font-size: 0.71rem !important;
    border-radius: 6px !important;
  }

  .main-container {
    padding: 0 0.5rem;
    margin: 0.5rem auto;
    gap: 0.85rem;
  }

  .sidebar {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  .sidebar-card {
    padding: 0.85rem;
  }

  .card {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  .card-header {
    margin-bottom: 0.75rem;
  }

  .card-title {
    font-size: 1rem;
  }

  .card-subtitle {
    font-size: 0.75rem;
  }

  .form-grid-2,
  .form-grid-3 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* Prevent auto-zoom on iOS inputs by ensuring 16px minimum font size */
  .form-input,
  .form-select,
  select,
  input[type="text"],
  input[type="number"],
  input[type="date"],
  input[type="email"] {
    font-size: 16px !important;
    padding: 0.6rem 0.7rem;
  }

  .btn {
    min-height: 42px;
    padding: 0.55rem 0.85rem;
  }

  .wizard-footer {
    flex-direction: column;
    gap: 0.65rem;
  }

  .wizard-footer .btn {
    width: 100%;
    justify-content: center;
  }

  .a4-preview-paper {
    padding: 1.25rem 0.75rem;
    font-size: 0.8rem;
    max-height: 500px;
  }

  .preview-toolbar {
    flex-wrap: wrap;
    gap: 0.3rem;
    padding: 0.4rem;
  }

  .modal-card {
    padding: 1rem;
    width: 95%;
    max-width: 95vw;
    max-height: 92vh;
    border-radius: var(--radius-lg);
  }

  .contract-option-card {
    padding: 0.85rem !important;
  }
}

/* Print styling for legal contracts */
@media print {
  @page {
    size: A4;
    margin-top: 30mm;
    margin-bottom: 20mm;
    margin-left: 25mm;
    margin-right: 20mm;
  }
  body {
    background: white !important;
    color: black !important;
  }
  .sidebar, .topbar, .preview-notice, .preview-toolbar, .btn, button {
    display: none !important;
  }
  .a4-preview-paper {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }
}

.hidden-by-template {
  display: none !important;
}
