:root {
  --ink: #0a2242;
  --muted: #5b677a;
  --line: #d9e2ec;
  --cyan: #38d5e8;
  --cyan-dark: #149caf;
  --green: #18865d;
  --amber: #a76a00;
  --red: #b42318;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --shadow: 0 14px 40px rgba(10, 34, 66, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body.auth-pending .app-shell {
  visibility: hidden;
}

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  background: #071b34;
  color: #fff;
  padding: 22px 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  color: #fff;
  text-decoration: none;
  font-weight: 750;
}

.brand img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

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

.nav-item {
  min-height: 40px;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.78);
  border-radius: 6px;
  text-decoration: none;
}

.nav-item:hover,
.nav-item.is-active {
  color: #fff;
  background: rgba(56, 213, 232, 0.16);
}

body.mfa-setup-locked .nav-item:not([data-view-link="dashboard"]) {
  display: none;
}

.main {
  min-width: 0;
  padding: 28px;
}

.app-version {
  position: fixed;
  right: 18px;
  bottom: 14px;
  z-index: 4;
  color: #7a8798;
  font-size: 0.76rem;
  font-weight: 750;
  letter-spacing: 0;
  line-height: 1;
  pointer-events: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 26px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--cyan-dark);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.05rem;
}

.session-panel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0;
  border: 0;
  background: transparent;
}

.session-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.82rem;
  box-shadow: 0 10px 24px rgba(8, 31, 59, 0.04);
}

.session-chip:hover {
  background: #eef5fb;
}

.session-user {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 750;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
}

.profile-drawer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  justify-items: end;
  background: rgba(8, 31, 59, 0.26);
}

.profile-card {
  display: grid;
  align-content: start;
  gap: 20px;
  width: min(100%, 420px);
  min-height: 100%;
  padding: 26px 24px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -18px 0 44px rgba(8, 31, 59, 0.16);
}

.profile-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.profile-persona {
  min-width: 0;
}

.profile-identity {
  min-width: 0;
}

.profile-kicker {
  color: var(--cyan-dark);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.profile-header h2 {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 1.16rem;
}

.profile-header p,
.profile-section p {
  margin: 5px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.profile-badges span {
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef5fb;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.profile-signout {
  justify-self: stretch;
  margin-top: 2px;
  color: var(--ink);
  background: #e8eef5;
}

.profile-signout:hover {
  background: #dbe6f1;
}

.icon-button {
  min-height: 32px;
  width: 32px;
  padding: 0;
  color: var(--ink);
  background: #e8eef5;
  font-size: 1.25rem;
  line-height: 1;
}

.profile-section {
  display: grid;
  gap: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.profile-section h3 {
  margin: 0;
  font-size: 0.95rem;
}

.profile-security-status {
  margin: -3px 0 0;
  padding: 8px 10px;
  color: #14634a;
  border: 1px solid #c8eadc;
  border-radius: 6px;
  background: #effaf5;
  font-size: 0.86rem;
  font-weight: 750;
}

.profile-security-status[data-state="warning"] {
  color: #7a4b00;
  border-color: #f3d58b;
  background: #fff8e6;
}

.profile-security-status[data-state="urgent"] {
  color: #9f1d18;
  border-color: #f1b7b3;
  background: #fff1ef;
}

.profile-preferences {
  gap: 10px;
}

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

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.auth-gate {
  display: grid;
  min-height: calc(100vh - 150px);
  place-items: center;
}

.auth-panel {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: 16px;
  width: min(100%, 460px);
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-panel.is-auth-handoff {
  border-color: #94dfe8;
  background: #f7feff;
  box-shadow: 0 18px 48px rgba(0, 173, 193, 0.12);
}

.auth-panel.is-auth-handoff::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 38%;
  height: 4px;
  background: var(--cyan);
  animation: auth-progress 1s ease-in-out infinite;
}

.auth-panel.is-auth-error {
  border-color: #ef9a9a;
  background: #fff8f8;
  box-shadow: 0 18px 48px rgba(196, 24, 24, 0.12);
}

.auth-panel.is-auth-error input {
  border-color: #e57373;
  background: #fffdfd;
}

.auth-panel.is-auth-error .form-status {
  color: var(--red);
}

.auth-panel.is-auth-shaking {
  animation: auth-shake 420ms ease-in-out;
}

@keyframes auth-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-8px);
  }
  40% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-5px);
  }
  80% {
    transform: translateX(3px);
  }
}

@keyframes auth-progress {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(265%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .auth-panel.is-auth-shaking,
  .auth-panel.is-auth-handoff::before {
    animation: none;
  }
}

.auth-panel img {
  width: min(100%, 260px);
  height: auto;
  justify-self: center;
}

.auth-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

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

.auth-challenge {
  display: grid;
  gap: 14px;
}

.challenge-secret {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f5fbfd;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.challenge-qr {
  display: grid;
  justify-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
}

.challenge-qr svg {
  width: min(100%, 190px);
  height: auto;
  display: block;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
  text-transform: uppercase;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

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

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

.metric {
  display: grid;
  gap: 6px;
  min-height: 116px;
  padding: 18px;
}

.metric-label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.metric strong {
  font-size: 2.1rem;
}

.content-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 18px;
}

body.mfa-setup-locked .metrics-grid,
body.mfa-setup-locked .content-grid {
  display: none;
}

.panel {
  padding: 18px;
}

.mfa-setup-panel {
  margin-bottom: 18px;
}

.mfa-setup-panel[data-state="locked"] {
  border-color: #f1b7b3;
  background: #fff8f7;
}

.mfa-setup-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1fr);
  gap: 18px;
  align-items: start;
}

.mfa-setup-grid p {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

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

.panel-heading,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #07505b;
  background: #dff9fc;
}

.badge-muted {
  color: #39465a;
  background: #edf1f6;
}

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

.inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(180px, 0.8fr);
  align-items: end;
  gap: 12px;
  margin-bottom: 16px;
}

.invite-form {
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1fr) minmax(150px, 0.7fr) auto minmax(170px, 0.8fr);
}

.share-form {
  grid-template-columns: minmax(260px, 1.2fr) minmax(220px, 1fr) minmax(140px, 0.55fr) auto minmax(170px, 0.8fr);
}

.share-filter-form {
  grid-template-columns:
    minmax(180px, 1fr) minmax(220px, 1fr) minmax(220px, 1fr) minmax(130px, 0.55fr) auto
    minmax(150px, 0.7fr);
}

.user-filter-form {
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.65fr) auto minmax(170px, 0.8fr);
}

.file-filter-form,
.audit-form {
  grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr) minmax(120px, 0.35fr) auto minmax(170px, 0.8fr);
}

.file-filter-form {
  grid-template-columns: minmax(240px, 1.15fr) minmax(220px, 1fr) minmax(160px, 0.55fr) auto minmax(170px, 0.8fr);
}

label,
.file-picker {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

select,
input[type="email"],
input[type="password"],
input[type="text"] {
  min-height: 42px;
  width: 100%;
  padding: 9px 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

select {
  padding-right: 34px;
}

.field-label {
  color: var(--muted);
}

.file-picker-control {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-height: 42px;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.file-picker-button {
  display: inline-grid;
  place-items: center;
  align-self: stretch;
  min-width: 112px;
  padding: 9px 13px;
  color: #062034;
  background: #e8eef5;
  border-right: 1px solid var(--line);
  cursor: pointer;
}

.file-picker-button:hover {
  background: #dce7f1;
}

.file-picker-name {
  min-width: 0;
  padding: 9px 12px;
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker-input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker-control:focus-within {
  border-color: var(--cyan-dark);
  box-shadow: 0 0 0 3px rgba(56, 213, 232, 0.2);
}

.file-type-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  line-height: 1.45;
}

.file-type-note code {
  color: var(--ink);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 800;
  white-space: nowrap;
}

.upload-progress {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border: 1px solid #c5eef4;
  border-radius: 6px;
  background: #f3fcfe;
}

.upload-progress-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--cyan-dark);
  font-size: 0.84rem;
  font-weight: 800;
}

.upload-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dce7f1;
}

.upload-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--cyan);
  transition: width 160ms ease;
}

.form-status {
  min-height: 20px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.form-status[data-state="success"] {
  color: var(--green);
}

.form-status[data-state="error"] {
  color: var(--red);
}

.form-status[data-state="pending"] {
  color: var(--cyan-dark);
}

button {
  min-height: 40px;
  padding: 9px 13px;
  border: 0;
  border-radius: 6px;
  color: #062034;
  background: var(--cyan);
  font-weight: 850;
  cursor: pointer;
}

button:hover {
  background: #62dfed;
}

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

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

button.compact {
  min-height: 30px;
  padding: 5px 9px;
  font-size: 0.82rem;
}

button.secondary {
  color: var(--ink);
  background: #e8eef5;
}

.activity-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
}

.activity-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 42px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.activity-list li {
  list-style: none;
}

.storage-list span {
  overflow-wrap: anywhere;
}

.audit-heading {
  align-items: start;
}

.audit-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 650;
}

.audit-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-list li {
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 24px rgba(8, 31, 59, 0.04);
  align-items: flex-start;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
  gap: 18px;
}

.audit-event {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.audit-event-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.audit-badge {
  min-width: 74px;
  padding: 4px 8px;
  color: #066c82;
  background: #dff8fc;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 850;
  text-align: center;
}

.audit-event strong {
  display: block;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}

.audit-event code {
  display: block;
  max-width: 100%;
  margin-top: 8px;
  padding: 10px;
  overflow-x: auto;
  overflow-wrap: anywhere;
  color: #2f4056;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 0.78rem;
}

.audit-meta {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.audit-detail summary {
  width: fit-content;
  color: #0b7f94;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 850;
}

.audit-list time {
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 850;
  text-align: right;
  white-space: nowrap;
}

.audit-empty {
  display: block !important;
  color: var(--muted);
  font-weight: 750;
}

.section-heading {
  min-height: 42px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(7, 27, 52, 0.32);
}

.modal-panel {
  width: min(100%, 520px);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(10, 34, 66, 0.18);
}

.account-editor-form,
.retention-editor-form {
  display: grid;
  gap: 14px;
}

.account-editor-form > p,
.retention-editor-form > p:first-child {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.account-checkbox-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.checkbox-row {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

.retention-checkbox {
  justify-content: flex-start;
  font-weight: 750;
}

.retention-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

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

.role-control {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) auto;
  gap: 7px;
  align-items: center;
  max-width: 280px;
}

.compact-select {
  min-height: 30px;
  padding: 4px 8px;
  font-size: 0.82rem;
}

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

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

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

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

code {
  color: #29425f;
  font-size: 0.85rem;
}

.pill.good {
  color: #0f5138;
  background: #dff3ea;
}

.pill.warn {
  color: var(--amber);
  background: #fff1d6;
}

.pill.scan {
  color: #5b3b91;
  background: #efe8ff;
}

.scan-status {
  display: grid;
  gap: 5px;
  min-width: 180px;
}

.scan-status .pill {
  width: fit-content;
}

.scan-status span {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 800;
}

.scan-status small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.security-grid-secondary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.control {
  display: grid;
  gap: 8px;
  min-height: 100px;
  padding: 16px;
}

.control-metric {
  min-height: 112px;
}

.control-metric strong {
  font-size: 2rem;
}

.control span {
  color: var(--muted);
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 12px;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 12px;
  }

  .nav-item {
    text-align: center;
  }

  .profile-card {
    width: 100%;
  }

  .main {
    padding: 18px;
  }

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

  .inline-form {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .metrics-grid,
  .content-grid,
  .mfa-setup-grid,
  .security-grid {
    grid-template-columns: 1fr;
  }

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

  .audit-list time {
    text-align: left;
  }
}
