:root {
  color-scheme: light dark;
  --bg: #f5f3ed;
  --panel: #ffffff;
  --panel-2: #ede8dc;
  --ink: #19201d;
  --black: #121211;
  --muted: #697069;
  --line: #d9d1c3;
  --green: #234332;
  --green-2: #16271f;
  --gold: #c49336;
  --red: #a33a32;
  --blue: #2f5f84;
  --olive: #6c7549;
  --shadow: 0 18px 45px rgba(25, 32, 29, .12);
  --radius: 8px;
  /* Semantic aliases used throughout the app */
  --accent:   var(--green);
  --surface:  var(--panel);
  --surface-2: var(--panel-2);
  --text-1:   var(--ink);
  --text-2:   var(--muted);
  --border:   var(--line);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

/* Evita zoom automático do iOS Safari em inputs com font-size < 16px */
@media (max-width: 768px) {
  input, textarea, select {
    font-size: 16px !important;
  }
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 284px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 28px;
  height: 100vh;
  padding: 24px 18px;
  color: #f8f5ec;
  background:
    linear-gradient(145deg, rgba(196, 147, 54, .18), transparent 36%),
    linear-gradient(180deg, var(--green), var(--green-2) 58%, var(--black));
}

.brand {
  display: grid;
  grid-template-columns: 78px 1fr;
  align-items: center;
  gap: 14px;
  min-height: 86px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}

.brand-mark {
  width: 76px;
  height: 76px;
  object-fit: contain;
  padding: 4px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  box-shadow: inset 0 0 0 1px rgba(242, 198, 90, .3);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, .32));
}

.brand strong {
  display: block;
  font-size: 1.35rem;
}

.brand span {
  display: block;
  color: rgba(248, 245, 236, .74);
  font-size: .86rem;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  width: 100%;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: rgba(248, 245, 236, .84);
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  border-color: rgba(242, 198, 90, .32);
  background: rgba(0, 0, 0, .24);
}

.nav-item.active {
  border-left-color: rgba(242, 198, 90, .75);
  border-left-width: 3px;
  padding-left: 12px;
  font-weight: 600;
}

.side-note {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, .24);
}

.side-note p {
  margin: 8px 0 0;
  color: rgba(248, 245, 236, .72);
  font-size: .88rem;
}

.side-note-action {
  margin-top: 10px;
  width: 100%;
  justify-content: center;
  font-size: .78rem;
  color: rgba(248, 245, 236, .55);
  border-color: rgba(255,255,255,.12);
  padding: 5px 8px;
}
.side-note-action:hover { color: rgba(248, 245, 236, .9); border-color: rgba(255,255,255,.3); }

.profile-control {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: rgba(248, 245, 236, .68);
  font-size: .76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-control select {
  min-height: 38px;
  border-color: rgba(242, 198, 90, .28);
  color: #f8f5ec;
  background: rgba(0, 0, 0, .28);
}

.profile-control option {
  color: var(--ink);
  background: #fff;
}

.motto-lockup {
  display: grid;
  grid-template-columns: 42px 1fr;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
  color: #f8f5ec;
}

.motto-lockup img {
  width: 42px;
  height: 42px;
  object-fit: contain;
  opacity: .88;
}

.motto-lockup strong {
  display: block;
  font-size: .9rem;
  letter-spacing: .08em;
}

.motto-lockup span {
  display: block;
  color: rgba(248, 245, 236, .62);
  font-size: .78rem;
}

.label,
.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.side-note .label {
  color: rgba(242, 198, 90, .9);
}

.main {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 34px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 243, 237, .88);
  backdrop-filter: blur(12px);
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  margin-top: 6px;
  font-size: clamp(1.55rem, 2.4vw, 2.45rem);
}

h2 {
  font-size: 1.2rem;
}

h3 {
  font-size: 1rem;
}

.top-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.search {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  color: var(--ink);
  background: #fff;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.search input {
  width: min(320px, 42vw);
}

#clearSearch {
  display: none;
}

body:has(#globalSearch:not(:placeholder-shown)) #clearSearch {
  display: grid;
}

.content {
  padding: 26px 34px 38px;
}

.search-results-page {
  display: grid;
  gap: 16px;
}

.search-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 16px 40px rgba(25, 32, 29, .08);
}

.search-result-groups {
  display: grid;
  gap: 14px;
}

.search-group {
  display: grid;
  gap: 14px;
}

.search-result-list {
  display: grid;
  gap: 8px;
}

.search-result {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.search-result:hover {
  border-color: rgba(35, 67, 50, .42);
  background: #f7f8f3;
}

.search-result span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.search-result strong {
  font-size: 1rem;
}

.search-result em {
  color: var(--muted);
  font-style: normal;
  line-height: 1.35;
}

mark {
  border-radius: 3px;
  padding: 0 2px;
  color: var(--black);
  background: rgba(242, 198, 90, .42);
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  align-items: center;
  gap: 24px;
  min-height: 300px;
  padding: 30px;
  border: 1px solid rgba(217, 209, 195, .72);
  border-radius: var(--radius);
  background:
    linear-gradient(140deg, rgba(255, 255, 255, .88), rgba(248, 246, 239, .72)),
    #fff;
  box-shadow: 0 24px 70px rgba(25, 32, 29, .14);
  overflow: hidden;
}

.hero-copy h2 {
  margin-top: 8px;
  max-width: 760px;
  font-size: 2.8rem;
  line-height: 1.02;
}

.hero-copy p:not(.eyebrow) {
  max-width: 660px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.hero-emblem {
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 22px;
  border: 1px solid rgba(255, 255, 255, .64);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .44);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75);
  backdrop-filter: blur(16px);
}

.hero-emblem img {
  width: 148px;
  height: 148px;
  object-fit: contain;
  filter: drop-shadow(0 16px 24px rgba(18, 18, 17, .22));
}

.hero-emblem span {
  color: var(--green);
  font-size: .8rem;
  font-weight: 900;
  letter-spacing: .14em;
}

.dashboard-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.dashboard-metric {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 118px;
  padding: 16px;
  border: 1px solid rgba(217, 209, 195, .8);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .76);
  box-shadow: 0 12px 34px rgba(25, 32, 29, .08);
}

.dashboard-metric > span {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  color: #f8f5ec;
  background: linear-gradient(150deg, var(--green), var(--black));
  font-size: .78rem;
  font-weight: 900;
}

.dashboard-metric strong {
  display: block;
  font-size: 2.2rem;
  line-height: 1;
}

.dashboard-metric p,
.dashboard-metric em {
  display: block;
  margin: 4px 0 0;
  color: var(--muted);
  font-style: normal;
}

.dashboard-metric p {
  color: var(--ink);
  font-weight: 800;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, .65fr);
  gap: 16px;
  margin-top: 16px;
}

.today-hero,
.resources-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
  padding: 22px;
  border: 1px solid rgba(217, 209, 195, .78);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, .9), rgba(248, 246, 239, .72)),
    #fff;
  box-shadow: 0 18px 48px rgba(25, 32, 29, .1);
}

.today-hero h2,
.resources-hero h2 {
  margin-top: 6px;
  font-size: 1.7rem;
}

.today-hero p:not(.eyebrow),
.resources-hero p:not(.eyebrow) {
  max-width: 720px;
  margin: 8px 0 0;
  color: var(--muted);
}

.today-stamp {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 132px;
  padding: 14px;
  border-radius: var(--radius);
  color: #f8f5ec;
  background: linear-gradient(145deg, var(--green), var(--black));
}

.today-stamp img {
  width: 74px;
  height: 74px;
  object-fit: contain;
}

.today-stamp strong {
  letter-spacing: .1em;
}

.today-stamp span {
  color: rgba(248, 245, 236, .72);
  font-size: .8rem;
}

.today-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.today-procedures {
  margin-top: 16px;
}

.today-procedure-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.procedure-shortcut {
  display: grid;
  gap: 6px;
  min-height: 132px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
}

.procedure-shortcut:hover {
  border-color: rgba(35, 67, 50, .42);
  background: #f7f8f3;
}

.procedure-shortcut span {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 900;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.procedure-shortcut strong {
  line-height: 1.2;
}

.procedure-shortcut em {
  align-self: end;
  color: var(--green);
  font-style: normal;
  font-weight: 800;
}

/* ── Operações ── */
.op-grid { display: flex; flex-direction: column; gap: 16px; }

.op-card { display: flex; flex-direction: column; gap: 8px; }

.op-card-meta { display: flex; align-items: center; gap: 8px; flex: 1; }

.op-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.op-tipo-reforco  { background: color-mix(in srgb, #234332 15%, transparent); color: #234332; }
.op-tipo-eve      { background: color-mix(in srgb, #1a4a7a 15%, transparent); color: #1a4a7a; }
.op-tipo-op       { background: color-mix(in srgb, #8b0000 15%, transparent); color: #8b0000; }
.op-tipo-escolta  { background: color-mix(in srgb, #6b3fa0 15%, transparent); color: #6b3fa0; }
.op-tipo-rec      { background: color-mix(in srgb, #b87800 15%, transparent); color: #b87800; }
.op-tipo-ex       { background: color-mix(in srgb, #8b4513 15%, transparent); color: #8b4513; }
.op-tipo-apoio    { background: color-mix(in srgb, #2a6496 15%, transparent); color: #2a6496; }

.op-data { font-size: 0.78rem; color: var(--muted); }

.op-designacao { font-size: 1rem; font-weight: 700; margin: 0; }

.op-details { display: flex; flex-wrap: wrap; gap: 12px; }
.op-detail { font-size: 0.78rem; color: var(--muted); }

.op-descricao { font-size: 0.83rem; color: var(--text); margin: 0; line-height: 1.5; }

.op-licoes {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 10px 14px;
}
.op-licoes-label { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--accent); margin: 0 0 4px; }
.op-licoes-texto { font-size: 0.82rem; color: var(--text); margin: 0; line-height: 1.5; white-space: pre-wrap; }

/* ── Reuniões ── */
.rn-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }

.rn-item { border-bottom: 1px solid var(--border); }
.rn-item:last-child { border-bottom: none; }
.rn-item-open { background: var(--surface-alt, var(--surface)); }

.rn-header {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 14px 16px; gap: 12px;
  background: none; border: none; cursor: pointer; text-align: left;
  color: var(--text); transition: background 0.15s;
}
.rn-header:hover { background: var(--hover, rgba(0,0,0,0.04)); }
.rn-item-open .rn-header { background: var(--hover, rgba(0,0,0,0.04)); }

.rn-header-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.rn-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.rn-ref { font-weight: 700; font-size: 0.9rem; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text); }
.rn-date { font-size: 0.8rem; color: var(--text-muted); white-space: nowrap; }
.rn-chevron { font-size: 0.65rem; color: var(--text-muted); }

.rn-badge {
  display: inline-block; padding: 2px 8px; border-radius: 3px;
  font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  white-space: nowrap;
}
.rn-tipo-cmd  { background: #1a3a2a; color: #a8d5b5; }
.rn-tipo-soi  { background: #1a2a3a; color: #a8c5e8; }
.rn-tipo-coord { background: #2a1a1a; color: #e8b8a8; }
.rn-tipo-brief { background: #2a2a1a; color: #d8d0a0; }
.rn-tipo-outro { background: var(--border); color: var(--text-muted); }

.rn-ref, .rn-tl-ref {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;
  letter-spacing: 0.02em;
}

.rn-body { padding: 0 16px 16px; display: flex; flex-direction: column; gap: 16px; }

/* Cabeçalho expandido da reunião */
.rn-detail-header {
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.rn-detail-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rn-detail-date {
  font-size: 0.78rem; color: var(--text-muted);
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
}

.rn-section { display: flex; flex-direction: column; gap: 8px; }
.rn-section-label {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--accent); margin: 0;
  display: flex; align-items: center; gap: 8px;
}
.rn-section-label::after {
  content: ""; flex: 1; height: 1px; background: var(--border); opacity: 0.6;
}
.rn-section-text {
  font-size: 0.83rem; line-height: 1.6; color: var(--text); margin: 0;
  white-space: pre-wrap;
}
.rn-section-acoes { background: rgba(0,0,0,.018); border-radius: 6px; padding: 10px 12px; }
.rn-section-acoes .rn-section-label { color: var(--gold, #c49336); }
.rn-section-acoes .rn-section-label::after { background: var(--gold, #c49336); opacity: 0.25; }

/* Bullet lists */
.rn-bullets { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.rn-bullets li {
  font-size: 0.83rem; line-height: 1.55; color: var(--text);
  padding-left: 18px; position: relative;
}
.rn-bullets li::before {
  content: ""; position: absolute; left: 2px; top: 7px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--border); border: 1.5px solid var(--accent);
}
.rn-bullets-acoes li::before {
  background: transparent;
  border-color: var(--gold, #c49336);
  width: 7px; height: 7px; top: 6px;
}

.rn-item-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 4px; }

.rn-tema-count { font-size: 0.7rem; color: var(--text-muted); font-weight: 400; }

.rn-temas-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.rn-temas-prefix {
  font-size: 0.62rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.09em; color: var(--text-muted);
}
.rn-tema-pill {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em;
  background: var(--border); color: var(--text-muted); border: 1px solid var(--border);
}

/* Vista Por Tema */
.rn-tema-list { display: flex; flex-direction: column; gap: 8px; }

.rn-tema-block {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.rn-tema-open { border-color: var(--accent); }

.rn-tema-header {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  padding: 13px 16px; background: none; border: none; cursor: pointer;
  text-align: left; color: var(--text); transition: background 0.15s;
}
.rn-tema-header:hover { background: var(--hover, rgba(0,0,0,0.04)); }
.rn-tema-open .rn-tema-header { background: var(--hover, rgba(0,0,0,0.04)); }

.rn-tema-nome { font-weight: 700; font-size: 0.9rem; flex-shrink: 0; }
.rn-tema-meta { font-size: 0.75rem; color: var(--text-muted); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.rn-tema-body { padding: 0 16px 16px; }

/* Linha do tempo */
.rn-timeline { list-style: none; margin: 0; padding: 8px 0 0; display: flex; flex-direction: column; gap: 0; }

.rn-tl-item { display: flex; gap: 0; }

.rn-tl-spine { display: flex; flex-direction: column; align-items: center; width: 24px; flex-shrink: 0; padding-top: 12px; }
.rn-tl-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--accent); flex-shrink: 0;
}
.rn-tl-item-open .rn-tl-dot { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent); }
.rn-tl-line { width: 2px; flex: 1; background: var(--border); min-height: 16px; margin-top: 4px; }

.rn-tl-content { flex: 1; min-width: 0; padding-bottom: 16px; }

.rn-tl-header {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border-radius: 6px; background: none; border: none;
  cursor: pointer; text-align: left; color: var(--text); transition: background 0.15s;
}
.rn-tl-header:hover { background: var(--hover, rgba(0,0,0,0.04)); }
.rn-tl-item-open .rn-tl-header { background: var(--hover, rgba(0,0,0,0.04)); border-radius: 6px 6px 0 0; }

.rn-tl-date { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.rn-tl-ref { font-weight: 700; font-size: 0.85rem; flex-shrink: 0; }
.rn-badge-sm { font-size: 0.62rem; padding: 1px 6px; }
.rn-tl-content .rn-body { border: 1px solid var(--border); border-top: none; border-radius: 0 0 6px 6px; padding: 12px 12px 10px; }

@media (max-width: 600px) {
  .rn-header { flex-wrap: wrap; }
  .rn-header-right { width: 100%; justify-content: space-between; }
  .rn-date { font-size: 0.75rem; }
  .rn-tema-meta { display: none; }
}

/* ── Avisos ── */
.avisos-list { display: flex; flex-direction: column; gap: 10px; }

.aviso-item {
  padding: 12px 14px;
  border-radius: var(--radius);
  border-left: 3px solid var(--line);
  background: var(--surface);
}
.aviso-item.aviso-alta { border-left-color: #e8a020; }
.aviso-item.aviso-urgente { border-left-color: var(--danger); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }

.aviso-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.aviso-titulo { font-weight: 700; font-size: 0.875rem; flex: 1; }
.aviso-badge {
  font-size: 0.62rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  text-transform: uppercase;
  flex-shrink: 0;
}
.aviso-badge-alta { background: color-mix(in srgb, #e8a020 20%, transparent); color: #b87800; }
.aviso-badge-urgente { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.aviso-texto { font-size: 0.82rem; color: var(--muted); white-space: pre-wrap; margin: 0 0 4px; }
.aviso-validade { font-size: 0.72rem; color: var(--muted); }
.aviso-actions { margin-left: auto; display: flex; gap: 4px; }

.readiness-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 16px;
  padding: 18px;
  border: 1px solid rgba(163, 58, 50, .24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .78);
}

.readiness-strip p:not(.eyebrow) {
  max-width: 850px;
  margin: 8px 0 0;
  color: var(--muted);
}

.resource-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.resource-stats span {
  display: grid;
  min-width: 96px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: #f8f5ec;
  background: linear-gradient(145deg, var(--green), var(--black));
  font-size: .82rem;
}

.resource-stats strong {
  font-size: 1.55rem;
  line-height: 1;
}

.resources-layout {
  display: grid;
  gap: 22px;
}

.dashboard-panel,
.glass-panel,
.quick-panel {
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 18px 50px rgba(25, 32, 29, .1);
}

.dashboard-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.dashboard-side {
  display: grid;
  gap: 16px;
  align-content: start;
}

.mini-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.quick-panel {
  display: grid;
  gap: 8px;
}

.quick-panel button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  text-align: left;
}

.quick-panel button:hover {
  border-color: rgba(35, 67, 50, .35);
  background: #f7f8f3;
}

.quick-panel button span {
  color: var(--muted);
  font-size: .86rem;
}

.brief-panel,
.maintenance-panel,
.credo-panel {
  background:
    linear-gradient(180deg, rgba(18, 18, 17, .035), transparent 130px),
    rgba(255, 255, 255, .82);
}

.credo-panel {
  border-top: 4px solid var(--black);
}

.credo-panel p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.4;
}

.maintenance-panel {
  border-color: rgba(18, 18, 17, .16);
}

.dashboard-signature {
  display: grid;
  grid-template-columns: 56px 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: var(--radius);
  color: #f8f5ec;
  background:
    linear-gradient(135deg, rgba(196, 147, 54, .18), transparent 42%),
    linear-gradient(145deg, var(--green), var(--black));
  box-shadow: 0 18px 42px rgba(18, 18, 17, .18);
}

.dashboard-signature img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.dashboard-signature strong {
  display: block;
  letter-spacing: .1em;
}

.dashboard-signature span {
  color: rgba(248, 245, 236, .68);
  font-size: .86rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.toolbar-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.month-switcher {
  display: inline-grid;
  grid-template-columns: 42px minmax(170px, auto) 42px;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 6px;
  border: 1px solid rgba(217, 209, 195, .86);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .86), rgba(248, 246, 239, .72)),
    #fff;
  box-shadow: 0 10px 28px rgba(25, 32, 29, .08);
}

.month-switcher .icon-button {
  width: 42px;
  min-height: 42px;
  border-color: transparent;
  color: #f8f5ec;
  background: linear-gradient(145deg, var(--green), var(--black));
  font-size: 1.35rem;
}

.month-switcher .icon-button:hover {
  border-color: rgba(196, 147, 54, .42);
  background: var(--black);
}

.month-switcher div {
  min-width: 0;
  padding: 0 8px;
  text-align: center;
}

.month-switcher h2 {
  margin-top: 2px;
  font-size: 1.05rem;
  white-space: nowrap;
}

a.button,
a.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button,
.ghost-button,
.danger-button,
.icon-button,
.segmented button {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 40px;
  padding: 0 13px;
  color: var(--ink);
  background: #fff;
}

.button {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.button:hover {
  background: var(--green-2);
}

.ghost-button:hover,
.icon-button:hover,
.segmented button:hover {
  background: var(--panel-2);
}

.logout-button { color: var(--red); }
.logout-button:hover { background: color-mix(in srgb, var(--red) 12%, transparent) !important; }

.danger-button {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  padding: 0;
  font-size: 1.2rem;
}

.hamburger-button {
  display: none;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 499;
  background: rgba(0, 0, 0, .45);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segmented button.active {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.metrics {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
}

.grid.two {
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.panel,
.record-card,
.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 1px 3px rgba(0, 0, 0, .04), 0 1px 0 rgba(25, 32, 29, .06);
}

.panel {
  padding: 18px;
}

.metric {
  display: grid;
  gap: 10px;
  min-height: 132px;
  padding: 16px;
}

.metric strong {
  font-size: 2rem;
}

.metric span {
  color: var(--muted);
  font-size: .9rem;
}

.metric[data-tone="gold"] {
  border-top: 4px solid var(--gold);
}

.metric[data-tone="green"] {
  border-top: 4px solid var(--green);
}

.metric[data-tone="blue"] {
  border-top: 4px solid var(--blue);
}

.metric[data-tone="red"] {
  border-top: 4px solid var(--red);
}

.list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.list-row,
.timeline-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.list-row header,
.record-card header,
.timeline-item header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.meta {
  color: var(--muted);
  font-size: .9rem;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #fff;
  background: var(--muted);
  font-size: .78rem;
  font-weight: 700;
  white-space: nowrap;
}

.status.ready,
.status.done {
  background: var(--green);
}

.status.service,
.status.progress {
  background: var(--blue);
}

.status.training,
.status.planned {
  background: var(--gold);
  color: #211a0f;
}

.status.warning,
.status.high {
  background: var(--red);
}

.status.muted {
  background: var(--muted);
}

.favorite-button {
  color: rgba(25, 32, 29, .34);
  background: #fff;
}

.favorite-button.active,
.favorite-button:hover {
  color: var(--black);
  border-color: rgba(196, 147, 54, .56);
  background: rgba(242, 198, 90, .32);
}

.tag {
  color: var(--ink);
  background: var(--panel-2);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.model-card {
  min-height: 260px;
}

.model-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: #fff;
  background: var(--green);
  font-weight: 900;
}

.model-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.model-actions a {
  min-height: 38px;
  padding: 0 14px;
  line-height: 1;
  text-decoration: none !important;
}

.culture-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 86px;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  padding: 18px 20px;
  border: 1px solid rgba(18, 18, 17, .1);
  border-radius: var(--radius);
  color: var(--ink);
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 12px 34px rgba(25, 32, 29, .08);
}

.culture-hero .eyebrow,
.culture-hero .meta {
  color: var(--muted);
}

.culture-hero h2 {
  margin-top: 6px;
  font-size: 1.55rem;
}

.culture-lead {
  max-width: 760px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: .98rem;
  line-height: 1.45;
}

.culture-hero img {
  width: 76px;
  height: 76px;
  object-fit: contain;
  justify-self: center;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .18));
}

.culture-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.culture-gallery figure {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(18, 18, 17, .14);
  border-radius: var(--radius);
  background: var(--black);
  box-shadow: 0 16px 36px rgba(25, 32, 29, .1);
  aspect-ratio: 16 / 9;
}

.culture-gallery img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.credo-text,
.culture-body {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  line-height: 1.45;
}

.credo-text p,
.culture-body p {
  margin: 0;
}

.culture-records {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.culture-card {
  border-top: 4px solid var(--gold);
}

.culture-body {
  color: var(--ink);
}

.creed-section {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid rgba(18, 18, 17, .16);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(18, 18, 17, .035), transparent 180px),
    #fff;
  box-shadow: 0 18px 48px rgba(25, 32, 29, .08);
}

.creed-heading {
  position: sticky;
  top: 18px;
  align-self: start;
  display: grid;
  gap: 14px;
}

.creed-heading h2 {
  margin-top: 6px;
  font-size: 1.65rem;
}

.creed-lines {
  display: grid;
  gap: 8px;
}

.creed-lines article {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .82);
}

.creed-lines article span {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #f8f5ec;
  background: linear-gradient(145deg, var(--green), var(--black));
  font-size: .76rem;
  font-weight: 900;
}

.creed-lines article p {
  margin: 0;
  line-height: 1.45;
}

.creed-lines .final-line {
  border-color: rgba(196, 147, 54, .5);
  color: #f8f5ec;
  background: linear-gradient(145deg, var(--black), var(--green-2));
}

.creed-lines .final-line span {
  color: var(--black);
  background: var(--gold);
}

.creed-lines .final-line p {
  font-size: 1.3rem;
  font-weight: 900;
  letter-spacing: .12em;
}

.culture-focus-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.history-section {
  margin-bottom: 32px;
}

.history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  background: var(--green);
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 0;
  color: #f8f5ec;
}

.history-header .eyebrow {
  color: rgba(248, 245, 236, .6);
}

.history-header h2 {
  color: #f8f5ec;
  margin: 6px 0 10px;
}

.history-lead {
  color: rgba(248, 245, 236, .8);
  font-size: .9rem;
  line-height: 1.6;
  max-width: 520px;
  margin: 0;
}

.history-stats {
  display: flex;
  gap: 24px;
  flex-shrink: 0;
  align-items: center;
}

.history-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.history-stats strong {
  font-size: 1.8rem;
  color: var(--gold);
  line-height: 1;
}

.history-stats span {
  font-size: .72rem;
  color: rgba(248, 245, 236, .6);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: .05em;
  max-width: 80px;
}

.history-timeline {
  position: relative;
  padding: 32px 0 16px;
  margin-bottom: 0;
}

.timeline-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--line);
  transform: translateX(-50%);
}

.timeline-entry {
  display: grid;
  grid-template-columns: 1fr 40px 1fr;
  gap: 0 16px;
  align-items: start;
  margin-bottom: 32px;
  position: relative;
  z-index: 1;
}

.timeline-entry .timeline-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-top: 8px;
}

.timeline-year {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .06em;
  color: var(--green);
  text-align: center;
  white-space: nowrap;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px var(--green);
  flex-shrink: 0;
}

.timeline-entry.left .timeline-card {
  grid-column: 1;
  grid-row: 1;
}

.timeline-entry.left .timeline-node {
  grid-column: 2;
  grid-row: 1;
}

.timeline-entry.left .timeline-card + * {
  grid-column: 3;
}

.timeline-entry .timeline-card {
  grid-column: 3;
}

.timeline-entry.left .timeline-card {
  grid-column: 1;
}

.timeline-entry .timeline-node {
  grid-column: 2;
}

.timeline-card {
  padding: 16px;
  overflow: hidden;
}

.timeline-card h3 {
  margin: 0 0 8px;
  font-size: .95rem;
  color: var(--ink);
}

.timeline-card p {
  margin: 0;
  font-size: .85rem;
  color: var(--muted);
  line-height: 1.6;
}

.timeline-img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: 12px;
  display: block;
}

.history-quote {
  background: var(--green);
  border-radius: var(--radius);
  padding: 28px 36px;
  margin: 0 0 24px;
  border: none;
}

.history-quote p {
  color: #f8f5ec;
  font-size: 1.1rem;
  font-style: italic;
  line-height: 1.7;
  margin: 0 0 12px;
}

.history-quote footer {
  color: rgba(248, 245, 236, .55);
  font-size: .8rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.social-section {
  margin-top: var(--space-6);
  background: var(--green-2);
  border-radius: calc(var(--radius) * 2);
  overflow: hidden;
}

.social-inner {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  background: linear-gradient(135deg, rgba(35,67,50,.6) 0%, transparent 60%);
}

.social-header { display: flex; flex-direction: column; gap: 8px; }

.social-title {
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0;
}

.social-lead {
  color: rgba(255,255,255,.55);
  font-size: .9rem;
  margin: 0;
  max-width: 420px;
}

.social-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.social-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: var(--radius);
  text-decoration: none;
  color: #fff;
  background: rgba(255,255,255,.06);
  transition: background .18s, border-color .18s, transform .18s;
}
.social-card:hover {
  background: rgba(255,255,255,.13);
  border-color: rgba(255,255,255,.28);
  transform: translateY(-2px);
}
.social-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
}
.social-icon svg { width: 20px; height: 20px; }
.social-card > div { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.social-card strong { font-size: .95rem; color: #fff; }
.social-card span { font-size: .78rem; color: rgba(255,255,255,.5); }
.social-arrow { color: rgba(255,255,255,.35); font-size: 1rem; margin-left: auto; }

.identity-panel {
  background:
    linear-gradient(180deg, rgba(18, 18, 17, .035), transparent 140px),
    #fff;
}

.culture-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.culture-panel-head h2 {
  margin-top: 4px;
}

.value-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.value-cloud span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 999px;
  color: #f8f5ec;
  background: linear-gradient(145deg, var(--green), var(--black));
  font-size: .84rem;
  font-weight: 800;
}

.directive-categories {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.directive-category-title {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.directive-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
}

.directive-card {
  border-top: 4px solid var(--black);
}

.directive-category:nth-child(1) .directive-card { border-top-color: var(--green); }
.directive-category:nth-child(2) .directive-card { border-top-color: var(--blue); }
.directive-category:nth-child(3) .directive-card { border-top-color: var(--gold); }

.records {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}

.people-summary {
  margin-bottom: 16px;
}

.people-sections {
  display: grid;
  gap: 16px;
}

.people-section {
  display: grid;
  gap: 16px;
}

.section-heading,
.peloton-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.peloton-block {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.people-records {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.procedure-records {
  grid-template-columns: 1fr;
}

.record-card {
  display: grid;
  gap: 12px;
  padding: 15px;
}

.featured-card {
  border-color: rgba(25, 32, 29, .35);
  border-top: 5px solid var(--black);
  background:
    linear-gradient(180deg, rgba(18, 18, 17, .04), transparent 120px),
    #fff;
}

.check-progress {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8f6ef;
}

.check-progress span {
  color: var(--muted);
  font-size: .88rem;
  font-weight: 700;
}

.check-progress strong {
  color: var(--green);
}

.check-progress div {
  grid-column: 1 / -1;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--panel-2);
}

.check-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--gold));
}

.checklist {
  display: grid;
  gap: 7px;
}

.checklist-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.check-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.check-item input {
  width: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--green);
  appearance: auto;
}

.check-item span {
  line-height: 1.35;
}

.check-item:has(input:checked) {
  border-color: rgba(35, 67, 50, .35);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.check-item:has(input:checked) span {
  color: var(--muted);
  text-decoration: line-through;
}

.ops-reference {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid rgba(242, 198, 90, .32);
  border-radius: var(--radius);
  color: #f8f5ec;
  background:
    linear-gradient(135deg, rgba(196, 147, 54, .18), transparent 38%),
    linear-gradient(100deg, var(--black), var(--green-2));
}

.ops-reference .eyebrow,
.ops-reference p {
  color: rgba(248, 245, 236, .78);
}

.ops-reference h2 {
  margin-top: 4px;
}

.ops-reference .button {
  border-color: var(--gold);
  color: var(--black);
  background: #f2c65a;
  white-space: nowrap;
}

.briefing-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.briefing-card {
  border-top: 4px solid var(--black);
}

.compact-row {
  background:
    linear-gradient(90deg, rgba(18, 18, 17, .04), transparent 42%),
    #fff;
}

.schedule-card {
  display: grid;
  gap: 18px;
}

.schedule-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.schedule-header p {
  max-width: 760px;
}

.schedule-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.schedule-preview {
  min-height: 620px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #2a2a28;
}

.schedule-preview object {
  display: block;
  width: 100%;
  height: 720px;
  border: 0;
}

.schedule-info {
  display: grid;
  align-content: start;
  gap: 16px;
}

.legend-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.legend-list div {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 2px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.legend-list strong {
  grid-row: span 2;
  color: var(--green);
  font-size: 1.05rem;
}

.legend-list span {
  font-weight: 700;
}

.legend-list em {
  color: var(--muted);
  font-style: normal;
}

.note-list {
  display: grid;
  gap: 8px;
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.record-actions {
  display: flex;
  gap: 6px;
}

.record-actions .icon-button {
  width: 36px;
  min-height: 36px;
  font-size: 1rem;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.instruction-heading {
  margin-bottom: 14px;
}

/* ── Instrução – navegação e toggle ─────────────────────── */
.instr-view-toggle { display: flex; gap: 6px; }

.instr-day-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.instr-day-label h2 { font-size: 1.1rem; margin: 0; }
.instr-today-btn { margin-left: 4px; }

/* ── Tabela semanal de instrução por pelotão ── */
.iw-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.iw-table {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
  font-size: .8rem;
}

.iw-table thead th {
  background: var(--panel-2);
  padding: 8px 6px;
  text-align: center;
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.iw-col-pel { text-align: left !important; padding-left: 10px !important; width: 80px; }
.iw-col-day { min-width: 110px; }

.iw-wd { display: block; font-size: .65rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.iw-dd { display: block; font-size: 1rem; font-weight: 700; color: var(--ink); }

.iw-today-col { background: rgba(35,67,50,.08); }
.iw-today-col .iw-dd { color: var(--green); }

.iw-cia-row th { background: var(--green); color: #fff; font-size: .7rem; letter-spacing: .07em; text-transform: uppercase; padding: 5px 8px; }
.iw-cia { text-align: left; }

.iw-pel { font-weight: 600; font-size: .78rem; padding: 6px 8px; background: var(--panel-2); border-right: 1px solid var(--line); white-space: nowrap; }

.iw-cell {
  padding: 5px 6px;
  vertical-align: top;
  border: 1px solid var(--line);
  min-height: 50px;
}

.iw-cell[data-today="1"] { background: rgba(35,67,50,.06); }

.iw-act {
  display: block;
  font-size: .72rem;
  line-height: 1.3;
  padding: 2px 4px;
  border-radius: 3px;
  margin-bottom: 2px;
  white-space: normal;
  word-break: break-word;
}

.iw-m { background: rgba(47,95,132,.12); color: var(--blue); }
.iw-t { background: rgba(196,147,54,.15); color: #7a5800; }

.iw-piq {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--muted);
  margin-top: 2px;
}

.iw-piq-pv {
  display: inline-block;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--green);
}

.iw-dc { background: rgba(25,32,29,.03); }
.iw-pv .iw-m, .iw-pv .iw-t { background: rgba(35,67,50,.1); color: var(--green); }

.iw-empty { background: var(--panel-2); opacity: .5; }

/* Dark mode */
[data-theme="dark"] .iw-today-col { background: rgba(35,67,50,.18); }
[data-theme="dark"] .iw-m { background: rgba(47,95,132,.25); color: #7eb8e8; }
[data-theme="dark"] .iw-t { background: rgba(196,147,54,.2); color: #e0b860; }
[data-theme="dark"] .iw-dc { background: rgba(255,255,255,.02); }

/* CIA filter buttons */
.instr-cia-btn { font-size: .78rem; padding: 4px 10px; }

@media (max-width: 640px) {
  .iw-table { min-width: 560px; }
  .iw-act { font-size: .68rem; }
}

/* ── Vista diária – estatísticas ── */
.idc-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0 16px;
  font-size: .82rem;
  color: var(--muted);
}

.idc-stat strong { color: var(--ink); font-weight: 700; }
.idc-stat-sep { opacity: .4; }

/* ── Vista diária – grid de pelotões ── */
.idc-units-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.idc-unit-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.idc-unit-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}

.idc-unit-name {
  font-size: .82rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}

.idc-unit-badges {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.idc-unit-badge {
  font-size: .62rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 4px;
}

.idc-badge-m { background: color-mix(in srgb, #2563eb 14%, transparent); color: #2563eb; }
.idc-badge-t { background: color-mix(in srgb, #b45309 14%, transparent); color: #b45309; }

.idc-unit-session {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
}

.idc-unit-session:last-child { border-bottom: none; }

.idc-session-hora {
  font-size: .72rem;
  font-weight: 800;
  min-width: 34px;
  padding: 2px 5px;
  border-radius: 4px;
  text-align: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.idc-session-m { background: color-mix(in srgb, #2563eb 10%, transparent); color: #2563eb; }
.idc-session-t { background: color-mix(in srgb, #b45309 10%, transparent); color: #b45309; }

.idc-session-info {
  flex: 1;
  min-width: 0;
}

.idc-session-tema {
  display: block;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.idc-session-local {
  display: block;
  font-size: .7rem;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.idc-no-sessions {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

/* ── Condutor de dia – widget ── */
.cond-widget {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  position: relative;
}

.cond-widget::before {
  content: "";
  width: 4px;
  background: var(--accent);
  flex-shrink: 0;
}

.cond-label {
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  font-size: .62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--accent);
  padding: 14px 8px;
  border-right: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--accent) 4%, var(--panel));
  flex-shrink: 0;
}

.cond-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0;
  min-width: 0;
}

.cond-titular {
  flex: 1;
  padding: 14px 18px;
  min-width: 80px;
  border-right: 1px solid var(--line);
}

.cond-name {
  display: block;
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.cond-num {
  display: block;
  margin-top: 3px;
  font-size: .72rem;
  color: var(--muted);
  font-weight: 600;
}

.cond-troca {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
  min-width: 0;
}

.cond-troca-badge {
  font-size: .62rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  background: color-mix(in srgb, #b45309 14%, transparent);
  color: #b45309;
}

.cond-troca-orig {
  font-size: .75rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cond-reserva {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 100px;
  max-width: 160px;
}

.cond-reserva-label {
  font-size: .6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.cond-reserva-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
}

.cond-edit {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border-left: 1px solid var(--line);
  flex-shrink: 0;
}

.cond-widget-empty {
  padding: 14px 18px;
  gap: 12px;
}

.cond-widget-empty .cond-label {
  writing-mode: horizontal-tb;
  transform: none;
  border-right: none;
  padding: 0;
  background: transparent;
}

.cond-empty-msg {
  font-size: .82rem;
  color: var(--muted);
  flex: 1;
}

/* PV widget colour overrides */
.pv-widget::before { background: #dc2626; }

.pv-label {
  color: #dc2626 !important;
  background: color-mix(in srgb, #dc2626 6%, var(--panel)) !important;
}

.pv-pv { border-right: 1px solid var(--line); }

.pv-p1 {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 14px 18px;
  border-right: 1px solid var(--line);
}

.pv-unit {
  font-size: .82rem !important;
  font-weight: 600;
  color: var(--ink) !important;
}

.pv-p2 { min-width: 0; }

.pv-tag {
  font-size: .6rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  background: color-mix(in srgb, #dc2626 12%, transparent);
  color: #dc2626;
}

.pv-tag-p1 {
  font-size: .6rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  background: color-mix(in srgb, #2563eb 12%, transparent);
  color: #2563eb;
}

/* ── Início (dashboard unificado) ── */
.inicio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.inicio-date h2 {
  font-size: 1.5rem;
  font-weight: 800;
  text-transform: capitalize;
  margin: 4px 0 0;
}
.inicio-emblem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  opacity: .55;
  flex-shrink: 0;
}
.inicio-emblem img { width: 44px; height: 44px; }
.inicio-emblem span { font-size: .65rem; font-weight: 700; letter-spacing: .08em; color: var(--muted); }

.inicio-clock {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.clock-time {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  line-height: 1;
}
.clock-label {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
}
.inicio-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(290px, .65fr);
  gap: 16px;
  margin-top: 16px;
}
.inicio-main { display: grid; gap: 16px; align-content: start; }
.inicio-side { display: grid; gap: 16px; align-content: start; }

/* Today view — duty row (PV + condutor side by side) */
.today-duty-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 0;
}

@media (max-width: 700px) {
  .today-duty-row { grid-template-columns: 1fr; }
  .cond-label { display: none; }
  .cond-widget:not(.pv-widget) .cond-troca { display: none; }
  .cond-reserva { min-width: 0; }
  .inicio-header { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 8px; }
  .inicio-emblem { display: none; }
  .inicio-date h2 { font-size: 1.15rem; }
  .clock-time { font-size: 1.5rem; }
  .inicio-clock { align-items: flex-end; margin-left: auto; }
  .inicio-grid { grid-template-columns: 1fr; }
}

/* ── Condutor – escala mensal (Recursos) ── */
.csched-section { margin-bottom: 32px; }

.csched-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.csched-head {
  display: grid;
  grid-template-columns: 64px 1fr 1fr 1fr auto;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
  border-bottom: 2px solid var(--line);
  font-size: .68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  gap: 8px;
}

.csched-head-date { color: var(--muted); }
.csched-head-actions { width: 60px; }

.csched-row {
  display: grid;
  grid-template-columns: 64px 1fr 1fr 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  transition: background .12s;
}

.csched-row:last-child { border-bottom: none; }
.csched-row:hover { background: color-mix(in srgb, var(--accent) 3%, var(--panel)); }

.csched-today {
  background: color-mix(in srgb, var(--accent) 7%, var(--panel)) !important;
}

.csched-today .csched-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .78rem;
}

.csched-date {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.csched-wd {
  font-size: .6rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.csched-num {
  font-size: .88rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.csched-militar {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.csched-name {
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink);
}

.csched-nnum {
  font-size: .68rem;
  color: var(--muted);
}

.csched-troca {
  display: flex;
  align-items: center;
  gap: 6px;
}

.csched-troca-badge {
  font-size: .6rem;
  font-weight: 800;
  padding: 2px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}

.csched-badge-pt {
  background: color-mix(in srgb, #2563eb 12%, transparent);
  color: #2563eb;
}

.csched-badge-pd {
  background: color-mix(in srgb, #b45309 12%, transparent);
  color: #b45309;
}

.csched-troca-name {
  font-size: .78rem;
  color: var(--ink);
}

.csched-dash { color: var(--line); font-size: .9rem; }

.csched-reserva {
  font-size: .78rem;
  color: var(--muted);
}

.csched-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  width: 60px;
}

.csched-empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: .85rem;
}

@media (max-width: 640px) {
  .csched-head,
  .csched-row { grid-template-columns: 52px 1fr 60px; }
  .csched-head-col:nth-child(3),
  .csched-head-col:nth-child(4),
  .csched-head-actions,
  .csched-troca,
  .csched-reserva,
  .csched-actions { display: none; }
}

/* ── Vista mensal – tabela de horário ─────────────────── */
.isched-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}

.isched-head {
  display: grid;
  grid-template-columns: 72px 1fr 1fr;
  background: var(--panel);
  border-bottom: 2px solid var(--line);
}

.isched-head-date,
.isched-head-col {
  padding: 10px 14px;
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}

.isched-head-manha { color: #2563eb; border-left: 1px solid var(--line); }
.isched-head-tarde  { color: #b45309; border-left: 1px solid var(--line); }

.isched-row {
  display: grid;
  grid-template-columns: 72px 1fr 1fr;
  border-bottom: 1px solid var(--line);
  min-height: 44px;
  transition: background .12s;
}

.isched-row:last-child { border-bottom: none; }

.isched-row.isched-weekend {
  background: color-mix(in srgb, var(--line) 30%, var(--panel));
  opacity: .6;
}

.isched-row.isched-today {
  background: color-mix(in srgb, var(--accent) 6%, var(--panel));
}

.isched-row.isched-today .isched-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.isched-row.isched-has-data { cursor: pointer; }
.isched-row.isched-has-data:hover {
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}

.isched-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 6px;
  border-right: 1px solid var(--line);
  gap: 1px;
}

.isched-wd {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: .04em;
}

.isched-num {
  font-size: .9rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
}

.isched-col {
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: center;
  border-left: 1px solid var(--line);
}

.isched-empty {
  color: var(--line);
  font-size: .8rem;
  align-self: center;
}

.isched-chip {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.isched-chip-tema {
  font-size: .74rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
}

.isched-chip-units {
  font-size: .66rem;
  color: var(--muted);
  line-height: 1.2;
}

@media (max-width: 600px) {
  .isched-head,
  .isched-row { grid-template-columns: 52px 1fr 1fr; }
  .isched-date { padding: 6px 4px; }
  .isched-wd { font-size: .55rem; }
  .isched-num { font-size: .82rem; }
  .isched-chip-tema { font-size: .68rem; }
  .isched-chip-units { display: none; }
}

.procedure-layout {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 16px;
}

.category-list {
  display: grid;
  gap: 8px;
}

.category-list button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.category-list button.active {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

.steps {
  margin: 10px 0 0;
  padding-left: 22px;
}

.steps li {
  margin: 8px 0;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: rgba(255, 255, 255, .6);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 18, 16, .42);
  z-index: 20;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.modal-header {
  position: sticky;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  grid-column: 1 / -1;
  padding-top: 6px;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.upload-file-btn {
  font-size: .78rem;
  padding: 4px 10px;
}

.upload-status {
  font-size: .75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.data-actions.compact {
  margin-top: 12px;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .hamburger-button {
    display: grid;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 500;
    width: 284px;
    height: 100vh;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4, 0, .2, 1);
    gap: 20px;
  }

  .sidebar.sidebar-open {
    transform: translateX(0);
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .side-note {
    display: none;
  }

  .grid.metrics,
  .grid.two,
  .grid.three,
  .briefing-board,
  .today-layout,
  .today-procedure-grid,
  .creed-section,
  .culture-focus-grid,
  .procedure-layout,
  .schedule-layout,
  .dashboard-hero,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .history-header {
    flex-direction: column;
    gap: 20px;
  }

  .history-stats {
    gap: 16px;
  }

  .timeline-line {
    left: 20px;
  }

  .timeline-entry {
    grid-template-columns: 40px 1fr;
    gap: 0 12px;
  }

  .timeline-entry .timeline-node {
    grid-column: 1;
    grid-row: 1;
  }

  .timeline-entry .timeline-card,
  .timeline-entry.left .timeline-card {
    grid-column: 2;
    grid-row: 1;
  }

  .today-hero,
  .resources-hero,
  .readiness-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .ops-reference,
  .schedule-header {
    align-items: stretch;
    flex-direction: column;
  }

  .culture-hero {
    grid-template-columns: 1fr;
  }

  .culture-gallery {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .creed-heading {
    position: static;
  }
}

@media (max-width: 680px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding: 20px 18px 16px;
  }

  .top-actions {
    align-items: stretch;
  }

  .search {
    flex: 1;
  }

  .search input {
    width: 100%;
  }

  .content {
    padding: 18px;
  }

  .dashboard-hero {
    padding: 22px;
    border-radius: var(--radius);
  }

  .hero-copy h2 {
    font-size: 2.15rem;
  }

  .hero-emblem img {
    width: 112px;
    height: 112px;
  }

  .dashboard-metrics {
    grid-template-columns: 1fr;
  }

  .culture-gallery {
    grid-template-columns: 1fr;
  }

  .dashboard-panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .month-switcher {
    width: 100%;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
  }

  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .today-stamp {
    grid-template-columns: 54px 1fr;
    justify-items: start;
    align-items: center;
    min-width: 0;
  }

  .today-stamp img {
    grid-row: span 2;
    width: 54px;
    height: 54px;
  }

  .resource-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .calendar {
    grid-template-columns: 1fr;
  }

  .calendar-head {
    display: none;
  }

  .day {
    min-height: auto;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .schedule-preview {
    min-height: 420px;
  }

  .schedule-preview object {
    height: 520px;
  }
}

/* ── Modo escuro (ativado via botão na barra de topo) ─────── */

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111914;
  --panel: #1b2720;
  --panel-2: #222e26;
  --ink: #ddeedd;
  --black: #0c1210;
  --muted: #96b89a;
  --line: #2b3d2e;
  --shadow: 0 18px 45px rgba(0, 0, 0, .45);
}

[data-theme="dark"] .topbar {
  background: rgba(17, 25, 20, .92);
  border-bottom-color: var(--line);
}

[data-theme="dark"] input:not([type="file"]),
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--panel-2);
  color: var(--ink);
  border-color: var(--line);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--muted);
}

[data-theme="dark"] .profile-control option {
  background: var(--panel-2);
  color: var(--ink);
}

[data-theme="dark"] .ghost-button,
[data-theme="dark"] .icon-button,
[data-theme="dark"] .segmented button {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .ghost-button:hover,
[data-theme="dark"] .icon-button:hover,
[data-theme="dark"] .segmented button:hover {
  background: var(--panel-2);
}

[data-theme="dark"] .segmented button.active {
  background: var(--green);
  color: #f8f5ec;
  border-color: var(--green);
}

[data-theme="dark"] .panel {
  background: var(--panel);
}

[data-theme="dark"] .record-card {
  background: var(--panel);
}

[data-theme="dark"] .procedure-shortcut {
  background: var(--panel);
}

[data-theme="dark"] .glass-panel,
[data-theme="dark"] .dashboard-panel,
[data-theme="dark"] .quick-panel {
  background: rgba(27, 39, 32, .85);
}

[data-theme="dark"] .brief-panel,
[data-theme="dark"] .maintenance-panel,
[data-theme="dark"] .credo-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .03), transparent 130px),
    var(--panel);
}

[data-theme="dark"] .quick-panel button {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .quick-panel button:hover {
  background: var(--panel);
}

[data-theme="dark"] .month-switcher {
  background: var(--panel);
  border-color: var(--line);
  box-shadow: 0 10px 28px rgba(0, 0, 0, .25);
}

[data-theme="dark"] .list-row {
  background: var(--panel);
}

[data-theme="dark"] .list-row:hover {
  background: var(--panel-2);
}

[data-theme="dark"] .category-list button,
[data-theme="dark"] .search-result {
  background: var(--panel);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .category-list button:hover,
[data-theme="dark"] .search-result:hover {
  background: var(--panel-2);
}

[data-theme="dark"] .day {
  background: var(--panel-2);
  border-color: var(--line);
}

[data-theme="dark"] .day.today {
  background: rgba(35, 67, 50, .3);
  border-color: var(--green);
}

[data-theme="dark"] .modal {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .modal-backdrop {
  background: rgba(0, 0, 0, .65);
}

[data-theme="dark"] .form-label {
  color: var(--ink);
}

[data-theme="dark"] .dashboard-hero,
[data-theme="dark"] .today-hero,
[data-theme="dark"] .resources-hero {
  background:
    linear-gradient(135deg, rgba(196, 147, 54, .12), transparent 40%),
    linear-gradient(180deg, var(--green-2), var(--black));
}

[data-theme="dark"] .readiness-strip {
  background:
    linear-gradient(90deg, rgba(196, 147, 54, .1), transparent 50%),
    var(--green-2);
}

[data-theme="dark"] .tag {
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--ink);
}

[data-theme="dark"] .resource-stats span {
  background: linear-gradient(145deg, var(--green-2), var(--black));
}

[data-theme="dark"] .metric {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .sidebar-backdrop {
  background: rgba(0, 0, 0, .6);
}

@media print {
  .sidebar,
  .top-actions,
  .toolbar,
  .record-actions {
    display: none !important;
  }

  .app-shell,
  .grid.metrics,
  .grid.two,
  .grid.three,
  .procedure-layout {
    display: block;
  }

  .topbar,
  .content {
    padding: 0;
  }

  .panel,
  .record-card,
  .metric {
    break-inside: avoid;
    box-shadow: none;
  }
}

/* ── Filter banner ─────────────────────────────────────────── */

.filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  margin-bottom: 4px;
  border-radius: var(--radius);
  background: rgba(35, 67, 50, .1);
  border: 1px solid rgba(35, 67, 50, .2);
  font-size: .88rem;
  color: var(--green);
}

[data-theme="dark"] .filter-banner {
  background: rgba(35, 67, 50, .25);
  border-color: rgba(35, 67, 50, .4);
  color: #8ecf9a;
}

[data-theme="dark"] .timeline-dot {
  border-color: var(--bg);
}

[data-theme="dark"] .timeline-card h3 {
  color: var(--ink);
}

[data-theme="dark"] .history-header,
[data-theme="dark"] .history-quote {
  background: var(--green-2);
}

/* ── Toast notifications ───────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
  pointer-events: none;
}

.toast {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 500;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .22s ease, transform .22s ease;
  color: #fff;
  line-height: 1.4;
}

.toast.toast-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success { background: var(--green); }
.toast-error   { background: var(--red); }
.toast-info    { background: var(--blue); }

/* ── PIN overlay ───────────────────────────────────────────── */

.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(145deg, rgba(196, 147, 54, .12), transparent 38%),
    linear-gradient(180deg, var(--green), var(--green-2) 55%, var(--black));
}

.pin-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: min(400px, 92vw);
  padding: 40px 36px 32px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 32px 80px rgba(0, 0, 0, .45);
  backdrop-filter: blur(8px);
}

.pin-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #f8f5ec;
  text-align: center;
}

.pin-emblem {
  width: 80px;
  height: 80px;
  object-fit: contain;
  padding: 6px;
  border-radius: 50%;
  background: rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .14);
}

.pin-header strong {
  font-size: 1.2rem;
  letter-spacing: .04em;
}

.pin-header span {
  color: rgba(248, 245, 236, .6);
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.pin-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
}

.pin-label {
  color: rgba(248, 245, 236, .7);
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-align: center;
}

.pin-form input {
  height: 52px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, .3);
  color: #f8f5ec;
  font-size: 1.4rem;
  letter-spacing: .3em;
  text-align: center;
  outline: none;
}

.pin-form input:focus {
  border-color: var(--gold);
  background: rgba(0, 0, 0, .45);
}

.pin-form input::placeholder {
  color: rgba(248, 245, 236, .3);
  letter-spacing: .2em;
}

.pin-error {
  color: #f28a82;
  font-size: .85rem;
  text-align: center;
  margin: 0;
}

.pin-submit {
  height: 48px;
  font-size: .95rem;
  letter-spacing: .04em;
}

.pin-footer {
  color: rgba(248, 245, 236, .4);
  font-size: .78rem;
  letter-spacing: .06em;
  text-align: center;
  margin: 0;
}

@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.pin-shake .pin-card {
  animation: pin-shake 0.45s ease;
}

.pin-select {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1.5px solid rgba(248, 245, 236, .25);
  background: rgba(255, 255, 255, .07);
  color: #f8f5ec;
  font-size: .95rem;
  appearance: auto;
}

.pin-select option {
  background: #1b2720;
  color: #f8f5ec;
}

.audit-meta {
  font-size: .72rem;
  color: var(--muted);
  margin-top: 6px;
  opacity: .8;
}

/* ── Histórico de Execuções ─────────────────────────────────── */
.hist-list { display: flex; flex-direction: column; gap: var(--space-2); }

.hist-row {
  display: grid;
  grid-template-columns: 80px 1fr auto;
  gap: var(--space-3);
  align-items: start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.hist-meta { display: flex; flex-direction: column; gap: 2px; padding-top: 2px; }
.hist-date { font-size: .8rem; font-weight: 600; color: var(--muted); }
.hist-time { font-size: .75rem; color: var(--muted); }

.hist-body { display: flex; flex-direction: column; gap: 4px; }
.hist-proc { font-weight: 600; font-size: .9rem; margin: 0; }
.hist-by { font-size: .78rem; color: var(--muted); }
.hist-obs { font-size: .82rem; color: var(--fg); margin: 2px 0 0; opacity: .85; }

.hist-resultado {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 20px;
  width: fit-content;
}
.hist-ok     { background: rgba(56,161,105,.15); color: #276749; }
.hist-parcial{ background: rgba(214,158,46,.15);  color: #744210; }
.hist-curso  { background: rgba(49,130,206,.15);  color: #1a365d; }
.hist-cancel { background: rgba(229,62,62,.12);   color: #742a2a; }

.hist-actions { display: flex; gap: 4px; }

/* ── Auth overlay (JWT) ─────────────────────────────────────── */
/* ── Login screen ─────────────────────────────────────────────────────────── */

.auth-overlay {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  z-index: 9000;
  font-family: inherit;
}

.auth-panel-left {
  background: var(--green-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 48px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.auth-panel-left::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 60% 40%, rgba(35,67,50,.8) 0%, transparent 70%);
  pointer-events: none;
}
.auth-panel-left-logo {
  width: 96px;
  height: 96px;
  object-fit: contain;
  filter: drop-shadow(0 4px 16px rgba(0,0,0,.5));
  position: relative;
}
.auth-panel-left-title {
  position: relative;
  color: #fff;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 0;
  line-height: 1.2;
}
.auth-panel-left-sub {
  position: relative;
  color: rgba(255,255,255,.55);
  font-size: .85rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin: 0;
}
.auth-panel-left-divider {
  position: relative;
  width: 40px;
  height: 2px;
  background: var(--gold);
  border-radius: 2px;
}
.auth-panel-left-motto {
  position: relative;
  color: rgba(255,255,255,.38);
  font-size: .75rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin: 0;
}

.auth-panel-right {
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 40px;
}

.auth-card {
  width: min(360px, 100%);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.auth-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 2px;
  letter-spacing: -.02em;
}
.auth-card-sub {
  font-size: .85rem;
  color: var(--muted);
  margin: 0;
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.auth-label {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.auth-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: .95rem;
  transition: border-color .15s, box-shadow .15s;
}
.auth-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(35,67,50,.12);
}
.auth-totp-input { letter-spacing: .25em; font-size: 1.3rem; text-align: center; }

.auth-error {
  font-size: .82rem;
  color: #c53030;
  background: rgba(229,62,62,.07);
  border: 1px solid rgba(229,62,62,.2);
  border-radius: var(--radius);
  padding: 8px 12px;
  margin: 0;
}

.auth-submit {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 1rem;
  margin-top: 4px;
}
.auth-back { width: 100%; justify-content: center; margin-top: -8px; }

.auth-footer {
  font-size: .72rem;
  color: var(--muted);
  text-align: center;
  margin: 8px 0 0;
  opacity: .55;
  letter-spacing: .06em;
  text-transform: uppercase;
}

@media (max-width: 640px) {
  .auth-overlay { display: flex; flex-direction: column; }
  .auth-panel-left { display: none; }
  .auth-panel-right { flex: 1; padding: 40px 24px; }
}

@media print {
  .sidebar,
  .sidebar-backdrop,
  .topbar,
  .toast-container,
  .pin-overlay,
  .modal-backdrop,
  .hamburger-button,
  .filter-banner,
  .checklist-actions,
  .record-actions,
  .model-actions,
  .data-actions,
  .toolbar .button,
  .toolbar .ghost-button,
  [data-action],
  [data-jump-view],
  [data-search-target],
  [data-month-shift],
  [data-people-group],
  [data-people-status],
  [data-procedure-category],
  .favorite-button,
  .segmented,
  .dashboard-metrics,
  .quick-panel,
  .maintenance-panel,
  .dashboard-signature,
  .culture-gallery,
  .history-stats,
  .readiness-strip,
  .today-stamp { display: none !important; }

  .auth-overlay,
  .pin-overlay { display: none !important; }

  * {
    color: #000 !important;
    background: #fff !important;
    box-shadow: none !important;
    text-shadow: none !important;
  }

  body { font-size: 11pt; }

  .app-shell { display: block; }
  .main { margin: 0; }
  .content { padding: 16px; }

  .panel,
  .record-card,
  .timeline-item { break-inside: avoid; border: 1px solid #ccc !important; margin-bottom: 12px; padding: 12px; }

  .tag, .status { border: 1px solid #999 !important; padding: 1px 5px; font-size: 9pt; }

  .check-item input[type="checkbox"] { print-color-adjust: exact; -webkit-print-color-adjust: exact; }

  .checklist { columns: 2; }

  .check-progress { break-inside: avoid; }

  h1, h2, h3 { break-after: avoid; }

  a[href]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555 !important; }
  a[href^="assets"]::after { content: ""; }

  @page { margin: 15mm 12mm; }
}

/* ── PWA install hint ────────────────────────────────── */
.pwa-hint {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  z-index: 900;
  width: min(480px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-hint--visible {
  transform: translateX(-50%) translateY(0);
}

.pwa-hint-inner {
  padding: 16px 20px;
}

.pwa-hint-inner strong {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text-1);
}

.pwa-hint-inner p {
  font-size: 0.8rem;
  color: var(--text-2);
  margin: 0 0 12px;
  line-height: 1.5;
}

.pwa-hint-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Calendário ─────────────────────────────────────── */
.cal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-nav .icon-button {
  width: 34px;
  height: 34px;
  font-size: 1.2rem;
}

.cal-month-label {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 190px;
  text-align: center;
  color: var(--text-1);
  letter-spacing: -0.01em;
}

.cal-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--text-2);
  flex-wrap: wrap;
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.cal-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.cal-weekdays > div {
  text-align: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-2);
  padding: 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cal-weekdays > div:nth-child(6),
.cal-weekdays > div:nth-child(7) {
  color: color-mix(in srgb, var(--text-2) 70%, var(--accent));
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.cal-cell {
  min-height: 72px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 8px 8px 6px;
  cursor: pointer;
  transition: background 0.12s;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  position: relative;
}

.cal-cell:nth-child(7n) {
  border-right: none;
}

/* last row — remove bottom border */
.cal-grid .cal-cell:nth-last-child(-n+7) {
  border-bottom: none;
}

.cal-cell:hover {
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.cal-cell--empty {
  background: var(--surface-2);
  cursor: default;
  pointer-events: none;
  opacity: 0.5;
}

.cal-cell--weekend .cal-day-num {
  color: var(--text-2);
}

.cal-cell--today {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.cal-cell--today .cal-day-num {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  margin-bottom: 0;
}

.cal-cell--selected {
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
}

.cal-cell--selected::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--accent);
  border-radius: 0;
  pointer-events: none;
}

.cal-day-num {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-1);
  line-height: 24px;
  min-width: 24px;
  text-align: center;
  margin-bottom: 4px;
}

.cal-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
}

.cal-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.cal-dot--instrucao { background: #3b82f6; }
.cal-dot--operacao  { background: #f97316; }
.cal-dot--reuniao   { background: #8b5cf6; }
.cal-dot--projeto   { background: #10b981; }
.cal-dot--evento    { background: var(--gold); }

/* Detail panel */
.cal-detail {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.cal-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.cal-detail-header strong { flex: 1; min-width: 0; }

.cal-add-event-btn { font-size: .78rem; padding: 4px 10px; margin-left: auto; white-space: nowrap; }

.cal-del-event {
  margin-left: auto;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
}
.cal-del-event:hover { color: var(--red); }

.cal-detail-header strong {
  font-size: 0.95rem;
  text-transform: capitalize;
}

.cal-event-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
}

.cal-event-item:last-child {
  border-bottom: none;
}

.cal-event-item--instrucao { border-left-color: #3b82f6; }
.cal-event-item--operacao  { border-left-color: #f97316; }
.cal-event-item--reuniao   { border-left-color: #8b5cf6; }
.cal-event-item--projeto   { border-left-color: #10b981; }
.cal-event-item--evento    { border-left-color: var(--gold); }

.cal-event-type {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-2);
  min-width: 68px;
}

.cal-event-label {
  flex: 1;
  font-size: 0.875rem;
  color: var(--text-1);
}

@media (max-width: 600px) {
  .cal-toolbar {
    gap: 8px;
    margin-bottom: 14px;
  }

  .cal-cell {
    min-height: 46px;
    padding: 5px 4px 4px;
  }

  .cal-day-num {
    font-size: 0.72rem;
    min-width: 20px;
    line-height: 20px;
  }

  .cal-cell--today .cal-day-num {
    width: 20px;
    height: 20px;
  }

  .cal-dot {
    width: 5px;
    height: 5px;
  }

  .cal-month-label {
    min-width: 150px;
    font-size: 1rem;
  }

  .cal-weekdays > div {
    font-size: 0.6rem;
    padding: 6px 0;
  }

  .cal-event-item {
    gap: 8px;
    padding: 10px 12px;
  }

  .cal-event-type {
    min-width: 54px;
  }
}

/* ── Admin: Gestão de Utilizadores ───────────────────────────────────────── */

.admin-users-list { margin-top: 1rem; overflow-x: auto; }

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.admin-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--border);
  color: var(--text-2);
  font-weight: 600;
  white-space: nowrap;
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.admin-table tr.row-disabled td { opacity: .5; }

.admin-actions { display: flex; gap: 8px; }
.admin-actions .ghost-button { font-size: .8rem; padding: 4px 10px; }
.admin-actions .ghost-button.danger { color: var(--danger, #c0392b); border-color: var(--danger, #c0392b); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-ok  { background: #d4edda; color: #155724; }
.badge-off { background: #f8d7da; color: #721c24; }

[data-theme="dark"] .badge-ok  { background: #1a3a2a; color: #6fcf97; }
[data-theme="dark"] .badge-off { background: #3a1a1a; color: #eb5757; }

/* ── Security alert banner ───────────────────────────────────────────────── */

.security-alert {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  background: rgba(220,38,38,.07);
  border: 1px solid rgba(220,38,38,.25);
  border-left: 4px solid #dc2626;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: .9rem;
}
.security-alert strong { color: #dc2626; }
.security-alert-ips { font-family: monospace; font-size: .8rem; color: var(--text-2); }
.security-alert-ok {
  padding: 8px 14px;
  background: rgba(16,185,129,.07);
  border: 1px solid rgba(16,185,129,.25);
  border-left: 4px solid #10b981;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  font-size: .85rem;
  color: #065f46;
}
[data-theme="dark"] .security-alert { background: rgba(220,38,38,.12); border-color: rgba(220,38,38,.35); }
[data-theme="dark"] .security-alert strong { color: #f87171; }
[data-theme="dark"] .security-alert-ok { background: rgba(16,185,129,.1); border-color: rgba(16,185,129,.3); color: #6ee7b7; }

/* ── Activity log ────────────────────────────────────────────────────────── */

.activity-table td { font-size: .82rem; }
.activity-table .act-ts  { white-space: nowrap; color: var(--text-2); }
.activity-table .act-ip  { font-family: monospace; font-size: .78rem; color: var(--text-2); white-space: nowrap; }
.activity-table .muted-text { color: var(--text-2); font-size: .8rem; }
.activity-table tr.row-alert td { background: rgba(220,38,38,.06); }

.act-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .73rem;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--text-2);
}
.act-login        { background: #d4edda; color: #155724; }
.act-login_failed  { background: #f8d7da; color: #721c24; }
.act-login_blocked { background: #f8d7da; color: #721c24; font-weight: 700; }
.act-data_write   { background: #cce5ff; color: #004085; }
.act-file_upload  { background: #e2d9f3; color: #4a235a; }
.act-password_change, .act-user_password_reset { background: #fff3cd; color: #856404; }
.act-user_added   { background: #d1ecf1; color: #0c5460; }
.act-user_toggled      { background: #fde8d8; color: #7d3c00; }
.act-instrucao_upload  { background: #d4efdf; color: #145a32; }

[data-theme="dark"] .act-login        { background: #1a3a2a; color: #6fcf97; }
[data-theme="dark"] .act-login_failed  { background: #3a1a1a; color: #eb5757; }
[data-theme="dark"] .act-login_blocked { background: #3a1a1a; color: #eb5757; font-weight: 700; }
[data-theme="dark"] .act-data_write   { background: #0d2a4a; color: #90caf9; }
[data-theme="dark"] .act-file_upload  { background: #2a1a3a; color: #ce93d8; }
[data-theme="dark"] .act-password_change,
[data-theme="dark"] .act-user_password_reset { background: #3a2e00; color: #ffd54f; }
[data-theme="dark"] .act-user_added   { background: #0a2a2a; color: #80deea; }
[data-theme="dark"] .act-user_toggled      { background: #3a1a00; color: #ffcc80; }
[data-theme="dark"] .act-instrucao_upload  { background: #0d2a1a; color: #82e0aa; }
[data-theme="dark"] .activity-table tr.row-alert td { background: rgba(220,38,38,.12); }

/* ── Password strength indicator ─────────────────────────────────────────── */

.pw-strength-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}
.pw-strength-fill {
  height: 100%;
  width: 0;
  border-radius: 2px;
  transition: width .3s, background .3s;
}
.pw-strength-1 { background: #e74c3c; }
.pw-strength-2 { background: #e67e22; }
.pw-strength-3 { background: #f1c40f; }
.pw-strength-4 { background: #27ae60; }

.pw-strength-label {
  font-size: .75rem;
  margin-top: 4px;
  color: var(--text-2);
  min-height: 1em;
}

/* ── Push notification banner ─────────────────────────────────────────────── */

.push-banner {
  position: fixed;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  max-width: 520px;
  width: calc(100vw - 2rem);
  z-index: 600;
  font-size: .85rem;
  color: var(--text-1);
}
.push-banner[hidden] { display: none; }
.push-banner span { flex: 1; }
.push-banner-btn { padding: .4rem .9rem; font-size: .8rem; white-space: nowrap; }
.push-banner-close { flex-shrink: 0; font-size: 1rem; opacity: .6; }
.push-banner-close:hover { opacity: 1; }

/* ── Instrucao upload button ──────────────────────────────────────────────── */

.instr-upload-btn {
  font-size: .8rem;
  padding: .35rem .75rem;
}
.instr-upload-btn:disabled { opacity: .5; cursor: wait; }

/* ── Botão voltar atrás ───────────────────────────────────────────────────── */

.back-button {
  font-size: 1.1rem;
  flex-shrink: 0;
}
.back-button[hidden] { display: none; }

/* ── Viaturas ─────────────────────────────────────────────────────────────── */

.viat-dist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.viat-col {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: .85rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.viat-col-head {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: .5rem;
}
.viat-col-head strong { font-size: .85rem; line-height: 1.3; }
.viat-col-pel {
  font-size: .78rem;
  font-weight: 700;
  color: var(--green, #234332);
}
[data-theme="dark"] .viat-col-pel { color: #7fc99a; }
.viat-col-nota {
  font-size: .72rem;
  color: var(--gold, #b8860b);
  font-weight: 600;
  text-transform: uppercase;
}

.viat-col-body {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  flex: 1;
}

.viat-chip {
  font-size: .78rem;
  font-weight: 600;
  padding: .25rem .55rem;
  border-radius: 6px;
  background: var(--surface-2, #eee);
  border: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}
.viat-chip--tp8    { background: #dbeafe; border-color: #93c5fd; color: #1e3a8a; }
.viat-chip--tp5    { background: #fef3c7; border-color: #fcd34d; color: #78350f; }
.viat-chip--pesado { background: #e9d5ff; border-color: #c4b5fd; color: #4c1d95; }
.viat-chip--warn   { background: #fee2e2; border-color: #fca5a5; color: #7f1d1d; }
[data-theme="dark"] .viat-chip--tp8    { background: #172554; border-color: #1e40af; color: #93c5fd; }
[data-theme="dark"] .viat-chip--tp5    { background: #3a2e00; border-color: #a16207; color: #fcd34d; }
[data-theme="dark"] .viat-chip--pesado { background: #2e1065; border-color: #6d28d9; color: #c4b5fd; }
[data-theme="dark"] .viat-chip--warn   { background: #450a0a; border-color: #b91c1c; color: #fca5a5; }

.viat-hint {
  margin-top: 1rem;
  font-size: .78rem;
  color: var(--text-2);
  font-style: italic;
}

.viat-tipo-section { margin-top: 1.25rem; }
.viat-tipo-title {
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .6rem;
}
.viat-tipo-count {
  font-size: .72rem;
  background: var(--surface-2, #eee);
  border-radius: 10px;
  padding: .1rem .5rem;
  color: var(--text-2);
}

.viat-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.viat-matricula {
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.viat-estado {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .15rem .55rem;
  border-radius: 10px;
  width: fit-content;
}
.viat-estado--ok   { background: #d4edda; color: #155724; }
.viat-estado--warn { background: #fff3cd; color: #856404; }
.viat-estado--info { background: #cce5ff; color: #004085; }
.viat-estado--bad  { background: #f8d7da; color: #721c24; }
[data-theme="dark"] .viat-estado--ok   { background: #1a3a2a; color: #6fcf97; }
[data-theme="dark"] .viat-estado--warn { background: #3a2e00; color: #ffd54f; }
[data-theme="dark"] .viat-estado--info { background: #0d2a4a; color: #90caf9; }
[data-theme="dark"] .viat-estado--bad  { background: #3a1a1a; color: #eb5757; }

.viat-km-info { font-size: .78rem; color: var(--text-2); margin: 0; }
.viat-obs     { font-size: .78rem; color: var(--text-2); margin: 0; }

.viat-km-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  margin-top: 1rem;
}
.viat-km-table th, .viat-km-table td {
  padding: .5rem .65rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.viat-km-table th { font-size: .72rem; text-transform: uppercase; color: var(--text-2); }
.viat-km-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.viat-km-mat { font-weight: 600; }

.viat-km-select {
  padding: .4rem .6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text-1);
  font-size: .85rem;
}

.act-efetivo_upload { background: #d4efdf; color: #145a32; }
[data-theme="dark"] .act-efetivo_upload { background: #0d2a1a; color: #82e0aa; }

/* ── Prontidão / Condutor: widgets do dia seguinte ────────────────────────── */

.cond-widget--amanha,
.pv-widget--amanha {
  opacity: .72;
  border-style: dashed;
  filter: grayscale(0.75);
  box-shadow: none;
}
.cond-widget--amanha:hover,
.pv-widget--amanha:hover {
  opacity: .95;
  filter: grayscale(0.2);
}
.pv-label--amanha,
.cond-label--amanha { font-style: italic; }
