/* Montuori Control — tema premium escuro. Sem bibliotecas ou recursos externos. */
:root {
  color-scheme: dark;
  --bg: #071923;
  --bg-deep: #06131c;
  --sidebar: #071923;
  --panel: #102935;
  --panel-strong: #143340;
  --panel-hover: #183c4a;
  --ink: #eef8fa;
  --muted: #c0d3da;
  --muted-subtle: #a1bbc6;
  --line: #31515e;
  --line-soft: #254450;
  --terra: #087f7b;
  --terra2: #106d6b;
  --green: #6ef0d5;
  --red: #ffa4a5;
  --amber: #ffd18a;
  --blue: #9bdcff;
  --gold: #e7b77f;
  --shadow: 0 16px 42px rgb(0 8 15 / 23%);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: radial-gradient(ellipse at 80% 0%, #153542 0%, transparent 42%),
              linear-gradient(145deg, var(--bg) 0%, #091f2a 60%, #071820 100%);
  background-attachment: fixed;
  color: var(--ink);
  font: 14px/1.55 Inter, "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid transparent; border-radius: 10px; padding: 10px 14px; background: var(--terra); color: #fff; font-weight: 680; transition: background .17s ease, border-color .17s ease, transform .17s ease; }
button:hover { background: var(--terra2); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: #1a3846; color: var(--ink); border-color: var(--line); }
button.secondary:hover { background: #264b59; }
button.ghost { background: #102c39; color: #c5f4f0; border-color: var(--line); }
button.ghost:hover { background: #1b4955; border-color: #58958e; }
button.danger { background: #483137; color: #ffb6b4; border-color: #875158; }
button.danger:hover { background: #693c43; }
button.small-btn { padding: 7px 10px; font-size: 12px; }
button.full { width: 100%; }
.primary { background: var(--terra); }
input, select, textarea { width: 100%; border: 1px solid #49636e; border-radius: 10px; padding: 10px 12px; background: #0a202c; color: var(--ink); }
input::placeholder, textarea::placeholder { color: #97adb8; opacity: 1; }
select option { background: #102936; color: #f3f9fb; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible,
[tabindex="-1"]:focus-visible { outline: 3px solid #7bead8; outline-offset: 3px; }
input[type=checkbox] { width: 19px; height: 19px; accent-color: #45d9c8; cursor: pointer; flex-shrink: 0; }
input[type=month], input[type=date] { color-scheme: dark; }
label { display: block; font-size: 12px; font-weight: 690; }
label input, label select, label textarea { margin-top: 6px; }
textarea { min-height: 85px; resize: vertical; }
.error-message { color: #ffb0af; font-size: 13px; padding-top: 8px; min-height: 21px; }
[hidden] { display: none !important; }

/* Aplicação: menu lateral permanente, cabeçalho e conteúdo independentes. */
#appShell {
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr);
  min-height: 100vh;
  max-width: 2000px;
  margin: 0 auto;
}
.sticky-head, .workspace { display: contents; }
.sidebar {
  position: sticky;
  top: 0;
  grid-column: 1;
  grid-row: 1 / 4;
  min-width: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 15px 24px;
  background: linear-gradient(162deg, #07141c 0%, #08212c 65%, #071820 100%);
  border-right: 1px solid #224450;
  isolation: isolate;
  overflow-y: auto;
}
.sidebar::before { content: ""; position: absolute; z-index: -1; pointer-events: none; inset: 0; background: radial-gradient(circle at -30% 78%, rgb(18 134 121 / 13%), transparent 52%); }
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 34px; }
.mark, .logo-big {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 12px;
  color: #e6fcfd;
  border: 1px solid #558e96;
  background: linear-gradient(145deg, #265b67, #102c39 62%, #0a2330);
  box-shadow: inset 0 1px 10px #7cffff1c, 0 6px 24px #0003;
  font-size: 25px; font-weight: 800;
  letter-spacing: -.05em;
}
.brand-title { font-size: 16px; font-weight: 820; letter-spacing: .03em; line-height: 1.08; }
.brand-subtitle { font-size: 8.5px; font-weight: 690; letter-spacing: .09em; color: #9dbcc4; margin-top: 8px; line-height: 1.45; }
.sidebar-section { font-size: 10px; letter-spacing: .18em; font-weight: 800; color: #94b7c0; margin: 3px 12px 13px; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; }
.sidebar nav button {
  display: flex; gap: 12px; align-items: center;
  border-radius: 12px; padding: 12px 13px;
  min-height: 49px; width: 100%;
  color: #c5d8de; text-align: left;
  background: transparent; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 620;
  white-space: nowrap;
}
.sidebar nav button svg { width: 19px; height: 19px; flex: 0 0 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sidebar nav button:hover { color: #f5ffff; background: #173540; }
.sidebar nav button.active {
  color: #dffffb;
  background: linear-gradient(105deg, #115b59 0%, #0d363f 88%);
  border-color: #48c9bd;
  box-shadow: inset 0 1px 0 #94fef421, 0 3px 18px #0ab7aa27;
  font-weight: 750;
}
.sidebar-note { margin: auto 9px 0; padding: 20px 4px 0; color: var(--muted); border-top: 1px solid var(--line-soft); font-size: 12px; }
.sidebar-note strong { color: var(--ink); font-weight: 730; }
.sidebar-note p { margin: 7px 0 0; font-size: 11px; color: #a4bec8; }
.sidebar-foot-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #54d9ae; box-shadow: 0 0 12px #25c89a6e; margin-right: 6px; }
.topbar {
  grid-column: 2; grid-row: 1;
  min-width: 0;
  padding: 18px clamp(18px, 2.5vw, 35px);
  display: flex; align-items: center; justify-content: space-between; gap: 18px;
  border-bottom: 1px solid #284651;
}
.topbar-context { display: flex; gap: 8px; flex-direction: column; min-width: 0; }
.topbar-overline { font-size: 10px; color: #98bfc6; font-weight: 750; letter-spacing: .13em; }
.topbar-overline span { padding: 0 5px; color: var(--gold); }
.topbar-place { font-weight: 710; color: #e9f5f6; font-size: 13.5px; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.user-chip { display: flex; align-items: center; gap: 8px; white-space: nowrap; font-size: 12px; color: #dbeff0; padding-right: 8px; }
.user-avatar { width: 32px; height: 32px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #eafffb; border: 1px solid #4f9191; background: #1c5054; border-radius: 50%; }
.top-btn { background: #142f3c; border: 1px solid var(--line); color: #cfdee4; font-size: 11px; padding: 8px 10px; }
.top-btn:hover { background: #224857; }
.summary-shell { position: relative; isolation: isolate; grid-column: 2; grid-row: 2; min-width: 0; padding: 30px clamp(18px, 2.5vw, 35px) 22px; overflow: hidden; }
.summary-shell::before { content: ""; position: absolute; z-index: -1; width: 74%; height: 220px; right: -8%; top: -125px; border-radius: 50%; transform: rotate(-8deg); border-bottom: 1px solid #43d8ca51; box-shadow: 0 20px 65px #13c4bc0a; pointer-events: none; }
.welcome { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 26px; }
.welcome-copy { padding-left: 17px; border-left: 2px solid var(--gold); min-width: 0; }
.eyebrow { font-size: 10px; letter-spacing: .19em; font-weight: 820; text-transform: uppercase; color: #63e3d1; }
.welcome h2 { font-size: clamp(24px, 2.5vw, 35px); line-height: 1.2; font-weight: 790; margin: 8px 0 9px; letter-spacing: -.028em; }
.welcome h2 em { font-style: normal; color: var(--gold); }
.welcome p { color: #c1d4db; font-size: 13.5px; line-height: 1.55; margin: 0; max-width: 640px; }
.welcome-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.monthbox { color: #d5e8eb; background: #102936; border: 1px solid #406773; padding: 9px 12px; border-radius: 12px; font-size: 11.5px; white-space: nowrap; }
.monthbox input { width: 145px; padding: 3px 0 0; margin: 0; border: 0; background: transparent; color: #ecfafa; font-size: 13px; font-weight: 760; }
.welcome-new-task { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; border-color: #41d4c4; box-shadow: 0 0 16px #14baaa1c; }
.welcome-new-task span { font-size: 20px; line-height: 1; }
.metrics { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.metric {
  min-width: 0; min-height: 148px; padding: 17px;
  text-align: left; color: var(--ink);
  background: linear-gradient(143deg, #173944 0%, #0c2631 100%);
  border: 1px solid #3a6370; border-radius: 16px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: flex-start;
}
.metric:first-child, .metric:last-child { background: linear-gradient(150deg, #154747 0%, #0b2c34 75%); border-color: #317c79; }
.metric.metric-alert { background: linear-gradient(148deg, #343636 0%, #162b32 100%); border-color: #9c7651; }
.metric:hover { background: linear-gradient(145deg, #225663 0%, #17343f 100%); border-color: #66bdba; }
.metric-icon { font-size: 23px; line-height: 1; margin-bottom: 14px; color: #77e5d9; }
.metric-alert .metric-icon { color: var(--amber); }
.metric .label { color: #e0eff0; font-size: 13px; font-weight: 710; line-height: 1.4; min-height: 29px; }
.metric strong { color: #fff; font-size: 34px; font-weight: 800; line-height: 1.12; letter-spacing: -.035em; margin: 6px 0; font-variant-numeric: tabular-nums; }
.metric small { display: block; color: #c5d9df; font-size: 12px; line-height: 1.4; }
.main { grid-column: 2; grid-row: 3; min-width: 0; min-height: 450px; padding: 4px clamp(18px, 2.5vw, 35px) 40px; }

/* Navegação secundária compacta: disponível somente no celular. */
.mobile-more-toggle, .mobile-more-panel { display: none; }

/* Componentes compartilhados em todas as telas. */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; }
.toolbar h3 { margin: 0; color: #f6fbfd; font-size: 24px; font-weight: 760; letter-spacing: -.02em; }
.toolbar p { color: var(--muted); font-size: 12px; margin: 5px 0 0; }
.controls { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.controls input { width: min(300px, 85vw); }
.controls select { width: auto; min-width: 155px; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin: 18px 0; }
.kpi { padding: 16px; text-align: left; color: var(--ink); border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(150deg, #163743, #0f2935); }
.kpi:hover { background: #1b4653; }
.kpi small { display: block; color: #b9cbd3; font-size: 11px; }
.kpi b { display: block; font-size: 29px; margin: 4px 0; color: #f4feff; }
.section-title { color: #e8f6fa; font-weight: 780; font-size: 14px; margin: 20px 0 10px; }
.section-actions { display: flex; gap: 9px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-top: 19px; }
.tasklist { display: grid; gap: 9px; }
.task { display: grid; grid-template-columns: 22px minmax(0,1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line-soft); border-radius: 12px; padding: 12px 13px; background: linear-gradient(150deg, #13323e, #0d2732); min-width: 0; }
.task:hover { border-color: #4c8290; background: #183946; }
.task-title { color: #eef8fa; font-size: 14px; font-weight: 700; line-height: 1.4; overflow-wrap: anywhere; }
.task-title.done { text-decoration: line-through; color: #a7b9c4; }
.task-meta { font-size: 12px; color: #b9cfd7; margin-top: 5px; line-height: 1.4; overflow-wrap: anywhere; }
.task-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.pill { display: inline-flex; align-items: center; border: 1px solid #496571; border-radius: 999px; padding: 3px 9px; font-size: 10px; font-weight: 760; background: #263e49; color: #e2f2f4; margin: 2px; white-space: nowrap; }
.pill.done { background: #16443c; color: #aafbe0; border-color: #328f77; }
.pill.progress { background: #514027; color: #ffe3ab; border-color: #886838; }
.pill.wait { background: #1b3c53; color: #b7e8ff; border-color: #386f96; }
.pill.late { background: #502f35; color: #ffc0bd; border-color: #98565b; }
.empty { text-align: center; padding: 24px 16px; background: #102b36; border: 1px dashed #45646c; color: #c2d5dc; border-radius: 12px; }
.notice { background: #3a342b; border-left: 3px solid #e9bc75; color: #ffe2ba; border-radius: 0 10px 10px 0; padding: 13px 14px; font-size: 12px; margin: 10px 0 14px; }
.notice.critical { background: #472d33; border-color: #e68086; color: #ffd5d1; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #102b36; }
table { width: 100%; min-width: 700px; border-collapse: collapse; }
thead { background: #1c3b47; }
th { text-align: left; color: #bfd6df; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; padding: 13px; }
td { border-top: 1px solid var(--line-soft); padding: 13px; font-size: 12px; vertical-align: middle; color: #e5f1f4; }
tbody tr:hover { background: #20404a; }
.small { font-size: 12px; color: #adc7d0; }
.company-name { font-weight: 790; font-size: 13px; color: #f3ffff; }
.detail-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.detail-head h3 { margin: 5px 0 0; font-size: 23px; letter-spacing: -.025em; }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin: 17px 0; }
.info { padding: 15px; border-radius: 12px; border: 1px solid var(--line); background: #112e39; min-width: 0; }
.info small { display: block; color: #aec7d1; font-size: 11px; }
.info b { display: block; color: #f1ffff; margin-top: 5px; overflow-wrap: anywhere; }
.rule-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #12313e; border: 1px solid var(--line); padding: 14px 16px; border-radius: 12px; margin-bottom: 8px; }
.rule-row.inactive { background: #102834; border-color: #38515a; }
.rule-row strong { display: block; overflow-wrap: anywhere; color: #effafc; }
.rule-row .rule-sub { color: #acc5ce; font-size: 11px; margin-top: 5px; }
.rule-row .rule-buttons { display: flex; gap: 8px; flex-wrap: wrap; flex-shrink: 0; }
.rule-closed { display: inline-block; color: #ffd59b; font-weight: 760; margin-left: 5px; }
.progress-line { height: 7px; border-radius: 999px; background: #2a4855; overflow: hidden; margin-bottom: 3px; }
.progress-line span { display: block; background: #40cfb6; height: 100%; }
.hint { color: #afc4cb; font-size: 11px; line-height: 1.55; }
.separator { border: none; border-top: 1px solid var(--line); margin: 22px 0; }

/* Nova visão geral: prioridades primeiro e detalhe útil ao lado. */
.dashboard-grid { display: grid; grid-template-columns: minmax(0,1.65fr) minmax(290px,.9fr); gap: 16px; align-items: start; }
.dashboard-panel {
  min-width: 0;
  background: linear-gradient(153deg, #14323e 0%, #0a2330 100%);
  border: 1px solid #3a6070; border-radius: 17px;
  padding: clamp(16px, 1.8vw, 22px); box-shadow: var(--shadow);
}
.dashboard-panel-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 9px; margin-bottom: 16px; }
.dashboard-panel-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.panel-icon { display: grid; place-items: center; width: 37px; height: 37px; flex-shrink: 0; border-radius: 11px; color: #9cf8e8; background: linear-gradient(145deg, #1c6e6b, #12414d); font-size: 22px; }
.dashboard-panel h4 { margin: 0; font-size: 19px; line-height: 1.3; font-weight: 760; color: #f2fcff; }
.dashboard-panel-description { margin-top: 3px; font-size: 12px; line-height: 1.45; color: #c3d9e0; }
.dashboard-link { color: #8af3e1; font-size: 13px; padding: 7px 0; background: transparent; border: none; }
.dashboard-link:hover { background: transparent; color: #dbffff; text-decoration: underline; }
.dashboard-filters { display: flex; gap: 7px; flex-wrap: wrap; margin: 0 0 15px; }
.dashboard-filters button { border: 1px solid var(--line); color: #d4e8ec; background: #122b37; font-size: 11.5px; padding: 8px 11px; }
.dashboard-filters button:hover { background: #25505c; }
.dashboard-filters button.active { color: #ebfffd; border-color: #40dacc; background: #125c5d; box-shadow: 0 0 12px #2bcbb228; }
.deadline-group { border: 1px solid var(--line-soft); border-left: 3px solid #2fbdb6; border-radius: 11px; overflow: hidden; margin-bottom: 10px; }
.deadline-group.late { border-left-color: #ff8f95; }
.deadline-group.today { border-left-color: #ebbc73; }
.deadline-group.finished { border-left-color: #58d3b5; }
.deadline-group-heading { padding: 10px 13px; background: #203b48; color: #aef1eb; font-size: 13px; font-weight: 760; }
.deadline-group.late .deadline-group-heading { background: #3d3038; color: #ffd0cf; }
.deadline-group.today .deadline-group-heading { background: #423b2e; color: #ffe4ad; }
.deadline-group.finished .deadline-group-heading { color: #b4f9df; }
.deadline-group .tasklist { gap: 0; }
.deadline-group .task { border: 0; border-radius: 0; padding: 12px 13px; background: #0c2632; }
.deadline-group .task + .task { border-top: 1px solid #264751; }
.deadline-group .task:hover { background: #1b3a46; }
.dashboard-side { display: flex; flex-direction: column; gap: 12px; }
.focus-company { color: #b4ccd6; font-size: 12px; margin-top: 4px; }
.focus-item { display: grid; grid-template-columns: 1fr auto; gap: 13px; padding: 12px 0; align-items: baseline; border-bottom: 1px solid #2d4f5b; font-size: 13px; }
.focus-item span { color: #b0cbd2; }
.focus-item strong { font-weight: 730; color: #f1fafc; text-align: right; overflow-wrap: anywhere; }
.focus-item strong.focus-late { color: #ffb7b7; }
.focus-rule { margin-top: 18px; padding: 15px 0 0; border-top: 1px solid #375966; }
.focus-rule-title { font-size: 13px; font-weight: 780; color: #d3f8f0; }
.focus-rule p { font-size: 12px; color: #b5cbd3; }
.focus-rule .rule-closed { margin-left: 0; }
.focus-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 15px; }
.focus-buttons button { flex: 1; }
.focus-empty { color: #bbd3db; font-size: 12px; margin: 10px 0; }

/* Catálogo, formulários e feedback. */
.catalog-row { overflow-wrap: anywhere; }
.catalog-row .rule-buttons { flex-shrink: 0; }
.catalog-fieldset { min-width: 0; margin: 14px 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.catalog-fieldset legend { padding: 0 5px; font-size: 12px; font-weight: 780; color: #dceef1; }
.catalog-regimes { display: grid; grid-template-columns: repeat(auto-fit,minmax(145px,1fr)); gap: 8px 12px; }
.catalog-check, .catalog-regimes label { display: flex; align-items: center; gap: 8px; }
.catalog-check input, .catalog-regimes input { flex-shrink: 0; margin: 0; }
.catalog-statuses { margin-bottom: 14px; }
.catalog-statuses button { flex-shrink: 0; }
#companyTasks, .rule-row[id] { scroll-margin-top: 2rem; }
.modal-back { position: fixed; inset: 0; z-index: 30; padding: 15px; background: rgb(2 12 19 / 78%); backdrop-filter: blur(7px); display: flex; align-items: center; justify-content: center; }
.modal { width: min(580px,100%); max-height: 92dvh; overflow-y: auto; background: linear-gradient(148deg,#163b48,#0d2936); border: 1px solid #4b7781; border-radius: 17px; padding: 24px; box-shadow: 0 28px 80px #0009; }
.modal h3 { margin: 0 0 8px; color: #f5faff; font-size: 23px; font-weight: 790; }
.modal .subtitle { margin: 0 0 16px; color: #c1d3da; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 20px; }
.toast { position: fixed; z-index: 40; right: 18px; bottom: 18px; max-width: min(440px,calc(100vw - 30px)); background: #1b4a4b; color: #fff; border: 1px solid #5db1aa; box-shadow: 0 18px 40px #0007; padding: 13px 18px; border-radius: 11px; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(430px,100%); border: 1px solid #3e6875; border-radius: 20px; background: linear-gradient(150deg,#163543,#0b2532); box-shadow: var(--shadow); padding: 34px; }
.login-card .logo-big { width: 55px; height: 55px; font-size: 33px; }
.login-card h1 { margin: 18px 0 8px; font-weight: 810; font-size: 26px; }
.login-card p { color: #bed0d8; margin: 0 0 19px; }
.login-card label { margin-top: 15px; }
.login-card button { margin-top: 18px; }

/* Comportamento em telas menores, sem esconder as funções existentes. */
@media (max-width: 1390px) {
  .metrics { gap: 9px; }
  .metric { padding: 13px; }
  .metric strong { font-size: 29px; }
  .dashboard-grid { grid-template-columns: minmax(0,1.5fr) minmax(270px,.9fr); }
}
@media (max-width: 1150px) {
  #appShell { grid-template-columns: 205px minmax(0,1fr); }
  .sidebar { padding-inline: 9px; }
  .sidebar-brand { gap: 8px; }
  .brand-title { font-size: 14px; }
  .metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-side { display: block; }
  .focus-buttons button { flex: none; }
}
@media (max-width: 760px) {
  #appShell { display: block; padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .topbar { padding: 13px 17px; gap: 8px; }
  .topbar-overline { font-size: 9px; letter-spacing: .06em; }
  .topbar-place { font-size: 12.5px; }
  .top-actions { gap: 5px; }
  .top-btn { font-size: 10px; padding: 7px 8px; }
  .user-chip { padding: 0; }
  #userLabel { display: none; }
  .summary-shell { padding: 23px 16px 18px; }
  .summary-shell::before { width: 90%; }
  .welcome { align-items: stretch; flex-direction: column; gap: 14px; margin-bottom: 22px; }
  .welcome h2 { font-size: clamp(23px, 6.2vw, 30px); line-height: 1.22; }
  .welcome-actions { justify-content: space-between; gap: 9px; }
  .metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-auto-flow: row; gap: 9px; overflow: visible; padding: 0; }
  .metrics .metric:last-child { grid-column: 1 / -1; }
  .metric { min-height: 128px; }
  .metrics .metric:last-child { min-height: 115px; }
  .metric-icon { margin-bottom: 8px; }
  .metric strong { font-size: 28px; }
  .main { padding: 4px 16px 22px; }
  .sidebar {
    z-index: 20; position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    height: auto; min-height: 75px; padding: 8px 8px calc(9px + env(safe-area-inset-bottom));
    border: 1px solid #366272; border-bottom: 0; border-radius: 18px 18px 0 0;
    box-shadow: 0 -12px 40px #0008; overflow: visible;
    background: #0b2632;
    display: grid; grid-template-columns: minmax(0,4fr) minmax(0,1fr); align-items: stretch; gap: 5px;
  }
  .sidebar-brand, .sidebar-section, .sidebar-note { display: none; }
  .sidebar nav { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; min-width: 0; overflow: visible; }
  .sidebar nav button { width: 100%; min-width: 0; min-height: 57px; padding: 6px 2px; display: flex; flex-direction: column; justify-content: center; gap: 4px; text-align: center; font-size: 10.5px; white-space: normal; line-height: 1.2; }
  .sidebar nav button svg { width: 18px; height: 18px; flex-basis: 18px; }
  .sidebar nav button[data-view="catalog"],
  .sidebar nav button[data-view="history"],
  .sidebar nav button[data-view="settings"] { display: none; }
  .mobile-more-toggle { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; width: 100%; min-height: 57px; padding: 6px 2px; border-radius: 12px; background: transparent; color: #c5d8de; font-size: 10.5px; line-height: 1.2; }
  .mobile-more-toggle:hover, .mobile-more-toggle.active, .mobile-more-toggle[aria-expanded="true"] { color: #dffffb; background: linear-gradient(105deg,#115b59,#0d363f); border-color: #48c9bd; }
  .mobile-more-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
  .mobile-more-panel { position: absolute; bottom: calc(100% + 7px); right: 8px; left: 8px; z-index: 2; display: grid; gap: 6px; padding: 12px; border: 1px solid #4b8890; border-radius: 14px; background: #102e3a; box-shadow: 0 -10px 35px #0009; max-height: min(50vh,300px); overflow-y: auto; }
  .mobile-more-panel button { text-align: left; background: #193c49; color: #e8f6f8; border: 1px solid #426672; padding: 12px 14px; }
  .mobile-more-panel button.active { background: #125a5b; border-color: #4ccac1; }
  .dashboard-panel { padding: 16px; }
  .dashboard-panel-heading { align-items: flex-start; }
  .toolbar h3 { font-size: 22px; }
  .info-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .toast { bottom: calc(100px + env(safe-area-inset-bottom)); }
}
@media (max-width: 510px) {
  .top-actions .top-btn:first-of-type { display: none; } /* O backup continua em Configurações. */
  .monthbox { font-size: 11.5px; padding: 7px 10px; }
  .monthbox input { width: 135px; font-size: 12.5px; }
  .welcome-new-task { padding: 9px 11px; font-size: 12.5px; }
  .kpis { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .kpis .kpi:last-child { grid-column: 1 / -1; }
  .task { grid-template-columns: 22px minmax(0,1fr); gap: 10px; }
  .task-actions { grid-column: 2; justify-content: flex-start; }
  .rule-row { flex-direction: column; align-items: flex-start; }
  .rule-row .rule-buttons { width: 100%; }
  .rule-row .rule-buttons button { flex: 1; }
  .controls input { width: 100%; }
  .form-grid, .info-grid { grid-template-columns: 1fr; }
  .modal { padding: 17px; }
  .focus-item { grid-template-columns: 1fr auto; }
  .dashboard-filters { gap: 5px; }
  .dashboard-filters button { font-size: 11px; padding: 7px 9px; }
}
/* Ajustes de leitura e respiro em celulares estreitos (320–360 px). */
@media (max-width: 360px) {
  .summary-shell { padding-inline: 12px; }
  .metrics { gap: 8px; }
  .metric { padding: 12px; }
  .metric .label { font-size: 12px; }
  .metric small { font-size: 11.5px; }
  .metric strong { font-size: 26px; }
  .welcome-actions { align-items: stretch; }
  .monthbox { max-width: 100%; }
  .sidebar { gap: 2px; padding-inline: 5px; }
  .sidebar nav { gap: 2px; }
  .sidebar nav button, .mobile-more-toggle { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  button { transition: none; }
}
