:root {
  --bg: #edf3f7;
  --surface: #ffffff;
  --surface-soft: #f5f8fb;
  --surface-strong: #fdfefe;
  --line: #d7e2eb;
  --line-strong: #b6c7d6;
  --text: #102033;
  --muted: #617286;
  --accent: #0f766e;
  --accent-strong: #0b5e58;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --accent-ring: rgba(15, 118, 110, 0.22);
  --danger: #b42318;
  --danger-soft: #fde7e5;
  --success: #157347;
  --success-soft: #ddf7e8;
  --shadow: 0 24px 60px rgba(16, 32, 51, 0.08);
  --field-shadow: 0 10px 26px rgba(16, 32, 51, 0.07);
  --radius: 24px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 28%),
    linear-gradient(180deg, #f5f8fb 0%, #eaf0f5 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.auth-shell-vnext,
.install-shell {
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-main-vnext {
  width: min(520px, 100%);
}

.auth-card-vnext,
.install-card,
.panel-card,
.metric-card {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.auth-card-vnext,
.install-card,
.panel-card {
  padding: 28px;
}

.auth-card-vnext,
.install-card,
.stack-form,
.auth-copy-vnext,
.nav-stack,
.page-section,
.list-stack,
.meta-stack,
.timeline,
.pipeline-list,
.tree-list {
  display: grid;
  gap: 16px;
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.76rem;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

.field {
  display: grid;
  gap: 9px;
}

.field span {
  color: var(--muted);
  letter-spacing: 0.01em;
  font-size: 0.84rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.topbar-search-vnext input {
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 15px 17px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 250, 252, 0.98) 100%);
  color: var(--text);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    0 1px 2px rgba(16, 32, 51, 0.04),
    var(--field-shadow);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease,
    background 160ms ease;
  appearance: none;
  -webkit-appearance: none;
}

.field textarea {
  min-height: 132px;
  padding-top: 16px;
  resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder,
.topbar-search-vnext input::placeholder {
  color: #8b9bae;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.topbar-search-vnext input:hover {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfd 100%);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.topbar-search-vnext input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface-strong);
  box-shadow:
    0 0 0 5px var(--accent-ring),
    0 18px 34px rgba(15, 118, 110, 0.12);
  transform: translateY(-1px);
}

.field select,
.topbar-search-vnext input[type="search"] {
  padding-right: 48px;
}

.field select {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 250, 252, 0.98) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18' fill='none'%3E%3Cpath d='M4.5 6.75L9 11.25L13.5 6.75' stroke='%23617286' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 16px center;
  background-size: auto, 18px 18px;
  cursor: pointer;
}

input[type="file"] {
  padding: 12px 12px 12px 14px;
}

input[type="file"]::file-selector-button {
  margin-right: 14px;
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  background: rgba(15, 118, 110, 0.1);
  color: var(--accent-strong);
  font-weight: 800;
  cursor: pointer;
  transition: background 160ms ease, transform 160ms ease;
}

input[type="file"]::file-selector-button:hover {
  background: rgba(15, 118, 110, 0.16);
  transform: translateY(-1px);
}

.primary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 16px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.secondary-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
}

.danger-button {
  border-color: rgba(180, 35, 24, 0.2);
  color: var(--danger);
  background: rgba(253, 231, 229, 0.6);
}

.ghost-link,
.danger-link {
  color: var(--accent);
  font-weight: 700;
}

.danger-link {
  color: var(--danger);
  background: none;
  border: 0;
  cursor: pointer;
}

.inline-row,
.section-head,
.topbar-vnext,
.list-item,
.tree-item {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  align-items: center;
}

.compact-row {
  gap: 8px;
}

.wrap-row {
  flex-wrap: wrap;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.sidebar-vnext {
  min-height: 100vh;
  padding: 24px 20px;
  background: rgba(248, 251, 253, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand-block {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 28px;
}

.brand-block span,
.sidebar-footer-vnext span,
.helper-copy,
.list-item span,
.list-item small,
.meta-block span,
.timeline span,
.empty-card,
.panel-card p {
  color: var(--muted);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0f766e, #0ea5a3);
  color: #fff;
  font-weight: 800;
}

.nav-item {
  padding: 12px 14px;
  border-radius: 14px;
  color: var(--text);
}

.nav-item.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent-soft);
}

.sidebar-footer-vnext {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

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

.topbar-vnext {
  margin-bottom: 20px;
}

.topbar-search-vnext {
  width: min(420px, 100%);
}

.topbar-search-vnext input {
  min-height: 52px;
  border-radius: 999px;
}

.card-grid,
.workspace-grid,
.filter-grid,
.grid-two,
.document-layout {
  display: grid;
  gap: 16px;
}

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

.workspace-grid,
.document-layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
}

.filter-grid.wide {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

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

.metric-card {
  padding: 22px;
}

.metric-card span {
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
}

.metric-card strong {
  display: block;
  font-size: 2rem;
  margin-bottom: 8px;
}

.list-item {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
}

.list-item.large {
  align-items: flex-start;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  white-space: nowrap;
}

.status-ready,
.flash-success {
  background: var(--success-soft);
  color: var(--success);
}

.status-review_required,
.status-duplicate_suspected {
  background: #fff2d6;
  color: #9a6700;
}

.status-failed,
.flash-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-active {
  background: var(--success-soft);
  color: var(--success);
}

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

.flash {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 16px;
}

.panel-card-accent {
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 28%),
    rgba(255, 255, 255, 0.96);
}

.pipeline-list div,
.meta-block,
.tree-item,
.file-preview-item,
.user-admin-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
}

.user-admin-card {
  display: grid;
  gap: 16px;
}

.pipeline-list div {
  display: grid;
  grid-template-columns: 34px 1fr;
  align-items: center;
}

.pipeline-list strong {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--surface);
}

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

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

.action-row {
  justify-content: flex-start;
}

.file-preview-item strong,
.meta-block strong,
.timeline strong {
  display: block;
  margin-bottom: 4px;
}

.viewer-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-soft);
  min-height: 520px;
}

.viewer-card iframe,
.viewer-card img {
  width: 100%;
  height: 520px;
  border: 0;
  object-fit: contain;
  background: #fff;
}

.page-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.page-strip span {
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
}

.ocr-box {
  overflow: auto;
  white-space: pre-wrap;
  padding: 16px;
  border-radius: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
}

.timeline div {
  padding: 14px;
  border-left: 3px solid var(--accent-soft);
  background: var(--surface-soft);
  border-radius: 12px;
}

.align-end {
  align-self: end;
}

.empty-card {
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px dashed var(--line);
}

@media (max-width: 1100px) {
  .app-shell,
  .workspace-grid,
  .document-layout,
  .card-grid,
  .filter-grid,
  .filter-grid.wide,
  .grid-two,
  .grid-three {
    grid-template-columns: 1fr;
  }

  .sidebar-vnext {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .auth-shell-vnext,
  .install-shell,
  .main-vnext {
    padding: 14px;
  }

  .auth-card-vnext,
  .install-card,
  .panel-card,
  .metric-card {
    padding: 20px;
    border-radius: 22px;
  }

  .topbar-vnext,
  .section-head,
  .list-item,
  .tree-item,
  .inline-row {
    flex-direction: column;
    align-items: stretch;
  }

  .viewer-card,
  .viewer-card iframe,
  .viewer-card img {
    min-height: 320px;
    height: 320px;
  }

  .field input,
  .field select,
  .field textarea,
  .topbar-search-vnext input {
    min-height: 52px;
    padding: 14px 15px;
    border-radius: 16px;
    font-size: 0.96rem;
  }

  .field textarea {
    min-height: 120px;
  }
}
