:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --ink: #15191f;
  --muted: #66717f;
  --line: #dce2e8;
  --black: #101216;
  --red: #e10618;
  --red-dark: #b90513;
  --green: #157347;
  --green-soft: #e7f5ed;
  --amber: #9a5a00;
  --amber-soft: #fff3da;
  --danger: #b3261e;
  --danger-soft: #ffe8e6;
  --blue: #2458d3;
  --blue-soft: #e8eefc;
  --shadow: 0 18px 50px rgba(18, 24, 32, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.text-button {
  min-height: 32px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--red);
  font-weight: 900;
  text-align: left;
}

.text-button:hover {
  color: var(--red-dark);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #101216;
}

.login-screen.hidden {
  display: none;
}

.login-card {
  width: min(440px, 100%);
  padding: 26px;
  border: 1px solid #333a45;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.login-card img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  margin-bottom: 18px;
}

.login-card h1 {
  margin-bottom: 20px;
}

.login-card form {
  display: grid;
  gap: 14px;
}

.login-card .primary-button {
  width: 100%;
}

.login-card .text-button {
  margin-top: 12px;
}

.app-shell.locked {
  display: none;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 276px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 22px;
  background: #101216;
  color: #ffffff;
}

.brand {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  padding: 6px;
}

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

.brand strong {
  font-size: 17px;
}

.brand span {
  color: #b8c0ca;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav-item {
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c8d0da;
  text-align: left;
  font-weight: 700;
}

.nav-item.active,
.nav-item:hover {
  background: #272d36;
  color: #ffffff;
}

.app {
  margin-left: 276px;
  padding: 28px;
}

.topbar,
.panel-header,
.topbar-actions,
.filters,
.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
}

.topbar {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.topbar-actions,
.filters,
.modal-actions {
  gap: 10px;
}

.filters {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filters input {
  width: 240px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 30px;
}

h2 {
  margin-bottom: 4px;
  font-size: 19px;
}

h3 {
  margin-bottom: 8px;
  font-size: 16px;
}

p {
  color: var(--muted);
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 40px;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  padding: 0 14px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--red-dark);
}

.ghost-button {
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #28313c;
}

.icon-button {
  position: relative;
  width: 40px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #202832;
}

.icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 999px;
  background: var(--red);
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
}

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--red);
}

.user-badge {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #101216;
  color: #ffffff;
  font-weight: 900;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.panel,
.profile-panel,
.sub-card,
.document-card,
.template-card,
.email-preview,
.automation-card,
.team-user-card,
.invite-preview,
.modal {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric-card {
  padding: 16px;
}

.metric-card span,
.muted-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel,
.profile-panel {
  padding: 18px;
}

.panel-header {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.wide-panel .panel-header {
  align-items: flex-start;
}

.panel-header p {
  margin-bottom: 0;
}

input,
select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

input {
  padding: 0 12px;
}

.password-field {
  position: relative;
  display: block;
}

.password-field input {
  width: 100%;
  padding-right: 46px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: #eef2f6;
  color: var(--ink);
  outline: none;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

select {
  padding: 0 34px 0 12px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

.empty-cell {
  color: var(--muted);
  text-align: center;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  cursor: pointer;
}

tbody tr:hover,
tbody tr.selected {
  background: #fafbfc;
}

.company-cell strong,
.profile-title strong,
.doc-title strong {
  display: block;
}

.company-cell span,
.profile-title span,
.doc-title span {
  color: var(--muted);
  font-size: 13px;
}

.status-pill,
.trade-pill,
.doc-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-approved,
.doc-complete {
  background: var(--green-soft);
  color: var(--green);
}

.status-warning,
.doc-warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.status-danger,
.doc-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-neutral,
.doc-neutral {
  background: var(--blue-soft);
  color: var(--blue);
}

.trade-pill {
  background: #f1f3f5;
  color: #28313c;
}

.missing-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.profile-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.profile-actions,
.profile-contact,
.profile-info-list,
.checklist,
.expiration-list,
.archive-list,
.activity-list {
  display: grid;
  gap: 10px;
}

.profile-actions {
  grid-template-columns: 1fr 1fr;
  margin: 16px 0;
}

.profile-contact {
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.profile-info-list {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #f8fafc;
}

.info-line {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.info-line:first-child {
  padding-top: 0;
}

.info-line:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.profile-panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.profile-panel-title h3 {
  margin: 0;
}

.profile-contact span,
.info-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.profile-section {
  margin-top: 18px;
}

.profile-page {
  display: grid;
  gap: 16px;
}

.back-button {
  width: fit-content;
}

.profile-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border-radius: 8px;
  background: #101216;
  color: #ffffff;
  box-shadow: var(--shadow);
}

.profile-hero .eyebrow,
.profile-hero p {
  color: #c8d0da;
}

.profile-hero h2 {
  margin-bottom: 12px;
  font-size: 32px;
}

.hero-meta,
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-actions {
  justify-content: flex-end;
}

.profile-scoreboard {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 14px;
}

.score-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.score-card span,
.score-card small {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.score-card strong {
  display: block;
  margin: 8px 0 3px;
  font-size: 28px;
}

.profile-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

.profile-main,
.profile-rail {
  display: grid;
  gap: 16px;
}

.check-row,
.expiration-row,
.upload-row,
.archive-row,
.activity-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.upload-section p {
  margin-bottom: 12px;
}

.upload-list {
  display: grid;
  gap: 10px;
}

.upload-row {
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.archive-row {
  align-items: center;
  flex-wrap: wrap;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.archive-row .ghost-button {
  min-width: 116px;
}

.upload-row .ghost-button {
  min-width: 112px;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.document-actions .ghost-button {
  min-width: 92px;
  min-height: 34px;
  padding: 0 10px;
}

.mini-field {
  min-width: 180px;
  color: var(--muted);
  font-size: 12px;
}

.mini-field input {
  min-height: 34px;
}

.file-field {
  min-width: 220px;
  color: var(--muted);
  font-size: 12px;
}

.file-field input {
  width: 100%;
  min-height: 34px;
  padding: 5px;
  background: #ffffff;
}

.check-name {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
}

.check-icon {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 900;
}

.check-icon.done {
  background: var(--green);
}

.check-icon.missing {
  background: var(--danger);
}

.check-icon.warning {
  background: var(--amber);
}

.sub-grid,
.document-queue {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
}

.sub-card,
.document-card,
.template-card,
.email-preview {
  padding: 16px;
}

.sub-card {
  display: grid;
  gap: 12px;
}

.doc-card-header,
.template-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.document-card {
  display: grid;
  gap: 14px;
}

.empty-state {
  grid-column: 1 / -1;
}

.empty-state p {
  color: var(--muted);
}

.automation-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.automation-card {
  padding: 16px;
}

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

.automation-card span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.35;
}

.reminder-layout,
.team-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
}

.template-list,
.team-list,
.team-user-list {
  display: grid;
  gap: 10px;
}

.template-card {
  border-color: var(--line);
  text-align: left;
}

.template-card.active {
  border-color: var(--red);
}

.email-preview,
.invite-preview {
  min-height: 360px;
}

.email-preview pre,
.invite-preview pre {
  white-space: pre-wrap;
  color: #26313d;
  font: inherit;
  line-height: 1.55;
}

.team-layout {
  grid-template-columns: minmax(0, 1fr) 420px;
  align-items: start;
}

.team-section-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 8px;
}

.team-section-header p {
  margin-bottom: 0;
}

.invite-history-header {
  margin-top: 14px;
}

.team-user-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #101216;
  color: #ffffff;
  font-weight: 900;
}

.invite-preview {
  padding: 16px;
}

.modal {
  width: min(720px, calc(100vw - 36px));
  padding: 0;
}

.modal::backdrop {
  background: rgba(16, 18, 22, 0.45);
}

.modal form {
  padding: 20px;
}

.document-viewer-shell {
  padding: 20px;
}

.document-viewer-modal {
  width: min(980px, calc(100vw - 28px));
}

.document-viewer-frame {
  height: min(68vh, 720px);
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.document-viewer-frame iframe {
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.modal-header {
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #28313c;
  font-size: 13px;
  font-weight: 900;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 20px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #101216;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  transition: 180ms ease;
  pointer-events: none;
}

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

@media (max-width: 1320px) {
  .profile-workspace,
  .reminder-layout,
  .team-layout {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 1120px) {

  .sub-grid,
  .document-queue,
  .automation-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 820px) {
  .sidebar {
    position: static;
    width: auto;
  }

  .app {
    margin-left: 0;
    padding: 18px;
  }

  .topbar,
  .panel-header {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .filters,
  .profile-actions,
  .form-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .metrics,
  .profile-scoreboard,
  .sub-grid,
  .document-queue,
  .automation-grid {
    grid-template-columns: 1fr;
  }

  .team-user-card {
    grid-template-columns: 42px minmax(0, 1fr);
  }
}
