/* =========================================================
   GLOBAL
   ========================================================= */

* {
    box-sizing: border-box;
}


html,
body {
    margin: 0;
    min-height: 100%;
}


body {
    min-height: 100vh;
    min-height: 100dvh;

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background-color: #f5f5f5;
    color: #222;

    line-height: 1.45;
}


button,
input,
select,
textarea {
    font: inherit;
}


button {
    -webkit-tap-highlight-color: transparent;
}


/* =========================================================
   NAVBAR
   ========================================================= */

.navbar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;

    gap: 18px;

    padding: 14px 18px;

    background-color: white;

    border-bottom: 1px solid #ddd;
}


.navbar a {
    color: #222;

    font-weight: bold;

    text-decoration: none;
}


.navbar a:hover {
    color: #04AA6D;
}


.logout-button {
    padding: 9px 16px;

    background-color: #04AA6D;

    border: 2px solid #04AA6D;
    border-radius: 8px;

    color: white;

    font-weight: bold;

    cursor: pointer;
}


.logout-button:hover {
    background-color: white;

    color: #04AA6D;
}


/* =========================================================
   GENERIC PAGE
   ========================================================= */

.page {
    width: 100%;

    padding: 28px 18px;

    text-align: center;
}


/* =========================================================
   LOGIN / REGISTER
   ========================================================= */

.auth-page {
    min-height: 100vh;
    min-height: 100dvh;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 18px;
}


.auth-card {
    width: 100%;
    max-width: 380px;

    padding: 28px;

    background-color: white;

    border: 1px solid #ddd;
    border-radius: 12px;

    text-align: center;
}


.auth-card h1 {
    margin-top: 0;
    margin-bottom: 22px;

    font-weight: bold;
}


.form-group {
    margin-bottom: 16px;

    text-align: left;
}


.form-group label,
.builder-label,
.field-label {
    display: block;

    margin-bottom: 4px;

    color: #333;

    font-size: 14px;
    font-weight: bold;
}


/* =========================================================
   INPUTS
   ========================================================= */

.form-group input,
.builder-input {
    width: 100%;

    padding: 11px 12px;

    box-sizing: border-box;

    border: 2px solid #04AA6D;
    border-radius: 8px;

    background-color: white;
    color: #222;

    font-size: 16px;

    outline: none;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}


.form-group input {
    margin: 8px 0;
}


.builder-input:focus,
.form-group input:focus {
    border-color: #028a58;

    box-shadow:
        0 0 0 3px
        rgba(4, 170, 109, 0.13);
}


.builder-input::placeholder {
    color: #888;
}


/* =========================================================
   BUTTONS
   ========================================================= */

.primary-button,
.secondary-button,
.primary-link-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 12px 18px;

    background-color: #04AA6D;

    border: 2px solid #04AA6D;
    border-radius: 8px;

    color: white;

    font-size: 14px;
    font-weight: bold;

    text-align: center;
    text-decoration: none;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        color 0.15s ease,
        transform 0.1s ease;
}


.primary-button:hover,
.secondary-button:hover,
.primary-link-button:hover {
    background-color: white;

    color: #04AA6D;
}


.primary-button:active,
.secondary-button:active,
.primary-link-button:active {
    transform: translateY(1px);
}


.primary-button:disabled {
    opacity: 0.5;

    cursor: not-allowed;
}


.primary-button {
    width: 100%;
}


/* =========================================================
   REMOVE X
   ========================================================= */

.remove-x-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    width: 30px;
    height: 30px;

    padding: 0;

    border: 0;
    border-radius: 50%;

    background: transparent;

    color: #777;

    font-size: 25px;
    font-weight: 400;

    line-height: 1;

    cursor: pointer;
}


.remove-x-button:hover {
    background-color: #ffecec;

    color: #d9534f;
}


.remove-x-button:focus-visible {
    outline: 2px solid #d9534f;
    outline-offset: 2px;
}


/* =========================================================
   ERRORS
   ========================================================= */

.error-message {
    color: #d9534f;

    font-size: 14px;
    font-weight: bold;
}


/* =========================================================
   WORKOUTS PAGE
   ========================================================= */

.workouts-page {
    width: 100%;
    max-width: 1000px;

    margin: 0 auto;

    padding:
        32px
        20px
        65px;

    text-align: center;
}


.page-header {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;

    gap: 20px;

    margin-bottom: 26px;
}


.page-header h1 {
    margin: 0;
}


/* =========================================================
   BUILDER PAGE
   ========================================================= */

.builder-page {
    width: 100%;
    max-width: 1000px;

    margin: 0 auto;

    padding:
        30px
        20px
        65px;

    text-align: center;
}


.builder-header {
    margin-bottom: 26px;
}


.builder-header h1 {
    margin:
        5px
        0
        0;

    font-size: 32px;
    font-weight: bold;
}


.back-link {
    color: #04AA6D;

    font-size: 14px;
    font-weight: bold;

    text-decoration: none;
}


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


/* =========================================================
   WORKOUT NAME
   ========================================================= */

.builder-card {
    width: 100%;
    max-width: 700px;

    margin:
        0 auto
        30px;

    padding: 20px;

    background-color: white;

    border: 1px solid #ddd;
    border-radius: 12px;
}


.builder-label {
    text-align: center;
}


/* =========================================================
   SECTION HEADER
   ========================================================= */

.builder-section-header {
    display: flex;
    align-items: center;
    justify-content: center;

    margin-bottom: 18px;
}


.builder-section-header h2 {
    margin: 0;

    font-size: 21px;
}


/* =========================================================
   BLOCK LIST
   ========================================================= */

#exercise-blocks {
    display: flex;
    flex-direction: column;

    gap: 20px;

    width: 100%;

    margin-bottom: 22px;
}


/* =========================================================
   EXERCISE BLOCK
   ========================================================= */

.hierarchy-block {
    width: 100%;

    padding: 20px;

    background-color: white;

    border: 2px solid #04AA6D;
    border-radius: 14px;

    text-align: left;
}


/* =========================================================
   COMPONENT HEADER
   ========================================================= */

.component-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 12px;

    margin-bottom: 13px;
}


.component-title {
    display: flex;
    align-items: center;

    min-width: 0;

    gap: 10px;
}


.component-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    width: 34px;
    height: 34px;

    border-radius: 8px;

    background-color: #04AA6D;

    color: white;

    font-size: 13px;
    font-weight: bold;
}


.component-number-small {
    width: 30px;
    height: 30px;

    background-color: #333;
}


.component-label {
    display: block;

    font-size: 16px;
    font-weight: 800;

    line-height: 1.15;
}


.component-description {
    display: block;

    margin-top: 2px;

    color: #777;

    font-size: 12px;

    line-height: 1.2;
}


/* =========================================================
   BLOCK OPTIONS
   ========================================================= */

.block-options,
.set-block-options {
    display: flex;
    align-items: center;

    min-height: 34px;

    margin-bottom: 12px;
}


/* =========================================================
   TOGGLE
   ========================================================= */

.toggle-field {
    display: inline-flex;
    align-items: center;

    gap: 9px;

    font-size: 14px;
    font-weight: bold;

    cursor: pointer;
}


.toggle-field input {
    position: absolute;

    width: 1px;
    height: 1px;

    opacity: 0;
}


.toggle-control {
    position: relative;

    flex-shrink: 0;

    width: 44px;
    height: 25px;

    border: 2px solid #04AA6D;
    border-radius: 999px;

    background-color: white;
}


.toggle-control::after {
    content: "";

    position: absolute;

    top: 3px;
    left: 3px;

    width: 15px;
    height: 15px;

    border-radius: 50%;

    background-color: #04AA6D;

    transition:
        transform 0.15s ease;
}


.toggle-field input:checked
+ .toggle-control {
    background-color: #04AA6D;
}


.toggle-field input:checked
+ .toggle-control::after {
    background-color: white;

    transform: translateX(19px);
}


/* =========================================================
   EXERCISES
   ========================================================= */

.block-exercises {
    display: flex;
    flex-direction: column;

    gap: 13px;

    margin-top: 10px;

    padding: 0;
}


.hierarchy-exercise {
    position: relative;

    width: 100%;

    padding: 16px;

    background-color: #f9f9f9;

    border: 2px solid #d0d0d0;
    border-radius: 12px;

    text-align: left;
}


/* =========================================================
   SUPERSET LINE
   ========================================================= */

.superset-exercises {
    position: relative;

    gap: 14px;

    padding-left: 17px;
}


.superset-exercises::before {
    content: "";

    position: absolute;

    top: 26px;
    bottom: 26px;
    left: 4px;

    width: 3px;

    border-radius: 999px;

    background-color: #04AA6D;
}


.superset-exercises
.hierarchy-exercise::before {
    content: "";

    position: absolute;

    top: 26px;
    left: -13px;

    width: 13px;
    height: 3px;

    background-color: #04AA6D;
}


/* =========================================================
   EXERCISE SEARCH
   ========================================================= */

.exercise-combobox {
    width: 100%;
}


.combobox-wrapper {
    position: relative;

    width: 100%;
}


.exercise-search-input {
    width: 100%;
}


.exercise-dropdown {
    position: absolute;

    z-index: 100;

    top: calc(100% + 4px);
    left: 0;
    right: 0;

    max-height: 260px;

    overflow-y: auto;

    background-color: white;

    border: 2px solid #04AA6D;
    border-radius: 8px;

    box-shadow:
        0 8px 18px
        rgba(0, 0, 0, 0.14);
}


.exercise-dropdown:empty {
    display: none;
}


.exercise-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;

    width: 100%;

    gap: 12px;

    padding: 11px 12px;

    border: 0;
    border-bottom: 1px solid #ddd;

    background-color: white;
    color: #222;

    text-align: left;

    cursor: pointer;
}


.exercise-dropdown-item:hover,
.exercise-dropdown-item:focus {
    background-color: #eaf8f2;

    outline: none;
}


.exercise-dropdown-item:last-child {
    border-bottom: 0;
}


.exercise-dropdown-name {
    min-width: 0;

    overflow: hidden;

    font-size: 14px;
    font-weight: bold;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.exercise-dropdown-muscle {
    flex-shrink: 0;

    padding:
        3px
        7px;

    border-radius: 999px;

    background-color: #04AA6D;
    color: white;

    font-size: 10px;
    font-weight: bold;
}


.exercise-no-results {
    padding: 12px;

    color: #777;

    font-size: 13px;

    text-align: center;
}


/* =========================================================
   SET BLOCKS
   ========================================================= */

.exercise-set-blocks {
    display: flex;
    flex-direction: column;

    gap: 13px;

    margin-top: 15px;

    padding: 0;
}


.hierarchy-set-block {
    width: 100%;

    padding: 15px;

    background-color: white;

    border: 2px solid #d5d5d5;
    border-radius: 10px;

    text-align: left;
}


/* =========================================================
   SET LIST
   ========================================================= */

.sets-list {
    display: flex;
    flex-direction: column;

    gap: 6px;

    margin-top: 8px;

    padding: 0;
}


/*
 * Set вече не е карта.
 *
 * Това е само компактен ред вътре в SetBlock.
 */
.set-row-compact {
    display: grid;

    grid-template-columns:
        58px
        minmax(0, 1fr)
        30px;

    align-items: center;

    gap: 8px;

    width: 100%;

    padding:
        5px
        0;

    border-bottom:
        1px solid
        #e7e7e7;
}


.set-row-compact:last-child {
    border-bottom: 0;
}


.set-number {
    color: #333;

    font-size: 13px;
    font-weight: 800;

    white-space: nowrap;
}


.set-value-expression {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto
        minmax(0, 1fr);

    align-items: center;

    gap: 7px;
}


.set-value-input {
    min-width: 0;

    padding:
        8px
        9px;

    font-size: 14px;
}


.set-times {
    color: #555;

    font-size: 17px;
    font-weight: bold;

    text-align: center;
}


.remove-set-button {
    width: 28px;
    height: 28px;

    font-size: 22px;
}


/* =========================================================
   ADD CHILD BUTTONS
   ========================================================= */

.add-child-button {
    margin-top: 13px;

    padding:
        9px
        13px;
}


.compact-add-button {
    margin-top: 10px;
}


/* =========================================================
   ADD BLOCK
   ========================================================= */

.add-block-section {
    display: flex;
    justify-content: center;

    margin:
        22px
        0
        14px;
}


.add-block-button {
    min-width: 220px;
}


/* =========================================================
   BUILDER ERROR
   ========================================================= */

.builder-error {
    margin:
        18px
        0
        12px;

    text-align: center;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 599px) {

    body {
        line-height: 1.4;
    }


    .navbar {
        gap: 10px;

        padding:
            12px
            13px;
    }


    .builder-page,
    .workouts-page {
        padding:
            20px
            10px
            50px;
    }


    .builder-header {
        margin-bottom: 20px;
    }


    .builder-header h1 {
        font-size: 27px;
    }


    .builder-card {
        margin-bottom: 24px;

        padding: 16px;
    }


    .builder-section-header {
        margin-bottom: 14px;
    }


    #exercise-blocks {
        gap: 16px;

        margin-bottom: 18px;
    }


    .hierarchy-block {
        padding: 15px;
    }


    .hierarchy-exercise {
        padding: 13px;
    }


    .hierarchy-set-block {
        padding: 12px;
    }


    .component-header {
        margin-bottom: 10px;
    }


    .component-number {
        width: 31px;
        height: 31px;
    }


    .component-number-small {
        width: 27px;
        height: 27px;
    }


    .component-label {
        font-size: 15px;
    }


    .block-options,
    .set-block-options {
        margin-bottom: 9px;
    }


    .exercise-set-blocks {
        margin-top: 12px;

        gap: 10px;
    }


    /*
     * Superset запазва много малък indent
     * само за зелената линия.
     */
    .superset-exercises {
        padding-left: 14px;
    }


    .superset-exercises::before {
        left: 3px;
    }


    .superset-exercises
    .hierarchy-exercise::before {
        left: -11px;

        width: 11px;
    }


    /*
     * Set row остава на един ред и на телефон.
     */
    .set-row-compact {
        grid-template-columns:
            48px
            minmax(0, 1fr)
            27px;

        gap: 5px;
    }


    .set-number {
        font-size: 12px;
    }


    .set-value-expression {
        gap: 4px;
    }


    .set-value-input {
        padding:
            8px
            7px;

        font-size: 13px;
    }


    .set-times {
        font-size: 15px;
    }


    .add-child-button {
        width: 100%;
    }


    .add-block-button {
        width: 100%;
    }


    .primary-link-button {
        width: 100%;
    }

}


/* =========================================================
   DESKTOP
   ========================================================= */

@media (min-width: 700px) {

    .builder-page {
        padding-top: 38px;
    }


    .hierarchy-block {
        padding: 22px;
    }


    .hierarchy-exercise {
        padding: 18px;
    }


    .hierarchy-set-block {
        padding: 17px;
    }


    /*
     * На desktop Weight × Reps полетата не трябва
     * да стават прекалено широки.
     */
    .set-value-expression {
        max-width: 390px;
    }


    .add-child-button {
        width: auto;
    }

}
/* =========================================================
   WORKOUT TABS
   ========================================================= */

.workouts-heading {
    margin-bottom: 24px;

    text-align: center;
}


.workouts-heading h1 {
    margin: 0;

    font-weight: 800;
}


.workout-tabs {
    display: flex;
    align-items: center;

    width: 100%;

    margin-bottom: 28px;

    border-bottom:
        2px solid
        #dddddd;
}


.workout-tab {
    position: relative;

    flex: 1;

    padding:
        13px
        16px;

    border: 0;

    background: transparent;

    color: #777;

    font-size: 15px;
    font-weight: bold;

    cursor: pointer;
}


.workout-tab::after {
    content: "";

    position: absolute;

    right: 0;
    bottom: -2px;
    left: 0;

    height: 3px;

    background-color: transparent;
}


.workout-tab.active {
    color: #04AA6D;
}


.workout-tab.active::after {
    background-color: #04AA6D;
}


/* =========================================================
   TEMPLATE SECTION
   ========================================================= */

.template-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 24px;

    text-align: left;
}


.template-section-header h2 {
    margin:
        0
        0
        3px;

    font-size: 22px;
}


.template-section-header p {
    margin: 0;

    color: #777;

    font-size: 13px;
}


.create-template-button {
    flex-shrink: 0;
}


/* =========================================================
   TEMPLATE CARDS
   ========================================================= */

.template-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(230px, 1fr)
        );

    gap: 14px;

    width: 100%;
}


.template-card {
    display: flex;
    align-items: center;
    justify-content: space-between;

    min-height: 105px;

    gap: 18px;

    padding: 18px;

    background-color: white;

    border:
        2px solid
        #dddddd;

    border-radius: 12px;

    color: #222;

    text-align: left;
    text-decoration: none;

    transition:
        border-color 0.15s ease,
        transform 0.15s ease,
        box-shadow 0.15s ease;
}


.template-card:hover {
    border-color: #04AA6D;

    transform:
        translateY(-2px);

    box-shadow:
        0 7px 18px
        rgba(0, 0, 0, 0.07);
}


.template-card-main {
    min-width: 0;
}


.template-card-label {
    display: block;

    margin-bottom: 4px;

    color: #04AA6D;

    font-size: 11px;
    font-weight: bold;

    text-transform: uppercase;

    letter-spacing: 0.06em;
}


.template-card h3 {
    margin: 0;

    overflow: hidden;

    font-size: 18px;
    font-weight: 800;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.template-card-arrow {
    color: #04AA6D;

    font-size: 25px;
    font-weight: bold;
}


.workouts-message {
    margin-top: 24px;

    color: #777;

    text-align: center;
}


/* =========================================================
   HISTORY PLACEHOLDER
   ========================================================= */

.history-placeholder {
    padding: 45px 20px;

    background-color: white;

    border:
        2px dashed
        #d3d3d3;

    border-radius: 12px;

    text-align: center;
}


.history-placeholder h2 {
    margin-top: 0;
}


.history-placeholder p {
    margin-bottom: 0;

    color: #777;
}


/* =========================================================
   WORKOUT DETAIL HEADER
   ========================================================= */

.workout-detail-page {
    text-align: left;
}


.detail-back-row {
    margin-bottom: 16px;
}


.workout-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 20px;

    margin-bottom: 22px;
}


.template-title-area {
    min-width: 0;
}


.template-title-area h1 {
    margin: 0;

    font-size: 31px;
    font-weight: 800;

    word-break: break-word;
}


.detail-template-label {
    display: block;

    margin-bottom: 3px;

    color: #04AA6D;

    font-size: 15px;
    font-weight: bold;

    text-transform: uppercase;

    letter-spacing: 0.07em;
}


.template-header-actions {
    display: flex;
    align-items: center;

    flex-shrink: 0;

    gap: 9px;
}


.detail-action-button {
    width: auto;

    min-width: 115px;
}


/* =========================================================
   DETAIL NAME EDIT
   ========================================================= */

.detail-name-edit {
    width: min(
        500px,
        100%
    );
}


.detail-name-edit label {
    display: block;

    margin-bottom: 5px;

    font-size: 13px;
    font-weight: bold;
}


.detail-name-edit-row {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto;

    gap: 8px;
}


/* =========================================================
   DETAIL MESSAGES
   ========================================================= */

.detail-message {
    min-height: 22px;

    margin:
        0
        0
        14px;

    font-size: 13px;
    font-weight: bold;

    text-align: center;
}


.detail-message.error {
    color: #d9534f;
}


.detail-message.success {
    color: #04AA6D;
}


/* =========================================================
   DETAIL COMPONENT ACTIONS
   ========================================================= */

.detail-component-actions {
    display: flex;
    align-items: center;

    flex-shrink: 0;

    gap: 7px;
}


.reorder-controls {
    display: flex;

    gap: 4px;
}


.reorder-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 30px;
    height: 30px;

    padding: 0;

    border:
        1px solid
        #cccccc;

    border-radius: 7px;

    background-color: white;
    color: #333;

    font-size: 16px;
    font-weight: bold;

    cursor: pointer;
}


.reorder-button:hover:not(:disabled) {
    border-color: #04AA6D;

    background-color: #eaf8f2;

    color: #04AA6D;
}


.reorder-button:disabled {
    opacity: 0.3;

    cursor: default;
}


/* =========================================================
   READ ONLY DETAIL
   ========================================================= */

.detail-status-row {
    margin:
        -3px
        0
        10px;
}


.detail-badge {
    display: inline-flex;
    align-items: center;

    padding:
        4px
        9px;

    border-radius: 999px;

    background-color: #e7f8f1;
    color: #038554;

    font-size: 11px;
    font-weight: bold;
}


.detail-exercise-display {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    padding:
        10px
        12px;

    background-color: white;

    border:
        2px solid
        #04AA6D;

    border-radius: 8px;
}


.detail-exercise-display strong {
    min-width: 0;

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;
}


.detail-exercise-display span {
    flex-shrink: 0;

    padding:
        3px
        7px;

    border-radius: 999px;

    background-color: #04AA6D;
    color: white;

    font-size: 10px;
    font-weight: bold;
}


/* =========================================================
   READ ONLY SET
   ========================================================= */

.detail-set-readonly {
    grid-template-columns:
        58px
        minmax(0, 1fr);
}


.detail-set-value {
    display: inline-flex;
    align-items: center;

    gap: 8px;

    min-height: 38px;

    font-size: 14px;
}


.detail-set-value strong {
    color: #777;
}


/* =========================================================
   SET EDIT ACTIONS
   ========================================================= */

.detail-set-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;

    gap: 5px;
}


.workout-detail-page
.set-row-compact:has(
    .detail-set-actions
) {
    grid-template-columns:
        58px
        minmax(0, 1fr)
        auto;
}


/* =========================================================
   ADD EXERCISE PANEL
   ========================================================= */

.add-exercise-panel {
    margin-top: 12px;

    padding: 13px;

    background-color: #f1faf6;

    border:
        2px solid
        #04AA6D;

    border-radius: 9px;
}


.add-exercise-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 8px;
}


.add-exercise-panel-header strong {
    font-size: 13px;
}


/* =========================================================
   DETAIL ADD BLOCK
   ========================================================= */

.detail-add-block {
    display: flex;
    justify-content: center;

    margin-top: 22px;
}


/* =========================================================
   IN PROGRESS PLACEHOLDER
   ========================================================= */

.in-progress-page {
    text-align: center;
}


/* =========================================================
   DETAIL MOBILE
   ========================================================= */

@media (max-width: 599px) {

    .workout-tabs {
        margin-bottom: 20px;
    }


    .workout-tab {
        padding:
            11px
            7px;

        font-size: 13px;
    }


    .template-section-header {
        align-items: stretch;
        flex-direction: column;

        gap: 13px;
    }


    .create-template-button {
        width: 100%;
    }


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


    .template-card {
        min-height: 82px;

        padding: 14px;
    }


    .workout-detail-header {
        align-items: stretch;
        flex-direction: column;

        gap: 13px;
    }


    .template-title-area h1 {
        font-size: 26px;

        text-align: center;
    }


    .detail-template-label {
        text-align: center;
    }


    .template-header-actions {
        width: 100%;
    }


    .detail-action-button {
        flex: 1;

        min-width: 0;
    }


    .detail-name-edit {
        width: 100%;
    }


    .detail-name-edit-row {
        grid-template-columns:
            1fr;
    }


    .detail-name-edit-row
    .secondary-button {
        width: 100%;
    }


    .detail-component-actions {
        gap: 4px;
    }


    .reorder-button {
        width: 27px;
        height: 27px;
    }


    .detail-exercise-display {
        padding:
            9px
            10px;
    }


    .workout-detail-page
    .set-row-compact:has(
        .detail-set-actions
    ) {
        grid-template-columns:
            45px
            minmax(0, 1fr)
            auto;
    }


    .detail-set-actions
    .reorder-controls {
        flex-direction: column;

        gap: 2px;
    }


    .detail-set-actions
    .reorder-button {
        width: 24px;
        height: 21px;

        font-size: 12px;
    }

}
/* =========================================================
   IN PROGRESS PAGE
   ========================================================= */

.in-progress-workout-page {
    text-align: left;
}


/* =========================================================
   TOP BAR
   ========================================================= */

.in-progress-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin-bottom: 18px;
}


.end-workout-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding:
        10px
        16px;

    border:
        2px solid
        #d9534f;

    border-radius: 8px;

    background-color: #d9534f;
    color: white;

    font-size: 14px;
    font-weight: bold;

    cursor: pointer;

    transition:
        background-color 0.15s ease,
        color 0.15s ease;
}


.end-workout-button:hover {
    background-color: white;

    color: #d9534f;
}


.end-workout-button:disabled {
    opacity: 0.55;

    cursor: not-allowed;
}


/* =========================================================
   STOPWATCH
   ========================================================= */

.stopwatch-section {
    display: flex;
    align-items: center;
    flex-direction: column;

    width: 100%;

    margin-bottom: 25px;

    padding:
        18px
        20px;

    background-color: white;

    border:
        2px solid
        #04AA6D;

    border-radius: 14px;

    text-align: center;
}


.stopwatch-label {
    margin-bottom: 2px;

    color: #777;

    font-size: 12px;
    font-weight: bold;

    text-transform: uppercase;

    letter-spacing: 0.06em;
}


.workout-stopwatch {
    margin:
        3px
        0
        12px;

    color: #222;

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: clamp(
        34px,
        8vw,
        52px
    );

    font-weight: bold;

    line-height: 1.1;

    letter-spacing: 0.04em;
}


.stopwatch-edit-button {
    min-width: 130px;
}


/* =========================================================
   TITLE
   ========================================================= */

.in-progress-title-area {
    margin-bottom: 18px;

    text-align: center;
}


.in-progress-title-area h1 {
    margin:
        3px
        0
        0;

    font-size: 30px;
    font-weight: 800;
}


.in-progress-status {
    display: inline-block;

    padding:
        4px
        9px;

    border-radius: 999px;

    background-color: #e7f8f1;
    color: #038554;

    font-size: 11px;
    font-weight: bold;

    text-transform: uppercase;

    letter-spacing: 0.06em;
}


/* =========================================================
   IN PROGRESS SET INPUT
   ========================================================= */

.in-progress-set-input {
    background-color: white;
}


.in-progress-set-input:focus {
    background-color: #fafffd;
}


/*
 * Без edit mode редът е:
 *
 * Set 1 | Weight × Reps
 */
.in-progress-workout-page
.set-row-compact {
    grid-template-columns:
        58px
        minmax(0, 1fr);
}


/*
 * В edit mode има и actions:
 *
 * Set 1 | Weight × Reps | ↑↓ ×
 */
.in-progress-workout-page
.set-row-compact:has(
    .detail-set-actions
) {
    grid-template-columns:
        58px
        minmax(0, 1fr)
        auto;
}


/* =========================================================
   NO ACTIVE WORKOUT
   ========================================================= */

.no-active-workout {
    width: 100%;
    max-width: 600px;

    margin:
        50px auto;

    padding:
        35px
        25px;

    background-color: white;

    border:
        2px solid
        #dddddd;

    border-radius: 14px;

    text-align: center;
}


.no-active-workout h1 {
    margin:
        0
        0
        8px;

    font-size: 26px;
}


.no-active-workout p {
    margin:
        0
        0
        22px;

    color: #777;
}


/* =========================================================
   COMPLETED WORKOUT BANNER
   ========================================================= */

.workout-completion-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    width: 100%;

    margin-bottom: 22px;

    padding:
        14px
        16px;

    background-color: #e7f8f1;

    border:
        2px solid
        #04AA6D;

    border-radius: 10px;

    color: #036b45;

    text-align: left;
}


.workout-completion-banner[hidden] {
    display: none;
}


.workout-completion-banner strong {
    display: block;

    margin-bottom: 2px;

    color: #025f3d;

    font-size: 14px;
}


.workout-completion-banner span {
    font-size: 13px;
}


.completion-close-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex-shrink: 0;

    width: 30px;
    height: 30px;

    padding: 0;

    border: 0;

    background: transparent;

    color: #036b45;

    font-size: 24px;

    cursor: pointer;
}


/* =========================================================
   IN PROGRESS MOBILE
   ========================================================= */

@media (max-width: 599px) {

    .in-progress-top-bar {
        margin-bottom: 13px;
    }


    .end-workout-button {
        padding:
            8px
            12px;

        font-size: 12px;
    }


    .stopwatch-section {
        margin-bottom: 18px;

        padding:
            14px
            12px;
    }


    .workout-stopwatch {
        margin-bottom: 10px;

        font-size: 36px;
    }


    .stopwatch-edit-button {
        min-width: 110px;

        padding:
            8px
            14px;
    }


    .in-progress-title-area {
        margin-bottom: 13px;
    }


    .in-progress-title-area h1 {
        font-size: 25px;
    }


    .in-progress-workout-page
    .set-row-compact {
        grid-template-columns:
            45px
            minmax(0, 1fr);

        gap: 5px;
    }


    .in-progress-workout-page
    .set-row-compact:has(
        .detail-set-actions
    ) {
        grid-template-columns:
            45px
            minmax(0, 1fr)
            auto;
    }


    .in-progress-workout-page
    .detail-set-actions
    .reorder-controls {
        flex-direction: column;

        gap: 2px;
    }


    .in-progress-workout-page
    .detail-set-actions
    .reorder-button {
        width: 23px;
        height: 20px;

        font-size: 11px;
    }


    .workout-completion-banner {
        padding:
            12px
            13px;
    }

}
/* =========================================================
   HISTORY INNER TABS
   ========================================================= */

.history-tabs {
    display: flex;
    align-items: center;

    max-width: 420px;

    margin:
        0 auto
        24px;

    padding: 4px;

    background-color: #e9e9e9;

    border-radius: 10px;
}


.history-tab {
    flex: 1;

    padding:
        9px
        14px;

    border: 0;
    border-radius: 7px;

    background: transparent;

    color: #666;

    font-size: 14px;
    font-weight: bold;

    cursor: pointer;
}


.history-tab.active {
    background-color: #04AA6D;

    color: white;
}


/* =========================================================
   CALENDAR
   ========================================================= */

.calendar-card {
    width: 100%;
    max-width: 720px;

    margin:
        0 auto
        28px;

    padding: 18px;

    background-color: white;

    border:
        2px solid
        #dddddd;

    border-radius: 14px;
}


.calendar-header {
    display: grid;

    grid-template-columns:
        42px
        minmax(0, 1fr)
        42px;

    align-items: center;

    gap: 10px;

    margin-bottom: 18px;
}


.calendar-header h2 {
    margin: 0;

    font-size: 20px;
    font-weight: 800;

    text-align: center;
}


.calendar-navigation-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    padding: 0;

    border:
        2px solid
        #04AA6D;

    border-radius: 8px;

    background-color: white;

    color: #04AA6D;

    font-size: 27px;
    font-weight: bold;

    cursor: pointer;
}


.calendar-navigation-button:hover {
    background-color: #04AA6D;

    color: white;
}


.calendar-weekdays,
.calendar-grid {
    display: grid;

    grid-template-columns:
        repeat(
            7,
            minmax(0, 1fr)
        );

    gap: 6px;
}


.calendar-weekdays {
    margin-bottom: 7px;
}


.calendar-weekdays span {
    color: #777;

    font-size: 11px;
    font-weight: bold;

    text-align: center;

    text-transform: uppercase;
}


.calendar-day {
    position: relative;

    aspect-ratio: 1 / 1;

    min-width: 0;

    padding: 4px;

    border:
        2px solid
        transparent;

    border-radius: 9px;

    background-color: #f6f6f6;

    color: #333;

    font-weight: bold;

    cursor: pointer;
}


.calendar-day:hover {
    border-color: #04AA6D;
}


.calendar-day-empty {
    background: transparent;

    pointer-events: none;
}


.calendar-day.today {
    border-color: #04AA6D;
}


.calendar-day.has-workout {
    background-color: #dff5ec;

    color: #02764c;
}


.calendar-day.has-workout.selected,
.calendar-day.selected {
    background-color: #04AA6D;

    border-color: #04AA6D;

    color: white;
}


.calendar-day-number {
    position: absolute;

    top: 7px;
    left: 8px;

    font-size: 13px;
}


.calendar-workout-dot {
    position: absolute;

    right: 7px;
    bottom: 7px;

    width: 7px;
    height: 7px;

    border-radius: 50%;

    background-color: #04AA6D;
}


.calendar-day.selected
.calendar-workout-dot {
    background-color: white;
}


/* =========================================================
   SELECTED CALENDAR DAY
   ========================================================= */

.selected-day-section {
    width: 100%;
    max-width: 900px;

    margin: 0 auto;
}


.selected-day-section > h2 {
    margin:
        0
        0
        15px;

    font-size: 20px;

    text-align: center;
}


.selected-day-workouts {
    display: flex;
    flex-direction: column;

    gap: 18px;
}


.calendar-empty-day,
.calendar-loading {
    padding: 22px;

    background-color: white;

    border:
        2px dashed
        #dddddd;

    border-radius: 10px;

    color: #777;

    text-align: center;
}


/* =========================================================
   INLINE HISTORY WORKOUT
   ========================================================= */

.calendar-workout-detail {
    padding: 18px;

    background-color: white;

    border:
        2px solid
        #04AA6D;

    border-radius: 14px;

    text-align: left;
}


.calendar-workout-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 15px;

    margin-bottom: 17px;
}


.calendar-workout-header h3 {
    margin:
        2px
        0
        0;

    font-size: 20px;
}


.calendar-workout-time {
    color: #777;

    font-size: 12px;
    font-weight: bold;
}


.calendar-workout-duration {
    flex-shrink: 0;

    padding:
        6px
        10px;

    border-radius: 8px;

    background-color: #e7f8f1;

    color: #038554;

    font-family:
        "Courier New",
        monospace;

    font-size: 13px;
    font-weight: bold;
}


.calendar-workout-tree {
    display: flex;
    flex-direction: column;

    gap: 13px;
}


.history-workout-block {
    padding: 13px;

    background-color: #f8f8f8;

    border-radius: 10px;
}


.history-component-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    margin-bottom: 10px;

    font-size: 13px;
}


.history-exercises {
    display: flex;
    flex-direction: column;

    gap: 9px;
}


.history-exercise {
    padding: 11px;

    background-color: white;

    border:
        1px solid
        #dddddd;

    border-radius: 8px;
}


.history-exercise-name {
    display: block;

    margin-bottom: 8px;

    font-size: 14px;
}


.history-set-blocks {
    display: flex;
    flex-direction: column;

    gap: 8px;
}


.history-set-block {
    padding:
        8px
        10px;

    background-color: #f7f7f7;

    border-radius: 7px;
}


.history-set-block
.detail-badge {
    margin-bottom: 5px;
}


.history-sets {
    display: flex;
    flex-direction: column;
}


.history-set-row {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 10px;

    padding:
        5px
        0;

    border-bottom:
        1px solid
        #e4e4e4;

    font-size: 13px;
}


.history-set-row:last-child {
    border-bottom: 0;
}


/* =========================================================
   RECORDS TAB
   ========================================================= */

.records-section-header {
    margin-bottom: 20px;

    text-align: center;
}


.records-section-header h2 {
    margin:
        0
        0
        3px;
}


.records-section-header p {
    margin: 0;

    color: #777;

    font-size: 13px;
}


/* =========================================================
   RECORDS PAGE
   ========================================================= */

.records-page-header {
    margin-bottom: 26px;

    text-align: center;
}


.records-page-label {
    display: block;

    margin-bottom: 3px;

    color: #04AA6D;

    font-size: 11px;
    font-weight: bold;

    text-transform: uppercase;

    letter-spacing: 0.07em;
}


.records-page-header h1 {
    margin: 0;

    font-size: 30px;
}


.record-instance-list {
    display: flex;
    flex-direction: column;

    gap: 13px;

    width: 100%;
    max-width: 800px;

    margin: 0 auto;
}


.record-instance-card {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto
        24px;

    align-items: center;

    gap: 18px;

    padding:
        16px
        18px;

    background-color: white;

    border:
        2px solid
        #dddddd;

    border-radius: 11px;

    color: #222;

    text-align: left;
    text-decoration: none;

    transition:
        border-color 0.15s ease,
        transform 0.15s ease;
}


.record-instance-card:hover {
    border-color: #04AA6D;

    transform:
        translateY(-1px);
}


.record-instance-label {
    display: block;

    margin-bottom: 2px;

    color: #04AA6D;

    font-size: 10px;
    font-weight: bold;

    text-transform: uppercase;
}


.record-instance-main h3 {
    margin:
        0
        0
        3px;

    font-size: 17px;
}


.record-instance-date {
    color: #777;

    font-size: 12px;
}


.record-instance-duration {
    text-align: right;
}


.record-instance-duration span {
    display: block;

    color: #777;

    font-size: 10px;
    font-weight: bold;

    text-transform: uppercase;
}


.record-instance-duration strong {
    font-family:
        "Courier New",
        monospace;

    font-size: 15px;
}


.record-instance-arrow {
    color: #04AA6D;

    font-size: 23px;
    font-weight: bold;
}


/* =========================================================
   COMPLETED DETAIL META
   ========================================================= */

.completed-workout-meta {
    display: flex;
    align-items: center;
    justify-content: center;

    gap: 14px;

    margin-top: 7px;

    color: #777;

    font-size: 13px;
}


.completed-workout-meta strong {
    color: #04AA6D;

    font-family:
        "Courier New",
        monospace;
}


/* =========================================================
   HISTORY MOBILE
   ========================================================= */

@media (max-width: 599px) {

    .history-tabs {
        margin-bottom: 17px;
    }


    .history-tab {
        padding:
            8px
            10px;

        font-size: 13px;
    }


    .calendar-card {
        padding: 11px;
    }


    .calendar-header {
        grid-template-columns:
            36px
            minmax(0, 1fr)
            36px;

        margin-bottom: 13px;
    }


    .calendar-header h2 {
        font-size: 17px;
    }


    .calendar-navigation-button {
        width: 36px;
        height: 36px;

        font-size: 23px;
    }


    .calendar-weekdays,
    .calendar-grid {
        gap: 3px;
    }


    .calendar-weekdays span {
        font-size: 9px;
    }


    .calendar-day {
        border-radius: 6px;
    }


    .calendar-day-number {
        top: 4px;
        left: 5px;

        font-size: 11px;
    }


    .calendar-workout-dot {
        right: 5px;
        bottom: 5px;

        width: 5px;
        height: 5px;
    }


    .calendar-workout-detail {
        padding: 13px;
    }


    .calendar-workout-header {
        margin-bottom: 13px;
    }


    .calendar-workout-header h3 {
        font-size: 17px;
    }


    .history-workout-block {
        padding: 10px;
    }


    .history-exercise {
        padding: 9px;
    }


    .record-instance-card {
        grid-template-columns:
            minmax(0, 1fr)
            auto;

        gap: 10px;

        padding:
            13px
            14px;
    }


    .record-instance-arrow {
        display: none;
    }


    .record-instance-duration strong {
        font-size: 13px;
    }

}
/* =========================================================
   HIDDEN ELEMENTS
   ========================================================= */

.template-header-actions[hidden],
.detail-action-button[hidden] {
    display: none !important;
}
/* =========================================================
 *
   COMPLETED WORKOUT HEADER
   ========================================================= */

.completed-workout-heading {
    display: flex;
    flex-direction: column;

    gap: 5px;
}


.completed-workout-ended {
    display: flex;
    align-items: center;

    gap: 8px;

    color: #777;

    font-size: 13px;
}


.completed-workout-ended span {
    font-weight: bold;
}


.completed-workout-ended strong {
    color: #333;

    font-weight: 700;
}
@media (max-width: 599px) {

    .completed-workout-heading {
        align-items: center;

        text-align: center;
    }


    .completed-workout-ended {
        justify-content: center;

        flex-wrap: wrap;
    }

}
/* =========================================================
   IN PROGRESS - STANDARD SET BLOCK
   ========================================================= */

.in-progress-standard-set-row {
    display: grid;

    grid-template-columns:
        auto
        minmax(0, 1fr);

    align-items: center;

    gap: 10px;

    width: 100%;

    min-width: 0;
}


.in-progress-standard-set-row
.in-progress-set-editor {
    width: 100%;

    min-width: 0;
}


.in-progress-standard-set-row
.in-progress-set-inputs {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto
        minmax(0, 1fr);

    align-items: center;

    gap: 5px;

    width: 100%;

    min-width: 0;
}


.in-progress-standard-set-row
.in-progress-read-input {
    width: 100%;

    min-width: 0;
    max-width: 100%;

    padding:
        8px
        7px;
}


.in-progress-standard-set-row
.in-progress-set-times {
    flex-shrink: 0;

    padding:
        0
        2px;

    text-align: center;
}


.in-progress-standard-set-row
.in-progress-previous-hint {
    width: 100%;

    margin-bottom: 3px;

    font-size: 11px;

    text-align: left;
}
@media (max-width: 599px) {

    .in-progress-standard-set-row {
        grid-template-columns:
            78px
            minmax(0, 1fr);

        gap: 6px;
    }


    .in-progress-standard-set-row
    .in-progress-set-inputs {
        gap: 3px;
    }


    .in-progress-standard-set-row
    .in-progress-read-input {
        padding:
            7px
            5px;

        font-size: 13px;
    }


    .in-progress-standard-set-row
    .in-progress-set-times {
        font-size: 14px;
    }

}
.in-progress-drop-set-row {
    display: grid;

    grid-template-columns:
        58px
        minmax(0, 1fr);

    align-items: center;

    gap: 8px;

    width: 100%;

    min-width: 0;
}


.in-progress-drop-set-row
.in-progress-set-editor {
    width: 100%;

    min-width: 0;
}


.in-progress-drop-set-row
.in-progress-set-inputs {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto
        minmax(0, 1fr);

    align-items: center;

    gap: 5px;

    width: 100%;

    min-width: 0;
}


.in-progress-drop-set-row
.in-progress-read-input {
    width: 100%;

    min-width: 0;
    max-width: 100%;

    padding:
        8px
        7px;
}


.in-progress-drop-set-row
.in-progress-set-times {
    padding:
        0
        2px;

    text-align: center;
}


.in-progress-drop-set-row
.in-progress-previous-hint {
    width: 100%;

    margin-bottom: 3px;

    font-size: 11px;

    text-align: left;
}


@media (max-width: 599px) {

    .in-progress-drop-set-row {
        grid-template-columns:
            48px
            minmax(0, 1fr);

        gap: 6px;
    }


    .in-progress-drop-set-row
    .in-progress-set-inputs {
        gap: 3px;
    }


    .in-progress-drop-set-row
    .in-progress-read-input {
        padding:
            7px
            5px;

        font-size: 13px;
    }


    .in-progress-drop-set-row
    .in-progress-set-times {
        font-size: 14px;
    }

}
/* =========================================================
   WORKOUTS - IN PROGRESS CARD
   ========================================================= */

.workouts-in-progress-section {
    width: 100%;

    margin:
        0
        0
        24px;
}


.workouts-in-progress-section[hidden] {
    display: none !important;
}


.workouts-in-progress-card {
    display: block;

    width: 100%;

    padding:
        16px
        18px;

    background-color: white;

    border:
        2px solid
        #04AA6D;

    border-radius: 14px;

    color: #222;

    text-align: left;
    text-decoration: none;

    transition:
        transform 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}


.workouts-in-progress-card:hover {
    background-color: #f8fffc;

    transform:
        translateY(-1px);

    box-shadow:
        0 6px 16px
        rgba(0, 0, 0, 0.07);
}


/* =========================================================
   LABEL
   ========================================================= */

.workouts-in-progress-label {
    display: inline-block;

    margin-bottom: 8px;

    color: #04AA6D;

    font-size: 14px;
    font-weight: 800;

    letter-spacing: 0.07em;
}


/* =========================================================
   MAIN ROW
   ========================================================= */

.workouts-in-progress-main {
    display: grid;

    grid-template-columns:
        minmax(0, 1fr)
        auto
        auto;

    align-items: center;

    gap: 18px;
}


.workouts-in-progress-main h2 {
    min-width: 0;

    margin: 0;

    overflow: hidden;

    color: #222;

    font-size: 21px;
    font-weight: 800;

    text-overflow: ellipsis;
    white-space: nowrap;
}


/* =========================================================
   TIMER
   ========================================================= */

.workouts-in-progress-time {
    display: flex;
    flex-direction: column;
    align-items: flex-end;

    gap: 1px;
}


.workouts-in-progress-time span {
    color: #777;

    font-size: 10px;
    font-weight: bold;

    text-transform: uppercase;
}


.workouts-in-progress-time strong {
    color: #04AA6D;

    font-family:
        "Courier New",
        Courier,
        monospace;

    font-size: 17px;
    font-weight: bold;
}


/* =========================================================
   ARROW
   ========================================================= */

.workouts-in-progress-arrow {
    color: #04AA6D;

    font-size: 25px;
    font-weight: bold;
}


/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 599px) {

    .workouts-in-progress-section {
        margin-bottom: 18px;
    }


    .workouts-in-progress-card {
        padding:
            13px
            14px;
    }


    .workouts-in-progress-label {
        margin-bottom: 6px;

        font-size: 12px;
    }


    .workouts-in-progress-main {
        grid-template-columns:
            minmax(0, 1fr)
            auto
            18px;

        gap: 8px;
    }


    .workouts-in-progress-main h2 {
        font-size: 17px;
    }


    .workouts-in-progress-time strong {
        font-size: 14px;
    }


    .workouts-in-progress-time span {
        font-size: 9px;
    }


    .workouts-in-progress-arrow {
        font-size: 20px;
    }

}
/* =========================================================
   HOME
   ========================================================= */

.home-page {
    width: 100%;
    max-width: 1000px;

    margin: 0 auto;

    padding:
        30px
        20px
        60px;
}


.home-page > h1 {
    margin:
        0
        0
        24px;

    text-align: center;
}


.home-tab-panel[hidden] {
    display: none !important;
}


.home-feature-placeholder {
    width: 100%;

    padding:
        45px
        20px;

    background-color: white;

    border:
        2px dashed
        #d3d3d3;

    border-radius: 12px;

    text-align: center;
}


.home-feature-placeholder p {
    margin: 0;

    color: #777;

    font-size: 15px;
    font-weight: bold;
}


@media (max-width: 599px) {

    .home-page {
        padding:
            20px
            12px
            50px;
    }


    .home-feature-placeholder {
        padding:
            35px
            15px;
    }

}
