@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

/* ── RESET & VARIABLES ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --blue:    #1A4FA0;
  --blue-dk: #14388A;
  --blue-lt: #E8EFF9;
  --navy:    #1B2B4B;
  --navy-mid:#2C3E5E;
  --teal:    #2A7C8E;
  --teal-lt: #EAF5F7;
  --gold:    #C49A3C;
  --white:   #FFFFFF;
  --fog:     #F5F7FA;
  --border:  #D8E0EA;
  --text:    #1B2B4B;
  --muted:   #6B7A91;
  --exc:     #1A7A4A;
  --bom:     #3A8FD6;
  --reg:     #E8A020;
  --rui:     #D64E30;
  --mru:     #9B2335;
  --danger:  #c0392b;
}

html { scroll-behavior: smooth; }
body { font-family: 'Inter', sans-serif; background: var(--fog); color: var(--text); min-height: 100vh; }

/* ── PAGE SYSTEM ── */
.page { display: none; }
.page.active { display: block; }

/* ── HEADER ── */
header { background: var(--blue-dk); position: relative; overflow: hidden; }
header::after { content: ''; position: absolute; left: 0; bottom: 0; right: 0; height: 4px; background: linear-gradient(90deg, var(--blue), #fff, var(--blue)); }
.header-top { background: linear-gradient(135deg, #0e2a70 0%, #1A4FA0 50%, #0e2a70 100%); padding: 1.6rem 2rem; display: flex; align-items: center; gap: 1.5rem; }
.header-logo img { width: 72px; height: 72px; object-fit: contain; border-radius: 50%; box-shadow: 0 2px 12px rgba(0,0,0,.3); }
.header-badge { display: inline-block; border: 1px solid rgba(255,255,255,.3); color: rgba(255,255,255,.75); font-size: .68rem; font-weight: 600; letter-spacing: .1em; padding: .25rem .8rem; border-radius: 2px; margin-bottom: .5rem; text-transform: uppercase; }
.header-title { font-family: 'Playfair Display', serif; font-size: clamp(1.05rem, 3.5vw, 1.85rem); color: #fff; line-height: 1.2; margin-bottom: .3rem; }
.header-sub { font-size: .8rem; color: rgba(255,255,255,.55); font-weight: 300; line-height: 1.5; }
.header-admin-btn { position: absolute; top: 1rem; right: 1.5rem; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.25); color: rgba(255,255,255,.75); font-family: inherit; font-size: .72rem; padding: .4rem .85rem; border-radius: 5px; cursor: pointer; transition: all .2s; z-index: 2; }
.header-admin-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.header-strip { background: var(--blue); padding: .45rem 2rem; display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.header-strip span { color: rgba(255,255,255,.7); font-size: .75rem; }
.header-strip strong { color: #fff; font-size: .75rem; }

/* ── MAIN ── */
main { max-width: 780px; margin: 0 auto; padding: 2rem 1rem 4rem; }

/* ── PROGRESS ── */
.progress-wrap { position: sticky; top: 0; z-index: 10; background: var(--fog); padding: .8rem 0; border-bottom: 1px solid var(--border); margin-bottom: 2rem; }
.progress-bar { height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--teal)); border-radius: 3px; width: 0%; transition: width .4s ease; }
.progress-label { font-size: .78rem; color: var(--muted); margin-top: .4rem; display: flex; justify-content: space-between; }

/* ── SECTIONS ── */
.section { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 1.8rem; margin-bottom: 1.5rem; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.section-title { font-family: 'Playfair Display', serif; font-size: 1.1rem; color: var(--navy); margin-bottom: 1.4rem; padding-bottom: .7rem; border-bottom: 2px solid var(--blue-lt); display: flex; align-items: center; gap: .6rem; }
.section-title .icon { width: 28px; height: 28px; background: var(--blue-lt); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 1rem; flex-shrink: 0; }

/* ── FIELDS ── */
.fields-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.field label .req { color: var(--danger); margin-left: 2px; }
.field input, .field select { padding: .65rem .9rem; border: 1.5px solid var(--border); border-radius: 6px; font-family: inherit; font-size: .92rem; color: var(--text); background: var(--white); transition: border-color .2s, box-shadow .2s; outline: none; }
.field input:focus, .field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,79,160,.12); }
.field input.error, .field select.error { border-color: var(--danger); }
.error-msg { font-size: .78rem; color: var(--danger); margin-top: .3rem; display: none; }
.has-error .error-msg { display: block; }

/* ── SERVICE CARD ── */
.service-card { background: var(--white); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 1.25rem; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.04); transition: box-shadow .2s; }
.service-card:focus-within { box-shadow: 0 0 0 3px rgba(26,79,160,.15); }
.service-header { display: flex; align-items: center; gap: .8rem; padding: 1rem 1.4rem; background: var(--blue-lt); border-bottom: 1px solid var(--border); }
.service-emoji { font-size: 1.35rem; }
.service-name { font-weight: 600; font-size: .95rem; color: var(--blue-dk); flex: 1; }
.rating-required { font-size: .7rem; color: var(--muted); font-style: italic; }
.service-body { padding: 1.2rem 1.4rem; }
.ruler-label, .just-label { font-size: .76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .6rem; }
.just-label span { font-weight: 400; font-style: italic; color: var(--muted); text-transform: none; letter-spacing: 0; }

/* ── RULER ── */
.ruler { display: flex; gap: .45rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.ruler input[type="radio"] { display: none; }
.ruler label { flex: 1; min-width: 78px; text-align: center; padding: .52rem .4rem; border-radius: 6px; border: 2px solid var(--border); cursor: pointer; font-size: .76rem; font-weight: 600; color: var(--muted); transition: all .18s; user-select: none; line-height: 1.3; }
.ruler label:hover { border-color: var(--blue); color: var(--blue); }
.ruler input[value="excelente"]:checked + label  { background: var(--exc); border-color: var(--exc); color: #fff; }
.ruler input[value="bom"]:checked + label        { background: var(--bom); border-color: var(--bom); color: #fff; }
.ruler input[value="regular"]:checked + label    { background: var(--reg); border-color: var(--reg); color: #fff; }
.ruler input[value="ruim"]:checked + label       { background: var(--rui); border-color: var(--rui); color: #fff; }
.ruler input[value="muito-ruim"]:checked + label { background: var(--mru); border-color: var(--mru); color: #fff; }
.rating-indicator { height: 3px; border-radius: 2px; margin-bottom: 1rem; background: var(--border); transition: background .25s; }
.has-error .ruler label { border-color: rgba(192,57,43,.3); }

textarea { width: 100%; min-height: 72px; resize: vertical; padding: .65rem .9rem; border: 1.5px solid var(--border); border-radius: 6px; font-family: inherit; font-size: .88rem; color: var(--text); background: var(--fog); transition: border-color .2s, box-shadow .2s; outline: none; line-height: 1.55; }
textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,79,160,.1); background: var(--white); }
.char-count { text-align: right; font-size: .72rem; color: var(--muted); margin-top: .25rem; }

/* ── LEGEND ── */
.legend { display: flex; flex-wrap: wrap; gap: .5rem .9rem; margin: .2rem 0 1.5rem; padding: .8rem 1rem; background: var(--fog); border-radius: 7px; border: 1px solid var(--border); }
.legend-item { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }

/* ── SUBMIT ── */
.submit-wrap { text-align: center; margin-top: 2.5rem; }
.btn-submit { display: inline-flex; align-items: center; gap: .6rem; background: var(--blue); color: #fff; border: none; padding: .95rem 2.8rem; font-family: inherit; font-size: 1rem; font-weight: 600; border-radius: 7px; cursor: pointer; transition: background .2s, box-shadow .2s; box-shadow: 0 2px 12px rgba(26,79,160,.3); letter-spacing: .01em; }
.btn-submit:hover { background: var(--blue-dk); box-shadow: 0 4px 18px rgba(26,79,160,.35); }
.submit-note { font-size: .78rem; color: var(--muted); margin-top: .9rem; }

/* ── SUCCESS ── */
#successMsg { display: none; text-align: center; padding: 3rem 1.5rem; }
.success-icon { font-size: 3.5rem; margin-bottom: 1rem; }
#successMsg h2 { font-family: 'Playfair Display', serif; font-size: 1.7rem; color: var(--blue-dk); margin-bottom: .7rem; }
#successMsg p { color: var(--muted); font-size: .92rem; line-height: 1.6; max-width: 440px; margin: 0 auto 1.5rem; }
.success-logo { width: 56px; margin: 0 auto 1rem; display: block; }

/* ── LOGIN ── */
#loginPage { min-height: 100vh; display: flex; flex-direction: column; }
#loginPage.active { display: flex; }
.login-body { flex: 1; display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { background: var(--white); border: 1px solid var(--border); border-radius: 14px; padding: 2.5rem 2rem; width: 100%; max-width: 390px; box-shadow: 0 6px 30px rgba(0,0,0,.1); text-align: center; }
.login-logo { width: 70px; margin: 0 auto 1rem; display: block; }
.login-condo { font-size: .78rem; font-weight: 600; color: var(--blue); margin-bottom: .2rem; letter-spacing: .03em; }
.login-card h2 { font-family: 'Playfair Display', serif; font-size: 1.45rem; color: var(--navy); margin-bottom: .4rem; }
.login-card p { font-size: .83rem; color: var(--muted); margin-bottom: 1.8rem; line-height: 1.5; }
.login-field { text-align: left; margin-bottom: 1.2rem; }
.login-field label { display: block; font-size: .76rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .4rem; }
.login-field input { width: 100%; padding: .72rem 1rem; border: 1.5px solid var(--border); border-radius: 7px; font-family: inherit; font-size: .95rem; outline: none; transition: border-color .2s, box-shadow .2s; }
.login-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(26,79,160,.12); }
.login-error { color: var(--danger); font-size: .82rem; margin-bottom: 1rem; display: none; padding: .5rem .8rem; background: #fff5f5; border-radius: 5px; border-left: 3px solid var(--danger); }
.btn-login { width: 100%; background: var(--blue); color: #fff; border: none; padding: .88rem; font-family: inherit; font-size: .95rem; font-weight: 600; border-radius: 7px; cursor: pointer; transition: background .2s; box-shadow: 0 2px 10px rgba(26,79,160,.3); }
.btn-login:hover { background: var(--blue-dk); }
.link-back { margin-top: 1.2rem; font-size: .78rem; color: var(--muted); cursor: pointer; }
.link-back:hover { color: var(--blue); }

/* ── ADMIN ── */
#adminPage { min-height: 100vh; display: flex; flex-direction: column; }
#adminPage.active { display: flex; }
.admin-header { background: var(--blue-dk); padding: 1.1rem 2rem; display: flex; align-items: center; justify-content: space-between; position: relative; flex-wrap: wrap; gap: .8rem; }
.admin-header::after { content: ''; position: absolute; left: 0; bottom: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--blue), #fff, var(--blue)); }
.admin-header-left { display: flex; align-items: center; gap: 1rem; }
.admin-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 50%; flex-shrink: 0; }
.admin-header h1 { font-family: 'Playfair Display', serif; font-size: 1.15rem; color: #fff; line-height: 1.2; }
.admin-header .tagline { font-size: .7rem; color: rgba(255,255,255,.5); margin-top: .1rem; }
.admin-nav { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.btn-nav { background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.2); color: rgba(255,255,255,.8); font-family: inherit; font-size: .76rem; padding: .4rem .9rem; border-radius: 5px; cursor: pointer; transition: all .2s; }
.btn-nav:hover, .btn-nav.act { background: rgba(255,255,255,.2); color: #fff; }
.btn-logout { background: rgba(192,57,43,.3); border: 1px solid rgba(192,57,43,.5); color: #faa; font-family: inherit; font-size: .76rem; padding: .4rem .9rem; border-radius: 5px; cursor: pointer; transition: all .2s; }
.btn-logout:hover { background: rgba(192,57,43,.5); }
.admin-body { flex: 1; padding: 2rem; max-width: 1100px; margin: 0 auto; width: 100%; }

/* ── STATS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 1.2rem 1.4rem; box-shadow: 0 1px 4px rgba(0,0,0,.04); border-top: 3px solid var(--blue); }
.stat-card .sv { font-family: 'Playfair Display', serif; font-size: 2rem; font-weight: 700; color: var(--blue-dk); line-height: 1; }
.stat-card .sl { font-size: .78rem; color: var(--muted); margin-top: .3rem; }
.stat-card .ss { font-size: .72rem; color: var(--blue); font-weight: 600; margin-top: .2rem; }

/* ── ADMIN SECTIONS ── */
.asec { background: var(--white); border: 1px solid var(--border); border-radius: 10px; margin-bottom: 1.5rem; overflow: hidden; box-shadow: 0 1px 4px rgba(0,0,0,.04); }
.asec-hd { background: var(--fog); padding: 1rem 1.4rem; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.asec-hd h3 { font-size: .98rem; font-weight: 600; color: var(--navy); }
.asec-bd { padding: 1.4rem; }

/* ── RANKING ── */
.svc-rank { display: flex; align-items: center; gap: .9rem; padding: .75rem 0; border-bottom: 1px solid var(--border); }
.svc-rank:last-child { border-bottom: none; }
.svc-rank-bw { flex: 2; background: var(--fog); border-radius: 20px; height: 8px; overflow: hidden; }
.svc-rank-b { height: 100%; border-radius: 20px; }

/* ── PILLS ── */
.rpill { display: inline-block; padding: .18rem .6rem; border-radius: 20px; font-size: .7rem; font-weight: 700; color: #fff; white-space: nowrap; }
.rpill.excelente  { background: var(--exc); }
.rpill.bom        { background: var(--bom); }
.rpill.regular    { background: var(--reg); }
.rpill.ruim       { background: var(--rui); }
.rpill.muito-ruim { background: var(--mru); }

/* ── TABLE ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th { background: var(--fog); color: var(--muted); font-weight: 600; padding: .7rem .9rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; font-size: .73rem; text-transform: uppercase; letter-spacing: .04em; }
td { padding: .65rem .9rem; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(26,79,160,.03); }

/* ── FILTERS ── */
.filters-row { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.2rem; align-items: flex-end; }
.ff { display: flex; flex-direction: column; gap: .3rem; }
.ff label { font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ff input, .ff select { padding: .45rem .75rem; border: 1.5px solid var(--border); border-radius: 6px; font-family: inherit; font-size: .85rem; color: var(--text); outline: none; background: var(--white); }
.ff input:focus, .ff select:focus { border-color: var(--blue); }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .5rem 1.1rem; font-family: inherit; font-size: .82rem; font-weight: 600; border-radius: 6px; cursor: pointer; border: none; transition: all .2s; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dk); }
.btn-danger { background: #c0392b; color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-outline { background: var(--white); color: var(--navy); border: 1.5px solid var(--border); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #b3892f; }

/* ── MODAL ── */
.modal-ov { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal-ov.open { display: flex; }
.modal { background: var(--white); border-radius: 12px; max-width: 520px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-hd { padding: 1.2rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-hd h3 { font-size: 1rem; font-weight: 600; color: var(--navy); }
.modal-cl { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); }
.modal-bd { padding: 1.5rem; }
.modal-ft { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .7rem; }

/* ── TABS ── */
.tab-c { display: none; }
.tab-c.active { display: block; }

/* ── DELETE ── */
.del-btn { background: none; border: none; cursor: pointer; color: var(--danger); font-size: .85rem; padding: .2rem .5rem; border-radius: 4px; transition: background .15s; font-family: inherit; }
.del-btn:hover { background: rgba(192,57,43,.08); }

/* ── PDF REPORT CARDS ── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; }
.danger-section { border: 1.5px solid var(--danger) !important; }
.danger-header { background: #fff5f5 !important; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
  .header-top { flex-direction: column; text-align: center; padding: 1.2rem 1rem; }
  .admin-body { padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .admin-header { flex-direction: column; text-align: center; }
  .admin-header-left { justify-content: center; }
  .ruler label { font-size: .7rem; padding: .45rem .25rem; min-width: 60px; }
}
