:root {
  --bg: #05070c;
  --panel: #0d1320;
  --panel-soft: #121b2c;
  --panel-raised: rgba(18, 27, 44, 0.96);
  --ink: #f4f7fb;
  --muted: #9aa8bb;
  --quiet: #6d7b8e;
  --line: rgba(228, 238, 255, 0.1);
  --line-strong: rgba(0, 212, 255, 0.28);
  --blue: #3f7cff;
  --cyan: #00d4ff;
  --green: #66f2c2;
  --amber: #ffd166;
  --red: #ff8d8d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --mono: "SF Mono", "Roboto Mono", Menlo, Consolas, monospace;
  font-family: var(--sans);
}

* {
  box-sizing: border-box;
}

body {
  background:
    linear-gradient(180deg, rgba(0, 212, 255, 0.08), transparent 460px),
    radial-gradient(circle at 82% 8%, rgba(63, 124, 255, 0.16), transparent 280px),
    var(--bg);
  color: var(--ink);
  margin: 0;
  min-height: 100vh;
}

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

button {
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

.app-notice {
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  padding: 10px 24px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.app-notice[data-variant="success"] {
  background: rgba(102, 242, 194, 0.14);
  color: var(--green);
}

.app-notice[data-variant="warning"] {
  background: rgba(255, 209, 102, 0.14);
  color: var(--amber);
}

.app-notice[data-variant="danger"] {
  background: rgba(255, 141, 141, 0.14);
  color: var(--red);
}

.app-notice[data-variant="info"] {
  background: rgba(0, 212, 255, 0.12);
  color: var(--blue);
}

.topbar {
  align-items: center;
  backdrop-filter: blur(18px);
  background: rgba(5, 7, 12, 0.9);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  min-height: 84px;
  padding: 18px 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.eyebrow {
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

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

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

h1 small {
  color: var(--muted);
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-top: 4px;
}

.brand-name {
  color: var(--ink);
  font-weight: 760;
}

.brand-name span {
  color: var(--cyan);
}

h2 {
  font-size: 28px;
  margin-bottom: 0;
}

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

.note,
.muted {
  color: var(--muted);
}

.top-actions,
.context-strip,
.panel-head {
  align-items: center;
  display: flex;
  gap: 12px;
}

.top-actions button,
.panel-head button,
menu button {
  background: var(--cyan);
  border: 0;
  border-radius: 8px;
  color: #001018;
  font-weight: 700;
  min-height: 40px;
  padding: 9px 14px;
}

.top-actions button:first-child,
menu button:first-child {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.user-badge {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-size: 13px;
  padding: 9px 12px;
}

.auth-panel {
  align-items: center;
  display: grid;
  min-height: calc(100vh - 84px);
  padding: 28px;
  place-items: center;
}

.login-card {
  background: linear-gradient(145deg, rgba(18, 27, 44, 0.98), rgba(9, 14, 24, 0.98));
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
  max-width: 520px;
  padding: 24px;
  width: 100%;
}

.login-card button {
  background: var(--cyan);
  border: 0;
  border-radius: 8px;
  color: #001018;
  font-weight: 700;
  min-height: 44px;
  padding: 10px 14px;
}

.workspace {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: calc(100vh - 84px);
  width: 100%;
}

.workspace.client-workspace {
  grid-template-columns: minmax(0, 1fr);
  max-width: 100vw;
  overflow-x: hidden;
}

.workspace.client-workspace .sidebar {
  display: none;
}

.sidebar {
  background: rgba(5, 7, 12, 0.74);
  border-right: 1px solid var(--line);
  display: grid;
  gap: 6px;
  padding: 20px 12px;
}

.nav-item {
  background: transparent;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  min-height: 42px;
  padding: 10px 12px;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: rgba(0, 212, 255, 0.12);
  color: var(--ink);
}

.content {
  max-width: 100vw;
  min-width: 0;
  padding: 24px;
}

.context-strip {
  background: rgba(13, 19, 32, 0.86);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 14px;
}

label {
  color: var(--muted);
  display: grid;
  font-size: 13px;
  gap: 6px;
  min-width: 0;
}

select,
input,
textarea {
  background: rgba(5, 7, 12, 0.58);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
  max-width: 100%;
  width: 100%;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 20px;
}

.section-head {
  align-items: end;
  display: flex;
  gap: 20px;
  justify-content: space-between;
}

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

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

.portal-feature-nav {
  align-items: stretch;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.route-card {
  background: rgba(13, 19, 32, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  color: var(--ink);
  display: grid;
  font-weight: 800;
  gap: 6px;
  min-height: 92px;
  padding: 14px;
  text-decoration: none;
}

.route-card:hover {
  border-color: var(--line-strong);
  transform: translateY(-1px);
}

.route-card.active {
  border-color: var(--blue);
  box-shadow: inset 0 3px 0 var(--blue), var(--shadow);
}

.route-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.35;
}

.portal-feature-nav .route-card {
  align-items: center;
  box-shadow: none;
  justify-content: center;
  min-height: 48px;
  text-align: center;
}

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

.metric,
.panel,
.card,
.review-card,
.auth-column,
.report,
.modal-card {
  background: rgba(13, 19, 32, 0.86);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.compact-metrics .metric {
  padding: 14px;
}

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

.metric-link {
  color: var(--ink);
  text-decoration: none;
}

.metric-link:hover {
  border-color: var(--cyan);
}

.metric strong {
  display: block;
  font-size: 30px;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.split-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
}

.split-grid > * {
  min-width: 0;
}

.panel,
.report {
  padding: 18px;
}

.command-panel {
  display: grid;
  gap: 14px;
}

.panel-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.queue-list,
.checklist,
.card-grid,
.review-grid,
.portal-form {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.portal-form button,
.correction-actions button,
#portal-dashboard-summary button,
#portal-reports button,
#internal-uploads button,
#internal-reviews button,
#internal-requests button,
#internal-claim-review button,
#internal-coding-controls button,
#internal-workflow-summary button {
  background: var(--cyan);
  border: 0;
  border-radius: 8px;
  color: #001018;
  font-weight: 700;
  min-height: 38px;
  padding: 8px 12px;
}

.portal-feature-nav button.route-card {
  cursor: pointer;
  min-height: 52px;
  text-align: left;
}

.portal-feature-nav button.route-card.active,
.portal-feature-nav button.route-card:focus-visible {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(0, 212, 255, 0.18);
}

.portal-section {
  scroll-margin-top: 92px;
}

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

.selected-file-list {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
}

.selected-file-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-width: 0;
}

.selected-file-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-row button {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  min-height: 36px;
  white-space: nowrap;
}

.locked-action {
  color: var(--muted);
  font-size: 13px;
}

.correction-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.comparison-grid div {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 6px;
  padding: 10px;
}

.comparison-grid span {
  overflow-wrap: anywhere;
}

.correction-actions button:last-child {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.correction-actions button[data-command-action$="approve"],
.correction-actions button[data-command-action="claim-approve"],
.correction-actions button[data-command-action="coding-approve"],
.correction-actions button[data-command-action="upload-quarantine"] {
  background: var(--green);
  color: #001018;
}

.correction-actions button[data-command-action$="changes"],
.correction-actions button[data-command-action="claim-hold"],
.correction-actions button[data-command-action="claim-docs"],
.correction-actions button[data-command-action="coding-provider"] {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
}

.queue-item,
.check-item,
.card,
.review-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.check-item {
  align-items: center;
  display: flex;
}

.check-item input[type="checkbox"] {
  min-height: auto;
  width: auto;
}

.queue-item {
  display: grid;
  gap: 8px;
}

.queue-item:hover,
.panel[data-route-focus="true"] {
  border-color: var(--line-strong);
}

.row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
}

.pill {
  border-radius: 999px;
  display: inline-flex;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1;
  padding: 5px 8px;
  text-transform: uppercase;
}

.status-info {
  background: rgba(63, 124, 255, 0.16);
  color: var(--blue);
}

.status-good {
  background: rgba(102, 242, 194, 0.14);
  color: var(--green);
}

.status-warning {
  background: rgba(255, 209, 102, 0.14);
  color: var(--amber);
}

.status-danger {
  background: rgba(255, 141, 141, 0.14);
  color: var(--red);
}

.compact-tags,
.workflow-lanes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-tags span {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 8px;
}

.workflow-lanes {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.lane {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  min-height: 108px;
  padding: 12px;
}

.lane span:last-child {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.risk-high {
  background: rgba(255, 141, 141, 0.14);
  color: var(--red);
}

.risk-medium {
  background: rgba(255, 209, 102, 0.14);
  color: var(--amber);
}

.risk-low {
  background: rgba(102, 242, 194, 0.14);
  color: var(--green);
}

.priority-list {
  color: var(--muted);
  line-height: 1.7;
  padding-left: 20px;
}

.table-wrap {
  background: rgba(13, 19, 32, 0.86);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  overflow-x: auto;
}

.flat-table {
  box-shadow: none;
}

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

code {
  font-family: var(--mono);
  font-size: 12px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  background: rgba(255, 255, 255, 0.025);
  text-transform: uppercase;
}

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

.auth-column {
  padding: 14px;
}

.auth-column h3 {
  margin-bottom: 12px;
}

.auth-card {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  padding: 12px;
}

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

.review-card {
  display: grid;
  gap: 10px;
}

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

.report-line {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-bottom: 12px;
}

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

dialog {
  border: 0;
  border-radius: 14px;
  padding: 0;
  width: min(560px, calc(100vw - 28px));
}

dialog::backdrop {
  background: rgba(5, 7, 12, 0.72);
}

.modal-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

menu {
  display: flex;
  gap: 10px;
  justify-content: end;
  margin: 0;
  padding: 0;
}

@media (max-width: 960px) {
  .workspace,
  .split-grid,
  .comparison-grid,
  .kanban,
  .review-grid,
  .metric-grid,
  .route-grid,
  .portal-feature-nav,
  .portal-dashboard-grid,
  .workflow-lanes {
    grid-template-columns: 1fr;
  }

  .sidebar {
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .topbar,
  .section-head {
    align-items: start;
    flex-direction: column;
  }
}
