:root {
  --navy: #071f38;
  --navy-2: #0b2d4f;
  --saffron: #f6ad00;
  --saffron-2: #ffca3a;
  --cream: #faf7f0;
  --paper: #ffffff;
  --ink: #122235;
  --muted: #687789;
  --line: #dfe6ec;
  --green: #137a52;
  --red: #b42318;
  --blue: #1769aa;
  --shadow: 0 18px 55px rgba(7,31,56,.12);
  --radius: 20px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--cream); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; line-height: 1.55; }
a { color: inherit; }
img { max-width: 100%; }
h1,h2,h3,p { margin-top: 0; }
h1 { font-size: clamp(2rem, 4vw, 3.6rem); line-height: 1.04; letter-spacing: -.045em; }
h2 { font-size: clamp(1.45rem, 2.5vw, 2.2rem); line-height: 1.15; letter-spacing: -.025em; }
h3 { font-size: 1.08rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.eyebrow { color: #9b6500; font-size: .75rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }

.app-header { min-height: 72px; padding: 12px max(20px, calc((100vw - 1180px)/2)); display: flex; align-items: center; justify-content: space-between; gap: 18px; background: var(--navy); color: white; border-bottom: 3px solid var(--saffron); }
.brand-small { display: flex; align-items: center; background: white; border-radius: 12px; padding: 5px 9px; height: 46px; }
.brand-small img { width: 125px; max-height: 36px; object-fit: contain; }
.header-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.header-link { color: white; text-decoration: none; font-size: .9rem; font-weight: 700; }
.header-link:hover { color: var(--saffron-2); }
.user-chip { font-size: .85rem; background: rgba(255,255,255,.1); padding: 7px 11px; border-radius: 999px; }

.flash { width: min(1120px, calc(100% - 32px)); margin: 14px auto 0; border-radius: 12px; padding: 12px 15px; font-weight: 700; }
.flash-success { background: #dff7eb; color: #075f3d; border: 1px solid #9edcbd; }
.flash-error { background: #fff0ed; color: #8f1d14; border: 1px solid #f4b7ae; }

.public-nav { position: absolute; z-index: 2; inset: 0 0 auto; display: flex; align-items: center; justify-content: space-between; width: min(1180px, calc(100% - 32px)); margin: 18px auto; }
.public-nav img { width: 164px; background: white; border-radius: 14px; padding: 8px 10px; }
.public-links { display: flex; gap: 10px; }
.hero { min-height: 690px; display: grid; align-items: center; color: white; background: radial-gradient(circle at 78% 20%, #174e78 0, transparent 33%), linear-gradient(135deg, #061a30 0%, #092a48 60%, #0d3a61 100%); padding: 110px 0 64px; overflow: hidden; }
.hero-grid { display: grid; grid-template-columns: 1.15fr .85fr; align-items: center; gap: 70px; }
.hero h1 span { color: var(--saffron-2); }
.hero p { color: #cedbe7; font-size: 1.12rem; max-width: 680px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.hero-card { position: relative; background: white; color: var(--ink); padding: 26px; border-radius: 28px; box-shadow: 0 28px 80px rgba(0,0,0,.27); transform: rotate(1.5deg); }
.hero-card:before { content: ""; position: absolute; width: 82px; height: 82px; right: -24px; top: -24px; border-radius: 24px; background: var(--saffron); z-index: -1; transform: rotate(8deg); }
.phone-demo { border: 8px solid #0c2033; border-radius: 28px; padding: 24px 18px; background: #fff; }
.phone-demo .demo-row { display: flex; gap: 12px; align-items: center; margin: 14px 0; padding: 12px; border-radius: 14px; background: #f2f5f7; }
.demo-dot { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--saffron); color: var(--navy); font-weight: 900; }
.section { padding: 80px 0; }
.section-white { background: white; }
.section-head { max-width: 720px; margin-bottom: 36px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.feature-card { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 25px; box-shadow: 0 8px 26px rgba(7,31,56,.05); }
.feature-card .number { width: 42px; height: 42px; display: grid; place-items: center; background: #fff1c7; border-radius: 12px; font-weight: 900; color: #855800; margin-bottom: 18px; }
.cta-band { margin: 70px auto; border-radius: 28px; color: white; padding: 42px; background: linear-gradient(135deg, var(--navy), var(--navy-2)); display: flex; align-items: center; justify-content: space-between; gap: 28px; }
.cta-band p { color: #cbd7e2; margin-bottom: 0; }
.site-footer { background: #041525; color: #afc0cf; text-align: center; padding: 25px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 11px; min-height: 44px; padding: 10px 17px; font: inherit; font-size: .92rem; font-weight: 800; text-decoration: none; cursor: pointer; transition: .18s ease; }
.btn:hover { transform: translateY(-1px); filter: brightness(.98); }
.btn-primary { color: #1b2200; background: linear-gradient(135deg, var(--saffron-2), var(--saffron)); box-shadow: 0 8px 20px rgba(246,173,0,.22); }
.btn-secondary { color: white; background: var(--navy-2); }
.btn-outline { color: inherit; background: transparent; border: 1px solid currentColor; }
.btn-white { background: white; color: var(--navy); }
.btn-danger { background: #fff0ed; color: var(--red); border: 1px solid #facbc4; }
.btn-small { min-height: 34px; padding: 6px 10px; font-size: .8rem; border-radius: 8px; }
.btn-block { width: 100%; }
.whatsapp { background: #1f9d61; color: white; }

.auth-page,.join-page { min-height: 100vh; display: grid; place-items: center; padding: 34px 16px; background: radial-gradient(circle at 15% 10%, #fff6dc 0, transparent 30%), radial-gradient(circle at 90% 90%, #dbeaf4 0, transparent 28%), var(--cream); }
.auth-card,.join-card,.center-card { width: min(100%, 530px); background: white; border-radius: 24px; box-shadow: var(--shadow); overflow: hidden; border: 1px solid rgba(7,31,56,.09); }
.auth-head,.join-head { padding: 34px 34px 24px; color: white; background: linear-gradient(145deg, #061b31, #0e3b62); text-align: center; }
.auth-head h1,.join-head h1 { font-size: 2rem; margin-bottom: 10px; }
.auth-head p,.join-head p { color: #d2dfea; }
.logo-box { display: inline-flex; padding: 7px 10px; background: white; border-radius: 12px; margin-bottom: 18px; }
.logo-box img { width: 164px; height: 42px; object-fit: contain; }
.auth-body,.join-body { padding: 30px 34px 34px; }
.center-card { padding: 40px; text-align: center; }
.success-icon { width: 64px; height: 64px; margin: 0 auto 15px; display: grid; place-items: center; color: white; background: var(--green); border-radius: 50%; font-size: 2rem; font-weight: 900; }
.summary-box { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 24px 0; }
.summary-box div { background: #f3f6f8; padding: 15px; border-radius: 13px; }
.summary-box span { display: block; font-size: .75rem; color: var(--muted); margin-bottom: 4px; }

.form-grid { display: grid; gap: 17px; }
.form-grid.two-col { grid-template-columns: 1fr 1fr; }
.form-grid .span-2 { grid-column: 1 / -1; }
label { display: grid; gap: 7px; font-size: .86rem; color: #35465a; font-weight: 800; }
input,select,textarea { width: 100%; border: 1px solid #cbd6df; border-radius: 10px; padding: 11px 12px; color: var(--ink); background: white; font: inherit; outline: none; }
input:focus,select:focus,textarea:focus { border-color: #1775ac; box-shadow: 0 0 0 3px rgba(23,117,172,.12); }
textarea { min-height: 92px; resize: vertical; }
.phone-field { display: flex; align-items: stretch; }
.phone-field span { display: grid; place-items: center; padding: 0 11px; background: #eff3f6; border: 1px solid #cbd6df; border-right: 0; border-radius: 10px 0 0 10px; }
.phone-field input { border-radius: 0 10px 10px 0; }
.consent-box { display: grid; grid-template-columns: auto 1fr; align-items: start; background: #f3f6f8; padding: 13px; border-radius: 11px; font-weight: 500; }
.consent-box input { width: 18px; height: 18px; margin-top: 2px; }
.form-note { margin: -4px 0 0; text-align: center; color: var(--muted); font-size: .75rem; }
.alert { padding: 11px 13px; border-radius: 10px; font-size: .88rem; margin-bottom: 12px; }
.alert-error { background: #fff0ed; color: #8f1d14; border: 1px solid #f4b7ae; }
.alert-success { background: #e8f7ef; color: #075f3d; border: 1px solid #b5e2cb; }

.dashboard { width: min(1180px, calc(100% - 32px)); margin: 32px auto 70px; }
.dash-title { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 24px; }
.dash-title h1 { font-size: 2.1rem; margin-bottom: 6px; }
.panel { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: 0 8px 28px rgba(7,31,56,.05); margin-bottom: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h2,.panel-head h3 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 22px; }
.stat { background: white; border: 1px solid var(--line); border-radius: 17px; padding: 18px; }
.stat span { display: block; color: var(--muted); font-size: .8rem; font-weight: 750; margin-bottom: 7px; }
.stat strong { font-size: 1.8rem; line-height: 1; }
.stat.due { border-left: 5px solid var(--saffron); }
.stat.green { border-left: 5px solid var(--green); }
.stat.blue { border-left: 5px solid var(--blue); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter { text-decoration: none; padding: 7px 11px; border-radius: 999px; font-weight: 750; font-size: .8rem; color: #536476; background: #edf2f5; }
.filter.active { background: var(--navy); color: white; }
.search-row { display: flex; gap: 10px; margin: 14px 0 20px; }
.search-row input { max-width: 360px; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; }
table { border-collapse: collapse; width: 100%; min-width: 780px; background: white; }
th,td { padding: 13px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f1f5f7; color: #516172; font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; }
td { font-size: .88rem; }
tr:last-child td { border-bottom: 0; }
.table-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.badge { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 999px; font-size: .72rem; font-weight: 850; text-transform: capitalize; }
.badge-due { color: #855800; background: #fff0bd; }
.badge-upcoming { color: #135e8c; background: #e2f2fd; }
.badge-contacted { color: #6548a3; background: #f0eaff; }
.badge-returned,.badge-active { color: #06613d; background: #def5e9; }
.badge-inactive,.badge-cancelled { color: #8f1d14; background: #fee8e4; }
.inline-form { display: inline; }
.empty { padding: 38px 15px; text-align: center; color: var(--muted); }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.details-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; }
.details-grid div { background: #f2f5f7; padding: 13px; border-radius: 11px; }
.details-grid span { display: block; color: var(--muted); font-size: .75rem; }

.qr-layout { display: grid; grid-template-columns: 340px 1fr; gap: 34px; align-items: start; }
.qr-card { background: white; border: 1px solid var(--line); border-radius: 22px; padding: 24px; text-align: center; box-shadow: var(--shadow); }
#qr-code { width: 280px; height: 280px; max-width: 100%; margin: 0 auto; }
#qr-code canvas,#qr-code img { width: 100% !important; height: auto !important; }
.copy-row { display: flex; gap: 8px; margin: 14px 0; }
.copy-row input { font-size: .82rem; }
.print-card { display: none; }
.rule-card { border: 1px solid var(--line); border-radius: 15px; padding: 16px; margin-bottom: 13px; }
.rule-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }

@media (max-width: 860px) {
  .hero-grid,.grid-3,.split,.qr-layout { grid-template-columns: 1fr; }
  .hero { min-height: auto; }
  .hero-card { max-width: 520px; transform: none; }
  .stats { grid-template-columns: 1fr 1fr; }
  .cta-band { align-items: flex-start; flex-direction: column; }
  .form-grid.two-col { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}

@media (max-width: 600px) {
  .public-nav { align-items: flex-start; }
  .public-links .btn-outline { display: none; }
  .hero { padding-top: 115px; }
  .hero-card { padding: 12px; }
  .section { padding: 56px 0; }
  .app-header { align-items: flex-start; }
  .brand-small img { width: 105px; }
  .user-chip { display: none; }
  .header-actions { gap: 9px; }
  .header-link { font-size: .8rem; }
  .dash-title { flex-direction: column; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat strong { font-size: 1.45rem; }
  .panel { padding: 16px; border-radius: 15px; }
  .auth-head,.join-head,.auth-body,.join-body { padding-left: 22px; padding-right: 22px; }
  .summary-box,.details-grid { grid-template-columns: 1fr; }
  .search-row { align-items: stretch; flex-direction: column; }
  .search-row input { max-width: none; }
}

@media print {
  body { background: white; }
  .app-header,.no-print,.flash { display: none !important; }
  .dashboard { margin: 0; width: 100%; }
  .qr-layout > :not(.qr-card) { display: none; }
  .qr-layout { display: block; }
  .qr-card { width: 100%; border: 0; box-shadow: none; }
  .print-card { display: block; }
}

.installer-page { min-height: 100vh; background: radial-gradient(circle at 8% 10%, #fff0bd, transparent 28%), #f4f6f8; }
.installer-shell { min-height: 100vh; display: grid; place-items: center; padding: 35px 16px; }
.installer-card { width: min(100%, 650px); padding: 36px; border-radius: 24px; background: white; box-shadow: var(--shadow); }
.installer-logo { width: 185px; margin-bottom: 20px; }
.installer-card h1 { font-size: 2.3rem; }
.installer-card h2 { margin: 18px 0 0; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 1.15rem; }
.installer-card code { padding: 2px 5px; background: #eef2f5; border-radius: 5px; }
