:root {
  --ink: #f4f7f1;
  --muted: #9ba99d;
  --surface: rgba(18, 29, 23, 0.88);
  --surface-strong: #17251d;
  --line: rgba(226, 240, 229, 0.11);
  --green: #78d69b;
  --green-strong: #35ad69;
  --gold: #e0bd70;
  --danger: #ff8b85;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
}

* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #09110c;
  overflow-x: hidden;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
.hidden {
  display: none !important;
}
.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(90px);
  opacity: 0.18;
  pointer-events: none;
}
.ambient-one {
  width: 38rem;
  height: 38rem;
  background: #3adc78;
  top: -18rem;
  right: -10rem;
}
.ambient-two {
  width: 28rem;
  height: 28rem;
  background: #d2aa55;
  bottom: -16rem;
  left: 10%;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem;
}
.login-card {
  width: min(29rem, 100%);
  padding: 2.5rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  background: linear-gradient(
    145deg,
    rgba(28, 46, 35, 0.94),
    rgba(12, 22, 16, 0.92)
  );
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}
/* .brand-mark { width: 4rem; height: 4rem; display: grid; place-items: center; border-radius: 1.25rem; background: linear-gradient(135deg, var(--green), var(--gold)); color: #0a160e; font-weight: 900; letter-spacing: -.08em; }
.brand-mark.small { width: 2.6rem; height: 2.6rem; border-radius: .85rem; font-size: .84rem; } */
.brand-mark {
  width: 90px;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand-mark.small {
  width: 4rem;
  height: 4rem;
  margin-bottom: 0;
  flex: none;
}
h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.04em;
}
h1 {
  margin-top: 0.35rem;
  font-size: clamp(2.4rem, 8vw, 4rem);
  line-height: 0.95;
}
h2 {
  font-size: clamp(1.65rem, 4vw, 2.4rem);
}
h3 {
  font-size: 1.35rem;
}
.eyebrow {
  margin: 0 0 0.35rem;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.7rem;
  font-weight: 800;
}
.muted {
  color: var(--muted);
  line-height: 1.6;
}
.stack {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}
label {
  display: grid;
  gap: 0.45rem;
  color: #c8d2ca;
  font-size: 0.84rem;
  font-weight: 650;
}
input,
select,
textarea {
  width: 100%;
  color: var(--ink);
  background: rgba(4, 11, 7, 0.56);
  border: 1px solid var(--line);
  border-radius: 0.8rem;
  padding: 0.78rem 0.9rem;
  outline: none;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
textarea {
  min-height: 7rem;
  resize: vertical;
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(120, 214, 155, 0.13);
}
.password-input {
  position: relative;
  display: block;
}
.password-input input {
  padding-right: 3rem;
}
.password-toggle {
  position: absolute;
  top: 50%;
  right: 0.35rem;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  transform: translateY(-50%);
  color: var(--muted);
  background: transparent;
  font-size: 1rem;
}
.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--ink);
  background: rgba(120, 214, 155, 0.1);
}
button {
  border: 0;
  border-radius: 0.8rem;
  padding: 0.72rem 1rem;
  font-weight: 760;
}
button.primary {
  color: #07120b;
  background: linear-gradient(135deg, var(--green), #9fe7b8);
  box-shadow: 0 10px 28px rgba(53, 173, 105, 0.18);
}
button.secondary {
  color: var(--ink);
  background: #294535;
}
button.ghost {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
}
button.danger {
  color: #2b0907;
  background: var(--danger);
}
button.compact {
  padding: 0.48rem 0.7rem;
  font-size: 0.75rem;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.form-error {
  min-height: 1.1rem;
  margin: 0;
  color: var(--danger);
  font-size: 0.82rem;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 17rem 1fr;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 1.15rem;
  border-right: 1px solid var(--line);
  background: rgba(9, 17, 12, 0.83);
  backdrop-filter: blur(24px);
  z-index: 5;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.4rem 0.35rem 1.25rem;
}
.sidebar-brand strong,
.sidebar-brand span {
  display: block;
}
.sidebar-brand span {
  margin-top: 0.18rem;
  color: var(--muted);
  font-size: 0.7rem;
}
nav {
  display: grid;
  gap: 0.25rem;
}
nav button {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  width: 100%;
  color: var(--muted);
  background: transparent;
  text-align: left;
}
nav button:hover,
nav button.active {
  color: var(--ink);
  background: rgba(120, 214, 155, 0.1);
}
.nav-icon {
  width: 1.4rem;
  color: var(--green);
  text-align: center;
}
.sidebar-user {
  margin-top: auto;
  display: grid;
  gap: 0.2rem;
  padding: 1rem;
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.035);
}
.sidebar-user small {
  color: var(--gold);
  margin-bottom: 0.6rem;
}
.workspace {
  min-width: 0;
  padding: 1.2rem clamp(1rem, 3vw, 2.7rem) 3rem;
}
.topbar {
  min-height: 5.3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.topbar > div:nth-child(2) {
  flex: 1;
}
.page-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.icon-button {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  font-size: 1.2rem;
}
#menu-button {
  display: none;
}
.page-content {
  display: grid;
  gap: 1rem;
}
.notice {
  margin: 0.5rem 0 1rem;
  padding: 0.8rem 1rem;
  color: #dff8e6;
  background: rgba(53, 173, 105, 0.14);
  border: 1px solid rgba(120, 214, 155, 0.25);
  border-radius: 0.8rem;
}
.notice.error {
  color: #ffd9d6;
  background: rgba(255, 139, 133, 0.12);
  border-color: rgba(255, 139, 133, 0.25);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}
.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 1.25rem;
  background: var(--surface);
  box-shadow: 0 15px 50px rgba(0, 0, 0, 0.16);
}
.metric {
  padding: 1.2rem;
}
.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}
.metric strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 2rem;
  letter-spacing: -0.05em;
}
.panel {
  overflow: hidden;
}
.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.panel-header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.empty {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 0.86rem 1rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 0.82rem;
}
th {
  color: var(--muted);
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
}
tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}
.cell-title {
  display: block;
  font-weight: 760;
}
.cell-subtitle {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.72rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  color: var(--green);
  background: rgba(120, 214, 155, 0.1);
  font-size: 0.66rem;
  font-weight: 850;
  letter-spacing: 0.05em;
}
.badge.warn {
  color: var(--gold);
  background: rgba(224, 189, 112, 0.1);
}
.badge.off {
  color: #bbc3bd;
  background: rgba(187, 195, 189, 0.08);
}
.row-actions {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
}
.filters {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}
.filters input,
.filters select {
  width: auto;
  min-width: 10rem;
}
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(17rem, 0.7fr);
  gap: 1rem;
}
.timeline {
  display: grid;
  gap: 0.8rem;
  padding: 1.1rem;
}
.timeline-item {
  padding-left: 1rem;
  border-left: 2px solid rgba(120, 214, 155, 0.35);
}
.timeline-item p {
  margin: 0.2rem 0;
}
.timeline-item small {
  color: var(--muted);
}
.change-review {
  display: grid;
  gap: 0.7rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: rgba(255, 255, 255, 0.025);
}
.change-review h4 {
  margin: 0 0 0.2rem;
}
.change-row {
  display: grid;
  grid-template-columns: minmax(9rem, 0.7fr) repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  align-items: start;
  padding: 0.8rem 0;
  border-top: 1px solid var(--line);
}
.change-row > strong {
  color: var(--green);
}

dialog {
  width: min(50rem, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  padding: 0;
  color: var(--ink);
  background: #111e16;
  border: 1px solid var(--line);
  border-radius: 1.4rem;
  box-shadow: var(--shadow);
}
dialog::backdrop {
  background: rgba(2, 7, 4, 0.76);
  backdrop-filter: blur(8px);
}
.activity-dialog {
  width: min(30rem, calc(100% - 2rem));
  overflow: hidden;
  text-align: center;
  background: linear-gradient(145deg, #17271d, #0d1811);
}
.activity-dialog::backdrop {
  background: rgba(2, 7, 4, 0.82);
  backdrop-filter: blur(12px);
}
.activity-card {
  display: grid;
  justify-items: center;
  gap: 0.65rem;
  padding: clamp(2rem, 7vw, 3.5rem);
}
.activity-card .eyebrow,
.activity-card .muted {
  margin: 0;
}
.activity-mark {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
  margin-bottom: 0.65rem;
}
.activity-mark::before,
.activity-mark::after {
  content: '';
  position: absolute;
  border-radius: 50%;
}
.activity-mark::before {
  inset: 0;
  border: 3px solid rgba(120, 214, 155, 0.14);
  border-top-color: var(--green);
  border-right-color: var(--gold);
  animation: activity-spin 0.85s linear infinite;
}
.activity-mark::after {
  inset: 0.6rem;
  display: grid;
  place-items: center;
  background: #111e16;
  font-size: 2rem;
  font-weight: 900;
}
.activity-dialog.is-complete .activity-mark::before,
.activity-dialog.is-error .activity-mark::before {
  animation: none;
  border-color: currentColor;
}
.activity-dialog.is-complete .activity-mark,
.activity-dialog.is-complete #activity-title {
  color: var(--green);
}
.activity-dialog.is-complete .activity-mark::after {
  content: '✓';
}
.activity-dialog.is-error .activity-mark,
.activity-dialog.is-error #activity-title {
  color: var(--danger);
}
.activity-dialog.is-error .activity-mark::after {
  content: '!';
}
@keyframes activity-spin {
  to {
    transform: rotate(1turn);
  }
}
@media (prefers-reduced-motion: reduce) {
  .activity-mark::before {
    animation: none;
  }
}
.modal-shell > header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  background: #111e16;
  border-bottom: 1px solid var(--line);
}
.modal-content {
  padding: 1.25rem;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
.form-grid .wide {
  grid-column: 1 / -1;
}
.form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  padding-top: 0.5rem;
}
.checkbox {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  align-self: end;
  padding: 0.75rem 0;
}
.checkbox input {
  width: 1rem;
}

@media (max-width: 960px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .two-column {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    width: 17rem;
    transform: translateX(-105%);
    transition: transform 0.2s;
    box-shadow: var(--shadow);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  #menu-button {
    display: grid;
  }
  .workspace {
    padding-inline: 1rem;
  }
  .topbar {
    align-items: flex-start;
    padding-block: 0.8rem;
  }
  .page-actions {
    width: 100%;
  }
  .metric-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .topbar {
    flex-wrap: wrap;
  }
  .change-row {
    grid-template-columns: 1fr;
  }
}

/* ── Bulk selection and run progress ──────────────────────────────────────── */
.pick-list {
  display: grid;
  gap: 0.5rem;
}
.pick-row {
  display: grid;
  grid-template-columns: 1.1rem 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 0.85rem;
  background: rgba(9, 17, 12, 0.45);
  cursor: pointer;
  transition:
    border-color 0.2s,
    background 0.2s;
}
.pick-row:hover:not(.disabled) {
  border-color: rgba(120, 214, 155, 0.35);
  background: rgba(41, 69, 53, 0.35);
}
.pick-row.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.pick-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--green-strong);
}
.pick-count {
  font-weight: 800;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.run-shell {
  display: grid;
  gap: 1rem;
}
.run-total {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}
.run-total b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.run-warn {
  margin: 0;
  padding: 0.7rem 0.85rem;
  border-radius: 0.8rem;
  font-size: 0.85rem;
  color: #ffd9d6;
  background: rgba(255, 139, 133, 0.1);
  border: 1px solid rgba(255, 139, 133, 0.25);
}

.run-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
.run-step {
  margin: 0;
  font-weight: 700;
}
.run-head small {
  display: block;
  color: var(--muted);
}
.run-spinner {
  position: relative;
  flex-shrink: 0;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  background: conic-gradient(
    from 0turn,
    rgba(120, 214, 155, 0) 0turn,
    var(--green) 0.82turn,
    rgba(120, 214, 155, 0) 1turn
  );
  animation: run-spin 0.9s linear infinite;
}
.run-spinner::after {
  content: '';
  position: absolute;
  inset: 0.34rem;
  border-radius: 50%;
  background: #111e16;
}
@keyframes run-spin {
  to {
    transform: rotate(1turn);
  }
}
.run-spinner.done {
  animation: none;
  background: conic-gradient(var(--green) 1turn);
}
.run-spinner.failed {
  animation: none;
  background: conic-gradient(var(--danger) 1turn);
}
.run-spinner.done::before,
.run-spinner.failed::before {
  content: '✓';
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: var(--green);
}
.run-spinner.failed::before {
  content: '!';
  color: var(--danger);
}

.run-bar {
  height: 0.55rem;
  border-radius: 999px;
  background: rgba(226, 240, 229, 0.08);
  overflow: hidden;
}
.run-bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--green-strong),
    var(--green),
    var(--gold),
    var(--green)
  );
  background-size: 300% 100%;
  animation: run-sheen 2.4s linear infinite;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes run-sheen {
  to {
    background-position: -300% 0;
  }
}
.run-bar-fill.indeterminate {
  width: 32%;
  animation:
    run-sheen 2.4s linear infinite,
    run-slide 1.4s ease-in-out infinite;
}
@keyframes run-slide {
  0% {
    margin-left: -32%;
  }
  100% {
    margin-left: 100%;
  }
}

.run-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem;
  color: var(--muted);
  font-size: 0.82rem;
}
.run-stats b {
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.run-log {
  display: grid;
  gap: 0.35rem;
  max-height: 16rem;
  overflow-y: auto;
}
.run-item {
  display: grid;
  grid-template-columns: 1.1rem 1fr auto;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 0.7rem;
  background: rgba(9, 17, 12, 0.5);
  animation: run-in 0.28s ease both;
}
@keyframes run-in {
  from {
    opacity: 0;
    transform: translateY(-0.35rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.run-item .mark {
  font-weight: 800;
}
.run-item.ok .mark {
  color: var(--green);
}
.run-item.fail .mark {
  color: var(--danger);
}
.run-item small {
  color: var(--muted);
  text-align: right;
}

@media (prefers-reduced-motion: reduce) {
  .run-spinner,
  .run-bar-fill,
  .run-item {
    animation: none !important;
  }
}
@media (max-width: 760px) {
  .run-item,
  .pick-row {
    grid-template-columns: 1.1rem 1fr;
  }
  .run-item small,
  .pick-count {
    grid-column: 2;
    text-align: left;
  }
}
