:root {
    --rad-primary: #0d6efd;       /* Синій - основний */
    --rad-primary-hover: #0b5ed7;
    --rad-success: #198754;       /* Зелений */
    --rad-danger: #dc3545;        /* Червоний */
    --rad-bg: #f8f9fa;            /* Світлий фон */
    --rad-text: #212529;          /* Темний текст */
    --rad-border: #dee2e6;        /* Сірі рамки */
    --rad-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* === ВІДЖЕТ НА САЙТІ === */
.rad-widget-wrapper {
    font-family: var(--lab-font-brand, var(--lab-font-body, Roboto, Arial, sans-serif));
    display: flex;
    justify-content: center; /* Центрування на сторінці */
    margin: 20px 0;
}

.rad-card {
    font-family: inherit;
    background: #fff;
    border: 1px solid var(--rad-border);
    border-radius: 8px;
    padding: 15px 25px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    transition: transform 0.2s, box-shadow 0.2s;
    min-width: 200px;
}

.rad-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--rad-shadow);
    border-color: var(--rad-primary);
}

.rad-card-header {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 5px;
    font-weight: 500;
}

.rad-card-body {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.rad-value-main {
    font-size: 2.1rem;
    font-weight: 700;
    color: var(--rad-text);
    line-height: 1.1;
}

.rad-unit {
    font-size: 0.82rem;
    color: #6c757d;
    margin-top: 2px;
}

.lab-radiation-widget .rad-widget-wrapper {
    font-family: var(--lab-font-brand, var(--lab-font-body, Roboto, Arial, sans-serif));
    display: block;
    margin: 18px 0 0;
}

.lab-radiation-widget .rad-card {
    width: 100%;
    min-width: 0;
    min-height: 310px;
    padding: 16px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    text-align: left;
    background:
        linear-gradient(135deg, rgba(128, 162, 183, 0.14), rgba(234, 243, 247, 0.72)),
        #ffffff;
    border: 1px solid rgba(128, 162, 183, 0.35);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(41, 57, 69, 0.08);
}

.lab-radiation-widget .rad-card:hover {
    transform: none;
    box-shadow: 0 12px 30px rgba(41, 57, 69, 0.08);
    border-color: rgba(128, 162, 183, 0.7);
}

.lab-radiation-widget .rad-card-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    min-height: 74px;
    padding: 12px 18px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(128, 162, 183, 0.28);
    border-radius: 8px;
}

.lab-radiation-widget .rad-card-header {
    margin: 0;
    padding: 8px 12px;
    color: var(--lab-text-secondary, #5A6B78);
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: center;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(128, 162, 183, 0.22);
    border-radius: 8px;
}

.lab-radiation-widget .rad-card-body {
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: flex-end;
    gap: 8px;
}

.lab-radiation-widget .rad-value-main {
    color: var(--lab-brand-dark, #293945);
    font-size: clamp(1.85rem, 3vw, 2.35rem);
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0;
}

.lab-radiation-widget .rad-unit {
    margin: 0;
    color: var(--lab-text-secondary, #5A6B78);
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.lab-radiation-widget .rad-inline-calendar {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 10px;
}

.lab-radiation-widget .rad-inline-calendar__controls {
    display: grid;
    grid-template-columns: 34px 1fr 34px;
    align-items: center;
    gap: 8px;
}

.lab-radiation-widget .rad-inline-calendar__month {
    color: var(--lab-brand-dark, #293945);
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
}

.lab-radiation-widget .rad-inline-calendar__nav {
    width: 34px;
    height: 34px;
    border: 1px solid rgba(128, 162, 183, 0.35);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--lab-brand-dark, #293945);
    font: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.lab-radiation-widget .rad-inline-calendar__nav:hover {
    background: var(--lab-brand-dark, #293945);
    border-color: var(--lab-brand-dark, #293945);
    color: #ffffff;
}

.lab-radiation-widget .rad-inline-weekdays,
.lab-radiation-widget .rad-inline-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.lab-radiation-widget .rad-inline-weekdays {
    color: var(--lab-text-secondary, #5A6B78);
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
}

.lab-radiation-widget .rad-inline-day {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 42px;
    padding: 6px 4px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 1px solid rgba(128, 162, 183, 0.18);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.46);
    color: rgba(41, 57, 69, 0.52);
    font-family: inherit;
    cursor: default;
}

.lab-radiation-widget .rad-inline-day.has-value {
    background: #ffffff;
    border-color: rgba(128, 162, 183, 0.36);
    color: var(--lab-brand-dark, #293945);
    cursor: pointer;
}

.lab-radiation-widget .rad-inline-day.has-value:hover,
.lab-radiation-widget .rad-inline-day.is-selected {
    background: var(--lab-brand-dark, #293945);
    border-color: var(--lab-brand-dark, #293945);
    color: #ffffff;
}

.lab-radiation-widget .rad-inline-day.today:not(.is-selected) {
    border-color: rgba(25, 135, 84, 0.45);
}

.lab-radiation-widget .rad-inline-day--empty {
    visibility: hidden;
}

.lab-radiation-widget .rad-inline-day__num {
    font-size: 0.76rem;
    font-weight: 700;
    line-height: 1;
}

.lab-radiation-widget .rad-inline-day__value {
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1;
}

.lab-radiation-widget .rad-inline-calendar__loading {
    grid-column: 1 / -1;
    padding: 18px 0;
    color: var(--lab-text-secondary, #5A6B78);
    font-size: 0.86rem;
    text-align: center;
}

.lab-radiation-widget .rad-footer-link--inline {
    margin-top: 0;
    text-align: right;
}

@media (max-width: 810px) {
    .lab-radiation-widget .rad-widget-wrapper,
    .lab-radiation-widget .rad-card,
    .lab-radiation-widget .rad-inline-calendar {
        min-width: 0;
        max-width: 100%;
    }
}

@media (max-width: 560px) {
    .lab-radiation-widget .rad-card {
        gap: 12px;
    }

    .lab-radiation-widget .rad-card-current {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .lab-radiation-widget .rad-card-header,
    .lab-radiation-widget .rad-card-body {
        justify-content: center;
        text-align: center;
    }

    .lab-radiation-widget .rad-inline-weekdays,
    .lab-radiation-widget .rad-inline-calendar-grid {
        gap: 4px;
    }

    .lab-radiation-widget .rad-inline-day {
        min-height: 38px;
        border-radius: 7px;
    }
}

/* === МОДАЛЬНЕ ВІКНО === */
.rad-modal {
    position: fixed; 
    z-index: 10000; /* Поверх всього Joomla */
    left: 0;
    top: 0;
    width: 100%; 
    height: 100%; 
    overflow: auto; 
    background-color: rgba(0,0,0,0.5); /* Затемнення фону */
    backdrop-filter: blur(3px); /* Ефект розмиття */
    display: flex;
    align-items: center;
    justify-content: center;
}

.rad-modal-content {
    background-color: #fff;
    margin: auto;
    padding: 25px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px; /* Не дуже широке */
    border-radius: 12px;
    box-shadow: 0 1rem 3rem rgba(0,0,0,0.2);
    position: relative;
    animation: radFadeIn 0.3s;
}

@keyframes radFadeIn {
    from {opacity: 0; transform: translateY(-20px);}
    to {opacity: 1; transform: translateY(0);}
}

.rad-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
    transition: color 0.2s;
}

.rad-close:hover {
    color: #000;
}

/* === КАЛЕНДАР === */
.rad-calendar-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-size: 1.2rem;
    font-weight: bold;
}

.rad-calendar-controls button {
    background: none;
    border: 1px solid var(--rad-border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    font-weight: bold;
    color: var(--rad-text);
}

.rad-calendar-controls button:hover {
    background-color: var(--rad-bg);
    border-color: #aaa;
}

.rad-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #6c757d;
}

.rad-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
}

.rad-day {
    aspect-ratio: 1 / 1; /* Квадратні клітинки */
    border: 1px solid var(--rad-border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 0.8rem;
    cursor: default;
    background: #fff;
    position: relative;
    padding: 2px;
}

.rad-day.has-value {
    background-color: #e6f4ea; /* Світло-зелений для заповнених */
    border-color: #c3e6cb;
    cursor: pointer;
    font-weight: bold;
    color: var(--rad-success);
}

.rad-day.has-value:hover {
    background-color: #d4edda;
}

.rad-day.empty {
    background-color: #f8f9fa; /* Сірий для пустих */
    color: #ccc;
}

.rad-day-num {
    position: absolute;
    top: 2px;
    left: 4px;
    font-size: 0.7rem;
    color: #999;
}

/* Підсвітка сьогоднішньої дати */
.rad-day.today {
    border: 2px solid var(--rad-primary);
}

/* === ФОРМИ === */
.rad-view h3 {
    margin-top: 0;
    margin-bottom: 20px;
    text-align: center;
    color: var(--rad-text);
}

.rad-form-group {
    margin-bottom: 15px;
}

.rad-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.rad-input {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--rad-border);
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box; /* Важливо для відступів */
}

.rad-input:focus {
    outline: none;
    border-color: var(--rad-primary);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.rad-input-large {
    font-size: 1.5rem;
    text-align: center;
    font-weight: bold;
}

.rad-form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 25px;
    gap: 10px;
}

.rad-btn-primary, .rad-btn-secondary {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    flex: 1;
}

.rad-btn-primary {
    background-color: var(--rad-primary);
    color: #fff;
}
.rad-btn-primary:hover { background-color: var(--rad-primary-hover); }

.rad-btn-secondary {
    background-color: #6c757d;
    color: #fff;
}
.rad-btn-secondary:hover { background-color: #5c636a; }

.rad-btn-link {
    background: none;
    border: none;
    color: var(--rad-primary);
    cursor: pointer;
    text-decoration: underline;
    padding: 5px;
}

.rad-text-danger { color: var(--rad-danger); }

.rad-footer-link {
    margin-top: 20px;
    text-align: center;
    font-size: 0.8rem;
}
.rad-footer-link a {
    color: #ccc;
    text-decoration: none;
}
.rad-footer-link a:hover { color: #888; }

/* === ТАБЛИЦЯ КОРИСТУВАЧІВ === */
.rad-users-table-wrapper {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
    border: 1px solid var(--rad-border);
    border-radius: 6px;
}

.rad-table {
    width: 100%;
    border-collapse: collapse;
}

.rad-table th, .rad-table td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid var(--rad-border);
}

.rad-table th {
    background-color: #f1f1f1;
    position: sticky;
    top: 0;
}

.rad-action-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 5px;
}

.rad-admin-panel-footer {
    margin-top: 30px;
    text-align: center;
}
