/* V2.4 — hierarquia de navegação, avisos compactos e listas mais legíveis. */
.app-shell {
  max-width: 1880px;
  padding: clamp(12px, 1.5vw, 26px) clamp(12px, 2vw, 34px) 30px;
}

.topbar {
  height: auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "user brand" "links links";
  align-items: center;
  gap: 8px 16px;
  padding: 10px 14px;
  margin-bottom: 12px;
}

.top-user { grid-area: user; }
.top-brand { grid-area: brand; text-align: right; }
.top-brand strong { font-size: 15px; }
.top-brand small { font-size: 9px; letter-spacing: .12em; }
.menu-toggle { display: none; }

.top-links {
  grid-area: links;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: 4px;
  border-top: 1px solid #edf1f6;
  padding-top: 6px;
}

.top-links > a,
.nav-group > summary {
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 7px;
  color: #43536b;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.top-links > a.selected,
.nav-group.selected > summary {
  background: #eaf2ff;
  color: #2057ad;
}

.nav-group { position: relative; }
.nav-group > summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-2px);
}
.nav-group[open] > summary::after { transform: rotate(225deg) translate(-1px, -1px); }
.nav-group-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 5px);
  left: 0;
  display: grid;
  min-width: 205px;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--linha);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 30px rgba(31, 41, 55, .14);
}
.nav-menu-end { right: 0; left: auto; }
.nav-group-menu a {
  display: block;
  padding: 10px 11px;
  border-radius: 7px;
  color: #43536b;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
}
.nav-group-menu a:hover,
.nav-group-menu a.selected { background: #f0f6ff; color: #2057ad; }
.nav-logout { margin: 0 0 0 auto; }
.nav-logout button { height: auto; min-height: 38px; padding: 7px 12px; border: 0; background: transparent; color: #a63240; font-size: 12px; }

.legal-banner {
  margin: 0 0 16px;
  padding: 8px 12px;
  border: 1px solid #f0dfb8;
  border-left: 4px solid #d69a25;
  border-radius: 9px;
  background: #fffaf0;
  color: #66511f;
}
.legal-banner summary {
  cursor: pointer;
  list-style: none;
  color: #705317;
  font-size: 12px;
  line-height: 1.45;
}
.legal-banner summary::-webkit-details-marker { display: none; }
.legal-banner summary::after { content: "＋"; float: right; font-weight: 800; }
.legal-banner[open] summary::after { content: "−"; }
.legal-banner p { margin: 7px 20px 2px 0; color: #66511f; font-size: 12px; line-height: 1.55; }

.titulo h1 { line-height: 1.15; }
.titulo p { max-width: 850px; line-height: 1.5; }
.painel h2 { line-height: 1.35; }
.painel > p.help { max-width: 1050px; line-height: 1.55; }
.tabela th { font-size: 12px; }
.tabela td { font-size: 13px; }
.tabela td small { display: block; margin-top: 4px; font-size: 11px; letter-spacing: 0; line-height: 1.4; }

.new-employee { padding: 0; overflow: visible; }
.new-employee > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
  list-style: none;
}
.new-employee > summary::-webkit-details-marker { display: none; }
.new-employee > summary > span:first-child { display: grid; gap: 3px; }
.new-employee > summary b { font-size: 15px; }
.new-employee > summary small { color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; }
.new-employee[open] > summary { border-bottom: 1px solid var(--linha); }
.new-employee > form { padding: 0 16px 4px; }
.new-employee > .help { margin: 10px 16px 16px; }

.team-list { padding: 0; overflow: visible; }
.team-list-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 16px;
  border-bottom: 1px solid var(--linha);
}
.team-list-head h2 { margin: 0; }
.team-list-head p { margin: 4px 0 0; font-size: 12px; }
.team-search { display: grid; gap: 5px; width: min(340px, 42%); color: #53647b; font-size: 11px; font-weight: 700; }
.team-search input { width: 100%; min-height: 40px; }
.team-table-wrap { padding: 0 12px 12px; overflow: visible; }
.team-table { min-width: 0 !important; }
.team-table th, .team-table td { padding: 11px 9px; }
.team-table td:first-child b { font-size: 13px; }
.row-menu { position: relative; width: max-content; max-width: 100%; }
.row-menu > summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--linha);
  border-radius: 7px;
  background: #fff;
  color: #35465e;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  list-style: none;
}
.row-menu > summary::-webkit-details-marker { display: none; }
.row-menu-options {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  right: 0;
  display: grid;
  min-width: 170px;
  gap: 3px;
  padding: 6px;
  border: 1px solid var(--linha);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 10px 25px rgba(31, 41, 55, .13);
}
.row-menu-options a,
.row-menu-options button {
  display: block;
  width: 100%;
  height: auto;
  min-height: 36px;
  padding: 8px 9px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #34445a;
  font: inherit;
  font-size: 12px;
  text-align: left;
  text-decoration: none;
}
.row-menu-options a:hover,
.row-menu-options button:hover { background: #f0f6ff; }
.row-menu-options form { margin: 0; }

.form-grid.cols.calendar-event-form {
  grid-template-columns: minmax(140px, .85fr) minmax(200px, 1.3fr) minmax(170px, 1fr) minmax(250px, 1.25fr) minmax(130px, auto);
  align-items: end;
}
.form-grid.cols.calendar-event-form label.calendar-close-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  justify-content: start;
  gap: 9px;
  min-height: 40px;
  color: #52627a;
  font-size: 12px;
  line-height: 1.4;
}
.form-grid.cols.calendar-event-form .calendar-close-check input {
  width: 18px;
  height: 18px;
  margin: 0;
}
.form-grid.cols.calendar-event-form > button { width: 100%; }

.section-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.section-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #d7e4f5;
  border-radius: 99px;
  background: #fff;
  color: #315b91;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.section-nav a:hover { background: #f0f6ff; }
.settings-section { scroll-margin-top: 16px; }
.settings-section > h2 { padding-bottom: 9px; border-bottom: 1px solid #edf1f6; }

.report-section { margin-bottom: 16px; }
.report-section .cards.compact { grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); }
.report-section .cards article { padding: 14px; }
.report-section .cards strong { font-size: clamp(20px, 1.5vw, 26px); }
.report-section h3 { margin: 18px 0 8px; font-size: 14px; }
.report-section .help { font-size: 12px; line-height: 1.55; }

.closure-strip {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(250px, 1.2fr);
  align-items: center;
  gap: 14px;
  margin: 14px 0;
  padding: 13px 15px;
  border: 1px solid #d7e4f3;
  border-radius: 12px;
  background: #f5f9ff;
}
.closure-strip > div { display: grid; gap: 4px; min-width: 0; }
.closure-strip > div > b { color: #23466f; }
.closure-strip small { color: #63738a; line-height: 1.45; }
.closure-strip.closure-stale { border-color: #e6c77a; background: #fff9e8; }
.closure-form { display: grid; grid-template-columns: minmax(150px, 1fr) auto; align-items: end; gap: 8px; }
.closure-form label, .closeout-actions label, .request-review-form label { min-width: 0; }
.closure-form input, .closeout-actions input, .request-review-form input { width: 100%; }
.status-chip { display: inline-flex; align-items: center; width: fit-content; padding: 6px 10px; border-radius: 999px; background: #e9f7ef; color: #17623a; font-size: 12px; font-weight: 700; }
.status-chip-warning { background: #fff0d0; color: #805a08; }
.calc-detail { margin-top: 8px; max-width: 500px; }
.calc-detail summary, .request-change summary { color: #31577f; cursor: pointer; font-size: 11px; font-weight: 700; }
.calc-detail p { margin: 6px 0 0; max-width: 440px; white-space: normal; line-height: 1.5; }
.request-change { margin-top: 8px; }
.request-change form, .request-review-form { display: grid; gap: 8px; min-width: 230px; max-width: 320px; margin-top: 8px; }
.request-change textarea { min-height: 64px; resize: vertical; }
.closeout-actions { min-width: 210px; }
.closeout-actions form { display: grid; gap: 7px; margin-top: 8px; }
.request-review-form .actions { display: flex; flex-wrap: wrap; gap: 6px; }
.request-review-form button { min-height: 36px; padding: 7px 10px; font-size: 12px; }

@media (min-width: 1800px) {
  .top-links > a, .nav-group > summary, .nav-group-menu a { font-size: 14px; }
  .tabela th { font-size: 13px; }
  .tabela td { font-size: 14px; }
}

@media (max-width: 1024px) {
  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "user menu" "brand brand" "links links";
    gap: 7px 10px;
  }
  .top-brand { display: block; text-align: left; }
  .menu-toggle {
    grid-area: menu;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 7px 11px;
  }
  .top-links { display: none; border-top: 1px solid #edf1f6; padding-top: 8px; }
  .top-links.aberto { display: flex; }
  .nav-group-menu { min-width: 190px; }
  .form-grid.cols.calendar-event-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .closure-strip { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 700px) {
  .app-shell { padding: 10px 10px max(18px, env(safe-area-inset-bottom)); }
  .topbar { padding: 10px; }
  .top-user { flex-wrap: wrap; }
  .top-user b { max-width: min(62vw, 280px); }
  .top-links.aberto { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .top-links > a, .nav-group > summary { width: 100%; justify-content: space-between; }
  .nav-group-menu, .nav-menu-end {
    position: static;
    min-width: 0;
    width: 100%;
    margin: 3px 0 4px;
    box-shadow: none;
    border-color: #e8edf4;
    background: #fbfcfe;
  }
  .nav-logout { margin: 2px 0 0; }
  .nav-logout button { width: 100%; text-align: left; }
  .cards:not(.compact) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid.cols.calendar-event-form { grid-template-columns: minmax(0, 1fr); }
  .report-filters { display: grid; grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .report-filters > label { width: 100%; min-width: 0; }
  .report-filters input, .report-filters select { width: 100%; }
  .report-filters > button, .report-filters > .button-link { width: 100%; justify-content: center; }
  .legal-banner { padding: 8px 10px; }
  .new-employee > summary { align-items: flex-start; padding: 13px 12px; }
  .new-employee > summary .btn { white-space: normal; text-align: center; }
  .new-employee > form { padding: 0 12px 4px; }
  .new-employee > .help { margin-inline: 12px; }
  .team-list-head { align-items: stretch; flex-direction: column; padding: 13px 12px; gap: 11px; }
  .team-search { width: 100%; }
  .team-table-wrap { padding: 0 10px 10px; }
  .team-table { display: block; width: 100%; }
  .team-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
  .team-table tbody { display: grid; gap: 9px; }
  .team-table tr[data-employee] {
    display: grid;
    gap: 0;
    padding: 5px 10px;
    border: 1px solid var(--linha);
    border-radius: 10px;
    background: #fff;
  }
  .team-table tr[data-employee] td {
    display: grid;
    grid-template-columns: minmax(82px, 29%) minmax(0, 1fr);
    gap: 8px;
    padding: 8px 2px;
    border-bottom: 1px solid #edf1f6;
    font-size: 13px;
  }
  .team-table tr[data-employee] td:last-child { border-bottom: 0; }
  .team-table tr[data-employee] td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 750;
  }
  .row-menu { width: 100%; }
  .row-menu > summary { width: max-content; }
  .row-menu-options { position: static; width: 100%; margin-top: 5px; box-shadow: none; }
  .team-table tr:not([data-employee]) td { display: block; min-width: 0; }
  .section-nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
  .section-nav a { justify-content: center; text-align: center; }
  .report-section .cards.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-section .cards article { padding: 11px; }
  .report-section .cards strong { font-size: 20px; }
  .closure-strip { padding: 11px; }
  .closure-form { grid-template-columns: minmax(0, 1fr); }
  .closure-form button { width: 100%; }
  .request-change form, .request-review-form { min-width: 210px; }
}

@media (max-width: 420px) {
  .top-user b { max-width: 55vw; }
  .new-employee > summary { flex-direction: column; }
  .new-employee > summary .btn { width: 100%; }
  .report-section .cards.compact { grid-template-columns: 1fr 1fr; }
  .report-section .cards span { font-size: 11px; }
}

@media print {
  .topbar, .legal-banner, .section-nav, .new-employee { display: none !important; }
  .tabela th, .tabela td { font-size: 8px; }
}
