*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #fce4f0 0%, #f8b4d0 40%, #f48fb1 100%);
    background-attachment: fixed;
    color: #1a1a1a;
    line-height: 1.5;
    min-height: 100vh;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px 16px;
}

h1 {
    font-size: 1.5rem;
    color: #1a1a1a;
    margin-bottom: 4px;
}

h2 {
    font-size: 1.1rem;
    color: #ad1457;
    margin-bottom: 20px;
    font-weight: 400;
}

/* Header Bar */
.header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-logo {
    height: 40px;
    width: auto;
}

.user-info {
    font-size: 0.85rem;
    color: #666;
}

.user-info a {
    color: #c2185b;
    text-decoration: none;
}

.user-info a:hover {
    text-decoration: underline;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.alert.error {
    background: #fde8e8;
    color: #c0392b;
    border: 1px solid #f5c6cb;
}

.alert.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Forms */
form {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

fieldset {
    border: 1px solid #f0c0d4;
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.92);
}

legend {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a1a1a;
    padding: 0 8px;
}

label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 4px;
    margin-top: 12px;
    color: #333;
}

label:first-of-type {
    margin-top: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddb8c8;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.2s;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: #e91e63;
    background: #fff;
}

/* Radio Group */
.radio-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 400;
    margin: 0;
    cursor: pointer;
    flex-wrap: wrap;
}

.radio-label input[type="radio"] {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    accent-color: #e91e63;
}

.inline-input {
    flex: 1;
    min-width: 120px;
    padding: 6px 10px;
    border: 1px solid #ddb8c8;
    border-radius: 6px;
    font-size: 0.9rem;
}

.inline-textarea {
    width: 100%;
    margin-top: 4px;
    padding: 6px 10px;
    border: 1px solid #ddb8c8;
    border-radius: 6px;
    font-size: 0.9rem;
    font-family: inherit;
    resize: vertical;
}

/* Signature */
.signature-wrapper {
    border: 2px dashed #ddb8c8;
    border-radius: 8px;
    overflow: hidden;
    margin-top: 8px;
    background: #fff;
    touch-action: none;
}

.signature-wrapper canvas {
    display: block;
    width: 100%;
    height: 200px;
}

/* Buttons */
button, .btn-primary, .btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary, button[type="submit"] {
    background: #e91e63;
    color: #fff;
    width: 100%;
    margin-top: 8px;
}

.btn-primary:hover, button[type="submit"]:hover {
    background: #c2185b;
}

.btn-secondary {
    background: #fce4ec;
    color: #1a1a1a;
    font-size: 0.85rem;
    padding: 8px 16px;
    margin-top: 8px;
}

.btn-secondary:hover {
    background: #f8bbd0;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.8rem;
    border-radius: 6px;
}

.btn-resend {
    background: #27ae60;
    color: #fff;
}

.btn-resend:hover {
    background: #219a52;
}

.btn-delete {
    background: #e74c3c;
    color: #fff;
}

.btn-delete:hover {
    background: #c0392b;
}

/* Links */
.link {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9rem;
    color: #666;
}

.link a {
    color: #c2185b;
    text-decoration: none;
}

.link a:hover {
    text-decoration: underline;
}

/* Month Headers */
.month-header {
    font-size: 1.05rem;
    color: #1a1a1a;
    margin: 20px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #e91e63;
    font-weight: 600;
}

/* History Table */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid #f0c0d4;
    border-radius: 10px;
    padding: 14px 16px;
}

.history-card h3 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: #1a1a1a;
}

.history-card .meta {
    font-size: 0.82rem;
    color: #777;
    margin-bottom: 8px;
}

.history-card .dates {
    font-size: 0.85rem;
    color: #333;
    margin-bottom: 8px;
}

.history-card .reason {
    font-size: 0.85rem;
    color: #555;
    font-style: italic;
    margin-bottom: 10px;
}

.history-actions {
    display: flex;
    gap: 8px;
}

/* Success Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.overlay-box {
    background: #fff;
    border-radius: 16px;
    padding: 32px 28px;
    text-align: center;
    max-width: 340px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.overlay-icon {
    width: 64px;
    height: 64px;
    background: #27ae60;
    color: #fff;
    border-radius: 50%;
    font-size: 2rem;
    line-height: 64px;
    margin: 0 auto 16px;
}

.overlay-box h2 {
    color: #1a1a1a;
    margin-bottom: 8px;
    font-size: 1.2rem;
}

.overlay-box p {
    color: #666;
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 480px) {
    .container {
        padding: 12px 10px;
    }

    h1 {
        font-size: 1.25rem;
    }

    .header-bar {
        flex-direction: column;
    }

    fieldset {
        padding: 12px;
    }

    .inline-input,
    .inline-textarea {
        width: 100%;
    }
}
