:root {
  --green: #a8cc38;
  --green-deep: #6d8d11;
  --green-soft: #f1f8dd;
  --ink: #050705;
  --muted: #687064;
  --line: #dde6d8;
  --paper: #ffffff;
  --wash: #f5f8f4;
  --danger: #dc3f3f;
  --warning: #f2b84b;
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--wash);
  font-family: "Google Sans Flex", "Google Sans", Arial, sans-serif;
  letter-spacing: 0;
}

button,
select,
input {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  color: #fff;
  background: #050705;
  border-right: 1px solid #111;
}

.brand {
  display: flex;
  align-items: center;
  padding-bottom: 26px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-logo {
  display: block;
  width: min(100%, 190px);
  height: auto;
}

.side-panel span,
.side-panel small {
  display: block;
}

.side-panel small {
  color: rgba(255, 255, 255, 0.64);
  font-size: 11px;
  line-height: 1.5;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 24px;
}

.nav-list a {
  color: rgba(255, 255, 255, 0.7);
  padding: 11px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}

.nav-list a.active,
.nav-list a:hover {
  color: #061007;
  background: var(--green);
}

.side-panel {
  position: absolute;
  right: 18px;
  bottom: 24px;
  left: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
}

.month-filter {
  width: 100%;
  min-width: 0;
  height: 24px;
  padding: 0 18px 0 0;
  color: var(--green);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: left;
}

.month-filter:focus {
  box-shadow: none;
}

.side-panel strong {
  display: block;
  margin-top: 8px;
  color: #fff;
  font-size: 48px;
  font-weight: 700;
  line-height: 0.95;
}

.side-panel small {
  margin-top: 6px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.panel-label,
.eyebrow {
  margin: 0 0 6px;
  color: var(--green-deep);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.dashboard {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: flex-end;
  gap: 18px;
  margin-bottom: 18px;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.05;
}

h2 {
  font-size: 17px;
  line-height: 1.2;
  text-transform: uppercase;
}

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

select {
  min-width: 150px;
  height: 38px;
  padding: 0 34px 0 12px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.language-toggle {
  display: inline-grid;
  grid-template-columns: repeat(2, 34px);
  height: 34px;
  padding: 3px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.language-toggle button {
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.language-toggle button.active {
  color: var(--ink);
  background: var(--green);
}

select:focus {
  border-color: var(--green-deep);
  box-shadow: 0 0 0 3px rgba(168, 204, 56, 0.24);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.kpi,
.panel,
.request-section {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.kpi {
  padding: 16px;
  min-height: 112px;
}

.kpi span,
.kpi small,
.result-count,
.meta,
td {
  color: var(--muted);
}

.kpi span {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.kpi strong {
  display: block;
  margin-top: 10px;
  font-size: 34px;
  line-height: 1;
}

.kpi small {
  display: block;
  margin-top: 10px;
  font-size: 11px;
}

.kpi.danger {
  border-color: rgba(220, 63, 63, 0.28);
  background: #fff6f6;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  align-items: stretch;
  gap: 12px;
}

.panel,
.request-section {
  padding: 16px;
}

.donut-panel {
  display: flex;
  grid-column: span 4;
  min-height: 366px;
  flex-direction: column;
}

.load-panel {
  grid-column: span 3;
  min-height: 276px;
}

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

.wide {
  grid-column: span 6;
}

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

.panel-head.compact {
  margin-bottom: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 10px;
  color: var(--green-deep);
  background: var(--green-soft);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.dark {
  color: #fff;
  background: var(--ink);
}

.bar-list {
  display: grid;
  gap: 12px;
}

.bar-row {
  display: grid;
  gap: 7px;
}

.bar-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  font-weight: 700;
}

.bar-value {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.track {
  height: 10px;
  overflow: hidden;
  background: #edf2ee;
  border-radius: 999px;
}

.fill {
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--green-deep), var(--green));
  border-radius: inherit;
}

.tight {
  gap: 10px;
}

.tight .track {
  height: 8px;
}

.donut-wrap {
  position: relative;
  display: grid;
  min-height: 190px;
  place-items: center;
}

.compact-donut {
  min-height: 190px;
}

.donut {
  width: 160px;
  height: 160px;
  background: conic-gradient(#dfe8e1 0deg, #dfe8e1 360deg);
  border-radius: 50%;
  animation: donutReveal 820ms ease-out both;
}

.donut::after {
  display: block;
  width: 104px;
  height: 104px;
  margin: 28px;
  content: "";
  background: var(--paper);
  border-radius: 50%;
}

.donut-center {
  position: absolute;
  display: grid;
  place-items: center;
}

.donut-center strong {
  font-size: 29px;
}

.donut-center span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.status-summary,
.revision-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  min-height: 58px;
  margin-bottom: 12px;
  margin-top: auto;
}

.status-card,
.revision-summary > div {
  min-width: 0;
  padding: 10px 8px;
  background: #fbfdfb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.status-card strong,
.revision-summary strong {
  display: block;
  color: inherit;
  font-size: 18px;
  line-height: 1;
}

.status-card small,
.revision-summary span {
  display: block;
  color: inherit;
  font-size: 9px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: uppercase;
}

.full-color-card {
  border-width: 0;
}

.full-color-card small {
  opacity: 0.78;
}

.card-numbers {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 6px;
  margin-top: 10px;
}

.card-numbers b {
  display: block;
  font-size: 18px;
  line-height: 1;
}

.ratio-denominator {
  font-size: 0.66em;
  font-weight: 500;
  opacity: 0.72;
}

.ratio-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 1px;
  white-space: nowrap;
}

.danger-glow {
  animation: dangerPulse 2.2s ease-in-out infinite;
  box-shadow: 0 0 0 1px rgba(220, 63, 63, 0.2), 0 0 24px rgba(220, 63, 63, 0.28);
}

.soft-alert {
  box-shadow: 0 0 18px rgba(164, 170, 165, 0.22);
}

@keyframes dangerPulse {
  0%,
  100% {
    box-shadow: 0 0 0 1px rgba(220, 63, 63, 0.2), 0 0 18px rgba(220, 63, 63, 0.2);
  }

  50% {
    box-shadow: 0 0 0 1px rgba(220, 63, 63, 0.38), 0 0 30px rgba(220, 63, 63, 0.46);
  }
}

@keyframes donutReveal {
  from {
    opacity: 0;
    transform: rotate(-28deg) scale(0.92);
    filter: saturate(0.8);
  }

  to {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    filter: saturate(1);
  }
}

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

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

.fill-danger {
  background: linear-gradient(90deg, #a42020, var(--danger));
}

.subhead {
  margin: 4px 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

.alert-list {
  display: grid;
  gap: 8px;
  max-height: 278px;
  overflow: auto;
  padding-right: 4px;
}

.alert-item {
  display: grid;
  grid-template-columns: minmax(70px, auto) 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: #fbfdfb;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.alert-item strong,
.task-main {
  font-size: 12px;
}

.alert-item .tag,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.alert-item .tag {
  color: #fff;
  background: var(--ink);
}

.request-section {
  margin-top: 12px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
  background: var(--paper);
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #fff;
  background: var(--ink);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

td {
  font-size: 11px;
  line-height: 1.35;
}

tbody tr:hover {
  background: var(--green-soft);
}

.status-pill.done {
  color: var(--green-deep);
  background: var(--green-soft);
}

.status-pill.processing {
  color: #504000;
  background: #fff4c7;
}

.status-pill.confirming {
  color: #245049;
  background: #dff3ee;
}

.status-pill.briefing {
  color: #545454;
  background: #eeeeee;
}

.rev-risk {
  color: #fff;
  background: var(--danger);
}

.rev-ok {
  color: var(--green-deep);
  background: var(--green-soft);
}

.cell-strong {
  color: var(--ink);
  font-weight: 700;
}

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

  .sidebar {
    position: static;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: auto;
    gap: 14px;
    padding: 14px 16px;
  }

  .brand {
    flex: 1 1 auto;
    min-width: 0;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .brand-logo {
    width: min(48vw, 220px);
  }

  .nav-list {
    display: none;
  }

  .side-panel {
    position: static;
    flex: 0 0 auto;
    min-width: 118px;
    padding: 9px 12px;
    text-align: right;
  }

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

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

  .wide {
    grid-column: 1 / -1;
  }

  .donut-panel {
    grid-column: span 2;
  }

  .load-panel {
    grid-column: span 3;
  }

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

@media (max-width: 760px) {
  .dashboard {
    padding: 14px 8px;
  }

  .topbar {
    align-items: start;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    margin-bottom: 10px;
  }

  .top-actions {
    grid-column: 1 / -1;
  }

  .section-head {
    align-items: flex-start;
    flex-direction: row;
  }

  .top-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }

  .top-actions select {
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 20px 0 10px;
    font-size: 12px;
    text-overflow: ellipsis;
  }

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

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

  .wide {
    grid-column: auto;
  }

  .donut-panel,
  .load-panel,
  .full-row {
    grid-column: auto;
  }

  .donut-panel {
    min-height: auto;
  }

  .load-panel {
    min-height: auto;
  }

  .sidebar {
    align-items: center;
    flex-direction: row;
    padding: 10px 8px;
  }

  .side-panel {
    width: auto;
    min-width: 112px;
  }

  .side-panel strong {
    margin-top: 4px;
    font-size: 30px;
  }

  .side-panel small,
  .panel-label {
    font-size: 12px;
  }

  .month-filter {
    height: 24px;
    font-size: 12px;
    text-align: right;
    text-align-last: right;
  }

  .brand-logo {
    width: min(54vw, 210px);
  }

  h1 {
    font-size: 24px;
  }

  .eyebrow {
    font-size: 12px;
  }

  .kpi {
    display: grid;
    grid-template-rows: 32px 38px 30px;
    min-height: 126px;
    padding: 12px 10px 10px;
  }

  .kpi span {
    font-size: 12px;
    line-height: 1.1;
    display: flex;
    align-items: flex-start;
    min-width: 0;
    overflow-wrap: normal;
    word-break: normal;
  }

  .kpi strong {
    align-self: center;
    margin-top: 0;
    font-size: 30px;
  }

  .kpi small {
    align-self: end;
    margin-top: 0;
    font-size: 12px;
    line-height: 1.2;
    min-width: 0;
    overflow-wrap: normal;
  }

  .status-panel {
    order: -1;
  }

  #revisionPanel {
    order: 0;
  }

  .alert-item {
    grid-template-columns: 1fr;
  }

  .status-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
  }

  .status-card {
    padding: 10px 8px;
  }

  .status-card strong {
    font-size: 15px;
  }

  .status-card small {
    font-size: 10px;
  }

  .card-numbers {
    align-items: flex-end;
    flex-direction: row;
    gap: 4px;
    margin-top: 6px;
  }

  .card-numbers b {
    font-size: 15px;
  }
}
