/* ========================================================
   JS DIGEST - MOBILE-APP ADMIN CONTROL CENTER
   Designed to look & feel like a Native Smartphone App
   ======================================================== */

:root {
  --bg-primary: #070a12;
  --bg-secondary: #0e1424;
  --bg-card: rgba(18, 25, 43, 0.92);
  --border-color: rgba(212, 175, 55, 0.22);
  --border-glow: rgba(212, 175, 55, 0.45);
  --gold-primary: #d4af37;
  --gold-light: #f3e5ab;
  --gold-gradient: linear-gradient(135deg, #fce08e 0%, #d4af37 50%, #997510 100%);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-sub: #cbd5e1;
  --font-heading: 'Cinzel', serif;
  --font-body: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  min-width: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  touch-action: manipulation;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  background: none;
  border: none;
  outline: none;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

input, select, textarea, a {
  touch-action: manipulation;
}

/* Utilities */
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }

/* LOGIN SCREEN */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.25rem;
  background: radial-gradient(circle at center, #151f38 0%, #070a12 100%);
}

.login-wrapper {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: var(--bg-card);
  border: 1.5px solid var(--border-glow);
  border-radius: var(--radius-lg);
  padding: clamp(1.75rem, 5vw, 2.75rem) clamp(1.25rem, 4vw, 2rem);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
}

.login-header {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid var(--gold-primary);
  margin-bottom: 0.75rem;
  box-shadow: 0 0 16px rgba(212, 175, 55, 0.4);
}

.login-header h2 {
  font-family: var(--font-heading);
  font-size: 1.55rem;
  color: #fff;
  letter-spacing: 1px;
}

.login-header p {
  color: var(--text-muted);
  font-size: 0.82rem;
}

.login-card .form-group {
  margin-bottom: 1.15rem;
}

.login-card label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.85rem 1rem;
  background: rgba(7, 10, 18, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 16px; /* Prevents auto-zoom on iOS */
  font-family: inherit;
  min-height: 48px;
  transition: border-color 0.2s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--gold-primary);
  box-shadow: 0 0 10px rgba(212, 175, 55, 0.25);
}

select.form-control option {
  background: #0e1424;
  color: #fff;
}

.login-footer {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
}

.login-footer a {
  color: var(--gold-light);
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.65rem;
}

.credential-tip {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.credential-tip code {
  background: rgba(255, 255, 255, 0.1);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  color: var(--gold-light);
}

/* APP HEADER */
.dashboard-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.admin-header {
  background: #090e1c;
  border-bottom: 1px solid var(--border-color);
  padding: 0.75rem clamp(1rem, 3vw, 2rem);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.admin-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--gold-primary);
}

.admin-brand h3 {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: #fff;
  letter-spacing: 0.8px;
  line-height: 1.1;
}

.admin-brand small {
  color: var(--gold-light);
  font-size: 0.65rem;
}

.admin-user-nav {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.06);
  min-height: 38px;
}

.nav-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.logout-btn {
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.22);
  color: #ef4444;
}

/* LAYOUT & SIDEBAR (Desktop) */
.dashboard-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  flex-grow: 1;
  min-height: calc(100vh - 60px);
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.admin-sidebar {
  background: #090e1c;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  padding: 1.25rem 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.side-tab {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  transition: 0.2s ease;
  min-height: 46px;
}

.side-tab:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.side-tab.active {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
  border-left: 3px solid var(--gold-primary);
}

.badge-count {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 0.72rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 700;
}

.badge-gold-sm {
  margin-left: auto;
  background: rgba(212, 175, 55, 0.25);
  color: var(--gold-light);
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-weight: 700;
  border: 1px solid rgba(212, 175, 55, 0.4);
}

.sidebar-support {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.82rem;
}

.sidebar-support strong {
  display: block;
  color: var(--gold-light);
  font-size: 0.92rem;
  margin-top: 0.2rem;
}

/* MAIN CONTENT */
.admin-main {
  padding: clamp(1rem, 3vw, 2.5rem);
  background: #070a12;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: block;
  animation: fadeIn 0.25s ease;
}

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

.pane-header {
  margin-bottom: 1.5rem;
}

.pane-header h2 {
  font-family: var(--font-heading);
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  color: #fff;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.pane-header p {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

/* CARDS */
.upload-card, .quotation-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: clamp(1.15rem, 3vw, 2.25rem);
  margin-bottom: 2rem;
}

/* DROPZONE */
.dropzone {
  position: relative;
  border: 2px dashed rgba(212, 175, 55, 0.45);
  border-radius: var(--radius-md);
  padding: clamp(1.75rem, 4vw, 2.5rem) 1rem;
  text-align: center;
  background: rgba(7, 10, 18, 0.6);
  cursor: pointer;
  margin-bottom: 1.25rem;
  transition: 0.2s ease;
}

.dropzone:hover {
  border-color: var(--gold-primary);
  background: rgba(212, 175, 55, 0.05);
}

.dropzone-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
  height: 100%;
}

.dropzone-icon {
  font-size: 2.75rem;
  color: var(--gold-primary);
  margin-bottom: 0.65rem;
}

.dropzone-content h4 {
  font-size: 1.05rem;
  color: #fff;
  margin-bottom: 0.25rem;
}

.dropzone-content p {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.dropzone-preview {
  position: relative;
  display: inline-block;
}

.dropzone-preview img {
  max-height: 220px;
  max-width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--gold-primary);
}

.remove-preview-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  background: rgba(239, 68, 68, 0.88);
  color: #fff;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
}

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

.form-group {
  margin-bottom: 1.15rem;
}

.form-group label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.alert-box {
  margin-top: 1rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
}

.alert-box.success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid #22c55e;
  color: #4ade80;
}

.alert-box.error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #f87171;
}

/* GALLERY GRID & CARDS */
.admin-gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.15rem;
}

.admin-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: 0.2s ease;
}

.admin-card:hover {
  border-color: var(--border-glow);
}

.admin-card-img {
  height: 170px;
  overflow: hidden;
  position: relative;
}

.admin-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-card-body {
  padding: 1.1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.admin-card-category {
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--gold-light);
  letter-spacing: 0.8px;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.admin-card-title {
  font-size: 0.98rem;
  color: #fff;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.admin-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  flex-grow: 1;
}

.admin-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.btn-edit {
  background: rgba(212, 175, 55, 0.15);
  border: 1px solid rgba(212, 175, 55, 0.4);
  color: var(--gold-light);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 42px;
  cursor: pointer;
}

.btn-edit:hover {
  background: var(--gold-primary);
  color: #000;
}

.btn-delete {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 42px;
  cursor: pointer;
}

.btn-delete:hover {
  background: #ef4444;
  color: #fff;
}

/* QUOTATION LINE ITEMS CONTAINER (RESPONSIVE CARDS) */
.quot-items-container {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1.5rem;
}

.quot-item-card {
  background: rgba(7, 10, 18, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color 0.2s ease;
}

.quot-item-card:hover {
  border-color: var(--border-glow);
}

.quot-card-row-top {
  width: 100%;
}

.quot-card-row-mid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.quot-card-row-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.item-amount-badge {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--gold-light);
}

.btn-remove-row {
  color: #f87171;
  background: rgba(239, 68, 68, 0.15);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  cursor: pointer;
  min-height: 38px;
}

.btn-remove-row:hover {
  background: #ef4444;
  color: #fff;
}

.quot-header-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quot-full-col {
  grid-column: 1 / -1;
}

.quot-section-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  color: #fff;
}

.quot-summary-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 1.25rem;
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.quot-totals-box {
  background: rgba(7, 10, 18, 0.75);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: var(--radius-sm);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.92rem;
}

.total-row strong {
  font-size: 1.05rem;
}

.total-row.grand-total {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0;
  font-size: 1.1rem;
}

.total-row.grand-total strong {
  font-size: 1.35rem;
}

.total-row.balance-due {
  color: #f87171;
}

.total-input {
  width: 130px;
  text-align: right;
  min-height: 40px;
}

.quot-actions-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.past-quotations-section {
  margin-top: 2.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.75rem;
}

/* SAVED QUOTATIONS & INQUIRIES CARDS */
.saved-quot-cards-container, .inquiries-cards-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.saved-quot-card, .inquiry-card {
  background: var(--bg-card);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: border-color 0.2s ease;
}

.saved-quot-card:hover, .inquiry-card:hover {
  border-color: var(--border-glow);
}

.card-top-flex {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fff;
}

.card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.card-details-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--text-sub);
}

.card-actions-flex {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* SETTINGS CARDS */
.settings-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
}

.setting-card {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: clamp(1.25rem, 2.5vw, 1.75rem);
}

.security-card {
  border-color: rgba(212, 175, 55, 0.5);
  box-shadow: 0 4px 20px rgba(212, 175, 55, 0.15);
}

.setting-card h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  color: #fff;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.setting-card p {
  color: var(--text-muted);
  font-size: 0.86rem;
  margin-bottom: 0.5rem;
}

.setting-card strong {
  color: #fff;
}

.badge-status {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.card-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 1rem 0;
}

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
  border: none;
  min-height: 48px; /* Native tap target */
}

.btn-gold {
  background: var(--gold-gradient);
  color: #070a12;
}

.btn-gold:hover {
  opacity: 0.92;
  transform: translateY(-2px);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-outline:hover {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-light);
}

.btn-whatsapp {
  background: #25d366;
  color: #fff;
}

.btn-whatsapp:hover {
  background: #20ba59;
}

.btn-full {
  width: 100%;
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.82rem;
  min-height: 38px;
}

.btn-lg {
  padding: 0.85rem 1.5rem;
  font-size: 0.98rem;
}

.text-gold {
  color: var(--gold-primary);
}

/* FIXED NATIVE MOBILE BOTTOM APP BAR */
.mobile-app-bottom-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  width: 100%;
  max-width: 100vw;
  z-index: 9999;
  background: rgba(9, 14, 28, 0.98);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-glow);
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 0.35rem 0.15rem calc(0.45rem + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -6px 30px rgba(0, 0, 0, 0.8);
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

.app-tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.35rem 0.1rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 500;
  position: relative;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 50px;
  background: none;
  border: none;
  outline: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-tab-btn:active {
  transform: scale(0.92);
  background: rgba(255, 255, 255, 0.05);
}

.app-tab-btn i {
  font-size: 1.25rem;
  transition: transform 0.2s ease, color 0.2s ease;
}

.app-tab-btn.active {
  color: #fff;
  font-weight: 700;
}

.app-tab-btn.active i {
  color: var(--gold-primary);
  transform: translateY(-2px);
  filter: drop-shadow(0 2px 6px rgba(212, 175, 55, 0.6));
}

.app-tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: 1px;
  width: 16px;
  height: 3px;
  background: var(--gold-primary);
  border-radius: 9999px;
  box-shadow: 0 0 8px var(--gold-primary);
}

.app-badge {
  position: absolute;
  top: 0.2rem;
  right: 20%;
  background: #ef4444;
  color: #fff;
  font-size: 0.65rem;
  padding: 0.1rem 0.38rem;
  border-radius: 9999px;
  font-weight: 700;
}

/* EDIT MODAL */
.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.admin-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
}

.admin-modal-content {
  position: relative;
  z-index: 2;
  background: #0e1424;
  border: 1.5px solid var(--border-glow);
  border-radius: var(--radius-md);
  padding: clamp(1.25rem, 3vw, 2rem);
  max-width: 94vw;
  width: 520px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.85);
  box-sizing: border-box;
}

.admin-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.admin-modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: #fff;
}

.modal-close-btn {
  font-size: 1.25rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

/* PRINT LETTERHEAD MODAL & RESPONSIVE PDF PREVIEW */
.print-modal-container {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: #090e1c;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.75rem 0.5rem 2rem;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}

.print-actions-bar {
  max-width: 800px;
  width: 100%;
  margin: 0 auto 0.75rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(9, 14, 28, 0.96);
  backdrop-filter: blur(12px);
  padding: 0.5rem 0;
}

.print-paper {
  max-width: 800px;
  width: 100%;
  margin: 0 auto;
  background: #ffffff;
  color: #111827;
  padding: clamp(1rem, 3.5vw, 2.75rem);
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
}

/* Paper Header */
.paper-header {
  border-bottom: 2px solid var(--gold-primary);
  padding-bottom: 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.paper-brand-block {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.paper-logo {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid var(--gold-primary);
  flex-shrink: 0;
}

.paper-brand-text h1 {
  font-family: var(--font-heading);
  margin: 0;
  font-size: 1.6rem;
  color: #0e1424;
  letter-spacing: 1px;
  line-height: 1.1;
}

.paper-tagline {
  margin: 2px 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #aa820a;
  letter-spacing: 0.5px;
}

.paper-motto {
  color: #555;
  font-style: italic;
  font-size: 0.72rem;
  display: block;
  line-height: 1.3;
}

.paper-contact-block {
  text-align: right;
  font-size: 0.82rem;
  color: #333;
  line-height: 1.45;
  flex-shrink: 0;
}

/* Info Box */
.paper-info-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.info-client h4 {
  margin: 0 0 0.25rem 0;
  color: #0e1424;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.8px;
}

.client-name {
  font-size: 1.1rem;
  color: #0e1424;
  display: block;
}

.info-client p {
  margin: 2px 0;
  font-size: 0.85rem;
  color: #475569;
}

.info-meta {
  text-align: right;
  flex-shrink: 0;
}

.info-meta h3 {
  margin: 0;
  color: #aa820a;
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.info-meta p {
  margin: 3px 0;
  font-size: 0.84rem;
  color: #64748b;
}

/* Line Items Table */
.paper-table-wrapper {
  width: 100%;
  margin-bottom: 1.25rem;
  box-sizing: border-box;
}

.paper-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  table-layout: fixed;
}

.paper-table th {
  background: #0e1424;
  color: #fff;
  padding: 8px 10px;
  border: 1px solid #0e1424;
}

.paper-table td {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  vertical-align: middle;
}

.paper-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

.paper-table .col-num {
  width: 7%;
  text-align: center;
}

.paper-table .col-desc {
  width: 48%;
  text-align: left;
  word-break: break-word;
}

.paper-table .col-area {
  width: 15%;
  text-align: right;
  white-space: nowrap;
}

.paper-table .col-rate {
  width: 14%;
  text-align: right;
  white-space: nowrap;
}

.paper-table .col-total {
  width: 16%;
  text-align: right;
  font-weight: 700;
  white-space: nowrap;
}

/* Summary Box */
.paper-summary-box {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-top: 1.25rem;
  margin-bottom: 1.5rem;
  gap: 1.25rem;
}

.summary-terms {
  flex: 1;
  font-size: 0.8rem;
  color: #475569;
  line-height: 1.5;
}

.summary-terms strong {
  color: #0e1424;
  display: block;
  margin-bottom: 0.25rem;
}

.summary-terms p {
  white-space: pre-line;
  margin: 0;
}

.summary-totals {
  width: 280px;
  flex-shrink: 0;
}

.totals-card {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.85rem;
  background: #f8fafc;
  font-size: 0.88rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.text-discount {
  color: #16a34a;
}

.tot-grand {
  border-top: 2px solid #0e1424;
  margin-top: 4px;
  padding-top: 6px;
  font-size: 1.15rem;
  color: #aa820a;
}

.tot-balance {
  font-weight: 700;
  color: #dc2626;
  border-top: 1px dashed #cbd5e1;
  padding-top: 4px;
}

/* Footer */
.paper-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px dashed #cbd5e1;
  gap: 1rem;
}

.footer-motto {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.4;
}

.footer-motto p {
  margin: 0 0 2px 0;
  font-weight: 600;
}

.footer-sig {
  text-align: center;
  flex-shrink: 0;
}

.sig-line {
  width: 150px;
  border-bottom: 1.5px solid #0e1424;
  margin-bottom: 6px;
}

.footer-sig strong {
  font-size: 0.85rem;
  color: #0e1424;
  display: block;
}

.footer-sig small {
  color: #64748b;
  font-size: 0.75rem;
  display: block;
}

/* Mobile Screens (< 600px) Responsive Rules for Letterhead / PDF */
@media (max-width: 600px) {
  .print-modal-container {
    padding: 0.5rem 0.35rem 1.5rem;
  }
  .print-actions-bar {
    gap: 0.35rem;
  }
  .print-actions-bar .btn {
    flex: 1;
    padding: 0.45rem 0.25rem;
    font-size: 0.76rem;
    min-height: 42px;
  }
  .print-paper {
    padding: 0.85rem 0.65rem;
    border-radius: 8px;
  }
  .paper-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding-bottom: 0.75rem;
  }
  .paper-brand-block {
    gap: 0.65rem;
  }
  .paper-logo {
    width: 48px;
    height: 48px;
  }
  .paper-brand-text h1 {
    font-size: 1.35rem;
  }
  .paper-tagline {
    font-size: 0.75rem;
  }
  .paper-motto {
    font-size: 0.68rem;
  }
  .paper-contact-block {
    text-align: left;
    font-size: 0.76rem;
    width: 100%;
    padding-top: 0.5rem;
    border-top: 1px dashed #e2e8f0;
  }
  .paper-info-box {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
  }
  .info-meta {
    text-align: left;
    width: 100%;
    padding-top: 0.5rem;
    border-top: 1px dashed #e2e8f0;
  }
  .info-meta h3 {
    font-size: 1rem;
  }
  .paper-table {
    font-size: 0.76rem;
  }
  .paper-table th, .paper-table td {
    padding: 6px 4px !important;
  }
  .paper-table .col-num {
    width: 7%;
  }
  .paper-table .col-desc {
    width: 47%;
  }
  .paper-table .col-area {
    width: 16%;
  }
  .paper-table .col-rate {
    width: 14%;
  }
  .paper-table .col-total {
    width: 16%;
  }
  .paper-summary-box {
    flex-direction: column-reverse; /* Totals shown first on mobile */
    gap: 1rem;
    margin-top: 1rem;
  }
  .summary-totals {
    width: 100%;
  }
  .summary-terms {
    width: 100%;
    font-size: 0.75rem;
  }
  .paper-footer {
    flex-direction: column-reverse;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    margin-top: 1.5rem;
  }
  .footer-sig {
    margin: 0 auto;
  }
}

/* Native Print & Save PDF Styles (A4 Standard) */
@media print {
  @page {
    size: A4 portrait;
    margin: 8mm 10mm;
  }

  /* CRITICAL: Explicitly hide the entire dashboard layout, header, bottom bar, and normal DOM
     Using display: none ensures the browser does NOT reserve empty vertical space (which creates blank pages on top) */
  .admin-header,
  .dashboard-layout,
  .mobile-app-bottom-bar,
  .admin-modal,
  .no-print {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;
  }

  html, body {
    background: #fff !important;
    color: #000 !important;
    font-size: 11pt !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .print-modal-container {
    position: static !important;
    display: block !important;
    background: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    width: 100% !important;
    height: auto !important;
  }

  .print-paper {
    box-shadow: none !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
    overflow: visible !important;
  }
  .paper-header {
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
  }
  .paper-contact-block {
    text-align: right !important;
    border-top: none !important;
    padding-top: 0 !important;
    width: auto !important;
  }
  .paper-info-box {
    flex-direction: row !important;
    justify-content: space-between !important;
  }
  .info-meta {
    text-align: right !important;
    border-top: none !important;
    padding-top: 0 !important;
    width: auto !important;
  }
  .paper-summary-box {
    flex-direction: row !important;
    justify-content: space-between !important;
  }
  .summary-totals {
    width: 280px !important;
  }
  .paper-footer {
    flex-direction: row !important;
    justify-content: space-between !important;
    text-align: left !important;
  }
  table {
    page-break-inside: auto;
  }
  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }
}

/* ========================================================
   RESPONSIVE BREAKPOINTS (Mobile App Transformation)
   ======================================================== */

@media (max-width: 900px) {
  .d-none-mobile {
    display: none !important;
  }

  .dashboard-layout {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .admin-main {
    padding: 0.85rem 0.85rem calc(88px + env(safe-area-inset-bottom, 0px)) 0.85rem;
    min-width: 0;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  .mobile-app-bottom-bar {
    display: grid;
  }

  .upload-card, .quotation-card, .setting-card, .admin-card, .saved-quot-card, .inquiry-card {
    padding: 1.1rem 0.95rem;
    border-radius: 16px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .admin-gallery-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .settings-cards-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .saved-quot-cards-container, .inquiries-cards-container {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .quot-header-grid {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .quot-summary-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

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

  .quot-actions-bar {
    flex-direction: column;
    gap: 0.65rem;
  }

  .quot-actions-bar .btn {
    width: 100%;
  }

  .pane-header h2 {
    font-size: 1.3rem;
  }

  .pane-header p {
    font-size: 0.82rem;
  }

  .total-input {
    width: 110px;
    max-width: 45%;
  }
}
