/* ── Commons Membership — Front-end Styles ──────────────── */

:root {
    --commons-primary: #2E75B6;
    --commons-primary-dark: #1a5a94;
    --commons-success: #2d8a4e;
    --commons-warning: #c5841d;
    --commons-danger: #b32d2e;
    --commons-bg: #f8f9fa;
    --commons-card: #ffffff;
    --commons-border: #e2e4e7;
    --commons-text: #1e1e1e;
    --commons-muted: #6b7280;
    --commons-radius: 8px;
}

/* ── Login ────────────────────────────────────────────────── */

.commons-login-wrap {
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.commons-login-box {
    background: var(--commons-card);
    border: 1px solid var(--commons-border);
    border-radius: var(--commons-radius);
    padding: 32px 36px;
    max-width: 400px;
    width: 100%;
}

.commons-login-box h2 {
    margin: 0 0 8px;
    font-size: 22px;
    color: var(--commons-text);
}

.commons-login-box p {
    color: var(--commons-muted);
    margin: 0 0 24px;
    font-size: 14px;
}

.commons-login-box label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--commons-text);
}

.commons-login-box input[type="text"],
.commons-login-box input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--commons-border);
    border-radius: 6px;
    font-size: 15px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.commons-login-box input[type="submit"] {
    width: 100%;
    padding: 12px;
    background: var(--commons-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
}

.commons-login-box input[type="submit"]:hover {
    background: var(--commons-primary-dark);
}

.commons-login-reset {
    text-align: center;
    margin-top: 16px;
}

.commons-login-reset a {
    color: var(--commons-muted);
    font-size: 13px;
}

/* ── Dashboard ────────────────────────────────────────────── */

.commons-dashboard {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

.commons-dash-header {
    position: relative;
    margin-bottom: 32px;
}

.commons-dash-header h2 {
    font-size: 24px;
    margin: 0 0 4px;
    color: var(--commons-text);
}

.commons-dash-subtitle {
    color: var(--commons-muted);
    font-size: 15px;
    margin: 0;
}

.commons-logout {
    position: absolute;
    top: 0;
    right: 0;
    font-size: 13px;
    color: var(--commons-muted);
    text-decoration: none;
}

.commons-logout:hover {
    color: var(--commons-danger);
}

.commons-dash-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.commons-dash-card {
    background: var(--commons-card);
    border: 1px solid var(--commons-border);
    border-radius: var(--commons-radius);
    padding: 24px;
    text-decoration: none;
    color: var(--commons-text);
    transition: border-color 0.2s, box-shadow 0.2s;
    display: block;
}

a.commons-dash-card:hover {
    border-color: var(--commons-primary);
    box-shadow: 0 2px 8px rgba(46, 117, 182, 0.12);
}

.commons-dash-card--soon {
    opacity: 0.5;
    cursor: default;
}

.commons-dash-icon {
    color: var(--commons-primary);
    margin-bottom: 12px;
}

.commons-dash-card h3 {
    font-size: 16px;
    margin: 0 0 6px;
}

.commons-dash-card p {
    font-size: 13px;
    color: var(--commons-muted);
    margin: 0;
    line-height: 1.5;
}

/* ── Recognition ──────────────────────────────────────────── */

.commons-recognition {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

.commons-recog-header {
    margin-bottom: 24px;
}

.commons-back-link {
    font-size: 13px;
    color: var(--commons-muted);
    text-decoration: none;
    display: inline-block;
    margin-bottom: 8px;
}

.commons-back-link:hover {
    color: var(--commons-primary);
}

.commons-recog-header h2 {
    font-size: 22px;
    margin: 0 0 6px;
}

.commons-recog-header p {
    color: var(--commons-muted);
    font-size: 14px;
    margin: 0;
    line-height: 1.5;
}

/* Coverage tracker */
.commons-coverage {
    background: var(--commons-card);
    border: 1px solid var(--commons-border);
    border-radius: var(--commons-radius);
    padding: 24px;
    margin-bottom: 24px;
}

.commons-coverage h3 {
    font-size: 16px;
    margin: 0 0 12px;
}

.commons-coverage-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.commons-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid var(--commons-border);
    background: var(--commons-bg);
    color: var(--commons-text);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.commons-badge:hover {
    border-color: var(--commons-primary);
    box-shadow: 0 1px 4px rgba(46, 117, 182, 0.15);
}

.commons-badge em {
    font-style: normal;
    font-weight: 700;
    font-size: 12px;
    min-width: 18px;
    height: 18px;
    line-height: 18px;
    text-align: center;
    border-radius: 9px;
    background: var(--commons-border);
    color: var(--commons-muted);
}

.commons-badge--good {
    background: #ecfdf3;
    border-color: #a3e4bc;
}

.commons-badge--good em {
    background: var(--commons-success);
    color: #fff;
}

.commons-badge--partial {
    background: #fef9e7;
    border-color: #f0d58c;
}

.commons-badge--partial em {
    background: var(--commons-warning);
    color: #fff;
}

.commons-badge--empty em {
    background: var(--commons-danger);
    color: #fff;
}

/* Submissions */
.commons-recog-entries {
    background: var(--commons-card);
    border: 1px solid var(--commons-border);
    border-radius: var(--commons-radius);
    padding: 24px;
    margin-bottom: 24px;
}

.commons-recog-entries h3 {
    font-size: 16px;
    margin: 0 0 12px;
}

/* Form */
.commons-recog-form-wrap {
    background: var(--commons-card);
    border: 1px solid var(--commons-border);
    border-radius: var(--commons-radius);
    padding: 24px;
    margin-bottom: 32px;
}

.commons-recog-form-wrap h3 {
    font-size: 16px;
    margin: 0 0 16px;
}

.commons-field {
    margin-bottom: 16px;
}

.commons-field label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--commons-text);
}

.commons-field select,
.commons-field textarea,
.commons-field input[type="text"],
.commons-field input[type="email"],
.commons-field input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--commons-border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
}

.commons-field textarea {
    resize: vertical;
}

.commons-submitter {
    font-size: 14px;
    color: var(--commons-muted);
    font-style: italic;
}

.commons-form-actions {
    display: flex;
    gap: 8px;
}

.commons-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.commons-btn-primary {
    background: var(--commons-primary);
    color: #fff;
}

.commons-btn-primary:hover {
    background: var(--commons-primary-dark);
}

.commons-btn-secondary {
    background: transparent;
    color: var(--commons-muted);
    border: 1px solid var(--commons-border);
}

.commons-btn-secondary:hover {
    background: var(--commons-bg);
}

.commons-msg {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
}

.commons-msg.success {
    background: #ecfdf3;
    color: var(--commons-success);
    border: 1px solid #a3e4bc;
}

.commons-msg.error {
    background: #fce4e4;
    color: var(--commons-danger);
    border: 1px solid #f0a8a8;
}

/* Grouped entries */
.commons-recog-entries h3 {
    font-size: 16px;
    margin: 0 0 12px;
}

.commons-empty {
    color: var(--commons-muted);
    font-style: italic;
}

.commons-recog-group {
    border: 1px solid var(--commons-border);
    border-radius: var(--commons-radius);
    margin-bottom: 8px;
    overflow: hidden;
}

button.commons-recog-toggle,
body[data-button-style^="rounded"] button.commons-recog-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--commons-card);
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 15px;
    text-align: left;
}

.commons-recog-toggle:hover {
    background: var(--commons-bg);
}

.commons-recog-name {
    font-weight: 600;
    flex: 1;
}

.commons-recog-count {
    background: var(--commons-primary);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 10px;
    padding: 2px 9px;
}

.commons-recog-arrow {
    font-size: 11px;
    color: var(--commons-muted);
    transition: transform 0.2s;
}

.commons-recog-group.open .commons-recog-arrow {
    transform: rotate(180deg);
}

.commons-recog-items {
    display: none;
    padding: 0 16px 12px;
}

.commons-recog-group.open .commons-recog-items {
    display: block;
}

.commons-recog-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--commons-bg);
}

.commons-recog-item:last-child {
    border-bottom: none;
}

.commons-recog-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--commons-text);
}

.commons-recog-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
    font-size: 12px;
    color: var(--commons-muted);
}

.commons-recog-actions a {
    font-size: 12px;
    text-decoration: none;
    margin-left: 4px;
}

.commons-recog-actions .commons-edit-entry {
    color: var(--commons-primary);
}

.commons-recog-actions .commons-delete-entry {
    color: var(--commons-danger);
}

/* ── Family Page ──────────────────────────────────────────── */

.commons-family {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

.commons-family-header {
    margin-bottom: 24px;
}

.commons-family-header h2 {
    font-size: 22px;
    margin: 0 0 6px;
}

.commons-family-section {
    background: var(--commons-card);
    border: 1px solid var(--commons-border);
    border-radius: var(--commons-radius);
    padding: 24px;
    margin-bottom: 24px;
}

.commons-family-section h3 {
    font-size: 16px;
    margin: 0 0 16px;
}

.commons-family-member {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--commons-bg);
}

.commons-family-member:last-child {
    border-bottom: none;
}

.commons-family-member-name {
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.commons-family-member-email {
    font-size: 13px;
    color: var(--commons-muted);
}

.commons-badge-primary {
    background: var(--commons-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.commons-invite-spouse,
.commons-add-child {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--commons-border);
}

.commons-invite-spouse h4,
.commons-add-child h4 {
    font-size: 14px;
    margin: 0 0 4px;
}

.commons-muted-text {
    font-size: 13px;
    color: var(--commons-muted);
    margin: 0 0 12px;
}

.commons-inline-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    align-items: end;
}

.commons-inline-form .commons-btn {
    align-self: end;
    white-space: nowrap;
}

.commons-family-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--commons-bg);
}

.commons-family-child:last-child {
    border-bottom: none;
}

.commons-child-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.commons-child-name {
    font-weight: 600;
    font-size: 15px;
}

.commons-child-bday {
    font-size: 13px;
    color: var(--commons-muted);
}

.commons-btn-sm {
    padding: 5px 12px;
    border: 1px solid var(--commons-border);
    border-radius: 6px;
    background: transparent;
    font-size: 12px;
    font-family: inherit;
    cursor: pointer;
    color: var(--commons-primary);
}

.commons-btn-sm:hover {
    background: var(--commons-bg);
}

.commons-empty-state {
    background: var(--commons-card);
    border: 1px solid var(--commons-border);
    border-radius: var(--commons-radius);
    padding: 32px;
    text-align: center;
    color: var(--commons-muted);
}

/* Overlay / Modal */
.commons-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.commons-modal {
    background: var(--commons-card);
    border-radius: var(--commons-radius);
    padding: 28px 32px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.commons-modal h3 {
    margin: 0 0 16px;
    font-size: 18px;
}

.commons-modal-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 600px) {
    .commons-dash-grid {
        grid-template-columns: 1fr;
    }

    .commons-login-box {
        padding: 24px 20px;
    }

    .commons-inline-form {
        grid-template-columns: 1fr;
    }

    .commons-family-member {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .commons-modal {
        margin: 16px;
    }
}
