/*
 * Copyright Universidade Federal do Espirito Santo (Ufes)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 *
 * This program is released under license GNU GPL v3+ license.
 */

/* ========================================================================
 * Copyright Universidade Federal do Espirito Santo (Ufes)
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
 *
 * This program is released under license GNU GPL v3+.
 * ========================================================================
 */

/* Municipal works dashboard: shared public identity and semantic status colors. */
:root {
  --brand: #14564b;
  --ink: #18312e;
  --muted: #60716e;
  --line: #dde5e1;
  --canvas: #f3f6f4;
  --danger: #aa3541;
  --warning: #946018;
  --green: #157365;
  --radius: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family:
    Inter,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}
a {
  color: var(--brand);
}
:focus-visible {
  outline: 3px solid #5ba799;
  outline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 8px;
}
h2 {
  font-size: 18px;
  letter-spacing: -0.3px;
  font-weight: 650;
  margin-bottom: 6px;
}
h3 {
  font-size: 14px;
  font-weight: 650;
}
.muted {
  color: var(--muted);
  margin-bottom: 0;
}
.eyebrow {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 1.6px;
  display: block;
  color: var(--brand);
  margin-bottom: 14px;
}
.identity {
  display: flex;
  align-items: center;
  gap: 14px;
}
.identity img {
  width: 48px;
  height: 56px;
  object-fit: contain;
}
.identity span,
.identity strong {
  display: block;
}
.identity span {
  font-size: 11px;
  letter-spacing: 0.6px;
}
.identity strong {
  font-size: 18px;
  font-weight: 650;
}
.primary-button,
.secondary-button {
  border-radius: 8px;
  min-height: 42px;
  padding: 10px 18px;
  font-weight: 600;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  text-decoration: none;
  border: 1px solid var(--line);
  transition: background 0.15s;
}
.primary-button {
  background: var(--brand);
  color: #fff;
  border-color: transparent;
}
.primary-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--brand), #000 12%);
  color: #fff;
}
.secondary-button {
  background: white;
  color: var(--ink);
}
.secondary-button:hover {
  background: #edf3ef;
  color: var(--ink);
}
.text-button {
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  padding: 6px 0;
  font-weight: 650;
}
.text-button:hover {
  text-decoration: underline;
}
.login-page {
  background: #e7eeea;
}
.login-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 1.08fr 1fr;
}
.login-intro {
  background: var(--brand);
  color: #fff;
  padding: 48px clamp(32px, 6vw, 100px);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.login-intro::after {
  content: "";
  position: absolute;
  right: -260px;
  bottom: -360px;
  width: 680px;
  height: 680px;
  border: 1px solid #ffffff12;
  border-radius: 50%;
  box-shadow:
    0 0 0 80px #ffffff04,
    0 0 0 160px #ffffff03;
  pointer-events: none;
}
.login-intro .identity {
  position: relative;
  z-index: 1;
}
.login-intro .identity img {
  width: 56px;
  height: 66px;
}
.intro-copy {
  margin: auto 0;
  padding: 75px 0 48px;
  position: relative;
  z-index: 1;
}
.intro-copy .eyebrow {
  color: #c1dbd3;
}
.intro-copy h1 {
  font-size: clamp(38px, 4.4vw, 66px);
  line-height: 1.09;
  letter-spacing: -2.6px;
  font-weight: 650;
  margin: 20px 0 25px;
}
.intro-copy > p {
  max-width: 390px;
  color: #d2e5de;
  font-size: 17px;
  line-height: 1.8;
}
.intro-features {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  padding: 0 0 52px;
  position: relative;
  z-index: 1;
}
.intro-features span {
  display: block;
  font-size: 12px;
  color: #b1d0c5;
  margin-bottom: 10px;
}
.intro-features strong {
  font-weight: 600;
  font-size: 14px;
}
.intro-features p {
  font-size: 12px;
  color: #c7ddd5;
  line-height: 1.7;
  margin: 8px 0 0;
}
.login-intro footer {
  border-top: 1px solid #ffffff25;
  padding-top: 20px;
  font-size: 11px;
  color: #c7ddd5;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.login-panel {
  background: #fafcfb;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 64px 48px 24px;
}
.login-form-wrap {
  width: 100%;
  max-width: 380px;
  margin: auto 0;
}
.login-form-wrap h2 {
  font-size: 30px;
  line-height: 1.2;
  letter-spacing: -0.8px;
  margin-bottom: 18px;
}
.login-form-wrap > .muted {
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 32px;
}
#login-form label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}
#login-form input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--ui-field-border, #ccd6d0);
  border-radius: var(--ui-field-radius, 2rem);
  padding: 12px 14px;
  color: var(--ink);
  background: white;
  box-shadow: 0 1px 2px #18312e04;
}
#login-form input::placeholder {
  color: #7b8881;
  font-size: 13px;
}
#login-form input[aria-invalid="true"] {
  border-color: var(--danger);
}
.password-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 0;
}
.password-heading .text-button {
  padding-top: 0;
  padding-bottom: 8px;
}
.form-error {
  font-size: 12px;
  line-height: 1.5;
  color: var(--danger);
  min-height: 20px;
  margin: 12px 0;
}
#login-submit {
  width: 100%;
  height: 48px;
  justify-content: space-between;
}
.login-help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
  border-top: 1px solid var(--line);
  padding-top: 24px;
  margin-top: 28px;
}
.login-bottom {
  font-size: 11px;
  color: #596b61;
  margin-top: 48px;
}
.container-fluid {
  padding: 0 !important;
}
.app-header {
  min-height: 90px;
  background: white;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px max(24px, calc((100vw - 1400px) / 2));
  gap: 20px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 22px;
}
.header-label {
  font-size: 10px;
  letter-spacing: 1.4px;
  color: var(--muted);
}
.user-name {
  font-size: 13px;
  font-weight: 600;
}
.header-actions .secondary-button {
  min-height: 36px;
  padding: 6px 15px;
}
.dashboard-main {
  max-width: 1448px;
  padding: 32px 24px 0;
  margin: auto;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 25px;
}
.page-heading .eyebrow {
  margin-bottom: 8px;
}
.page-heading > .secondary-button {
  flex-shrink: 0;
}
.notice {
  padding: 12px 16px;
  background: #e9f1ed;
  border: 1px solid #d6e3dc;
  color: #405e53;
  border-radius: 9px;
  margin-bottom: 24px;
  font-size: 12px;
}
.notice.warning {
  background: #fff8e9;
  border-color: #eddfbd;
  color: #775015;
}
.notice.danger {
  background: #fff0f1;
  border-color: #f0c9ce;
  color: var(--danger);
}
.filter-panel,
.content-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 24px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}
.section-heading h2 {
  margin: 0;
}
.section-heading p {
  font-size: 12px;
  margin-top: 6px;
}
.filter-grid {
  display: grid;
  grid-template-columns: 1.3fr 0.75fr 1fr 1.2fr 1fr;
  gap: 16px;
}
.filter-grid .shiny-input-container,
.table-heading .shiny-input-container {
  margin-bottom: 0;
  min-width: 0;
}
.control-label {
  font-size: 12px !important;
  font-weight: 600 !important;
  margin-bottom: 8px !important;
  color: #40594e;
}
.form-control,
.form-select,
.selectize-input {
  border: 1px solid #ccd9d1 !important;
  border-radius: 7px !important;
  font-size: 13px !important;
  min-height: 42px !important;
  box-shadow: none !important;
  color: var(--ink) !important;
  background-color: #fff !important;
}
.selectize-input {
  display: flex !important;
  align-items: center;
  padding: 8px 30px 8px 12px !important;
}
.selectize-input .item {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.selectize-control.single .selectize-input:after {
  right: 12px;
}
.selectize-dropdown .option {
  white-space: normal !important;
  font-size: 12px;
}
.selectize-control {
  min-width: 0;
}
.selection-count {
  font-size: 12px;
  color: var(--muted);
}
.overview-heading {
  margin: 30px 0 16px;
}
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}
.metric-card {
  padding: 21px 22px;
  background: white;
  border: 1px solid var(--line);
  border-top: 3px solid #82958e;
  border-radius: 12px;
  min-height: 160px;
  position: relative;
  display: flex;
  flex-direction: column;
}
.metric-label {
  font-size: 12px;
  font-weight: 600;
  color: #53675d;
  margin-bottom: 12px;
}
.metric-value {
  font-size: clamp(22px, 2.3vw, 32px);
  font-weight: 650;
  line-height: 1.2;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
}
.metric-detail {
  font-size: 11px;
  color: var(--muted);
  margin: auto 0 0;
  line-height: 1.5;
}
.metric-card.amendment {
  border-top-color: #b47e2c;
}
.metric-card.amendment .metric-value {
  color: #8a5b1c;
}
.metric-card.execution {
  border-top-color: #258577;
}
.metric-card.execution .metric-value {
  color: #156858;
}
.metric-progress {
  height: 4px;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: hidden;
  background: #e9f1ee;
  border-radius: 0 0 12px 12px;
}
.metric-progress > div {
  background: #258577;
  height: 100%;
}
.signals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.signal {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
}
.signal > strong {
  font-size: 30px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.signal h3 {
  margin-bottom: 4px;
  font-size: 12px;
}
.signal p {
  font-size: 11px;
  margin: 0;
  color: var(--muted);
}
.signal.danger {
  border-color: #ead7d9;
  background: #fff9f9;
}
.signal.danger > strong {
  color: var(--danger);
}
.signal.warning {
  border-color: #e7dec8;
  background: #fffcf5;
}
.signal.warning > strong {
  color: var(--warning);
}
.context-note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin: 12px 0 24px;
}
.content-panel > .context-note,
.content-panel > .shiny-html-output > .context-note {
  margin-bottom: 0;
}
.content-panel .shiny-html-output > .context-note {
  margin-bottom: 14px;
}
.table-heading > div:first-child {
  margin-right: auto;
}
.portfolio-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
}
.portfolio-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #65766e;
  background: #f6f8f6;
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
}
.portfolio-table td {
  padding: 16px 12px;
  border-bottom: 1px solid #edf1ee;
  vertical-align: middle;
  font-variant-numeric: tabular-nums;
}
.portfolio-table tbody tr:hover {
  background: #f9fbfa;
}
.portfolio-table tr:last-child td {
  border-bottom: 0;
}
.portfolio-table td:nth-child(2) {
  white-space: normal;
  min-width: 130px;
  max-width: 200px;
}
.table-scroll {
  overflow-x: auto;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.work-cell {
  min-width: 230px;
  max-width: 340px;
  white-space: normal;
}
.work-cell strong {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
  display: block;
}
.work-cell small {
  display: block;
  color: var(--muted);
  margin-top: 7px;
  font-size: 10px;
}
.status-badge {
  display: block;
  width: fit-content;
  font-size: 10px;
  border-radius: 4px;
  padding: 3px 6px;
  margin-top: 7px;
  background: #edf2ef;
  color: #53675d;
}
.status-badge.danger {
  background: #fae8eb;
  color: #9c3542;
}
.status-badge.warning {
  background: #fff0cc;
  color: #825916;
}
.empty-state {
  padding: 40px;
  text-align: center;
  border: 1px dashed #c8d6cd;
  border-radius: 12px;
  background: white;
  color: var(--muted);
  margin-bottom: 24px;
}
.empty-state h3 {
  font-size: 18px;
  color: var(--ink);
}
.app-footer {
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding: 22px 0;
  display: flex;
  justify-content: space-between;
  gap: 20px;
}
.skip-link {
  position: absolute;
  left: 20px;
  top: -100px;
  background: white;
  padding: 10px;
  z-index: 100;
}
.skip-link:focus {
  top: 10px;
}
.shiny-output-error {
  font-size: 13px;
}
.shiny-input-container {
  max-width: 100%;
}
.shiny-plot-output,
.shiny-ipywidget-output {
  max-width: 100%;
  overflow: hidden;
}
@media (min-width: 1550px) {
  .login-intro {
    padding-left: 100px;
    padding-right: 100px;
  }
  .intro-copy h1 {
    font-size: 66px;
  }
}
@media (max-width: 1100px) {
  .filter-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .filter-grid > div:first-child {
    grid-column: span 2;
  }
  .signal {
    padding: 15px;
    gap: 12px;
  }
  .signal > strong {
    font-size: 24px;
  }
  .header-label {
    display: none;
  }
  .table-heading {
    flex-wrap: wrap;
  }
  .table-heading > div:first-child {
    flex-basis: 100%;
  }
  .intro-features {
    gap: 20px;
  }
  .login-intro {
    padding: 35px;
  }
  .login-panel {
    padding: 45px 32px 24px;
  }
}
@media (max-width: 760px) {
  .login-shell {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }
  .login-intro {
    padding: 24px;
  }
  .login-intro .identity img {
    height: 48px;
    width: 42px;
  }
  .login-intro .identity strong {
    font-size: 17px;
  }
  .intro-copy {
    padding: 28px 0 0;
    margin: 0;
  }
  .intro-copy .eyebrow {
    display: none;
  }
  .intro-copy h1 {
    font-size: 32px;
    letter-spacing: -1px;
    margin: 0 0 12px;
  }
  .intro-copy h1 br {
    display: none;
  }
  .intro-copy > p {
    font-size: 13px;
    margin: 0;
    line-height: 1.6;
    max-width: none;
  }
  .intro-features,
  .login-intro footer {
    display: none;
  }
  .login-panel {
    padding: 30px 24px 18px;
  }
  .login-form-wrap {
    max-width: 440px;
  }
  .login-form-wrap h2 {
    font-size: 24px;
  }
  .login-form-wrap h2 br {
    display: none;
  }
  .login-form-wrap > .muted {
    margin-bottom: 22px;
  }
  .login-bottom {
    margin-top: 10px;
  }
  .login-help {
    margin-top: 20px;
    padding-top: 18px;
  }
  .app-header {
    padding: 12px 18px;
    min-height: 76px;
  }
  .identity {
    gap: 9px;
  }
  .identity img {
    width: 34px;
    height: 44px;
  }
  .identity strong {
    font-size: 15px;
  }
  .identity span {
    font-size: 9px;
  }
  .header-actions {
    gap: 10px;
  }
  .user-name {
    display: none;
  }
  .dashboard-main {
    padding: 24px 16px 0;
  }
  .page-heading {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 14px;
  }
  .page-heading h1 {
    font-size: 25px;
  }
  .page-heading .muted {
    font-size: 13px;
  }
  .filter-panel,
  .content-panel {
    padding: 17px;
  }
  .filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }
  .filter-grid > div:first-child {
    grid-column: span 2;
  }
  .filter-grid > div:last-child {
    grid-column: span 2;
  }
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .metric-card {
    min-height: 170px;
    padding: 17px 14px;
  }
  .metric-value {
    font-size: 23px;
    letter-spacing: -0.8px;
  }
  .metric-label {
    font-size: 11px;
    min-height: 32px;
    margin-bottom: 8px;
  }
  .metric-detail {
    font-size: 10px;
  }
  .signals-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .signal {
    padding: 14px 18px;
  }
  .signal > strong {
    min-width: 35px;
  }
  .section-heading h2 {
    font-size: 16px;
  }
  .overview-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }
  .app-footer {
    flex-direction: column;
    gap: 6px;
  }
  .table-heading {
    gap: 12px;
  }
  .table-heading > .shiny-input-container {
    width: 100% !important;
    flex: 1;
    min-width: 140px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

.table-pagination {
  display: flex;
  align-items: end;
  gap: 16px;
  margin-top: 16px;
}
.table-pagination .shiny-input-container {
  margin: 0;
}
.table-pagination > .shiny-text-output {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  padding-bottom: 10px;
}
@media (max-width: 760px) {
  .metric-value {
    font-size: clamp(15px, 4.2vw, 22px);
    white-space: nowrap;
    letter-spacing: -0.5px;
  }
  .table-pagination {
    flex-wrap: wrap;
    gap: 12px;
  }
  .table-pagination > .shiny-text-output {
    width: 100%;
    margin-left: 0;
  }
}

/* Override Bootstrap action-button states while retaining a visible focus ring. */
.btn.text-button,
.btn.text-button:hover,
.btn.text-button:active,
.btn.text-button:focus-visible {
  background: transparent;
  border-color: transparent;
  color: var(--brand);
  box-shadow: none;
}
.btn.text-button:focus-visible {
  outline: 3px solid #5ba799;
  outline-offset: 3px;
}
@media (max-width: 760px) {
  .filter-grid > div:nth-child(4) {
    grid-column: span 2;
  }
}
/* Accessible controls and work records. */
.theme-control,
.login-theme {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.theme-control select,
.login-theme select {
  font: inherit;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px;
  background: var(--surface);
  color: var(--ink);
}
.login-theme {
  align-self: flex-end;
  margin-bottom: 24px;
}
.password-label {
  margin-top: 22px;
}
.password-field {
  position: relative;
}
.password-field input {
  padding-right: 52px !important;
}
.eye-button {
  position: absolute;
  right: 4px;
  top: 4px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
}
.eye-button:hover {
  background: var(--canvas);
}
.eye-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.eye-slash {
  display: none;
}
.eye-button[aria-pressed="true"] .eye-slash {
  display: block;
}
#login-submit {
  justify-content: center;
}
.recovery-button {
  display: block;
  margin: 16px auto 0;
  min-height: 40px;
}
#recovery-message {
  margin-top: 12px;
}
.query-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: -8px 0 24px;
}
#share-feedback {
  font-size: 12px;
}
.work-link {
  font-weight: 650;
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.work-link:hover {
  color: var(--green);
}
.signal {
  text-decoration: none;
  color: var(--ink);
}
.signal:hover {
  box-shadow: 0 0 0 2px var(--brand);
}
.work-detail h2 {
  font-size: 21px;
  line-height: 1.4;
  max-width: 900px;
}
.work-detail .section-heading {
  align-items: flex-start;
}
.work-detail .secondary-button {
  flex-shrink: 0;
}
.work-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 24px 0;
}
.work-facts dt {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.work-facts dd {
  font-size: 13px;
  margin: 5px 0 0;
  overflow-wrap: anywhere;
}
.work-evidence {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}
.work-evidence p,
.work-evidence li {
  font-size: 12px;
}
.content-panel summary {
  cursor: pointer;
  min-height: 44px;
  padding: 12px 0;
  font-size: 13px;
  font-weight: 600;
}
.action-list {
  padding: 0;
  margin: 12px 0;
  list-style: none;
  max-height: 450px;
  overflow: auto;
}
.action-item {
  border-left: 3px solid var(--warning);
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--canvas);
}
.action-item.danger {
  border-left-color: var(--danger);
}
.action-item strong,
.action-item .work-link {
  display: block;
  font-size: 13px;
  margin-bottom: 8px;
}
.action-item p {
  font-size: 12px;
  margin: 0;
}
.pagination-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 8px;
  color: var(--brand);
  text-decoration: underline;
}
.pagination-link.current {
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}
.pagination-link[aria-disabled="true"] {
  color: var(--muted);
  text-decoration: none;
}
.portfolio-pagination {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}
.portfolio-pagination > .shiny-html-output { flex: 1; }
.contract-identifiers > div { display: grid; gap: 2px; margin-bottom: 6px; }
.contract-dates > div { white-space: nowrap; margin-bottom: 6px; }
.page-gap {
  padding: 10px 0;
}
.table-pagination {
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.pagination-count {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
}
.search-container {
  position: relative;
}
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  width: min(560px, 80vw);
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 20px #0002;
  list-style: none;
  padding: 4px;
  margin: 4px 0;
  max-height: 300px;
  overflow: auto;
}
.autocomplete-list li {
  padding: 10px;
  font-size: 13px;
  cursor: pointer;
}
.autocomplete-list li[aria-selected="true"],
.autocomplete-list li:hover {
  background: var(--canvas);
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}
.app-header .theme-control label {
  margin: 0;
}
.portfolio-table a {
  white-space: normal;
  display: block;
}
.content-panel .js-plotly-plot {
  color: var(--ink);
}
:root {
  --surface: #ffffff;
  --soft: #f6f8f6;
}
:root[data-theme="dark"] {
  --brand: #91d5bf;
  --ink: #e1eee8;
  --muted: #b6c9bf;
  --line: #3a5147;
  --canvas: #101e19;
  --surface: #182824;
  --soft: #21372e;
  --danger: #ffadb7;
  --warning: #f1c475;
  --green: #91dac7;
}
[data-theme="dark"] body {
  background: var(--canvas);
  color: var(--ink);
}
[data-theme="dark"] .app-header,
[data-theme="dark"] .filter-panel,
[data-theme="dark"] .content-panel,
[data-theme="dark"] .metric-card,
[data-theme="dark"] .signal,
[data-theme="dark"] .empty-state,
[data-theme="dark"] .secondary-button,
[data-theme="dark"] .skip-link {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
}
[data-theme="dark"] .login-panel {
  background: var(--surface);
}
[data-theme="dark"] .login-page {
  background: var(--surface);
}
[data-theme="dark"] .login-intro {
  background: #103f36;
}
[data-theme="dark"] .login-intro .identity,
[data-theme="dark"] .login-intro h1 {
  color: #f3faf6;
}
[data-theme="dark"] .primary-button {
  background: #235e4f;
  color: #fff;
  border-color: #6aab94;
}
[data-theme="dark"] .primary-button:hover:not(:disabled) {
  background: #2e7462;
}
[data-theme="dark"] #login-form input,
[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select,
[data-theme="dark"] .selectize-input {
  background-color: var(--canvas) !important;
  color: var(--ink) !important;
  border-color: var(--line) !important;
}
[data-theme="dark"] .form-select {
  --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23c2d5ce' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
[data-theme="dark"] .control-label,
[data-theme="dark"] .metric-label {
  color: #c4d7cb;
}
[data-theme="dark"] .metric-card.amendment .metric-value {
  color: #efc17b;
}
[data-theme="dark"] .metric-card.execution .metric-value {
  color: #8cdbc5;
}
[data-theme="dark"] .metric-progress {
  background: #304b40;
}
[data-theme="dark"] .metric-progress > div {
  background: #7dccb2;
}
[data-theme="dark"] .notice {
  background: #203b2e;
  color: #cee4d5;
  border-color: #496d59;
}
[data-theme="dark"] .notice.warning,
[data-theme="dark"] .signal.warning {
  background: #342d1e;
  color: #f0d19a;
  border-color: #67583a;
}
[data-theme="dark"] .notice.danger,
[data-theme="dark"] .signal.danger {
  background: #3a252b;
  color: #ffbdc5;
  border-color: #65414a;
}
[data-theme="dark"] .portfolio-table th {
  background: var(--soft);
  color: #c0d4c8;
}
[data-theme="dark"] .portfolio-table td {
  border-color: var(--line);
}
[data-theme="dark"] .portfolio-table tbody tr:hover {
  background: var(--soft);
}
[data-theme="dark"] .status-badge {
  background: #2c473b;
  color: #c7ddcf;
}
[data-theme="dark"] .status-badge.danger {
  background: #593039;
  color: #ffd0d7;
}
[data-theme="dark"] .status-badge.warning {
  background: #554629;
  color: #ffdea8;
}
[data-theme="dark"] .secondary-button:hover {
  background: var(--soft);
}
[data-theme="dark"] .login-bottom {
  color: var(--muted);
}
[data-theme="dark"] #login-form input::placeholder {
  color: #9db1a5;
}
[data-theme="dark"] .form-control::placeholder {
  color: #9db1a5;
}
[data-theme="dark"] .btn.text-button {
  color: var(--brand);
}
@media (max-width: 760px) {
  .header-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .theme-control {
    flex-direction: column;
    gap: 2px;
  }
  .theme-control select {
    max-width: 112px;
    font-size: 11px;
  }
  .theme-control label {
    font-size: 10px;
  }
  .login-theme {
    margin-bottom: 22px;
  }
  .work-facts {
    grid-template-columns: 1fr 1fr;
  }
  .work-evidence {
    grid-template-columns: 1fr;
  }
  .work-detail .section-heading {
    flex-direction: column;
  }
  .pagination-count {
    width: 100%;
    margin: 8px 0 0;
  }
  .pagination-link {
    padding: 8px;
    min-width: 40px;
  }
  .work-detail h2 {
    font-size: 18px;
  }
  .query-actions {
    gap: 10px;
  }
}
@media (forced-colors: active) {
  .metric-card,
  .signal,
  .pagination-link,
  .eye-button {
    border: 1px solid ButtonText;
  }
  .metric-progress > div {
    background: Highlight;
  }
  .eye-button svg {
    stroke: ButtonText;
  }
}

@media (max-width: 760px) {
  #login-form input,
  .filter-grid .form-control,
  .filter-grid .form-select {
    font-size: 16px !important;
  }
}
#history_plot {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  contain: inline-size;
}

/* Navigation context and searchable filters. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.portfolio-navigation {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin: 1rem 0;
}
.home-link {
  white-space: nowrap;
}
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.filter-chip {
  display: inline-block;
  padding: 0.35rem 0.6rem;
  border: 1px solid currentColor;
  border-radius: 1rem;
  font-size: 0.85rem;
  overflow-wrap: anywhere;
}
#work-title:focus {
  outline: none;
  box-shadow: none;
}
.period-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}
.fact-link {
  display: block;
  width: fit-content;
  margin: 0.25rem 0;
  text-decoration: underline;
}
.theme-control label,
.login-theme label {
  font-size: 1.5rem;
  line-height: 1;
}
.selectize-dropdown,
.selectize-input,
.selectize-input input {
  color: var(--text);
}
[data-theme="dark"] .selectize-dropdown {
  background: #182824;
  color: #e6f1ec;
  border-color: #52685d;
}
[data-theme="dark"] .selectize-dropdown .active {
  background: #354b42;
  color: #fff;
}
[data-theme="dark"] .selectize-input input {
  color: #e6f1ec;
}
[data-theme="dark"] .datepicker {
  background: #182824;
  color: #e6f1ec;
}
[data-theme="dark"] .datepicker td.day:hover,
[data-theme="dark"] .datepicker th:hover {
  background: #354b42;
}
@media (max-width: 800px) {
  .period-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .portfolio-navigation {
    flex-direction: column;
  }
}
@media (max-width: 480px) {
  .period-grid {
    grid-template-columns: 1fr;
  }
}

/* Appearance popover shared by the login and dashboard. */
.appearance-menu {
  position: relative;
  display: inline-flex;
}
.appearance-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.app-header .appearance-trigger {
  color: var(--ink);
}
.appearance-trigger:hover,
.appearance-trigger[aria-expanded="true"] {
  background: rgb(128 128 128 / 15%);
}
.appearance-options {
  position: absolute;
  right: 0;
  top: calc(100% + 12px);
  z-index: 1100;
  width: 240px;
  max-width: calc(100vw - 40px);
  padding: 14px 0;
  border-radius: 20px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 14px 36px rgb(0 0 0 / 20%);
  border: 1px solid var(--line);
}
.appearance-options[hidden] {
  display: none;
}
.appearance-options button {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: .6rem 1rem;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  cursor: pointer;
}
.appearance-options button:hover,
.appearance-options button:focus-visible {
  background: rgb(128 128 128 / 12%);
  outline-offset: -3px;
}
.theme-check {
  color: #249d86;
  font-size: 24px;
  visibility: hidden;
}
[aria-checked="true"] .theme-check {
  visibility: visible;
}
[data-theme="dark"] .theme-check {
  color: #8cdbc5;
}

.login-intro::after {
  inset: 0;
  width: auto;
  height: auto;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background-image: var(--login-background-image, none);
  background-size: 420px 340px;
  background-repeat: repeat;
  pointer-events: none;
  z-index: 0;
}
.login-intro > * {
  position: relative;
  z-index: 1;
}
.privacy-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100dvh - 40px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 70px rgb(0 0 0 / 25%);
  font-size: 15px;
  line-height: 1.6;
}
.privacy-dialog::backdrop {
  background: rgb(0 0 0 / 50%);
}
.privacy-dialog h2 {
  font-size: 24px;
  margin-top: 0;
}
.privacy-dialog h2:focus {
  outline: none;
}
.privacy-dialog h3 {
  font-size: 17px;
  margin: 20px 0 8px;
}
.privacy-dialog a {
  color: var(--brand);
  text-decoration: underline;
}
.privacy-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}
.privacy-actions .primary-button {
  width: auto;
  min-width: 140px;
  padding: 12px 20px;
}
.login-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.privacy-banner {
  position: fixed;
  inset: auto 0 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px clamp(20px, 4vw, 48px);
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  background: #dce5e0;
  color: #293d34;
  border-top: 1px solid #c5d4cb;
  font-size: 14px;
  line-height: 1.5;
}
.privacy-banner[hidden] {
  display: none;
}
.privacy-banner p {
  margin: 0;
}
.privacy-more {
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
.privacy-banner .primary-button {
  width: auto;
  flex-shrink: 0;
  min-height: 44px;
  padding: 10px 20px;
  margin: 0;
}
.privacy-banner-visible body {
  padding-bottom: var(--privacy-banner-height, 100px);
}
.privacy-actions {
  gap: 12px;
  flex-wrap: wrap;
}
[data-theme="dark"] .privacy-banner {
  background: #253c32;
  color: #e1eee7;
  border-color: #496153;
}
@media (max-width: 600px) {
  .privacy-banner {
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
    padding: 14px 20px;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }
  .privacy-banner .primary-button {
    align-self: flex-end;
  }
}

.status-badge.success {
  background: #dff3e6;
  color: #17603b;
}
[data-theme="dark"] .status-badge.success {
  background: #204b35;
  color: #a5e9bd;
}

.sort-heading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  border: 0;
  padding: 4px 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.sort-heading span {
  white-space: nowrap;
}
.sort-heading:hover {
  text-decoration: underline;
}

.work-map { display: block; width: 100%; height: 320px; border: 1px solid var(--line); border-radius: 10px; margin: 12px 0; }
.source-location { margin-top: 24px; }

/* Bootstrap supplies portfolio controls, card, table and pagination. */
.portfolio-panel { min-width: 0; margin-bottom: 24px; color: var(--bs-body-color); }
.portfolio-panel h2 { font-size: 1.1rem; margin: 0; }
.portfolio-panel .portfolio-grid { max-height: 620px; }
.portfolio-panel .portfolio-bs-table { table-layout: fixed; min-width: 1430px; font-size: .8rem; }
.portfolio-bs-table > :not(caption) > * > * { padding: .8rem; overflow-wrap: anywhere; }
.portfolio-bs-table thead th { position: sticky; top: 0; z-index: 1; background: var(--bs-tertiary-bg); }
.portfolio-sort { font-size: .75rem; font-weight: 600; }
.portfolio-bs-table th:nth-child(1) { width: 125px; }
.portfolio-bs-table th:nth-child(2) { width: 250px; }
.portfolio-bs-table th:nth-child(3) { width: 160px; }
.portfolio-bs-table th:nth-child(4) { width: 120px; }
.portfolio-bs-table th:nth-child(5), .portfolio-bs-table th:nth-child(6), .portfolio-bs-table th:nth-child(8) { width: 115px; }
.portfolio-bs-table th:nth-child(7), .portfolio-bs-table th:nth-child(9) { width: 75px; }
.portfolio-bs-table th:nth-child(10) { width: 145px; }
.portfolio-bs-table th:nth-child(11) { width: 135px; }
.portfolio-bs-table .work-cell { min-width: 0; max-width: none; }
.portfolio-bs-table .work-link { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-weight: 600; }
.portfolio-bs-table .contract-identifiers > div { display: grid; gap: 2px; }
.portfolio-bs-table .contract-identifiers strong, .portfolio-bs-table .contract-dates small { font-size: .7rem; color: var(--bs-secondary-color); }
.portfolio-bs-table .contract-dates small { display: block; }
.portfolio-bs-table .contract-dates > div { white-space: normal; }
.portfolio-bs-table .status-badge { white-space: normal; margin: 0; }
.company-portfolio .portfolio-bs-table { min-width: 900px; }
.company-portfolio .portfolio-bs-table th { width: 125px; }
.company-portfolio .portfolio-bs-table th:first-child { width: 240px; }
.company-portfolio .portfolio-bs-table th:nth-child(2) { width: 85px; }
.portfolio-footer > .shiny-input-container { margin: 0; display: flex; align-items: center; gap: 10px; width: auto !important; }
.portfolio-footer .control-label { margin: 0; white-space: nowrap; font-size: .8rem; }
.portfolio-footer select { width: 90px; }
.portfolio-footer > .shiny-html-output { flex: 1; min-width: 260px; }
.portfolio-footer .pagination-count { margin: 0; }
.portfolio-panel #sort_summary p { padding: .5rem 1rem; margin: 0; font-size: .75rem; }
.portfolio-panel .empty-state { padding: 2rem; }
@media (max-width: 600px) { .portfolio-footer > .shiny-html-output { flex-basis: 100%; min-width: 0; } }
.portfolio-bs-table thead th { overflow-wrap: normal; }
/* Configure Bootstrap component variables using the application's theme. */
.portfolio-panel .btn-outline-primary {
  --bs-btn-color: var(--brand);
  --bs-btn-border-color: var(--brand);
  --bs-btn-hover-bg: #14564b;
  --bs-btn-hover-border-color: #14564b;
  --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: #14564b;
  --bs-btn-active-border-color: #14564b;
  --bs-btn-active-color: #fff;
}
.portfolio-panel .btn-outline-secondary {
  --bs-btn-color: var(--ink);
  --bs-btn-border-color: var(--line);
  --bs-btn-hover-bg: var(--canvas);
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-border-color: var(--muted);
  --bs-btn-active-bg: var(--canvas);
  --bs-btn-active-color: var(--ink);
}
.portfolio-panel .portfolio-sort { color: var(--ink) !important; }
.portfolio-panel .pagination {
  --bs-pagination-color: var(--brand);
  --bs-pagination-bg: var(--surface);
  --bs-pagination-border-color: var(--line);
  --bs-pagination-hover-color: var(--ink);
  --bs-pagination-hover-bg: var(--canvas);
  --bs-pagination-hover-border-color: var(--line);
  --bs-pagination-focus-color: var(--ink);
  --bs-pagination-focus-bg: var(--canvas);
  --bs-pagination-active-bg: #14564b;
  --bs-pagination-active-border-color: #14564b;
  --bs-pagination-active-color: #fff;
  --bs-pagination-disabled-color: var(--muted);
  --bs-pagination-disabled-bg: var(--canvas);
  --bs-pagination-disabled-border-color: var(--line);
}
/* Shiny's compiled Bootstrap theme also sets literal colors for these states. */
.portfolio-panel .btn-outline-secondary:is(:hover, :focus, :active) {
  background-color: var(--canvas);
  color: var(--ink);
}
