:root {
  --bg: #0f1827;
  --bg-alt: #1a2a3f;
  --panel: #111f34;
  --text: #eef4ff;
  --muted: #b7c5df;
  --line: #2c3f5e;
  --accent: #1e9ad6;
  --accent-strong: #1986ba;
  --danger: #ff6f7a;
  --ok: #78d9a1;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 5% 0%, #2a3f5e, var(--bg) 48%);
}

body[data-page="home"] {
  color: #111827;
  background: #f6f8fb;
}

a {
  color: inherit;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 10px;
  z-index: 100;
  background: #0f172a;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  background: rgba(15, 24, 39, 0.9);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-size: 21px;
  font-weight: 500;
}

.platform-tag {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.7;
  letter-spacing: 0.04em;
}

.brand img {
  width: 156px;
  height: auto;
  object-fit: contain;
  border-radius: 0;
  border: none;
}

nav {
  display: flex;
  gap: 18px;
}

nav a {
  text-decoration: none;
  color: var(--muted);
  font-size: 14px;
}

nav a:hover {
  color: var(--text);
}

.market-label {
  font-size: 12px;
  color: var(--muted);
  margin-right: 4px;
  vertical-align: middle;
}

.market-select {
  width: auto;
  min-width: 120px;
  padding: 6px 10px;
  font-size: 13px;
  margin-right: 12px;
}

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 18px 64px;
}

body[data-page="home"] .layout {
  max-width: 1240px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(17, 31, 52, 0.75);
  overflow: hidden;
}

body[data-page="home"] .panel {
  border: 1px solid #d8e1ed;
  background: #ffffff;
  box-shadow: 0 10px 26px rgba(20, 33, 54, 0.08);
}

body[data-page="home"] .site-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid #e4e9f1;
}

body[data-page="home"] nav a {
  color: #243041;
  font-weight: 500;
}

body[data-page="home"] nav a:hover {
  color: #0b1c33;
}

body[data-page="home"] .brand span {
  color: #0f172a;
}

.home-hero {
  position: relative;
  height: min(62vh, 620px);
}

.home-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-hero-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: end;
  gap: 10px;
  padding: clamp(22px, 4vw, 46px);
  background: linear-gradient(180deg, rgba(12, 24, 40, 0.04), rgba(6, 15, 29, 0.56));
  color: #ffffff;
}

.home-hero-overlay p {
  margin: 0;
  max-width: 760px;
  color: rgba(245, 249, 255, 0.92);
}

.home-hero-overlay h1 {
  margin: 0;
  max-width: 900px;
  font-size: clamp(34px, 4.4vw, 62px);
}

.hero-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.hero-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 14px;
}

.hero-copy {
  padding: 28px;
}

.kicker {
  margin: 0 0 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 12px;
}

body[data-page="home"] .hero-copy p,
body[data-page="home"] .hero-copy li,
body[data-page="home"] p,
body[data-page="home"] label,
body[data-page="home"] .hint {
  color: #4b5563;
}

body[data-page="home"] .brand span {
  letter-spacing: 0.01em;
}

h1 {
  margin: 0;
  font-size: clamp(32px, 4.2vw, 56px);
  line-height: 1.08;
  font-weight: 500;
}

h2 {
  margin: 0 0 14px;
  font-size: 27px;
  font-weight: 500;
}

body[data-page="home"] h2,
body[data-page="home"] h3,
body[data-page="home"] .mini-cards strong {
  color: #0f172a;
}

h3 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 500;
}

p {
  color: var(--muted);
  line-height: 1.65;
}

.bullets {
  margin: 20px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.hero-media {
  display: grid;
  grid-template-rows: 58% 42%;
  min-height: 420px;
}

.hero-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.split-grid {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.login-panel,
.ai-panel {
  padding: 24px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

label {
  font-size: 13px;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid #385176;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  color: var(--text);
  background: #0f1a2d;
}

body[data-page="home"] input {
  border: 1px solid #cad6e4;
  color: #0f172a;
  background: #ffffff;
}

select,
textarea {
  width: 100%;
  border: 1px solid #385176;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 15px;
  color: var(--text);
  background: #0f1a2d;
}

body[data-page="home"] select,
body[data-page="home"] textarea {
  border: 1px solid #cad6e4;
  color: #0f172a;
  background: #ffffff;
}

input:focus {
  outline: 2px solid rgba(30, 154, 214, 0.5);
  outline-offset: 1px;
}

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
  border: none;
  border-radius: 10px;
  padding: 11px 14px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.primary {
  background: var(--accent);
  color: #f5fcff;
}

.primary:hover {
  background: var(--accent-strong);
}

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

.light-ghost {
  color: #eef4ff;
  border-color: rgba(235, 244, 255, 0.6);
}

body[data-page="home"] .ghost {
  border: 1px solid #ced9e8;
  color: #0f172a;
}

.hint {
  margin-top: 12px;
  font-size: 13px;
}

.hint a {
  color: var(--accent);
}

.api-health {
  margin: 0 0 12px;
  font-size: 13px;
  color: #64748b;
}

.api-health.ok {
  color: #0f766e;
}

.api-health.error {
  color: #b91c1c;
}

.status {
  min-height: 20px;
  margin: 10px 0 0;
  font-size: 13px;
}

.order-submit-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.status.error {
  color: var(--danger);
}

.status.ok {
  color: var(--ok);
}

body[data-page="home"] .status.ok {
  color: #0f766e;
}

body[data-page="home"] .status.error {
  color: #b91c1c;
}

.mini-cards {
  display: grid;
  gap: 10px;
}

.mini-cards div {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: rgba(12, 24, 40, 0.7);
}

body[data-page="home"] .mini-cards div {
  border: 1px solid #dce4ef;
  background: #f9fbff;
}

.mini-cards p {
  margin: 8px 0 0;
  font-size: 14px;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.inline-btn {
  margin-top: 0;
  height: 43px;
  min-width: 72px;
  font-size: 13px;
}

.login-links {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.forgot-password-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.forgot-password-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.feature-banner {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
}

.feature-banner img {
  width: 100%;
  height: 270px;
  object-fit: cover;
}

.feature-banner div {
  padding: 28px;
}

.footer-note {
  margin-top: 14px;
  padding: 18px 22px;
}

.footer-note p {
  margin: 0;
  color: #485569;
  font-size: 14px;
}

/* ── Sidebar layout ──────────────────────────────────────── */

.app-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 57px);
}

.app-sidebar {
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px 16px;
  border-right: 1px solid var(--line);
  background: rgba(11, 18, 30, 0.92);
}

.sidebar-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.sidebar-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 600;
  text-transform: uppercase;
}

.sidebar-username {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  word-break: break-all;
}

.sidebar-email {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  word-break: break-all;
}

.sidebar-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.sidebar-role-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(30, 154, 214, 0.15);
  color: var(--accent);
  border: 1px solid rgba(30, 154, 214, 0.3);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 4px 0;
}

.sidebar-nav a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
  background: rgba(30, 60, 100, 0.35);
  color: var(--text);
}

.sidebar-nav a.active {
  background: rgba(30, 154, 214, 0.15);
  color: var(--accent);
  font-weight: 600;
}

.sidebar-account {
  padding: 10px 0;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar-section-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}

.sidebar-account-detail {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sidebar-account-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
}

.sidebar-account-row strong {
  color: var(--muted);
  font-weight: 500;
  flex-shrink: 0;
}

.sidebar-account-row span {
  color: var(--text);
  text-align: right;
  word-break: break-word;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.sidebar-logout {
  width: 100%;
  font-size: 13px;
  padding: 9px 12px;
}

/* ── End sidebar ─────────────────────────────────────────── */

.page-shell {
  min-height: calc(100vh - 57px);
  display: grid;
  place-items: center;
  padding: 26px;
}

.app-layout .page-shell,
.app-layout .content-shell {
  min-height: 0;
}

.auth-card,
.workspace-shell {
  width: min(920px, 100%);
}

.auth-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-copy {
  padding: 28px;
  border-right: 1px solid var(--line);
}

.auth-form {
  padding: 28px;
}

.workspace-shell {
  display: grid;
  gap: 14px;
}

.workspace-top,
.workspace-grid article {
  padding: 22px;
}

.workspace-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.workspace-grid h4 {
  margin: 0 0 10px;
  font-size: 18px;
}

.workspace-links-panel {
  grid-column: 1 / -1;
}

.workspace-links {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.workspace-links a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
  text-align: center;
  background: rgba(17, 31, 52, 0.35);
}

.workspace-links a:hover {
  border-color: #3b547b;
  background: rgba(17, 31, 52, 0.6);
}

.order-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  padding: 26px;
  min-height: calc(100vh - 72px);
}

.order-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 12px;
  align-items: stretch;
}

.order-nav-btn {
  display: block;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  padding: 10px 8px;
  font-size: 12px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

.order-nav-btn.is-active,
.order-nav-btn:hover {
  color: var(--text);
  border-color: #3b547b;
  background: rgba(17, 31, 52, 0.6);
}

.order-form {
  padding: 24px;
  display: grid;
  gap: 16px;
}

.order-form-header h2 {
  margin: 6px 0 0;
}

.order-primary-row {
  display: grid;
  grid-template-columns: minmax(220px, 280px) repeat(3, minmax(160px, 1fr));
  gap: 12px 14px;
  align-items: end;
}

.product-group-field select {
  max-width: 280px;
}

.order-var-inline {
  display: contents;
}

.order-var-grid,
.order-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 14px;
}

.order-option-grid .option-full-width {
  grid-column: 1 / -1;
}

.connection-detail-section {
  display: grid;
  gap: 10px;
}

.connection-detail-add-more {
  margin-top: 6px;
}

#connection-detail-add-more-btn {
  font-size: 14px;
  padding: 6px 18px;
}

.individual-zr-row,
.bridge-options-container {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(56, 81, 118, 0.3);
}

.bridge-options-container {
  flex-direction: column;
  align-items: flex-start;
}

.bridge-row-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}

.individual-zr-row .izr-group,
.bridge-options-container .izr-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.individual-zr-row .izr-group label,
.bridge-options-container .izr-group label {
  font-size: 13px;
  color: var(--muted);
}

.individual-zr-row .izr-group select,
.bridge-options-container .izr-group select {
  min-width: 90px;
}

.row-stl-cell {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.btn-row-stl {
  flex-shrink: 0;
  padding: 4px 12px;
  font-size: 13px;
  border: 1px solid #385176;
  border-radius: 6px;
  background: #0f1a2d;
  color: var(--accent);
  cursor: pointer;
  white-space: nowrap;
}

.btn-row-stl:hover {
  background: #1a2a45;
}

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

.row-stl-name {
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}

.row-stl-name.error {
  color: #e74c3c;
}

.one2one-inline-row {
  display: grid;
  grid-template-columns: 140px 120px minmax(160px, 1fr);
  gap: 12px 14px;
}

.one2one-inline-row .one2one-zirconia select {
  max-width: 140px;
}

.one2one-inline-row .one2one-color select {
  max-width: 90px;
}

.scan-service-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px 14px;
}

.connection-detail-header {
  display: grid;
  gap: 10px;
  margin-bottom: 6px;
  padding: 0 2px;
}

.connection-detail-header span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}

.connection-detail-row {
  display: grid;
  gap: 10px;
  align-items: center;
}

.connection-detail-row select,
.connection-detail-row .tooth-position-input {
  width: 100%;
  height: 42px;
  border: 1px solid #385176;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  background: #0f1a2d;
  -webkit-appearance: none;
  appearance: none;
  box-sizing: border-box;
  margin: 0;
  line-height: 40px;
}

.connection-detail-row .tooth-position-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.arc-screwdriver-prompt {
  margin-top: 6px;
}

.arc-screwdriver-prompt .warning {
  color: var(--danger);
}

.order-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

.order-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.upload-status {
  font-size: 12px;
  color: var(--muted);
  min-height: 16px;
}

.upload-progress {
  height: 8px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-top: 6px;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s ease;
}

.order-preview {
  padding: 20px;
  display: grid;
  gap: 12px;
  position: sticky;
  top: 80px;
  align-self: start;
}

.order-preview h3 {
  display: none;
}

.preview-pane {
  display: grid;
  gap: 12px;
}

.preview-image,
.preview-stl {
  border-radius: 12px;
  padding: 0;
  min-height: 180px;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.preview-image img {
  max-width: 100%;
  max-height: 280px;
  object-fit: contain;
}

.preview-stl {
  place-items: stretch;
  align-content: start;
  gap: 8px;
}

.stl-preview-canvas {
  width: 100%;
  height: 260px;
}

.stl-preview-status {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  min-height: 16px;
}

.stl-preview-status.error {
  color: var(--danger);
}

.account-shell {
  display: grid;
  grid-template-columns: 90px minmax(0, 720px);
  gap: 16px;
  padding: 26px;
  min-height: calc(100vh - 72px);
  justify-content: start;
}

.content-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  padding: 26px;
  min-height: calc(100vh - 72px);
}

.orders-shell {
  width: min(1320px, 96vw);
}

.orders-list {
  width: 100%;
  min-width: 0;
}

.orders-layout {
  grid-template-columns: 90px minmax(0, 1fr);
}

.account-form {
  padding: 28px;
  display: grid;
  gap: 20px;
}

.user-management-shell {
  width: min(1120px, 100%);
}

.user-management-panel {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.user-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.user-tab-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 999px;
  padding: 10px 16px;
  cursor: pointer;
  font-weight: 600;
}

.user-tab-btn.is-active {
  background: rgba(30, 154, 214, 0.18);
  border-color: rgba(30, 154, 214, 0.45);
  color: #eef7ff;
}

.user-tab-panel {
  display: grid;
  gap: 16px;
}

.user-table-wrap {
  overflow-x: auto;
}

.detail-modal[hidden] {
  display: none;
}

.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
}

.detail-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 10, 23, 0.72);
}

.detail-modal-dialog {
  position: relative;
  width: min(1320px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  padding: 22px;
  overflow: auto;
}

.detail-modal-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.stl-modal[hidden] { display: none; }
.stl-modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
}
.stl-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 10, 23, 0.78);
}
.stl-modal-dialog {
  position: relative;
  width: min(720px, calc(100vw - 40px));
  max-height: calc(100vh - 48px);
  margin: 24px auto;
  padding: 22px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.stl-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.stl-modal-header h3 { margin: 0; }
.stl-modal-canvas {
  width: 100%;
  height: 480px;
  border-radius: 8px;
  background: #0f1827;
}
.stl-modal .stl-preview-status {
  text-align: center;
  margin-top: 8px;
}

.user-table {
  width: 100%;
  border-collapse: collapse;
}

.user-table th,
.user-table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.user-table th {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

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

.user-role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px 14px;
}

.user-role-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
}

.user-role-option input {
  width: auto;
  margin: 0;
}

.account-form-header h2 {
  margin: 6px 0 0;
}

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

.account-section legend {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  padding: 0 6px;
}

.account-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.account-row .phone-code {
  max-width: 100px;
}

.account-row .phone-number {
  flex: 1;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.account-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

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

  .order-preview {
    grid-column: 1 / -1;
  }

  .account-shell {
    grid-template-columns: 80px minmax(0, 1fr);
  }
}

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

  .app-sidebar {
    display: none;
  }

  .order-primary-row {
    grid-template-columns: 1fr;
  }

  .account-row {
    grid-template-columns: 1fr;
  }

  nav {
    display: none;
  }

  .hero-grid,
  .home-hero,
  .split-grid,
  .feature-banner,
  .auth-card,
  .workspace-grid,
  .order-shell,
  .account-shell,
  .content-shell {
    grid-template-columns: 1fr;
  }

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

  .home-hero {
    height: 420px;
  }

  .brand span {
    display: none;
  }

  .hero-media {
    min-height: 320px;
  }

  .auth-copy {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
}

/* ── Light theme for all pages except home ──────────────── */

body:not([data-page="home"]) {
  --bg: #f6f8fb;
  --bg-alt: #edf1f7;
  --panel: #ffffff;
  --text: #0f172a;
  --muted: #5b6a82;
  --line: #d8e1ed;
  --accent: #1e7bb8;
  --accent-strong: #1a6da3;
  --danger: #dc3545;
  --ok: #0f766e;
  color: #0f172a;
  background: #f6f8fb;
}

body:not([data-page="home"]) .site-header {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid #e4e9f1;
}

body:not([data-page="home"]) .brand span {
  color: #0f172a;
}

body:not([data-page="home"]) .platform-tag {
  color: #5b6a82;
}

body:not([data-page="home"]) nav a {
  color: #3b4a60;
}

body:not([data-page="home"]) nav a:hover {
  color: #0f172a;
}

body:not([data-page="home"]) .panel {
  border: 1px solid #d8e1ed;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

body:not([data-page="home"]) input {
  border: 1px solid #cbd5e1;
  color: #0f172a;
  background: #ffffff;
}

body:not([data-page="home"]) select,
body:not([data-page="home"]) textarea {
  border: 1px solid #cbd5e1;
  color: #0f172a;
  background: #ffffff;
}

body:not([data-page="home"]) .market-select {
  border: 1px solid #cbd5e1;
  color: #0f172a;
  background: #ffffff;
}

body:not([data-page="home"]) .ghost {
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

body:not([data-page="home"]) .app-sidebar {
  background: #ffffff;
  border-right: 1px solid #e4e9f1;
}

body:not([data-page="home"]) .sidebar-nav a:hover {
  background: rgba(30, 123, 184, 0.08);
  color: #0f172a;
}

body:not([data-page="home"]) .sidebar-nav a.active {
  background: rgba(30, 123, 184, 0.1);
  color: var(--accent);
}

body:not([data-page="home"]) .sidebar-role-badge {
  background: rgba(30, 123, 184, 0.1);
  border: 1px solid rgba(30, 123, 184, 0.25);
}

body:not([data-page="home"]) .workspace-links a {
  border: 1px solid #d8e1ed;
  color: #0f172a;
  background: #f9fbff;
}

body:not([data-page="home"]) .workspace-links a:hover {
  border-color: #b8c5d8;
  background: #edf1f7;
}

body:not([data-page="home"]) .user-tab-btn {
  border: 1px solid #cbd5e1;
  color: #0f172a;
}

body:not([data-page="home"]) .user-tab-btn.is-active {
  background: rgba(30, 123, 184, 0.1);
  border-color: rgba(30, 123, 184, 0.4);
  color: var(--accent);
}

body:not([data-page="home"]) .account-section {
  border: 1px solid #d8e1ed;
}

body:not([data-page="home"]) .account-section legend {
  color: #0f172a;
}

body:not([data-page="home"]) .mini-cards div {
  border: 1px solid #d8e1ed;
  background: #f9fbff;
}

body:not([data-page="home"]) .order-nav-btn {
  border: 1px solid #cbd5e1;
  color: #5b6a82;
}

body:not([data-page="home"]) .order-nav-btn.is-active,
body:not([data-page="home"]) .order-nav-btn:hover {
  color: #0f172a;
  border-color: #b8c5d8;
  background: #edf1f7;
}

body:not([data-page="home"]) .btn-row-stl {
  border: 1px solid #cbd5e1;
  background: #f9fbff;
  color: var(--accent);
}

body:not([data-page="home"]) .btn-row-stl:hover {
  background: #edf1f7;
}

body:not([data-page="home"]) .connection-detail-row select,
body:not([data-page="home"]) .connection-detail-row .tooth-position-input {
  border: 1px solid #cbd5e1;
  color: #0f172a;
  background: #ffffff;
}

body:not([data-page="home"]) .detail-modal-backdrop {
  background: rgba(15, 23, 42, 0.5);
}

body:not([data-page="home"]) .stl-modal-backdrop {
  background: rgba(15, 23, 42, 0.55);
}

body:not([data-page="home"]) .stl-modal-canvas {
  background: #e2e8f0;
}

body:not([data-page="home"]) .individual-zr-row,
body:not([data-page="home"]) .bridge-options-container {
  border-top: 1px solid rgba(203, 213, 225, 0.5);
}

/* ── Sortable table headers ──────────────────────────────── */

.sortable-th {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sortable-th:hover {
  background: rgba(30, 123, 184, 0.08);
}

.sort-icon {
  font-size: 0.75em;
  opacity: 0.7;
}

/* ── Print modal ─────────────────────────────────────────── */

.print-dialog {
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
}

.print-body {
  padding: 0 1.5rem 1.5rem;
}

.print-section {
  margin-bottom: 1.5rem;
}

.print-section h4 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--accent, #1e7bb8);
  color: var(--accent, #1e7bb8);
}

.print-info-table {
  width: 100%;
  border-collapse: collapse;
}

.print-info-table td {
  padding: 0.3rem 0.5rem;
  font-size: 0.9rem;
}

.print-info-table td:first-child {
  width: 100px;
  white-space: nowrap;
}

.print-prod-table {
  font-size: 0.9rem;
}

.print-additional {
  padding: 0.75rem;
  border: 1px solid var(--line, #334155);
  border-radius: 6px;
  font-size: 0.9rem;
  white-space: pre-wrap;
  min-height: 2rem;
}

/* ── Print media ─────────────────────────────────────────── */

@media print {
  body > *:not(#order-print-modal) {
    display: none !important;
  }

  #order-print-modal {
    position: static !important;
    display: block !important;
  }

  #order-print-modal .detail-modal-backdrop {
    display: none !important;
  }

  #order-print-modal .detail-modal-dialog {
    position: static !important;
    max-width: 100% !important;
    max-height: none !important;
    box-shadow: none !important;
    border: none !important;
    overflow: visible !important;
  }

  #print-do-print,
  [data-close-print] {
    display: none !important;
  }

  .print-section h4 {
    color: #000 !important;
    border-bottom-color: #000 !important;
  }

  .print-body,
  .print-info-table,
  .print-prod-table,
  .print-additional {
    color: #000 !important;
    background: #fff !important;
  }

  .print-additional {
    border-color: #999 !important;
  }
}

/* ── Action dropdown ──────────────────────────────────────── */

.action-dropdown {
  position: relative;
  display: inline-block;
}

.action-dropdown-btn {
  white-space: nowrap;
}

.action-dropdown-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 120px;
  background: var(--panel, #1e293b);
  border: 1px solid var(--line, #334155);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  z-index: 50;
  list-style: none;
  margin: 2px 0 0;
  padding: 4px 0;
}

.action-dropdown:hover .action-dropdown-menu {
  display: block;
}

.action-menu-item {
  display: block;
  width: 100%;
  padding: 0.45rem 0.9rem;
  background: none;
  border: none;
  color: var(--text, #e2e8f0);
  font-size: 0.85rem;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.action-menu-item:hover {
  background: var(--accent, #1e7bb8);
  color: #fff;
}

.orders-list .user-table-wrap {
  overflow: visible;
}
