:root {
  --atlas-blue: #0057ad;
  --atlas-navy: #081a33;
  --atlas-line: #d9e2ef;
  --atlas-bg: #f4f7fb;
  --atlas-muted: #5e6d84;
  --atlas-red: #b42318;
  --atlas-green: #16803a;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--atlas-navy);
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--atlas-bg);
}

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

button {
  cursor: pointer;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.login-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 48px;
  align-items: center;
}

.login-hero,
.login-card,
.page-hero,
.card-panel {
  background: #fff;
  border: 1px solid var(--atlas-line);
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(8, 26, 51, 0.06);
}

.login-hero,
.login-card {
  padding: 42px;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 22px;
}

.hero-brand img,
.login-logo,
.topbar-brand img {
  height: 54px;
  width: auto;
}

.hero-brand span {
  width: 1px;
  height: 52px;
  background: var(--atlas-line);
}

.hero-copy h1 {
  margin: 44px 0 12px;
  font-size: 34px;
}

.login-card {
  text-align: center;
}

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

.login-card label,
.form-grid label {
  display: grid;
  gap: 6px;
  text-align: left;
  font-weight: 650;
  color: #44546a;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd8e6;
  border-radius: 6px;
  padding: 11px 12px;
  color: var(--atlas-navy);
  background: #fff;
}

.topbar {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid var(--atlas-line);
}

.topbar-brand,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-brand span {
  width: 1px;
  height: 36px;
  background: var(--atlas-line);
}

.topbar-brand button,
.ghost-button {
  border: 0;
  background: transparent;
  color: var(--atlas-navy);
  font-weight: 700;
}

.session-pill,
.scope-pill,
.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eaf2ff;
  color: var(--atlas-blue);
  font-weight: 700;
}

.documental-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 68px);
}

.side-nav {
  background: #fff;
  border-right: 1px solid var(--atlas-line);
  padding: 22px 14px;
}

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

.side-nav a {
  display: block;
  padding: 12px 14px;
  border-radius: 8px;
  color: #26364d;
  text-decoration: none;
  font-weight: 650;
}

.side-nav a.active,
.side-nav a:hover {
  background: #eaf2ff;
  color: var(--atlas-blue);
}

.version-note {
  display: block;
  margin: 28px 14px 0;
  color: var(--atlas-muted);
}

.content-area {
  padding: 26px;
  display: grid;
  gap: 20px;
  min-width: 0;
}

.page-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px;
}

.page-hero h1 {
  margin: 0 0 8px;
  font-size: 30px;
}

.page-hero p,
.muted,
.section-title-row p,
.hero-brand p,
.hero-copy p,
.login-card p {
  color: var(--atlas-muted);
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--atlas-blue);
  font-weight: 800;
}

.tab-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}

.tab-bar button {
  border: 1px solid var(--atlas-line);
  border-radius: 999px;
  background: #fff;
  padding: 10px 16px;
  color: #304158;
  font-weight: 750;
}

.tab-bar button.active {
  background: var(--atlas-blue);
  color: #fff;
  border-color: var(--atlas-blue);
}

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 420px);
  gap: 18px;
}

.card-panel {
  padding: 20px;
  min-width: 0;
}

.span-2 {
  grid-column: 1 / -1;
}

.section-title-row,
.filters-row,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filters-row {
  margin: 14px 0;
}

.primary-action,
.danger-action {
  border: 0;
  border-radius: 6px;
  padding: 11px 16px;
  color: #fff;
  font-weight: 800;
}

.primary-action {
  background: var(--atlas-blue);
}

.danger-action {
  background: var(--atlas-red);
}

.form-grid {
  grid-template-columns: 1fr 1fr;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}

.check-row input {
  width: auto;
}

.list-panel,
.mini-list,
.metadata-panel,
.base-summary {
  display: grid;
  gap: 10px;
}

.list-item,
.mini-item,
.metadata-card {
  border: 1px solid var(--atlas-line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.list-item.selected,
.version-item.selected {
  border-color: var(--atlas-blue);
  box-shadow: inset 4px 0 0 var(--atlas-blue);
}

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

.list-item button {
  justify-self: start;
  border: 1px solid var(--atlas-line);
  border-radius: 6px;
  background: #f8fbff;
  padding: 7px 10px;
  color: var(--atlas-blue);
  font-weight: 750;
}

.split-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

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

.compact-form button {
  border: 1px solid var(--atlas-blue);
  border-radius: 6px;
  background: #eaf2ff;
  color: var(--atlas-blue);
  font-weight: 800;
}

.toast,
.form-message {
  color: var(--atlas-red);
}

.action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.action-bar button,
.ghost-bordered {
  border: 1px solid var(--atlas-line);
  border-radius: 6px;
  background: #fff;
  color: var(--atlas-blue);
  padding: 9px 12px;
  font-weight: 800;
}

.action-bar button:hover,
.ghost-bordered:hover {
  background: #eaf2ff;
}

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

.bucket-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--atlas-line);
  border-radius: 8px;
  background: #fff;
}

.bucket-card > span {
  width: fit-content;
  min-width: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eaf2ff;
  color: var(--atlas-blue);
  font-weight: 900;
}

.bucket-card button,
.version-item {
  width: 100%;
  border: 1px solid var(--atlas-line);
  border-radius: 6px;
  background: #f8fbff;
  color: #26364d;
  padding: 8px 10px;
  text-align: left;
  font-weight: 750;
}

.version-item {
  display: grid;
  gap: 4px;
}

.document-preview {
  min-height: 420px;
  max-height: 70vh;
  overflow: auto;
  border: 1px solid var(--atlas-line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 16px;
}

.document-preview pre {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

.status-chip.warning {
  background: #fff7e8;
  color: #a15c00;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 26, 51, 0.35);
  z-index: 30;
}

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

.modal-card {
  width: min(560px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--atlas-line);
  border-radius: 8px;
  background: #fff;
  padding: 22px;
  box-shadow: 0 28px 80px rgba(8, 26, 51, 0.24);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--atlas-line);
  border-left: 4px solid var(--atlas-blue);
  border-radius: 8px;
  box-shadow: 0 18px 50px rgba(8, 26, 51, 0.14);
}

@media (max-width: 980px) {
  .login-shell,
  .documental-shell,
  .panel-grid,
  .split-two {
    grid-template-columns: 1fr;
  }

  .side-nav {
    border-right: 0;
    border-bottom: 1px solid var(--atlas-line);
  }

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

  .page-hero,
  .section-title-row,
  .filters-row {
    align-items: stretch;
    flex-direction: column;
  }
}
