* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 40px 20px;
}

.container {
    background: white;
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 8px 32px rgba(0, 0, 0, 0.06);
    padding: 40px;
    max-width: 540px;
    width: 100%;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.lang-switch {
    position: absolute;
    top: 24px;
    right: 24px;
}

.lang-select {
    padding: 6px 12px;
    border: 1px solid #e2e8f0;
    background: white;
    color: #1e293b;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s ease;
    outline: none;
    appearance: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 14px;
    padding-right: 32px;
}

.lang-select:hover {
    border-color: #cbd5e1;
    background-color: #f8fafc;
}

.lang-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.header {
    text-align: center;
    margin-bottom: 32px;
    padding-top: 8px;
}

.header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 14px;
    font-size: 22px;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

h1 {
    color: #1e293b;
    margin-bottom: 6px;
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    letter-spacing: -0.02em;
}

.subtitle {
    color: #94a3b8;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.form-section {
    background: #fafbfc;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 16px;
    border: 1px solid #f1f5f9;
}

.form-section h3 {
    color: #1e293b;
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.section-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 14px;
    flex-shrink: 0;
}

.section-icon.calendar {
    background: #ede9fe;
}

.section-icon.pill {
    background: #e0e7ff;
}

.form-group {
    margin-bottom: 18px;
}

.form-group:last-child {
    margin-bottom: 0;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #475569;
    font-weight: 500;
    font-size: 13px;
}

.date-input,
input[type="number"] {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    color: #1e293b;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

.date-input::placeholder,
input[type="number"]::placeholder {
    color: #94a3b8;
}

.date-input:focus,
input[type="number"]:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.date-input[aria-invalid="true"],
input[type="number"][aria-invalid="true"] {
    border-color: #ef4444;
}

.date-input[aria-invalid="true"]:focus,
input[type="number"][aria-invalid="true"]:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.radio-group {
    display: flex;
    gap: 4px;
    margin-bottom: 18px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 3px;
}

.radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    cursor: pointer;
    font-weight: 500;
    font-size: 13px;
    color: #64748b;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
}

.radio-label:has(input:checked) {
    background: white;
    color: #1e293b;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.radio-label input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.btn {
    width: 100%;
    padding: 13px 20px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s, transform 0.1s;
    letter-spacing: 0.01em;
}

.btn:hover {
    background: #4f46e5;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}

.btn:active {
    transform: scale(0.99);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
}

.result {
    margin-top: 24px;
    padding: 0;
    background: transparent;
    border-radius: 12px;
    display: none;
    overflow: hidden;
    border: 1px solid #f1f5f9;
}

.result.show {
    display: block;
    animation: slideIn 0.35s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-header {
    text-align: center;
    padding: 28px 24px 24px;
    background: #fafbfc;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.3s ease;
}

.result-header.result-good {
    background: #f0fdf4;
    border-bottom-color: #dcfce7;
}

.result-header.result-warning {
    background: #fffbeb;
    border-bottom-color: #fef3c7;
}

.result-header.result-poor {
    background: #fef2f2;
    border-bottom-color: #fecaca;
}

.gauge-container {
    position: relative;
    width: 140px;
    height: 140px;
    margin: 0 auto 16px;
}

.gauge-ring {
    display: block;
}

.gauge-fill {
    transition: stroke-dashoffset 0.8s ease-out;
}

.gauge-text {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.adherence-value {
    font-size: 36px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.03em;
    line-height: 1;
}

.adherence-value.good {
    color: #16a34a;
}

.adherence-value.warning {
    color: #d97706;
}

.adherence-value.poor {
    color: #dc2626;
}

.status {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 0;
    letter-spacing: 0.01em;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
}

.status-badge.good {
    background: rgba(22, 163, 74, 0.1);
    color: #16a34a;
}

.status-badge.warning {
    background: rgba(217, 119, 6, 0.1);
    color: #d97706;
}

.status-badge.poor {
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

.status-badge svg {
    flex-shrink: 0;
}

.copy-btn {
    margin-top: 20px;
    padding: 10px 20px;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.1), 0 2px 4px -1px rgba(99, 102, 241, 0.06);
}

.copy-btn:hover {
    background: #4f46e5;
    box-shadow: 0 10px 15px -3px rgba(99, 102, 241, 0.2), 0 4px 6px -2px rgba(99, 102, 241, 0.05);
    transform: translateY(-1px);
}

.copy-btn:active {
    transform: translateY(0);
}

.copy-btn.success {
    background: #10b981;
    box-shadow: 0 4px 6px -1px rgba(16, 185, 129, 0.1), 0 2px 4px -1px rgba(16, 185, 129, 0.06);
}

.details {
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
    padding: 4px 0;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    border-bottom: 1px solid #f8fafc;
    transition: background 0.15s;
}

.detail-row:hover {
    background: #fafbfc;
}

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

.detail-label {
    color: #64748b;
    font-size: 13px;
}

.detail-value {
    font-weight: 600;
    color: #1e293b;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 6px;
    display: none;
    font-weight: 500;
}

.note {
    background: #f0f4ff;
    padding: 14px 20px;
    border-radius: 0 0 12px 12px;
    margin-top: 0;
    font-size: 12px;
    color: #4f46e5;
    border-top: 1px solid #e0e7ff;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.note-icon {
    flex-shrink: 0;
    margin-top: 1px;
}

.date-field {
    display: flex;
    gap: 8px;
    align-items: center;
}

.date-text {
    flex: 1;
}

.date-picker-btn {
    width: 42px;
    height: 42px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.date-picker-btn:hover {
    border-color: #cbd5e1;
}

.date-picker-btn:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.date-picker-wrap {
    position: relative;
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
}

.date-picker-wrap:focus-within .date-picker-btn {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

.date-picker-overlay {
    position: absolute;
    inset: 0;
    opacity: 0.02;
    z-index: 2;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 0;
    margin: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.date-picker-btn {
    position: relative;
    z-index: 1;
}

.help-text {
    margin-top: 6px;
    font-size: 12px;
    color: #94a3b8;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.form-error {
    display: none;
    margin-bottom: 16px;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    font-weight: 500;
}

.periods-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.period-item {
    background: white;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    position: relative;
    transition: border-color 0.2s;
}

.period-item:focus-within {
    border-color: #6366f1;
}

.period-item[aria-invalid="true"] {
    border-color: #ef4444;
}

.period-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.period-label {
    font-size: 12px;
    font-weight: 600;
    color: #6366f1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.remove-period-btn {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-period-btn:hover {
    color: #dc2626;
    background: #fef2f2;
}

.period-fields {
    display: grid;
    gap: 10px;
}

.period-fields.date-mode {
    grid-template-columns: 1fr 1fr;
}

.period-fields.length-mode {
    grid-template-columns: 1fr 1fr;
}

.period-field-full {
    grid-column: 1 / -1;
}

.period-fields label {
    margin-bottom: 4px;
    font-size: 12px;
}

.period-fields input {
    padding: 8px 10px;
    font-size: 13px;
}

.add-period-btn {
    background: none;
    border: 1.5px dashed #cbd5e1;
    border-radius: 10px;
    padding: 10px;
    color: #6366f1;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    width: 100%;
}

.add-period-btn:hover {
    border-color: #6366f1;
    background: #f5f3ff;
}

.period-error {
    color: #dc2626;
    font-size: 12px;
    margin-top: 8px;
    display: none;
    font-weight: 500;
}

@media (max-width: 480px) {
    .period-fields.date-mode,
    .period-fields.length-mode {
        grid-template-columns: 1fr;
    }

    .period-field-full {
        grid-column: 1;
    }
}

.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #6366f1, #8b5cf6);
    border-radius: 16px 16px 0 0;
}

.disclaimer {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    color: #94a3b8;
    font-size: 11px;
    line-height: 1.5;
}

@media (max-width: 480px) {
    body {
        padding: 16px;
        align-items: flex-start;
    }

    .container {
        padding: 24px;
        border-radius: 12px;
    }

    .container::before {
        border-radius: 12px 12px 0 0;
    }

    .form-section {
        padding: 18px;
    }

    h1 {
        font-size: 20px;
    }

    .gauge-container {
        width: 120px;
        height: 120px;
    }

    .gauge-ring {
        width: 120px;
        height: 120px;
    }

    .adherence-value {
        font-size: 30px;
    }

    .radio-label {
        font-size: 12px;
        padding: 7px 10px;
    }

    .detail-row {
        padding: 10px 18px;
    }
}
