/* extracted from the previous inline styles */
:root {
  color-scheme: light;
  --bg: #f8fafc;
  --bg-dark: #0f172a;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-border: rgba(148, 163, 184, 0.22);
  --text: #0f172a;
  --muted: #475569;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.1);
  --danger: #b91c1c;
  --success: #166534;
  --shadow: 0 22px 70px rgba(15, 23, 42, 0.12);
  --shadow-strong: 0 24px 80px rgba(15, 23, 42, 0.24);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(20, 184, 166, 0.12), transparent 28%),
    radial-gradient(circle at right top, rgba(59, 130, 246, 0.1), transparent 24%),
    linear-gradient(180deg, #ffffff, var(--bg));
}

.auth-body {
  color: #e2e8f0;
  background:
    radial-gradient(circle at top left, rgba(45, 212, 191, 0.18), transparent 30%),
    radial-gradient(circle at right center, rgba(59, 130, 246, 0.18), transparent 32%),
    linear-gradient(135deg, var(--bg-dark), #111c36);
}

.shell {
  min-height: 10vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.preview-body {
  color: var(--text);
  background: #0f172a;
}

.preview-shell {
  min-height: 100vh;
  padding: 20px;
}

.preview-card {
  min-height: calc(100vh - 40px);
  background: #f8fafc;
  border-radius: 28px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  padding: 24px;
  display: grid;
  gap: 18px;
  box-shadow: var(--shadow);
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}

.preview-header h1 {
  max-width: none;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  color: var(--text);
}

.preview-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.preview-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.preview-frame-wrap {
  min-height: 0;
  display: grid;
}

.preview-frame,
.preview-image {
  width: 100%;
  min-height: 68vh;
  border: 0;
  border-radius: 22px;
  background: white;
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.16);
}

.preview-image {
  object-fit: contain;
}

.cad-viewer {
  display: grid;
  position: relative;
  width: 100%;
  min-height: 68vh;
  border-radius: 22px;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 26%),
    linear-gradient(180deg, #f8fafc, #e2e8f0);
  box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.16);
}

.cad-canvas {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  display: block;
}

.cad-overlay {
  grid-area: 1 / 1;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 28%);
}

.cad-overlay-top,
.cad-overlay-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
  justify-content: space-between;
}

.cad-chip {
  margin: 0;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.cad-status {
  margin: 0;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.cad-help {
  margin: 0;
  padding: 9px 13px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.08);
  color: var(--text);
  font-size: 0.92rem;
}

.cad-overlay .button {
  pointer-events: auto;
}

.cad-viewer.cad-viewer-error {
  background:
    radial-gradient(circle at top left, rgba(220, 38, 38, 0.14), transparent 26%),
    linear-gradient(180deg, #f8fafc, #fee2e2);
}

.cad-viewer.cad-viewer-error .cad-status {
  background: rgba(255, 255, 255, 0.96);
  color: var(--danger);
}

.hero {
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 28px;
  align-items: start;
}

.auth-hero {
  width: min(560px, 100%);
  grid-template-columns: 1fr;
  justify-items: stretch;
}

.intro {
  padding: 32px;
  background: rgba(15, 23, 42, 0.26);
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(14px);
}

.auth-hero .intro {
  display: grid;
  justify-items: center;
  text-align: center;
  gap: 18px;
  padding: 38px 30px 30px;
}

.auth-logo {
  width: min(180px, 42vw);
  height: auto;
  border-radius: 30px;
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
}

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

.brand-mark img {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.brand-mark div {
  display: grid;
  gap: 4px;
}

.brand-mark .eyebrow {
  margin-bottom: 0;
}

.brand-mark strong {
  color: #fff;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(226, 232, 240, 0.72);
  font-size: 0.78rem;
}

h1 { margin: 0; font-size: clamp(2.6rem, 4vw, 4.8rem); line-height: 0.98; max-width: 10ch; }
.lede { max-width: 58ch; line-height: 1.65; margin: 18px 0 0; color: inherit; opacity: 0.92; }
.feature-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 28px; }
.feature, .card, .panel, .stat, .empty { border-radius: 20px; }
.feature { padding: 16px; background: rgba(255, 255, 255, 0.08); border: 1px solid rgba(226, 232, 240, 0.12); }
.feature strong { display: block; margin-bottom: 6px; color: #fff; }
.feature span { color: rgba(226, 232, 240, 0.78); line-height: 1.55; font-size: 0.95rem; }
.card, .panel { padding: 28px; border-radius: 28px; background: var(--panel); color: var(--text); border: 1px solid var(--panel-border); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.tabs { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.tabs a, .pill, .button, .ghost, .dialog-breadcrumbs button, .folder-item button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; font: inherit; cursor: pointer; border: 1px solid transparent; }
.tabs a { min-width: 120px; padding: 11px 16px; border-radius: 999px; border-color: rgba(15, 23, 42, 0.12); color: var(--muted); background: rgba(255, 255, 255, 0.8); }
.tabs a.active { color: white; border-color: var(--accent); background: linear-gradient(135deg, var(--accent), #14b8a6); }
.auth-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; justify-content: center;}
.auth-actions .button.secondary.active {
  color: white;
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  border-color: transparent;
}
.notice { padding: 14px 16px; border-radius: 16px; margin: 0 0 18px; line-height: 1.55; }
.notice.error { background: rgba(220, 38, 38, 0.09); color: var(--danger); border: 1px solid rgba(220, 38, 38, 0.18); }
.notice.info, .notice.success { background: rgba(15, 118, 110, 0.1); color: var(--accent); border: 1px solid rgba(15, 118, 110, 0.16); }
form { display: grid; gap: 14px; }
label { display: grid; gap: 8px; color: var(--muted); font-size: 0.95rem; }
input[type="text"], input[type="password"], input[type="file"], select { width: 100%; padding: 14px 15px; border-radius: 16px; border: 1px solid rgba(148, 163, 184, 0.35); background: rgba(248, 250, 252, 0.95); color: var(--text); font: inherit; }
button { border-radius: 16px; padding: 14px 18px; font-weight: 700; }
.hint { margin: 0; color: var(--muted); line-height: 1.55; font-size: 0.95rem; }
.page { width: min(1280px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 42px; }
header { display: flex; justify-content: space-between; gap: 18px; align-items: center; padding: 20px 24px; margin-bottom: 22px; border-radius: 28px; background: rgba(255, 255, 255, 0.8); border: 1px solid var(--panel-border); box-shadow: var(--shadow); backdrop-filter: blur(12px); }
.brand { display: grid; gap: 6px; }
.brand small { color: var(--muted); text-transform: uppercase; letter-spacing: 0.14em; }
.brand strong { font-size: 1.25rem; }
.brand-mark-inline { margin-bottom: 0; }
.brand-mark-inline img { width: 32px; height: 32px; border-radius: 10px; }
.brand-mark-inline .eyebrow { margin-bottom: 2px; }
.header-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.pill, .button, .ghost, .dialog-breadcrumbs button, .folder-item button { border-radius: 999px; padding: 11px 16px; }
.pill, .button { color: white; background: linear-gradient(135deg, var(--accent), #14b8a6); border-color: transparent; box-shadow: 0 12px 24px rgba(15, 118, 110, 0.25); }
.button.secondary, .ghost, .dialog-breadcrumbs button, .folder-item button { color: var(--text); background: white; border-color: rgba(148, 163, 184, 0.28); box-shadow: none; }
.button.danger { color: white; background: linear-gradient(135deg, #b91c1c, #ef4444); box-shadow: none; }
.grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 18px; margin-bottom: 18px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.maintenance-form { margin-top: 18px; display: grid; gap: 14px; }
.stat { padding: 16px; background: #fff; border: 1px solid rgba(148, 163, 184, 0.18); }
.stat span { display: block; color: var(--muted); font-size: 0.9rem; margin-bottom: 8px; }
.stat strong { font-size: 1.6rem; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.full { grid-column: 1 / -1; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.upload-dropzone {
  display: grid;
  gap: 8px;
  padding: 24px;
  border-radius: 24px;
  border: 1.5px dashed rgba(15, 118, 110, 0.28);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.06), rgba(255, 255, 255, 0.92)),
    #fff;
  color: var(--text);
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.upload-dropzone:hover {
  border-color: rgba(15, 118, 110, 0.45);
  transform: translateY(-1px);
}
.upload-dropzone.is-dragover {
  border-color: var(--accent);
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.12), rgba(255, 255, 255, 0.98)),
    #fff;
  box-shadow: 0 18px 36px rgba(15, 118, 110, 0.12);
}
.upload-dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}
.upload-dropzone-kicker {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.78rem;
  font-weight: 700;
}
.upload-dropzone strong {
  font-size: 1.1rem;
  line-height: 1.3;
}
.upload-dropzone-copy,
.upload-dropzone-selected {
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.5;
}
.upload-dropzone-selected {
  margin: 0;
}
.upload-meter { display: grid; gap: 10px; }
.upload-meter progress { width: 100%; height: 16px; border: 0; border-radius: 999px; overflow: hidden; background: rgba(148, 163, 184, 0.18); }
.upload-meter progress::-webkit-progress-bar { background: rgba(148, 163, 184, 0.18); border-radius: 999px; }
.upload-meter progress::-webkit-progress-value { background: linear-gradient(135deg, var(--accent), #14b8a6); border-radius: 999px; }
.upload-meter progress::-moz-progress-bar { background: linear-gradient(135deg, var(--accent), #14b8a6); border-radius: 999px; }
.upload-status { margin: 0; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1080px; }
thead th { text-align: left; font-size: 0.82rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 14px 10px; border-bottom: 1px solid rgba(148, 163, 184, 0.2); }
tbody td { padding: 16px 10px; border-bottom: 1px solid rgba(148, 163, 184, 0.12); vertical-align: middle; }
tbody tr:hover { background: rgba(15, 118, 110, 0.04); }
.type-tag { display: inline-flex; align-items: center; padding: 6px 10px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; background: var(--accent-soft); color: var(--accent); }
.row-name { font-weight: 700; color: var(--text); text-decoration: none; }
.row-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 0.92rem; }
.row-sub small { display: block; margin-top: 2px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; min-width: 260px; }
.media-dialog { border: 0; padding: 0; max-width: min(760px, calc(100vw - 28px)); width: 100%; border-radius: 28px; box-shadow: 0 30px 80px rgba(15, 23, 42, 0.28); background: transparent; }
.media-dialog::backdrop { background: rgba(15, 23, 42, 0.58); backdrop-filter: blur(4px); }
.dialog-card { background: #fff; border-radius: 28px; border: 1px solid rgba(148, 163, 184, 0.2); padding: 22px; display: grid; gap: 18px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.dialog-title { margin: 0; font-size: 1.5rem; line-height: 1.1; }
.dialog-muted { margin: 0; color: var(--muted); line-height: 1.6; }
.dialog-close { width: 42px; height: 42px; border-radius: 999px; border: 1px solid rgba(148, 163, 184, 0.3); background: #fff; color: var(--muted); cursor: pointer; font-size: 1.2rem; line-height: 1; box-shadow: none; }
.dialog-toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.dialog-path { padding: 12px 14px; border-radius: 16px; background: rgba(15, 118, 110, 0.06); color: var(--accent); font-weight: 700; }
.dialog-breadcrumbs { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.dialog-breadcrumbs .separator { color: var(--muted); }
.dialog-folder-list { display: grid; gap: 10px; max-height: 320px; overflow: auto; padding-right: 4px; }
.folder-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; border: 1px solid rgba(148, 163, 184, 0.18); background: #fff; }
.folder-item strong { display: block; }
.folder-item span { display: block; color: var(--muted); font-size: 0.92rem; margin-top: 4px; }
.dialog-empty, .empty { padding: 14px 16px; border-radius: 16px; background: rgba(148, 163, 184, 0.08); color: var(--muted); }
.dialog-grid { display: grid; gap: 14px; }
.dialog-grid label { color: var(--muted); gap: 8px; }
.dialog-grid input[type="text"] { padding: 12px 14px; border-radius: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.hidden { display: none !important; }
@media (max-width: 980px) {
  .hero, .grid, .stats, .form-grid { grid-template-columns: 1fr; }
  header { flex-direction: column; align-items: flex-start; }
}
