/* -------------------------------------------------------------------
   Collagia Portal � app.css
   Ports Angular SCSS design system to plain CSS for Blazor WASM.
   Viewport-based sizing follows Angular convention: calc(Xvh/10.8)
   and calc(Xvw/19.2) to match the original viewport math.
   ------------------------------------------------------------------- */

/* -- Fonts ------------------------------------------------------- */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap");
@import url("https://fonts.googleapis.com/icon?family=Material+Icons+Round");

/* -- Design tokens ----------------------------------------------- */
:root {
  --accent: #00bcd4;
  --primary: #00bcd4;
  /* Auth */
  --auth-bg: #232340;
  --auth-cta: #fe3467;
  --auth-error: #ff3333;
  --auth-link: #fe3467;
  /* Sidebar */
  --sidebar-bg: #33323d;
  --sidebar-text: #f5f5f5;
  --sidebar-active-bg: rgba(54, 240, 186, 0.13);
  --sidebar-active-text: #65d6cf;
  --sidebar-disabled: #565567;
  /* Card type shadow colors */
  --shadow-study: rgba(103, 113, 220, 0.5);
  --shadow-collage: rgba(79, 209, 197, 0.5);
  --shadow-biz: rgba(199, 103, 220, 0.5);
  --shadow-item: rgba(255, 195, 0, 0.5);
  --shadow-image: rgba(160, 188, 103, 0.5);
  --shadow-model: rgba(106, 169, 255, 0.35);
  /* Generic */
  --border: #c4c4c4;
  --text-dark: #33323d;
  --text-muted: rgba(0, 0, 0, 0.6);
  --body-bg: #eeeeee;
  --radius-sm: 4px;
  --radius-card: 5px;
  --radius-modal: 8px;
}

/* -- Reset / base ------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--text-dark);
  background: var(--body-bg);
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

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

input,
textarea,
select {
  font-family: inherit;
}

h1,
h2,
h3,
h4 {
  margin: 0;
}

/* -- App loading (shown while Blazor bootstraps) ----------------- */
.app-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
}

.app-loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* -- Update banner ----------------------------------------------- */
.update-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 10px 20px;
  background-color: var(--color-primary, #1976d2);
  color: #fff;
  font-size: 0.9em;
}

.update-banner button {
  padding: 4px 14px;
  border: 1px solid #fff;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-size: inherit;
}

.update-banner button:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* -- App shell --------------------------------------------------- */
.app-shell {
  display: flex;
  flex-direction: column;
  width: 95vw;
  height: 95vh;
  padding: 1rem;
  gap: 1rem;
  background: var(--body-bg);
}

/* -- Top bar ----------------------------------------------------- */
.top-bar {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 1rem;
  flex-shrink: 0;
  height: 56px;
}

/* -- Left header ------------------------------------------------- */
.left-header {
  background: white;
  border-radius: 6px;
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  padding: 4px 16px;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  position: relative;
}

.logo-image {
  width: 100px;
  display: block;
}

.beta-sign {
  position: absolute;
  top: -8px;
  right: -14px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
}

/* -- Right header ------------------------------------------------ */
.right-header {
  flex: 1;
  background: white;
  border-radius: 5px;
  box-shadow: 0px 4px 4px 0px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 17px;
  gap: 4px;
}

.header-menu {
  position: relative;
}

.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 5px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-dark);
  transition:
    box-shadow 0.15s,
    color 0.15s;
  text-decoration: none;
}

.header-icon-btn:hover {
  box-shadow: 1px 1px 2px 1px rgba(64, 64, 64, 0.1);
  color: var(--accent);
}

/* -- Material icon spans ----------------------------------------- */
[class^="icon-"],
[class*=" icon-"] {
  font-family: "Material Icons Round", "Material Icons";
  font-size: 24px;
  line-height: 1;
  display: inline-block;
  font-style: normal;
  font-weight: normal;
  letter-spacing: normal;
  text-transform: none;
  -webkit-font-feature-settings: "liga";
  font-feature-settings: "liga";
}

.icon-user-account::before {
  content: "account_circle";
}

.icon-education::before {
  content: "school";
}

.icon-bug-report::before {
  content: "bug_report";
}

/* -- Right-header dropdown --------------------------------------- */
.dropdown-panel {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  z-index: 100;
  overflow: hidden;
}

.user-info {
  display: flex;
  flex-direction: column;
  padding: 7.5px 16px;
  gap: 2px;
}

.user-info b {
  font-size: 14px;
  font-weight: 500;
}

.user-info span {
  font-size: 12px;
  color: var(--text-muted);
}

.dropdown-panel hr {
  margin: 0;
  border: none;
  border-top: 1px solid var(--border);
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-dark);
  text-decoration: none;
  transition: background 0.1s;
}

.dropdown-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* -- Main content ------------------------------------------------ */
.main-content {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* -- Home layout (sidebar + content) ---------------------------- */
.home-layout {
  display: flex;
  flex-direction: row;
  flex: 1;
  background: white;
  border-radius: 10px;
  overflow: hidden;
}

/* -- Home menu (sidebar navigation) ----------------------------- */
.home-menu {
  width: calc(226vh / 10.8);
  min-width: 160px;
  max-width: 220px;
  background: var(--sidebar-bg);
  border-radius: 10px 0 0 10px;
  display: flex;
  flex-direction: column;
  padding-top: 1.5rem;
  flex-shrink: 0;
}

.home-menu-item {
  display: block;
  padding: clamp(8px, calc(10vh / 10.8), 16px)
    clamp(12px, calc(20vw / 19.2), 24px);
  font-size: clamp(13px, calc(24vh / 10.8), 20px);
  color: var(--sidebar-text);
  text-decoration: none;
  transition:
    background 0.1s,
    color 0.1s;
  white-space: nowrap;
  font-weight: 400;
}

.home-menu-item:hover:not(.active) {
  background: rgba(255, 255, 255, 0.05);
}

.home-menu-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
  font-weight: 800;
}

/* -- Home content area ------------------------------------------- */
.home-content {
  flex: 1;
  background: white;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

/* -- Home list --------------------------------------------------- */
.home-list {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

/* -- Home list search bar ---------------------------------------- */
.home-list-search {
  display: flex;
  flex-direction: column;
  padding-left: clamp(20px, calc(170vw / 19.2), 120px);
  padding-right: clamp(20px, calc(170vw / 19.2), 120px);
  padding-top: clamp(16px, calc(117vh / 10.8), 80px);
  flex-shrink: 0;
}

/* Row 1: magnifying glass icon + text input */
.search-field {
  display: flex;
  flex-direction: row;
  align-items: center;
  border-bottom: 2px solid #c4c4c4;
  padding-bottom: clamp(6px, calc(9vh / 10.8), 12px);
}

.search-field .icon {
  width: clamp(20px, calc(34vh / 10.8), 40px);
  height: clamp(20px, calc(34vh / 10.8), 40px);
  flex-shrink: 0;
}

.search-field__input {
  margin-left: clamp(6px, calc(8vh / 10.8), 12px);
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-weight: 400;
  font-size: clamp(13px, calc(16vh / 10.8), 18px);
  line-height: clamp(16px, calc(19vh / 10.8), 22px);
  color: var(--text-dark);
}

.search-field__input::placeholder {
  color: #c4c4c4;
}

/* Row 2: result count (left) + optional connection type switcher (right) */
.search-footer {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
}

.search-footer__result {
  padding-top: clamp(8px, calc(14.5vh / 10.8), 16px);
  padding-bottom: clamp(8px, calc(14.5vh / 10.8), 16px);
  padding-left: clamp(4px, calc(5vw / 19.2), 20px);
  font-weight: 400;
  font-size: clamp(13px, calc(16vh / 10.8), 18px);
  line-height: clamp(16px, calc(19vh / 10.8), 22px);
  color: #000;
}

/* Connection type filter icon buttons */
.search-footer__switcher {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: clamp(4px, calc(6vh / 10.8), 8px) clamp(8px, calc(26vw / 19.2), 40px);
}

.search-footer__switcher__button {
  border: none;
  padding: 0;
  width: clamp(24px, calc(36vh / 10.8), 44px);
  height: clamp(24px, calc(36vh / 10.8), 44px);
  background-color: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-footer__switcher__button .icon {
  width: clamp(24px, calc(36vh / 10.8), 44px);
  height: clamp(24px, calc(36vh / 10.8), 44px);
}

.search-footer__switcher__divider {
  width: 1px;
  height: clamp(16px, calc(24vh / 10.8), 28px);
  background-color: #33323d;
  margin: 0 2px;
}

/* Active state: colorize SVG paths to accent colour */
.search-footer__switcher__button.image.active svg rect {
  stroke: var(--accent);
}

.search-footer__switcher__button.image.active svg circle,
.search-footer__switcher__button.image.active svg path {
  fill: var(--accent);
}

.search-footer__switcher__button.business.active svg rect:not(:first-child) {
  stroke: var(--accent);
}

.search-footer__switcher__button.item.active svg path {
  stroke: var(--accent);
}

.search-footer__switcher__button.item.active svg rect:not(:first-child) {
  stroke: var(--accent);
}

/* -- Card grid --------------------------------------------------- */
.card-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-content: flex-start;
  padding: clamp(8px, calc(9vh / 10.8), 16px)
    clamp(20px, calc(205vw / 19.2), 140px);
  overflow-y: auto;
  flex: 1;
  /* Negative right margin counteracts per-card margin-right on row ends */
  margin-right: calc(-36vw / 19.2);
}

/* -- Base card � mirrors Angular home-card mixin ----------------- */
.card {
  display: flex;
  flex-direction: column;
  width: calc(200vw / 19.2);
  min-width: calc(200vh / 10.8);
  max-height: calc(280vh / 10.8);
  border-radius: var(--radius-card);
  background: white;
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  margin-right: calc(36vw / 19.2);
  margin-bottom: calc(40vh / 10.8);
  transition: box-shadow 0.2s;
}

/* Generic fallback hover */
.card:hover {
  box-shadow: 1px 6px 15px rgba(0, 0, 0, 0.12);
}

/* -- Type-specific shadows (base + hover) ------------------------ */
.study-card,
.new-item-card--Studies {
  border: none;
  box-shadow: 0 2px 5px var(--shadow-study);
}

.collage-card,
.new-item-card--Collages {
  border: none;
  box-shadow: 0 2px 5px #4fd1c5;
}

.collage-view-card {
  border: none;
  box-shadow: 0 2px 5px #d1994f;
}

.connection-card {
  border: none;
}

.connection-card--image {
  box-shadow: 0 2px 5px var(--shadow-image);
}

.connection-card--business {
  box-shadow: 0 2px 5px var(--shadow-biz);
}

.connection-card--items {
  box-shadow: 0 2px 5px var(--shadow-item);
}

.study-card:hover,
.new-item-card--Studies:hover {
  box-shadow: 1px 6px 15px var(--shadow-study);
}

.collage-card:hover,
.new-item-card--Collages:hover {
  box-shadow: 1px 6px 15px var(--shadow-collage);
}

.collage-view-card:hover {
  box-shadow: 1px 6px 15px #d1994f;
}

.connection-card--image:hover {
  box-shadow: 1px 6px 15px var(--shadow-image);
}

.connection-card--business:hover {
  box-shadow: 1px 6px 15px var(--shadow-biz);
}

.connection-card--items:hover {
  box-shadow: 1px 6px 15px var(--shadow-item);
}

.model-card {
  box-shadow: 0 2px 5px var(--shadow-model);
  border: none;
}

.model-card:hover {
  box-shadow: 1px 6px 15px var(--shadow-model);
}

/* -- Card body --------------------------------------------------- */
/* Header: name + border-bottom separator */
.card-header {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: calc(14.5vh / 10.8) 0;
  border-bottom: 1px solid #c4c4c4;
}

.card-name {
  font-weight: 500;
  font-size: calc(18vh / 10.8);
  line-height: calc(23vh / 10.8);
  text-indent: calc(18vh / 10.8);
  color: #33323d;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Inner wrapper: centered with auto margin, ~188/19.2 vw wide */
.card-wrapper {
  position: relative;
  min-width: calc(188vh / 10.8);
  width: calc(188vw / 19.2);
  margin: 0 auto;
}

.card-body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  justify-content: space-between;
  height: calc(220vh / 10.8);
}

.card-title {
  font-size: clamp(13px, calc(18vh / 10.8), 20px);
  font-weight: 500;
  color: var(--text-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-title-row {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.card-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: auto;
  padding-top: 8px;
}

.card-date {
  font-size: clamp(10px, calc(11vh / 10.8), 13px);
  font-weight: 300;
  color: var(--text-dark);
}

/* -- Card actions bar -------------------------------------------- */
.card-actions {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  flex-shrink: 0;
}

/* -- Shared card footer ------------------------------------------- */
.card-footer {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  flex-shrink: 0;
}

.card-footer__created {
  padding-left: calc(9vh / 10.8);
  padding-bottom: calc(14vh / 10.8);
}

.card-footer__author,
.card-footer__date {
  font-weight: 300;
  font-size: calc(11vh / 10.8);
  line-height: calc(12vh / 10.8);
  color: #33323d;
}

.card-footer__author {
  margin-bottom: calc(8vh / 10.8);
}

.card-footer__action {
  position: relative;
}

/* Collage reference (icon + name) */
.collage {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding-top: calc(10vh / 10.8);
  padding-left: calc(6vh / 10.8);
  padding-right: calc(6vh / 10.8);
}

.collage .icon {
  width: calc(36vh / 10.8);
  height: calc(36vh / 10.8);
  flex-shrink: 0;
}

.collage__name {
  font-weight: 400;
  font-size: calc(12vh / 10.8);
  line-height: calc(14vh / 10.8);
  color: #33323d;
  white-space: normal;
  overflow: visible;
  word-break: break-word;
}

/* -- Collage card body ------------------------------------------- */
.collage-card.uncompleted {
  background: #eeeeee;
  cursor: default;
}

.collage-card .card-body {
  overflow: hidden;
  justify-content: flex-start;
}

.collage-card__content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding-top: calc(10vh / 10.8);
  position: relative;
  overflow: visible;
}

/* Connection row: icon + truncated name */
.collage-card__connection {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding-left: calc(10vh / 10.8);
  height: 2.7vh;
}

.collage-card__connection .icon {
  width: calc(36vh / 10.8);
  height: calc(36vh / 10.8);
  flex-shrink: 0;
}

.collage-card__connection-name {
  font-weight: 400;
  font-size: calc(12vh / 10.8);
  line-height: calc(14vh / 10.8);
  text-indent: calc(4vh / 10.8);
  color: #33323d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - calc(36vh / 10.8));
}

/* Gauge chart area */
.collage-card__chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding-top: calc(10vh / 10.8);
  position: relative;
}

.collage-gauge {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
}

.collage-gauge__circle {
  width: 120px;
  height: 60px;
}

.collage-gauge__circle svg {
  width: 100%;
  height: 100%;
}

.collage-gauge__text {
  position: absolute;
  top: 50%;
  text-align: center;
}

.collage-gauge__items {
  display: flex;
  flex-direction: column;
  font-weight: 300;
  font-size: clamp(8px, calc(12vh / 10.8), 12px);
  line-height: 100%;
  text-align: center;
}

.collage-gauge__items strong {
  font-weight: 700;
  font-size: clamp(10px, calc(16vh / 10.8), 16px);
  line-height: 100%;
}

.collage-gauge__tooltip {
  position: absolute;
  bottom: 100%;
  background: #333;
  color: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  z-index: 10;
  font-size: 11px;
  white-space: nowrap;
}

.collage-gauge__triangle {
  position: absolute;
  bottom: 95%;
  width: 0;
  height: 0;
  border-left: 20px solid transparent;
  border-right: 20px solid transparent;
  border-top: 20px solid #2e2e38;
}

/* Processing state overlay */
.collage-card__loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(10vh / 10.8) 0;
  font-size: calc(8vh / 10.8);
  text-align: center;
}

.collage-card__loader .icon {
  width: 42px;
  height: 42px;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

.icon-spinning {
  animation: spin 2s linear infinite;
}

/* Collage card footer: paints over gauge overflow */
.collage-card .card-footer {
  position: relative;
  z-index: 1;
  background: white;
}

/* -- Connection card body ---------------------------------------- */

/* Content: fills height above footer */
.connection-card__content {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1;
}

/* Type row: icon + truncated source name */
.connection-card__type {
  display: flex;
  flex-direction: row;
  align-items: center;
  padding-left: calc(10vh / 10.8);
  padding-top: calc(10vh / 10.8);
}

.connection-card__type .icon {
  width: calc(36vh / 10.8);
  height: calc(36vh / 10.8);
  flex-shrink: 0;
}

.connection-card__type-name {
  font-weight: 400;
  font-size: calc(12vh / 10.8);
  line-height: calc(14vh / 10.8);
  text-indent: calc(4vh / 10.8);
  color: #33323d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: calc(100% - calc(36vh / 10.8));
}

/* Decorative right-border box */
.connection-card__border-box {
  height: calc(50vh / 10.8);
  max-width: calc(100% - calc(9vh / 10.8));
  width: calc(100% - calc(9vw / 19.2));
  margin-bottom: calc(20vh / 10.8);
}

.connection-card--image .connection-card__border-box {
  border-right: 3px solid #a0bc67;
}

.connection-card--business .connection-card__border-box {
  border-right: 3px solid #c767dc;
}

.connection-card--items .connection-card__border-box {
  border-right: 3px solid #ffc300;
}

/* -- Kebab trigger button ---------------------------------------- */
.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(30vh / 10.8);
  height: calc(30vh / 10.8);
  border: 0;
  outline: 0;
  background-color: transparent;
  cursor: pointer;
}

.icon-button .icon {
  width: calc(24vh / 10.8);
  height: calc(24vh / 10.8);
}

/* Rename form (replaces collage row in body) */
.study-card__rename {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: calc(10vh / 10.8) calc(6vh / 10.8) 0;
}

.study-card__rename input {
  width: 100%;
  padding: 4px 8px;
  font-size: calc(12vh / 10.8);
  border: 1px solid #c4c4c4;
  border-radius: 3px;
  font-family: inherit;
  box-sizing: border-box;
}

.study-card__rename-actions {
  display: flex;
  gap: 6px;
}

/* Kebab dropdown */
.kebab-backdrop {
  position: fixed;
  inset: 0;
  z-index: 49;
}

.kebab-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  right: 0;
  background: white;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  min-width: 130px;
  z-index: 50;
  overflow: hidden;
}

.kebab-item {
  display: block;
  width: 100%;
  padding: 9px 14px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  color: #33323d;
  transition: background 0.1s;
}

.kebab-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.kebab-item--danger {
  color: var(--danger);
}

.kebab-item--danger:hover {
  background: rgba(220, 38, 38, 0.06);
}

/* -- New item card ----------------------------------------------- */
.new-item-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  color: var(--text-muted);
  transition:
    border-color 0.2s,
    color 0.2s,
    box-shadow 0.2s;
}

.new-item-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 1px 6px 15px rgba(0, 188, 212, 0.2);
}

.new-item-card .card-wrapper {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.new-item-card .card-body {
  align-items: center;
  justify-content: center;
}

.new-item-icon {
  font-size: 32px;
  font-weight: 300;
  line-height: 1;
}

/* -- Badges ------------------------------------------------------ */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  flex-shrink: 0;
}

/* -- Buttons ----------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s,
    opacity 0.15s;
  border: 1px solid;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 24px;
  border-radius: 72px;
  background: var(--auth-cta);
  color: white;
  font-size: 16px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-primary:hover {
  opacity: 0.9;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent, #00bcd4);
  border-color: var(--accent, #00bcd4);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: #00a5bb;
  filter: brightness(0.92);
}

.btn--secondary {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.18);
  color: var(--text-primary, #33323d);
}

.btn--secondary:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.04);
}

.btn--danger {
  background: #fff;
  border-color: #e53935;
  color: #e53935;
}

.btn--danger:hover:not(:disabled) {
  background: rgba(229, 57, 53, 0.06);
}

.btn--ghost {
  background: transparent;
  color: var(--text-dark);
  border: 1px solid var(--border);
}

.btn--ghost:hover:not(:disabled) {
  background: #f5f5f5;
}

.btn--outline {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn--outline.btn--active,
.btn--outline:hover:not(:disabled) {
  background: rgba(0, 188, 212, 0.1);
}

.btn--back {
  padding: 6px 12px;
  color: var(--text-muted);
  border: none;
  background: transparent;
  font-size: 13px;
}

.btn--back:hover {
  color: var(--text-dark);
}

.btn--back .icon {
  width: 16px;
  height: 16px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  background: white;
  color: var(--text-dark);
  font-size: 14px;
  font-weight: 400;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.04);
}

.btn-secondary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border-radius: var(--radius-sm);
  background: #d32f2f;
  color: white;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.15s;
}

.btn-danger:hover {
  opacity: 0.9;
}

.btn-danger:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-sm {
  padding: 3px 10px;
  font-size: 12px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-muted);
  font-family: inherit;
  border-radius: var(--radius-sm);
  transition:
    background 0.1s,
    color 0.1s;
}

.btn-icon:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-dark);
}

.btn-danger-text {
  color: #d32f2f;
}

.btn-danger-text:hover {
  background: rgba(211, 47, 47, 0.08);
  color: #d32f2f;
}

.link-button {
  background: none;
  border: none;
  padding: 0;
  color: var(--auth-link);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  text-decoration: underline;
}

/* -- Form groups � light default (used in modals on home pages) -- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input {
  height: 40px;
  padding: 0 12px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input:focus {
  border-color: var(--accent);
}

/* Dark override � auth layout (covers auth pages and auth modals) */
.auth-layout .form-group label {
  color: rgba(255, 255, 255, 0.7);
}

.auth-layout .form-group input {
  height: 50px;
  padding: 0 16px;
  background: var(--auth-bg);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  color: white;
  font-size: 18px;
}

.auth-layout .form-group input:focus {
  border-color: rgba(255, 255, 255, 0.5);
}

/* ForgotPasswordModal renders inside auth-layout but is a light modal */
.auth-layout .modal .form-group label {
  color: var(--text-muted);
}

.auth-layout .modal .form-group input {
  height: 40px;
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dark);
  font-size: 14px;
}

.auth-layout .modal .form-group input:focus {
  border-color: var(--accent);
}

.validation-message {
  font-size: 12px;
  color: var(--auth-error);
  margin-top: 2px;
}

/* -- Auth layout ------------------------------------------------- */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--auth-bg);
}

.auth-layout-content {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* -- Auth card --------------------------------------------------- */
.auth-card {
  width: 480px;
  max-width: calc(100vw - 2rem);
  padding: 40px;
  display: flex;
  flex-direction: column;
}

.auth-card h1 {
  font-size: 40px;
  font-weight: 500;
  color: white;
  margin-bottom: 8px;
}

.auth-card .subtitle {
  font-size: 16px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 24px;
}

.auth-card .btn-primary {
  width: 100%;
  height: 50px;
  font-size: 18px;
  border-radius: 72px;
  margin-top: 8px;
}

.auth-error {
  color: var(--auth-error);
  font-size: 13px;
  margin: 8px 0 12px;
}

/* 6-digit TOTP code input — used on login page and settings MFA section */
.mfa-code-input {
  font-size: 24px;
  letter-spacing: 0.25em;
  max-width: 200px;
  text-align: center;
}

.auth-links {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

.auth-links a,
.auth-links .link-button {
  color: var(--auth-link);
}

/* -- Modals ------------------------------------------------------ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: var(--radius-modal);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 201;
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-header h2 {
  font-size: 20px;
  font-weight: 500;
  color: var(--text-dark);
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition:
    color 0.1s,
    background 0.1s;
}

.modal-close:hover {
  color: var(--text-dark);
  background: rgba(0, 0, 0, 0.05);
}

.modal-body {
  padding: 16px 24px 24px;
}

.modal-body p {
  color: var(--text-dark);
  margin: 0 0 16px;
  line-height: 1.5;
}

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

.modal-error {
  color: var(--color-danger, #d32f2f);
  font-size: 0.875em;
  margin-top: 8px;
  margin-bottom: 0;
}

/* -- Select Collage modal ---------------------------------------- */
.select-collage-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: var(--radius-modal);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 201;
  width: min(1300px, calc(100vw - 4rem));
  min-height: 80vh;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.select-collage-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(9vh / 10.8) calc(18vw / 19.2) calc(9vh / 10.8);
  flex-shrink: 0;
}

.select-collage-modal__title {
  font-size: 32px;
  font-weight: 400;
  color: var(--text-dark);
  white-space: nowrap;
}

.select-collage-modal__search {
  padding: 0 calc(18vw / 19.2) calc(9vh / 10.8);
  flex-shrink: 0;
}

.select-collage-modal__body {
  flex: 1;
  overflow-y: auto;
  padding: 0 calc(18vw / 19.2) calc(18vh / 10.8);
}

/* -- Loading spinner --------------------------------------------- */
.loading-spinner {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* -- Blazor error UI --------------------------------------------- */
h1:focus {
  outline: none;
}

#blazor-error-ui {
  background: #ffbe00;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
  display: none;
  left: 0;
  padding: 0.6rem 3rem 0.7rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
  font-size: 14px;
}

#blazor-error-ui .reload {
  font-weight: 600;
  text-decoration: underline;
  margin-left: 8px;
}

#blazor-error-ui .dismiss {
  cursor: pointer;
  position: absolute;
  right: 0.75rem;
  top: 0.5rem;
}

.blazor-error-boundary {
  background:
    url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2ZyA+)
      no-repeat 1rem/1.8rem,
    #b32121;
  padding: 1rem 1rem 1rem 3.7rem;
  color: white;
}

.blazor-error-boundary::after {
  content: "An error has occurred.";
}

/* -------------------------------------------------------------------
   Import Card
   ------------------------------------------------------------------- */

.import-card {
  box-shadow: 0 4px 12px rgba(0, 188, 212, 0.4);
  cursor: pointer;
  transition: box-shadow 0.2s;
}

.import-card:hover {
  box-shadow: 0 6px 18px rgba(0, 188, 212, 0.6);
}

.import-card__content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: calc(6vh / 10.8) calc(6vw / 19.2);
}

.import-card__file {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dark);
}

.import-card__file .icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.import-card__filename {
  font-size: 12px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* -- Status badge -------------------------------------------------- */

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  align-self: flex-start;
}

.status--created {
  background: #e8e8e8;
  color: #555;
}

.status--processing {
  background: #fff3cd;
  color: #856404;
}

.status--uploaded {
  background: #cce5ff;
  color: #004085;
}

.status--configured {
  background: #d4edda;
  color: #155724;
}

.status--completed {
  background: #d4edda;
  color: #155724;
}

.status--error {
  background: #f8d7da;
  color: #721c24;
}

/* -- Source select ------------------------------------------------- */

.source-select__options {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 480px;
}

.source-select__option {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fff;
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.source-select__option:hover:not(:disabled) {
  border-color: var(--accent);
  box-shadow: 0 2px 8px rgba(0, 188, 212, 0.2);
}

.source-select__option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.source-select__icon {
  width: 40px;
  height: 40px;
  color: var(--accent);
  flex-shrink: 0;
}

.source-select__icon svg {
  width: 100%;
  height: 100%;
}

.source-select__label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.source-select__label strong {
  font-size: 15px;
  color: var(--text-dark);
}

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

/* -- Upload zone --------------------------------------------------- */

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  border: 2px dashed var(--border);
  border-radius: var(--radius-card);
  padding: 40px 24px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
  text-align: center;
  color: var(--text-muted);
}

.upload-zone:hover,
.upload-zone--selected {
  border-color: var(--accent);
  background: rgba(0, 188, 212, 0.04);
}

.upload-zone__icon {
  width: 48px;
  height: 48px;
  color: var(--accent);
  margin-bottom: 12px;
}

.upload-zone__hint {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--text-dark);
}

.upload-zone__types {
  margin: 0;
  font-size: 12px;
}

.upload-zone__filename {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--text-dark);
  font-weight: 500;
  word-break: break-all;
}

.upload-zone__size {
  margin: 0;
  font-size: 12px;
}

.upload-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  color: var(--text-muted);
}

.upload-polling {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.upload-error {
  color: #721c24;
  background: #f8d7da;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 13px;
  margin-top: 12px;
}

/* -- S3 upload ----------------------------------------------------- */

.s3-input-row {
  margin-bottom: 16px;
}

.s3-path-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: monospace;
  color: var(--text-dark);
}

.s3-path-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* -- Sheet selection ----------------------------------------------- */

.sheet-selection-panel {
  margin-top: 24px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: #fafafa;
}

.sheet-selection-panel h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.sheet-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.sheet-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

/* -- Preview table ------------------------------------------------- */

.preview-step__name-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.preview-step__name-label {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}

.preview-step__name-input {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  max-width: 360px;
}

.preview-step__name-input:focus {
  outline: none;
  border-color: var(--accent);
}

.preview-step__filename {
  font-size: 12px;
  color: var(--text-muted);
}

.preview-step__sheet-selector {
  margin-bottom: 20px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.preview-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

/* -- Connection upload wizard tables ------------------------------- */

.conn-table-wrap {
  overflow: auto;
  max-height: 55vh;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.conn-csv-table,
.conn-col-type-table {
  border-collapse: collapse;
  font-size: 13px;
  min-width: 100%;
  white-space: nowrap;
}

.conn-csv-table th,
.conn-col-type-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f5f5f5;
  padding: 7px 12px;
  text-align: left;
  font-weight: 600;
  color: var(--text-dark);
  border: 1px solid var(--border);
}

.conn-csv-table td {
  padding: 6px 12px;
  border: 1px solid #e8e8e8;
  color: var(--text-muted);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conn-col-type-table td {
  padding: 6px 12px;
  border: 1px solid #e8e8e8;
  color: var(--text-muted);
}

.conn-table-empty {
  color: var(--text-muted);
  font-size: 14px;
  padding: 32px;
  text-align: center;
  margin: 0;
}

.conn-col-name {
  font-weight: 500;
  color: var(--text-dark);
  white-space: nowrap;
}

.conn-sample-values {
  max-width: 600px;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
  font-size: 12px;
}

.conn-sample-chip {
  display: inline-block;
  background: #f0f0f0;
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--text-dark);
}

.conn-sample-null {
  color: var(--text-muted);
  font-style: italic;
}

.conn-type-card {
  width: 150px;
}

.conn-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: #e8e8e8;
  color: #555;
}

.conn-type-card__name {
  font-weight: 700;
  margin-bottom: 4px;
}

.conn-type-badge--integer,
.conn-type-badge--float,
.conn-type-badge--number {
  background: #cce5ff;
  color: #004085;
}

.conn-type-badge--date,
.conn-type-badge--datetime {
  background: #d4edda;
  color: #155724;
}

.conn-type-locked {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
}

.conn-col-overflow {
  color: var(--text-muted);
  font-style: italic;
}

.conn-required {
  color: #e53935;
}

.conn-field-error {
  color: #e53935;
  font-size: 12px;
  display: block;
  margin-top: 4px;
}

.conn-item-id-group {
  margin-bottom: 16px;
}

.conn-name-group {
  margin-bottom: 24px;
}

.preview-table-wrapper {
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.preview-table {
  border-collapse: collapse;
  font-size: 12px;
  min-width: 100%;
}

.preview-table th {
  background: #f5f5f5;
  padding: 6px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  font-weight: 600;
  color: var(--text-dark);
}

.preview-table td {
  padding: 5px 10px;
  border-bottom: 1px solid #f0f0f0;
  color: var(--text-muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-table tr:last-child td {
  border-bottom: none;
}

/* -- Mapping step -------------------------------------------------- */

.mapping-field {
  margin-bottom: 16px;
}

.mapping-field__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.mapping-field__label .req {
  color: #e53935;
}

.mapping-field__select {
  width: 100%;
  max-width: 360px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--text-dark);
  background: #fff;
}

.mapping-field__select:focus {
  outline: none;
  border-color: var(--accent);
}

.mapping-field__hint {
  margin: 4px 0 0;
  font-size: 11px;
  color: var(--text-muted);
}

.mapping-section {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}

.mapping-section__header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: #f8f9fa;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.mapping-section__header::marker,
.mapping-section__header::-webkit-details-marker {
  display: none;
}

.mapping-section__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.mapping-section__body {
  padding: 16px;
}

.checkbox-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  max-height: 200px;
  overflow-y: auto;
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.multi-column-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 13px;
}

.multi-column-row__name {
  min-width: 140px;
  color: var(--text-dark);
}

.multi-column-row__perspective {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 140px;
}

/* -- Rename step --------------------------------------------------- */

.rename-section {
  margin-bottom: 24px;
}

.rename-section__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.rename-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.rename-row__original {
  min-width: 160px;
  font-size: 13px;
  color: var(--text-dark);
  font-family: monospace;
}

.rename-row__arrow {
  color: var(--text-muted);
}

.rename-row__input {
  flex: 1;
  max-width: 240px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: monospace;
}

.rename-row__input:focus {
  outline: none;
  border-color: var(--accent);
}

/* -- Transform step ------------------------------------------------ */

.transform-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 40px;
  color: var(--text-muted);
}

.transform-results {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.download-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition:
    border-color 0.15s,
    background 0.15s;
  color: var(--text-dark);
}

.download-link:hover {
  border-color: var(--accent);
  background: rgba(0, 188, 212, 0.05);
}

.download-link .icon {
  width: 20px;
  height: 20px;
  color: var(--accent);
  flex-shrink: 0;
}

.download-link__count {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 400;
}

.transform-error {
  color: #721c24;
  background: #f8d7da;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 16px;
}

/* -- Spinners ------------------------------------------------------ */

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid rgba(0, 188, 212, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.spinner--large {
  width: 48px;
  height: 48px;
  border-width: 4px;
}

.spinner--inline {
  width: 14px;
  height: 14px;
  border-width: 2px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* -- Developer Portal -------------------------------------------------------- */

.developer-portal {
  padding: calc(2.4vh / 1.08) calc(2.4vw / 1.92);
  max-width: calc(120vw / 1.92);
  display: flex;
  flex-direction: column;
  gap: calc(2.4vh / 1.08);
}

.developer-portal__title {
  margin: 0;
  font-size: calc(2.4vh / 1.08);
  font-weight: 500;
  color: var(--text-primary);
}

.developer-portal__subtitle {
  margin: 0;
  font-size: calc(1.4vh / 1.08);
  color: var(--text-secondary);
}

.developer-portal__form {
  display: flex;
  flex-direction: column;
  gap: calc(1.2vh / 1.08);
  max-width: calc(60vw / 1.92);
}

.developer-portal__url-input {
  width: 100%;
  padding: calc(1vh / 1.08) calc(1.2vw / 1.92);
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: calc(0.4vh / 1.08);
  font-size: calc(1.4vh / 1.08);
  color: var(--text-primary);
  background: var(--card-bg, #fff);
  outline: none;
  box-sizing: border-box;
}

.developer-portal__url-input:focus {
  border-color: var(--color-primary, #5b6bf5);
  box-shadow: 0 0 0 2px rgba(91, 107, 245, 0.15);
}

.developer-portal__actions {
  display: flex;
  gap: calc(1.2vw / 1.92);
  flex-wrap: wrap;
}

.developer-portal__error {
  display: flex;
  align-items: center;
  gap: calc(1.2vw / 1.92);
  padding: calc(1.6vh / 1.08) calc(1.6vw / 1.92);
  background: #ffebee;
  border-radius: calc(0.4vh / 1.08);
  color: #c62828;
}

.developer-portal__error svg {
  width: calc(2.4vh / 1.08);
  height: calc(2.4vh / 1.08);
  flex-shrink: 0;
}

.developer-portal__error span {
  font-size: calc(1.4vh / 1.08);
}

.developer-portal__loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: calc(1.6vh / 1.08);
  padding: calc(4.8vh / 1.08) calc(2.4vw / 1.92);
  background: rgba(0, 0, 0, 0.03);
  border-radius: calc(0.8vh / 1.08);
  color: var(--text-secondary);
  font-size: calc(1.4vh / 1.08);
}

.developer-portal__loading p {
  margin: 0;
}

.developer-portal__viewer {
  display: flex;
  align-items: flex-start;
}

.developer-portal__image {
  max-width: 100%;
  height: auto;
  border-radius: calc(0.4vh / 1.08);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: zoom-in;
  transition: transform 0.15s ease;
}

.developer-portal__image:hover {
  transform: scale(1.01);
}

.developer-portal__fullscreen {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(2vw / 1.92);
  cursor: zoom-out;
}

.developer-portal__fullscreen-img {
  max-width: calc(100% - 4vw);
  max-height: calc(100% - 4vh);
  object-fit: contain;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
  cursor: zoom-out;
  border-radius: calc(0.4vh / 1.08);
}

/* -- New Collage wizard ---------------------------------------------- */

.conn-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  max-height: 380px;
  overflow-y: auto;
  padding-right: 4px;
}

.conn-picker__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
  background: #fff;
}

.conn-picker__item:hover {
  border-color: var(--accent);
  background: #f7fffe;
}

.conn-picker__item--selected {
  border-color: var(--accent);
  background: #edfaf8;
}

.conn-picker__check {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.conn-picker__item--selected .conn-picker__check {
  background: var(--accent);
}

.conn-picker__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.conn-picker__name {
  font-size: calc(14vw / 19.2);
  font-weight: 600;
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conn-picker__meta {
  font-size: calc(12vw / 19.2);
  color: var(--text-muted);
}

.conn-optional {
  font-size: 0.75em;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 6px;
}

.collage-combine-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 700px;
}

.collage-combine-selects {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .collage-combine-selects {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .collage-combine-selects {
    grid-template-columns: 1fr;
  }
}

.form-group__hint {
  font-size: calc(11vw / 19.2);
  color: var(--text-muted);
  margin: 0 0 6px 0;
  line-height: 1.4;
}

.collage-combine-item-note {
  padding: 10px 14px;
  background: #edfaf8;
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: calc(13vw / 19.2);
  color: var(--text-dark);
  margin-bottom: 24px;
}

/* -- Default View carousel --------------------------------------------------- */

.combine-carousel {
  margin-bottom: 24px;
}

.combine-carousel__label {
  font-size: calc(11vw / 19.2);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 0 0 4px 0;
}

.combine-carousel__name {
  font-size: calc(14vw / 19.2);
  font-weight: 600;
  color: var(--text-dark);
  margin: 0 0 12px 0;
}

.combine-carousel__row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.combine-carousel__btn {
  background: var(--bg-surface, #f5f5f5);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: calc(40vw / 19.2);
  height: calc(40vw / 19.2);
  font-size: calc(22vw / 19.2);
  cursor: pointer;
  color: var(--text-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.combine-carousel__btn:hover:not(:disabled) {
  background: #edfaf8;
  border-color: var(--accent);
}

.combine-carousel__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.combine-carousel__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.combine-carousel__img {
  width: calc(200vw / 19.2);
  height: calc(200vw / 19.2);
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #f0f0f0;
}

.combine-carousel__view-name {
  font-size: calc(13vw / 19.2);
  font-weight: 500;
  color: var(--text-dark);
}

.combine-carousel__counter {
  font-size: calc(11vw / 19.2);
  color: var(--text-muted);
}

.combine-no-views {
  font-size: calc(13vw / 19.2);
  color: var(--text-muted);
  margin-bottom: 24px;
}

.conn-preview-meta {
  font-size: calc(11vw / 19.2);
  color: var(--text-muted);
  margin: 0 0 8px 0;
}

/* -- Image manifest preview grid ------------------------------------------- */

.img-manifest-grid {
  overflow: auto;
  max-height: 350px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 24px;
}

.img-manifest-table {
  border-collapse: collapse;
  width: max-content;
  min-width: 100%;
}

.img-manifest-th {
  position: sticky;
  top: 0;
  background: var(--bg-surface, #f5f5f5);
  z-index: 1;
  padding: 8px 12px;
  font-size: calc(12vw / 19.2);
  font-weight: 600;
  color: var(--text-dark);
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid var(--border);
}

.img-manifest-th--thumb {
  width: calc(60vw / 19.2);
  min-width: calc(60vw / 19.2);
  text-align: center;
}

.img-manifest-td {
  padding: 6px 12px;
  font-size: calc(12vw / 19.2);
  color: var(--text-dark);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  max-width: calc(180vw / 19.2);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
}

.img-manifest-td--thumb {
  width: calc(60vw / 19.2);
  min-width: calc(60vw / 19.2);
  text-align: center;
  padding: 4px 8px;
}

.img-manifest-table tbody tr:hover {
  background: var(--bg-hover, #f9f9f9);
}

.img-thumb {
  display: block;
  margin: 0 auto;
  width: calc(40vw / 19.2);
  height: calc(40vw / 19.2);
  object-fit: contain;
  border-radius: 3px;
  background: #f0f0f0;
}

/* -- Model card body ---------------------------------------------- */
.model-card__content {
  display: flex;
  flex: 1;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

.model-card__summary {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding-top: calc(10vh / 10.8);
  padding-left: calc(10vh / 10.8);
  padding-right: calc(10vh / 10.8);
}

.model-card__created {
  margin-bottom: calc(8vh / 10.8);
  font-size: calc(12vh / 10.8);
  font-weight: 400;
  line-height: calc(15vh / 10.8);
  color: rgba(51, 50, 61, 0.78);
}

.model-card__chips {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px;
  max-width: 100%;
  margin-bottom: calc(12vh / 10.8);
}

.model-card__chips .model-report-chip {
  display: inline-flex;
  align-self: flex-start;
  max-width: 100%;
  padding: 4px 12px;
  font-size: calc(12vh / 10.8);
  line-height: calc(16vh / 10.8);
  white-space: nowrap;
  border-radius: 999px;
}

.model-card__stats {
  display: flex;
  flex-direction: column;
  gap: calc(12vh / 10.8);
}

.model-card__stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.model-card__stat-label {
  font-size: calc(11vh / 10.8);
  font-weight: 400;
  line-height: calc(14vh / 10.8);
  color: rgba(51, 50, 61, 0.62);
}

.model-card__stat-value {
  font-size: calc(14vh / 10.8);
  font-weight: 600;
  line-height: calc(18vh / 10.8);
  color: #33323d;
}

.model-card__hint {
  margin-top: calc(12vh / 10.8);
  font-size: calc(11vh / 10.8);
  font-weight: 400;
  line-height: calc(15vh / 10.8);
  color: rgba(51, 50, 61, 0.58);
}

.model-card__state {
  font-size: calc(12vh / 10.8);
  font-weight: 400;
  line-height: calc(16vh / 10.8);
  color: rgba(51, 50, 61, 0.65);
}

.model-card__state--error {
  color: rgba(200, 0, 0, 0.75);
}

/* -- Model report modal ------------------------------------------- */
.model-report-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: var(--radius-modal);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  z-index: 201;
  width: min(760px, 92vw);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  font-size: 14px;
  overflow: hidden;
}

.model-report-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

.model-report-modal__title-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.model-report-modal__title {
  font-size: 20px;
  font-weight: 700;
  color: rgba(0, 0, 0, 0.82);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 52vw;
}

.model-report-modal__subtitle {
  font-size: 13px;
  color: rgba(0, 0, 0, 0.62);
}

.model-report-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 2px;
  flex-shrink: 0;
}

.model-report-chip {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.06);
  color: rgba(0, 0, 0, 0.75);
  white-space: nowrap;
}

.model-report-chip--ok {
  background: rgba(0, 140, 60, 0.12);
  color: rgba(0, 110, 50, 1);
}

.model-report-chip--error {
  background: rgba(244, 67, 54, 0.12);
  color: rgba(170, 0, 0, 1);
}

.model-report-chip--neutral {
  background: rgba(25, 118, 210, 0.1);
  color: rgba(20, 70, 150, 1);
}

.model-report-modal__content {
  padding: 14px 20px 20px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  box-sizing: border-box;
}

.model-report-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 20px 16px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  flex-shrink: 0;
}

/* Loading / error states */
.model-report-loading,
.model-report-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px 0;
  text-align: center;
}

.model-report-loading__text,
.model-report-error__text {
  color: rgba(0, 0, 0, 0.65);
}

.model-report-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-top-color: rgba(25, 118, 210, 0.8);
  border-radius: 50%;
  animation: model-report-spin 0.7s linear infinite;
}

@keyframes model-report-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Summary section */
.model-report-section {
  margin-top: 14px;
  width: 100%;
  box-sizing: border-box;
}

.model-report-section:first-child {
  margin-top: 0;
}

.model-report-section__title {
  margin: 6px 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: rgba(0, 0, 0, 0.7);
  text-transform: uppercase;
}

.model-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: start;
  width: 100%;
}

@media (max-width: 520px) {
  .model-report-grid {
    grid-template-columns: 1fr;
  }
}

.model-report-kv {
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.02);
  min-width: 0;
}

.model-report-kv__k {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.62);
}

.model-report-kv__v {
  font-size: 16px;
  font-weight: 800;
  color: rgba(0, 0, 0, 0.82);
  margin-top: 2px;
}

.model-report-kv__hint {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.55);
  margin-top: 4px;
  line-height: 1.35;
}

/* Technical details collapsible */
.model-report-details {
  margin-top: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 12px;
  overflow: hidden;
}

.model-report-details__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 12px;
  cursor: pointer;
  font-weight: 500;
  font-size: 14px;
  color: rgba(0, 0, 0, 0.82);
  user-select: none;
  list-style: none;
}

.model-report-details__summary::-webkit-details-marker {
  display: none;
}

.model-report-details__summary::before {
  content: "▶";
  font-size: 10px;
  color: rgba(0, 0, 0, 0.4);
  transition: transform 0.2s;
}

.model-report-details[open] > .model-report-details__summary::before {
  transform: rotate(90deg);
}

.model-report-details__hint {
  font-size: 12px;
  color: rgba(0, 0, 0, 0.45);
  font-weight: 400;
}

.model-report-raw {
  white-space: pre-wrap;
  font-family:
    ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Courier New",
    monospace;
  font-size: 12px;
  line-height: 1.45;
  padding: 12px;
  background: rgba(0, 0, 0, 0.03);
  border-radius: 0 0 12px 12px;
  margin: 0;
  overflow: auto;
}

.model-report-muted {
  padding: 0 12px 12px;
  font-size: 13px;
  color: rgba(0, 0, 0, 0.5);
}
