:root {
  --bg: #f6f8fc;
  --card: #ffffff;
  --ink: #071430;
  --muted: #5b6685;
  --line: #dfe6f2;
  --red: #f00432;
  --blue: #0067b1;
  --green: #079b61;
  --gold: #a46300;
  --shadow: 0 22px 60px rgba(15, 23, 42, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(240, 4, 50, 0.08), transparent 32rem),
    linear-gradient(180deg, #fff, var(--bg));
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: clamp(1.25rem, 2vw, 2rem);
  background: rgba(255, 255, 255, 0.86);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.brand {
  display: flex;
  gap: 0.9rem;
  align-items: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: white;
  font-weight: 900;
  background: linear-gradient(135deg, var(--blue), #2e52ff);
  box-shadow: 0 14px 30px rgba(0, 103, 177, 0.24);
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.muted,
.card-head p,
.search-box span {
  color: var(--muted);
  font-weight: 700;
}

nav {
  display: grid;
  gap: 0.65rem;
}

nav a,
.text-btn {
  min-height: 48px;
  border-radius: 14px;
  padding: 0.85rem 1rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 900;
  border: 1px solid transparent;
}

nav a:hover,
nav a.active {
  color: var(--red);
  background: rgba(240, 4, 50, 0.08);
  border-color: rgba(240, 4, 50, 0.16);
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.text-btn {
  width: 100%;
  background: white;
  cursor: pointer;
}

.main {
  width: min(100%, 1380px);
  padding: clamp(1.5rem, 4vw, 4rem);
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: clamp(1.5rem, 3vw, 3rem);
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: var(--red);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 1000;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.75rem;
  font-size: clamp(2.6rem, 6vw, 5.5rem);
  line-height: 0.92;
  letter-spacing: -0.03em;
}

h2 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
}

.auth-card,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(100%, 560px);
  padding: clamp(1.5rem, 4vw, 3rem);
}

.form-stack {
  display: grid;
  gap: 1rem;
  margin-top: 2rem;
}

.create-card {
  display: grid;
  gap: 1.5rem;
}

label {
  display: grid;
  gap: 0.5rem;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 52px;
  border: 1px solid #cfd8e8;
  border-radius: 12px;
  padding: 0 1rem;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  background: white;
}

select {
  appearance: none;
}

input[type="file"] {
  min-height: auto;
  border-style: dashed;
  padding: 1rem;
  background: linear-gradient(135deg, rgba(240, 4, 50, 0.035), rgba(0, 103, 177, 0.035));
}

.primary-btn,
.secondary-btn {
  min-height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 0 1.5rem;
  border: 0;
  text-decoration: none;
  font: inherit;
  font-weight: 1000;
  cursor: pointer;
}

.primary-btn {
  color: white;
  background: var(--red);
  box-shadow: 0 18px 38px rgba(240, 4, 50, 0.22);
}

.secondary-btn {
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
}

.card {
  padding: clamp(1rem, 3vw, 2.5rem);
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

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

.upload-card {
  min-height: 240px;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(1rem, 2vw, 1.5rem);
  background: white;
  align-content: start;
}

.upload-card > span,
.details-grid label > span {
  color: var(--ink);
  font-weight: 1000;
}

.upload-card strong {
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}

.upload-card small {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.45;
}

.details-grid label {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1rem;
  background: #fff;
}

.action-bar {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  align-items: center;
  gap: 1rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.notice a {
  color: var(--blue);
  font-weight: 1000;
}

.search-box {
  max-width: 680px;
  margin: 1.75rem 0 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.filters button {
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 0 1.2rem;
  font: inherit;
  font-weight: 1000;
  cursor: pointer;
}

.filters button.active,
.filters button:hover {
  color: var(--red);
  border-color: rgba(240, 4, 50, 0.4);
  box-shadow: 0 12px 22px rgba(240, 4, 50, 0.08);
}

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

table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

td strong {
  display: block;
}

.pill {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  border-radius: 999px;
  padding: 0 0.8rem;
  font-size: 0.82rem;
  font-weight: 1000;
}

.pill.signed {
  color: var(--green);
  background: #e9fbf3;
}

.pill.pending {
  color: var(--gold);
  background: #fff4dc;
}

.pill.issue {
  color: var(--red);
  background: #fff0f3;
}

.row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.row-actions a,
.row-actions button {
  min-height: 36px;
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-weight: 1000;
  text-decoration: none;
  font: inherit;
  border: 0;
  cursor: pointer;
  color: white;
  background: var(--blue);
}

.row-actions a.secondary {
  color: var(--blue);
  background: #eaf6ff;
}

.row-actions .danger-link {
  color: var(--red);
  background: #fff;
  border: 1px solid #ffd3dc;
}

.back-link {
  display: inline-flex;
  margin-bottom: 0.75rem;
  color: var(--red);
  text-decoration: none;
  font-weight: 1000;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.75fr);
  gap: 1.25rem;
  align-items: start;
}

.detail-card {
  display: grid;
  gap: 1.4rem;
}

.detail-side {
  display: grid;
  gap: 1.25rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 0.85rem 1rem;
  padding-top: 1.25rem;
}

.summary-grid span,
.activity-item small,
.danger-zone p {
  color: var(--muted);
  font-weight: 800;
}

.summary-grid strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-actions {
  margin-top: 1.25rem;
  display: grid;
}

.activity-list {
  display: grid;
  gap: 0.8rem;
  padding-top: 1.25rem;
}

.activity-item {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0.95rem;
  background: #fff;
}

.activity-item strong,
.activity-item small {
  display: block;
}

.activity-item p,
.danger-zone p {
  margin: 0.35rem 0 0;
}

.danger-zone {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-top: 0.5rem;
  padding: 1rem;
  border: 1px solid #ffd3dc;
  border-radius: 18px;
  background: #fff8fa;
}

.danger-btn {
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid #ffc4d0;
  padding: 0 1rem;
  color: var(--red);
  background: white;
  font: inherit;
  font-weight: 1000;
  cursor: pointer;
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.72fr);
  gap: 1.25rem;
  align-items: start;
}

.review-card {
  display: grid;
  gap: 1.25rem;
}

.review-section {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(1rem, 2vw, 1.35rem);
  background: #fff;
}

.review-section h3 {
  margin: 0 0 1rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
}

.review-section h3 span {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: white;
  font-size: 0.95rem;
  font-weight: 1000;
}

.review-section .wide-field {
  grid-column: 1 / -1;
}

.row-actions a[aria-busy="true"],
.row-actions button[aria-busy="true"],
.primary-btn[aria-busy="true"],
.secondary-btn[aria-busy="true"],
.danger-btn[aria-busy="true"] {
  opacity: 0.68;
  pointer-events: none;
}

.notice,
.error,
.empty {
  margin-top: 1rem;
  border-radius: 14px;
  padding: 1rem;
  font-weight: 800;
}

.notice {
  color: #775900;
  background: #fff7df;
  border: 1px solid #f7dd98;
}

.error {
  color: #b00020;
  background: #fff0f3;
  border: 1px solid #ffc4d0;
}

.empty {
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
}

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

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

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

  .main {
    padding: 1rem;
  }

  .page-header,
  .card-head,
  .action-bar {
    display: grid;
  }

  .upload-grid,
  .details-grid,
  .detail-layout,
  .review-layout {
    grid-template-columns: 1fr;
  }

  .danger-zone {
    display: grid;
  }
}
