:root {
  --bg: #f2f2f2;
  --ink: #1f1f1f;
  --muted: #5f5f5f;
  --accent: #d4af37;
  --panel: #f8f8f8;
  --line: #d3d3d3;
  --button-bg: #9a9a9a;
  --button-bg-hover: #6f6f6f;
  --button-border: #d4af37;
  --button-text: #111111;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  background: radial-gradient(circle at top, #f7f7f7 0%, var(--bg) 55%);
  color: var(--ink);
}

.live-order-page {
  min-height: 100vh;
  padding: 2rem 2.5rem 3rem;
}

.live-order-header {
  display: grid;
  gap: 0.4rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.live-order-title {
  margin: 0;
  font-size: 2rem;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
}

.live-order-subtitle {
  margin: 0;
  font-size: 1.1rem;
  color: var(--muted);
  font-weight: 600;
}

.live-order-grid {
  display: grid;
  gap: 1.5rem;
}

.live-order-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.5rem;
  box-shadow: 0 12px 24px rgba(31, 27, 22, 0.08);
}

.live-order-card h2 {
  margin: 0 0 0.85rem;
  font-size: 1.4rem;
}

.live-order-list {
  display: grid;
  gap: 0.75rem;
}

.live-order-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--line);
}

.live-order-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.live-order-desc {
  font-weight: 600;
}

.live-order-price {
  font-weight: 700;
  white-space: nowrap;
  color: var(--accent);
}

.live-order-total {
  margin-top: 1rem;
  display: flex;
  justify-content: space-between;
  font-size: 1.1rem;
  font-weight: 700;
}

.live-order-empty {
  color: var(--muted);
  font-weight: 600;
}

.live-order-updated {
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 1rem;
}

.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.layout {
  width: min(1400px, 98vw);
  margin: 2rem auto 3rem;
}

.site-header {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.25rem 2.5rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
}

.spot-frame {
  width: 100%;
  border: 0;
  display: block;
  min-height: 120px;
}

.nav-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand-mark {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.1rem;
}

.brand-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.menu {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.menu a,
.menu-button,
a,
.button-link,
.button-primary,
button,
.tab-button,
.subtab-button,
.segmented-button,
.spot-mode-button,
.spot-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--button-border);
  background: var(--button-bg);
  color: var(--button-text);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.2s ease, box-shadow 0.2s ease;
  white-space: nowrap;
}

.menu a:active,
.menu-button:active,
a:active,
.button-link:active,
.button-primary:active,
button:active,
.tab-button.is-active,
.subtab-button.is-active,
.segmented-button.is-active,
.spot-mode-button.is-active {
  color: #ffffff;
}

.menu a:hover,
.menu-button:hover,
a:hover,
.button-link:hover,
.button-primary:hover,
button:hover,
.tab-button:hover,
.subtab-button:hover,
.segmented-button:hover,
.spot-mode-button:hover,
.spot-link:hover {
  background: var(--button-bg-hover);
}

.menu a,
.menu-button {
  font-family: inherit;
}

.menu a:hover,
.menu-button:hover,
.menu-item.is-open .menu-button {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.menu .logout {
  color: var(--button-text);
}

.print-actions {
  display: grid;
  gap: 0.75rem;
}

.print-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.checkbox-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
}

.inventory-panel h2 {
  margin-top: 0;
}

.chart-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
}

.segmented {
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: 999px;
  background: #e3e3e3;
  border: 1px solid var(--line);
}

.segmented-button {
  font-family: inherit;
}

.segmented-button.is-active {
  background: var(--button-bg-hover);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.chart {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(36px, 1fr));
  gap: 0.5rem;
  align-items: end;
  min-height: 180px;
  margin-top: 1rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.chart-bar {
  position: relative;
  height: 100%;
  display: flex;
  align-items: flex-end;
}

.chart-bar::before {
  content: "";
  display: block;
  width: 100%;
  height: var(--bar-height, 10%);
  background: #7f7f7f;
  border-radius: 10px 10px 4px 4px;
  transition: height 0.2s ease;
}

.chart-bar.is-negative::before {
  background: #5a5a5a;
}

.chart-bar::after {
  content: attr(data-label) " " attr(data-value);
  position: absolute;
  bottom: -1.35rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.7rem;
  color: var(--muted);
  white-space: nowrap;
}

.menu-item {
  position: relative;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0;
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(31, 27, 22, 0.12);
  padding: 0.5rem;
  display: none;
  z-index: 20;
}

.menu-item.is-open .dropdown-menu {
  display: block;
}

.dropdown-menu a {
  display: block;
  width: 100%;
}

.dropdown-menu a:hover {
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.submenu-item {
  position: relative;
}

.submenu-button {
  width: 100%;
  background: none;
  border: none;
  padding: 0.45rem 0.5rem;
  text-align: left;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.submenu-button:hover,
.submenu-item.is-open .submenu-button {
  color: var(--button-text);
  background: rgba(0, 0, 0, 0.04);
  border-radius: 10px;
}

.submenu-menu {
  position: absolute;
  top: 0;
  left: calc(100% + 0.4rem);
  min-width: 220px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(31, 27, 22, 0.12);
  padding: 0.5rem;
  display: none;
  z-index: 30;
}

.submenu-item.is-open .submenu-menu {
  display: block;
}

.submenu-menu a {
  display: block;
  width: 100%;
}

.submenu-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.35rem 0.5rem 0.15rem;
}

.content {
  flex: 1;
  background: var(--panel);
  border-radius: 18px;
  border: 1px solid var(--line);
  padding: 2.5rem;
  box-shadow: 0 20px 40px rgba(31, 27, 22, 0.08);
}

.order-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  align-items: center;
  margin: 1rem 0 1.5rem;
}

.order-actions form {
  margin: 0;
}

.button-link,
.button-primary {
  box-shadow: 0 10px 18px rgba(31, 27, 22, 0.12);
  text-align: center;
}

.button-link:hover,
.button-primary:hover {
  box-shadow: 0 14px 22px rgba(31, 27, 22, 0.16);
}

h1, h2, h3 {
  margin-top: 0;
}

.grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem;
  background: #f5f5f5;
}

.muted {
  color: var(--muted);
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-grid .form-row {
  margin-bottom: 0;
}

.premium-row {
  display: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.premium-row.is-open {
  display: grid;
}

@media (max-width: 900px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

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

label {
  font-weight: 600;
}

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

input, select, textarea {
  padding: 0.6rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.usa-pricing-table .compact-name {
  width: 28ch;
  max-width: 28ch;
}

.usa-pricing-table .compact-10ch {
  width: 10ch;
}

.usa-pricing-table .compact-8ch {
  width: 8ch;
}

.usa-pricing-table .math-preview {
  font-size: 0.85rem;
  line-height: 1.35;
}

.usa-pricing-table .math-preview-row td {
  padding-top: 0;
  padding-bottom: 0.75rem;
}

input[type="number"] {
  -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field-error {
  border-color: #c0392b;
  background: #fff1f0;
}

button {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.14);
}

.order-action-form {
  margin: 0.5rem 0;
}

.item-actions button {
  margin: 0.2rem 0.35rem 0.2rem 0;
}

.item-actions {
  width: 100%;
  min-width: 160px;
}

.item-actions button {
  width: 100%;
  margin: 0.2rem 0;
  padding: 0.35rem 0.4rem;
  border-radius: 12px;
}

.input-count {
  width: 4ch;
}

.input-weight {
  width: 6ch;
}

.input-price {
  width: 7ch;
}

.input-notes {
  width: 16ch;
  max-width: 100%;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}

.order-table {
  table-layout: fixed;
}

.actions-cell {
  width: 150px;
}

.col-metal {
  width: 90px;
}

.col-count {
  width: 70px;
}

.col-weight {
  width: 95px;
}

.col-price {
  width: 90px;
}

.col-notes {
  width: 170px;
}

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

.spot-banner {
  background: #3a3a3a;
  color: #f4f4f4;
  border-radius: 16px;
  padding: 0.9rem 1.25rem;
  box-shadow: 0 12px 24px rgba(31, 27, 22, 0.18);
}

.pricing-page {
  background: #000;
  color: #e6e6e6;
}

.pricing-page .spot-banner {
  background: #d0d0d0;
  color: #000;
  border: 2px solid #2b2b2b;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.35);
}

.pricing-page .spot-section-title {
  color: var(--accent);
}

.pricing-page .spot-ask,
.pricing-page .spot-bid,
.pricing-page .spot-source {
  color: #000;
}

.pricing-page .spot-banner .muted {
  color: #000;
}

.pricing-page .muted {
  color: #bfbfbf;
}

.spot-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.spot-section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.08rem;
  text-transform: uppercase;
  color: var(--accent);
}

.spot-section-title-live {
  font-size: 1.7rem;
  letter-spacing: 0.1rem;
}

.pricing-page-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1rem 1.5rem;
  margin-bottom: 1.5rem;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 12px 24px rgba(31, 27, 22, 0.08);
}

.pricing-page .pricing-page-header {
  align-items: stretch;
  gap: 0.75rem;
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.pricing-welcome-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.pricing-logo {
  width: 140px;
  height: auto;
  display: block;
}

.pricing-welcome-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}

.pricing-page .pricing-welcome-title {
  color: #000;
}

.pricing-page .button-primary {
  margin-top: 1.5rem;
  box-shadow: 0 10px 18px rgba(0, 0, 0, 0.25);
}

@media (max-width: 700px) {
  .pricing-page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .pricing-welcome-banner {
    flex-direction: column;
    align-items: flex-start;
  }

  .pricing-logo {
    width: 120px;
  }
}

.spot-banner .muted {
  color: #d0d0d0;
  margin: 0.4rem 0 0;
}

.spot-mode {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
}

.spot-mode-toggle {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.25rem;
  margin: 0;
}

.spot-mode-button {
  font-size: 0.78rem;
  font-weight: 700;
}

.spot-mode-button.is-active {
  background: var(--button-bg-hover);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15) inset;
}

.spot-mode-current {
  font-weight: 700;
  color: #e0e0e0;
}

.spot-grid {
  display: grid;
  gap: 0.9rem;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.spot-grid-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1rem;
  align-items: start;
}

.spot-row {
  display: grid;
  gap: 0.35rem;
}

.spot-label {
  font-weight: 700;
  font-size: 0.95rem;
}

.spot-values {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.98rem;
}

.spot-source {
  font-size: 0.78rem;
  color: #d0d0d0;
}

.spot-mode-stack {
  display: flex;
  align-items: flex-start;
  padding-top: 0;
}

.spot-ask {
  color: #b7d7b7;
  font-weight: 600;
  font-size: 1rem;
}

.spot-bid {
  color: #e0b0b0;
  font-weight: 600;
  font-size: 1rem;
}

.spot-link {
  font-weight: 600;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0 1.25rem;
  border-bottom: none;
}

.tab-button {
  font-weight: 700;
}

.tab-button.is-active {
  background: var(--button-bg-hover);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.75rem 0 1rem;
  border-bottom: none;
}

.subtab-button {
  font-weight: 700;
}

.subtab-button.is-active {
  background: var(--button-bg-hover);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
}

.button-small {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
}

.us-currency-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

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

.compact-table th,
.compact-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 0.92rem;
}

.currency-table .currency-images {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.currency-table .currency-images img {
  height: 58px;
  width: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 2px;
}

.currency-table .currency-name {
  font-weight: 600;
}

.currency-table .currency-qty {
  width: 8ch;
  max-width: 100%;
}

.currency-table .currency-total {
  font-weight: 700;
}

.us-currency-panel .us-input {
  width: 10ch;
  max-width: 100%;
}

.us-currency-panel .us-condition {
  width: 12ch;
  max-width: 100%;
}

.us-currency-panel .currency-images {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.us-currency-panel .currency-images img {
  height: 58px;
  width: auto;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 2px;
}

@media (max-width: 700px) {
  .site-header {
    padding: 1rem 1.25rem;
  }

  .layout {
    width: min(96vw, 700px);
  }

  .content {
    padding: 1.5rem;
  }

  .menu-item {
    width: 100%;
  }

  .dropdown-menu {
    position: static;
    width: 100%;
    box-shadow: none;
    margin-top: 0.4rem;
  }

  .currency-table .currency-images img {
    height: 44px;
  }

  .us-currency-panel .currency-images img {
    height: 44px;
  }
}

@media print {
  .site-header,
  .order-actions,
  .print-actions {
    display: none !important;
  }

  .content {
    border: none;
    box-shadow: none;
  }

  .print-hidden {
    display: none !important;
  }
}
.input-category {
  width: 11ch;
  max-width: 100%;
}

.input-item {
  width: 18ch;
  max-width: 100%;
}

.spot-pricing-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.spot-pricing-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pricing-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
  background: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pricing-block.pricing-live {
  background: #eeeeee;
  border-color: #cfcfcf;
}

.pricing-block.pricing-locked {
  background: #f5f5f5;
}

.pricing-label {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: 0.12rem;
  text-transform: uppercase;
  color: var(--accent);
}

.pricing-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.pricing-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12rem;
  color: var(--muted);
}

.pricing-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.pricing-meta {
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .pricing-values {
    grid-template-columns: 1fr;
  }
}

.pricing-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
