.rd-card { padding: 28px; }
.rd-title-bar { background: linear-gradient(135deg, var(--site-dark, #0f766e) 0%, var(--site-dark-2, #115e59) 100%); border-radius: 10px 10px 0 0; padding: 18px 24px; margin: -28px -28px 24px; }
.rd-title-bar h1 { color: #fff; margin: 0; font-size: 1.4em; text-align: center; }

.rd-tabs { display: flex; flex-wrap: wrap; gap: 6px; background: #f7f8fa; border: 1px solid #e5e7eb; border-radius: 30px; padding: 6px; justify-content: center; margin-bottom: 22px; }
.rd-tab { background: none; border: none; border-radius: 24px; padding: 9px 16px; font-weight: 600; font-size: .88em; color: #6b7280; cursor: pointer; white-space: nowrap; transition: background .2s ease, color .2s ease; }
.rd-tab:hover { color: var(--site-dark, #0f766e); }
.rd-tab[aria-selected="true"] { background: var(--site-dark, #0f766e); color: #fff; }
.rd-tab:focus-visible, .rd-btn:focus-visible, .rd-input:focus-visible, .rd-select:focus-visible, .rd-link-btn:focus-visible { outline: 3px solid rgba(20,184,166,.45); outline-offset: 2px; }

.rd-panel[hidden] { display: none; }
.rd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 18px; margin-bottom: 18px; }
.rd-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.rd-field > label { font-weight: 600; font-size: .86em; color: #374151; }
.rd-input, .rd-select { width: 100%; box-sizing: border-box; border: 1px solid #ddd; border-radius: 8px; padding: 10px 12px; font-size: .95em; background: #fff; color: #23272f; }
.rd-input:focus, .rd-select:focus { border-color: var(--site-light, #14b8a6); outline: none; }
.rd-hint { font-size: .8em; color: #6b7280; line-height: 1.45; }

.rd-btn { display: inline-flex; align-items: center; gap: 8px; border: none; border-radius: 30px; padding: 10px 22px; font-weight: 600; font-size: .92em; cursor: pointer; background: var(--site-dark, #0f766e); color: #fff; transition: background .2s ease; }
.rd-btn:hover { background: var(--site-dark-2, #115e59); }
.rd-btn-ghost { background: #f3f4f6; color: #374151; border: 1px solid #ddd; }
.rd-btn-ghost:hover { background: #eceef1; }
.rd-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 18px; }

.rd-error { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; border-radius: 8px; padding: 10px 14px; font-size: .9em; margin-bottom: 16px; }
.rd-error[hidden] { display: none; }

.rd-output { background: #f7f8fa; border: 1px solid #eee; border-radius: 10px; padding: 18px; text-align: center; min-height: 64px; }
.rd-big { font-size: 2.1em; font-weight: 700; color: #23272f; font-variant-numeric: tabular-nums; word-break: break-word; }
.rd-list-text { font-family: "Courier New", monospace; font-size: .95em; color: #23272f; word-break: break-word; line-height: 1.6; }
.rd-empty { color: #9aa0aa; font-size: .9em; }
.rd-tally { margin-top: 12px; font-size: .9em; color: #374151; }

.rd-breakdown { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; text-align: left; }
.rd-breakdown li { background: #fff; border: 1px solid #eee; border-radius: 8px; padding: 10px 12px; font-size: .9em; color: #374151; word-break: break-word; }
.rd-breakdown code { font-family: "Courier New", monospace; color: #23272f; }

.rd-history { margin-top: 26px; border-top: 1px solid #eee; padding-top: 18px; }
.rd-history-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.rd-history-head h3 { font-size: 1em; margin: 0; color: #23272f; }
.rd-link-btn { background: none; border: none; color: var(--site-dark, #0f766e); font-weight: 600; font-size: .88em; cursor: pointer; padding: 4px 6px; }
.rd-history-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.rd-history-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; background: #f7f8fa; border: 1px solid #eee; border-radius: 8px; padding: 8px 12px; font-size: .88em; color: #374151; }
.rd-history-label { font-weight: 600; color: #23272f; }
.rd-history-result { font-family: "Courier New", monospace; word-break: break-word; max-width: 100%; }

@media (max-width: 600px) {
    .rd-card { padding: 20px 16px; }
    .rd-title-bar { margin: -20px -16px 20px; }
    .rd-grid { grid-template-columns: 1fr; }
    .rd-tab { flex: 1 1 auto; text-align: center; padding: 9px 10px; }
    .rd-actions { flex-direction: column; }
    .rd-btn { justify-content: center; width: 100%; }
    .rd-big { font-size: 1.7em; }
}
