:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #0f2137;
  --muted: #637086;
  --primary: #0796c8;
  --primary-dark: #056f99;
  --secondary: #0d4160;
  --sidebar: #06283f;
  --line: #dde7f1;
  --success: #138a5b;
  --danger: #c93b3b;
  --warning: #d97706;
  --shadow: 0 18px 45px rgba(20, 32, 51, .08);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

/* Login profissional */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at 18% 15%, rgba(84,216,255,.33), transparent 32%),
    radial-gradient(circle at 85% 22%, rgba(255,255,255,.24), transparent 26%),
    linear-gradient(135deg, #031a2f 0%, #063b59 48%, #e8f7ff 100%);
}
.login-card {
  width: min(470px, 100%);
  background: rgba(255,255,255,.96);
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 30px;
  box-shadow: 0 28px 85px rgba(2,8,23,.28);
  padding: 34px;
  backdrop-filter: blur(12px);
}
.login-brand { margin-bottom: 26px; }
.login-card h2 { margin: 0 0 8px; font-size: 29px; letter-spacing: -0.04em; }
.login-card .muted { margin: 0; }
.login-form { display: grid; gap: 15px; margin-top: 24px; }
.login-form label { color: var(--text); font-weight: 800; }
.login-form input {
  width: 100%; border: 1px solid #d7e3ee; border-radius: 16px; padding: 14px 15px;
  background: #f8fbff; color: var(--text); outline: none;
}
.login-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(8,151,200,.14); background: #fff; }
.login-error { color: #dc2626; font-size: 13px; font-weight: 800; min-height: 18px; }
.login-hint { margin-top: 18px; padding: 14px 15px; border-radius: 18px; background: #eef8fc; color: #4a5c70; font-size: 13px; line-height: 1.6; border: 1px solid #d5edf6; }
.app-shell.locked { display: none !important; }
.login-screen.hidden { display: none !important; }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 290px; background: linear-gradient(180deg, var(--sidebar), #073755); color: #fff; padding: 26px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 24px; box-shadow: 16px 0 45px rgba(2,8,23,.12); }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-icon { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; background: linear-gradient(135deg, #26c7ee, #73e5ff); color: #08304a; font-weight: 900; box-shadow: 0 10px 25px rgba(38,199,238,.25); }
.brand h1 { margin: 0; font-size: 18px; letter-spacing: -0.03em; }
.brand span { color: rgba(255,255,255,.7); font-size: 12px; }
.login-card .brand span { color: var(--muted); }
.login-card .brand h1 { color: var(--text); }
.nav { display: grid; gap: 10px; }
.nav-item { border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.08); color: #fff; text-align: left; border-radius: 14px; padding: 14px 14px; font-weight: 800; cursor: pointer; transition: .18s ease; }
.nav-item:hover { transform: translateX(3px); background: rgba(255,255,255,.14); }
.nav-item.active { background: #fff; color: var(--secondary); box-shadow: 0 12px 30px rgba(0,0,0,.15); }
.sidebar-card { margin-top: auto; background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.14); border-radius: 22px; padding: 18px; }
.sidebar-card small, .sidebar-card span { display: block; color: rgba(255,255,255,.72); }
.sidebar-card strong { display: block; margin: 8px 0; font-size: 27px; }
.main { flex: 1; padding: 34px; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; color: var(--primary); text-transform: uppercase; letter-spacing: .08em; font-size: 12px; font-weight: 900; }
.topbar h2 { margin: 0; font-size: clamp(27px, 3vw, 38px); letter-spacing: -0.055em; }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.user-pill { border: 1px solid var(--line); background: var(--panel); border-radius: 999px; padding: 9px 13px; display: grid; gap: 2px; min-width: 145px; box-shadow: 0 8px 20px rgba(20,32,51,.04); }
.user-pill span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.user-pill strong { color: var(--text); font-size: 13px; }
.btn { border: 0; border-radius: 14px; padding: 12px 17px; background: linear-gradient(135deg, var(--primary), #17b8e8); color: white; font-weight: 900; cursor: pointer; box-shadow: 0 12px 24px rgba(8,151,200,.19); transition: .18s ease; }
.btn:hover { transform: translateY(-1px); filter: brightness(.98); }
.btn.ghost { background: var(--panel); color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.danger { background: linear-gradient(135deg, #c93b3b, #ef4444); box-shadow: 0 12px 24px rgba(201,59,59,.18); }
.section { display: none; }
.active-section { display: block; }
.hero { border-radius: 30px; padding: 34px; background: linear-gradient(135deg, rgba(8,151,200,.16), rgba(255,255,255,.92)); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; justify-content: space-between; gap: 22px; margin-bottom: 22px; overflow: hidden; position: relative; }
.hero:after { content: ""; position: absolute; right: -80px; top: -90px; width: 240px; height: 240px; border-radius: 999px; background: rgba(8,151,200,.08); }
.hero h3 { margin: 0; font-size: clamp(28px, 3.2vw, 44px); max-width: 780px; letter-spacing: -0.06em; line-height: 1.04; }
.hero p:not(.eyebrow) { color: var(--muted); max-width: 820px; line-height: 1.65; }
.hero-value { min-width: 250px; background: var(--panel); border: 1px solid var(--line); border-radius: 24px; padding: 24px; align-self: stretch; display: grid; align-content: center; z-index: 1; }
.hero-value span { color: var(--muted); font-weight: 800; }
.hero-value strong { font-size: 34px; margin-top: 8px; }
.cards-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; padding: 21px; box-shadow: var(--shadow); }
.metric span, .metric small { color: var(--muted); }
.metric strong { display: block; font-size: 29px; margin: 9px 0 5px; letter-spacing: -0.04em; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.card-header, .section-title { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.section-title { margin-bottom: 18px; }
.section-title h3, .card h3 { margin: 0; }
.badge { background: rgba(8,151,200,.12); color: var(--primary); border: 1px solid rgba(8,151,200,.22); border-radius: 999px; padding: 6px 10px; font-size: 12px; font-weight: 900; }
.summary-list { display: grid; gap: 9px; }
.summary-list div { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.summary-list span { color: var(--muted); }
.bars { display: grid; gap: 14px; }
.bar-row strong { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 7px; gap: 15px; }
.bar-track { height: 13px; background: rgba(8,151,200,.11); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--primary), #54d8ff); border-radius: 999px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
label { display: grid; gap: 7px; color: var(--muted); font-weight: 800; font-size: 13px; }
input, select { width: 100%; border: 1px solid var(--line); background: #f8fbff; color: var(--text); border-radius: 14px; padding: 13px; outline: none; }
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(8,151,200,.12); background: #fff; }
.form-actions { grid-column: 1 / -1; display: flex; gap: 10px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 13px 10px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
td { font-size: 14px; }
.action-btn { border: 1px solid var(--line); background: transparent; color: var(--text); padding: 7px 10px; border-radius: 10px; cursor: pointer; margin-right: 6px; font-weight: 800; }
.action-btn.delete { color: var(--danger); }
.mini-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 16px; }
.status { border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 900; }
.status.Ativo, .status.Pago { background: rgba(19,138,91,.12); color: var(--success); }
.status.Pendente { background: rgba(201,59,59,.12); color: var(--danger); }
.status.Encerrado { background: rgba(104,117,138,.15); color: var(--muted); }
.report-box { color: var(--muted); line-height: 1.7; }
.notice { margin-top: 18px; border-left: 5px solid var(--primary); background: rgba(8,151,200,.09); padding: 16px; border-radius: 14px; }
.muted { color: var(--muted); line-height: 1.7; }
.viewer-alert { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; padding: 12px 14px; border-radius: 16px; font-weight: 800; margin-bottom: 16px; }
body.viewer .admin-only { display: none !important; }
body.viewer .admin-action { display: none !important; }

/* Dark */
body.dark { --bg: #07111f; --panel: #101c2e; --text: #edf5ff; --muted: #a9b8cb; --line: #20324a; --shadow: 0 18px 45px rgba(0,0,0,.2); }
body.dark .hero { background: linear-gradient(135deg, rgba(24,183,232,.17), rgba(14,26,45,.95)); }
body.dark input, body.dark select { background: #0b1627; }
body.dark .btn.ghost, body.dark .user-pill { background: #0f1b2d; }
body.dark .login-screen { background: radial-gradient(circle at top left, rgba(59,130,246,.22), transparent 36%), linear-gradient(135deg, #020617 0%, #0f172a 100%); }
body.dark .login-card { background: rgba(15,27,45,.96); }
body.dark .login-hint { background: rgba(96,165,250,.12); border-color: rgba(96,165,250,.2); }
body.dark .viewer-alert { background: rgba(251,146,60,.12); border-color: rgba(251,146,60,.3); color: #fed7aa; }

@media (max-width: 1050px) {
  .app-shell { display:block; }
  .sidebar { width:auto; height:auto; position:static; }
  .nav { grid-template-columns: repeat(3,1fr); }
  .cards-grid, .grid-2, .form-grid { grid-template-columns: 1fr 1fr; }
  .hero { flex-direction: column; }
}
@media (max-width: 700px) {
  .main { padding: 18px; }
  .topbar, .section-title, .card-header { align-items:flex-start; flex-direction:column; }
  .cards-grid, .grid-2, .form-grid, .mini-form { grid-template-columns: 1fr; }
  .nav { grid-template-columns: 1fr; }
  .top-actions { width:100%; flex-direction:column; align-items: stretch; }
  .btn { width:100%; }
  .hero-value { min-width: 0; }
  .login-card { padding: 25px; }
}
@media print {
  .sidebar, .top-actions, .nav, .btn, .action-btn, .viewer-alert { display:none !important; }
  .main { padding:0; }
  .section { display:block; break-inside: avoid; margin-bottom:20px; }
  body { background:white; color:#111; }
  .card, .hero { box-shadow:none; }
}

/* V5 - Alteração de senhas pelo administrador */
.compact-form { margin-top: 16px; }
.security-note { margin-top: 10px; }


/* V6 - Programação 2026/2027, edição de valores e pagamentos fracionados */
.status.Parcial { background: rgba(217,119,6,.14); color: var(--warning); }
.actions-stack { min-width: 310px; }
.actions-stack .action-btn { margin-bottom: 6px; }
.payments-list { display: block; margin-top: 5px; color: var(--muted); line-height: 1.45; font-size: 12px; }
.muted-mini { opacity: .8; }
