:root {
  --bg: #F6F6F6;
  --bg-soft: #ffffff;
  --primary: #AD093D;
  --blue: #C05D7E;
  --muted: #C4C2C2;
  --text: #5A2236;
  --text-muted: #7B4A5D;
  --surface-tint: #FAEDF2;
  --surface-soft: #FDF7FA;
  --surface-track: #F5E8EE;
  --shadow: 0 16px 40px rgba(23, 32, 43, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Futura, "Futura PT", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at 0% 0%, rgba(173, 9, 61, 0.08), transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(173, 9, 61, 0.05), transparent 30%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.landing {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
  position: relative;
  overflow: hidden;
  isolation: isolate;
  transition: background 0.18s ease, transform 0.18s ease;
}

.landing::before,
.landing::after {
  content: "";
  position: absolute;
  left: -15%;
  width: 130%;
  height: 46%;
  border-radius: 45% 55% 40% 60% / 60% 45% 55% 40%;
  z-index: -1;
  filter: blur(1px);
}

.landing::before {
  top: 10%;
  background: linear-gradient(120deg, rgba(173, 9, 61, 0.18) 0%, rgba(173, 9, 61, 0.03) 65%);
  animation: landingWaveA 12s ease-in-out infinite alternate;
}

.landing::after {
  bottom: 6%;
  background: linear-gradient(120deg, rgba(173, 9, 61, 0.12) 0%, rgba(214, 111, 146, 0.04) 68%);
  animation: landingWaveB 14s ease-in-out infinite alternate;
}

.landing.login-burst {
  background:
    radial-gradient(circle at 18% 22%, rgba(173, 9, 61, 0.16), transparent 28%),
    radial-gradient(circle at 82% 78%, rgba(214, 111, 146, 0.12), transparent 26%),
    var(--bg);
}

.landing.login-burst::before {
  animation: loginWaveScreenA 0.42s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  filter: blur(0);
}

.landing.login-burst::after {
  animation: loginWaveScreenB 0.46s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  filter: blur(0);
}

.landing-card {
  width: min(520px, 100%);
  background: linear-gradient(145deg, #fff 0%, #f9f1f4 100%);
  border: 1px solid rgba(173, 9, 61, 0.18);
  border-radius: 22px;
  padding: 1.2rem;
  box-shadow: var(--shadow);
  position: relative;
  transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.landing-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.6) 46%, transparent 100%);
  transform: translateX(-130%);
  opacity: 0;
  pointer-events: none;
}

@keyframes landingWaveA {
  0% { transform: translate3d(-1%, 0, 0) rotate(-2deg) scale(1); }
  50% { transform: translate3d(2%, -3%, 0) rotate(1deg) scale(1.03); }
  100% { transform: translate3d(0, 2%, 0) rotate(-1deg) scale(1.01); }
}

@keyframes landingWaveB {
  0% { transform: translate3d(0, 0, 0) rotate(1deg) scale(1); }
  50% { transform: translate3d(-2%, 3%, 0) rotate(-1deg) scale(1.02); }
  100% { transform: translate3d(1%, -2%, 0) rotate(2deg) scale(1.01); }
}

@keyframes loginSweep {
  0% {
    transform: translateX(-130%);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  100% {
    transform: translateX(130%);
    opacity: 0;
  }
}

@keyframes loginShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}

@keyframes loginWaveScreenA {
  0% {
    transform: translate3d(-2%, 0, 0) scale(1);
    opacity: 0.35;
  }
  38% {
    transform: translate3d(2%, -3%, 0) scale(1.14);
    opacity: 0.72;
  }
  100% {
    transform: translate3d(6%, -6%, 0) scale(1.24);
    opacity: 0;
  }
}

@keyframes loginWaveScreenB {
  0% {
    transform: translate3d(2%, 0, 0) scale(1);
    opacity: 0.34;
  }
  42% {
    transform: translate3d(-3%, 4%, 0) scale(1.13);
    opacity: 0.68;
  }
  100% {
    transform: translate3d(-7%, 7%, 0) scale(1.22);
    opacity: 0;
  }
}

.landing-brand {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.landing-brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.landing-form {
  margin-top: 0.8rem;
  display: grid;
  gap: 0.55rem;
}

.landing-exit .landing-card {
  transform: translateY(-10px) scale(0.985);
  opacity: 0;
  filter: blur(4px);
  box-shadow: 0 30px 60px rgba(23, 32, 43, 0.12);
}

.landing-card.login-success-flash::after {
  animation: loginSweep 0.34s ease forwards;
}

.landing-card.login-success-flash {
  box-shadow: 0 20px 48px rgba(173, 9, 61, 0.16);
}

.landing-card.login-error-shake {
  animation: loginShake 0.22s ease;
}

#appShell.app-enter {
  opacity: 0;
  transform: translateY(14px);
}

#appShell.app-enter.app-enter-active {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.2rem;
  padding: 1rem 1.2rem 1.1rem;
  background: linear-gradient(120deg, #fff 0%, #fdf6f8 100%);
  border-bottom: 1px solid rgba(173, 9, 61, 0.18);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
}

.brand-kicker {
  margin: 0;
  color: var(--blue);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.brand h1 {
  margin: 0.1rem 0 0;
  font-size: 1.75rem;
  color: var(--primary);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 0.78rem;
}

.brand-mark {
  width: 62px;
  height: 62px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #ffffff;
  box-shadow: 0 10px 25px rgba(173, 9, 61, 0.3);
  border: 1px solid rgba(196, 194, 194, 0.6);
  padding: 0.35rem;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.auth {
  display: flex;
  gap: 0.5rem;
  background: #ffffff;
  border: 1px solid rgba(196, 194, 194, 0.6);
  border-radius: 999px;
  padding: 0.35rem;
  box-shadow: var(--shadow);
}

.user-badge {
  margin: 0;
  min-width: 40px;
  height: 40px;
  padding: 0 0.65rem;
  border-radius: 999px;
  background: linear-gradient(135deg, #ffffff 0%, var(--surface-tint) 100%);
  border: 1px solid rgba(173, 9, 61, 0.22);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(173, 9, 61, 0.08);
}

.user-menu-wrap {
  position: relative;
}

.user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  min-width: 220px;
  background: #ffffff;
  border: 1px solid rgba(196, 194, 194, 0.55);
  border-radius: 12px;
  padding: 0.45rem;
  box-shadow: var(--shadow);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.user-menu .btn-subtle {
  width: 100%;
  text-align: left;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(25, 33, 42, 0.42);
  display: grid;
  place-items: center;
  z-index: 120;
  padding: 1rem;
}

.overlay-card {
  width: min(460px, 100%);
  background: #ffffff;
  border: 1px solid rgba(196, 194, 194, 0.55);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 1rem;
}

.overlay-card h3 {
  margin: 0 0 0.5rem;
}

.success-overlay-card {
  width: min(520px, 100%);
  border-color: rgba(48, 136, 93, 0.22);
  background: linear-gradient(145deg, #ffffff 0%, #f6fcf9 100%);
}

.success-overlay-head {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  margin-bottom: 0.9rem;
}

.success-badge {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #C43A6A 0%, var(--primary) 100%);
  color: #fff;
  font-size: 1.35rem;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(173, 9, 61, 0.18);
  flex: 0 0 auto;
}

.success-summary-list {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.95rem;
}

.success-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(196, 194, 194, 0.38);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
}

.success-summary-label {
  color: var(--text);
  font-size: 0.95rem;
}

.success-summary-value {
  color: var(--primary);
  font-weight: 700;
  font-size: 1rem;
}

.ui-dialog-card {
  width: min(560px, 100%);
}

.ui-dialog-head {
  margin-bottom: 0.3rem;
}

.ui-dialog-head h3 {
  margin: 0;
}

.ui-dialog-message {
  display: grid;
  gap: 0.45rem;
  margin: 0.25rem 0 0.9rem;
}

.ui-dialog-message-line {
  color: var(--text);
  line-height: 1.45;
  padding: 0.15rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.ui-dialog-message-line.is-emphasis {
  color: var(--primary);
  font-weight: 700;
}

.ui-dialog-message-line.is-link {
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(196, 194, 194, 0.4);
  border-radius: 12px;
  background: var(--surface-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.86rem;
}

.ui-dialog-card.dialog-tone-success {
  border-color: rgba(48, 136, 93, 0.24);
  background: linear-gradient(145deg, #ffffff 0%, #f6fcf9 100%);
}

.ui-dialog-card.dialog-tone-warning {
  border-color: rgba(173, 137, 9, 0.24);
  background: linear-gradient(145deg, #ffffff 0%, #fffaf2 100%);
}

.ui-dialog-card.dialog-tone-danger {
  border-color: rgba(173, 9, 61, 0.2);
  background: linear-gradient(145deg, #ffffff 0%, #fff7fa 100%);
}

#uiDialogForm {
  display: grid;
  gap: 0.85rem;
  margin-top: 0.35rem;
}

#uiDialogForm label {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 0.95rem;
  color: var(--text);
  font-weight: 600;
}

#uiDialogForm label input,
#uiDialogForm label select {
  width: 100%;
  min-width: 0;
}

#uiDialogForm > input,
#uiDialogForm > select {
  width: 100%;
}

#uiDialogActions {
  margin-top: 1rem;
  display: flex;
  gap: 0.7rem;
  flex-wrap: wrap;
}

#userAdminPanel .actions.import-card {
  margin-bottom: 0.8rem;
}

.user-admin-card {
  padding: 0.75rem 0.8rem;
  border-radius: 16px;
  background: linear-gradient(145deg, #fff 0%, #f8fbfe 100%);
}

.user-admin-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.user-admin-identity {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  min-width: 200px;
}

.user-admin-name {
  color: var(--text);
  font-size: 1rem;
}

.user-admin-mail {
  color: var(--text-muted);
  font-size: 0.88rem;
}

.user-admin-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.role-chip {
  font-size: 0.79rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.role-admin {
  color: #7a1a3a;
  background: #fceaf0;
}

.role-advanced {
  color: #7d4c08;
  background: #fff4de;
}

.role-basic {
  color: #3f5f73;
  background: #eef6fb;
}

.user-admin-actions {
  margin-top: 0.55rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.42rem;
}

.user-admin-actions button {
  min-width: 122px;
}

.auth .hint {
  margin: 0;
  align-self: center;
  padding: 0 0.4rem;
}

input, select, button {
  padding: 0.6rem 0.75rem;
  border: 1px solid #d4d4d4;
  border-radius: 12px;
  font-family: inherit;
  color: var(--text);
  background: #ffffff;
}

input:focus, select:focus {
  outline: none;
  border-color: rgba(173, 9, 61, 0.5);
  box-shadow: 0 0 0 3px rgba(173, 9, 61, 0.1);
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(130deg, #ffffff 0%, var(--surface-tint) 100%);
  color: var(--text);
  cursor: pointer;
  border: 1px solid rgba(173, 9, 61, 0.24);
  line-height: 1.2;
  min-height: 38px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.2s ease;
  box-shadow: 0 6px 14px rgba(173, 9, 61, 0.1);
}

.btn-main,
.save-btn {
  background: linear-gradient(135deg, #C43A6A 0%, var(--primary) 100%);
  color: #ffffff;
  border-color: rgba(173, 9, 61, 0.92);
  box-shadow: 0 8px 18px rgba(173, 9, 61, 0.16);
}

.btn-main:hover,
.btn-main:focus-visible,
.save-btn:hover,
.save-btn:focus-visible {
  background: linear-gradient(135deg, #CF4A79 0%, #B70F47 100%);
  color: #ffffff;
  border-color: rgba(173, 9, 61, 1);
  box-shadow:
    0 0 0 3px rgba(173, 9, 61, 0.12),
    0 10px 20px rgba(173, 9, 61, 0.18);
}

.edit-btn {
  background: linear-gradient(130deg, #ffffff 0%, var(--surface-tint) 100%);
  color: var(--text);
  border-color: rgba(173, 9, 61, 0.28);
  box-shadow: 0 5px 12px rgba(173, 9, 61, 0.08);
}

.edit-btn:hover,
.edit-btn:focus-visible {
  background: linear-gradient(130deg, #ffffff 0%, #F8E8EE 55%, var(--surface-soft) 100%);
  color: var(--text);
  border-color: rgba(173, 9, 61, 0.35);
}

.btn-subtle,
.cancel-btn {
  background: #ffffff;
  color: var(--text-muted);
  border: 1px solid rgba(173, 9, 61, 0.14);
  box-shadow: none;
}

.btn-subtle:hover,
.btn-subtle:focus-visible,
.cancel-btn:hover,
.cancel-btn:focus-visible {
  background: var(--surface-soft);
  color: var(--text);
  border-color: rgba(173, 9, 61, 0.22);
  box-shadow: 0 0 0 3px rgba(173, 9, 61, 0.06);
}

#landingLoginBtn {
  position: relative;
  overflow: hidden;
  min-height: 46px;
}

#landingLoginBtn.is-loading {
  background: linear-gradient(135deg, #C05D7E, #AD093D);
  color: #fff;
  box-shadow: 0 12px 24px rgba(173, 9, 61, 0.14);
}

#landingLoginBtn.is-loading::after {
  content: "";
  width: 16px;
  height: 16px;
  margin-left: 0.55rem;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  display: inline-block;
  vertical-align: -3px;
  animation: spin 0.48s linear infinite;
}

#landingLoginBtn.is-success {
  background: linear-gradient(135deg, #C43A6A 0%, var(--primary) 100%);
  color: #fff;
  box-shadow: 0 14px 28px rgba(173, 9, 61, 0.18);
}

button:hover {
  filter: brightness(1.01);
  border-color: rgba(173, 9, 61, 0.35);
  background: linear-gradient(130deg, #ffffff 0%, #F8E8EE 55%, var(--surface-soft) 100%);
  box-shadow: 0 8px 18px rgba(173, 9, 61, 0.12);
  transform: translateY(-1px);
}

button:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(173, 9, 61, 0.18),
    0 8px 18px rgba(173, 9, 61, 0.14);
}

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

.tabs {
  display: flex;
  gap: 0.6rem;
  padding: 0.85rem 1rem 0.95rem;
  background: transparent;
  overflow-x: auto;
}

.tabs button {
  background: #ffffff;
  color: var(--blue);
  border: 1px solid rgba(173, 9, 61, 0.18);
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(173, 9, 61, 0.08);
  padding: 0.72rem 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.tabs button.active {
  background: var(--primary);
  color: #fff;
  border-color: transparent;
}

main { padding: 0.45rem 1rem 1.2rem; }
.tab-panel { display: none; }
.tab-panel.active {
  display: block;
  background: var(--bg-soft);
  border: 1px solid rgba(196, 194, 194, 0.4);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: var(--shadow);
  padding: 1rem;
}

.tab-panel.active h2,
.tab-panel.active h3,
.tab-panel.active h4 {
  color: var(--text-muted);
}

#master h2,
#master h3,
#master h4 {
  color: var(--text);
}

.tab-panel.active input,
.tab-panel.active select,
.tab-panel.active textarea {
  color: var(--text);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dashboard-welcome {
  margin: 0.3rem 0 1rem;
  font-size: 2.45rem;
  color: var(--text);
}

.dashboard-search-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 0.75rem;
  align-items: center;
  margin: 0 0 1rem;
  padding: 0.95rem 1rem;
  border: 1px solid rgba(173, 9, 61, 0.16);
  border-radius: 18px;
  background: linear-gradient(145deg, #ffffff 0%, var(--surface-soft) 100%);
}

.dashboard-search-card input {
  min-height: 54px;
  font-size: 1.02rem;
  padding: 0.85rem 1rem;
}

.dashboard-search-card button {
  min-height: 54px;
  padding: 0.85rem 1.1rem;
}

.card {
  background: linear-gradient(145deg, #fff 0%, var(--surface-soft) 100%);
  border: 1px solid rgba(196, 194, 194, 0.5);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  position: relative;
  overflow: hidden;
  min-height: 142px;
  display: flex;
  flex-direction: column;
}

.card::after {
  content: "";
  position: absolute;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  right: -14px;
  top: -14px;
  background: rgba(173, 9, 61, 0.12);
}

.card h3 {
  margin: 0;
  color: var(--text-muted);
}

.card p { font-size: 1.6rem; margin: 0.3rem 0 0; }

.cards .card[data-metric] {
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.cards .card[data-metric]:hover,
.cards .card[data-metric]:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(173, 9, 61, 0.45);
  box-shadow: 0 12px 24px rgba(173, 9, 61, 0.16);
  outline: none;
}

.card-action {
  margin-top: auto;
  padding: 0.4rem 0.56rem;
  border-radius: 10px;
  font-size: 0.8rem;
}

.import-summary-cards .card {
  min-height: 110px;
}

.import-summary-cards .card p {
  font-size: 1.45rem;
}

.import-step {
  margin-bottom: 0.75rem;
}

#dashboardDetailWrap {
  margin-bottom: 0.8rem;
}

.dashboard-audit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
}

.audit-filters {
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  gap: 0.45rem;
}

.audit-filters select {
  min-width: 130px;
}

#auditWrap {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid rgba(196, 194, 194, 0.45);
  border-radius: 12px;
  background: #ffffff;
  padding: 0.35rem;
}

#audit {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.audit-line {
  font-size: 0.86rem;
  color: var(--text);
  padding: 0.34rem 0.45rem;
  border-radius: 10px;
  border: 1px solid rgba(196, 194, 194, 0.4);
  background: #fffafb;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: #ffffff;
  border: 1px solid rgba(196, 194, 194, 0.45);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td {
  border-bottom: 1px solid rgba(196, 194, 194, 0.45);
  padding: 0.62rem;
  text-align: left;
  vertical-align: middle;
}
th {
  background: var(--surface-tint);
  color: var(--text);
}
tr:last-child td {
  border-bottom: none;
}

#pricesTable tr.manual-price-row td {
  background: #FBEFF4;
}

.table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.62rem;
  margin-bottom: 0.35rem;
}

.price-toggles-row {
  margin-top: -0.15rem;
  margin-bottom: 0.25rem;
  display: flex;
  flex-wrap: nowrap;
  justify-content: flex-start;
  align-items: center;
  gap: 0.55rem;
  width: fit-content;
}

.condition-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.65rem;
}

.cond-toggle-item {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.22rem;
  font-size: 0.9rem;
  color: var(--text);
  margin: 0;
  text-align: left;
  line-height: 1.1;
  white-space: nowrap;
  flex: 0 0 auto !important;
  width: auto !important;
  max-width: max-content;
}

input[type="checkbox"] {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  width: 16px;
  height: 16px;
  min-width: 16px;
  box-shadow: none !important;
  appearance: auto;
  -webkit-appearance: checkbox;
}

.price-toggles-row input[type="checkbox"] {
  min-width: 0 !important;
  flex: 0 0 auto !important;
}

input[type="checkbox"]:focus,
input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: none !important;
}

#mappingEditor label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
  font-size: 0.9rem;
}

#pricesTable th,
#pricesTable td {
  padding: 0.42rem 0.5rem;
  color: var(--text);
}

.prices-table-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  border: 1px solid rgba(196, 194, 194, 0.45);
  border-radius: 18px;
  overflow: hidden;
  margin-bottom: 0.85rem;
  background: linear-gradient(180deg, rgba(248, 251, 253, 0.88) 0%, rgba(255, 255, 255, 0.96) 100%);
}

.prices-table-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  scrollbar-gutter: stable;
}

.prices-table-wrap::-webkit-scrollbar {
  height: 10px;
}

.prices-table-wrap::-webkit-scrollbar-track {
  background: var(--surface-track);
  border-top: 1px solid rgba(196, 194, 194, 0.35);
}

.prices-table-wrap::-webkit-scrollbar-thumb {
  background: rgba(173, 9, 61, 0.32);
  border-radius: 999px;
  border: 2px solid var(--surface-track);
}

.prices-actions-wrap {
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(196, 194, 194, 0.45);
  background: #ffffff;
}

.prices-actions-wrap::after {
  content: "";
  display: block;
  flex: 0 0 10px;
  background: #eef3f7;
  border-top: 1px solid rgba(196, 194, 194, 0.35);
}

#pricesTable,
#pricesActionTable {
  border: none;
  border-radius: 0;
  background: transparent;
}

#pricesTable {
  width: max-content;
  min-width: 100%;
}

#pricesActionTable {
  width: 176px;
  min-width: 176px;
  max-width: 176px;
  table-layout: fixed;
}

#pricesTable th,
#pricesActionTable th {
  line-height: 1.15;
}

#pricesTable thead tr:first-child th,
#pricesActionTable thead tr:first-child th {
  height: 52px;
}

#pricesTable .filter-row th,
#pricesActionTable .filter-row th {
  height: 52px;
  padding: 0.35rem 0.4rem;
  background: var(--surface-soft);
}

#pricesTable tbody tr,
#pricesActionTable tbody tr {
  height: 62px;
}

#pricesTable input,
#pricesTable select {
  padding: 0.4rem 0.45rem;
  min-width: 88px;
}

#pricesTable .filter-row input,
#pricesTable .filter-row select {
  min-width: 78px;
  width: 100%;
  padding: 0.34rem 0.4rem;
  font-size: 0.82rem;
}

#pricesTable th.price-col-head,
#pricesTable td.price-value-cell,
#pricesTable .filter-row th.price-filter-cell {
  width: 108px;
  min-width: 108px;
  max-width: 108px;
}

#pricesTable .filter-row th.price-filter-cell input {
  min-width: 0;
  width: 100%;
  text-align: right;
}

#pricesTable .price-name-input {
  min-width: 260px;
  width: min(32vw, 420px);
}

#pricesTable .price-manual-vk-input {
  min-width: 110px;
  width: 110px;
  text-align: right;
}

#pricesActionTable th,
#pricesActionTable td {
  padding: 0.42rem 0.5rem;
  color: var(--text);
}

#pricesActionTable .action-col-head {
  background: var(--surface-tint);
  text-align: center;
}

#pricesActionTable .action-col-filter {
  background: var(--surface-soft);
}

#pricesActionTable tbody td {
  background: #ffffff;
}

#pricesActionTable tbody tr.manual-price-row td {
  background: #FBEFF4;
}

.action-cell-inner {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  white-space: nowrap;
  flex-wrap: nowrap;
  width: 100%;
}

.price-action-btn {
  min-height: 30px;
  padding: 0.34rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: none;
}

#manualProductName {
  min-width: 220px;
  flex: 1 1 220px;
}

#manualProductSkuZumstein,
#manualProductVkA {
  min-width: 140px;
}

.csv-import-head {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.hidden-file-input {
  display: none;
}

.inline-info {
  position: relative;
  display: inline-flex;
}

.inline-info summary {
  list-style: none;
  width: 1.5rem;
  min-width: 1.5rem;
  max-width: 1.5rem;
  height: 1.5rem;
  min-height: 1.5rem;
  max-height: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(173, 9, 61, 0.22);
  border-radius: 50%;
  color: var(--text);
  cursor: pointer;
  background: var(--surface-soft);
  font-weight: 700;
  line-height: 1;
  padding: 0;
  box-sizing: border-box;
  flex: 0 0 1.5rem;
}

.inline-info summary::-webkit-details-marker {
  display: none;
}

.inline-info-body {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 20;
  width: min(26rem, 70vw);
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(196, 194, 194, 0.45);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  box-shadow: 0 12px 24px rgba(173, 9, 61, 0.1);
}

#effective .actions.import-card {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.table-tools input {
  min-width: 250px;
  flex: 1;
}

th input[type="checkbox"] {
  transform: scale(1.05);
}

.hint {
  color: var(--text-muted);
  margin: 0.65rem 0 0.1rem;
}

.hidden {
  display: none !important;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

.pagination p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.94rem;
}

.pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.grid-3 {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 1rem 1.1rem;
}

.grid-3 > div {
  flex: 0 0 auto;
  min-width: 320px;
  max-width: 430px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-bottom: 0.9rem;
}

.import-finish-actions {
  margin-top: 1rem;
  padding-top: 0.15rem;
}

.actions p {
  margin: 0;
}

.dropzone {
  border: 2px dashed rgba(173, 9, 61, 0.42);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  background: linear-gradient(120deg, #ffffff 0%, var(--surface-soft) 100%);
  min-width: 260px;
  transition: border-color 0.2s ease, background 0.2s ease;
  flex: 1;
}

.format-hints {
  background: var(--surface-soft);
  border: 1px solid rgba(173, 9, 61, 0.14);
  border-radius: 14px;
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.75rem;
}

.format-hints p {
  margin: 0.2rem 0;
  color: var(--text);
  font-size: 0.93rem;
}

.import-card {
  background: #ffffff;
  border: 1px solid rgba(196, 194, 194, 0.5);
  border-radius: 14px;
  padding: 0.7rem;
}

#newAiConnectionName {
  min-width: 280px;
  flex: 1 1 280px;
}

#imports .actions {
  background: #ffffff;
  border: 1px solid rgba(196, 194, 194, 0.45);
  border-radius: 14px;
  padding: 0.7rem;
  margin-bottom: 0.7rem;
  align-items: center;
}

#imports .actions.import-card {
  border-color: rgba(196, 194, 194, 0.55);
  background: linear-gradient(145deg, #fff 0%, #f7fafc 100%);
}

.connections-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.connection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: #ffffff;
  border: 1px solid rgba(196, 194, 194, 0.55);
  border-radius: 12px;
  padding: 0.5rem 0.7rem;
}

.status-active,
.status-inactive,
.status-unknown {
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
}

.status-active {
  color: #1f6a45;
  background: #eaf8f1;
}

.status-inactive {
  color: var(--text-muted);
  background: #FCF1F5;
}

.status-unknown {
  color: var(--text-muted);
  background: var(--surface-tint);
}

.ai-inline-row {
  align-items: center;
  flex-wrap: wrap;
  overflow: visible;
  gap: 0.5rem;
}

.ai-inline-row button {
  white-space: nowrap;
  min-height: 36px;
  line-height: 1.2;
}

.ai-status-pill {
  margin-left: 0;
  text-align: left;
  align-self: center;
}

.ai-status-pill.status-active {
  color: #1f6b3c;
  background: #e9f7ef;
  border: 1px solid rgba(31, 107, 60, 0.18);
}

.import-card textarea {
  width: 100%;
  min-height: 72px;
  border: 1px solid #d4d4d4;
  border-radius: 12px;
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  resize: vertical;
}

.progress {
  width: 100%;
  height: 12px;
  background: var(--surface-track);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.4rem 0 0.9rem;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #D67B9A, #AD093D);
  transition: width 0.12s ease;
}

.info-toggle {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.5rem;
}

.info-btn {
  width: 28px;
  min-width: 28px;
  max-width: 28px;
  height: 28px;
  min-height: 28px;
  max-height: 28px;
  border-radius: 50%;
  padding: 0;
  font-weight: 700;
  line-height: 1;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 28px;
}

.file-input-hidden {
  position: absolute;
  left: -9999px;
}

.file-picker-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.62rem 0.9rem;
  border-radius: 12px;
  border: 1px solid rgba(173, 9, 61, 0.22);
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(173, 9, 61, 0.12);
}

.file-picker-btn:hover {
  background: var(--surface-soft);
}

.record {
  background: #ffffff;
  border: 1px solid rgba(196, 194, 194, 0.55);
  border-radius: 14px;
  padding: 0.55rem 0.6rem;
  margin-bottom: 0.4rem;
  position: relative;
  display: block;
  width: 100%;
}

.record-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  flex-wrap: wrap;
}

#groups .record-row[id^="group-row-"],
#catalog .record-row[id^="catalog-row-"],
#classes .record-row[id^="class-row-"] {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) max-content max-content max-content;
  align-items: center;
  gap: 0.6rem;
}

.record-row label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.record-row input {
  min-width: 0;
  padding: 0.42rem 0.5rem;
}

.record-row input[readonly] {
  background: var(--surface-soft);
  color: var(--text);
  border-color: rgba(173, 9, 61, 0.12);
}

.record-row input[type="number"] {
  max-width: 110px;
}

.record-row button {
  padding: 0.42rem 0.58rem;
  font-size: 0.86rem;
  line-height: 1.2;
  white-space: nowrap;
}

#groups .record-row[id^="group-row-"] button,
#catalog .record-row[id^="catalog-row-"] button,
#classes .record-row[id^="class-row-"] button {
  justify-self: start;
}

#groups .record-row[id^="group-row-"] .btn-subtle,
#catalog .record-row[id^="catalog-row-"] .btn-subtle,
#classes .record-row[id^="class-row-"] .btn-subtle {
  margin-left: 0.08rem;
}

.factors-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
  margin-top: 0.9rem;
}

.factor-col {
  background: linear-gradient(145deg, #ffffff 0%, var(--surface-soft) 100%);
  border: 1px solid rgba(196, 194, 194, 0.55);
  border-radius: 16px;
  padding: 0.75rem;
}

.factor-col > h3 {
  margin: 0 0 0.55rem;
}

#vkFactors,
#ekFactors {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

#vkFactors .record,
#ekFactors .record {
  margin-bottom: 0;
}

#vkFactors .record h4,
#ekFactors .record h4 {
  margin: 0 0 0.55rem;
  color: var(--text);
}

#vkFactors .record-row strong,
#ekFactors .record-row strong {
  color: var(--text);
  font-weight: 700;
}

#pricing-vk-settings-row,
#pricing-ek-settings-row {
  align-items: flex-end;
}

#pricing-vk-settings-row label,
#pricing-ek-settings-row label {
  flex: 1 1 120px;
  min-width: 112px;
}

#vkFactors .record-row[id^="vk-class-row-"],
#ekFactors .record-row[id^="ek-class-row-"] {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 92px auto auto auto;
  align-items: center;
  gap: 0.45rem;
}

#vkFactors .record-row[id^="cond-row-"] {
  display: grid;
  grid-template-columns: 42px 92px max-content max-content max-content max-content;
  align-items: center;
  gap: 0.55rem;
  justify-content: start;
}

#vkFactors .record-row[id^="cond-row-"] .edit-btn,
#vkFactors .record-row[id^="cond-row-"] .save-btn,
#vkFactors .record-row[id^="cond-row-"] .cancel-btn,
#vkFactors .record-row[id^="cond-row-"] .delete-cond-btn {
  min-width: 96px;
  max-width: 96px;
  width: 96px;
  justify-self: start;
  justify-content: center;
}

#cond-create-row {
  display: grid;
  grid-template-columns: 120px 92px max-content;
  align-items: center;
  gap: 0.6rem;
  justify-content: start;
  margin-top: 0.4rem;
  padding-top: 0.15rem;
}

#cond-create-row input {
  min-width: 0;
}

.cond-code {
  width: 36px;
  color: var(--text);
}

.delete-icon-btn {
  position: static;
  transform: none;
  margin-left: 0.2rem;
  width: 34px;
  height: 34px;
  max-width: 34px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  background: #b30a3f;
  font-size: 0.95rem;
}

.record:hover .delete-icon-btn {
  opacity: 1;
  pointer-events: auto;
}

#groups,
#catalog,
#classes,
#conditions,
#aiConnectionsList {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

@media (max-width: 700px) {
  .topbar { flex-direction: column; align-items: flex-start; }
  .auth {
    width: 100%;
    flex-wrap: wrap;
    border-radius: var(--radius);
  }
  .tab-panel.active {
    padding: 0.75rem;
  }
  .factors-two-col {
    grid-template-columns: 1fr;
  }
  #vkFactors .record-row[id^="vk-class-row-"],
  #ekFactors .record-row[id^="ek-class-row-"] {
    grid-template-columns: 1fr;
  }
  #vkFactors .record-row[id^="cond-row-"] {
    grid-template-columns: 1fr;
  }
  #cond-create-row {
    grid-template-columns: 1fr;
  }
  #groups .record-row[id^="group-row-"],
  #catalog .record-row[id^="catalog-row-"],
  #classes .record-row[id^="class-row-"] {
    grid-template-columns: 1fr;
  }
  .dashboard-search-card {
    grid-template-columns: 1fr;
  }
  #uiDialogForm label {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }
}
