:root {
  --ink: #17202a;
  --muted: #607080;
  --line: #d9e1ea;
  --soft: #f5f7fa;
  --panel: #ffffff;
  --nav: #071a2e;
  --nav-2: #0b2848;
  --blue: #1769e0;
  --green: #1b8f5a;
  --amber: #ba7317;
  --red: #c43f45;
  --violet: #6854bc;
  --shadow: 0 18px 45px rgba(18, 32, 50, .12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #edf2f7;
  -webkit-text-size-adjust: 100%;
}

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: linear-gradient(180deg, var(--nav), var(--nav-2));
  color: #fff;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-block {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
  background: rgba(255, 255, 255, .08);
  font-weight: 800;
  font-size: 24px;
}

.brand-block h1 {
  margin: 2px 0 0;
  font-size: 15px;
  line-height: 1.2;
}

.eyebrow {
  margin: 0;
  color: #7f8fa0;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.sidebar .eyebrow {
  color: #9db2cc;
}

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

.nav-button {
  width: 100%;
  border: 0;
  color: #dce8f8;
  background: transparent;
  padding: 11px 12px;
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 10px;
  align-items: center;
  text-align: left;
  border-radius: 6px;
}

.nav-button.active,
.nav-button:hover {
  background: rgba(255, 255, 255, .12);
  color: #fff;
}

.nav-icon {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: rgba(255, 255, 255, .1);
  font-size: 13px;
}

.powered {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  border-radius: 8px;
}

.powered p {
  margin: 0 0 6px;
  font-weight: 800;
  line-height: 1.25;
}

.powered span {
  color: #b7c7da;
  font-size: 13px;
}

.workspace {
  padding: 22px;
  display: grid;
  gap: 18px;
  min-width: 0;
}

.topbar,
.role-strip,
.panel,
.hero-band {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  min-height: 78px;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 520px) auto;
  gap: 18px;
  align-items: center;
  padding: 16px 18px;
  border-radius: 8px;
}

.topbar h2,
.hero-copy h2,
.modal h2 {
  margin: 4px 0 0;
}

.search-box {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: 6px;
}

.search-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-box input {
  border: 0;
  outline: 0;
  background: transparent;
  min-width: 0;
}

.status-cluster {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.simulated {
  color: #0f5f3c;
  background: #ddf5e9;
}

.clock {
  color: var(--muted);
  font-size: 12px;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 43%);
  gap: 18px;
  padding: 18px;
  border-radius: 8px;
  align-items: stretch;
}

.hero-copy {
  align-self: center;
  max-width: 760px;
}

.hero-copy h2 {
  font-size: clamp(30px, 4vw, 58px);
  line-height: 1;
}

.hero-copy p:not(.eyebrow) {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
  max-width: 680px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.primary,
.secondary,
.danger,
.quiet {
  border: 1px solid transparent;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  font-weight: 800;
}

.primary {
  color: #fff;
  background: var(--blue);
}

.secondary {
  color: var(--ink);
  background: #eef4fb;
  border-color: #cfdae7;
}

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

.quiet {
  color: var(--blue);
  background: transparent;
  border-color: var(--line);
}

.hero-visual {
  min-height: 300px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #1d3554;
  background: #061320;
}

.hero-visual img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.role-strip {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 8px;
}

.role-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.role-button {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  border-radius: 999px;
  min-height: 34px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
}

.role-button.active {
  color: #fff;
  background: var(--nav-2);
  border-color: var(--nav-2);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

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

.metric-card strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
  margin: 6px 0;
}

.metric-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(330px, .65fr);
  gap: 14px;
}

.panel {
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
}

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

.panel-header h3 {
  margin: 3px 0 0;
  font-size: 19px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

th,
td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

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

.badge {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.green {
  color: #0f5f3c;
  background: #ddf5e9;
}

.badge.red {
  color: #8b262d;
  background: #fde4e5;
}

.badge.amber {
  color: #80500e;
  background: #fff0d6;
}

.badge.blue {
  color: #124d9f;
  background: #dfeeff;
}

.badge.gray {
  color: #4e5b66;
  background: #e8edf2;
}

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

.mobile-list {
  display: none;
}

.list-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.list-item strong {
  display: block;
}

.list-item span,
.list-item p {
  color: var(--muted);
  font-size: 13px;
  margin: 3px 0 0;
}

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

.workflow-card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 15px;
  display: grid;
  gap: 12px;
}

.workflow-card h3 {
  margin: 0;
  font-size: 17px;
}

.workflow-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.workflow-card button {
  justify-self: start;
}

.timeline {
  display: grid;
  gap: 12px;
}

.audit-row {
  display: grid;
  grid-template-columns: 74px 1fr;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.audit-row time {
  color: var(--muted);
  font-weight: 800;
  font-size: 12px;
}

.audit-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

label.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 10px;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 18, 32, .62);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: min(760px, 100%);
  max-height: min(820px, 92vh);
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .28);
  padding: 18px;
}

.modal header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 16px;
}

.icon-button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  font-weight: 800;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.empty-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
  padding: 24px;
}

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

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .nav-button {
    width: auto;
    min-width: 150px;
  }

  .powered {
    margin-top: 0;
  }

  .topbar,
  .hero-band,
  .role-strip,
  .content-grid {
    grid-template-columns: 1fr;
  }

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

  .status-cluster {
    justify-items: start;
  }
}

@media (max-width: 680px) {
  body {
    background: #f3f6f9;
  }

  .app-shell {
    display: block;
  }

  .workspace {
    padding: 10px;
    gap: 10px;
  }

  .metric-grid,
  .workflow-grid,
  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    gap: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 14px 32px rgba(5, 18, 32, .18);
  }

  .brand-block {
    grid-template-columns: 40px 1fr;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .nav-button {
    min-width: 118px;
    padding: 9px 10px;
    grid-template-columns: 22px 1fr;
    font-size: 13px;
  }

  .powered {
    display: none;
  }

  .topbar,
  .hero-band,
  .role-strip,
  .panel {
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(18, 32, 50, .08);
  }

  .topbar {
    min-height: 0;
    gap: 12px;
  }

  .topbar h2 {
    font-size: 23px;
    line-height: 1.12;
  }

  .search-box {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .search-box input {
    min-height: 28px;
  }

  .status-cluster {
    grid-template-columns: auto 1fr;
    align-items: center;
    justify-items: start;
  }

  .hero-copy h2 {
    font-size: 28px;
    line-height: 1.05;
  }

  .hero-copy p:not(.eyebrow) {
    font-size: 14px;
    line-height: 1.45;
  }

  .hero-actions {
    display: grid;
    gap: 8px;
    margin-top: 14px;
  }

  .hero-visual {
    min-height: 160px;
    max-height: 220px;
  }

  .panel-header {
    display: grid;
  }

  .role-strip {
    gap: 10px;
  }

  .role-strip strong {
    display: block;
    font-size: 14px;
    line-height: 1.35;
  }

  .role-buttons {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 3px;
    -webkit-overflow-scrolling: touch;
  }

  .role-button {
    flex: 0 0 auto;
    min-height: 38px;
  }

  .metric-grid {
    gap: 8px;
  }

  .metric-card {
    padding: 12px;
  }

  .metric-card strong {
    font-size: 24px;
  }

  .table-wrap.mobile-cards {
    display: none;
  }

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

  .record-card {
    display: grid;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
  }

  .record-card header {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
  }

  .record-card h4 {
    margin: 0;
    font-size: 15px;
    line-height: 1.2;
  }

  .record-card p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
  }

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

  .record-meta span {
    display: grid;
    gap: 2px;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
  }

  .record-meta strong {
    color: var(--ink);
    font-size: 13px;
    overflow-wrap: anywhere;
  }

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

  .audit-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
  }

  .modal {
    width: 100%;
    max-height: 88vh;
    border-radius: 8px;
    padding: 14px;
  }

  .modal header {
    margin-bottom: 12px;
  }

  .primary,
  .secondary,
  .danger,
  .quiet {
    width: 100%;
  }
}
