:root {
  color-scheme: light;
  --bg: #edf3f1;
  --surface: #f9fcfb;
  --ink: #14212c;
  --muted: #607174;
  --line: #cbd9d8;
  --accent: #07927f;
  --accent-dark: #075e58;
  --brand-deep: #0b1c32;
  --brand-mid: #123b73;
  --brand-blue: #2f43a8;
  --gold: #d4a64b;
  --gold-soft: #fff3d4;
  --warn: #a86400;
  --danger: #a53a3a;
  --soft: #e7f3ef;
  --shadow: 0 18px 48px rgba(15, 35, 52, 0.14);
  --button-gradient: linear-gradient(135deg, #304bb3 0%, #0f6f9d 48%, #087568 100%);
  --panel-gradient: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, rgba(239, 247, 245, 0.96) 100%);
  --header-gradient: linear-gradient(135deg, #0f2440 0%, #304bb3 48%, #087568 100%);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 8%, rgba(47, 63, 153, 0.12) 0 14%, transparent 34%),
    radial-gradient(circle at 92% 16%, rgba(200, 148, 47, 0.14) 0 10%, transparent 30%),
    linear-gradient(180deg, #e6eeee 0%, #f4f7f5 44%, #eaf1ef 100%);
  color: var(--ink);
  font-family: "Hiragino Sans GB", "PingFang SC", "Microsoft YaHei", "Avenir Next", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f8f7 100%);
  color: var(--ink);
  min-height: 36px;
  padding: 0 12px;
  cursor: pointer;
  font-weight: 650;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

button:hover,
.tab-link:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
  transform: translateY(-1px);
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 36px 18px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 100%),
    linear-gradient(145deg, #071421 0%, #0d263f 54%, #0a3f3b 100%);
  background-size: 32px 32px, auto;
  animation: loginBackdrop 18s ease-in-out infinite alternate;
}

.login-shell {
  width: min(940px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) 390px;
  overflow: hidden;
  border: 1px solid rgba(210, 226, 238, 0.22);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 70px rgba(0, 10, 26, 0.38);
}

.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 54px;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.login-card {
  position: relative;
  overflow: hidden;
  width: 100%;
  border: 0;
  border-left: 1px solid rgba(183, 207, 224, 0.28);
  border-radius: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99) 0%, rgba(247, 250, 252, 0.99) 100%);
  box-shadow: none;
  padding: 44px 34px 26px;
  animation: loginCardIn 0.7s ease-out both;
}

.login-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, #123b73 0%, #1c75bc 58%, #10a9b8 100%);
}

.login-system {
  margin: 0;
  color: #ffffff;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.18;
  font-weight: 850;
  letter-spacing: 0;
}

.login-subtitle {
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.login-intro-title {
  margin: 48px 0 0;
  max-width: 430px;
  color: #f7fbff;
  font-size: 28px;
  line-height: 1.35;
  font-weight: 820;
}

.login-intro-text {
  margin: 13px 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 15px;
  line-height: 1.6;
}

.login-form-head {
  margin-bottom: 28px;
}

.login-form-head p {
  margin: 0;
  color: #0b1c32;
  font-size: 24px;
  font-weight: 850;
}

.login-form-head span {
  display: block;
  margin-top: 8px;
  color: #6d7a85;
  font-size: 13px;
}

.login-company {
  margin: 18px 0 0;
  color: #6f7c88;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.login-brand {
  align-items: center;
  flex-direction: row;
  gap: 14px;
}

.login-brand-copy {
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
  width: 86px;
  height: 86px;
  border-radius: 14px;
  background:
    linear-gradient(180deg, #ffffff 0%, #eef4fb 100%);
  border: 1px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 16px 38px rgba(15, 31, 64, 0.24);
  padding: 7px;
}

.login-brand .brand-mark {
  width: 72px;
  height: 72px;
  border-radius: 14px;
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 16px 32px rgba(0, 9, 22, 0.28);
  animation: none;
}

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

.login-fields {
  display: grid;
  gap: 15px;
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.login-decoy {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.login-fields label {
  display: grid;
  gap: 6px;
}

.login-fields span {
  color: #536272;
  font-size: 13px;
  font-weight: 650;
}

.login-fields input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #d5e0e6;
  border-radius: 8px;
  background: #ffffff;
  color: #132235;
  padding: 0 14px;
  outline: none;
  box-shadow: 0 1px 0 rgba(16, 35, 55, 0.03) inset;
}

.login-fields input:focus {
  border-color: #1c75bc;
  box-shadow: 0 0 0 3px rgba(28, 117, 188, 0.12);
}

.remember-login {
  display: flex !important;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin-top: -3px;
  color: #536272;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.remember-login input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  min-height: 16px;
  margin: 0;
  padding: 0;
  accent-color: #1c75bc;
  cursor: pointer;
}

.remember-login span {
  color: #536272;
  font-size: 13px;
  font-weight: 700;
}

.login-submit {
  width: 100%;
  margin-top: 20px;
  background: linear-gradient(135deg, #0b1c32 0%, #123b73 100%);
  border-color: rgba(18, 59, 115, 0.42);
  border-radius: 8px;
  color: #fff;
  min-height: 47px;
  box-shadow: 0 12px 26px rgba(18, 59, 115, 0.22);
}

.login-submit:hover {
  background: linear-gradient(135deg, #123b73 0%, #0f6f9d 100%);
  color: #fff;
}

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

.app-shell {
  min-height: 100vh;
  padding: 28px;
}

.workspace {
  width: min(1480px, 100%);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(120deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 86% 0%, rgba(245, 207, 127, 0.24) 0 17%, transparent 38%),
    linear-gradient(135deg, #091725 0%, #122a52 36%, #253c96 66%, #087568 100%);
  background-size: 30px 30px, auto, auto;
  box-shadow: 0 14px 34px rgba(11, 35, 51, 0.18);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
  font-family: "Hiragino Sans GB", "PingFang SC", "Microsoft YaHei", "Avenir Next", sans-serif;
}

h1 {
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.1;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
}

.topbar-kicker {
  margin: 10px 0 0;
  color: #f7d384;
  font-size: 21px;
  font-weight: 800;
}

.topbar-subtitle {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 16px;
}

.topbar h1 {
  color: #ffffff;
  font-weight: 900;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.16);
  max-width: 940px;
  font-size: clamp(20px, 2vw, 28px);
  white-space: nowrap;
}

.topbar .brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  padding: 4px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.status-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  flex: 0 0 auto;
}

.status-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 0 12px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
  font-size: 13px;
}

.status-strip button {
  min-height: 34px;
  font-size: 13px;
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}

.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92) 0%, rgba(237, 246, 243, 0.92) 100%);
  padding: 4px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(21, 52, 52, 0.08);
}

.tab-button {
  border: 0;
  min-height: 34px;
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  border-radius: 7px;
  font-weight: 750;
  white-space: normal;
  text-align: center;
  line-height: 1.25;
}

.tab-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 650;
}

.tab-button.is-active {
  background: var(--button-gradient);
  color: #fff;
  box-shadow: 0 8px 20px rgba(36, 86, 166, 0.22);
}

.input-panel,
.settings-card,
.price-panel,
.quote-card,
.quote-table-panel,
.records-panel,
.exchange-panel,
.coupling-panel,
.costs-panel,
.tools-panel,
.users-panel {
  position: relative;
  overflow: hidden;
}

.input-panel::before,
.settings-card::before,
.price-panel::before,
.quote-card::before,
.quote-table-panel::before,
.records-panel::before,
.exchange-panel::before,
.coupling-panel::before,
.costs-panel::before,
.tools-panel::before,
.users-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--gold) 100%);
}

.template-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.template-card {
  display: grid;
  gap: 8px;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #ffffff;
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 10px 24px rgba(21, 52, 52, 0.07);
}

.template-card strong {
  color: #10233b;
  font-size: 18px;
}

.template-card span {
  color: var(--muted);
  line-height: 1.35;
}

.shipping-tabs {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.shipping-tab {
  min-height: 46px;
}

.shipping-tab.is-active {
  background: var(--button-gradient);
  color: #ffffff;
  border-color: transparent;
}

.shipping-subview {
  position: relative;
  z-index: 1;
}

.shipping-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 6px;
  margin-top: 12px;
}

.shipping-summary.compact .summary-pill {
  min-height: 52px;
  padding: 6px 8px;
  border-radius: 7px;
}

.shipping-summary.compact .summary-pill strong {
  font-size: 13px;
}

.shipping-summary.compact .summary-pill span {
  font-size: 11px;
}

.shipping-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.shipping-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.shipping-form label.wide {
  grid-column: span 2;
}

.shipping-form input,
.shipping-form select,
.shipping-form textarea {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0 12px;
}

.shipping-form textarea {
  min-height: 92px;
  padding: 10px 12px;
  resize: vertical;
}

.shipping-form .paste-field {
  grid-column: span 2;
}

.shipping-form button[type="submit"] {
  align-self: end;
  min-height: 42px;
  background: var(--button-gradient);
  color: #ffffff;
  border-color: transparent;
}

.shipping-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.shipping-list {
  display: grid;
  gap: 10px;
}

.shipping-record-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(21, 52, 52, 0.06);
}

.shipping-card-head,
.shipping-record-card > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.shipping-record-card strong {
  color: #10233b;
  overflow-wrap: anywhere;
}

.shipping-record-card p {
  margin: 0;
  color: #087568;
  font-size: 17px;
  font-weight: 900;
}

.shipping-record-card small {
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.shipping-record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.shipping-record-actions button,
.shipping-status-select {
  min-height: 30px;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
}

.shipping-status-select {
  border: 1px solid var(--line);
  background: #ffffff;
  font-weight: 800;
  color: #24405f;
}

.shipping-card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: 10px;
  align-items: center;
}

.shipping-card-body > div {
  display: grid;
  gap: 5px;
}

.waybill-thumb,
.waybill-empty {
  width: 68px;
  height: 68px;
  border: 1px solid rgba(8, 117, 104, 0.18);
  border-radius: 8px;
  overflow: hidden;
  background: #eefaf7;
}

.waybill-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.waybill-empty {
  display: inline-grid;
  place-items: center;
  color: #087568;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.shipping-inline-edit {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(48, 75, 179, 0.16);
  border-radius: 8px;
  background: #f6fbff;
}

.shipping-inline-edit label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.shipping-inline-edit label.wide,
.inline-edit-actions {
  grid-column: 1 / -1;
}

.shipping-inline-edit input,
.shipping-inline-edit select,
.shipping-inline-edit textarea {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  padding: 0 9px;
}

.shipping-inline-edit textarea {
  padding: 8px 9px;
}

.inline-edit-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.inline-edit-actions button {
  min-height: 38px;
}

.paid-tag,
.unpaid-tag {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 850;
}

.paid-tag {
  color: #0f766e;
  background: #dff7ee;
}

.unpaid-tag {
  color: #a86400;
  background: #fff3d4;
}

.page-view[hidden] {
  display: none;
}

.input-panel,
.settings-card,
.price-panel,
.quote-card,
.quote-table-panel,
.records-panel,
.coupling-panel,
.users-panel {
  background: var(--panel-gradient);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.input-panel,
.price-panel,
.quote-card,
.settings-card,
.quote-table-panel,
.records-panel,
.coupling-panel,
.users-panel {
  padding: 18px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  position: relative;
  z-index: 1;
}

.panel-heading h2 {
  color: #10233b;
  font-size: 22px;
  font-weight: 850;
}

.panel-heading.compact {
  margin-bottom: 12px;
}

.cost-search-panel {
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
}

.cost-search-panel label {
  display: grid;
  gap: 8px;
  color: #10233b;
  font-weight: 800;
}

.cost-search-panel input {
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--ink);
  font-size: 18px;
  font-weight: 750;
}

.product-cost-results {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 10px;
}

.cost-heading-actions {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.product-cost-categories {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 0 10px;
  margin: -2px 0 6px;
  scrollbar-width: thin;
}

.cost-add-panel,
.cost-category-panel {
  position: relative;
  z-index: 4;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  margin-bottom: 0;
}

.cost-add-panel summary,
.cost-category-panel summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #10233b;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.cost-add-panel[open],
.cost-category-panel[open] {
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(21, 52, 52, 0.12);
}

.product-cost-form {
  display: grid;
  width: min(760px, calc(100vw - 28px));
  grid-template-columns: minmax(160px, 1fr) minmax(120px, 180px) minmax(160px, 1fr) auto;
  gap: 10px;
  padding: 0 12px 12px;
  align-items: end;
}

.product-cost-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.product-cost-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
}

.cost-category-panel .product-cost-categories {
  width: min(760px, calc(100vw - 28px));
  padding: 0 12px 12px;
  margin: 0;
}

.cost-category-chip,
.cost-model-chip {
  flex: 0 0 auto;
  min-height: 38px;
  border-radius: 999px;
  background: #ffffff;
  color: #18344a;
  border-color: #c7d8d6;
  white-space: nowrap;
}

.cost-category-chip.is-active {
  background: var(--button-gradient);
  color: #ffffff;
  border-color: transparent;
}

.cost-category-chip span {
  color: inherit;
  opacity: 0.72;
  margin-left: 4px;
}

.product-cost-group {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.9);
}

.product-cost-group-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.product-cost-group-head strong {
  color: #10233b;
  font-size: 18px;
}

.product-cost-group-head span {
  color: var(--muted);
  font-size: 13px;
}

.product-cost-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.product-cost-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(21, 52, 52, 0.07);
}

.product-cost-card > div {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.product-cost-card > div > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.product-cost-card strong {
  color: #10233b;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.product-cost-card span,
.product-cost-card small {
  color: var(--muted);
  line-height: 1.35;
}

.product-cost-card p {
  margin: 0;
  color: #087568;
  font-size: 24px;
  font-weight: 900;
}

.mini-action-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfb;
  color: #0f4b55;
  font-size: 14px;
  font-weight: 850;
}

.cost-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-weight: 750;
}

.cost-empty.is-error {
  color: #b91c1c;
  border-color: #fecaca;
  background: #fff1f2;
}

.dimension-search-panel {
  position: relative;
  z-index: 1;
  margin-bottom: 10px;
}

.dimension-search-panel label {
  display: grid;
  gap: 8px;
  color: #10233b;
  font-weight: 850;
}

.dimension-search-panel input {
  width: 100%;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 19px;
  font-weight: 800;
}

.dimension-summary {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 12px;
}

.dimension-results {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.dimension-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(21, 52, 52, 0.07);
}

.dimension-preview {
  width: 78px;
  height: 78px;
  border: 1px solid #c7d8d6;
  border-radius: 8px;
  background: #f7fbfb;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #1f3f78;
  font-weight: 950;
  text-decoration: none;
}

.dimension-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dimension-preview.is-pdf {
  background: linear-gradient(135deg, #eef5ff, #f7fbfb);
}

.dimension-card-body {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.dimension-card-body strong {
  color: #10233b;
  font-size: 17px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.dimension-card-body span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.dimension-models,
.dimension-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dimension-models button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: #ffffff;
  color: #18344a;
  border-color: #c7d8d6;
  font-size: 12px;
  font-weight: 850;
}

.dimension-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  background: #eaf5f3;
  color: #087568;
  text-decoration: none;
  font-size: 13px;
  font-weight: 900;
}

.dimension-empty {
  grid-column: 1 / -1;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  font-weight: 750;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

textarea {
  width: 100%;
  min-height: 190px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9) 0%, rgba(239, 246, 246, 0.92) 100%);
  line-height: 1.6;
}

textarea:focus,
input:focus,
select:focus {
  outline: 3px solid rgba(11, 118, 108, 0.15);
  border-color: var(--accent);
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr);
  gap: 16px;
  margin-top: 16px;
}

.field-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}

.customer-field {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 86px minmax(220px, 420px);
  align-items: center;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--muted);
}

.customer-field span {
  color: #25415a;
  font-weight: 700;
}

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

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #f5faf9 100%);
  color: var(--ink);
  padding: 0 10px;
}

td input + input {
  margin-top: 6px;
}

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

.number-field.wide {
  display: block;
}

.number-field span {
  color: var(--muted);
}

.rule-list {
  display: grid;
  gap: 8px;
}

.rule-list span {
  border-left: 3px solid var(--accent);
  padding-left: 10px;
  color: var(--muted);
  line-height: 1.5;
}

.price-panel {
  margin-top: 16px;
}

.hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.input-panel textarea,
.bulk-body textarea {
  position: relative;
  z-index: 1;
}

.image-recognition-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fbff 0%, #edf7f4 100%);
  padding: 12px;
}

.image-recognition-panel img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
}

.image-recognition-body {
  display: grid;
  gap: 8px;
  align-content: start;
}

.image-recognition-body strong {
  color: var(--brand-deep);
  font-size: 16px;
}

.image-recognition-body p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.image-recognition-body textarea {
  min-height: 92px;
  font-size: 13px;
}

.toolbar button,
#generateQuoteTable,
#saveQuoteRecord,
#copyQuoteTable,
#saveQuoteImage,
#exportRecords,
#saveExchangeRate,
#copyExchangeResult {
  border-color: rgba(8, 117, 104, 0.25);
}

#generateQuoteTable,
#saveQuoteRecord,
#saveExchangeRate {
  background: var(--button-gradient);
  color: #fff;
}

#saveQuoteRecord {
  background: linear-gradient(135deg, #b77a18 0%, #8e5c10 100%);
  border-color: rgba(183, 122, 24, 0.35);
}

#generateQuoteTable:hover,
#saveQuoteRecord:hover,
#saveExchangeRate:hover {
  color: #fff;
  filter: brightness(0.96);
  box-shadow: 0 10px 22px rgba(8, 92, 86, 0.2);
}

#copyQuoteTable,
#saveQuoteImage,
#exportRecords,
#copyExchangeResult {
  background: linear-gradient(180deg, #fffaf0 0%, #f5ebd4 100%);
  border-color: rgba(200, 148, 47, 0.34);
  color: #6e4910;
}

.bulk-import,
.price-group {
  border: 1px solid color-mix(in srgb, var(--group-color, var(--accent)) 22%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--group-color, var(--accent)) 12%, transparent) 0 5px, transparent 5px 100%),
    linear-gradient(180deg, color-mix(in srgb, var(--group-color, var(--accent)) 8%, #ffffff) 0%, #eef7f5 100%);
  margin-bottom: 12px;
}

.bulk-import summary,
.price-group summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  color: color-mix(in srgb, var(--group-color, var(--accent)) 72%, #102935);
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(90deg, color-mix(in srgb, var(--group-color, var(--accent)) 14%, transparent), transparent 58%);
}

.price-group-title {
  width: min(320px, 45vw);
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  color: color-mix(in srgb, var(--group-color, var(--accent)) 72%, #102935);
  font-weight: 700;
  padding: 0 6px;
}

.price-group-name {
  display: block;
  color: color-mix(in srgb, var(--group-color, var(--accent)) 72%, #102935);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

.price-group-heading {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.price-group-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.price-group-title:focus {
  background: var(--surface);
  border-color: var(--accent);
}

.price-group-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.add-category-row {
  min-height: 30px;
  padding: 0 10px;
  background: linear-gradient(180deg, #ffffff 0%, color-mix(in srgb, var(--group-color, var(--accent)) 10%, #f7fbfa) 100%);
  border-color: color-mix(in srgb, var(--group-color, var(--accent)) 32%, var(--line));
  color: color-mix(in srgb, var(--group-color, var(--accent)) 76%, #102935);
  font-size: 13px;
}

.bulk-body {
  border-top: 1px solid var(--line);
  padding: 14px;
}

.bulk-body textarea {
  min-height: 120px;
}

.library-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.library-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--muted);
  white-space: nowrap;
}

.inline-check input {
  width: auto;
  min-height: 0;
}

.user-form {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) 140px auto;
  align-items: end;
  gap: 12px;
  margin: 16px 0;
}

.user-form label {
  display: grid;
  gap: 6px;
}

.user-form span {
  color: #25415a;
  font-weight: 700;
}

.user-card-list {
  display: grid;
  gap: 14px;
}

.user-empty,
.user-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 12px 28px rgba(21, 52, 52, 0.07);
}

.user-empty {
  padding: 18px;
  color: var(--muted);
  font-weight: 800;
}

.user-card {
  overflow: hidden;
}

.user-card-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(48, 75, 179, 0.1) 0%, rgba(8, 117, 104, 0.1) 100%);
}

.user-card-head strong {
  display: block;
  color: #10233b;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.user-card-head span {
  color: var(--muted);
  font-weight: 750;
}

.user-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-card-actions select {
  min-height: 40px;
}

.user-password-row {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 252, 251, 0.86);
}

.user-password-row label {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 5px;
}

.user-password-row span {
  color: #25415a;
  font-size: 13px;
  font-weight: 800;
}

.user-password-row input {
  min-width: 0;
  min-height: 40px;
}

.user-password-row button {
  min-height: 40px;
  white-space: nowrap;
}

.user-permission-groups {
  display: grid;
  gap: 0;
}

.permission-group {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr);
  gap: 14px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.permission-group:last-child {
  border-bottom: 0;
}

.permission-group h3 {
  margin: 0 0 5px;
  color: #10233b;
  font-size: 17px;
}

.permission-group p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  font-size: 13px;
}

.user-save-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: rgba(247, 251, 251, 0.96);
}

.user-save-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.user-save-row span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.user-card.is-dirty .user-save-row span {
  color: var(--warn);
}

.save-user-permissions {
  min-width: 112px;
  background: var(--button-gradient);
  color: #ffffff;
  border-color: transparent;
  font-weight: 900;
}

.summary-pill {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #eff8f4 0%, #fff7e8 100%);
  padding: 10px 12px;
}

.summary-pill strong {
  display: block;
  color: var(--accent-dark);
  font-size: 18px;
}

.summary-pill span {
  color: var(--muted);
  font-size: 13px;
}

.price-groups {
  display: grid;
  gap: 10px;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: linear-gradient(180deg, #f9fcfb 0%, #eef7f5 100%);
  text-align: center;
}

.price-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfa;
}

.price-group .price-table-wrap {
  border-color: color-mix(in srgb, var(--group-color, var(--accent)) 20%, var(--line));
  border-width: 1px 0 0;
  border-radius: 0 0 8px 8px;
}

.price-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
}

.price-table th,
.price-table td {
  padding: 7px 8px;
}

.price-table th {
  background: linear-gradient(180deg, #f3f7fb 0%, #e4edf0 100%);
  color: #20344a;
  font-size: 12px;
}

.price-table th:nth-child(1),
.price-table td:nth-child(1) {
  width: 18%;
}

.price-table th:nth-child(2),
.price-table td:nth-child(2) {
  width: 24%;
}

.price-table th:nth-child(3),
.price-table td:nth-child(3) {
  width: 22%;
}

.price-table th:nth-child(4),
.price-table td:nth-child(4) {
  width: 30%;
}

.price-table th:nth-child(5),
.price-table td:nth-child(5) {
  width: 48px;
}

.price-table input,
.price-table select {
  min-height: 34px;
  border-color: #c4d3d2;
  background: #ffffff;
  font-size: 13px;
}

.price-table td:nth-child(4) input {
  display: inline-block;
  width: calc(50% - 4px);
  margin: 0 4px 6px 0;
}

.price-table td:nth-child(4) input:only-child {
  width: 100%;
  margin-right: 0;
}

@keyframes loginBackdrop {
  0% {
    background-position: 0 0, 0 0, 0 0, 0 0;
  }
  100% {
    background-position: 36px 24px, 2% 2%, 98% 92%, 0 0;
  }
}

@keyframes loginCardIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes logoFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes logoShine {
  0%,
  58% {
    left: -65%;
  }
  100% {
    left: 120%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .login-page,
  .login-card,
  .login-brand .brand-mark,
  .login-brand .brand-mark::after {
    animation: none;
  }
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: middle;
}

th {
  background: linear-gradient(180deg, #edf7f3 0%, #dcebe7 100%);
  color: var(--brand-deep);
  font-size: 13px;
  font-weight: 800;
}

td:last-child,
th:last-child {
  width: 64px;
  text-align: center;
}

tr:last-child td {
  border-bottom: 0;
}

.price-table th,
.price-table td {
  padding: 7px 8px;
}

.price-table th {
  background: linear-gradient(180deg, #f3f7fb 0%, #e4edf0 100%);
  color: #20344a;
  font-size: 12px;
}

.price-table th:last-child,
.price-table td:last-child {
  width: 48px;
}

.price-table td:nth-child(4) input + input {
  margin-top: 0;
}

.remove-row {
  width: 36px;
  padding: 0;
  color: var(--danger);
}

.quote-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

.quote-market-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdfd 0%, #eff7f6 100%);
  padding: 10px 12px;
}

.quote-market-bar span {
  color: var(--muted);
  font-size: 14px;
}

.market-toggle {
  display: inline-flex;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf5f3;
  padding: 4px;
}

.market-toggle button {
  border: 0;
  min-height: 32px;
  background: transparent;
  color: var(--muted);
}

.market-toggle button.is-active {
  background: var(--accent);
  color: #fff;
}

.quote-card {
  min-height: 480px;
}

.quote-card.is-collapsed {
  min-height: 0;
  padding-top: 12px;
  padding-bottom: 12px;
}

.quote-card.is-collapsed .panel-heading {
  margin-bottom: 0;
}

.quote-card[hidden] {
  display: none;
}

.quote-table-panel {
  margin-top: 16px;
}

.records-panel {
  margin-top: 16px;
}

.exchange-panel {
  margin-top: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(48, 75, 179, 0.08) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 94% 0%, rgba(212, 166, 75, 0.16) 0 18%, transparent 34%),
    linear-gradient(180deg, #fafdff 0%, #eef7f5 100%);
  background-size: 36px 100%, auto;
  box-shadow: var(--shadow);
}

.exchange-calculator {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.exchange-field,
.exchange-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdfd 0%, #eef6f8 100%);
  padding: 18px;
  box-shadow: 0 10px 24px rgba(21, 42, 69, 0.08);
}

.exchange-result {
  border-color: rgba(48, 75, 179, 0.18);
  background: linear-gradient(135deg, #eef3ff 0%, #f1faf6 52%, #fff7e7 100%);
}

.exchange-field.wide {
  grid-column: 1 / -1;
}

.exchange-field label,
.exchange-result span {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.exchange-input-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.exchange-input-row span {
  color: var(--muted);
  white-space: nowrap;
}

.exchange-result strong {
  display: block;
  color: var(--accent-dark);
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.1;
  word-break: break-word;
}

.exchange-field input {
  min-height: 48px;
  font-size: 24px;
  font-weight: 700;
}

.exchange-input-row input {
  font-size: 24px;
  font-weight: 700;
}

.amount-reading {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--accent-dark);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}

.exchange-result .amount-reading {
  color: #8a5d12;
}

.exchange-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 14px;
}

.exchange-history {
  margin-top: 16px;
}

.exchange-history h3 {
  margin: 0 0 8px;
  font-size: 15px;
}

.exchange-history-list {
  display: grid;
  gap: 8px;
}

.exchange-history-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: linear-gradient(180deg, #fbfdfd 0%, #eef7f5 100%);
}

.exchange-history-list span {
  color: var(--muted);
  font-size: 12px;
}

.coupling-panel {
  margin-top: 16px;
}

.coupling-search-grid {
  display: grid;
  grid-template-columns: minmax(240px, 460px);
  gap: 12px;
  margin: 12px 0 14px;
}

.coupling-search-grid label {
  display: grid;
  gap: 7px;
}

.coupling-search-grid span {
  color: #25415a;
  font-weight: 700;
}

.coupling-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

.coupling-summary span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(48, 75, 179, 0.16);
  border-radius: 6px;
  background: linear-gradient(180deg, #ffffff 0%, #edf5f3 100%);
  color: #25415a;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.coupling-empty {
  display: grid;
  gap: 6px;
  border: 1px dashed rgba(48, 75, 179, 0.22);
  border-radius: 8px;
  background: linear-gradient(135deg, #f8fbff 0%, #eef7f4 100%);
  padding: 18px;
  color: var(--muted);
}

.coupling-empty strong {
  color: #10233b;
  font-size: 18px;
}

.coupling-card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.coupling-result-card {
  border: 1px solid rgba(48, 75, 179, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(48, 75, 179, 0.1) 0 4px, transparent 4px 100%),
    linear-gradient(180deg, #ffffff 0%, #eef7f5 100%);
  padding: 14px;
  box-shadow: 0 12px 26px rgba(18, 45, 64, 0.08);
}

.coupling-result-card > div {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
}

.coupling-result-card span,
.coupling-result-card dt {
  color: var(--muted);
  font-size: 12px;
}

.coupling-result-card strong {
  color: #10233b;
  font-size: 22px;
  line-height: 1.15;
}

.coupling-result-card dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.coupling-result-card dl div {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 8px;
  align-items: center;
}

.coupling-result-card dd {
  margin: 0;
  color: #163149;
  font-weight: 800;
}

.coupling-source {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdfd 0%, #eef7f5 100%);
}

.coupling-source summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: #25415a;
  font-weight: 800;
  cursor: pointer;
}

.coupling-source > div {
  border-top: 1px solid var(--line);
  padding: 12px;
}

.coupling-table-block {
  display: grid;
  gap: 8px;
}

.coupling-table-title {
  color: #25415a;
  font-size: 13px;
  font-weight: 800;
}

.coupling-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdfd 0%, #eef6f8 100%);
  box-shadow: 0 12px 30px rgba(17, 48, 71, 0.08);
}

.coupling-table {
  width: 100%;
  min-width: 820px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.coupling-table th,
.coupling-table td {
  padding: 7px 8px;
  line-height: 1.3;
  border-right: 1px solid var(--line);
}

.coupling-table th:last-child,
.coupling-table td:last-child {
  border-right: 0;
}

.coupling-table th {
  background: var(--header-gradient);
  color: #ffffff;
  white-space: nowrap;
}

.coupling-table tbody tr:nth-child(even) td {
  background: #f3f8f7;
}

.record-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.record-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdfd 0%, #eef6f8 100%);
  box-shadow: 0 12px 30px rgba(17, 48, 71, 0.08);
}

.record-table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.record-table th,
.record-table td {
  padding: 6px 8px;
  line-height: 1.3;
  border-right: 1px solid var(--line);
}

.record-table th:last-child,
.record-table td:last-child {
  border-right: 0;
  width: 150px;
  text-align: center;
}

.record-table th {
  background: var(--header-gradient);
  color: #ffffff;
  white-space: nowrap;
}

.record-table th:nth-child(2),
.record-table td:nth-child(2) {
  width: 150px;
}

.record-table th:nth-child(5),
.record-table td:nth-child(5) {
  width: 110px;
}

.record-order {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-customer-input {
  min-height: 30px;
  padding: 0 8px;
  font-size: 12px;
  background: #ffffff;
}

.record-actions {
  display: flex;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.record-toggle,
.record-open-quote {
  min-height: 28px;
  padding: 0 10px;
  font-size: 12px;
}

.record-open-quote {
  background: linear-gradient(135deg, #304bb3 0%, #087568 100%);
  border-color: rgba(48, 75, 179, 0.24);
  color: #ffffff;
}

.record-open-quote:hover {
  color: #ffffff;
  filter: brightness(0.96);
}

.record-detail {
  display: grid;
  gap: 8px;
  padding: 8px;
  background: #f6faf9;
}

.record-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.record-meta-line span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid rgba(8, 117, 104, 0.16);
  border-radius: 6px;
  background: #ffffff;
  color: #25415a;
  padding: 0 9px;
  font-weight: 700;
}

.record-order-full {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 8px 10px;
  color: var(--muted);
  line-height: 1.5;
}

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

.record-detail th,
.record-detail td {
  padding: 5px 6px;
  border: 1px solid var(--line);
}

.quote-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdfd 0%, #eef6f8 100%);
  box-shadow: 0 12px 30px rgba(17, 48, 71, 0.08);
}

.quote-letterhead {
  display: grid;
  grid-template-columns: 58px 1fr;
  align-items: center;
  gap: 12px;
  min-width: 860px;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(90deg, rgba(48, 75, 179, 0.1) 0 1px, transparent 1px 100%),
    linear-gradient(135deg, #f9fcff 0%, #eef7f4 100%);
  background-size: 28px 100%, auto;
}

.quote-letterhead img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(16, 35, 59, 0.1);
}

.quote-letterhead strong,
.quote-letterhead span {
  display: block;
  text-align: center;
}

.quote-letterhead strong {
  color: var(--brand-deep);
  font-size: 24px;
  font-weight: 900;
  line-height: 1.2;
}

.quote-letterhead span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
}

.quote-output-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.quote-output-table th,
.quote-output-table td {
  padding: 5px 6px;
  line-height: 1.25;
  border-right: 1px solid var(--line);
  vertical-align: middle;
}

.quote-output-table th:last-child,
.quote-output-table td:last-child {
  border-right: 0;
}

.quote-output-table th {
  height: 30px;
  white-space: nowrap;
  text-align: center;
  background: var(--header-gradient);
  color: #ffffff;
}

.quote-output-table td {
  height: 30px;
}

.quote-output-table tbody tr:nth-child(even) td {
  background: #f3f8f7;
}

.quote-output-table tfoot td {
  background: linear-gradient(180deg, #fff8e8 0%, #f1e2bd 100%);
  color: var(--accent-dark);
  font-weight: 700;
}

.quote-output-table .col-index {
  width: 42px;
  text-align: center;
}

.quote-output-table .col-category {
  width: 100px;
}

.quote-output-table .col-model {
  width: 112px;
  font-weight: 700;
}

.quote-output-table .col-spec {
  width: 150px;
}

.quote-output-table .col-qty {
  width: 52px;
  text-align: center;
}

.quote-output-table .col-unit {
  width: 52px;
  text-align: center;
}

.quote-output-table .col-price,
.quote-output-table .col-amount {
  width: 128px;
  text-align: right;
}

.quote-output-table .col-note {
  width: 230px;
  max-width: 230px;
}

.quote-output-table .col-category,
.quote-output-table .col-model,
.quote-output-table .col-spec,
.quote-output-table .col-note {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.manual-price-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
}

.quote-edit-input,
.quote-edit-select {
  width: 100%;
  min-height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 0 6px;
  font-size: 12px;
  font-weight: 700;
}

.quote-edit-select {
  text-align: center;
}

.quote-edit-input:focus,
.quote-edit-select:focus {
  background: #ffffff;
  border-color: var(--accent);
  outline: 2px solid rgba(8, 117, 104, 0.14);
}

.manual-price-input {
  min-width: 0;
  width: 100%;
  min-height: 30px;
  padding: 0 8px;
  text-align: right;
  font-size: 13px;
  font-weight: 700;
}

.reset-manual-price {
  min-height: 30px;
  padding: 0 7px;
  font-size: 12px;
  color: #526167;
  background: linear-gradient(180deg, #ffffff 0%, #edf3f2 100%);
  border-color: #c9d7d5;
}

pre {
  min-height: 410px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #f9fcfb 0%, #edf5f3 100%);
  padding: 14px;
  line-height: 1.55;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}

.copy-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.copy-btn:hover {
  background: var(--accent-dark);
  color: #fff;
}

@media (max-width: 900px) {
  .app-shell {
    padding: 10px;
  }

  .topbar,
  .settings-grid,
  .quote-grid,
  .exchange-calculator,
  .coupling-search-grid,
  .coupling-card-grid,
  .library-summary,
  .record-summary {
    grid-template-columns: 1fr;
    display: grid;
  }

  .exchange-field.wide {
    grid-column: auto;
  }

  .topbar {
    align-items: start;
    gap: 10px;
    padding: 10px;
  }

  .brand-lockup {
    align-items: center;
    gap: 10px;
  }

  .login-brand {
    align-items: center;
  }

  .topbar h1 {
    font-size: 20px;
    white-space: normal;
  }

  .status-strip {
    justify-content: flex-start;
    gap: 6px;
  }

  .status-strip span,
  .status-strip button {
    min-height: 32px;
    font-size: 12px;
    padding: 0 8px;
  }

  .page-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
    padding: 8px;
    margin-bottom: 14px;
  }

  .tab-button {
    min-height: 48px;
    padding: 8px 10px;
    border: 1px solid rgba(30, 65, 94, 0.1);
    background: rgba(255, 255, 255, 0.76);
    color: #24405f;
    font-size: 15px;
    box-shadow: 0 5px 14px rgba(21, 52, 52, 0.05);
  }

  .tab-button.is-active {
    border-color: transparent;
  }

  .price-table,
  .price-table thead,
  .price-table tbody,
  .price-table tr {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .price-table td {
    display: block;
    width: auto;
    min-width: 0;
  }

  .price-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0;
  }

  .price-table thead {
    display: none;
  }

  .price-group {
    border-color: rgba(190, 204, 214, 0.62);
    background: #f7fafc;
  }

  .price-group .price-table-wrap {
    background: transparent;
  }

  .price-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .price-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 28px;
    grid-template-areas:
      "model action"
      "category unit"
      "cost cost";
    column-gap: 8px;
    row-gap: 6px;
    align-items: start;
    border: 1px solid rgba(184, 199, 211, 0.58);
    border-radius: 10px;
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
    padding: 9px 10px 10px;
    box-shadow: 0 6px 14px rgba(20, 48, 64, 0.04);
  }

  .price-table tr.price-row-readonly {
    display: block;
    min-height: 0;
    padding: 0;
  }

  .price-table td {
    padding: 0;
    margin-bottom: 0;
  }

  .price-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: #6c7b88;
    font-size: 11px;
    line-height: 1.15;
    font-weight: 750;
  }

  .price-table .price-cell-model {
    grid-area: model;
  }

  .price-table .price-cell-category {
    grid-area: category;
  }

  .price-table .price-cell-unit {
    grid-area: unit;
  }

  .price-table .price-cell-cost {
    grid-area: cost;
  }

  .price-table .price-cell-action {
    grid-area: action;
    align-self: start;
    justify-self: end;
  }

  .price-table .price-cell-action::before {
    display: none;
  }

  .price-table .price-cell-model::before {
    display: none;
  }

  .price-table tr.price-row-readonly td::before {
    display: none;
  }

  .library-read-card {
    display: block;
    padding: 11px 12px 12px;
  }

  .library-read-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
    margin-bottom: 8px;
  }

  .library-read-head strong {
    min-width: 0;
    color: #10233b;
    font-size: 18px;
    font-weight: 900;
    line-height: 1.15;
    overflow-wrap: anywhere;
  }

  .library-read-head span {
    flex: 0 0 auto;
    color: #0a704f;
    font-size: 17px;
    font-weight: 900;
    white-space: nowrap;
  }

  .library-read-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .library-read-meta span,
  .library-read-costs span {
    min-width: 0;
    display: grid;
    gap: 2px;
    border: 1px solid #dce7ec;
    border-radius: 8px;
    background: #f8fbfc;
    color: #17283a;
    font-size: 13px;
    font-weight: 850;
    line-height: 1.2;
    padding: 7px 8px;
  }

  .library-read-meta b,
  .library-read-costs b {
    color: #71808c;
    font-size: 10px;
    font-weight: 800;
  }

  .library-read-costs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    margin-top: 7px;
  }

  .price-table .price-cell-model input {
    min-height: 34px;
    border-color: transparent;
    background: transparent;
    color: #10233b;
    font-size: 18px;
    font-weight: 900;
    padding: 0;
    box-shadow: none;
  }

  .price-table .price-cell-category input,
  .price-table .price-cell-unit select,
  .price-table .price-cell-cost input {
    width: 100%;
    min-height: 36px;
    border: 1px solid #d5e0e6;
    border-radius: 9px;
    background: #ffffff;
    color: #17283a;
    font-size: 13px;
    font-weight: 750;
    padding: 0 9px;
    box-shadow: 0 1px 0 rgba(16, 35, 55, 0.03) inset;
  }

  .price-table .price-cell-model input:focus,
  .price-table .price-cell-category input:focus,
  .price-table .price-cell-unit select:focus,
  .price-table .price-cell-cost input:focus {
    border-color: #1c75bc;
    outline: 0;
    box-shadow: 0 0 0 3px rgba(28, 117, 188, 0.12);
  }

  .price-table .price-cell-cost {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .price-table .price-cell-cost::before {
    grid-column: 1 / -1;
    margin-bottom: -2px;
  }

  .price-table .price-cell-cost input:only-child {
    grid-column: 1 / -1;
  }

  .price-table input[readonly],
  .price-table select:disabled {
    opacity: 1;
    color: #17283a;
    -webkit-text-fill-color: #17283a;
  }

  .price-table td:nth-child(4) input,
  .price-table td:nth-child(4) input:only-child {
    width: 100%;
    margin: 0;
  }

  .price-table .remove-row {
    width: 28px;
    min-height: 28px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #8392a1;
    font-size: 19px;
    line-height: 1;
    box-shadow: none;
  }

  .price-table .remove-row:hover {
    background: #fbeaea;
    color: #b42318;
    transform: none;
  }

  .product-cost-form {
    grid-template-columns: 1fr;
  }

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

  .shipping-summary,
  .shipping-form {
    grid-template-columns: 1fr;
  }

  .shipping-form label.wide {
    grid-column: auto;
  }

  .shipping-form .paste-field {
    grid-column: auto;
  }
}

@media (max-width: 560px) {
  .login-page {
    padding: 18px;
  }

  .login-shell {
    min-height: auto;
    grid-template-columns: 1fr;
    border-radius: 10px;
  }

  .login-intro {
    padding: 28px 22px 22px;
  }

  .login-intro-title {
    margin-top: 24px;
    font-size: 21px;
  }

  .login-intro-text {
    font-size: 13px;
  }

  .login-card {
    width: 100%;
    border-left: 0;
    border-top: 1px solid rgba(183, 207, 224, 0.28);
    padding: 28px 22px 22px;
  }

  .login-system {
    font-size: 24px;
  }

  .login-subtitle {
    font-size: 10px;
  }

  .login-company {
    font-size: 11px;
  }

  .login-brand .brand-mark {
    width: 66px;
    height: 66px;
  }

  .topbar h1 {
    font-size: 17px;
  }

  .page-tabs {
    gap: 7px;
    padding: 7px;
  }

  .tab-button {
    min-height: 46px;
    font-size: 14px;
  }

  .page-tabs {
    width: 100%;
    overflow: auto;
  }

  .product-cost-card > div,
  .product-cost-group-head {
    display: grid;
    gap: 4px;
  }

  .product-cost-card p {
    font-size: 21px;
  }

  .cost-heading-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .cost-add-panel,
  .cost-category-panel {
    flex: 1 1 132px;
  }

  .cost-add-panel summary,
  .cost-category-panel summary {
    justify-content: center;
  }

  .product-cost-form {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .price-group summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    min-height: auto;
    padding: 9px 10px 9px 12px;
  }

  .price-group-title {
    width: 100%;
    min-height: 30px;
    border: 0;
    background: transparent;
    font-size: 16px;
    font-weight: 900;
    padding: 0;
  }

  .price-group-title[readonly] {
    color: color-mix(in srgb, var(--group-color, var(--accent)) 70%, #102935);
    -webkit-text-fill-color: color-mix(in srgb, var(--group-color, var(--accent)) 70%, #102935);
  }

  .price-group-name {
    font-size: 17px;
  }

  .price-group-heading {
    gap: 1px;
  }

  .price-group-count {
    color: #71808c;
    font-size: 12px;
    line-height: 1;
  }

  .add-category-row {
    min-height: 32px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, #123b73 0%, #0f6f9d 100%);
    color: #ffffff;
    padding: 0 11px;
    font-size: 12px;
    box-shadow: 0 8px 16px rgba(18, 59, 115, 0.16);
  }

  .library-tools {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .price-table tr {
    grid-template-columns: minmax(0, 1fr) 30px;
    padding: 10px 11px 11px;
  }

  .price-table tr.price-row-readonly {
    display: block;
    padding: 0;
  }

  .library-read-card {
    padding: 10px;
  }

  .library-read-head {
    margin-bottom: 7px;
  }

  .library-read-head strong {
    font-size: 17px;
  }

  .library-read-head span {
    font-size: 16px;
  }

  .library-read-meta,
  .library-read-costs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .library-read-meta span,
  .library-read-costs span {
    font-size: 12px;
    padding: 7px;
  }

  .price-table .price-cell-cost {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .price-table .price-cell-model input {
    min-height: 40px;
    font-size: 16px;
  }

  .price-table .price-cell-category input,
  .price-table .price-cell-unit select,
  .price-table .price-cell-cost input {
    min-height: 36px;
    font-size: 13px;
  }

  .price-table .remove-row {
    width: 30px;
    min-height: 30px;
  }

  .shipping-record-card > div {
    display: grid;
    gap: 5px;
  }

  .image-recognition-panel {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .customer-field,
  .field-row,
  .user-form {
    grid-template-columns: 1fr;
    display: grid;
    align-items: start;
  }

.toolbar {
  justify-content: flex-start;
  }
}

.permission-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
}

.mini-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #25415a;
  min-height: 42px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 800;
  white-space: normal;
}

.mini-check input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.mini-check span {
  overflow-wrap: anywhere;
}

@media (max-width: 560px) {
  .dimension-results {
    grid-template-columns: 1fr;
  }

  .dimension-card {
    grid-template-columns: 64px minmax(0, 1fr);
    padding: 10px;
  }

  .dimension-preview {
    width: 64px;
    height: 64px;
  }

  .dimension-actions a {
    flex: 1 1 86px;
  }

  .user-card-head,
  .permission-group {
    grid-template-columns: 1fr;
    display: grid;
  }

  .user-card-actions {
    justify-content: flex-start;
  }

  .user-password-row {
    align-items: stretch;
    flex-direction: column;
  }

  .user-password-row button {
    width: 100%;
  }

  .user-save-row {
    align-items: stretch;
    flex-direction: column;
  }

  .user-save-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .save-user-permissions {
    width: 100%;
  }

  .permission-checks {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  html body .price-table-wrap {
    overflow: visible !important;
    border-radius: 0 0 8px 8px;
  }

  html body .price-table {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    table-layout: auto !important;
    border-collapse: separate !important;
  }

  html body .price-table thead {
    display: none !important;
  }

  html body .price-table tbody {
    display: grid !important;
    width: 100% !important;
    gap: 10px !important;
    padding: 10px !important;
  }

  html body .price-table tr {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    border: 1px solid rgba(184, 199, 211, 0.58) !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    padding: 10px 12px !important;
    box-shadow: 0 6px 14px rgba(20, 48, 64, 0.04) !important;
  }

  html body .price-table td,
  html body .price-table th:nth-child(n),
  html body .price-table td:nth-child(n),
  html body .price-table td:last-child {
    display: block !important;
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 0 8px !important;
    text-align: left !important;
  }

  html body .price-table td::before {
    content: attr(data-label) !important;
    display: block !important;
    margin: 0 0 4px !important;
    color: #6c7b88 !important;
    font-size: 11px !important;
    line-height: 1.15 !important;
    font-weight: 800 !important;
  }

  html body .price-table .price-cell-model::before,
  html body .price-table .price-cell-action::before,
  html body .price-table tr.price-row-readonly td::before {
    display: none !important;
  }

  html body .price-table input,
  html body .price-table select {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 40px !important;
    border: 1px solid #d5e0e6 !important;
    border-radius: 9px !important;
    background: #ffffff !important;
    color: #17283a !important;
    font-size: 14px !important;
    font-weight: 800 !important;
    padding: 0 10px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    -webkit-text-fill-color: #17283a !important;
  }

  html body .price-table .price-cell-model input {
    border-color: transparent !important;
    background: transparent !important;
    color: #10233b !important;
    font-size: 20px !important;
    font-weight: 900 !important;
    padding: 0 !important;
    overflow-wrap: anywhere !important;
    -webkit-text-fill-color: #10233b !important;
  }

  html body .price-table .price-cell-cost {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
  }

  html body .price-table .price-cell-cost::before {
    grid-column: 1 / -1 !important;
    display: block !important;
  }

  html body .price-table .price-cell-cost input,
  html body .price-table td:nth-child(4) input,
  html body .price-table td:nth-child(4) input:only-child,
  html body .price-table td:nth-child(4) input + input {
    width: 100% !important;
    margin: 0 !important;
  }

  html body .price-table .price-cell-cost input:only-child {
    grid-column: 1 / -1 !important;
  }

  html body .price-table .price-cell-action {
    position: absolute !important;
    top: 8px !important;
    right: 8px !important;
    width: auto !important;
    margin: 0 !important;
    text-align: right !important;
  }

  html body .price-table .remove-row {
    width: 28px !important;
    min-height: 28px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: #f4f7f8 !important;
    color: #7b8794 !important;
    font-size: 18px !important;
    box-shadow: none !important;
  }

  html body .price-table tr.price-row-readonly {
    padding: 0 !important;
  }

  html body .price-table .library-read-card {
    display: block !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 10px !important;
  }
}

@media (max-width: 560px) {
  html body .price-table tbody {
    gap: 9px !important;
    padding: 9px !important;
  }

  html body .price-table tr {
    padding: 9px 10px !important;
  }

  html body .price-table .price-cell-model input {
    font-size: 19px !important;
  }

  html body .price-table .price-cell-cost {
    grid-template-columns: 1fr 1fr !important;
  }
}

.shipping-entry-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.shipping-entry-card {
  display: grid;
  gap: 4px;
  justify-items: start;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffffff;
  color: #10233b;
  text-align: left;
  box-shadow: 0 8px 18px rgba(21, 52, 52, 0.06);
}

.shipping-entry-card strong {
  font-size: 16px;
}

.shipping-entry-card span {
  color: var(--muted);
  font-size: 12px;
}

.shipping-entry-card.is-active {
  background: #0f7f73;
  border-color: #0f7f73;
  color: #ffffff;
}

.shipping-entry-card.is-active span {
  color: rgba(255, 255, 255, 0.84);
}

.shipping-list-tools {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 170px 140px;
  gap: 8px;
  margin: 12px 0 6px;
}

.shipping-list-tools.bridge-tools {
  grid-template-columns: minmax(180px, 1fr) 170px;
}

.shipping-list-tools input,
.shipping-list-tools select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0 10px;
  color: var(--ink);
  font-weight: 700;
}

.shipping-list-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.shipping-list {
  max-height: min(620px, calc(100vh - 300px));
  overflow: auto;
  padding-right: 4px;
}

.shipping-record-card {
  box-shadow: none;
}

.compact-bridge-record {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

@media (max-width: 720px) {
  .shipping-entry-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .shipping-entry-card {
    min-height: 54px;
    padding: 9px 10px;
  }

  .shipping-list-tools,
  .shipping-list-tools.bridge-tools {
    grid-template-columns: 1fr;
  }

  .shipping-list {
    max-height: calc(100svh - 320px);
  }

  .compact-bridge-record {
    grid-template-columns: 1fr;
  }
}

/* Formal production workbench */
body {
  background: #f5f7f9;
}

.app-shell {
  width: min(100%, 1120px);
  padding: 14px 16px calc(84px + env(safe-area-inset-bottom));
}

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

.home-hero {
  min-height: 98px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border-radius: 16px;
  background: linear-gradient(135deg, #0f2a46 0%, #145d77 55%, #0b7f72 100%);
  color: #fff;
  box-shadow: 0 14px 34px rgba(11, 42, 70, 0.16);
}

body:not([data-current-page="homePage"]) .home-hero {
  display: none;
}

.compact-mark {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  box-shadow: none;
}

.hero-copy h1 {
  max-width: none;
  display: block;
  margin: 0 0 4px;
  color: #fff;
  font-size: clamp(18px, 2.2vw, 22px);
  line-height: 1.16;
  font-weight: 860;
  letter-spacing: 0.4px;
  text-shadow: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hero-copy h1 span {
  display: inline;
}

.hero-copy p {
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
  font-weight: 700;
}

.hero-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.hero-actions span,
.hero-actions button {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  font-weight: 800;
  box-shadow: none;
}

.hero-actions button:hover {
  transform: none;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.36);
}

.home-dashboard {
  display: grid;
  gap: 14px;
}

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

.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.section-title h2 {
  margin: 0;
  color: #17212b;
  font-size: 17px;
}

.section-title span {
  color: #77838a;
  font-size: 12px;
  font-weight: 750;
}

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

.module-card,
.business-card-grid a,
.business-card-grid button,
.tool-grid a,
.tool-grid button {
  border: 1px solid rgba(203, 217, 216, 0.66);
  background: #fff;
  color: #17212b;
  text-decoration: none;
  box-shadow: 0 8px 22px rgba(15, 35, 52, 0.06);
}

.module-card {
  min-height: 100px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 13px;
  border-radius: 16px;
  text-align: left;
}

.module-card:hover,
.business-card-grid a:hover,
.business-card-grid button:hover,
.tool-grid a:hover,
.tool-grid button:hover {
  transform: translateY(-1px);
  border-color: rgba(7, 146, 127, 0.42);
  color: #0b5f59;
}

.module-icon {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  border-radius: 12px;
  background: #e7f3ef;
  color: #087568;
  font-size: 18px;
  font-weight: 900;
}

.module-card strong {
  font-size: 16px;
  line-height: 1.2;
}

.module-card em {
  color: #66757d;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.business-card-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.business-card {
  min-height: 100px;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.tool-grid a,
.tool-grid button,
.tool-link {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  padding: 0 12px;
  font-size: 14px;
  font-weight: 760;
  text-align: center;
}

.tool-link {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-dark);
  text-decoration: none;
}

.compact-tools {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.page-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 56px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 54px;
  align-items: center;
  gap: 8px;
  margin: -2px -2px 12px;
  padding: 7px 0;
  background: rgba(245, 247, 249, 0.94);
  backdrop-filter: blur(14px);
}

.page-header h2 {
  overflow: hidden;
  margin: 0;
  color: #17212b;
  font-size: 20px;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-home,
.more-button {
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
}

.back-home {
  color: #17212b;
  font-size: 30px;
}

.more-button {
  color: #087568;
  font-size: 13px;
}

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

.quote-primary-actions > button {
  position: relative;
  z-index: 1;
}

.quote-primary-actions > .primary-action {
  flex: 1 1 auto;
  min-width: 0;
}

.primary-action {
  min-height: 48px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, #123b73 0%, #087568 100%);
  color: #fff;
  box-shadow: 0 10px 22px rgba(8, 117, 104, 0.18);
}

.quote-primary-actions > .secondary-action {
  flex: 0 0 82px;
}

.secondary-action {
  min-width: 82px;
  min-height: 48px;
  border-radius: 12px;
  background: #fff;
  color: #607174;
}

.input-panel,
.settings-card,
.price-panel,
.quote-card,
.quote-table-panel,
.records-panel,
.exchange-panel,
.coupling-panel,
.costs-panel,
.users-panel,
.tools-panel,
.dimensions-panel {
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 35, 52, 0.06);
}

.input-panel::before,
.settings-card::before,
.price-panel::before,
.quote-card::before,
.quote-table-panel::before,
.records-panel::before,
.exchange-panel::before,
.coupling-panel::before,
.costs-panel::before,
.users-panel::before,
.tools-panel::before,
.dimensions-panel::before {
  display: none;
}

.panel-heading h2 {
  font-size: 18px;
}

.toolbar {
  gap: 8px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  z-index: 50;
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  border-top: 1px solid rgba(203, 217, 216, 0.82);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

.bottom-nav a,
.bottom-nav button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #607174;
  text-decoration: none;
  font-size: 13px;
  font-weight: 850;
  box-shadow: none;
}

.bottom-nav .is-active {
  background: #e7f3ef;
  color: #087568;
}

@media (min-width: 900px) {
  .bottom-nav {
    width: min(100%, 1120px);
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 10px 10px calc(78px + env(safe-area-inset-bottom));
  }

  .home-hero {
    min-height: 92px;
    align-items: center;
    padding: 12px;
  }

  .hero-actions {
    max-width: 70px;
    display: grid;
    gap: 6px;
  }

  .hero-actions span {
    display: none;
  }

  .hero-copy h1 {
    max-width: calc(100vw - 148px);
    font-size: clamp(16px, 4.2vw, 18px);
    letter-spacing: 0.25px;
  }

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

  .business-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .module-card {
    min-height: 96px;
    padding: 12px;
    border-radius: 14px;
  }

  .business-card {
    min-height: 96px;
  }

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

  .compact-tools {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .panel-heading {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar {
    justify-content: flex-start;
  }

  .page-view,
  .input-panel,
  .quote-table-panel {
    min-width: 0;
    max-width: 100%;
  }

  .quote-table-wrap {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .quote-letterhead,
  .quote-output-table {
    width: 860px;
    max-width: none;
  }
}

@media (max-width: 430px) {
  .compact-mark {
    width: 44px;
    height: 44px;
  }

  .home-hero {
    gap: 8px;
  }

  .hero-copy h1 {
    max-width: calc(100vw - 132px);
    font-size: 16px;
  }

  .module-card strong {
    font-size: 15px;
  }

  .module-card em {
    font-size: 12px;
  }
}

@media (max-width: 370px) {
  .hero-copy h1 {
    max-width: calc(100vw - 124px);
    font-size: 15px;
    letter-spacing: 0;
  }

  .hero-actions {
    max-width: 94px;
  }

  .hero-actions button {
    padding: 0 8px;
  }

  .tool-grid a,
  .tool-grid button {
    padding: 0 8px;
    font-size: 13px;
  }
}

/* Account permissions: focused mobile editor without changing permission data or save behavior. */
#usersPage .users-panel {
  overflow: visible;
}

#userCreateForm[hidden] {
  display: none;
}

#usersPage .user-card-list {
  gap: 12px;
}

.account-list-view {
  display: grid;
  gap: 10px;
}

.account-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 4px;
}

.account-list-heading h3 {
  margin: 0;
  color: #132d33;
  font-size: 17px;
  line-height: 1.25;
}

.account-list-heading p {
  margin: 3px 0 0;
  color: #69787d;
  font-size: 13px;
  line-height: 1.4;
}

.account-create-trigger {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  border-color: #bedbd5;
  border-radius: 10px;
  background: #f4faf8;
  color: #096d62;
  font-size: 14px;
  font-weight: 800;
}

.account-list-items {
  display: grid;
  gap: 8px;
}

.account-list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 20px;
  align-items: center;
  width: 100%;
  min-height: 70px;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid #dfe9e6;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(17, 51, 49, 0.045);
  color: #183238;
  text-align: left;
}

.account-list-item:active {
  border-color: #78aca2;
  background: #f3faf8;
  transform: none;
}

.account-list-main {
  display: grid;
  min-width: 0;
  color: #152a30;
  font-size: 17px;
  font-weight: 850;
  line-height: 1.25;
}

.account-list-main small {
  margin-top: 3px;
  overflow: hidden;
  color: #77878b;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-list-meta {
  color: #577076;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.account-list-chevron {
  color: #0b756a;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
}

.user-permission-editor {
  overflow: visible;
  border-radius: 14px;
  box-shadow: 0 8px 22px rgba(14, 47, 45, 0.07);
}

.account-editor-identity {
  position: sticky;
  top: 58px;
  z-index: 12;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid #cde0dc;
  background: rgba(246, 252, 250, 0.97);
  box-shadow: 0 5px 14px rgba(26, 60, 57, 0.06);
  backdrop-filter: blur(12px);
}

.account-editor-back {
  display: inline-grid;
  width: 36px;
  height: 36px;
  place-items: center;
  padding: 0;
  border: 1px solid #c4ddd7;
  border-radius: 10px;
  background: #ffffff;
  color: #096d62;
  font-size: 27px;
  font-weight: 400;
  line-height: 1;
}

.account-editor-identity-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.account-editor-identity-copy > span,
.account-editor-identity-copy small {
  overflow: hidden;
  color: #6d8182;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-editor-identity-copy strong {
  overflow: hidden;
  color: #143439;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.22;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-editor-status {
  justify-self: end;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.account-editor-status.is-active {
  background: #e5f5ef;
  color: #087366;
}

.account-editor-status.is-inactive {
  background: #f4ece8;
  color: #9b5541;
}

.account-editor-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5efec;
  background: #ffffff;
}

.account-editor-actions label {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.account-editor-actions label > span {
  color: #526b70;
  font-size: 13px;
  font-weight: 800;
}

.account-editor-actions select,
.account-editor-actions button {
  min-height: 42px;
}

.account-editor-actions button {
  padding: 0 13px;
  border-color: #e5cbc2;
  background: #fff8f5;
  color: #a54a34;
  font-weight: 850;
  white-space: nowrap;
}

.user-permission-editor .user-password-row {
  padding: 12px 14px;
  background: #fbfdfc;
}

.permission-search-field {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid #e5efec;
  background: #ffffff;
}

.permission-search-field > span {
  color: #526b70;
  font-size: 13px;
  font-weight: 800;
}

.permission-search-field input {
  min-height: 44px;
  border-color: #cfe1dd;
  border-radius: 10px;
  background: #f9fcfb;
  font-size: 15px;
}

.user-permission-editor .user-permission-groups {
  display: grid;
  gap: 8px;
  padding: 10px 12px 94px;
  background: #f7faf9;
}

.user-permission-editor .permission-group {
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid #dce8e5;
  border-radius: 12px;
  background: #ffffff;
}

.user-permission-editor .permission-group-toggle {
  display: flex;
  width: 100%;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: #ffffff;
  color: #183238;
  text-align: left;
}

.user-permission-editor .permission-group-toggle:active,
.user-permission-editor .permission-group.is-open .permission-group-toggle {
  background: #f3faf8;
}

.permission-group-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.permission-group-title strong {
  color: #17363a;
  font-size: 16px;
  font-weight: 850;
}

.permission-group-title small {
  color: #6c7d80;
  font-size: 12px;
  font-weight: 700;
}

.permission-group-title small b {
  color: #087568;
  font-weight: 850;
}

.permission-group-chevron {
  flex: 0 0 auto;
  color: #3d7770;
  font-size: 22px;
  line-height: 1;
  transition: transform 160ms ease;
}

.permission-group.is-open .permission-group-chevron {
  transform: rotate(180deg);
}

.user-permission-editor .permission-group-content {
  display: none;
  padding: 0 12px 12px;
  border-top: 1px solid #e7efed;
}

.user-permission-editor .permission-group.is-open .permission-group-content {
  display: block;
}

.user-permission-editor .permission-group-content > p {
  margin: 10px 0;
  color: #6d7e80;
  font-size: 12px;
  line-height: 1.55;
}

.user-permission-editor .permission-checks {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.user-permission-editor .mini-check {
  min-height: 50px;
  padding: 8px 10px;
  border: 1px solid #e4ecea;
  border-radius: 9px;
  background: #ffffff;
  color: #29464b;
  font-size: 14px;
  font-weight: 750;
  line-height: 1.3;
}

.user-permission-editor .mini-check:has(input:checked) {
  border-color: #9fcec5;
  background: #eff9f6;
  color: #086e63;
}

.user-permission-editor .mini-check input {
  width: 18px;
  height: 18px;
  accent-color: #087568;
}

.permission-search-empty {
  margin: 8px 0 0;
  padding: 16px 12px;
  border: 1px dashed #cbded9;
  border-radius: 10px;
  color: #718284;
  font-size: 14px;
  font-weight: 750;
  text-align: center;
}

.user-permission-editor .user-save-row {
  position: sticky;
  bottom: calc(64px + env(safe-area-inset-bottom));
  z-index: 14;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid #bcd8d2;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -6px 18px rgba(21, 54, 51, 0.08);
  backdrop-filter: blur(14px);
}

.user-permission-editor .user-save-row > span {
  color: #6b7d80;
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}

.user-permission-editor.is-dirty .user-save-row > span {
  color: #a7631f;
}

.user-permission-editor .user-save-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.user-permission-editor .user-save-actions button {
  min-height: 40px;
  padding: 0 10px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.user-permission-editor .save-user-permissions {
  min-width: 94px;
}

@media (max-width: 560px) {
  .account-editor-identity {
    top: 56px;
  }

  .account-list-item {
    grid-template-columns: minmax(0, 1fr) 20px;
  }

  .account-list-meta {
    grid-column: 1;
    grid-row: 2;
  }

  .account-list-chevron {
    grid-column: 2;
    grid-row: 1 / span 2;
  }

  .user-permission-editor .permission-checks {
    grid-template-columns: 1fr;
  }

  .user-permission-editor .user-save-row {
    grid-template-columns: 1fr;
    bottom: calc(64px + env(safe-area-inset-bottom));
  }

  .user-permission-editor .user-save-actions {
    display: grid;
    grid-template-columns: 1fr 1fr minmax(104px, 1.2fr);
    width: 100%;
  }

  .user-permission-editor .user-save-actions button {
    width: 100%;
    padding: 0 6px;
  }
}

@media (min-width: 720px) {
  .user-permission-editor .user-save-row {
    bottom: 12px;
  }
}

/* Keep all homepage labels readable and the palette restrained despite older home rules. */
html body[data-current-page="homePage"] .home-dashboard .home-app-grid > .home-app-link strong,
html body[data-current-page="homePage"] .home-dashboard .business-card-grid.home-app-grid > .business-card.home-app-link strong {
  min-height: 32px;
  display: -webkit-box !important;
  overflow: hidden !important;
  color: #263532 !important;
  font-size: 13px !important;
  font-weight: 760 !important;
  line-height: 1.28 !important;
  text-align: center;
  text-overflow: clip !important;
  white-space: normal !important;
  word-break: break-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

html body[data-current-page="homePage"] .home-dashboard .home-app-grid > .home-app-link:nth-child(4n + 2) .module-icon {
  background: #e7eef0 !important;
  color: #456a73 !important;
}

html body[data-current-page="homePage"] .home-dashboard .home-app-grid > .home-app-link:nth-child(4n + 3) .module-icon {
  background: #eef1e7 !important;
  color: #5f795d !important;
}

html body[data-current-page="homePage"] .home-dashboard .home-app-grid > .home-app-link:nth-child(4n) .module-icon {
  background: #f3eee4 !important;
  color: #8b6b42 !important;
}

@media (max-width: 370px) {
  html body[data-current-page="homePage"] .home-dashboard .home-app-grid > .home-app-link strong,
  html body[data-current-page="homePage"] .home-dashboard .business-card-grid.home-app-grid > .business-card.home-app-link strong {
    min-height: 30px;
    font-size: 12px !important;
  }
}

/* Home uses one compact application-icon language across every entry. */
html body .home-dashboard .home-app-grid {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  align-items: start !important;
  gap: 16px 10px !important;
}

html body .home-dashboard .home-app-grid > .home-app-link {
  min-width: 0 !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  grid-template-rows: 64px auto !important;
  align-content: start !important;
  justify-items: center !important;
  gap: 7px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #17212b !important;
  text-align: center !important;
}

html body .home-dashboard .home-app-grid > .home-app-link:hover {
  transform: none !important;
  border-color: transparent !important;
  color: #17212b !important;
}

html body .home-dashboard .home-app-grid > .home-app-link .module-icon {
  width: 64px !important;
  height: 64px !important;
  display: grid !important;
  place-items: center !important;
  border-radius: 17px !important;
  background: #e7f3ef !important;
  color: #087568 !important;
  font-size: 24px !important;
  font-weight: 900 !important;
  box-shadow: 0 6px 16px rgba(15, 35, 52, 0.11) !important;
}

html body .home-dashboard .home-app-grid > .home-app-link .module-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
}

html body .home-dashboard .home-app-grid > .home-app-link:nth-child(4n + 2) .module-icon {
  background: #e8f0fc !important;
  color: #2866aa !important;
}

html body .home-dashboard .home-app-grid > .home-app-link:nth-child(4n + 3) .module-icon {
  background: #f5edf9 !important;
  color: #8754a0 !important;
}

html body .home-dashboard .home-app-grid > .home-app-link:nth-child(4n) .module-icon {
  background: #fff1e8 !important;
  color: #bb6540 !important;
}

html body .home-dashboard .home-app-grid > .home-app-link strong {
  width: 100% !important;
  overflow: hidden !important;
  color: #17212b !important;
  font-size: 13px !important;
  font-weight: 820 !important;
  line-height: 1.3 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .home-dashboard .home-app-grid > .home-app-link em {
  display: none !important;
}

html body .home-dashboard .home-app-grid > .home-app-link[hidden] {
  display: none !important;
}

@media (max-width: 420px) {
  html body .home-dashboard .home-app-grid {
    gap: 14px 8px !important;
  }

  html body .home-dashboard .home-app-grid > .home-app-link {
    grid-template-rows: 60px auto !important;
  }

  html body .home-dashboard .home-app-grid > .home-app-link .module-icon {
    width: 60px !important;
    height: 60px !important;
    border-radius: 16px !important;
    font-size: 22px !important;
  }

  html body .home-dashboard .home-app-grid > .home-app-link .module-icon svg {
    width: 26px;
    height: 26px;
  }
}

@media (max-width: 370px) {
  html body .home-dashboard .home-app-grid {
    gap: 13px 6px !important;
  }

  html body .home-dashboard .home-app-grid > .home-app-link {
    grid-template-rows: 56px auto !important;
    gap: 6px !important;
  }

  html body .home-dashboard .home-app-grid > .home-app-link .module-icon {
    width: 56px !important;
    height: 56px !important;
    border-radius: 15px !important;
    font-size: 21px !important;
  }

  html body .home-dashboard .home-app-grid > .home-app-link .module-icon svg {
    width: 24px;
    height: 24px;
  }

  html body .home-dashboard .home-app-grid > .home-app-link strong {
    font-size: 12px !important;
  }
}

/* Screw length calculator: intentionally compact enough for one-handed field use. */
.screw-length-panel {
  max-width: 680px;
  margin-top: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(15, 35, 52, 0.06);
}

.screw-length-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.screw-length-field {
  display: grid;
  gap: 8px;
  color: #334155;
  font-size: 14px;
  font-weight: 700;
}

.screw-length-field select,
.screw-length-field input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid #cbd8d5;
  border-radius: 12px;
  background: #fff;
  color: #17212b;
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  outline: none;
}

.screw-length-field select:focus,
.screw-length-field input:focus {
  border-color: #078c7b;
  box-shadow: 0 0 0 3px rgba(7, 140, 123, 0.12);
}

.screw-length-field input[aria-invalid="true"] {
  border-color: #d14343;
}

.screw-thread-field {
  grid-column: 1 / -1;
}

.screw-length-input-wrap {
  position: relative;
}

.screw-length-input-wrap input {
  padding-right: 58px;
}

.screw-length-input-wrap b {
  position: absolute;
  top: 50%;
  right: 16px;
  color: #64748b;
  font-size: 15px;
  transform: translateY(-50%);
}

.screw-machining-note {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #eff9f6;
  color: #14665d;
  font-size: 14px;
}

.screw-machining-note strong {
  color: #0b5f59;
}

.screw-machining-note span {
  color: #3b746e;
}

.screw-length-result {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-top: 14px;
  padding: 20px 16px;
  border: 1px solid rgba(7, 140, 123, 0.24);
  border-radius: 14px;
  background: #effaf7;
  text-align: center;
}

.screw-length-result > span {
  color: #316b64;
  font-size: 15px;
  font-weight: 800;
}

.screw-length-result strong {
  color: #076f63;
  font-size: 52px;
  font-weight: 900;
  line-height: 1.04;
}

.screw-length-result output {
  font: inherit;
}

.screw-length-result small {
  margin-left: 8px;
  color: #3e766f;
  font-size: 18px;
}

.screw-length-result p {
  margin: 3px 0 0;
  color: #64748b;
  font-size: 13px;
}

.screw-length-message {
  min-height: 20px;
  margin: 8px 2px 0;
  color: #d14343;
  font-size: 13px;
}

@media (max-width: 560px) {
  .screw-length-panel {
    margin-top: 12px;
    padding: 16px;
  }

  .screw-length-form {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .screw-thread-field {
    grid-column: auto;
  }

  .screw-length-result {
    padding: 18px 14px;
  }

  .screw-length-result strong {
    font-size: 48px;
  }
}

/* Homepage business tools: lock the mobile app grid so legacy button/link rules cannot stretch individual cards. */
html body .home-dashboard .business-card-grid {
  display: grid !important;
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  align-items: stretch !important;
  gap: 10px !important;
}

html body .home-dashboard .business-card-grid > .business-card {
  grid-column: auto !important;
  width: auto !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 108px !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  align-content: start !important;
  justify-content: stretch !important;
  justify-items: start !important;
  gap: 8px !important;
  padding: 14px !important;
  border-radius: 16px !important;
  text-align: left !important;
}

html body .home-dashboard .business-card-grid > .business-card[hidden],
html body .home-dashboard [data-permission][hidden],
html body .bottom-nav [data-permission][hidden] {
  display: none !important;
}

html body .home-dashboard .business-card-grid > .business-card .module-icon {
  width: 46px !important;
  height: 46px !important;
  border-radius: 13px !important;
  font-size: 20px !important;
}

html body .home-dashboard .business-card-grid > .business-card strong {
  font-size: 18px !important;
  line-height: 1.18 !important;
  font-weight: 900 !important;
}

html body .home-dashboard .business-card-grid > .business-card em {
  font-size: 13px !important;
  line-height: 1.32 !important;
}

@media (max-width: 760px) {
  html body .home-dashboard .business-card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  html body .home-dashboard .business-card-grid > .business-card {
    min-height: 112px !important;
  }
}

@media (max-width: 370px) {
  html body .home-dashboard .business-card-grid {
    gap: 10px !important;
  }

  html body .home-dashboard .business-card-grid > .business-card {
    min-height: 108px !important;
    padding: 12px !important;
  }

  html body .home-dashboard .business-card-grid > .business-card strong {
    font-size: 17px !important;
  }
}

/* Keep the later legacy business-card rule from turning app icons back into wide cards. */
html body .home-dashboard .business-card-grid.home-app-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  grid-auto-flow: row !important;
  align-items: start !important;
  gap: 16px 10px !important;
}

html body .home-dashboard .business-card-grid.home-app-grid > .business-card.home-app-link {
  grid-column: span 1 !important;
  grid-row: auto !important;
  width: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  align-content: start !important;
  justify-items: center !important;
  text-align: center !important;
}

html body .home-dashboard .business-card-grid.home-app-grid > .business-card.home-app-link .module-icon {
  width: 64px !important;
  height: 64px !important;
  border-radius: 17px !important;
  font-size: 24px !important;
}

html body .home-dashboard .business-card-grid.home-app-grid > .business-card.home-app-link strong {
  width: 100% !important;
  overflow: hidden !important;
  color: #17212b !important;
  font-size: 13px !important;
  font-weight: 820 !important;
  line-height: 1.3 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body .home-dashboard .business-card-grid.home-app-grid > .business-card.home-app-link em {
  display: none !important;
}

@media (max-width: 420px) {
  html body .home-dashboard .business-card-grid.home-app-grid {
    gap: 14px 8px !important;
  }

  html body .home-dashboard .business-card-grid.home-app-grid > .business-card.home-app-link .module-icon {
    width: 60px !important;
    height: 60px !important;
    border-radius: 16px !important;
    font-size: 22px !important;
  }
}

@media (max-width: 370px) {
  html body .home-dashboard .business-card-grid.home-app-grid {
    gap: 13px 6px !important;
  }

  html body .home-dashboard .business-card-grid.home-app-grid > .business-card.home-app-link .module-icon {
    width: 56px !important;
    height: 56px !important;
    border-radius: 15px !important;
    font-size: 21px !important;
  }

  html body .home-dashboard .business-card-grid.home-app-grid > .business-card.home-app-link strong {
    font-size: 12px !important;
  }
}

.user-permission-groups {
  gap: 8px;
  padding: 12px 16px;
}

.permission-group {
  display: block;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.permission-group + .permission-group {
  border-top: 1px solid var(--line);
}

.user-permission-groups .permission-group:last-child {
  border-bottom: 1px solid var(--line);
}

.permission-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
}

.permission-group summary::-webkit-details-marker {
  display: none;
}

.permission-group-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.permission-group-title strong {
  color: #10233b;
  font-size: 15px;
}

.permission-group-title small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.permission-group-chevron {
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  transition: transform 160ms ease;
}

.permission-group[open] .permission-group-chevron {
  transform: rotate(180deg);
}

.permission-group-content {
  display: grid;
  gap: 12px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
  background: #fbfdfd;
}

.permission-group-content p {
  margin: 10px 0 0;
}

@media (max-width: 720px) {
  .user-permission-groups {
    padding: 10px;
  }

  .permission-group summary {
    min-height: 46px;
    padding: 9px 10px;
  }

  .permission-group-content {
    padding: 0 10px 10px;
  }
}

/* Homepage visual system: calm industrial colors and a consistent app-icon language. */
body[data-current-page="homePage"] {
  background: #f6f7f4;
}

body[data-current-page="homePage"] .workspace {
  gap: 16px;
}

body[data-current-page="homePage"] .home-hero {
  min-height: 90px;
  position: relative;
  overflow: hidden;
  padding: 12px 14px;
  border: 1px solid rgba(235, 249, 244, 0.16);
  border-radius: 18px;
  background: linear-gradient(132deg, #123d3a 0%, #1a4654 58%, #275462 100%);
  box-shadow: 0 12px 30px rgba(21, 54, 59, 0.18);
}

body[data-current-page="homePage"] .home-hero::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: inherit;
}

body[data-current-page="homePage"] .brand-lockup {
  gap: 11px;
}

body[data-current-page="homePage"] .compact-mark {
  width: 56px;
  height: 56px;
  padding: 6px;
  border: 1px solid rgba(223, 240, 235, 0.7);
  border-radius: 16px;
  background: #f9fcfa;
  box-shadow: 0 7px 18px rgba(4, 25, 29, 0.22);
}

body[data-current-page="homePage"] .compact-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

body[data-current-page="homePage"] .hero-copy h1 {
  margin-bottom: 5px;
  color: #f9fcfa;
  font-size: 19px;
  font-weight: 780;
  letter-spacing: 0;
  line-height: 1.2;
  text-shadow: none;
}

body[data-current-page="homePage"] .hero-copy p {
  color: rgba(235, 246, 242, 0.72);
  font-size: 12px;
  font-weight: 650;
}

body[data-current-page="homePage"] .hero-actions {
  position: relative;
  z-index: 1;
  gap: 6px;
}

body[data-current-page="homePage"] .hero-actions span,
body[data-current-page="homePage"] .hero-actions button {
  min-height: 30px;
  border-color: rgba(224, 242, 237, 0.22);
  border-radius: 10px;
  background: rgba(5, 28, 34, 0.18);
  color: rgba(250, 253, 252, 0.92);
  font-size: 12px;
  font-weight: 700;
}

body[data-current-page="homePage"] .hero-actions button {
  min-width: 46px;
  padding: 0 9px;
}

body[data-current-page="homePage"] .hero-actions button:active {
  background: rgba(236, 250, 246, 0.22);
  transform: translateY(1px);
}

body[data-current-page="homePage"] .home-dashboard {
  gap: 18px;
}

body[data-current-page="homePage"] .top-todo-entry {
  min-height: 64px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto 16px;
  align-items: center;
  gap: 10px;
  margin: 10px 0 16px;
  padding: 10px 12px;
  border: 1px solid #d9e7e1;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 7px 18px rgba(27, 63, 56, 0.06);
  color: #22332e;
  text-decoration: none;
}

body[data-current-page="homePage"] .top-todo-entry:active {
  transform: translateY(1px);
  background: #f5fbf8;
}

body[data-current-page="homePage"] .top-todo-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #e4f2ec;
  color: #176b5e;
}

body[data-current-page="homePage"] .top-todo-icon svg {
  width: 21px;
  height: 21px;
  stroke-width: 2;
}

body[data-current-page="homePage"] .top-todo-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

body[data-current-page="homePage"] .top-todo-copy strong {
  color: #233530;
  font-size: 15px;
  font-weight: 780;
  line-height: 1.2;
}

body[data-current-page="homePage"] .top-todo-copy em {
  overflow: hidden;
  color: #6c7b76;
  font-size: 12px;
  font-style: normal;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body[data-current-page="homePage"] .top-todo-arrow {
  width: 16px;
  height: 16px;
  color: #7d8d87;
}

.todo-home-badge {
  min-width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: #c6573b;
  color: #fff;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

body[data-current-page="homePage"] .top-todo-entry[data-todo-state="clear"] .top-todo-icon {
  background: #e8f3ed;
  color: #1c7567;
}

body[data-current-page="homePage"] .workbench-section {
  gap: 11px;
}

body[data-current-page="homePage"] .section-title {
  min-height: 22px;
  align-items: center;
  padding: 0 1px;
}

body[data-current-page="homePage"] .section-title h2 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #243330;
  font-size: 17px;
  font-weight: 780;
  line-height: 1.25;
}

body[data-current-page="homePage"] .section-title h2::before {
  width: 3px;
  height: 15px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #1d756b;
  content: "";
}

body[data-current-page="homePage"] .home-app-grid,
body[data-current-page="homePage"] .business-card-grid.home-app-grid {
  gap: 17px 11px !important;
}

body[data-current-page="homePage"] .home-app-grid > .home-app-link,
body[data-current-page="homePage"] .business-card-grid.home-app-grid > .business-card.home-app-link {
  grid-template-rows: 62px minmax(32px, auto) !important;
  gap: 8px !important;
  color: #263532 !important;
}

body[data-current-page="homePage"] .home-app-grid > .home-app-link .module-icon,
body[data-current-page="homePage"] .business-card-grid.home-app-grid > .business-card.home-app-link .module-icon {
  width: 62px !important;
  height: 62px !important;
  border: 1px solid rgba(32, 80, 75, 0.08);
  border-radius: 18px !important;
  background: #e5f0eb !important;
  color: #176b62 !important;
  box-shadow: 0 6px 16px rgba(38, 66, 61, 0.1) !important;
}

body[data-current-page="homePage"] .home-app-grid > .home-app-link .module-icon svg,
body[data-current-page="homePage"] .business-card-grid.home-app-grid > .business-card.home-app-link .module-icon svg {
  width: 27px;
  height: 27px;
  stroke-width: 1.85;
}

body[data-current-page="homePage"] .home-app-grid > .home-app-link:nth-child(4n + 2) .module-icon {
  background: #e7eef0 !important;
  color: #456a73 !important;
}

body[data-current-page="homePage"] .home-app-grid > .home-app-link:nth-child(4n + 3) .module-icon {
  background: #eef1e7 !important;
  color: #5f795d !important;
}

body[data-current-page="homePage"] .home-app-grid > .home-app-link:nth-child(4n) .module-icon {
  background: #f3eee4 !important;
  color: #8b6b42 !important;
}

body[data-current-page="homePage"] .home-app-grid > .home-app-link strong,
body[data-current-page="homePage"] .business-card-grid.home-app-grid > .business-card.home-app-link strong {
  min-height: 32px;
  display: -webkit-box !important;
  overflow: hidden !important;
  color: #263532 !important;
  font-size: 13px !important;
  font-weight: 760 !important;
  line-height: 1.28 !important;
  text-align: center;
  text-overflow: clip !important;
  white-space: normal !important;
  word-break: break-all;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

body[data-current-page="homePage"] .home-app-grid > .home-app-link:active .module-icon {
  box-shadow: 0 2px 8px rgba(38, 66, 61, 0.1) !important;
  transform: translateY(1px) scale(0.98);
}

body[data-current-page="homePage"] .bottom-nav {
  min-height: 66px;
  padding: 7px 9px calc(7px + env(safe-area-inset-bottom));
  border-top-color: rgba(161, 184, 178, 0.55);
  background: rgba(252, 253, 251, 0.97);
  box-shadow: 0 -5px 18px rgba(28, 50, 46, 0.05);
}

body[data-current-page="homePage"] .bottom-nav a,
body[data-current-page="homePage"] .bottom-nav button {
  min-height: 50px;
  border-radius: 12px;
  color: #46524f;
  font-size: 14px;
  font-weight: 760;
}

body[data-current-page="homePage"] .bottom-nav .is-active {
  background: #e1f0ea;
  color: #145f56;
  box-shadow: inset 0 0 0 1px rgba(25, 112, 100, 0.08);
}

body[data-current-page="homePage"] .bottom-nav a:active,
body[data-current-page="homePage"] .bottom-nav button:active {
  background: #edf3f0;
}

@media (max-width: 430px) {
  body[data-current-page="homePage"] .home-hero {
    min-height: 86px;
    padding: 11px;
  }

  body[data-current-page="homePage"] .compact-mark {
    width: 50px;
    height: 50px;
    border-radius: 15px;
  }

  body[data-current-page="homePage"] .hero-copy h1 {
    max-width: calc(100vw - 139px);
    font-size: 16px;
  }

  body[data-current-page="homePage"] .home-dashboard {
    gap: 16px;
  }

  body[data-current-page="homePage"] .home-app-grid,
  body[data-current-page="homePage"] .business-card-grid.home-app-grid {
    gap: 15px 8px !important;
  }

  body[data-current-page="homePage"] .home-app-grid > .home-app-link,
  body[data-current-page="homePage"] .business-card-grid.home-app-grid > .business-card.home-app-link {
    grid-template-rows: 58px minmax(32px, auto) !important;
    gap: 7px !important;
  }

  body[data-current-page="homePage"] .home-app-grid > .home-app-link .module-icon,
  body[data-current-page="homePage"] .business-card-grid.home-app-grid > .business-card.home-app-link .module-icon {
    width: 58px !important;
    height: 58px !important;
    border-radius: 17px !important;
  }

  body[data-current-page="homePage"] .home-app-grid > .home-app-link .module-icon svg,
  body[data-current-page="homePage"] .business-card-grid.home-app-grid > .business-card.home-app-link .module-icon svg {
    width: 25px;
    height: 25px;
  }
}

@media (max-width: 370px) {
  body[data-current-page="homePage"] .compact-mark {
    width: 46px;
    height: 46px;
  }

  body[data-current-page="homePage"] .hero-copy h1 {
    max-width: calc(100vw - 133px);
    font-size: 15px;
  }

  body[data-current-page="homePage"] .home-app-grid,
  body[data-current-page="homePage"] .business-card-grid.home-app-grid {
    gap: 13px 6px !important;
  }

  body[data-current-page="homePage"] .home-app-grid > .home-app-link,
  body[data-current-page="homePage"] .business-card-grid.home-app-grid > .business-card.home-app-link {
    grid-template-rows: 54px minmax(30px, auto) !important;
  }

  body[data-current-page="homePage"] .home-app-grid > .home-app-link .module-icon,
  body[data-current-page="homePage"] .business-card-grid.home-app-grid > .business-card.home-app-link .module-icon {
    width: 54px !important;
    height: 54px !important;
    border-radius: 16px !important;
  }

  body[data-current-page="homePage"] .home-app-grid > .home-app-link strong,
  body[data-current-page="homePage"] .business-card-grid.home-app-grid > .business-card.home-app-link strong {
    font-size: 12px !important;
  }
}



body[data-current-page="homePage"] .top-exception-entry {
  margin-top: -8px;
  border-color: #ecd9c3;
}

body[data-current-page="homePage"] .top-exception-entry .top-todo-icon {
  background: #fff0e8;
  color: #b95331;
}

body[data-current-page="homePage"] .top-exception-entry[data-exception-state="clear"] .top-todo-icon {
  background: #e8f3ed;
  color: #1c7567;
}

.exception-home-badge { background: #be4b3e; }

/* Compact homepage status links */
body[data-current-page="homePage"] .hero-status-links {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

body[data-current-page="homePage"] .hero-status-entry {
  min-height: 25px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 7px;
  border: 1px solid rgba(226, 243, 237, 0.24);
  border-radius: 8px;
  background: rgba(4, 30, 34, 0.18);
  color: rgba(249, 253, 252, 0.93);
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
  text-decoration: none;
}

body[data-current-page="homePage"] .hero-status-entry:active {
  background: rgba(237, 250, 247, 0.22);
  transform: translateY(1px);
}

body[data-current-page="homePage"] .hero-status-entry .hero-status-icon {
  width: 13px;
  height: 13px;
  stroke-width: 2.15;
}

body[data-current-page="homePage"] .hero-status-entry strong { font: inherit; }

body[data-current-page="homePage"] .hero-status-entry em {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.hero-status-badge {
  min-width: 15px;
  height: 15px;
  display: inline-grid;
  place-items: center;
  padding: 0 3px;
  border-radius: 999px;
  background: #c6573b;
  color: #fff;
  font-size: 9px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

body[data-current-page="homePage"] .hero-status-entry[data-todo-state="clear"] {
  color: #c8f0df;
}

body[data-current-page="homePage"] .hero-status-entry.is-exception {
  color: #ffe2d0;
}

body[data-current-page="homePage"] .hero-status-entry.is-exception[data-exception-state="clear"] {
  color: #c8f0df;
}

@media (max-width: 370px) {
  body[data-current-page="homePage"] .hero-status-links { gap: 4px; }
  body[data-current-page="homePage"] .hero-status-entry { padding: 0 6px; }
}
/* End compact homepage status links */

/* DIMENSION_GALLERY_UI_START */
#dimensionsPage .dimensions-panel {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 12px calc(22px + env(safe-area-inset-bottom));
  background: transparent;
  border: 0;
  box-shadow: none;
}

#dimensionsPage .dimensions-panel > .panel-heading {
  display: none;
}

#dimensionsPage .dimension-search-panel {
  position: sticky;
  top: 56px;
  z-index: 8;
  margin: 0 -2px 6px;
  padding: 8px 2px 6px;
  background: #f7f9f8;
}

#dimensionsPage .dimension-search-panel label {
  display: block;
}

#dimensionsPage .dimension-search-panel label > span {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#dimensionsPage .dimension-search-panel input {
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid #cfd9d7;
  border-radius: 10px;
  background: #ffffff;
  color: #17302f;
  box-shadow: none;
  font-size: 16px;
  font-weight: 700;
}

#dimensionsPage .dimension-search-panel input::placeholder {
  color: #73817f;
  font-weight: 600;
}

#dimensionsPage .dimension-summary {
  margin: 0 2px 8px;
  color: #6b7977;
  font-size: 13px;
  font-weight: 650;
}

#dimensionsPage .dimension-results {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

#dimensionsPage .dimension-card {
  display: grid;
  grid-template-columns: 116px minmax(0, 1fr) 20px;
  align-items: center;
  width: 100%;
  min-height: 104px;
  gap: 12px;
  padding: 7px;
  border: 1px solid #e0e7e5;
  border-radius: 10px;
  background: #ffffff;
  color: #172c2b;
  text-align: left;
  box-shadow: none;
  cursor: pointer;
}

#dimensionsPage .dimension-card:active {
  background: #f1f8f6;
  border-color: #9ecfc4;
}

#dimensionsPage .dimension-preview {
  display: grid;
  width: 116px;
  height: 88px;
  place-items: center;
  overflow: hidden;
  border: 1px solid #e4e9e8;
  border-radius: 7px;
  background: #ffffff;
}

#dimensionsPage .dimension-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

#dimensionsPage .dimension-card-body {
  display: grid;
  min-width: 0;
  gap: 7px;
}

#dimensionsPage .dimension-card-body strong {
  overflow: visible;
  color: #132b2a;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0;
  white-space: nowrap;
}

#dimensionsPage .dimension-card-body small {
  color: #6e7c7a;
  font-size: 13px;
  font-weight: 650;
}

#dimensionsPage .dimension-card-arrow {
  color: #078270;
  font-size: 28px;
  font-weight: 500;
  line-height: 1;
  text-align: center;
}

#dimensionsPage .dimension-empty {
  padding: 24px 14px;
  border: 1px dashed #d3dfdc;
  border-radius: 10px;
  background: #ffffff;
  color: #6e7c7a;
  font-size: 14px;
  font-weight: 650;
  text-align: center;
}

.dimension-viewer[hidden] {
  display: none;
}

.dimension-viewer {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
  background: #f5f7f7;
  color: #172c2b;
}

.dimension-viewer-bar {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: env(safe-area-inset-top) 12px 0 8px;
  background: #ffffff;
  border-bottom: 1px solid #e5ebea;
}

.dimension-viewer-close {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #17302f;
  font-size: 28px;
  font-weight: 350;
  line-height: 1;
}

.dimension-viewer-bar strong {
  min-width: 0;
  overflow: hidden;
  color: #17302f;
  font-size: 17px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dimension-viewer-bar span {
  color: #687775;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.dimension-viewer-stage {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  background: #f5f7f7;
}

.dimension-viewer-stage img {
  display: block;
  max-width: calc(100% - 16px);
  max-height: calc(100% - 16px);
  object-fit: contain;
  background: #ffffff;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: default;
  will-change: transform;
}

body.dimension-viewer-open {
  overflow: hidden;
}

body.dimension-viewer-open .bottom-nav {
  display: none !important;
}

@media (min-width: 720px) {
  #dimensionsPage .dimension-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
}

@media (max-width: 374px) {
  #dimensionsPage .dimension-card {
    grid-template-columns: 102px minmax(0, 1fr) 18px;
    gap: 9px;
  }

  #dimensionsPage .dimension-preview {
    width: 102px;
    height: 82px;
  }

  #dimensionsPage .dimension-card-body strong {
    font-size: 18px;
  }
}

@media (orientation: landscape) and (max-height: 600px) {
  .dimension-viewer {
    grid-template-rows: 48px minmax(0, 1fr);
  }

  .dimension-viewer-bar {
    min-height: 48px;
  }
}
/* DIMENSION_GALLERY_UI_END */
