/**
 * HIB RunPace Calc - Frontend Stylesheet
 * Fullt tilpassbar med CSS-variabler
 */

:root {
    --hib-pace-primary: #ff5500;
    --hib-pace-primary-hover: #e04a00;
    --hib-pace-secondary: #2563eb;
    --hib-pace-accent: #10b981;
    --hib-pace-bg: #ffffff;
    --hib-pace-card-bg: #f8fafc;
    --hib-pace-card-border: #e2e8f0;
    --hib-pace-highlight-bg: #fff7ed;
    --hib-pace-sticky-bg: #f8fafc;
    --hib-pace-text: #0f172a;
    --hib-pace-muted: #64748b;
    --hib-pace-on-primary: #ffffff;
    --hib-pace-on-primary-hover: #ffffff;
    --hib-pace-primary-readable: #c2410c;
    --hib-pace-on-secondary: #ffffff;
    --hib-pace-on-accent: #0f172a;
    --hib-pace-on-highlight: #0f172a;
    --hib-pace-frame-radius: 16px;
    --hib-pace-card-radius: 12px;
    --hib-pace-radius: 12px;
    --hib-pace-frame-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.08), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
    --hib-pace-card-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    --hib-pace-font: inherit;
}

/* Container */
.hib-runpace-container {
    font-family: var(--hib-pace-font);
    color: var(--hib-pace-text);
    background-color: var(--hib-pace-bg);
    border-radius: var(--hib-pace-frame-radius);
    padding: 24px;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin: 0 auto 30px auto;
    box-shadow: var(--hib-pace-frame-shadow);
    border: 1px solid var(--hib-pace-card-border);
    transition: all 0.25s ease;
    overflow-x: hidden;
}

.hib-runpace-container.hib-glass .hib-input-card,
.hib-runpace-container.hib-glass .hib-result-card,
.hib-runpace-container.hib-glass .hib-view-switcher,
.hib-runpace-container.hib-glass .hib-mode-tabs {
    background: color-mix(in srgb, var(--hib-pace-card-bg) 82%, transparent);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.hib-runpace-container *,
.hib-runpace-container *::before,
.hib-runpace-container *::after {
    box-sizing: border-box;
}

/* Skjul default number spinner piler som tar opp plass på mobil */
.hib-runpace-container input[type="number"]::-webkit-outer-spin-button,
.hib-runpace-container input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hib-runpace-container input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Topbar: Visningsvelger, Modusvelger & Enhetsbryter */
.hib-calc-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--hib-pace-card-border);
}

/* Visningsbryter (Enkel vs Avansert) */
.hib-view-switcher {
    display: flex;
    background: var(--hib-pace-card-bg);
    padding: 3px;
    border-radius: calc(var(--hib-pace-card-radius) * 0.8);
    border: 1px solid var(--hib-pace-card-border);
    gap: 2px;
}

.hib-view-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: calc(var(--hib-pace-card-radius) * 0.6);
    font-size: 13px;
    font-weight: 700;
    color: var(--hib-pace-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.hib-view-btn:hover {
    color: var(--hib-pace-text);
}

.hib-view-btn.active {
    background: var(--hib-pace-primary);
    color: var(--hib-pace-on-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

/* Synlighet for Enkel vs Avansert visning */
.hib-view-simple .hib-advanced-only {
    display: none !important;
}

.hib-view-advanced .hib-simple-only {
    display: none !important;
}

.hib-runpace-container.hib-mode-distance .hib-distance-section {
    display: none;
}

.hib-mode-tabs {
    display: flex;
    background: var(--hib-pace-card-bg);
    padding: 4px;
    border-radius: calc(var(--hib-pace-card-radius) * 0.8);
    border: 1px solid var(--hib-pace-card-border);
    gap: 4px;
}

.hib-mode-tab {
    background: transparent;
    border: none;
    padding: 8px 16px;
    border-radius: calc(var(--hib-pace-card-radius) * 0.6);
    font-size: 14px;
    font-weight: 600;
    color: var(--hib-pace-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.hib-mode-tab:hover {
    color: var(--hib-pace-text);
}

.hib-mode-tab.active {
    background: var(--hib-pace-primary);
    color: var(--hib-pace-on-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Enhetsbryter (KM / MILES) */
.hib-unit-switcher {
    display: flex;
    background: var(--hib-pace-card-bg);
    padding: 4px;
    border-radius: 9999px;
    border: 1px solid var(--hib-pace-card-border);
}

.hib-unit-btn {
    background: transparent;
    border: none;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 700;
    color: var(--hib-pace-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hib-unit-btn.active {
    background: var(--hib-pace-primary);
    color: var(--hib-pace-on-primary);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Grid Layout */
.hib-calc-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

@media (max-width: 860px) {
    .hib-calc-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Input Card & Result Card */
.hib-input-card,
.hib-result-card {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.hib-section-block {
    background: var(--hib-pace-card-bg);
    border: 1px solid var(--hib-pace-card-border);
    border-radius: var(--hib-pace-card-radius);
    box-shadow: var(--hib-pace-card-shadow);
    padding: 18px;
    transition: all 0.2s ease;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.hib-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.hib-section-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    color: var(--hib-pace-text);
}

.hib-active-dist-badge {
    background: var(--hib-pace-primary);
    color: var(--hib-pace-on-primary);
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 9999px;
}

/* Kategori faner for distanse */
.hib-dist-cat-pills {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    overflow-x: auto;
    padding: 5px 2px 6px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
}

.hib-dist-cat-btn {
    background: transparent;
    border: 1px solid var(--hib-pace-card-border);
    padding: 6px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--hib-pace-muted);
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.hib-dist-cat-btn:hover {
    color: var(--hib-pace-text);
    border-color: var(--hib-pace-muted);
}

.hib-dist-cat-btn.active {
    background: var(--hib-pace-text);
    color: var(--hib-pace-on-text) !important;
    border-color: var(--hib-pace-text);
}

/* Knapper for distanser */
.hib-dist-buttons-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.hib-dist-btn {
    background: var(--hib-pace-bg);
    border: 1.5px solid var(--hib-pace-card-border);
    border-radius: calc(var(--hib-pace-card-radius) * 0.75);
    box-shadow: var(--hib-pace-card-shadow);
    padding: 12px 14px;
    font-size: 14px;
    font-weight: 600;
    color: var(--hib-pace-text);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    text-align: center;
    min-height: 52px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

.hib-dist-btn:hover {
    border-color: var(--hib-pace-primary);
    transform: translateY(-2px);
}

.hib-dist-btn.active {
    border-color: var(--hib-pace-primary);
    background: var(--hib-pace-primary);
    color: var(--hib-pace-on-primary);
    font-weight: 700;
    box-shadow: var(--hib-pace-card-shadow);
}

.hib-dist-main {
    font-size: 15px;
    font-weight: 700;
}

.hib-dist-sub {
    font-size: 11px;
    color: var(--hib-pace-muted);
    margin-top: 2px;
}

.hib-dist-btn.active .hib-dist-sub {
    color: var(--hib-pace-on-primary);
}

/* Egendefinert distanse */
.hib-custom-dist-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hib-custom-dist-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hib-custom-input-wrap {
    flex: 1;
    min-width: 100px;
}

.hib-custom-dist-val {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--hib-pace-card-border);
    border-radius: calc(var(--hib-pace-card-radius) * 0.6);
    font-size: 16px;
    font-weight: 600;
    color: var(--hib-pace-text);
    background: var(--hib-pace-bg);
}

.hib-custom-dist-val:focus {
    outline: none;
    border-color: var(--hib-pace-primary);
}

.hib-custom-dist-unit {
    padding: 10px 12px;
    border: 1.5px solid var(--hib-pace-card-border);
    border-radius: calc(var(--hib-pace-card-radius) * 0.6);
    font-size: 14px;
    font-weight: 600;
    color: var(--hib-pace-text);
    background: var(--hib-pace-bg);
}

.hib-btn-apply-dist {
    background: var(--hib-pace-primary);
    color: var(--hib-pace-on-primary);
    border: none;
    padding: 10px 16px;
    border-radius: calc(var(--hib-pace-card-radius) * 0.6);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.hib-btn-apply-dist:hover {
    background: var(--hib-pace-primary-hover);
    color: var(--hib-pace-on-primary-hover);
}

.hib-custom-hint {
    font-size: 12px;
    color: var(--hib-pace-muted);
}

/* Enkel visning (Simple View) Tilpasninger */
.hib-view-simple .hib-dist-buttons-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.hib-view-simple .hib-result-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hib-view-simple .hib-result-hero {
    min-height: 260px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

@media (max-width: 640px) {
    .hib-view-simple .hib-dist-buttons-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }
}

.hib-simple-time-sliders {
    display: flex;
    gap: 14px;
    align-items: stretch;
    justify-content: space-between;
    width: 100%;
    margin: 8px 0 8px 0;
}

.hib-time-slider-col {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    background: var(--hib-pace-bg);
    padding: 12px 10px;
    border-radius: calc(var(--hib-pace-card-radius) * 0.7);
    border: 1.5px solid var(--hib-pace-card-border);
}

.hib-slider-col-label {
    font-size: 13px;
    font-weight: 700;
    color: var(--hib-pace-muted);
}

.hib-time-slider {
    width: 100%;
    accent-color: var(--hib-pace-primary);
    cursor: pointer;
    margin: 4px 0;
}

.hib-slider-col-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--hib-pace-text);
}

.hib-simple-hero-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--hib-pace-muted);
    margin-bottom: 4px;
    text-align: center;
}

.hib-simple-speed-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--hib-pace-text);
    margin: 8px 0 4px 0;
    text-align: center;
}

.hib-hero-summary-text {
    font-size: 13.5px;
    color: var(--hib-pace-muted);
    margin-top: 10px;
    text-align: center;
}

.hib-hero-summary-text strong {
    color: var(--hib-pace-text);
}

/* Tidsinndata & Pace Inputs (Avansert) */
.hib-time-inputs-group,
.hib-pace-inputs-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.hib-time-field {
    display: flex;
    align-items: center;
    background: var(--hib-pace-bg);
    border: 1.5px solid var(--hib-pace-card-border);
    border-radius: calc(var(--hib-pace-card-radius) * 0.6);
    padding: 8px 10px;
    flex: 1 1 0;
    min-width: 0;
    max-width: 110px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.hib-time-field:focus-within {
    border-color: var(--hib-pace-primary);
    box-shadow: 0 0 0 3px rgba(255, 85, 0, 0.15);
}

.hib-time-input {
    width: 100%;
    min-width: 0;
    border: none;
    background: transparent;
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    color: var(--hib-pace-text);
    padding: 0;
    box-sizing: border-box;
}

.hib-time-input:focus {
    outline: none;
}

.hib-time-unit {
    font-size: 12px;
    font-weight: 700;
    color: var(--hib-pace-muted);
    margin-left: 3px;
    flex-shrink: 0;
}

.hib-time-sep {
    font-size: 20px;
    font-weight: 700;
    color: var(--hib-pace-muted);
    flex-shrink: 0;
    padding: 0 2px;
}

/* Hurtigmål (Target times) */
.hib-time-targets-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--hib-pace-card-border);
}

.hib-targets-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--hib-pace-muted);
}

.hib-targets-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hib-target-btn {
    background: var(--hib-pace-bg);
    border: 1px solid var(--hib-pace-card-border);
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    color: var(--hib-pace-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hib-target-btn:hover {
    border-color: var(--hib-pace-primary);
    background: var(--hib-pace-primary);
    color: var(--hib-pace-on-primary);
}

/* Result Card - Hero */
.hib-result-hero {
    background: linear-gradient(135deg, var(--hib-pace-card-bg) 0%, rgba(255, 85, 0, 0.04) 100%);
    border: 1.5px solid var(--hib-pace-card-border);
    border-radius: var(--hib-pace-card-radius);
    box-shadow: var(--hib-pace-card-shadow);
    padding: 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hib-hero-badge {
    display: inline-block;
    background: var(--hib-pace-highlight-bg);
    color: var(--hib-pace-on-highlight);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    border-radius: 9999px;
    margin-bottom: 8px;
}

.hib-hero-main-val {
    font-size: 46px;
    font-weight: 800;
    line-height: 1.1;
    color: var(--hib-pace-text);
    letter-spacing: -1px;
    margin: 8px 0;
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 8px;
}

.hib-hero-unit {
    font-size: 18px;
    font-weight: 600;
    color: var(--hib-pace-muted);
    letter-spacing: normal;
}

/* Nøkkeltall (Hastighet, Sluttid, Distanse) */
.hib-hero-sub-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 20px 0 16px 0;
    padding: 14px 0;
    border-top: 1px solid var(--hib-pace-card-border);
    border-bottom: 1px solid var(--hib-pace-card-border);
}

.hib-sub-metric {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hib-metric-label {
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--hib-pace-muted);
    letter-spacing: 0.5px;
}

.hib-metric-val {
    font-size: 18px;
    font-weight: 700;
    color: var(--hib-pace-text);
}

.hib-metric-val small {
    font-size: 12px;
    color: var(--hib-pace-muted);
    font-weight: 500;
}

/* Pace meter / speedometer bar */
.hib-pace-meter-wrap {
    margin-top: 12px;
}

.hib-pace-meter-bar {
    height: 8px;
    background: var(--hib-pace-card-border);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
}

.hib-pace-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981 0%, #f59e0b 50%, #ff5500 80%, #ef4444 100%);
    border-radius: 9999px;
    transition: width 0.4s ease;
}

.hib-meter-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--hib-pace-muted);
}

.hib-meter-labels > span {
    min-width: 0;
}

.hib-meter-min-label,
.hib-meter-max-label {
    flex: 1 1 0;
}

.hib-meter-max-label {
    text-align: right;
}

.hib-meter-current-tag {
    background: var(--hib-pace-text);
    color: var(--hib-pace-on-text) !important;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 10px;
    font-weight: 700;
    max-width: 48%;
    line-height: 1.2;
    text-align: center;
    white-space: normal;
}

/* Tilleggsfaner (Splits, Negative, Zones) */
.hib-extras-section {
    background: var(--hib-pace-card-bg);
    border: 1px solid var(--hib-pace-card-border);
    border-radius: var(--hib-pace-card-radius);
    box-shadow: var(--hib-pace-card-shadow);
    padding: 16px;
}

.hib-extras-nav {
    display: flex;
    gap: 6px;
    border-bottom: 1px solid var(--hib-pace-card-border);
    padding: 6px 2px 10px;
    margin-bottom: 14px;
    overflow-x: auto;
}

.hib-extra-tab {
    background: transparent;
    border: none;
    padding: 6px 12px;
    border-radius: calc(var(--hib-pace-card-radius) * 0.5);
    font-size: 13px;
    font-weight: 600;
    color: var(--hib-pace-muted);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.hib-extra-tab:hover {
    color: var(--hib-pace-text);
}

.hib-extra-tab.active {
    background: var(--hib-pace-primary);
    color: var(--hib-pace-on-primary);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

.hib-tab-pane {
    display: none;
}

.hib-tab-pane.active {
    display: block;
}

.hib-pane-desc {
    font-size: 13px;
    color: var(--hib-pace-muted);
    margin: 0 0 12px 0;
    line-height: 1.4;
}

/* Splits Table */
.hib-splits-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-size: 13px;
    font-weight: 600;
}

.hib-print-splits-btn {
    background: var(--hib-pace-bg);
    border: 1px solid var(--hib-pace-card-border);
    padding: 4px 10px;
    border-radius: calc(var(--hib-pace-radius) * 0.5);
    font-size: 12px;
    font-weight: 600;
    color: var(--hib-pace-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

.hib-print-splits-btn:hover {
    border-color: var(--hib-pace-primary);
    background: var(--hib-pace-primary);
    color: var(--hib-pace-on-primary);
}

.hib-splits-table-wrap {
    max-height: 240px;
    overflow-y: auto;
    border: 1px solid var(--hib-pace-card-border);
    border-radius: calc(var(--hib-pace-radius) * 0.5);
}

.hib-splits-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

.hib-splits-table th {
    background: var(--hib-pace-sticky-bg) !important;
    padding: 8px 12px;
    font-weight: 700;
    color: var(--hib-pace-muted);
    text-align: left;
    position: sticky;
    top: 0;
    z-index: 3;
    box-shadow: 0 1px 0 var(--hib-pace-card-border);
    border-bottom: 1px solid var(--hib-pace-card-border);
}

.hib-splits-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--hib-pace-card-border);
    color: var(--hib-pace-text);
}

.hib-splits-table tr:last-child td {
    border-bottom: none;
    font-weight: 700;
    background: rgba(255, 85, 0, 0.05);
}

/* Negativ Splitt Simulator */
.hib-neg-split-box {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.hib-slider-wrap {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hib-slider-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
}

.hib-neg-slider {
    width: 100%;
    accent-color: var(--hib-pace-primary);
    cursor: pointer;
}

.hib-half-splits-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.hib-half-card {
    background: var(--hib-pace-bg);
    border: 1px solid var(--hib-pace-card-border);
    border-radius: calc(var(--hib-pace-radius) * 0.6);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.hib-half-card.highlight {
    border-color: var(--hib-pace-accent);
    background: var(--hib-pace-highlight-bg);
    color: var(--hib-pace-on-highlight);
}

.hib-half-card.highlight .hib-half-title,
.hib-half-card.highlight .hib-half-pace,
.hib-half-card.highlight .hib-half-time {
    color: var(--hib-pace-on-highlight);
}

.hib-half-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--hib-pace-muted);
}

.hib-half-pace {
    font-size: 17px;
    font-weight: 700;
    color: var(--hib-pace-text);
}

.hib-half-time {
    font-size: 12px;
    color: var(--hib-pace-muted);
}

/* Treningssoner */
.hib-zones-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hib-zone-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--hib-pace-bg);
    border: 1px solid var(--hib-pace-card-border);
    border-radius: calc(var(--hib-pace-radius) * 0.5);
    padding: 8px 12px;
}

.hib-zone-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hib-zone-badge {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.hib-zone-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--hib-pace-text);
}

.hib-zone-pace {
    font-size: 13px;
    font-weight: 700;
    color: var(--hib-pace-primary-readable);
}

/* Hjelpeklasser */
.hib-hidden {
    display: none !important;
}

/* Responsiv tilpasning for mobil og små skjermer */
@media (max-width: 640px) {
    .hib-runpace-container {
        padding: 14px 10px;
        margin-bottom: 20px;
    }

    .hib-calc-topbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 16px;
        padding-bottom: 12px;
    }

    .hib-mode-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        padding: 3px;
        gap: 2px;
    }

    .hib-mode-tab {
        padding: 8px 4px;
        font-size: 11.5px;
        justify-content: center;
        text-align: center;
        flex-direction: column;
        gap: 3px;
    }

    .hib-tab-icon {
        font-size: 14px;
    }

    .hib-unit-switcher {
        align-self: center;
    }

    .hib-section-block {
        padding: 14px 10px;
    }

    .hib-section-header {
        margin-bottom: 10px;
    }

    .hib-section-label {
        font-size: 13.5px;
    }

    .hib-active-dist-badge {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* Kategori-faner for distanse */
    .hib-dist-cat-pills {
        gap: 4px;
        margin-bottom: 10px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }

    .hib-dist-cat-pills::-webkit-scrollbar {
        display: none;
    }

    .hib-dist-cat-btn {
        font-size: 11.5px;
        padding: 5px 10px;
    }

    /* Knapper for distanser */
    .hib-dist-buttons-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .hib-dist-btn {
        padding: 8px 6px;
        min-height: 44px;
        font-size: 12.5px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .hib-dist-main {
        font-size: 13.5px;
        white-space: normal;
        word-break: break-word;
    }

    .hib-dist-sub {
        font-size: 10px;
        white-space: normal;
        word-break: break-word;
        max-width: 100%;
    }

    /* Egendefinert distanse */
    .hib-custom-dist-row {
        flex-direction: column;
        gap: 8px;
    }

    .hib-custom-dist-val,
    .hib-custom-dist-unit,
    .hib-btn-apply-dist {
        width: 100%;
        font-size: 16px;
    }

    /* Tids- og pace-inndata */
    .hib-time-inputs-group,
    .hib-pace-inputs-group {
        gap: 4px;
        width: 100%;
        max-width: 100%;
        display: flex;
        justify-content: space-between;
        align-items: center;
        box-sizing: border-box;
    }

    .hib-time-field {
        padding: 6px 4px;
        max-width: 32%;
        flex: 1 1 0;
        min-width: 0;
        box-sizing: border-box;
    }

    .hib-time-input {
        font-size: 17px;
        width: 100%;
        min-width: 0;
    }

    .hib-time-unit {
        font-size: 11px;
        margin-left: 1px;
        flex-shrink: 0;
    }

    .hib-time-sep {
        font-size: 16px;
        flex-shrink: 0;
        padding: 0 1px;
    }

    /* Hurtigmål */
    .hib-time-targets-wrap {
        gap: 4px;
    }

    .hib-target-btn {
        font-size: 11px;
        padding: 3px 8px;
    }

    /* Resultat Hero */
    .hib-result-hero {
        padding: 16px 10px;
    }

    .hib-hero-main-val {
        font-size: 34px;
        gap: 6px;
    }

    .hib-hero-unit {
        font-size: 15px;
    }

    .hib-hero-sub-metrics {
        gap: 6px;
        padding: 10px 0;
        margin: 14px 0 10px 0;
    }

    .hib-metric-label {
        font-size: 10px;
    }

    .hib-metric-val {
        font-size: 15px;
    }

    .hib-metric-val small {
        font-size: 10.5px;
    }

    /* Tilleggsfaner & Tabeller */
    .hib-extras-section {
        padding: 12px 8px;
    }

    .hib-extra-tab {
        padding: 5px 8px;
        font-size: 12px;
    }

    .hib-splits-table th,
    .hib-splits-table td {
        padding: 6px 8px;
        font-size: 12px;
    }

    .hib-half-splits-grid {
        gap: 6px;
    }

    .hib-half-card {
        padding: 8px 6px;
    }

    .hib-half-pace {
        font-size: 15px;
    }

    .hib-zone-item {
        padding: 6px 8px;
    }

    .hib-zone-name,
    .hib-zone-pace {
        font-size: 12px;
    }
}

/* Ekstra smale mobilskjermer (iPhone SE, etc. <= 480px) */
@media (max-width: 480px) {
    .hib-runpace-container {
        padding: 10px 8px;
    }

    .hib-section-block,
    .hib-result-hero,
    .hib-extras-section {
        padding: 10px 8px;
    }

    .hib-mode-tab {
        padding: 6px 2px;
        font-size: 10.5px;
    }

    .hib-tab-icon {
        font-size: 13px;
    }

    .hib-time-inputs-group,
    .hib-pace-inputs-group {
        gap: 2px;
    }

    .hib-time-field {
        padding: 5px 3px;
    }

    .hib-time-input {
        font-size: 16px;
    }

    .hib-time-unit {
        font-size: 10px;
    }

    .hib-time-sep {
        font-size: 15px;
    }

    .hib-dist-buttons-grid {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 6px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    .hib-dist-btn {
        padding: 6px 4px;
        min-height: 40px;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        box-sizing: border-box;
    }

    .hib-dist-main {
        font-size: 12.5px;
        white-space: normal;
        word-break: break-word;
    }

    .hib-dist-sub {
        font-size: 9.5px;
        white-space: normal;
        word-break: break-word;
    }

    .hib-hero-main-val {
        font-size: 30px;
    }

    .hib-hero-unit {
        font-size: 13.5px;
    }

    .hib-hero-sub-metrics {
        gap: 4px;
    }

    .hib-metric-label {
        font-size: 9px;
    }

    .hib-metric-val {
        font-size: 13.5px;
    }
}

.hib-runpace-print-root {
    display: none;
}

/* Utskriftsstil for Pace-armbånd */
@media print {
    html,
    body {
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
    }

    body > * {
        display: none !important;
    }

    body > .hib-runpace-print-root {
        display: block !important;
        position: static !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    body > .hib-runpace-print-root,
    body > .hib-runpace-print-root * {
        visibility: visible !important;
        opacity: 1 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .hib-runpace-print-root .hib-splits-table-wrap {
        display: block !important;
        position: static !important;
        width: 100% !important;
        max-height: none !important;
        margin: 0 !important;
        overflow: visible !important;
        border: 1px solid #cbd5e1 !important;
        border-radius: 0 !important;
        background: #ffffff !important;
        color: #111827 !important;
    }

    .hib-runpace-print-root .hib-splits-table {
        width: 100% !important;
        border-collapse: collapse !important;
    }

    .hib-runpace-print-root .hib-splits-table th,
    .hib-runpace-print-root .hib-splits-table td,
    .hib-runpace-print-root .hib-splits-table strong {
        background: #ffffff !important;
        color: #111827 !important;
        -webkit-text-fill-color: #111827 !important;
        box-shadow: none !important;
    }

    .hib-runpace-print-root .hib-splits-table th {
        position: static !important;
    }

    .hib-runpace-print-root .hib-splits-table tr {
        break-inside: avoid;
        page-break-inside: avoid;
    }
}
