* { box-sizing: border-box; }

body { min-width: 320px; background: var(--bg); color: var(--text); }
button, input, select { font: inherit; }
button { cursor: pointer; }

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.uc-app { width: min(1260px, calc(100% - 40px)); margin: 0 auto; padding: 22px 0 80px; }
.uc-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; padding: 24px 0 28px; }
.uc-hero > div:first-child { max-width: 790px; }
.uc-kicker,
.uc-side-heading span,
.uc-card-heading span,
.uc-info-card > div > span,
.uc-table-card > header > div > span {
  display: block;
  margin: 0;
  color: var(--accent-strong);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .13em;
}
.uc-hero h1 { margin: 7px 0 10px; }
.uc-hero > div:first-child > p:last-child { max-width: 720px; margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.65; }
.uc-hero-badge { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; min-width: 210px; padding: 14px 17px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.uc-hero-badge > i { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; background: var(--core-title-gradient); color: #fff; }
.uc-hero-badge strong, .uc-hero-badge span { display: block; }
.uc-hero-badge strong { font-size: 1.15rem; }
.uc-hero-badge span { color: var(--muted); font-size: .76rem; }

.uc-workspace { display: grid; grid-template-columns: 286px minmax(0, 1fr); gap: 22px; align-items: start; }
.uc-side { position: sticky; top: calc(var(--header-height) + 16px); max-height: calc(100vh - var(--header-height) - 32px); display: flex; flex-direction: column; min-width: 0; padding: 16px; border: 1px solid var(--line); border-radius: 20px; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow); }
.back-link { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; margin-bottom: 16px; color: var(--muted); text-decoration: none; font-size: .8rem; font-weight: 700; }
.back-link:hover { color: var(--accent-strong); }
.uc-side-heading { display: grid; gap: 2px; margin-bottom: 11px; }
.uc-side-heading strong { font-size: 1rem; }
.uc-family-search,
.uc-unit-search { position: relative; display: flex; align-items: center; min-width: 0; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); }
.uc-family-search:focus-within,
.uc-unit-search:focus-within,
.uc-value-control:focus-within,
.uc-input-block select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--core-focus); outline: none; }
.uc-family-search > i,
.uc-unit-search > i { flex: 0 0 auto; margin-left: 11px; color: var(--accent-strong); font-size: .78rem; }
.uc-family-search input,
.uc-unit-search input { width: 100%; min-width: 0; height: 40px; padding: 0 9px; border: 0; outline: 0; background: transparent; color: var(--text); }
.uc-family-search input::-webkit-search-cancel-button,
.uc-unit-search input::-webkit-search-cancel-button { display: none; }
.uc-family-search button { flex: 0 0 30px; width: 30px; height: 30px; margin-right: 4px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); }
.uc-family-search button:hover { background: var(--accent-soft); color: var(--accent-strong); }
.uc-families { min-height: 0; margin-top: 12px; overflow: auto; scrollbar-width: thin; }
.uc-family-group { margin: 14px 8px 5px; color: var(--muted); font-size: .65rem; font-weight: 800; letter-spacing: .12em; }
.uc-family-group:first-child { margin-top: 2px; }
.uc-family-button { width: 100%; display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: 42px; padding: 5px 8px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--text); text-align: left; }
.uc-family-button i:first-child { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--surface-2); color: var(--accent-strong); font-size: .76rem; }
.uc-family-button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .8rem; font-weight: 650; }
.uc-family-button small { color: var(--muted); font-size: .65rem; }
.uc-family-button:hover { background: var(--surface-2); }
.uc-family-button.is-active { border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); background: var(--accent-soft); color: var(--accent-strong); }
.uc-family-button.is-active i:first-child { background: var(--core-title-gradient); color: #fff; }
.uc-family-empty { margin: 12px 2px; color: var(--muted); font-size: .8rem; }

.uc-main { min-width: 0; }
.uc-converter-card,
.uc-info-card,
.uc-precision-card,
.uc-table-card { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); }
.uc-converter-card { padding: 22px; border-radius: 22px; }
.uc-card-heading { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: start; gap: 13px; }
.uc-family-mark { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--core-title-gradient); color: #fff; box-shadow: 0 9px 20px color-mix(in srgb, var(--accent) 22%, transparent); }
.uc-card-heading h2 { margin: 2px 0 1px; font-size: 1.35rem; }
.uc-card-heading p { margin: 0; color: var(--muted); font-size: .82rem; }
.uc-quiet-button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: .78rem; font-weight: 700; }
.uc-quiet-button:hover { border-color: var(--accent); color: var(--accent-strong); }

.uc-form { display: grid; grid-template-columns: minmax(0, 1fr) 76px minmax(0, 1fr); gap: 14px; align-items: end; margin-top: 22px; }
.uc-input-block { display: grid; gap: 7px; min-width: 0; }
.uc-input-block > label:first-child { color: var(--muted); font-size: .75rem; font-weight: 750; }
.uc-value-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; min-height: 60px; border: 1px solid var(--line); border-radius: 13px; background: var(--surface-2); transition: border-color .16s ease, box-shadow .16s ease; }
.uc-value-control input { width: 100%; min-width: 0; height: 58px; padding: 0 5px 0 15px; border: 0; outline: 0; background: transparent; color: var(--text); font-size: clamp(1.25rem, 2vw, 1.65rem); font-weight: 700; }
.uc-value-control span { max-width: 100px; margin-right: 13px; overflow: hidden; color: var(--accent-strong); font-size: .83rem; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.uc-input-block select { width: 100%; height: 44px; padding: 0 38px 0 12px; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: var(--surface); color: var(--text); font-size: .82rem; font-weight: 650; }
.uc-swap,
.uc-gradient-button { border: 0; background: var(--core-title-gradient); color: #fff; box-shadow: 0 9px 22px color-mix(in srgb, var(--accent) 25%, transparent); font-weight: 750; }
.uc-swap { height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin-bottom: 0; border-radius: 12px; font-size: .75rem; }
.uc-swap:hover,
.uc-gradient-button:hover { filter: saturate(1.08) brightness(1.03); transform: translateY(-1px); }
.uc-swap.is-swapping i { animation: ucSwap .35s ease; }
@keyframes ucSwap { 50% { transform: rotate(180deg) scale(1.08); } }
.uc-input-help { margin: 10px 0 0; color: var(--muted); font-size: .75rem; }
.uc-input-help i { color: var(--accent-strong); }
.uc-input-help code { padding: 1px 4px; border-radius: 4px; background: var(--surface-2); color: var(--text); }
.uc-validation { margin: 9px 0 0; padding: 9px 11px; border-left: 3px solid #d93025; background: color-mix(in srgb, #d93025 9%, var(--surface)); color: #b3261e; font-size: .8rem; }
html[data-theme="dark"] .uc-validation { color: #ffb4ab; }
.uc-result { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 17px; padding: 16px 17px; border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line)); border-radius: 16px; background: linear-gradient(115deg, var(--accent-soft), color-mix(in srgb, #7c4dff 8%, var(--surface))); }
.uc-result > div { min-width: 0; }
.uc-result span { display: block; color: var(--muted); font-size: .72rem; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.uc-result strong { display: block; max-width: 100%; overflow-wrap: anywhere; color: var(--text); font-size: clamp(1.25rem, 2.4vw, 2rem); letter-spacing: -.025em; }
.uc-result small { display: block; margin-top: 2px; color: var(--muted); }
.uc-gradient-button { flex: 0 0 auto; min-height: 42px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border-radius: 11px; }
.uc-gradient-button:disabled { cursor: not-allowed; filter: grayscale(.45); opacity: .55; transform: none; }

.uc-info-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-top: 14px; }
.uc-info-card,
.uc-precision-card { border-radius: 16px; }
.uc-info-card { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; padding: 16px; }
.uc-info-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-strong); }
.uc-info-card h3 { margin: 2px 0 3px; font-size: 1rem; }
.uc-info-card p { margin: 0; color: var(--muted); font-size: .78rem; line-height: 1.55; }
.uc-precision-card { padding: 0; overflow: hidden; }
.uc-precision-card summary { min-height: 68px; display: grid; align-content: center; gap: 2px; padding: 13px 15px; cursor: pointer; list-style: none; }
.uc-precision-card summary::-webkit-details-marker { display: none; }
.uc-precision-card summary span { display: flex; align-items: center; gap: 8px; font-size: .84rem; font-weight: 750; }
.uc-precision-card summary span i { color: var(--accent-strong); }
.uc-precision-card summary small { color: var(--muted); }
.uc-precision-controls { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 9px; padding: 0 15px 10px; }
.uc-precision-controls label { display: grid; gap: 4px; color: var(--muted); font-size: .7rem; font-weight: 700; }
.uc-precision-controls select,
.uc-precision-controls input { width: 100%; min-width: 0; height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--text); }
.uc-precision-card > p { margin: 0; padding: 0 15px 14px; color: var(--muted); font-size: .72rem; line-height: 1.45; }

.uc-table-card { margin-top: 14px; border-radius: 18px; overflow: hidden; }
.uc-table-card > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 17px; border-bottom: 1px solid var(--line); }
.uc-table-card h2 { margin: 1px 0 0; font-size: 1rem; }
.uc-unit-search { width: min(260px, 45%); }
.uc-table { max-height: 420px; overflow: auto; scrollbar-width: thin; }
.uc-table table { width: 100%; border-collapse: collapse; }
.uc-table th,
.uc-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.uc-table th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--muted); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; }
.uc-table td { font-size: .82rem; }
.uc-table td:first-child { width: 52%; }
.uc-table td:first-child strong,
.uc-table td:first-child small { display: block; }
.uc-table td:first-child small { margin-top: 1px; color: var(--muted); }
.uc-table td:nth-child(2) { width: 18%; color: var(--accent-strong); font-weight: 750; }
.uc-table td:last-child { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.uc-table tr.is-target td { background: var(--accent-soft); }
.uc-table-empty { padding: 22px; color: var(--muted); text-align: center; }
.uc-standards-note { display: flex; align-items: flex-start; gap: 8px; margin: 13px 3px 0; color: var(--muted); font-size: .74rem; }
.uc-standards-note i { margin-top: 3px; color: var(--accent-strong); }

@media (max-width: 900px) {
  .uc-app { width: min(100% - 24px, 760px); padding-top: 10px; }
  .uc-hero { align-items: flex-start; padding-top: 18px; }
  .uc-hero-badge { display: none; }
  .uc-workspace { grid-template-columns: 1fr; }
  .uc-side { position: static; max-height: none; }
  .uc-families { display: flex; gap: 7px; margin-top: 10px; padding-bottom: 5px; overflow-x: auto; }
  .uc-family-group { display: none; }
  .uc-family-button { flex: 0 0 auto; width: auto; grid-template-columns: 30px auto; }
  .uc-family-button small { display: none; }
}

@media (max-width: 650px) {
  .uc-hero { padding-bottom: 18px; }
  .uc-converter-card { padding: 15px; border-radius: 18px; }
  .uc-card-heading { grid-template-columns: 42px minmax(0, 1fr); }
  .uc-family-mark { width: 42px; height: 42px; }
  .uc-card-heading .uc-quiet-button { grid-column: 1 / -1; justify-self: end; margin-top: -2px; }
  .uc-form { grid-template-columns: 1fr; gap: 9px; }
  .uc-swap { width: 96px; justify-self: center; }
  .uc-result { align-items: stretch; flex-direction: column; }
  .uc-gradient-button { width: 100%; }
  .uc-info-grid { grid-template-columns: 1fr; }
  .uc-table-card > header { align-items: stretch; flex-direction: column; }
  .uc-unit-search { width: 100%; }
  .uc-table th, .uc-table td { padding: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .uc-swap.is-swapping i { animation: none; }
  .uc-swap:hover, .uc-gradient-button:hover { transform: none; }
}
