/* ═══════════════════════════════════════════════════════
   SDR Invisible Grills – Mobile App UI v2
   Mobile-first · App-like · Premium Green & Gold
   ═══════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700;800;900&family=Poppins:wght@300;400;500;600&display=swap');

:root {
  --green:        #004540;
  --green-deep:   #002e2a;
  --green-mid:    #005c55;
  --green-light:  #e6f4f1;
  --green-pale:   #f0faf8;
  --gold:         #FFE175;
  --gold-dark:    #c9a800;
  --gold-mid:     #f5d44e;
  --gold-soft:    #fffbeb;
  --white:        #ffffff;
  --bg:           #f2f7f6;
  --surface:      #ffffff;
  --text:         #111827;
  --text-2:       #374151;
  --muted:        #6b7280;
  --border:       #e0ebe9;
  --danger:       #ef4444;
  --danger-soft:  #fef2f2;
  --success:      #16a34a;
  --success-soft: #f0fdf4;
  --warning:      #f59e0b;
  --radius-sm:    8px;
  --radius:       14px;
  --radius-lg:    20px;
  --radius-xl:    28px;
  --shadow-sm:    0 2px 8px rgba(0,69,64,.08);
  --shadow:       0 4px 20px rgba(0,69,64,.12);
  --shadow-lg:    0 8px 40px rgba(0,69,64,.18);
  --nav-h:        70px;
  --top-h:        60px;
  --anim:         .22s cubic-bezier(.4,0,.2,1);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; }

/* ── App Shell ── */
.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  background: var(--bg);
}

/* ── Top Bar ── */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--top-h);
  background: var(--green);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.top-bar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.top-bar-brand .brand-name {
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  font-size: 15px;
  color: #fff;
  line-height: 1.1;
}
.top-bar-brand .brand-name span { color: var(--gold); }
.top-bar-brand .brand-sub {
  font-size: 8.5px;
  color: rgba(255,255,255,.55);
  letter-spacing: 1.8px;
  text-transform: uppercase;
}
.top-bar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: none;
  background: rgba(255,255,255,.12);
  color: #fff;
  font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background var(--anim);
  text-decoration: none;
}
.icon-btn:hover, .icon-btn:active { background: rgba(255,255,255,.22); }
.icon-btn.gold { background: var(--gold); color: var(--green); }

/* Back button top bar variant */
.top-bar-back {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none;
  color: rgba(255,255,255,.85);
  font-size: 14px; font-weight: 500;
  cursor: pointer; padding: 0;
  text-decoration: none;
}
.top-bar-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 15px; font-weight: 700;
  color: #fff;
}

/* ── Scroll Content ── */
.scroll-content {
  padding: 16px 16px calc(var(--nav-h) + 24px);
  min-height: calc(100vh - var(--top-h));
}
.scroll-content.no-nav { padding-bottom: 24px; }

/* ── Bottom Nav ── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  height: var(--nav-h);
  background: var(--white);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 20px rgba(0,0,0,.08);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  cursor: pointer;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .3px;
  text-transform: uppercase;
  text-decoration: none;
  transition: color var(--anim);
  position: relative;
  padding-top: 4px;
}
.nav-item .nav-icon { font-size: 22px; transition: transform var(--anim); }
.nav-item.active { color: var(--green); }
.nav-item.active .nav-icon { transform: scale(1.15); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0; left: 20%; right: 20%;
  height: 3px;
  background: var(--green);
  border-radius: 0 0 4px 4px;
}
/* FAB-style center nav button */
.nav-item.fab-nav {
  color: var(--white);
}
.nav-item.fab-nav .nav-icon-wrap {
  width: 50px; height: 50px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--green-mid), var(--green));
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 16px rgba(0,69,64,.35);
  margin-top: -8px;
  transition: transform var(--anim), box-shadow var(--anim);
}
.nav-item.fab-nav:active .nav-icon-wrap { transform: scale(.94); box-shadow: 0 2px 8px rgba(0,69,64,.2); }
.nav-item.fab-nav span.nav-lbl { color: var(--green); }

/* ── Hero Header Card (Dashboard) ── */
.hero-card {
  background: linear-gradient(135deg, var(--green-deep) 0%, var(--green) 60%, var(--green-mid) 100%);
  border-radius: var(--radius-xl);
  padding: 22px 20px 28px;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.hero-card::before {
  content: '';
  position: absolute;
  top: -30px; right: -30px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(255,225,117,.08);
}
.hero-card::after {
  content: '';
  position: absolute;
  bottom: -40px; left: -20px;
  width: 120px; height: 120px;
  border-radius: 50%;
  background: rgba(255,255,255,.04);
}
.hero-greeting {
  font-size: 12px;
  color: rgba(255,255,255,.6);
  font-weight: 400;
  margin-bottom: 4px;
  letter-spacing: .3px;
}
.hero-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 2px;
  line-height: 1.2;
}
.hero-title span { color: var(--gold); }
.hero-sub {
  font-size: 11px;
  color: rgba(255,255,255,.5);
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.hero-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  position: relative; z-index: 1;
}
.hero-stat {
  background: rgba(255,255,255,.1);
  backdrop-filter: blur(10px);
  border-radius: var(--radius);
  padding: 13px 14px;
  border: 1px solid rgba(255,255,255,.12);
}
.hero-stat .sv {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px; font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.hero-stat .sl {
  font-size: 10px;
  color: rgba(255,255,255,.6);
  margin-top: 3px;
  font-weight: 400;
}

/* ── Section Label ── */
.section-label {
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 20px 0 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.section-label a { color: var(--green); font-size: 11px; font-weight: 600; font-family: 'Poppins', sans-serif; text-transform: none; letter-spacing: 0; }

/* ── Quote Card (list) ── */
.quote-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: box-shadow var(--anim), transform var(--anim);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}
.quote-card:active { transform: scale(.98); box-shadow: none; }
.quote-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.quote-card.status-Draft::before     { background: var(--muted); }
.quote-card.status-Sent::before      { background: #3b82f6; }
.quote-card.status-Accepted::before  { background: var(--success); }
.quote-card.status-Rejected::before  { background: var(--danger); }

.qc-avatar {
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
  font-family: 'Montserrat', sans-serif;
  font-weight: 800;
  color: var(--green);
  font-size: 16px;
}
.qc-body { flex: 1; min-width: 0; }
.qc-name {
  font-weight: 600; font-size: 14px;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.qc-no { font-size: 11px; color: var(--muted); margin-top: 1px; }
.qc-right { text-align: right; flex-shrink: 0; }
.qc-amount {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px; font-weight: 700;
  color: var(--green);
}
.qc-date { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* ── Status Badge ── */
.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.badge-Draft    { background: #f3f4f6; color: #6b7280; }
.badge-Sent     { background: #dbeafe; color: #1d4ed8; }
.badge-Accepted { background: #dcfce7; color: #15803d; }
.badge-Rejected { background: #fee2e2; color: #dc2626; }

/* ── Stat Row (mini) ── */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 6px;
}
.mini-stat {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 10px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.mini-stat .ms-val {
  font-family: 'Montserrat', sans-serif;
  font-size: 20px; font-weight: 800;
  color: var(--green);
}
.mini-stat .ms-lbl { font-size: 9.5px; color: var(--muted); margin-top: 2px; font-weight: 500; }

/* ── Form Styles (App) ── */
.form-card {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
}
.form-card-header {
  background: var(--green-light);
  padding: 12px 16px;
  font-family: 'Montserrat', sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--green);
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border);
}
.form-card-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--muted);
  text-transform: uppercase;
}
.field-group input,
.field-group select,
.field-group textarea {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--white);
  outline: none;
  transition: border-color var(--anim), box-shadow var(--anim);
  -webkit-appearance: none;
  appearance: none;
}
.field-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236b7280' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}
.field-group input:focus,
.field-group select:focus,
.field-group textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,69,64,.1);
}
.field-group textarea { resize: vertical; min-height: 80px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Item Row (service table mobile) ── */
.item-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
  position: relative;
}
.item-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.item-num {
  font-family: 'Montserrat', sans-serif;
  font-size: 13px;
  font-weight: 800;
  color: var(--green);
  background: var(--green-light);
  width: 32px; height: 32px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
}
.item-total-display {
  font-family: 'Montserrat', sans-serif;
  font-size: 15px; font-weight: 700;
  color: var(--green);
}
.item-del-btn {
  width: 32px; height: 32px;
  border-radius: 9px;
  border: none;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--anim);
}
.item-del-btn:active { background: var(--danger); color: #fff; }

/* ── Totals Summary Card ── */
.totals-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.total-row:last-child { border: none; }
.total-row .lbl { color: var(--muted); font-weight: 500; }
.total-row .amt { font-weight: 600; color: var(--text); }
.total-row.gst { background: var(--gold-soft); }
.total-row.grand {
  background: var(--green);
  padding: 14px 16px;
}
.total-row.grand .lbl { color: var(--gold); font-family: 'Montserrat', sans-serif; font-weight: 700; font-size: 13px; }
.total-row.grand .amt { color: var(--gold); font-family: 'Montserrat', sans-serif; font-weight: 900; font-size: 18px; }

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 14px 22px;
  border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600;
  cursor: pointer; border: none;
  text-decoration: none;
  transition: opacity var(--anim), transform var(--anim);
  line-height: 1;
  -webkit-appearance: none;
}
.btn:active { opacity: .85; transform: scale(.97); }
.btn-primary { background: var(--green); color: var(--gold); }
.btn-gold    { background: var(--gold); color: var(--green); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--green);
  color: var(--green);
}
.btn-danger  { background: var(--danger-soft); color: var(--danger); border: 1px solid #fca5a5; }
.btn-ghost   { background: rgba(0,69,64,.08); color: var(--green); }
.btn-full    { width: 100%; }
.btn-sm      { padding: 9px 16px; font-size: 12px; }

/* ── Floating Action Button ── */
.fab {
  position: fixed;
  bottom: calc(var(--nav-h) + 16px);
  right: 18px;
  width: 56px; height: 56px;
  border-radius: 18px;
  background: var(--gold);
  color: var(--green);
  font-size: 26px;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 24px rgba(0,69,64,.3);
  cursor: pointer;
  border: none;
  z-index: 150;
  text-decoration: none;
  transition: transform var(--anim), box-shadow var(--anim);
}
.fab:active { transform: scale(.92); }

/* ── Search Bar ── */
.search-wrap {
  position: relative;
  margin-bottom: 14px;
}
.search-wrap input {
  width: 100%;
  padding: 13px 16px 13px 44px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  background: var(--surface);
  outline: none;
  transition: border-color var(--anim);
}
.search-wrap input:focus { border-color: var(--green); }
.search-wrap .search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 18px; color: var(--muted);
  pointer-events: none;
}

/* ── Filter Pills ── */
.filter-pills {
  display: flex; gap: 8px; overflow-x: auto;
  padding-bottom: 4px; margin-bottom: 14px;
  scrollbar-width: none;
}
.filter-pills::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: all var(--anim);
}
.pill.active {
  background: var(--green);
  color: var(--gold);
  border-color: var(--green);
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 60px 20px 40px;
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 16px; }
.empty-state h3 { font-size: 17px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.empty-state p { font-size: 13px; color: var(--muted); line-height: 1.6; }

/* ── Alert ── */
.alert {
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
  border-left: 3px solid;
  display: flex; align-items: center; gap: 10px;
}
.alert-success { background: var(--success-soft); color: var(--success); border-color: var(--success); }
.alert-error   { background: var(--danger-soft);  color: var(--danger);  border-color: var(--danger); }
.alert-info    { background: #dbeafe; color: #1d4ed8; border-color: #1d4ed8; }

/* ── Quote Action Sheet ── */
.action-sheet-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 300;
  align-items: flex-end;
  justify-content: center;
}
.action-sheet-overlay.open { display: flex; }
.action-sheet {
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%; max-width: 480px;
  padding: 12px 20px calc(20px + env(safe-area-inset-bottom,0px));
  animation: slideUp .25s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 18px;
}
.sheet-title {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px; font-weight: 700;
  color: var(--text); margin-bottom: 4px;
}
.sheet-sub { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.sheet-action {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  font-size: 15px; font-weight: 500;
  transition: background var(--anim);
  border-radius: var(--radius-sm);
}
.sheet-action:last-child { border: none; }
.sheet-action:active { background: var(--bg); }
.sheet-action .sa-icon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.sa-view   .sa-icon { background: #dbeafe; }
.sa-edit   .sa-icon { background: var(--green-light); }
.sa-delete .sa-icon { background: var(--danger-soft); }
.sa-delete { color: var(--danger); }
.sa-share  .sa-icon { background: var(--gold-soft); }

/* ── Settings List ── */
.settings-list { display: flex; flex-direction: column; gap: 2px; }
.setting-item {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--anim);
}
.setting-item:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.setting-item:last-child  { border-radius: 0 0 var(--radius) var(--radius); border: none; }
.setting-item:active { background: var(--bg); }
.setting-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--green-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.setting-label { flex: 1; font-size: 14px; font-weight: 500; }
.setting-arrow { color: var(--muted); font-size: 16px; }

/* ── View Page (print quotation) ── */
.print-bar {
  background: var(--green);
  padding: 12px 16px;
  display: flex; gap: 10px; align-items: center;
  position: sticky; top: 0; z-index: 50;
}
.print-bar a, .print-bar button {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  text-decoration: none;
  transition: opacity var(--anim);
}
.pb-back { background: rgba(255,255,255,.12); color: #fff; }
.pb-print { background: var(--gold); color: var(--green); margin-left: auto; }
.pb-edit  { background: rgba(255,255,255,.12); color: #fff; }

/* Desktop upgrade — keep it readable on big screens too */
@media (min-width: 520px) {
  .app-shell { box-shadow: 0 0 60px rgba(0,0,0,.1); }
  .bottom-nav { border-radius: 0; }
}

/* Safe area for notch phones */
@media (max-width: 480px) {
  .scroll-content { padding-left: 14px; padding-right: 14px; }
}

/* ═══════════════════════════════════════════════════
   GLOBAL PRINT SAFETY NET
   Kills all app UI when printing from any page.
   view.php has its own deeper rules for the A4 doc.
   ═══════════════════════════════════════════════════ */
@media print {
  @page { size: A4 portrait; margin: 0mm; }

  .bottom-nav,
  #bottomNav,
  .top-bar,
  .nav-item,
  .fab-nav,
  .nav-icon-wrap {
    display: none !important;
    visibility: hidden !important;
    position: static !important;
    height: 0 !important;
    overflow: hidden !important;
  }
}
