:root {
    --tools-bg: #f6f4ed;
    --tools-ink: #0f1b2d;
    --tools-muted: #5c6b80;
    --tools-card: #ffffff;
    --tools-border: #e5e7eb;
    --tools-accent: #1f57ff;
}

.tools-shell {
    max-width: 1100px;
    margin: 24px auto 64px;
    padding: 0 20px;
    color: var(--tools-ink);
}

.tools-back {
    display: inline-block;
    margin-bottom: 12px;
    color: #6b46c1;
    text-decoration: none;
    font-weight: 700;
}

.tools-back:hover {
    text-decoration: underline;
}

.tools-hero {
    background: var(--tools-card);
    border: 1px solid var(--tools-border);
    border-radius: 20px;
    padding: 26px 28px;
    box-shadow: 0 10px 28px rgba(17, 24, 39, 0.08);
}

.tools-hero h1 {
    margin: 6px 0 12px;
    font-size: clamp(1.7rem, 1.6vw + 1rem, 2.4rem);
    letter-spacing: -0.02em;
}

.lead {
    color: var(--tools-muted);
    line-height: 1.6;
    margin: 0;
}

.eyebrow {
    display: inline-block;
    padding: 6px 10px;
    background: #eef3ff;
    color: #1a46c7;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
}

.tools-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
}

.tool-card {
    display: flex;
    flex-direction: column;
    background: var(--tools-card);
    border: 1px solid var(--tools-border);
    border-radius: 16px;
    padding: 18px 18px 16px;
    text-decoration: none;
    color: var(--tools-ink);
    box-shadow: 0 8px 18px rgba(17, 24, 39, 0.05);
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
    min-height: 220px;
}

.tool-card-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.tool-card:hover,
.tool-card:focus-visible {
    transform: translateY(-2px);
    border-color: #cbd5e1;
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.09);
}

.tool-card-category {
    color: #1a73e8;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 6px;
}

.tool-card-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
}

.tool-card-desc {
    margin: 0 0 14px;
    color: var(--tools-muted);
    line-height: 1.5;
    flex: 1;
}

.tool-card-link {
    color: #6b46c1;
    font-weight: 700;
    margin-top: auto;
}

.tools-empty {
    background: var(--tools-card);
    border: 1px dashed #cbd5e1;
    border-radius: 16px;
    padding: 28px 22px;
    text-align: center;
    color: #475569;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.placeholder-title {
    margin: 0 0 4px;
    font-weight: 700;
    color: var(--tools-ink);
}

.placeholder-copy {
    margin: 0;
    color: var(--tools-muted);
}

.tool-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #556074;
    margin-bottom: 10px;
    text-decoration: none;
}

.tool-breadcrumb a {
    color: #1a73e8;
    text-decoration: none;
    font-weight: 600;
}

.tool-breadcrumb a:hover {
    text-decoration: underline;
}

.crumb-current {
    color: #111827;
    font-weight: 700;
}

.tool-detail {
    background: var(--tools-card);
    border: 1px solid var(--tools-border);
    border-radius: 20px;
    padding: 24px 26px;
    box-shadow: 0 10px 28px rgba(17, 24, 39, 0.08);
}

.tool-note {
    background: #eef3ff;
    border: 1px solid #d7e3ff;
    color: #1f2937;
    border-radius: 12px;
    padding: 12px 14px;
    margin: 10px 0 14px;
    font-weight: 600;
}

.tool-header h1 {
    margin: 6px 0 8px;
    font-size: clamp(1.6rem, 1.4vw + 1rem, 2.2rem);
    letter-spacing: -0.02em;
}

.tool-panel {
    margin-top: 16px;
    border: 1px dashed #d2d6dc;
    background: #f8fafc;
    border-radius: 14px;
    padding: 18px;
}

.coming-soon {
    margin: 0 0 8px;
    font-weight: 700;
    color: var(--tools-ink);
}

.tool-form {
    display: grid;
    gap: 10px;
}

.tool-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.tool-field label {
    display: block;
    font-weight: 600;
    color: #111827;
    margin-bottom: 6px;
}

.tool-field input,
.tool-field textarea,
.tool-field select {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1rem;
    color: #1f2937;
    background: #fff;
}

.tool-field textarea {
    min-height: 140px;
    resize: vertical;
}

.tool-field textarea:disabled {
    cursor: not-allowed;
    background: #f3f4f6;
}

.char-limit {
    color: #6b7280;
    font-size: 0.9rem;
}

.tool-form button {
    width: 100%;
    max-width: 240px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: var(--tools-accent);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    opacity: 1;
}

.tool-clear-btn {
    background: #e5e7eb;
    color: #1f2937;
    border: 1px solid #d1d5db;
}

.tp-inline {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.tp-add-btn {
    width: auto !important;
    min-width: auto;
    padding: 10px 14px;
}

.tp-remove-btn {
    background: #e5e7eb;
    color: #1f2937;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    width: auto;
    min-width: auto;
    padding: 8px 12px;
    cursor: pointer;
}

.tool-run-btn[disabled] {
    cursor: not-allowed;
    opacity: 0.6;
}

.tool-status {
    margin-top: 8px;
    color: #374151;
    min-height: 18px;
}

.tool-status.error {
    color: #b91c1c;
}

.tool-status.success {
    color: #065f46;
}

.tool-output {
    margin-top: 12px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    padding: 12px;
}

.tool-output-label {
    font-weight: 700;
    margin-bottom: 8px;
    color: #111827;
}

.tool-output-pre {
    margin: 0;
    white-space: pre-wrap;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    color: #1f2937;
}

.tool-share {
    margin-top: 10px;
    border-top: 1px solid #e5e7eb;
    padding-top: 10px;
}

.tool-share-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-weight: 600;
    color: #1f2937;
}

.tool-free-plus {
    margin-top: 14px;
}

.tool-copy-share,
.tool-copy-btn {
    background: #eef3ff;
    border: 1px solid #d7e3ff;
    color: #1a46c7;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
}

.tool-copy-btn {
    display: none;
}

.tool-audio {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.tool-audio button {
    background: #eef3ff;
    border: 1px solid #d7e3ff;
    color: #1a46c7;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
}

.tool-audio-note {
    color: #6b7280;
    font-size: 0.95rem;
}

.chip-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.chip {
    background: #eef3ff;
    border: 1px solid #d7e3ff;
    color: #1a46c7;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
}

.share-sections {
    display: grid;
    gap: 16px;
}

.share-section h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
}

.tp-section {
    margin-top: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}

.share-table {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

.share-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #e5e7eb;
    align-items: center;
}

.share-row:last-child {
    border-bottom: none;
}

.share-head {
    background: #f3f4f6;
    font-weight: 700;
}

.tp-grid {
    grid-template-columns: 1fr 1fr 2fr 1fr 1fr 60px;
    align-items: center;
}

.tp-exp-grid {
    grid-template-columns: 1fr 1fr 1fr 1.5fr 1fr 70px;
    align-items: center;
}

.muted {
    color: #6b7280;
}

.result-card {
    margin-top: 14px;
    padding: 18px;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 8px 18px rgba(17, 24, 39, 0.05);
}

.result-card .chip-row {
    margin-top: 10px;
}

.result-title {
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 10px;
    color: #0f1b2d;
}

.result-primary {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.result-primary-label {
    color: #6b7280;
    font-weight: 600;
}

.result-primary-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: #1f2937;
}

.result-secondary {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
    color: #374151;
    font-weight: 600;
}

.result-secondary-value {
    font-weight: 700;
    color: #111827;
}

.result-subtext {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.pill.success {
    background: #ecfdf3;
    color: #166534;
}

.pill.warn {
    background: #fff7ed;
    color: #9a3412;
}

.pill.danger {
    background: #fef2f2;
    color: #b91c1c;
}

.detail-rows {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 8px;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    font-size: 0.95rem;
    color: #111827;
}

.detail-row span:last-child {
    font-weight: 700;
    color: #0f172a;
}

.compare-panel {
    margin-top: 12px;
    padding: 14px;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    background: #f8fafc;
}

.compare-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: #0f172a;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 8px;
}

.compare-col {
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
}

.compare-col.winner {
    border-color: #10b981;
    box-shadow: 0 0 0 1px #d1fae5 inset;
}

.compare-name {
    font-weight: 700;
    margin-bottom: 6px;
}

.compare-metric {
    font-size: 1.1rem;
    font-weight: 800;
    color: #111827;
}

.compare-note {
    color: #475569;
    font-size: 0.95rem;
}

.nudge-panel {
    margin-top: 12px;
    padding: 14px;
    border: 1px dashed #a5b4fc;
    border-radius: 12px;
    background: #f5f7ff;
}

.sp-meta {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.sp-copybox {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f9fafb;
    padding: 12px;
}

.sp-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
        "Segoe UI Emoji";
    font-size: 1rem;
    line-height: 1.5;
    color: #0f172a;
}

.sp-actions {
    margin-top: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: flex-start;
}

.sp-copy-btn {
    padding: 8px 12px;
    border-radius: 10px;
}

.sp-secondary {
    margin-top: 12px;
}

.sp-changes {
    margin: 0;
    padding-left: 18px;
    color: #334155;
    font-size: 0.98rem;
}

.sp-changes li {
    margin: 6px 0;
}

.sp-toggle {
    margin-top: 10px;
}

.sp-alt {
    margin-top: 10px;
    display: grid;
    gap: 12px;
}

.sp-alt-section {
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #ffffff;
    padding: 10px;
}

.sp-alt-title {
    font-weight: 700;
    margin-bottom: 8px;
    color: #0f172a;
}

.sp-alt-text {
    margin-bottom: 10px;
}

/* ---- Workout Log (client-only) ---- */
.wl-section-title {
    font-weight: 800;
    margin: 14px 0 10px;
    color: #0f172a;
}

.wl-sets {
    margin-top: 6px;
}

.wl-table {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
}

.wl-row {
    display: grid;
    grid-template-columns: 2.2fr 0.7fr 0.7fr 0.9fr 0.6fr auto;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
}

.wl-head {
    background: #f3f4f6;
    font-weight: 800;
    color: #111827;
    font-size: 0.95rem;
}

.wl-item {
    border-top: 1px solid #e5e7eb;
    background: #fff;
}

.wl-item input,
.wl-item select {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 1rem;
    background: #fff;
}

.wl-remove {
    border: 1px solid #fee2e2;
    background: #fef2f2;
    color: #b91c1c;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 800;
    cursor: pointer;
    width: 100%;
}

.wl-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.wl-add {
    margin-top: 10px;
}

.wl-recent {
    margin-top: 6px;
}

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

.wl-empty {
    color: #6b7280;
    font-size: 0.95rem;
    padding: 8px 2px;
}

.wl-item-row {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
}

.wl-item-title {
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 4px;
}

.wl-item-sub {
    color: #6b7280;
    font-size: 0.95rem;
}

.wl-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.wl-small {
    border: 1px solid #d7e3ff;
    background: #eef3ff;
    color: #1a46c7;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 800;
    cursor: pointer;
}

.wl-small.danger {
    border-color: #fee2e2;
    background: #fef2f2;
    color: #b91c1c;
}

.wl-detail-card {
    margin-top: 12px;
    border: 1px dashed #d1d5db;
    border-radius: 14px;
    background: #f8fafc;
    padding: 12px;
}

.wl-detail-header {
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 8px;
}

.wl-detail-close {
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 10px;
    padding: 8px 10px;
    font-weight: 800;
    cursor: pointer;
    margin-bottom: 10px;
}

.wl-detail-rows {
    display: grid;
    gap: 8px;
}

.wl-detail-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 10px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
}

.wl-detail-ex {
    font-weight: 800;
    color: #0f172a;
}

.wl-detail-meta {
    color: #475569;
    font-weight: 700;
}

/* ---- Grocery List (shared) ---- */
.gl-share {
    margin-top: 10px;
    padding: 12px;
    border: 1px dashed #d1d5db;
    border-radius: 14px;
    background: #f8fafc;
}

.gl-share-label {
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 8px;
}

.gl-share-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.gl-share-input {
    flex: 1;
    min-width: 0;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
    white-space: nowrap;
    overflow-x: auto;
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}

.gl-share-help {
    margin-top: 6px;
    color: #475569;
    font-size: 0.9rem;
}

.gl-share-feedback {
    margin-top: 4px;
    color: #0f172a;
    font-weight: 700;
    font-size: 0.9rem;
}

.gl-controls {
    margin-top: 12px;
}

.gl-note {
    color: #6b7280;
    font-size: 0.95rem;
    margin-bottom: 10px;
}

.gl-add-row {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.gl-add-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
    font-size: 1rem;
}

.gl-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
    align-items: center;
}

.gl-list {
    margin-top: 14px;
    display: grid;
    gap: 12px;
}

.gl-section {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
}

.gl-section-head {
    background: #f3f4f6;
    padding: 10px 12px;
    font-weight: 900;
    color: #0f172a;
}

.gl-item {
    display: grid;
    grid-template-columns: 28px 1fr 36px;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-top: 1px solid #e5e7eb;
}

.gl-item.checked .gl-text {
    color: #6b7280;
    text-decoration: line-through;
}

.gl-check {
    width: 20px;
    height: 20px;
}

.gl-text {
    font-weight: 700;
    color: #0f172a;
    word-break: break-word;
}

.gl-del {
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 10px;
    height: 34px;
    width: 34px;
    font-weight: 900;
    cursor: pointer;
    color: #475569;
}

.gl-del:hover {
    border-color: #fecaca;
    color: #b91c1c;
    background: #fef2f2;
}

.gl-empty {
    color: #6b7280;
    font-size: 0.98rem;
    padding: 6px 2px;
}

/* ---- Countdown ---- */
.cd-share {
    margin-top: 10px;
    padding: 12px;
    border: 1px dashed #d1d5db;
    border-radius: 14px;
    background: #f8fafc;
}

.cd-share-label {
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 8px;
}

.cd-share-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.cd-share-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
}

.cd-card {
    margin-top: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    padding: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 10px 22px rgba(17, 24, 39, 0.06);
}

.cd-title {
    font-weight: 900;
    color: #0f172a;
    font-size: 1.15rem;
    margin-bottom: 10px;
}

.cd-big {
    font-weight: 1000;
    font-size: 1.8rem;
    color: #111827;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.cd-small {
    color: #475569;
    font-weight: 700;
}

.cd-actions {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.cd-section-title {
    margin-top: 16px;
    font-weight: 900;
    color: #0f172a;
}

.cd-items {
    margin-top: 10px;
    display: grid;
    gap: 10px;
}

.cd-empty {
    color: #6b7280;
    font-size: 0.98rem;
    padding: 6px 2px;
}

.cd-item {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #fff;
}

.cd-item.active {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 1px #dbeafe inset;
}

.cd-item-title {
    font-weight: 900;
    color: #0f172a;
    margin-bottom: 4px;
}

.cd-item-sub {
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 700;
}

.cd-item-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

@media (max-width: 640px) {
    .tools-shell {
        margin-top: 12px;
        padding: 0 16px;
    }

    .tools-hero,
    .tool-detail {
        padding: 20px 18px;
    }

    .tool-card {
        min-height: auto;
    }

    .wl-row {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .wl-head {
        display: none;
    }

    .wl-item input:nth-child(1),
    .wl-item select:nth-child(5),
    .wl-item button:nth-child(6) {
        grid-column: 1 / -1;
    }

    .wl-actions {
        position: sticky;
        bottom: 0;
        padding: 10px 0 0;
        background: #fff;
        border-top: 1px solid #e5e7eb;
    }

    .wl-item-row {
        flex-direction: column;
        align-items: stretch;
    }

    .wl-item-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .gl-share-row,
    .gl-add-row {
        flex-direction: column;
        align-items: stretch;
    }

    .gl-actions {
        position: sticky;
        bottom: 0;
        padding: 10px 0 0;
        background: #fff;
        border-top: 1px solid #e5e7eb;
    }

    .cd-share-row {
        flex-direction: column;
        align-items: stretch;
    }

    .cd-actions {
        position: sticky;
        bottom: 0;
        padding: 10px 0 0;
        background: #fff;
        border-top: 1px solid #e5e7eb;
    }

    .cd-item {
        flex-direction: column;
        align-items: stretch;
    }

    .cd-item-actions {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }
}
