:root {
  --ink: #333333;
  --muted: #66758a;
  --bg: #f3f7fb;
  --card: #ffffff;
  --nav: #003366;
  --nav2: #074b7c;
  --brand: #00a8c4;
  --brand2: #00c2e0;
  --blue: #0a6fae;
  --line: #dce6ee;
  --shadow: 0 12px 32px rgba(0, 51, 102, .08);
  --shadow-strong: 0 24px 70px rgba(0, 51, 102, .16);
  --r: 14px;
  --font-heading: "Montserrat", "Segoe UI", sans-serif;
  --font-body: "Poppins", "Segoe UI", sans-serif;
}

html { color-scheme: light; }
body {
  min-width: 320px;
  font: 400 1rem/1.55 var(--font-body);
  background:
    radial-gradient(circle at 86% 8%, rgba(0, 194, 224, .08), transparent 22rem),
    var(--bg);
  color: var(--ink);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: var(--font-body); }
button { touch-action: manipulation; }

:focus-visible {
  outline: 3px solid rgba(0, 194, 224, .45);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  left: 16px;
  top: 12px;
  z-index: 200;
  padding: 10px 14px;
  border-radius: 10px;
  background: #fff;
  color: var(--nav);
  font-weight: 700;
  transform: translateY(-150%);
  transition: transform .18s ease;
}
.skip-link:focus { transform: translateY(0); }

.app { grid-template-columns: 282px minmax(0, 1fr); }
.side {
  padding: 24px 16px 18px;
  background:
    linear-gradient(155deg, rgba(0, 194, 224, .14), transparent 36%),
    linear-gradient(180deg, #003366 0%, #00284f 100%);
  border-right: 1px solid rgba(255, 255, 255, .08);
  box-shadow: 10px 0 40px rgba(0, 37, 73, .08);
}
.side::after {
  content: "";
  position: absolute;
  inset: auto 16px 12px;
  height: 2px;
  border-radius: 99px;
  background: linear-gradient(90deg, transparent, var(--brand2), transparent);
  opacity: .55;
}
.brand { gap: 13px; padding: 0 8px 22px; }
.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
}
.brand-mark img { padding: 4px; }
.brand b, .page-head h2, .top h1, .login-card h2, .panel h3 {
  font-family: var(--font-heading);
}
.brand b { font-size: 1.05rem; letter-spacing: -.02em; }
.brand small { color: #a9c4d9; font-size: .75rem; }
.nav { gap: 5px; }
.nav button {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #c8d9e8;
  font-size: .875rem;
  font-weight: 500;
  transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.nav button:hover {
  color: #fff;
  background: rgba(255, 255, 255, .07);
  transform: translateX(2px);
}
.nav button.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(0, 194, 224, .2), rgba(0, 194, 224, .08));
  border-color: rgba(0, 194, 224, .28);
  box-shadow: inset 3px 0 0 var(--brand2);
}
.nav .ico {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex: 0 0 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .07);
  color: #d5f8ff;
}
.nav .ico svg { width: 17px; height: 17px; stroke-width: 1.8; }
.side-note {
  margin: 22px 8px 4px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  background: rgba(0, 0, 0, .1);
  color: #a7bed1;
  font-size: .75rem;
}

.top {
  height: 82px;
  padding: 0 30px;
  background: rgba(255, 255, 255, .88);
  border-bottom-color: rgba(0, 51, 102, .1);
  box-shadow: 0 8px 30px rgba(0, 51, 102, .045);
  backdrop-filter: blur(18px) saturate(145%);
}
.top::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--nav), var(--brand2), transparent 76%);
}
.top h1 { color: var(--nav); font-size: 1.15rem; font-weight: 700; }
.top p { font-size: .75rem; }
.top > .actions > div:last-child {
  display: grid;
  grid-template-columns: minmax(0, auto) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
}
.top > .actions > div:last-child h1 { grid-column: 1; grid-row: 1; }
.top > .actions > div:last-child p { grid-column: 1; grid-row: 2; }
.top > .actions > div:last-child .environment-badge {
  grid-column: 2;
  grid-row: 1 / 3;
  margin-top: 0;
}
.top-brand-logo {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(0, 51, 102, .1);
  border-radius: 11px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(0, 51, 102, .08);
}
.top-brand-logo img { padding: 3px; }
.avatar {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(0, 194, 224, .25);
  border-radius: 12px;
  background: #e8fbff;
  color: var(--nav);
  font-family: var(--font-heading);
}
.content { max-width: 1720px; padding: 30px; }
.page-head { margin-bottom: 20px; }
.page-head h2 { color: var(--nav); font-size: 1.5rem; font-weight: 700; }
.page-head p { max-width: 72ch; font-size: .875rem; }

.btn {
  min-height: 40px;
  padding: 9px 14px;
  border-color: #d4e0e9;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0, 51, 102, .035);
  font-size: .84rem;
  font-weight: 600;
  transition: transform .16s ease, box-shadow .16s ease, filter .16s ease, border-color .16s ease;
}
.btn:hover { border-color: #b9cbd9; box-shadow: 0 6px 16px rgba(0, 51, 102, .08); }
.btn.primary {
  border-color: var(--nav);
  background: linear-gradient(135deg, var(--nav), #075b91);
  box-shadow: 0 8px 20px rgba(0, 51, 102, .18);
}
.btn.primary:hover { filter: brightness(1.08); }
.btn.dark { background: var(--nav); border-color: var(--nav); }
.btn.gold { background: #fff4d6; border-color: #f2d17c; color: #704c00; }
.btn.danger { background: #fff7f7; border-color: #f2d4d4; }
.btn.sm { min-height: 34px; font-size: .75rem; }

.cards { gap: 14px; }
.metric, .panel {
  border-color: rgba(0, 51, 102, .1);
  box-shadow: var(--shadow);
}
.metric {
  min-height: 128px;
  padding: 18px;
  border-top: 3px solid color-mix(in srgb, var(--accent, var(--brand2)) 68%, var(--nav));
}
.metric::after {
  width: 86px;
  height: 86px;
  right: -28px;
  bottom: -34px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent, var(--brand2)) 18%, transparent), transparent 68%);
}
.metric .k { font-size: .75rem; letter-spacing: .055em; }
.metric .v { color: var(--nav); font-family: var(--font-heading); font-size: 1.7rem; font-weight: 700; }
.metric .s { font-size: .72rem; }
.panel { padding: 20px; }
.panel h3 { color: var(--nav); font-size: .95rem; font-weight: 700; }
.mini-card, .status-card, .report, .check, .meal-config-card {
  border-color: rgba(0, 51, 102, .11);
  background: linear-gradient(180deg, #fff, #fbfdff);
}
.status-card { border-left: 3px solid var(--brand2); }
.status-card .v, .mini-card strong { color: var(--nav); font-family: var(--font-heading); }

.field label { color: #52657a; font-size: .75rem; letter-spacing: .04em; }
.field input, .field select, .field textarea, .search, .multi-select summary {
  min-height: 42px;
  border-color: #cfdae4;
  border-radius: 9px;
  font-size: .875rem;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.field input:hover, .field select:hover, .field textarea:hover, .search:hover { border-color: #aebfce; }
.field input:focus, .field select:focus, .field textarea:focus, .search:focus, .multi-select[open] summary {
  border-color: var(--brand2);
  box-shadow: 0 0 0 3px rgba(0, 194, 224, .14);
}
.section-title { color: var(--nav); border-bottom-color: rgba(0, 51, 102, .13); font-size: .75rem; }
.table-wrap { border-color: rgba(0, 51, 102, .12); box-shadow: inset 0 1px 0 #fff; }
table { font-size: .82rem; }
th, td { padding: 11px 12px; border-bottom-color: #e8eef3; }
th {
  background: #f1f6fa;
  color: #4c6073;
  font-size: .68rem;
  letter-spacing: .045em;
}
tbody tr:hover td { background: #f2fbfd; }
.subline { font-size: .75rem; }
.pill { border: 1px solid transparent; font-size: .75rem; }
.bar { background: linear-gradient(90deg, var(--nav2), var(--brand2)); }
.bar-track { background: #e5edf3; }
.notice { border-color: #9be7f1; background: #eafcff; color: #07536a; }
.scope-note { background: #eaf7fb; color: #164f6b; }

.login-screen { background: #f4f8fb; }
.login-hero {
  min-height: 100svh;
  padding: clamp(36px, 5.2vw, 76px);
  background:
    linear-gradient(150deg, rgba(0, 194, 224, .16), transparent 46%),
    linear-gradient(145deg, #003366 0%, #004b75 64%, #007d96 100%);
}
.login-hero::before {
  width: 620px;
  height: 620px;
  right: -280px;
  top: -230px;
  border-color: rgba(0, 194, 224, .26);
  box-shadow: 0 0 0 90px rgba(0, 194, 224, .035), 0 0 0 180px rgba(0, 194, 224, .025);
}
.login-hero::after {
  width: 380px;
  height: 380px;
  right: 10%;
  bottom: -250px;
  border-color: rgba(255, 255, 255, .16);
}
.login-brand { font-family: var(--font-heading); font-size: 1.25rem; font-weight: 700; }
.login-brand .brand-mark { width: 66px; height: 66px; flex-basis: 66px; border-radius: 16px; }
.login-copy h1 {
  max-width: 700px;
  margin-bottom: 20px;
  font-family: var(--font-heading);
  font-size: clamp(2.15rem, 4.3vw, 4.15rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.045em;
}
.login-copy h1::after {
  content: "";
  display: block;
  width: 86px;
  height: 5px;
  margin-top: 24px;
  border-radius: 99px;
  background: var(--brand2);
}
.login-copy p { color: #d3e8f2; font-size: 1rem; }
.login-features { gap: 10px; }
.login-features span {
  padding: 8px 11px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 9px;
  background: rgba(255, 255, 255, .06);
  color: #e5f6fa;
  font-size: .75rem;
}
.login-panel { padding: clamp(24px, 4vw, 54px); }
.login-card {
  width: min(460px, 100%);
  padding: clamp(26px, 4vw, 38px);
  border: 1px solid rgba(0, 51, 102, .11);
  border-radius: 18px;
  box-shadow: var(--shadow-strong);
}
.login-card h2 { color: var(--nav); font-size: 1.55rem; font-weight: 700; }
.login-card .btn { min-height: 46px; }
.login-message { font-size: .82rem; }

.environment-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 5px 9px;
  border: 1px solid rgba(0, 194, 224, .22);
  border-radius: 99px;
  background: #eafcff;
  color: #07566b;
  font-size: .68rem;
  font-weight: 700;
}
.environment-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand2);
  box-shadow: 0 0 0 4px rgba(0, 194, 224, .12);
}

.report-logos {
  display: flex;
  align-items: center;
  gap: 8px;
}

.print-client-placeholder {
  display: grid;
  place-items: center;
  width: 64px;
  height: 48px;
  padding: 4px;
  border: 1px dashed #9bc8cf;
  border-radius: 8px;
  background: #fff;
  color: #0b6257;
  font-size: .55rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
}

/* Densidade para estações de trabalho: mais contexto visível sem reduzir a clareza. */
@media (min-width: 901px) {
  body { font-size: .875rem; line-height: 1.42; }
  .app { grid-template-columns: 248px minmax(0, 1fr); }
  .side { padding: 16px 12px 12px; }
  .side::after { inset-inline: 12px; bottom: 8px; }
  .brand { gap: 9px; padding: 0 6px 13px; }
  .brand-mark { width: 43px; height: 43px; flex-basis: 43px; border-radius: 11px; }
  .brand b { font-size: .94rem; }
  .brand small, .side-note { font-size: .68rem; }
  .nav { gap: 2px; }
  .nav button { min-height: 37px; padding: 7px 9px; border-radius: 9px; font-size: .78rem; }
  .nav .ico { width: 22px; height: 22px; flex-basis: 22px; border-radius: 7px; }
  .nav .ico svg { width: 15px; height: 15px; }
  .side-note { margin: 12px 6px 2px; padding: 9px; border-radius: 10px; }

  .top { height: 64px; padding-inline: 20px; }
  .top h1 { font-size: 1rem; }
  .top p { font-size: .68rem; }
  .top-brand-logo { width: 34px; height: 34px; border-radius: 9px; }
  .avatar { width: 34px; height: 34px; border-radius: 10px; }
  .environment-badge { gap: 5px; padding: 3px 7px; font-size: .61rem; }
  .environment-badge::before { width: 6px; height: 6px; }

  .content { max-width: none; padding: 18px 20px; }
  .page-head { margin-bottom: 12px; }
  .page-head h2 { font-size: 1.25rem; }
  .page-head p { font-size: .78rem; }
  .page-head, .toolbar, .actions, .daily-head { gap: 7px; }

  .btn { min-height: 34px; padding: 6px 10px; border-radius: 8px; font-size: .76rem; }
  .btn.sm { min-height: 29px; padding: 4px 7px; font-size: .68rem; }
  .cards { grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)); gap: 10px; margin-bottom: 11px; }
  #dashCards { grid-template-columns: repeat(auto-fit, minmax(116px, 1fr)) !important; gap: 10px !important; }
  .cards .metric { min-width: 0; }
  #dashCards .metric { height: 94px !important; min-height: 94px !important; max-height: 94px !important; padding: 11px 12px !important; border-top-width: 3px !important; }
  .metric { min-height: 94px; padding: 11px 12px; border-top-width: 3px; }
  .metric::after { width: 66px; height: 66px; right: -22px; bottom: -27px; }
  .metric .k { font-size: .61rem; }
  .metric .v { margin-top: 3px; font-size: 1.42rem; }
  .metric .s { font-size: .63rem; }
  .panel { padding: 14px; margin-bottom: 11px; }
  .panel h3 { margin-bottom: 9px; font-size: .83rem; }
  .grid2, .grid3 { gap: 10px; }
  .form-grid, .filters { gap: 9px; }

  .field { gap: 3px; }
  .field label { font-size: .64rem; }
  .field input, .field select, .field textarea, .search, .multi-select summary { min-height: 35px; padding: 6px 8px; border-radius: 8px; font-size: .78rem; }
  .field textarea { min-height: 62px; }
  .section-title { padding: 6px 0 4px; margin-top: 2px; font-size: .65rem; }
  .subline { font-size: .68rem; }
  .notice, .scope-note { padding: 9px 10px; font-size: .76rem; }

  table { font-size: .74rem; }
  th, td { padding: 7px 8px; }
  th { font-size: .59rem; }
  .pill { padding: 3px 6px; font-size: .65rem; }
  .status-counts, .report-grid { gap: 8px; margin-bottom: 10px; }
  .status-card, .mini-card, .meal-config-card, .report, .check { padding: 9px; border-radius: 9px; }
  .status-card .v, .mini-card strong { font-size: 1.22rem; }
  .daily-head { margin-bottom: 9px; }
  .daily td input[type=number], .daily td input[type=text], .daily td select { padding: 5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

@media (max-width: 1200px) {
  .app { grid-template-columns: 250px minmax(0, 1fr); }
  .side { padding-inline: 12px; }
}

@media (max-width: 900px) {
  .app { display: block; }
  .side { width: min(292px, 88vw); left: -310px; }
  .side.open { left: 0; box-shadow: 30px 0 70px rgba(0, 24, 48, .28); }
  .top { height: 74px; padding: 0 16px; }
  .top-brand-logo,
  .top p,
  .top .environment-badge,
  .top .user > div:nth-child(2) { display: none; }
  .top > .actions > div:last-child { display: block; }
  .content { padding: 18px; }
  .login-hero { min-height: 290px; }
  .login-copy h1 { font-size: clamp(2rem, 8vw, 3rem); }
}

@media (max-width: 600px) {
  body { font-size: .94rem; }
  .content { padding: 14px; }
  .panel { padding: 15px; }
  .page-head { align-items: flex-start; }
  .page-head > .actions { width: 100%; }
  .page-head > .actions > .btn, .page-head > .actions > .search { flex: 1 1 150px; }
  .metric { min-height: 112px; }
  .login-hero { min-height: 245px; padding: 28px; }
  .login-copy p { display: none; }
  .login-panel { padding: 18px; }
  .login-card { padding: 24px 20px; }
  .user .avatar { display: none; }
}

@media print {
  .print-sheet { font-family: var(--font-body); }
  .print-head { background: linear-gradient(135deg, var(--nav), #075b91); }
}

/* Controle financeiro mensal */
.invoice-alerts { display: grid; gap: 7px; }
.invoice-alert { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 10px; border: 1px solid #d7e4ec; border-left: 4px solid var(--blue); border-radius: 9px; background: #fbfdff; }
.invoice-alert.overdue { border-left-color: #d55353; background: #fff8f7; }
.invoice-alert b { display: block; font-size: .77rem; color: var(--ink); }
.invoice-alert span, .invoice-due, .invoice-table small { display: block; margin-top: 2px; font-size: .66rem; color: var(--muted); }
.invoice-alert-date { min-width: 100px; text-align: right; }
.invoice-pill { display: inline-flex; white-space: nowrap; background: #e9f3ff; color: #075b91; border: 1px solid #c8ddf1; }
.invoice-pill.invoice-overdue { background: #fff0ef; border-color: #f1c3be; color: #a6302d; }
.invoice-pill.invoice-paid { background: #e8f8f2; border-color: #bee8d7; color: #0b7058; }
.invoice-actions { display: flex; gap: 5px; justify-content: flex-end; flex-wrap: nowrap; white-space: nowrap; }
.invoice-table { min-width: 1440px; }
.invoice-table td { vertical-align: middle; }
.invoice-table .money { white-space: nowrap; font-weight: 800; }
.invoice-filters .filters { grid-template-columns: 1.1fr .9fr .8fr 1.5fr; }
@media (min-width: 901px) {
  .invoice-alert-panel { padding-block: 11px; }
  .invoice-alert { padding: 7px 9px; }
}
@media (max-width: 700px) {
  .invoice-filters .filters { grid-template-columns: 1fr; }
  .invoice-alert { grid-template-columns: auto minmax(0, 1fr); }
  .invoice-alert-date { grid-column: 2; text-align: left; }
}
