/* ==========================================================================
   OsmoTools : calcul d'heures ([osmova_heures])
   Onglets : durée, feuille de la semaine, addition, heure + durée, décimales.
   ========================================================================== */

.ohr {
    --ohr-noir: #0A0A0A;
    --ohr-gris: #6B6B6B;
    --ohr-gris-bg: #F6F7F9;
    --ohr-border: #E5E7EB;
    --ohr-blue: #0064FF;
    --ohr-blue-bg: color-mix(in srgb, var(--ohr-blue) 7%, white);
    --ohr-rouge: #B42318;
    --ohr-orange: #B54708;
    --ohr-mono: 'JetBrains Mono', monospace;
    margin: 0 0 40px;
    padding: 28px;
    border: 1px solid var(--ohr-border);
    border-radius: 16px;
    background: #fff;
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--ohr-noir);
}

.ohr *,
.ohr *::before,
.ohr *::after {
    box-sizing: border-box;
}

.ohr__badge {
    display: inline-block;
    margin: 0 0 12px;
    padding: 4px 10px;
    border-radius: 4px;
    background: color-mix(in srgb, var(--ohr-blue) 10%, white);
    color: var(--ohr-blue);
    font: 700 11px/1.4 var(--ohr-mono);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.ohr .ohr__title {
    margin: 0 0 8px;
    font-size: 1.5rem;
    line-height: 1.25;
}

.ohr__intro {
    margin: 0 0 18px;
    color: var(--ohr-gris);
}

/* ---------- Onglets ---------- */

.ohr__tabs {
    display: flex;
    gap: 4px;
    margin: 0 0 20px;
    padding: 4px;
    border-radius: 12px;
    background: var(--ohr-gris-bg);
    overflow-x: auto;
    scrollbar-width: none;
}

.ohr__tabs::-webkit-scrollbar {
    display: none;
}

.ohr__tab {
    flex: 1 0 auto;
    padding: 10px 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ohr-gris);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease;
}

.ohr__tab:hover {
    color: var(--ohr-noir);
}

.ohr__tab[aria-selected="true"] {
    background: #fff;
    color: var(--ohr-blue);
    box-shadow: 0 1px 3px rgba(10, 10, 10, .08), 0 0 0 1px var(--ohr-border);
}

.ohr :focus-visible {
    outline: 3px solid color-mix(in srgb, var(--ohr-blue) 45%, white);
    outline-offset: 2px;
}

.ohr__panel[hidden] {
    display: none;
}

.ohr__panel:focus-visible {
    border-radius: 8px;
}

/* ---------- Champs ---------- */

.ohr__grid {
    display: grid;
    gap: 12px;
    margin: 0 0 10px;
}

.ohr__grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ohr__grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ohr__field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    font-size: 13px;
    font-weight: 600;
}

.ohr input[type="text"],
.ohr input[type="time"],
.ohr select {
    width: 100%;
    min-width: 0;
    padding: 12px 14px;
    border: 1px solid var(--ohr-border);
    border-radius: 10px;
    background: #fff;
    font: 700 18px/1.2 var(--ohr-mono);
    color: var(--ohr-noir);
}

.ohr select {
    font-family: inherit;
    font-size: 16px;
    cursor: pointer;
}

.ohr input:focus,
.ohr select:focus {
    border-color: var(--ohr-blue);
    outline: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ohr-blue) 15%, white);
}

.ohr__field--inline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.ohr__field--inline input[type="text"] {
    width: 90px;
    padding: 8px 10px;
    font-size: 15px;
}

.ohr__hint {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--ohr-gris);
}

.ohr__check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.ohr__check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--ohr-blue);
}

/* ---------- Résultat ---------- */

.ohr__res {
    padding: 18px 20px;
    border-radius: 14px;
    background: var(--ohr-blue-bg);
}

.ohr__res:empty {
    display: none;
}

.ohr__res-lab {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 600;
    color: var(--ohr-gris);
}

.ohr__big {
    display: block;
    font: 800 clamp(26px, 5vw, 34px)/1.15 var(--ohr-mono);
    color: var(--ohr-blue);
    overflow-wrap: anywhere;
}

.ohr__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 12px 0 0;
    padding: 0;
    list-style: none;
}

.ohr__chips li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin: 0;
    padding: 8px 12px;
    border: 1px solid color-mix(in srgb, var(--ohr-blue) 18%, white);
    border-radius: 10px;
    background: #fff;
}

.ohr__chips span {
    font-size: 11px;
    font-weight: 600;
    color: var(--ohr-gris);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.ohr__chips b {
    font: 700 16px/1.2 var(--ohr-mono);
}

.ohr__note {
    margin: 10px 0 0;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.ohr__note.is-warn {
    color: var(--ohr-orange);
    font-weight: 600;
}

.ohr__res.is-error {
    background: #FEF3F2;
}

.ohr__err {
    margin: 0;
    color: var(--ohr-rouge);
    font-weight: 600;
}

.ohr__res.is-error .ohr__note.is-warn {
    color: var(--ohr-rouge);
}

/* ---------- Boutons ---------- */

.ohr__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    align-items: center;
    margin: 14px 0 0;
}

.ohr__btn {
    padding: 10px 16px;
    border: 1px solid var(--ohr-border);
    border-radius: 10px;
    background: #fff;
    color: var(--ohr-noir);
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.ohr__btn:hover {
    border-color: var(--ohr-noir);
}

.ohr__btn--main {
    border-color: var(--ohr-blue);
    color: var(--ohr-blue);
}

.ohr__btn--main:hover {
    background: var(--ohr-blue);
    color: #fff;
}

.ohr__btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.ohr__actions + .ohr__res {
    margin-top: 16px;
}

.ohr__status {
    min-height: 1.2em;
    margin: 8px 0 0;
    font-size: 13px;
    color: var(--ohr-gris);
}

.ohr__sr {
    position: fixed;
    top: -1000px;
    left: -1000px;
    opacity: 0;
}

/* ---------- Feuille de la semaine ---------- */

.ohr__week-opts {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 14px;
}

.ohr__week {
    margin: 0 0 14px;
    border: 1px solid var(--ohr-border);
    border-radius: 12px;
    overflow: hidden;
}

.ohr__wrow {
    display: grid;
    grid-template-columns: 96px repeat(3, minmax(0, 1fr)) 96px;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    border-bottom: 1px solid var(--ohr-border);
}

.ohr__wrow:last-child {
    border-bottom: 0;
}

.is-split .ohr__wrow {
    grid-template-columns: 96px repeat(5, minmax(0, 1fr)) 96px;
}

.ohr__wrow--head {
    padding-top: 10px;
    padding-bottom: 10px;
    background: var(--ohr-gris-bg);
    font-size: 12px;
    font-weight: 700;
    color: var(--ohr-gris);
}

.ohr__wrow--head span:last-child {
    text-align: right;
}

.ohr .ohr__p2 {
    display: none;
}

.is-split .ohr__p2 {
    display: block;
}

.ohr__wday {
    font-weight: 700;
    font-size: 14px;
}

.ohr__wcell {
    display: block;
    min-width: 0;
}

.ohr__wlab {
    display: none;
}

.ohr__week input[type="time"],
.ohr__week input[type="text"] {
    padding: 8px 8px;
    font-size: 15px;
}

.ohr__wtot {
    font: 700 15px/1.2 var(--ohr-mono);
    color: var(--ohr-blue);
    text-align: right;
    white-space: nowrap;
}

.ohr__wrow.is-error {
    background: #FEF3F2;
}

.ohr__wrow.is-error input {
    border-color: var(--ohr-rouge);
}

.ohr__wrow.is-error .ohr__wtot {
    color: var(--ohr-rouge);
}

/* ---------- Liste de durées ---------- */

.ohr__list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 460px;
    margin: 0 0 4px;
    padding: 0;
    list-style: none;
    counter-reset: ohr;
}

.ohr__line {
    display: grid;
    grid-template-columns: 26px 64px minmax(0, 1fr) 44px;
    gap: 8px;
    align-items: center;
    margin: 0;
    counter-increment: ohr;
}

.ohr__line::before {
    content: counter(ohr);
    font: 600 12px/1 var(--ohr-mono);
    color: var(--ohr-gris);
    text-align: right;
}

.ohr__line select {
    padding: 10px 8px;
    font: 800 18px/1.2 var(--ohr-mono);
    text-align: center;
}

.ohr__line input[type="text"] {
    padding: 10px 12px;
    font-size: 17px;
}

.ohr__line.is-error input {
    border-color: var(--ohr-rouge);
    background: #FEF3F2;
}

.ohr__del {
    width: 44px;
    height: 44px;
    border: 1px solid var(--ohr-border);
    border-radius: 10px;
    background: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.ohr__del:hover {
    border-color: var(--ohr-rouge);
    color: var(--ohr-rouge);
}

/* ---------- Convertisseur ---------- */

.ohr__box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--ohr-border);
    border-radius: 14px;
}

.ohr__box .ohr__res {
    padding: 14px 16px;
}

/* ---------- Responsive ---------- */

@media (max-width: 760px) {
    .ohr {
        padding: 18px;
    }

    .ohr__grid--2 {
        grid-template-columns: 1fr;
    }

    .ohr__wrow--head {
        display: none;
    }

    .ohr__wrow,
    .is-split .ohr__wrow {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 8px;
        padding: 12px;
    }

    .ohr__wday {
        grid-column: 1 / 3;
        grid-row: 1;
    }

    .ohr__wtot {
        grid-column: 3;
        grid-row: 1;
    }

    .is-split .ohr__wrow {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 8px 6px;
    }

    .is-split .ohr__wday {
        grid-column: 1 / 3;
    }

    .is-split .ohr__wtot {
        grid-column: 3 / 5;
    }

    .is-split .ohr__week input[type="time"] {
        padding: 9px 4px;
        font-size: 15px;
        text-align: center;
    }

    .ohr__wlab {
        display: block;
        margin: 0 0 4px;
        font-size: 11px;
        font-weight: 600;
        color: var(--ohr-gris);
    }

    .ohr__week input[type="time"],
    .ohr__week input[type="text"] {
        padding: 9px 8px;
        font-size: 16px;
    }

    .ohr__week input[type="time"]::-webkit-calendar-picker-indicator {
        display: none;
    }

    .ohr__tabs {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ohr__tab {
        white-space: normal;
    }

    .ohr__tab:last-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 520px) {
    .ohr__grid--3 {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .ohr__grid--3 > :last-child {
        grid-column: 1 / -1;
    }

    .ohr__tab {
        padding: 9px 12px;
        font-size: 13px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ohr__tab {
        transition: none;
    }
}
