:root {
  color-scheme: light;
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-strong: #f8fafc;
  --ink: #111827;
  --muted: #5b677a;
  --line: #d7dde7;
  --brand: #11624f;
  --brand-strong: #0b4639;
  --brand-soft: #dff4ee;
  --warning: #a15c00;
  --warning-soft: #fff3d6;
  --success: #17663c;
  --success-soft: #dff7e9;
  --danger: #a83232;
  --danger-soft: #ffe3e3;
  --shadow: 0 18px 50px rgb(15 23 42 / 0.12);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button,
a,
input,
select,
textarea {
  outline-offset: 3px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgb(17 98 79 / 0.35);
}

button {
  border: 0;
  border-radius: 10px;
  padding: 0.72rem 0.95rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--brand);
  color: #ffffff;
  transition:
    transform 160ms ease-out,
    background 160ms ease-out,
    opacity 160ms ease-out;
}

button:hover:not(:disabled) {
  background: var(--brand-strong);
  transform: translateY(-1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

button.secondary {
  background: #e9eef5;
  color: var(--ink);
  border: 1px solid var(--line);
}

button.secondary:hover:not(:disabled) {
  background: #dce4ef;
}

button.ghost {
  background: transparent;
  color: var(--brand-strong);
  border: 1px solid var(--line);
}

a {
  color: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.25rem;
  background: #10231f;
  color: #f9fafb;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #40d6a8;
  color: #08231c;
  font-weight: 900;
}

.brand strong,
.brand span,
.project-card strong,
.project-card span {
  display: block;
}

.brand span,
.project-card span {
  color: #bfd2cc;
  font-size: 0.87rem;
}

.nav-list {
  display: grid;
  gap: 0.4rem;
}

.nav-list a {
  text-decoration: none;
  padding: 0.75rem 0.8rem;
  border-radius: 10px;
  color: #dbe7e3;
}

.nav-list a:hover {
  background: rgb(255 255 255 / 0.08);
}

.project-card {
  margin-top: auto;
  padding: 1rem;
  border-radius: 14px;
  background: rgb(255 255 255 / 0.08);
  border: 1px solid rgb(255 255 255 / 0.12);
}

.workspace {
  padding: 1.5rem;
  display: grid;
  gap: 1rem;
}

.topbar,
.panel,
.metric {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  border-radius: 22px;
  padding: 1.4rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.topbar h1 {
  margin: 0 0 0.45rem;
  font-size: 2rem;
  line-height: 1.12;
  text-wrap: balance;
}

.topbar p {
  margin: 0;
  max-width: 75ch;
  color: var(--muted);
}

.topbar-actions,
.actions,
.row-actions {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}

.kicker,
.label {
  margin: 0 0 0.3rem;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.metric {
  border-radius: 18px;
  padding: 1rem;
}

.metric strong {
  display: block;
  font-size: 1.9rem;
  line-height: 1.1;
}

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

.split-layout {
  display: grid;
  grid-template-columns: minmax(320px, 0.88fr) minmax(420px, 1.12fr);
  gap: 1rem;
}

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

.panel {
  border-radius: 20px;
  padding: 1rem;
}

.section-heading {
  margin-bottom: 1rem;
}

.section-heading h2 {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
}

.row-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

label {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.8rem;
  color: #374151;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.72rem 0.78rem;
  background: #ffffff;
  color: var(--ink);
}

textarea {
  resize: vertical;
}

.review-list,
.event-list {
  display: grid;
  gap: 0.75rem;
}

.submission-row,
.event-row {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
  background: var(--surface-strong);
}

.submission-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: start;
}

.submission-title {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.submission-row p,
.event-row p {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.flags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.65rem;
}

.flag,
.status {
  display: inline-flex;
  align-items: center;
  min-height: 1.65rem;
  border-radius: 999px;
  padding: 0.18rem 0.55rem;
  font-size: 0.78rem;
  font-weight: 800;
}

.flag.warning,
.status.rejected-by-prime {
  background: var(--warning-soft);
  color: var(--warning);
}

.flag.success,
.status.approved-by-prime {
  background: var(--success-soft);
  color: var(--success);
}

.status.pending {
  background: #e8eef8;
  color: #28456e;
}

.review-note {
  color: var(--warning) !important;
  font-weight: 700;
}

.event-row span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.package-panel pre {
  max-height: 360px;
  overflow: auto;
  margin: 0;
  padding: 1rem;
  border-radius: 14px;
  background: #0b1220;
  color: #d7fbe8;
  font-size: 0.82rem;
  line-height: 1.5;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 1rem;
  color: var(--muted);
  background: var(--surface-strong);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  max-width: min(420px, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #10231f;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity 180ms ease-out,
    transform 180ms ease-out;
}

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

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .project-card {
    margin-top: 0;
  }

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

@media (max-width: 760px) {
  .workspace {
    padding: 1rem;
  }

  .topbar,
  .row-heading,
  .submission-row {
    display: grid;
  }

  .topbar-actions,
  .row-actions {
    width: 100%;
  }

  .topbar-actions button,
  .row-actions button,
  .actions button {
    flex: 1;
  }

  .metrics-grid,
  .split-layout,
  .split-layout.lower,
  .form-grid,
  .nav-list {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
