/*
 * ReturnFlow layout v2
 * Original implementation informed by MIT-licensed Shadcn Admin,
 * TailAdmin, Ant Design Pro and Mosaic Lite layout conventions.
 */

:root {
  --ui-sidebar: 240px;
  --ui-sidebar-collapsed: 76px;
  --ui-topbar: 64px;
  --ui-bg: #f6f7f9;
  --ui-surface: #ffffff;
  --ui-surface-soft: #f8fafc;
  --ui-text: #172033;
  --ui-muted: #667085;
  --ui-subtle: #98a2b3;
  --ui-border: #e4e7ec;
  --ui-border-strong: #d0d5dd;
  --ui-primary: #2563eb;
  --ui-primary-dark: #1d4ed8;
  --ui-primary-soft: #eff6ff;
  --ui-success: #079455;
  --ui-success-soft: #ecfdf3;
  --ui-warning: #dc6803;
  --ui-warning-soft: #fffaeb;
  --ui-danger: #d92d20;
  --ui-danger-soft: #fef3f2;
  --ui-radius-sm: 8px;
  --ui-radius: 10px;
  --ui-radius-lg: 14px;
  --ui-shadow-sm: 0 1px 2px rgba(16, 24, 40, .04);
  --ui-shadow: 0 8px 24px rgba(16, 24, 40, .07);
  --ui-focus: 0 0 0 4px rgba(37, 99, 235, .12);
}

html {
  min-width: 320px;
  background: var(--ui-bg);
  color-scheme: light;
  scroll-behavior: smooth;
}

body:not(.login-page) {
  min-height: 100vh;
  padding-top: var(--ui-topbar);
  padding-left: var(--ui-sidebar);
  color: var(--ui-text);
  background: var(--ui-bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: padding-left .2s ease;
}

body.nav-lock { overflow: hidden; }

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

button,
a,
input,
select,
textarea,
[tabindex] { -webkit-tap-highlight-color: transparent; }

a { text-underline-offset: 3px; }

::selection {
  color: #172033;
  background: #dbeafe;
}

/* Sidebar --------------------------------------------------------------- */

.navbar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 950;
  width: var(--ui-sidebar);
  height: 100vh;
  padding: 0;
  display: block;
  color: var(--ui-text);
  background: #fff;
  border-right: 1px solid var(--ui-border);
  box-shadow: none;
  transition: width .2s ease, transform .2s ease;
}

.app-nav-shell,
.navbar > .nav-container {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.app-nav-header {
  min-height: var(--ui-topbar);
  padding: 10px 12px 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--ui-border);
}

.nav-brand {
  min-width: 0;
  margin: 0 auto 0 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ui-text);
  text-decoration: none;
}

.nav-brand:hover { color: var(--ui-text); }

.nav-brand-mark {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--ui-primary);
  box-shadow: 0 5px 12px rgba(37, 99, 235, .20);
  font-size: 15px;
  font-weight: 800;
}

.nav-brand-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.nav-brand-copy strong {
  overflow: hidden;
  color: #101828;
  font-size: 14px;
  font-weight: 720;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-brand-copy small {
  color: var(--ui-subtle);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.nav-collapse-btn {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  color: var(--ui-muted);
  background: #fff;
  cursor: pointer;
}

.nav-collapse-btn:hover {
  color: var(--ui-primary);
  border-color: #bfdbfe;
  background: var(--ui-primary-soft);
}

.nav-collapse-glyph {
  font-size: 18px;
  line-height: 1;
  transition: transform .2s ease;
}

.app-nav-links,
.navbar .nav-links {
  min-width: 0;
  min-height: 0;
  margin: 0;
  padding: 14px 10px;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  scrollbar-width: thin;
  scrollbar-color: #d0d5dd transparent;
}

.nav-group {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.nav-group + .nav-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.nav-group-label {
  padding: 0 10px 4px;
  color: var(--ui-subtle);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .08em;
}

.navbar .nav-links a,
.navbar .nav-links button:not(.nav-menu-toggle) {
  width: 100%;
  min-height: 40px;
  margin: 0;
  padding: 7px 9px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #475467;
  background: transparent;
  font-size: 13px;
  font-weight: 560;
  line-height: 1.25;
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color .14s ease, background .14s ease, border-color .14s ease;
}

.navbar .nav-links a:hover,
.navbar .nav-links button:not(.nav-menu-toggle):hover {
  color: #1d2939;
  background: #f2f4f7;
  border-color: #eaecf0;
  transform: none;
}

.navbar .nav-links a.active,
.navbar .nav-links a[aria-current="page"] {
  color: var(--ui-primary-dark);
  background: var(--ui-primary-soft);
  border-color: #dbeafe;
  box-shadow: none;
  font-weight: 680;
}

.nav-item-icon {
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: #667085;
  background: #f2f4f7;
  font-size: 11px;
  font-weight: 750;
}

.navbar .nav-links a.active .nav-item-icon,
.navbar .nav-links a[aria-current="page"] .nav-item-icon {
  color: #fff;
  background: var(--ui-primary);
}

.nav-item-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar .nav-links .nav-logout {
  color: #b42318 !important;
}

.navbar .nav-links .nav-logout .nav-item-icon {
  color: #b42318;
  background: #fef3f2;
}

.navbar .nav-links .nav-logout:hover {
  color: #b42318 !important;
  border-color: #fee4e2;
  background: #fef3f2;
}

.app-nav-footer {
  padding: 10px;
  border-top: 1px solid var(--ui-border);
}

.app-route-chip {
  min-width: 0;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  color: #344054;
  background: #f9fafb;
}

.app-route-avatar {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #1d4ed8;
  background: #dbeafe;
  font-size: 12px;
  font-weight: 750;
}

.app-route-copy {
  min-width: 0;
  display: grid;
}

.app-route-copy strong {
  overflow: hidden;
  color: #344054;
  font-size: 12px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-route-copy small {
  color: var(--ui-subtle);
  font-size: 10px;
}

.nav-menu-toggle {
  width: 38px;
  height: 38px;
  display: none;
  place-items: center;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  color: #344054;
  background: #fff;
  cursor: pointer;
}

.nav-menu-icon,
.nav-menu-icon::before,
.nav-menu-icon::after {
  width: 18px;
  height: 2px;
  display: block;
  border-radius: 99px;
  background: currentColor;
}

.nav-menu-icon { position: relative; }
.nav-menu-icon::before,
.nav-menu-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.nav-menu-icon::before { top: -6px; }
.nav-menu-icon::after { top: 6px; }

.nav-backdrop { display: none; }

/* Top task bar ---------------------------------------------------------- */

.app-topbar {
  position: fixed;
  inset: 0 0 auto var(--ui-sidebar);
  z-index: 900;
  height: var(--ui-topbar);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, .96);
  border-bottom: 1px solid var(--ui-border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: left .2s ease;
}

.topbar-copy {
  min-width: 0;
  margin-right: auto;
  display: grid;
  gap: 1px;
}

.topbar-copy small {
  color: var(--ui-subtle);
  font-size: 10px;
  font-weight: 680;
}

.topbar-copy strong {
  overflow: hidden;
  color: #101828;
  font-size: 15px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-status {
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  color: #475467;
  background: #fff;
  font-size: 11px;
  white-space: nowrap;
}

.topbar-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #12b76a;
  box-shadow: 0 0 0 3px #d1fadf;
}

body.sidebar-collapsed { padding-left: var(--ui-sidebar-collapsed); }
body.sidebar-collapsed .navbar { width: var(--ui-sidebar-collapsed); }
body.sidebar-collapsed .app-topbar { left: var(--ui-sidebar-collapsed); }
body.sidebar-collapsed .nav-brand-copy,
body.sidebar-collapsed .nav-group-label,
body.sidebar-collapsed .nav-item-label,
body.sidebar-collapsed .app-route-copy { display: none; }
body.sidebar-collapsed .app-nav-header { padding-inline: 19px; }
body.sidebar-collapsed .nav-brand { margin: 0; }
body.sidebar-collapsed .nav-collapse-btn { display: none; }
body.sidebar-collapsed .navbar .nav-links a,
body.sidebar-collapsed .navbar .nav-links button:not(.nav-menu-toggle) {
  padding-inline: 14px;
  justify-content: center;
}
body.sidebar-collapsed .app-route-chip { padding: 9px 12px; justify-content: center; }

/* Content --------------------------------------------------------------- */

.container,
.profile-wrap {
  width: min(100%, 1660px);
  max-width: 1660px;
  margin: 0 auto;
  padding: 26px 24px 56px;
}

.profile-wrap { max-width: 1080px; }

.container > h1,
.container h1.ui-page-title,
.profile-wrap h1.ui-page-title {
  margin: 0 0 22px;
  color: #101828;
  font-size: clamp(23px, 2.2vw, 29px);
  font-weight: 730;
  letter-spacing: -.025em;
  line-height: 1.25;
}

h1.ui-page-title::before {
  content: attr(data-eyebrow);
  margin-bottom: 6px;
  display: block;
  color: var(--ui-primary);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: .08em;
}

h1.ui-page-title[data-subtitle]::after {
  content: attr(data-subtitle);
  max-width: 760px;
  margin-top: 7px;
  display: block;
  color: var(--ui-muted);
  font-size: 13px;
  font-weight: 430;
  letter-spacing: 0;
  line-height: 1.55;
}

.ui-page-head {
  margin-bottom: 22px !important;
  padding: 0 !important;
  align-items: flex-end !important;
  gap: 16px !important;
}

.ui-page-head h1 { margin-bottom: 0 !important; }
.ui-page-head > .btn,
.ui-page-head > a.btn { margin-bottom: 1px; flex: 0 0 auto; }

.card,
.profile-panel,
.record-card {
  position: relative;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-lg);
  background: var(--ui-surface);
  box-shadow: var(--ui-shadow-sm);
}

.card {
  margin-bottom: 16px;
  padding: 20px;
}

.card h2,
.profile-panel h2 {
  margin: 0 0 14px;
  color: #1d2939;
  font-size: 15px;
  font-weight: 690;
  letter-spacing: -.01em;
}

.card h3 {
  color: #344054;
  font-size: 13px;
  font-weight: 680;
}

.hint,
.records-head p {
  color: var(--ui-muted);
  font-size: 12px;
  line-height: 1.6;
}

.serial-status {
  min-height: 42px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  border: 1px solid #dbeafe;
  border-radius: 9px;
  color: #1e40af;
  background: var(--ui-primary-soft);
  font-weight: 650;
}

/* Form controls --------------------------------------------------------- */

.btn,
.login-btn {
  min-height: 38px;
  padding: 8px 13px;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 640;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: var(--ui-shadow-sm);
  transition: color .14s ease, background .14s ease, border-color .14s ease, box-shadow .14s ease;
}

.btn:hover:not(:disabled),
.login-btn:hover:not(:disabled) {
  transform: none;
  box-shadow: 0 3px 8px rgba(16, 24, 40, .09);
}

.btn:disabled { opacity: .5; filter: saturate(.7); }

.btn-primary {
  color: #fff;
  background: var(--ui-primary);
  border-color: var(--ui-primary);
}
.btn-primary:hover:not(:disabled) { color: #fff; background: var(--ui-primary-dark); border-color: var(--ui-primary-dark); }

.btn-success {
  color: #fff;
  background: var(--ui-success);
  border-color: var(--ui-success);
}
.btn-success:hover:not(:disabled) { color: #fff; background: #067647; border-color: #067647; }

.btn-secondary {
  color: #344054;
  background: #fff;
  border-color: var(--ui-border-strong);
}
.btn-secondary:hover:not(:disabled) { color: #1d2939; background: #f9fafb; border-color: #b9c0ca; }

.btn-warning { color: #fff; background: var(--ui-warning); border-color: var(--ui-warning); }
.btn-danger { color: #fff; background: var(--ui-danger); border-color: var(--ui-danger); }
.btn-danger:hover:not(:disabled) { color: #fff; background: #b42318; border-color: #b42318; }

.form-input,
.filter-input,
.search-input,
.ai-select,
.ai-import-pending-select,
.modal-input,
.profile-panel input,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select,
textarea {
  min-height: 40px;
  border: 1px solid var(--ui-border-strong);
  border-radius: 8px;
  color: #1d2939;
  background: #fff;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(16, 24, 40, .03);
  transition: border-color .14s ease, box-shadow .14s ease;
}

.form-input,
.filter-input,
.search-input,
.ai-select,
.ai-import-pending-select,
.modal-input,
.profile-panel input,
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
textarea { padding: 8px 11px; }

select { padding: 7px 32px 7px 11px; }
textarea { line-height: 1.55; }

.form-input:focus,
.filter-input:focus,
.search-input:focus,
.ai-select:focus,
.ai-import-pending-select:focus,
.modal-input:focus,
.profile-panel input:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: #84adff;
  box-shadow: var(--ui-focus);
}

input[type="checkbox"],
input[type="radio"] { min-height: 0; accent-color: var(--ui-primary); }

input[type="file"] {
  max-width: 100%;
  min-height: 40px;
  padding: 6px;
  border: 1px dashed var(--ui-border-strong);
  border-radius: 8px;
  color: var(--ui-muted);
  background: #f9fafb;
}

input[type="file"]::file-selector-button {
  margin-right: 8px;
  padding: 6px 9px;
  border: 0;
  border-radius: 6px;
  color: #1d4ed8;
  background: #dbeafe;
  font-weight: 650;
  cursor: pointer;
}

.form-label,
.ai-setting-field > span,
.form-row label { color: #344054; font-weight: 650; }

.choice-btn,
.issue-btn,
.ai-mode-card {
  border-radius: 9px;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}

.choice-btn:hover,
.issue-btn:hover,
.ai-mode-card:hover {
  border-color: #84adff;
  box-shadow: var(--ui-focus);
  transform: none;
}

/* Feedback and tables --------------------------------------------------- */

.alert {
  padding: 11px 13px;
  border: 1px solid transparent;
  border-left-width: 3px;
  border-radius: 8px;
  font-size: 12px;
}
.alert-success, .alert.ok { color: #05603a; background: var(--ui-success-soft); border-color: #abefc6; border-left-color: var(--ui-success); }
.alert-error, .alert.err { color: #912018; background: var(--ui-danger-soft); border-color: #fecdca; border-left-color: var(--ui-danger); }
.alert-info, .alert.info { color: #1849a9; background: var(--ui-primary-soft); border-color: #b2ccff; border-left-color: var(--ui-primary); }
.alert-warn, .alert.warn { color: #93370d; background: var(--ui-warning-soft); border-color: #fedf89; border-left-color: var(--ui-warning); }

.stats-bar,
.price-toolbar,
.filter-row,
.upload-row { gap: 9px; }

.table-scroll {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: #fff;
  scrollbar-color: #d0d5dd transparent;
}

.table-scroll > .data-table { min-width: 720px; }

.data-table {
  border-collapse: separate;
  border-spacing: 0;
  color: var(--ui-text);
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 10px 12px;
  border-bottom: 1px solid var(--ui-border);
  color: #475467;
  background: #f9fafb;
  font-size: 11px;
  font-weight: 690;
}

.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f1f3;
  color: #344054;
  vertical-align: middle;
}

.data-table tbody tr:hover td { background: #f8fafc; }
.data-table .empty { padding: 44px 20px; color: var(--ui-subtle); }

/* Admin review layout --------------------------------------------------- */

.ai-review-workbench {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  gap: 18px;
}

.ai-review-workbench > .card { margin-bottom: 0; }
.ai-review-left { min-width: 0; padding: 20px; }

.ai-review-right {
  position: sticky;
  top: calc(var(--ui-topbar) + 18px);
  align-self: start;
  max-height: calc(100vh - var(--ui-topbar) - 36px);
  padding: 16px;
  overflow: hidden;
}

.ai-review-right .ai-import-asset-grid {
  max-height: calc(100vh - var(--ui-topbar) - 78px);
  padding: 1px 4px 8px 1px;
  overflow-y: auto;
}

.ai-review-current-status {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.ai-import-flow-head {
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: #f9fafb;
}

.ai-import-flow-head strong { color: #344054; }

.ai-import-select-row {
  grid-template-columns: minmax(180px, 1fr) minmax(118px, 150px) auto;
  gap: 7px;
}

.ai-import-button-row {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.ai-import-pending-stats {
  min-height: 39px;
  margin-bottom: 7px;
  padding: 9px 11px;
  border-color: var(--ui-border);
  border-radius: 8px;
  color: var(--ui-muted);
  background: #fff;
}

.ai-import-flow-steps {
  grid-template-columns: repeat(4, minmax(110px, 1fr));
  gap: 6px;
  margin-bottom: 12px;
  padding: 8px;
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  background: #f9fafb;
}

.ai-import-flow-step {
  position: relative;
  min-height: 43px;
  padding: 8px 8px 8px 22px;
  justify-content: flex-start;
  border-color: var(--ui-border);
  border-radius: 7px;
  color: var(--ui-muted);
  background: #fff;
}

.ai-import-flow-step::before {
  content: "";
  position: absolute;
  left: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d0d5dd;
}

.ai-import-flow-step.done {
  color: #067647;
  border-color: #abefc6;
  background: var(--ui-success-soft);
}
.ai-import-flow-step.done::before { background: #12b76a; box-shadow: 0 0 0 3px #d1fadf; }

.ai-import-asset-box,
.ai-import-recognized-panel,
.ai-import-batch-panel,
.ai-import-items-panel,
.ai-import-codex-history {
  border-color: var(--ui-border);
  border-radius: 9px;
  box-shadow: none;
}

.ai-import-asset-box { padding: 10px; }
.ai-import-asset-box:hover { border-color: #b2ccff; background: #fff; box-shadow: var(--ui-shadow-sm); }

.ai-import-archive-status {
  border: 1px solid var(--ui-border);
  border-left: 3px solid var(--ui-subtle);
  border-radius: 8px;
}

.ai-import-status-actions { gap: 7px; }
.ai-import-codex-reply pre,
.ai-import-codex-history-list { background: #f9fafb; }

/* Capture and batch layout --------------------------------------------- */

.ai-grid {
  grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
  gap: 18px;
}

.ai-grid > .card { margin-bottom: 0; }

.ai-right {
  position: sticky;
  top: calc(var(--ui-topbar) + 18px);
  align-self: start;
  max-height: calc(100vh - var(--ui-topbar) - 36px);
  overflow-y: auto;
}

.ai-workflow-order {
  border-color: #fedf89;
  border-radius: 9px;
  color: #93370d;
  background: var(--ui-warning-soft);
}

.ai-workflow-progress {
  gap: 5px;
  padding: 8px;
  border-color: var(--ui-border);
  border-radius: 10px;
  background: #f9fafb;
}

.workflow-step {
  min-height: 56px;
  border-color: var(--ui-border);
  border-radius: 8px;
  color: var(--ui-muted);
  background: #fff;
}

.workflow-step.done {
  color: #067647;
  border-color: #abefc6;
  background: var(--ui-success-soft);
}

.workflow-arrow { color: #d0d5dd; font-size: 12px; }

.ai-live-camera-panel {
  overflow: hidden;
  border-color: #344054;
  border-radius: 11px;
  box-shadow: var(--ui-shadow);
}

.ai-condition-box,
.ai-processing-summary,
.ai-recognition-summary,
.ai-scan-panel { border-radius: 10px; }

.ai-choice-fieldset {
  padding: 10px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: #fff;
}

.ai-choice-fieldset legend { padding: 0 4px; }
.choice-btn { min-height: 44px; }
.ai-capture-checklist { border-radius: 9px; }

.ai-complete-row {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--ui-border);
}

.ai-batch-upload-card { border-color: #dbeafe; }

.ai-batch-dropzone {
  min-height: 132px;
  border-color: #84adff;
  border-radius: 10px;
  color: #1849a9;
  background: #f5f8ff;
}

.ai-batch-dropzone strong { font-size: 16px; font-weight: 690; }
.ai-batch-dropzone:hover,
.ai-batch-dropzone.dragover { border-color: var(--ui-primary); background: var(--ui-primary-soft); box-shadow: var(--ui-focus); transform: none; }

.ai-batch-upload-summary { border-color: var(--ui-border); border-radius: 8px; background: #f9fafb; }

#aiImportBatchWorkbench .ai-batch-toolbar {
  padding: 10px;
  border: 1px solid var(--ui-border);
  border-radius: 9px;
  background: #f9fafb;
}

/* Records and account --------------------------------------------------- */

.record-list { gap: 12px !important; }
.record-card { padding: 16px !important; }
.record-card:hover { border-color: #b2ccff; box-shadow: var(--ui-shadow-sm); transform: none; }
.record-title { color: #1d2939; }
.record-meta { padding: 10px; border-radius: 8px; background: #f9fafb; }
.profile-panel { padding: 20px !important; }
.profile-grid { gap: 16px !important; }

/* Dialogs --------------------------------------------------------------- */

.modal,
.ai-modal,
.media-preview-modal {
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal-box,
.ai-modal-box,
.ai-camera-modal-box,
.media-preview-dialog {
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(16, 24, 40, .20);
}

/* Login ----------------------------------------------------------------- */

body.login-page {
  min-height: 100vh;
  height: auto;
  padding: 24px;
  display: grid;
  place-items: center;
  color: var(--ui-text);
  background: #f2f4f7;
}

.login-stage {
  width: min(100%, 940px);
  min-height: 570px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, .9fr);
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(16, 24, 40, .12);
}

.login-intro {
  position: relative;
  padding: 54px 48px;
  overflow: hidden;
  color: #fff;
  background: linear-gradient(145deg, #1d4ed8, #2563eb 55%, #0ea5e9);
}

.login-intro::after {
  content: "";
  position: absolute;
  right: -100px;
  bottom: -120px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 50%;
  box-shadow: 0 0 0 52px rgba(255, 255, 255, .05), 0 0 0 104px rgba(255, 255, 255, .03);
}

.login-intro-mark {
  position: relative;
  z-index: 1;
  width: 48px;
  height: 48px;
  margin-bottom: 30px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 13px;
  background: rgba(255, 255, 255, .14);
  font-size: 20px;
  font-weight: 800;
}

.login-intro-eyebrow {
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
  color: #dbeafe;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .12em;
}

.login-intro h1 {
  position: relative;
  z-index: 1;
  max-width: 400px;
  margin: 0 0 16px;
  font-size: clamp(30px, 4vw, 42px);
  font-weight: 740;
  letter-spacing: -.04em;
  line-height: 1.13;
}

.login-intro > p {
  position: relative;
  z-index: 1;
  max-width: 410px;
  color: #dbeafe;
  font-size: 13px;
  line-height: 1.75;
}

.login-capabilities {
  position: relative;
  z-index: 1;
  margin: 34px 0 0;
  padding: 0;
  display: grid;
  gap: 11px;
  list-style: none;
}

.login-capabilities li {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #eff6ff;
  font-size: 12px;
}

.login-capabilities li::before {
  content: "";
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: #bfdbfe;
  box-shadow: 0 0 0 4px rgba(219, 234, 254, .14);
}

.login-container {
  width: 100%;
  max-width: none;
  padding: 44px 38px;
  display: flex;
  align-items: center;
  background: #fff;
}

.login-card {
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.login-card .logo-area { display: none; }
.login-card h2 { color: #101828; font-size: 25px; font-weight: 720; letter-spacing: -.025em; }
.login-card .subtitle { margin: 7px 0 20px; color: var(--ui-muted); }
.login-card .input-group { margin-bottom: 16px; }

.login-card .input-group input {
  min-height: 52px;
  padding: 19px 14px 7px;
  border-color: var(--ui-border-strong);
  border-radius: 9px;
  background: #fff;
}

.login-card .input-group input:focus { border-color: #84adff; box-shadow: var(--ui-focus); }

.login-card .login-btn {
  min-height: 48px;
  margin-top: 8px;
  border-radius: 9px;
  color: #fff;
  background: var(--ui-primary);
  font-weight: 680;
}

.login-security-note {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--ui-border);
  color: var(--ui-subtle);
  font-size: 11px;
  line-height: 1.55;
  text-align: center;
}

/* Accessibility -------------------------------------------------------- */

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .26);
  outline-offset: 2px;
}

.ui-skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 2000;
  padding: 8px 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--ui-primary-dark);
  text-decoration: none;
  transform: translateY(-160%);
}
.ui-skip-link:focus { transform: translateY(0); }

/* Responsive ------------------------------------------------------------ */

@media (min-width: 901px) and (max-width: 1360px) {
  body:not(.login-page) { padding-left: var(--ui-sidebar-collapsed); }
  .navbar { width: var(--ui-sidebar-collapsed); }
  .app-topbar { left: var(--ui-sidebar-collapsed); }
  .nav-brand-copy,
  .nav-group-label,
  .nav-item-label,
  .app-route-copy { display: none; }
  .app-nav-header { padding-inline: 19px; }
  .nav-brand { margin: 0; }
  .nav-collapse-btn { display: none; }
  .navbar .nav-links a,
  .navbar .nav-links button:not(.nav-menu-toggle) { padding-inline: 14px; justify-content: center; }
  .app-route-chip { padding: 9px 12px; justify-content: center; }
}

@media (max-width: 1180px) {
  .ai-review-workbench,
  .ai-grid { grid-template-columns: 1fr; }

  .ai-review-right,
  .ai-right {
    position: static;
    max-height: none;
    overflow: visible;
  }

  .ai-review-right .ai-import-asset-grid { max-height: none; }
  .ai-import-flow-steps { grid-template-columns: repeat(2, minmax(110px, 1fr)); }
}

@media (max-width: 900px) {
  body:not(.login-page) { padding-left: 0; }

  .navbar {
    width: min(84vw, 270px);
    box-shadow: 12px 0 30px rgba(16, 24, 40, .14);
    transform: translateX(-105%);
  }

  .navbar.nav-open { transform: translateX(0); }

  .app-topbar {
    left: 0;
    padding: 0 14px;
  }

  .nav-menu-toggle { display: grid; }
  .app-nav-header { padding-inline: 14px 10px; }
  .nav-collapse-btn { display: none; }

  .nav-backdrop {
    position: fixed;
    inset: 0;
    z-index: 940;
    display: none;
    border: 0;
    background: rgba(16, 24, 40, .42);
    backdrop-filter: blur(2px);
  }

  body.nav-lock .nav-backdrop { display: block; }

  body.sidebar-collapsed .nav-brand-copy,
  body.sidebar-collapsed .nav-group-label,
  body.sidebar-collapsed .nav-item-label { display: block; }
  body.sidebar-collapsed .app-route-copy { display: grid; }
  body.sidebar-collapsed .app-nav-header { padding-inline: 14px 10px; }
  body.sidebar-collapsed .nav-brand { margin-right: auto; }
  body.sidebar-collapsed .navbar .nav-links a,
  body.sidebar-collapsed .navbar .nav-links button:not(.nav-menu-toggle) {
    padding: 7px 9px;
    justify-content: flex-start;
  }
  body.sidebar-collapsed .app-route-chip { padding: 9px 10px; justify-content: flex-start; }

  .container,
  .profile-wrap { padding: 22px 14px 44px; }

  .login-stage { grid-template-columns: 1fr; max-width: 500px; min-height: 0; }
  .login-intro { padding: 28px 30px; }
  .login-intro h1 { font-size: 29px; }
  .login-intro > p,
  .login-capabilities { display: none; }
  .login-intro-mark { width: 44px; height: 44px; margin-bottom: 18px; }
  .login-container { padding: 34px 28px; }
}

@media (max-width: 640px) {
  .app-topbar { height: 60px; }
  body:not(.login-page) { padding-top: 60px; }
  .topbar-status { display: none; }
  .topbar-copy strong { font-size: 14px; }

  .container,
  .profile-wrap { padding: 18px 10px 36px; }

  .container > h1,
  .container h1.ui-page-title,
  .profile-wrap h1.ui-page-title { font-size: 22px; }

  h1.ui-page-title[data-subtitle]::after { font-size: 12px; }

  .ui-page-head { display: grid !important; align-items: stretch !important; }
  .ui-page-head > .btn,
  .ui-page-head > a.btn { width: 100%; }

  .card,
  .profile-panel,
  .record-card { border-radius: 11px; }
  .card { margin-bottom: 10px; padding: 14px; }

  .btn { min-height: 42px; padding: 9px 12px; }
  .view-mobile .btn { min-height: 50px; padding: 12px 14px; }

  .form-input,
  .filter-input,
  .search-input,
  .ai-select,
  .ai-import-pending-select,
  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  select { min-height: 44px; }

  .upload-row,
  .filter-row,
  .price-toolbar,
  .toolbar-left,
  .toolbar-right { align-items: stretch; }

  .ai-import-select-row,
  .ai-import-button-row,
  .ai-import-flow-steps { grid-template-columns: 1fr; }
  .ai-import-flow-step { min-height: 40px; }
  .ai-workflow-progress { grid-template-columns: 1fr; }
  .workflow-arrow { min-height: 8px; transform: rotate(90deg); }
  .ai-batch-dropzone { min-height: 118px; }

  .table-scroll { overflow: visible; border: 0; border-radius: 0; background: transparent; }
  .table-scroll > .data-table { min-width: 0; }

  body.login-page { padding: 12px; align-items: start; }
  .login-stage { margin: 6px auto; border-radius: 16px; }
  .login-intro { padding: 23px 22px; }
  .login-intro h1 { margin-bottom: 0; font-size: 26px; }
  .login-intro-eyebrow { margin-bottom: 7px; }
  .login-container { padding: 28px 20px; }
  .login-card h2 { font-size: 23px; }
  .login-options { align-items: flex-start; flex-direction: column; }
}

/* ReturnFlow layout v3 --------------------------------------------------
 * The v3 layer reduces simultaneous controls and makes queue state the
 * primary navigation model for administrators.
 */

:root {
  --ui-sidebar: 224px;
  --ui-topbar: 58px;
  --ui-bg: #f3f6fa;
  --ui-surface-soft: #f7f9fc;
  --ui-border: #e2e8f0;
  --ui-border-strong: #cbd5e1;
  --ui-primary: #175cd3;
  --ui-primary-dark: #1849a9;
  --ui-primary-soft: #eef4ff;
  --ui-radius: 12px;
  --ui-radius-lg: 16px;
  --ui-shadow-sm: 0 1px 2px rgba(15, 23, 42, .035);
  --ui-shadow: 0 12px 28px rgba(15, 23, 42, .07);
}

body:not(.login-page) {
  background:
    radial-gradient(circle at 86% 0, rgba(23, 92, 211, .045), transparent 25rem),
    var(--ui-bg);
}

.navbar {
  border-right-color: #dfe5ee;
  box-shadow: 2px 0 10px rgba(15, 23, 42, .025);
}

.app-nav-header {
  min-height: var(--ui-topbar);
  padding: 9px 11px 9px 13px;
}

.nav-brand-mark {
  width: 34px;
  height: 34px;
  flex-basis: 34px;
  border-radius: 11px;
  background: linear-gradient(145deg, #155eef, #1849a9);
  box-shadow: 0 6px 14px rgba(23, 92, 211, .18);
}

.nav-brand-copy strong { font-size: 13px; }
.app-nav-links,
.navbar .nav-links { gap: 12px; padding: 14px 9px; }
.nav-group { gap: 3px; }
.nav-group-label { padding: 0 10px 3px; font-size: 9px; }

.navbar .nav-links a,
.navbar .nav-links button:not(.nav-menu-toggle) {
  min-height: 38px;
  padding: 6px 9px;
  border-radius: 9px;
  font-size: 12.5px;
}

.nav-item-icon {
  width: 23px;
  height: 23px;
  flex-basis: 23px;
  border-radius: 6px;
  background: transparent;
  font-size: 10px;
}

.navbar .nav-links a.active,
.navbar .nav-links a[aria-current="page"] {
  border-color: #d6e4ff;
  background: #edf4ff;
}

.app-nav-footer { padding: 9px; }
.app-route-chip { border: 0; background: #f3f6fa; }

.app-topbar {
  height: var(--ui-topbar);
  padding-inline: 22px;
  background: rgba(255, 255, 255, .92);
}

.topbar-copy { display: flex; align-items: baseline; gap: 7px; }
.topbar-copy small::after { content: "/"; margin-left: 7px; color: #cbd5e1; }
.topbar-copy strong { font-size: 14px; }
.topbar-status { padding: 5px 9px; border: 0; background: #f6f8fb; }

.container,
.profile-wrap {
  width: min(100%, 1500px);
  max-width: 1500px;
  padding: 28px 28px 64px;
}

.container > h1,
.container h1.ui-page-title,
.profile-wrap h1.ui-page-title {
  margin-bottom: 20px;
  font-size: clamp(24px, 2vw, 30px);
}

h1.ui-page-title::before { margin-bottom: 4px; }
h1.ui-page-title[data-subtitle]::after { margin-top: 6px; font-size: 13px; }

.card,
.profile-panel,
.record-card {
  border-color: #e1e7ef;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .025), 0 8px 22px rgba(15, 23, 42, .025);
}

.card { padding: 22px; }
.card h2, .profile-panel h2 { font-size: 16px; }

/* Queue overview */

.ui-queue-overview {
  margin: -2px 0 20px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.ui-queue-metric {
  position: relative;
  min-width: 0;
  min-height: 112px;
  padding: 15px 16px;
  display: grid;
  align-content: start;
  gap: 2px;
  overflow: hidden;
  border: 1px solid #e1e7ef;
  border-radius: 14px;
  color: #344054;
  background: rgba(255, 255, 255, .88);
  box-shadow: var(--ui-shadow-sm);
  text-decoration: none;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.ui-queue-metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #98a2b3;
}

.ui-queue-metric:hover {
  border-color: #b2ccff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .07);
  transform: translateY(-1px);
}

.ui-queue-metric > span { color: #667085; font-size: 12px; font-weight: 650; }
.ui-queue-metric > strong { color: #101828; font-size: 30px; font-weight: 750; line-height: 1.25; letter-spacing: -.035em; }
.ui-queue-metric > small { margin-top: 3px; color: #98a2b3; font-size: 10.5px; }
.ui-queue-metric.is-registered::before { background: #12b76a; }
.ui-queue-metric.is-review::before { background: #f79009; }
.ui-queue-metric.is-recognition::before { background: #2e90fa; }
.ui-queue-metric.is-total::before { background: #7f56d9; }
.ui-queue-overview.is-unavailable .ui-queue-metric > strong { color: #98a2b3; }

.ui-queue-secondary {
  grid-column: 1 / -1;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  border: 1px solid #e4e7ec;
  border-radius: 10px;
  color: #667085;
  background: rgba(255, 255, 255, .72);
  font-size: 11px;
}

.ui-queue-secondary strong { color: #344054; font-weight: 720; }

.ai-import-review-alert {
  margin: 0 0 12px;
  padding: 11px 12px;
  border: 1px solid #fedf89;
  border-radius: 10px;
  color: #7a2e0e;
  background: #fffaeb;
}

.ai-import-review-alert ul { margin: 6px 0; padding-left: 18px; }
.ai-import-review-alert li + li { margin-top: 3px; }
.ai-import-review-alert small { color: #93370d; }

/* Single-package review */

.ai-review-workbench { grid-template-columns: minmax(0, 1fr) 370px; gap: 16px; }
.ai-review-left { padding: 18px; }

.ai-review-current-status { display: none; }

.ai-import-flow-head {
  margin-bottom: 10px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(220px, .7fr) minmax(520px, 1.3fr);
  align-items: center;
  gap: 18px;
  border-color: #dbe4ef;
  border-radius: 13px;
  background: linear-gradient(135deg, #f8faff, #f6f8fb);
}

.ai-import-flow-head h2 { margin-bottom: 5px; }
.ai-import-flow-head .hint { margin-top: 3px; }
.ai-import-flow-actions { min-width: 0; }

.ai-import-select-row {
  display: grid;
  grid-template-columns: 190px minmax(240px, 1fr) 185px;
  gap: 7px;
}

.ai-import-serial-jump { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.ai-import-serial-jump .form-input { min-width: 0; }

.ai-import-button-row {
  margin-top: 7px;
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.ai-import-queue-statuses {
  margin-bottom: 10px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.ai-import-pending-stats {
  min-height: 38px;
  margin: 0;
  padding: 9px 11px;
  display: flex;
  align-items: center;
  border: 1px solid #e4e9f1;
  border-radius: 9px;
  color: #667085;
  background: #fff;
  font-size: 11.5px;
}

.ai-import-pending-stats strong { color: #1d2939; font-size: 13px; }

.ai-import-flow-steps {
  grid-template-columns: repeat(8, minmax(104px, 1fr));
  gap: 5px;
  padding: 7px;
  overflow-x: auto;
  border-radius: 11px;
}

.ai-import-flow-step { min-height: 38px; padding-block: 7px; font-size: 10.5px; }

.ai-import-start-row {
  margin: 10px 0;
  padding: 12px;
  border: 1px solid #dbe4ef;
  border-radius: 11px;
  background: #f8faff;
}

.ui-advanced-panel,
.ui-danger-zone,
.ai-import-batch-correction-row,
.ui-expandable-card,
.ai-batch-more-actions { overflow: visible; }

.ui-advanced-panel {
  margin: 10px 0;
  padding: 0;
  border: 1px solid #e1e7ef;
  border-radius: 11px;
  background: #fff;
}

.ui-advanced-panel > summary,
.ui-expandable-card > summary,
.ai-import-batch-correction-row > summary,
.ui-danger-zone > summary {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #344054;
  cursor: pointer;
  list-style: none;
  font-size: 12.5px;
  font-weight: 680;
}

.ui-advanced-panel > summary::-webkit-details-marker,
.ui-expandable-card > summary::-webkit-details-marker,
.ai-import-batch-correction-row > summary::-webkit-details-marker,
.ui-danger-zone > summary::-webkit-details-marker { display: none; }

.ui-advanced-panel > summary::after,
.ui-expandable-card > summary::after,
.ai-import-batch-correction-row > summary::after,
.ui-danger-zone > summary::after {
  content: "+";
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #667085;
  background: #f2f4f7;
}

.ui-advanced-panel[open] > summary::after,
.ui-expandable-card[open] > summary::after,
.ai-import-batch-correction-row[open] > summary::after,
.ui-danger-zone[open] > summary::after { content: "−"; }

.ui-advanced-panel > summary small,
.ui-expandable-card > summary small { color: #98a2b3; font-size: 10.5px; font-weight: 450; }
.ui-advanced-panel-body,
.ui-expandable-card-body { padding: 0 14px 14px; border-top: 1px solid #eef1f5; }
.ui-advanced-panel-body { padding-top: 14px; }

.ai-import-recognized-panel,
.ai-import-batch-panel,
.ai-import-items-panel { margin-top: 10px; padding: 14px; }

.ai-import-status-actions {
  position: sticky;
  bottom: 10px;
  z-index: 12;
  margin-top: 12px;
  padding: 10px;
  gap: 10px;
  border: 1px solid #b7e4cc;
  border-radius: 12px;
  background: rgba(247, 254, 250, .96);
  box-shadow: 0 10px 30px rgba(15, 23, 42, .10);
  backdrop-filter: blur(10px);
}

.ai-import-status-actions .btn-success { min-height: 44px; padding-inline: 18px; }

.ui-danger-zone { margin-top: 14px; border-top: 1px solid #eef1f5; }
.ui-danger-zone > summary { padding-inline: 4px; color: #b42318; font-size: 11px; font-weight: 550; }
.ui-danger-zone > div { padding: 4px 4px 10px; }

.ai-review-right {
  top: calc(var(--ui-topbar) + 14px);
  max-height: calc(100vh - var(--ui-topbar) - 28px);
  padding: 14px;
}

.ai-review-right > .ai-import-asset-title { margin-bottom: 10px; font-size: 14px; }
.ai-import-master-folder { padding: 10px; border-radius: 10px; background: #f7f9fc; }
.ai-import-asset-grid { gap: 8px; }
.ai-import-asset-box { padding: 10px; border-radius: 10px; background: #fff; }
.ai-import-asset-box.ai-import-auxiliary-asset {
  border-style: dashed;
  background: #fafafa;
}
.ai-import-asset-box.ai-import-auxiliary-asset[data-upload-type="factory_return"] {
  border-color: #fdba74;
  background: #fffaf3;
}
.ai-import-asset-box.ai-import-auxiliary-asset[data-upload-type="back"] {
  border-color: #c4b5fd;
  background: #faf8ff;
}
.ai-import-folder-actions-compact .btn { min-height: 32px; padding: 5px 8px; font-size: 10px; }

/* Batch workbench */

.ui-expandable-card { padding: 0; }
.ui-expandable-card > summary { min-height: 68px; padding: 14px 18px; }
.ui-expandable-card > summary > span { display: grid; gap: 3px; }
.ui-expandable-card > summary strong { color: #1d2939; font-size: 14px; }
.ui-expandable-card-body { padding: 16px 18px 18px; }

.ai-batch-queue-tabs {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.ai-batch-queue-tab {
  min-height: 72px;
  padding: 11px 13px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 6px;
  border: 1px solid #e1e7ef;
  border-radius: 12px;
  color: #667085;
  background: #fff;
  cursor: pointer;
  text-align: left;
}

.ai-batch-queue-tab:hover { border-color: #b2ccff; background: #f8faff; }
.ai-batch-queue-tab.active { color: #1849a9; border-color: #84adff; background: #eef4ff; box-shadow: 0 0 0 3px rgba(23, 92, 211, .08); }
.ai-batch-queue-tab span { font-size: 11.5px; font-weight: 650; }
.ai-batch-queue-tab strong { color: #101828; font-size: 23px; line-height: 1; }

#aiImportBatchWorkbench > .ai-import-flow-head {
  grid-template-columns: minmax(210px, .55fr) minmax(600px, 1.45fr);
}

#aiImportBatchWorkbench .ai-import-select-row.ai-batch-toolbar {
  padding: 0;
  display: grid;
  grid-template-columns: 1fr;
  border: 0;
  background: transparent;
}

.ai-batch-filter-fields { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
.ai-batch-action-buttons { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.ai-batch-more-actions { position: relative; }
.ai-batch-more-actions > summary { list-style: none; cursor: pointer; }
.ai-batch-more-actions > summary::-webkit-details-marker { display: none; }
.ai-batch-more-actions > div {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 25;
  width: 220px;
  padding: 8px;
  display: grid;
  gap: 6px;
  border: 1px solid #dfe5ee;
  border-radius: 11px;
  background: #fff;
  box-shadow: var(--ui-shadow);
}

#aiImportBatchRows {
  max-height: min(70vh, 760px);
  margin-top: 12px !important;
  padding-right: 6px;
  overflow-y: auto !important;
  scrollbar-gutter: stable;
}

.ai-batch-list-summary {
  position: sticky;
  top: 0;
  z-index: 12;
  margin-bottom: 9px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid #e1e7ef;
  border-radius: 10px;
  color: #667085;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 4px 12px rgba(16, 24, 40, .06);
  font-size: 11.5px;
  backdrop-filter: blur(8px);
}

.ai-batch-selection-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; }
.ai-batch-selection-actions .btn { min-height: 30px; padding: 4px 8px; font-size: 10.5px; }
.ai-import-batch-list { display: grid; gap: 10px; }

.ai-import-batch-card {
  padding: 14px;
  display: grid;
  gap: 10px;
  border: 1px solid #e1e7ef;
  border-left: 4px solid #98a2b3;
  border-radius: 13px;
  background: #fff;
  box-shadow: var(--ui-shadow-sm);
}

.ai-import-batch-card.is-ready { border-left-color: #f79009; }
.ai-import-batch-card.is-idle { border-left-color: #2e90fa; }
.ai-import-batch-card.has-risk { border-color: #fedf89; border-left-color: #f79009; background: #fffdf8; }

.ai-import-batch-card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ai-import-batch-card-select { display: inline-flex; align-items: center; gap: 9px; color: #1d2939; font-size: 14px; font-weight: 720; }
.ai-import-batch-card-select input { width: 17px; height: 17px; }

.ai-import-batch-state {
  padding: 4px 9px;
  border-radius: 999px;
  color: #1849a9;
  background: #eef4ff;
  font-size: 10.5px;
  font-weight: 680;
}

.ai-import-batch-card.is-ready .ai-import-batch-state { color: #93370d; background: #fffaeb; }
.ai-import-batch-card-copy { color: #475467; font-size: 12.5px; line-height: 1.6; }
.ai-import-batch-risk { padding: 9px 10px; display: grid; gap: 2px; border-radius: 9px; color: #93370d; background: #fffaeb; font-size: 11px; }
.ai-import-batch-card-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; padding-top: 2px; }
.ai-import-batch-card-actions .btn { min-height: 34px; padding: 6px 10px; font-size: 11px; }

.ai-import-batch-correction-row { border-top: 1px solid #eef1f5; }
.ai-import-batch-correction-row > summary { padding: 9px 2px 0; color: #475467; font-size: 11px; }
.ai-import-batch-correction-cell { padding-top: 10px; }
.ai-import-batch-correction-grid { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto; gap: 8px; align-items: end; }
.ai-import-batch-correction-grid textarea { margin-top: 5px; }

.ai-import-batch-media-row { padding: 12px; border: 1px solid #e1e7ef; border-radius: 10px; background: #f8fafc; }
.ai-batch-correction-panel { margin-block: 10px 2px; }
.ui-empty-state { min-height: 170px; display: grid; place-content: center; gap: 5px; color: #98a2b3; text-align: center; }
.ui-empty-state strong { color: #475467; font-size: 14px; }
.ui-empty-state span { font-size: 11px; }

/* Keep the full navigation usable on ordinary laptop widths. */
@media (min-width: 901px) and (max-width: 1360px) {
  body:not(.login-page):not(.sidebar-collapsed) { padding-left: var(--ui-sidebar); }
  body:not(.sidebar-collapsed) .navbar { width: var(--ui-sidebar); }
  body:not(.sidebar-collapsed) .app-topbar { left: var(--ui-sidebar); }
  body:not(.sidebar-collapsed) .nav-brand-copy,
  body:not(.sidebar-collapsed) .nav-group-label,
  body:not(.sidebar-collapsed) .nav-item-label { display: block; }
  body:not(.sidebar-collapsed) .app-route-copy { display: grid; }
  body:not(.sidebar-collapsed) .app-nav-header { padding: 9px 11px 9px 13px; }
  body:not(.sidebar-collapsed) .nav-brand { margin-right: auto; }
  body:not(.sidebar-collapsed) .nav-collapse-btn { display: grid; }
  body:not(.sidebar-collapsed) .navbar .nav-links a,
  body:not(.sidebar-collapsed) .navbar .nav-links button:not(.nav-menu-toggle) { padding: 6px 9px; justify-content: flex-start; }
  body:not(.sidebar-collapsed) .app-route-chip { padding: 9px 10px; justify-content: flex-start; }
}

@media (min-width: 901px) {
  .ai-import-batch-card { grid-template-columns: minmax(0, 1fr) auto; }
  .ai-import-batch-card-head,
  .ai-import-batch-correction-row,
  .ai-import-batch-media-row { grid-column: 1 / -1; }
  .ai-import-batch-card-copy,
  .ai-import-batch-risk { grid-column: 1; min-width: 0; }
  .ai-import-batch-card-actions {
    grid-column: 2;
    grid-row: 2 / span 2;
    align-self: center;
    max-width: 340px;
  }
}

@media (max-width: 1240px) {
  .ui-queue-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-review-workbench { grid-template-columns: 1fr; }
  .ai-review-right { position: static; max-height: none; }
  .ai-review-right .ai-import-asset-grid { max-height: none; }
  .ai-import-flow-head,
  #aiImportBatchWorkbench > .ai-import-flow-head { grid-template-columns: 1fr; }
  .ai-import-select-row { grid-template-columns: 180px minmax(220px, 1fr) 180px; }
}

@media (max-width: 900px) {
  .container, .profile-wrap { padding: 22px 16px 50px; }
  .app-topbar { padding-inline: 14px; }
  .ui-queue-overview { gap: 8px; }
  .ai-batch-queue-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-review-workbench { grid-template-columns: 1fr; }
  .ai-review-right { position: static; max-height: none; }
  #aiImportBatchRows { max-height: none; padding-right: 0; overflow: visible !important; }
}

@media (max-width: 640px) {
  .ui-queue-overview { margin-bottom: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ui-queue-metric { min-height: 96px; padding: 12px; }
  .ui-queue-metric > strong { font-size: 25px; }
  .ui-queue-metric > small { display: none; }
  .ai-review-left { padding: 12px; }
  .ai-import-flow-head { padding: 12px; }
  .ai-import-select-row,
  .ai-import-queue-statuses { grid-template-columns: 1fr; }
  .ai-import-button-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-import-flow-steps { grid-template-columns: repeat(8, 112px); }
  .ai-import-status-actions { bottom: 6px; display: grid; }
  .ai-import-status-actions .btn-success { width: 100%; }
  .ai-batch-filter-fields { grid-template-columns: 1fr; }
  .ai-batch-list-summary { align-items: flex-start; flex-direction: column; }
  .ai-batch-selection-actions { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ai-batch-action-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-batch-more-actions > div { right: auto; left: 0; }
  .ai-import-batch-card { padding: 12px; }
  .ai-import-batch-card-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ai-import-batch-correction-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .navbar,
  .app-topbar,
  .btn,
  .nav-backdrop { display: none !important; }
  body:not(.login-page) { padding: 0; background: #fff !important; }
  .container,
  .profile-wrap { max-width: none; padding: 0; }
  .card { break-inside: avoid; box-shadow: none; }
}
