/* Rubox logistics — single light design system aligned with the site
   (Roboto, white surfaces, #3A3A3A / #54595F text, lime #D6E100 accent). */
.rubox-logistics,
.rubox-logistics * { box-sizing: border-box; }

.rubox-logistics {
  --rb-accent: #D6E100;
  --rb-accent-ink: #3A3A3A;
  --rb-heading: #3A3A3A;
  --rb-copy: #54595F;
  --rb-muted: #7c828a;
  --rb-line: #e4e7ea;
  --rb-field: #ffffff;
  --rb-field-line: #d7dbdf;
  --rb-surface-2: #f6f7f8;
  max-width: 1140px;
  margin: 40px auto;
  padding: clamp(24px, 4vw, 48px);
  border: 1px solid var(--rb-line);
  border-top: 4px solid var(--rb-accent);
  border-radius: 10px;
  background: #fff;
  color: var(--rb-heading);
  font-family: Roboto, Arial, sans-serif;
  box-shadow: 0 16px 45px rgba(31, 42, 53, .08);
}

.rubox-logistics__head { max-width: 760px; margin-bottom: 28px; }
.rubox-logistics__head h2 { margin: 6px 0 10px; color: var(--rb-heading); font-size: clamp(26px, 4vw, 40px); line-height: 1.15; }
.rubox-logistics__head p { margin: 0; color: var(--rb-copy); line-height: 1.6; }
.rubox-logistics__head .rubox-kicker { color: #8f9700; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; }

/* Form layout */
.rubox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.rubox-logistics label,
.rubox-volume-method { display: flex; flex-direction: column; gap: 8px; color: var(--rb-heading); font-weight: 600; }
.rubox-logistics label small { color: var(--rb-muted); font-weight: 400; }

.rubox-logistics input,
.rubox-logistics select {
  width: 100%;
  min-height: 52px;
  padding: 0 15px;
  border: 1px solid var(--rb-field-line);
  border-radius: 6px;
  background: var(--rb-field);
  color: var(--rb-heading);
  font: inherit;
}
.rubox-logistics input::placeholder { color: #9aa0a6; }
.rubox-delivery select[name="package_type"] {
  padding-right: 42px;
  background-color: var(--rb-field);
  background-image: linear-gradient(45deg, transparent 50%, var(--rb-copy) 50%), linear-gradient(135deg, var(--rb-copy) 50%, transparent 50%);
  background-position: calc(100% - 18px) 23px, calc(100% - 13px) 23px;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}
.rubox-logistics input:focus,
.rubox-logistics select:focus { outline: none; border-color: #bfc900; box-shadow: 0 0 0 3px rgba(214, 225, 0, .25); }

.rubox-volume-method { border: 0; padding: 0; margin: 0; }
.rubox-volume-method legend { margin-bottom: 8px; padding: 0; }
.rubox-volume-method label { display: inline-flex; flex-direction: row; align-items: center; gap: 8px; margin-right: 18px; color: var(--rb-copy); font-weight: 400; }
.rubox-volume-method input { width: auto; min-height: auto; accent-color: var(--rb-accent); }

.rubox-dimensions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin: 18px 0; }
.rubox-direct-volume { margin: 18px 0; }

/* Primary action */
.rubox-primary-button {
  min-height: 54px;
  padding: 0 28px;
  margin-top: 4px;
  border: 0;
  border-radius: 6px;
  background: var(--rb-accent);
  color: var(--rb-accent-ink);
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}
.rubox-primary-button:hover { background: var(--rb-accent-ink); color: #fff; transform: translateY(-1px); }
.rubox-primary-button:disabled { opacity: .65; cursor: wait; transform: none; }

.rubox-message { margin-top: 18px; color: var(--rb-copy); }
.rubox-message--error { padding: 13px 15px; border: 1px solid #f0c2c2; border-radius: 6px; background: #fdf1f1; color: #a3282a; }

/* Calculator result */
.rubox-result { margin-top: 26px; padding: 24px; border: 1px solid var(--rb-line); border-top: 3px solid var(--rb-accent); border-radius: 10px; background: var(--rb-surface-2); }
.rubox-result > div:first-child { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.rubox-result > div:first-child span { color: var(--rb-copy); font-weight: 600; }
.rubox-result strong { color: var(--rb-heading); font-size: clamp(32px, 6vw, 50px); line-height: 1; }
.rubox-result dl { margin: 22px 0 0; }
.rubox-result dl div { display: flex; justify-content: space-between; gap: 15px; padding: 11px 0; border-bottom: 1px solid var(--rb-line); }
.rubox-result dt { color: var(--rb-copy); }
.rubox-result dd { margin: 0; font-weight: 700; color: var(--rb-heading); }
.rubox-result > p { margin: 16px 0 0; color: var(--rb-muted); font-size: 14px; }

/* TN VED search */
.rubox-tnved__form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; padding: 8px; border: 1px solid var(--rb-field-line); border-radius: 8px; background: var(--rb-surface-2); }
.rubox-tnved__form input { min-height: 56px; padding: 0 18px; border: 1px solid var(--rb-field-line); border-radius: 6px; background: #fff; color: var(--rb-heading); }
.rubox-tnved__form input::placeholder { color: #9aa0a6; }
.rubox-tnved__form input:focus { outline: none; border-color: #bfc900; box-shadow: 0 0 0 3px rgba(214, 225, 0, .25); }
.rubox-tnved__form .rubox-primary-button { min-width: 150px; min-height: 56px; margin-top: 0; }

.rubox-search-tabs { display: inline-flex; gap: 4px; margin-top: 18px; padding: 4px; border: 1px solid var(--rb-line); border-radius: 8px; background: var(--rb-surface-2); }
.rubox-search-tabs button { min-height: 42px; padding: 0 18px; border: 0; border-radius: 6px; background: transparent; color: var(--rb-copy); font: inherit; font-weight: 700; cursor: pointer; transition: background .2s ease, color .2s ease, box-shadow .2s ease; }
.rubox-search-tabs button[aria-selected="true"] { background: #fff; color: var(--rb-heading); box-shadow: 0 2px 8px rgba(31, 42, 53, .1); }
.rubox-search-tabs button:hover { color: var(--rb-heading); }
.rubox-search-tabs button:focus-visible { outline: 2px solid #bfc900; outline-offset: 2px; }

.rubox-tnved__reference-status.is-loading { display: flex; align-items: center; gap: 10px; min-height: 24px; color: var(--rb-muted); }
.rubox-search-spinner { width: 16px; height: 16px; border: 2px solid #dfe3e6; border-top-color: #9da600; border-radius: 50%; animation: rubox-search-spin .7s linear infinite; }
@keyframes rubox-search-spin { to { transform: rotate(360deg); } }

.rubox-tnved__results { display: grid; gap: 14px; margin-top: 22px; }
.rubox-tnved-card { display: grid; grid-template-columns: 170px minmax(0, 1fr); align-items: start; gap: 18px; padding: 20px; border: 1px solid var(--rb-line); border-radius: 8px; background: #fff; color: var(--rb-heading); box-shadow: 0 6px 20px rgba(31, 42, 53, .05); }
.rubox-tnved-card h3 { margin: 0 0 8px; color: var(--rb-heading); font-size: 17px; line-height: 1.45; }
.rubox-tnved-card p { margin: 0; color: var(--rb-copy); font-size: 14px; }
.rubox-tnved-card p b { color: var(--rb-heading); }
.rubox-level { color: var(--rb-muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }

/* Hierarchical TN VED reference */
.rubox-tree-table { overflow-x: auto; border: 1px solid var(--rb-line); border-radius: 8px; background: #fff; box-shadow: 0 6px 20px rgba(31, 42, 53, .04); }
.rubox-tree-head,
.rubox-tree-row { display: grid; grid-template-columns: 28px 125px minmax(240px, 1.35fr) minmax(250px, 1fr); align-items: center; gap: 10px; min-width: 760px; }
.rubox-tree-head { padding: 11px 14px; background: var(--rb-surface-2); color: var(--rb-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.rubox-tnved-tree,
.rubox-tnved-tree ul { margin: 0; padding: 0; list-style: none; }
.rubox-tnved-tree ul { margin-left: 28px; border-left: 1px solid #dfe3b2; }
.rubox-tree-row { position: relative; padding: 12px 14px; border-top: 1px solid var(--rb-line); color: var(--rb-copy); }
.rubox-tree-node.is-match > .rubox-tree-row { background: #fefff5; }
.rubox-tree-row strong { color: var(--rb-heading); font-size: 14px; line-height: 1.45; }
.rubox-tree-row > span:last-child { font-size: 13px; line-height: 1.45; }
.rubox-tree-row b { color: var(--rb-heading); }
.rubox-tree-category { color: var(--rb-muted); font-style: italic; }
.rubox-tree-toggle { position: relative; width: 26px; height: 26px; padding: 0; border: 1px solid var(--rb-field-line); border-radius: 6px; background: #fff; color: var(--rb-heading); cursor: pointer; transition: border-color .2s ease, background-color .2s ease; }
.rubox-tree-toggle::before { content: ''; position: absolute; top: 50%; left: 50%; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translate(-50%, -65%) rotate(45deg); transition: transform .2s ease; }
.rubox-tree-toggle[aria-expanded="false"]::before { transform: translate(-65%, -50%) rotate(-45deg); }
.rubox-tree-toggle:hover { border-color: #bfc900; background: #f8f9dd; }
.rubox-tree-toggle:focus-visible { outline: 2px solid #bfc900; outline-offset: 2px; }
.rubox-tree-spacer { width: 26px; }
.rubox-tree-code { justify-self: start; padding: 8px 10px; border: 0; border-radius: 5px; background: var(--rb-accent); color: var(--rb-accent-ink); font-weight: 700; cursor: pointer; white-space: nowrap; transition: background .2s ease, color .2s ease; }
.rubox-tree-code:hover { background: var(--rb-accent-ink); color: #fff; }
.rubox-empty-result { margin: 0; color: var(--rb-copy); }

/* Copy-code chips (reference cards + statistics) */
.rubox-tnved-card button,
.rubox-declarations-group button {
  align-self: start;
  padding: 12px 14px;
  border: 0;
  border-radius: 6px;
  background: var(--rb-accent);
  color: var(--rb-accent-ink);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background .2s ease, color .2s ease;
}
.rubox-tnved-card button:hover,
.rubox-declarations-group button:hover { background: var(--rb-accent-ink); color: #fff; }

/* Declaration statistics block */
.rubox-declarations { margin-top: 22px; }
.rubox-declarations h3 { margin: 0 0 16px; color: var(--rb-heading); }
.rubox-declarations-group { background: #fff; border: 1px solid var(--rb-line); border-radius: 8px; margin: 0 0 14px; padding: 18px; box-shadow: 0 6px 20px rgba(31, 42, 53, .04); }
.rubox-declarations-group h4 { margin: 0 0 8px; color: var(--rb-heading); }
.rubox-declarations-group > p { margin: 0 0 12px; color: var(--rb-copy); }
.rubox-declarations-group > div { display: flex; align-items: flex-start; gap: 14px; padding: 10px 0; border-top: 1px solid var(--rb-line); }
.rubox-declarations-group > div span { color: var(--rb-copy); font-size: 14px; line-height: 1.5; }
.rubox-declarations-duty { display: block; margin-top: 4px; font-size: 13px; color: var(--rb-muted); }
.rubox-declarations-duty b { color: var(--rb-heading); }

/* Pagination */
.rubox-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; margin-top: 24px; }
.rubox-pagination span { color: var(--rb-copy); font-weight: 600; }
.rubox-pagination button { padding: 10px 16px; border: 1px solid var(--rb-field-line); border-radius: 6px; background: #fff; color: var(--rb-heading); cursor: pointer; transition: background .2s ease, border-color .2s ease; }
.rubox-pagination button:not(:disabled):hover { border-color: #bfc900; background: #f8f9dd; }
.rubox-pagination button:disabled { opacity: .4; cursor: default; }

[hidden] { display: none !important; }

@media (max-width: 720px) {
  .rubox-logistics { margin: 20px 12px; padding: 24px 18px; border-radius: 10px; }
  .rubox-grid,
  .rubox-dimensions,
  .rubox-tnved__form,
  .rubox-tnved-card { grid-template-columns: 1fr; }
  .rubox-tnved__form .rubox-primary-button,
  .rubox-tnved-card button { width: 100%; }
  .rubox-result > div:first-child { flex-direction: column; align-items: flex-start; gap: 8px; }
  .rubox-search-tabs { display: grid; grid-template-columns: 1fr; width: 100%; }
  .rubox-search-tabs button { width: 100%; }
  .rubox-tree-head { display: none; }
  .rubox-tree-row { grid-template-columns: 28px minmax(100px, auto) minmax(220px, 1fr); min-width: 560px; }
  .rubox-tree-row > span:last-child { grid-column: 2 / -1; }
}

@media (max-width: 600px) {
  .rubox-declarations-group > div { flex-direction: column; }
  .rubox-declarations-group button { margin-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  .rubox-search-spinner { animation-duration: 1.5s; }
}
