@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&display=swap');

/* === RESET & BASE === */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --accent: #2563eb;
    --accent-strong: #1d4ed8;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --radius: 12px;
    --shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

body {
    font-family: "Space Grotesk", "Segoe UI", system-ui, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    font-size: 15px;
}

/* === LAYOUT === */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    background-color: #ffffff;
    min-height: 100vh;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.main-content {
    padding-top: 96px; /* Space for fixed nav */
}

.main-content.no-progress {
    padding-top: 96px;
}

/* === NAVIGATION === */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: var(--surface);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    box-shadow: var(--shadow);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
}

.nav-date {
    font-size: 1rem;
    color: var(--text);
    font-weight: 600;
    display: block;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--text);
}

.nav-link.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* === HAMBURGER MENU === */
.nav-hamburger {
    display: none;
    flex-direction: column;
    gap: 3px;
    cursor: pointer;
    padding: 0.75rem;
    position: relative;
    width: 44px;
    height: 44px;
    justify-content: center;
    align-items: center;
}

.nav-hamburger span {
    width: 20px;
    height: 2px;
    background-color: #374151;
    transition: all 0.3s ease;
    transform-origin: center;
    position: absolute;
}

/* === USER MENU === */
.nav-user {
    position: relative;
}

.user-menu {
    position: relative;
}

.user-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: none;
    border: 1px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text);
    transition: all 0.2s ease;
}

.user-toggle:hover {
    background-color: var(--surface-muted);
    border-color: var(--border);
}

.user-name {
    font-weight: 500;
}

.user-icon {
    transition: transform 0.2s ease;
}

.user-toggle[aria-expanded="true"] .user-icon {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 280px;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    margin-top: 0.25rem;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-section {
    padding: 1rem;
}

.dropdown-section h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.dropdown-divider {
    height: 1px;
    background-color: #e5e7eb;
    margin: 0.5rem 0;
}

.dropdown-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #374151;
    text-decoration: none;
    font-size: 0.875rem;
    transition: background-color 0.2s ease;
}

.dropdown-link:hover {
    background-color: #f3f4f6;
}

.test-date-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background-color: #fffbeb;
    border-radius: 0.25rem;
}

.test-date-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-text {
    background: none;
    border: none;
    color: #3b82f6;
    font-size: 0.75rem;
    cursor: pointer;
    text-decoration: underline;
}

.btn-text:hover {
    color: #2563eb;
}

.form-input-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.25rem;
    flex: 1;
}

.btn-full {
    width: 100%;
    justify-content: center;
}

.reset-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.logout-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #dc2626 !important;
    font-weight: 500;
}

.logout-link:hover {
    background-color: #fef2f2;
}

/* === PROGRESS BAR === */
.progress-bar {
    background-color: #f9fafb;
    border-top: 1px solid #e5e7eb;
    padding: 1rem 0;
}

.progress-steps {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

.progress-step-number {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 600;
    background-color: #e5e7eb;
    color: #6b7280;
    transition: all 0.3s ease;
}

.progress-step.active .progress-step-number {
    background-color: #3b82f6;
    color: #ffffff;
}

.progress-step.completed .progress-step-number {
    background-color: #10b981;
    color: #ffffff;
}

.progress-step-title {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.5rem;
    text-align: center;
}

.progress-step.active .progress-step-title {
    color: #3b82f6;
    font-weight: 500;
}

.progress-step.completed .progress-step-title {
    color: #10b981;
    font-weight: 500;
}

.progress-connector {
    flex: 1;
    height: 2px;
    background-color: #e5e7eb;
    margin: 0 1rem;
    min-width: 3rem;
}

.progress-step.completed + .progress-connector {
    background-color: #10b981;
}

/* === STEP CONTAINER === */
.step-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 2rem 3.5rem;
}

.step-header {
    text-align: left;
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.step-header h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.35rem;
    letter-spacing: -0.01em;
}

.step-description {
    color: var(--text-muted);
    font-size: 1rem;
}

.step-content {
    margin-bottom: 2.5rem;
}

.step-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.btn-large {
    padding: 0.75rem 2rem;
    font-size: 1rem;
}

.btn-icon {
    margin-left: 0.5rem;
}

.btn-outline .btn-icon {
    margin-left: 0;
    margin-right: 0.5rem;
}

/* === STEP-SPECIFIC STYLES === */

/* Selection Form */
.selection-form {
    background-color: var(--surface);
    padding: 1.75rem 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    width: 100%;
}

.form-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(260px, 1fr);
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    align-items: stretch;
}

.form-input-large {
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.form-input-full {
    width: 100%;
}

.form-help {
    color: #6b7280;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

.checkbox-large {
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background-color: var(--surface);
    cursor: pointer;
    transition: all 0.2s ease;
    height: 100%;
}

.checkbox-large:hover {
    border-color: var(--border);
    background-color: var(--surface-muted);
}

.checkbox-large input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.75rem;
}

.checkbox-text {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.checkbox-text strong {
    color: #111827;
    font-size: 0.875rem;
}

.checkbox-text small {
    color: #6b7280;
    font-size: 0.75rem;
}

/* Selection Preview */
.selection-preview {
    margin-top: 2rem;
    padding: 1.5rem;
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 0.5rem;
}

.selection-preview h3 {
    color: #166534;
    font-size: 1rem;
    margin-bottom: 1rem;
}

.copy-ids-actions {
    margin-top: 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: flex-start;
}

.selected-children-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}

.selected-child-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background-color: #dcfce7;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

.selected-child-item.priority {
    background-color: #fed7aa;
    border: 1px solid #fb923c;
}

.priority-badge {
    font-size: 0.65rem;
    background-color: #ea580c;
    color: #ffffff;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Adjustment Summary */
.selection-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0 1.75rem;
    padding: 1.25rem;
    background-color: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.summary-item {
    text-align: left;
}

.summary-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.summary-value {
    display: block;
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-top: 0.25rem;
}

/* Finalization Styles */
.finalization-summary {
    margin-bottom: 2rem;
}

.summary-card {
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    padding: 2rem;
    text-align: center;
}

.summary-card h3 {
    font-size: 1.25rem;
    color: #111827;
    margin-bottom: 1.5rem;
}

.summary-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
}

.stat-item {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: #3b82f6;
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

.final-children-lists {
    display: grid;
    gap: 2rem;
    margin-bottom: 2rem;
}

.children-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
}

.final-children-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 0.75rem;
}

.final-child-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: #ffffff;
}

.final-child-item.selected {
    background-color: #f0fdf4;
    border-color: #22c55e;
}

.final-child-item.priority {
    background-color: #fff7ed;
    border-color: #fb923c;
}

.final-child-item.absent {
    background-color: #fef2f2;
    border-color: #fecaca;
    opacity: 0.7;
}

.final-child-item.not-selected {
    background-color: #fffbeb;
    border-color: #fed7aa;
    opacity: 0.8;
}

.skip-indicators {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.finalize-actions {
    background-color: #f9fafb;
    padding: 2rem;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.copy-ids-actions .btn {
    min-width: 200px;
}

.confirm-section {
    margin-bottom: 1.5rem;
    text-align: center;
}

.finalize-form .checkbox-label {
    justify-content: center;
    font-size: 0.875rem;
    gap: 0.75rem;
}

.finalize-form .checkbox-label input[type="checkbox"] {
    width: 1.25rem;
    height: 1.25rem;
}

#finalize-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#finalize-btn:disabled:hover {
    background-color: #10b981;
    transform: none;
}

/* === LOGIN PAGE === */
.login-container {
    max-width: 400px;
    margin: 10rem auto;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.login-container h1 {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 2rem;
}

.login-container form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-container label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.login-container input {
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease;
}

.login-container input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.login-container button {
    padding: 0.75rem;
    background-color: #3b82f6;
    color: #ffffff;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease;
    margin-top: 1rem;
}

.login-container button:hover {
    background-color: #2563eb;
}

.setup-info {
    padding: 1rem;
    background-color: #fffbeb;
    border: 1px solid #fed7aa;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: #92400e;
    margin-bottom: 1.5rem;
}

.flashes {
    list-style: none;
    padding: 0;
    margin-bottom: 1.5rem;
}

.flashes li {
    padding: 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.flashes .success {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.flashes .danger {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.flashes .info {
    background-color: #cff4fc;
    color: #055160;
    border: 1px solid #b6effb;
}

/* === ARCHIVE PAGE === */
.archive-layout {
    display: flex;
    height: calc(100vh - 160px);
    gap: 0;
    background-color: #ffffff;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.archive-sidebar {
    width: 300px;
    background-color: #f9fafb;
    border-right: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #ffffff;
}

.sidebar-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.25rem;
}

.sidebar-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.archive-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.archive-item {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.archive-item:hover {
    background-color: #ffffff;
    border-color: #e5e7eb;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.archive-item.active {
    background-color: #3b82f6;
    color: #ffffff;
    border-color: #3b82f6;
    box-shadow: 0 1px 3px rgba(59, 130, 246, 0.2);
}

.archive-date {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

.archive-summary {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.summary-stat {
    font-size: 0.75rem;
    opacity: 0.8;
}

.archive-item.active .summary-stat {
    opacity: 0.9;
}

.sidebar-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
    font-size: 0.875rem;
}

.archive-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.archive-viewer {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
}

.no-selection-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 50vh;
    text-align: center;
    color: #6b7280;
}

.no-selection-message h3 {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #374151;
}

.archive-entry-detail {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.entry-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.entry-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1rem;
}

.entry-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.rotation-info {
    font-size: 0.75rem;
    color: #6b7280;
}

.rotation-detail {
    font-family: monospace;
    background-color: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

/* Legacy styles for compatibility */
.archive-entry {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background-color: #ffffff;
}

.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.archive-meta h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.archive-stats {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.stat-item {
    padding: 0.25rem 0.75rem;
    background-color: #f3f4f6;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #374151;
}

.archive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.category-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.child-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.archive-entry .child-item {
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.skip-reasons {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.skip-marker {
    font-size: 0.875rem;
    opacity: 0.8;
    cursor: help;
}

.nest-skip {
    filter: sepia(1) saturate(2) hue-rotate(25deg);
}

.sibling-skip {
    filter: sepia(1) saturate(2) hue-rotate(200deg);
}

.child-item.present {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.child-item.absent {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.child-item.not-selected {
    background-color: #fffbeb;
    border: 1px solid #fed7aa;
    color: #92400e;
}

.child-item.priority {
    border-left: 4px solid #f59e0b;
    background-color: #fff7ed;
}

.child-item.nest-excluded {
    border-left: 4px solid #6b7280;
}

.priority-indicator,
.nest-indicator {
    font-size: 0.65rem;
    background-color: #374151;
    color: #ffffff;
    padding: 0.125rem 0.375rem;
    border-radius: 9999px;
    font-weight: 600;
}

.priority-indicator {
    background-color: #f59e0b;
}

.nest-indicator {
    background-color: #6b7280;
}

.empty-message {
    color: #6b7280;
    font-style: italic;
    font-size: 0.875rem;
}

.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

/* === PUBLIC VIEW === */
.public-container {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: #ffffff;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.public-header {
    position: relative;
}

.public-login-btn {
    position: absolute;
    top: 0;
    right: 0;
}

.public-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #10b981;
    margin-bottom: 0.5rem;
}

.public-date {
    font-size: 1rem;
    color: #6b7280;
    margin-bottom: 2rem;
}

.public-stats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.child-count {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #f0fdf4;
    color: #166534;
    border-radius: 0.375rem;
    font-weight: 500;
    border: 1px solid #bbf7d0;
}

.whatsapp-copy-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: #25d366;
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* === ARCHIVE STATUS MODAL === */
.archive-status-modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 50;
}

.archive-status-modal.is-open {
    display: flex;
}

.archive-status-modal .modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
}

.archive-status-modal .modal-panel {
    position: relative;
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1rem 1.25rem;
    width: min(360px, 90vw);
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.2);
    z-index: 1;
}

.archive-status-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.archive-status-modal .modal-close {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: #334155;
}

.archive-status-modal .modal-child-name {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 0.75rem;
}

.archive-edit-badge {
    display: inline-flex;
    margin-top: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 0.7rem;
    font-weight: 600;
}

.archive-edit-note {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: #9a3412;
}

.archive-history {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-item {
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    padding: 0.75rem;
    background: #ffffff;
}

.history-main {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: #0f172a;
    align-items: center;
}

.history-time {
    color: #64748b;
}

.history-change {
    font-weight: 600;
}

.history-meta {
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #475569;
}

.history-reason {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
}

.archive-status-modal .modal-current-status {
    font-size: 0.8rem;
    color: #64748b;
}

.archive-status-modal .modal-reason label {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-bottom: 0.25rem;
}

.archive-status-modal .modal-reason textarea {
    width: 100%;
    resize: vertical;
    padding: 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.85rem;
}

.archive-status-modal .modal-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* === PRINT LAYOUT (A4) === */
@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    body {
        background: #ffffff;
    }

    .main-nav,
    .archive-sidebar,
    .user-menu,
    .nav-menu,
    .nav-user,
    .archive-edit-badge,
    .archive-edit-note,
    .archive-history,
    .archive-status-modal,
    .qr-page-actions,
    .btn,
    .whatsapp-copy-btn,
    #toast-container {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
        margin: 0 !important;
    }

    .qr-page {
        max-width: none !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .qr-page-header {
        margin-bottom: 8mm !important;
    }

    .qr-sheet {
        display: flex !important;
        flex-wrap: wrap;
        align-items: flex-start;
        justify-content: space-between;
        width: 100% !important;
        margin: 0 !important;
        gap: 4mm;
    }

    .qr-print-card {
        width: 31% !important;
        max-width: 31% !important;
        min-width: 31% !important;
        padding: 4mm;
        border-width: 1px;
        border-radius: 10px;
        box-sizing: border-box;
    }

    .qr-card-header h2 {
        font-size: 10.5pt;
        line-height: 1.2;
        margin-bottom: 1.5mm;
    }

    .qr-card-ids {
        font-size: 8.5pt;
    }

    .qr-card-body {
        gap: 3mm;
        margin-top: 3mm;
        align-items: flex-start;
        flex-direction: column;
    }

    .qr-code-image {
        width: 32mm;
        height: 32mm;
        padding: 1.5mm;
        border-radius: 6px;
    }

    .qr-card-label {
        font-size: 7.5pt;
    }

    .qr-card-note {
        margin-top: 1.5mm;
        font-size: 8pt;
        line-height: 1.3;
    }

    .archive-layout {
        display: block;
    }

    .archive-content {
        width: 100%;
    }

    .archive-entry-detail {
        display: none !important;
        page-break-inside: avoid !important;
        page-break-before: avoid !important;
        break-before: avoid !important;
    }

    .archive-entry-detail.active {
        display: block !important;
    }

    .entry-header {
        border-bottom: 1px solid #e2e8f0;
        padding-bottom: 0.25rem;
        margin-bottom: 0.4rem;
    }

    .entry-header h1 {
        font-size: 0.9rem;
        margin: 0 0 0.15rem 0;
    }

    .entry-stats,
    .rotation-info {
        display: none !important;
    }

    .archive-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.2rem !important;
    }

    .category-section h4 {
        font-size: 0.7rem;
        margin: 0 0 0.2rem 0;
        padding-bottom: 0.1rem;
        border-bottom: 1px solid #e2e8f0;
    }

    .child-grid {
        column-count: 1 !important;
    }

    .child-item {
        display: block !important;
        font-size: 0.6rem !important;
        line-height: 1.05 !important;
        padding: 0 !important;
        margin: 0 0 0.08rem 0 !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        gap: 0 !important;
        page-break-inside: avoid !important;
    }

    .child-item .child-info-left {
        display: inline !important;
        font-size: 0.6rem !important;
    }

    .child-item .child-id-prefix {
        font-weight: 600 !important;
        margin-right: 0.2rem !important;
    }

    .priority-indicator,
    .skip-reasons,
    .child-status,
    .child-actions,
    .status-badge,
    .toggle-group,
    .toggle-seg {
        display: none !important;
    }
}

.whatsapp-copy-btn:hover {
    background-color: #22c55e;
    transform: translateY(-1px);
}

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

.whatsapp-icon {
    flex-shrink: 0;
}

.public-children-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.public-child-item {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
}

.public-child-item .child-id {
    font-weight: 600;
    font-size: 1.125rem;
    color: #111827;
    font-family: monospace;
}

/* Small ID displays for debugging */
.child-id-small {
    font-size: 0.75rem;
    color: #6b7280;
    font-family: monospace;
    font-weight: normal;
    margin-left: 0.5rem;
}

.child-id {
    font-size: 0.875rem;
    color: #6b7280;
    font-family: monospace;
    font-weight: 500;
}

.child-id-prefix {
    font-size: 0.75rem;
    color: #6b7280;
    font-family: monospace;
    font-weight: 600;
    margin-right: 0.5rem;
}

.child-info-left {
    display: flex;
    align-items: center;
    flex: 1;
}

.public-empty-state {
    padding: 3rem 1rem;
}

.public-empty-state p {
    font-size: 1.125rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.public-empty-state small {
    color: #9ca3af;
}

/* === TYPOGRAPHY === */
.page-header {
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.page-header h1 {
    font-size: 2rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: #6b7280;
    font-size: 1rem;
}

/* === WORKFLOW SECTIONS === */
.workflow-section {
    margin-bottom: 3rem;
}

.section-header {
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.5rem;
}

.section-description {
    color: #6b7280;
    font-size: 0.875rem;
}

/* === CHILDREN LIST === */
.children-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.child-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    background-color: var(--surface);
    transition: all 0.2s ease;
}

.child-item:hover {
    border-color: #cbd5e1;
    background-color: var(--surface-muted);
}

.child-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.child-name {
    font-weight: 500;
    color: var(--text);
    font-size: 0.95rem;
}

.child-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.child-status {
    flex-shrink: 0;
}

/* === CHILD STATES === */
.child-absent {
    opacity: 0.6;
    background-color: #fef2f2;
    border-color: #fecaca;
}

.child-absent:hover {
    background-color: #fef2f2;
    border-color: #f87171;
}

.child-excluded {
    opacity: 0.5;
    background-color: #f3f4f6;
    border-color: #d1d5db;
}

.child-selected {
    background-color: #f0fdf4;
    border-color: #22c55e;
}

.child-selected:hover {
    background-color: #ecfdf5;
    border-color: #16a34a;
}

.child-priority {
    background-color: #fff7ed;
    border-color: #fb923c;
}

.child-priority:hover {
    background-color: #fef3c7;
    border-color: #f59e0b;
}

.child-available {
    cursor: default;
}

.child-reduced {
    background-color: #f8fafc;
    border-color: #e2e8f0;
}

.child-reduced:hover {
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

/* Only selected children are clickable in selection grid */
#selection-grid .child-selected {
    cursor: pointer;
}

#absence-grid .child-item {
    cursor: pointer;
}

.child-freed {
    border: 2px dashed #f59e0b;
    background-color: #fffbeb;
}

/* === STATUS BADGES === */
.status-badge {
    display: inline-block;
    padding: 0.3rem 0.85rem;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.status-available {
    background-color: #f3f4f6;
    color: #6b7280;
}

.status-absent {
    background-color: #fee2e2;
    color: #dc2626;
}

.status-excluded {
    background-color: #f3f4f6;
    color: #6b7280;
}

.status-selected {
    background-color: #dcfce7;
    color: #16a34a;
}

.status-priority {
    background-color: #fed7aa;
    color: #ea580c;
}

.status-freed {
    background-color: #fef3c7;
    color: #b45309;
}

.status-reduced {
    background-color: #e2e8f0;
    color: #475569;
}

.child-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-left: 1rem;
}

.child-actions .btn {
    min-width: 108px;
    justify-content: center;
}

/* legacy btn-active styling now handled by .toggle-btn */

/* Align status chips in the single-page overview list */
#overview-grid .child-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    column-gap: 1rem;
}

#overview-grid .child-status {
    justify-self: end;
}

#overview-grid .child-actions {
    justify-self: end;
    margin-left: 0;
}

.toggle-group {
    display: inline-flex;
    align-items: center;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    overflow: hidden;
    background-color: #ffffff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.06);
}

.toggle-seg {
    appearance: none;
    background: transparent;
    border: none;
    padding: 0.35rem 0.9rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #0f172a;
    cursor: pointer;
    min-width: 112px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.toggle-seg + .toggle-seg {
    border-left: 1px solid #e2e8f0;
}

.toggle-seg:hover {
    background-color: #f8fafc;
}

.toggle-seg:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.toggle-seg.is-active {
    color: #ffffff;
}

.toggle-seg.is-active.is-absent {
    background-color: #dc2626;
}

.toggle-seg.is-active.is-freed {
    background-color: #16a34a;
}

#overview-grid .status-badge {
    background-color: #eef2f7;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
}

#overview-grid .status-absent {
    background-color: #fee2e2;
    color: #b91c1c;
}

#overview-grid .status-selected {
    background-color: #e8fbe9;
    color: #15803d;
}

#overview-grid .status-priority {
    background-color: #fff1e1;
    color: #c2410c;
}

#overview-grid .status-freed {
    background-color: #fff7d6;
    color: #a16207;
}

#overview-grid .status-reduced {
    background-color: #eef2f7;
    color: #64748b;
}
.rotation-note {
    margin: 1rem 0 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    background-color: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.5rem 1rem 0.6rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: flex-start;
}

.rotation-note-warning {
    color: #b91c1c;
    font-weight: 600;
}

/* === FORMS === */
.form-row {
    display: flex;
    align-items: end;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
}

.form-input {
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    background-color: #ffffff;
    transition: border-color 0.2s ease;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
}

.form-actions-row {
    display: flex;
    align-items: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
}


/* === WARNING BANNER === */
.warning-banner {
    background-color: #fff7ed;
    border: 1px solid #fed7aa;
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
}

.warning-content {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.warning-icon {
    color: #c2410c;
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.warning-text {
    color: #7c2d12;
    font-size: 0.875rem;
    line-height: 1.5;
}

.warning-text strong {
    font-weight: 600;
}

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-small {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-strong);
}

.btn-secondary {
    background-color: #475569;
    color: #ffffff;
}

.btn-secondary:hover {
    background-color: #334155;
}

.btn-success {
    background-color: var(--success);
    color: #ffffff;
}

.btn-success:hover {
    background-color: #15803d;
}

.btn-danger {
    background-color: #ef4444;
    color: #ffffff;
}

.btn-danger:hover {
    background-color: #dc2626;
}

.btn-warning {
    background-color: #f59e0b;
    color: #1f2937;
}

.btn-warning:hover {
    background-color: #eab308;
}

.btn-outline {
    background-color: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-outline:hover {
    background-color: var(--surface-muted);
    border-color: var(--border);
}

/* === SECTION ACTIONS === */
.section-actions {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

/* === PLACEHOLDER === */
.placeholder-message {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.placeholder-message p {
    font-size: 1rem;
}

/* === FOOTER === */
.page-footer {
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid #e5e7eb;
}

.footer-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.action-group {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

/* === ADMIN TOOLS === */
.admin-tools {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.admin-tools-toggle {
    padding: 0.75rem 1rem;
    background-color: #f9fafb;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
    border-bottom: 1px solid #e5e7eb;
}

.admin-tools-toggle:hover {
    background-color: #f3f4f6;
}

.admin-tools-content {
    padding: 1rem;
    background-color: #ffffff;
}

.test-date-info {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #fffbeb;
    border-radius: 0.375rem;
    border: 1px solid #fed7aa;
}

.test-date-info p {
    font-size: 0.875rem;
    color: #92400e;
    margin-bottom: 0.5rem;
}

.test-date-form {
    display: flex;
    gap: 1rem;
    align-items: end;
}

/* === TOAST NOTIFICATIONS === */
#toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 20rem;
}

.toast {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #ffffff;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    animation: slideIn 0.3s ease-out, fadeOut 0.3s 4.7s ease-out forwards;
}

.toast.info {
    background-color: #3b82f6;
}

.toast.success {
    background-color: #10b981;
}

.toast.warning {
    background-color: #f59e0b;
    color: #92400e;
}

.toast.error {
    background-color: #ef4444;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .form-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .footer-actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-group {
        justify-content: center;
    }
    
    .test-date-form {
        flex-direction: column;
        align-items: stretch;
    }
}

/* === MODAL STYLES (for child management) === */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #ffffff;
    margin: auto;
    padding: 2rem;
    border-radius: 0.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close-button {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #6b7280;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0.25rem;
}

.close-button:hover {
    color: #374151;
}

/* === MANAGEMENT PAGE === */
.management-section {
    margin-bottom: 3rem;
    padding: 1.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background-color: #ffffff;
}

.management-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.admin-manage-page {
    max-width: 1320px;
    padding-bottom: 3rem;
}

.manage-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1.5rem;
    padding: 2rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(37, 99, 235, 0.12);
    border-radius: 28px;
    background:
        radial-gradient(circle at top right, rgba(37, 99, 235, 0.10), transparent 32%),
        linear-gradient(135deg, #ffffff 0%, #f8fbff 48%, #eef5ff 100%);
    box-shadow: 0 24px 44px rgba(15, 23, 42, 0.08);
}

.manage-kicker {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.7rem;
    margin-bottom: 0.9rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.manage-header-copy h1 {
    font-size: clamp(2rem, 3vw, 2.8rem);
    line-height: 1.05;
    margin-bottom: 0.75rem;
}

.manage-header-copy .page-subtitle {
    max-width: 720px;
    font-size: 1rem;
    color: var(--text-muted);
}

.manage-overview-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.manage-overview-card {
    padding: 1.25rem 1.4rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.05);
}

.manage-overview-label {
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.manage-overview-value {
    display: block;
    font-size: 2rem;
    line-height: 1;
    color: var(--text);
}

.manage-overview-note {
    margin-top: 0.6rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.management-section {
    border-radius: 26px;
    border-color: rgba(148, 163, 184, 0.24);
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.04);
}

.management-section-heading {
    margin-bottom: 1.25rem;
}

.management-section h2 {
    border-bottom: none;
    margin-bottom: 0.35rem;
    padding-bottom: 0;
}

.management-section .page-subtitle {
    color: var(--text-muted);
}

.management-section-intake {
    background:
        radial-gradient(circle at bottom left, rgba(22, 163, 74, 0.08), transparent 30%),
        linear-gradient(180deg, #ffffff 0%, #fbfefc 100%);
}

.add-child-form-polished {
    grid-template-columns: 1.2fr 1.2fr 1fr auto;
    gap: 1rem;
}

.add-child-form-polished label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
}

.add-child-submit {
    display: flex;
    align-items: flex-end;
}

.add-child-submit .btn {
    width: 100%;
    min-height: 46px;
}

.management-section-families {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.family-group-list {
    gap: 1.25rem;
}

.family-group-box {
    padding: 1.25rem;
    border: 1px solid rgba(148, 163, 184, 0.28);
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 250, 252, 0.98) 100%);
    box-shadow: 0 14px 28px rgba(15, 23, 42, 0.05);
}

.family-heading {
    min-width: 0;
}

.family-name {
    font-size: 1.15rem;
    line-height: 1.2;
    margin-bottom: 0.45rem;
}

.family-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    font-size: 0.84rem;
}

.family-meta span {
    display: inline-flex;
    align-items: center;
    padding: 0.28rem 0.6rem;
    border-radius: 999px;
    background: rgba(226, 232, 240, 0.7);
    color: #475569;
}

.family-actions {
    justify-content: flex-end;
}

.family-link-panel {
    margin-top: 1rem;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.88);
}

.family-link-panel-label {
    margin-bottom: 0.55rem;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.family-link-row {
    margin-top: 0;
}

.family-link-input {
    background: #f8fafc;
    border-color: rgba(148, 163, 184, 0.32);
    color: #334155;
    font-size: 0.88rem;
}

.family-child-list {
    margin-top: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 20px;
    overflow: hidden;
}

.family-child-item {
    padding: 1.05rem 1.15rem;
    background: rgba(255, 255, 255, 0.72);
}

.family-child-item:nth-child(even) {
    background: rgba(248, 250, 252, 0.92);
}

.child-name-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.child-id-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 700;
}

.child-name {
    font-size: 1rem;
    font-weight: 700;
}

.child-group,
.child-siblings {
    color: #64748b;
}

.child-actions {
    align-items: flex-start;
}

.manage-empty-state {
    padding: 2rem;
    border: 1px dashed rgba(148, 163, 184, 0.4);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.manage-empty-state h3 {
    margin-bottom: 0.5rem;
}

/* Child management specific styles */
.add-child-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

.add-child-form .form-group:last-child {
    display: flex;
    align-items: end;
}

.child-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #e5e7eb;
}

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

.child-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.child-name {
    font-weight: 500;
    font-size: 1rem;
    color: #111827;
}

.child-group,
.child-siblings {
    font-size: 0.875rem;
    color: #6b7280;
}

/* === MOBILE RESPONSIVE === */
@media (max-width: 768px) {
    /* Show hamburger menu on mobile */
    .nav-hamburger {
        display: flex !important;
    }
    
    /* Navigation - Hamburger Menu */
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: #ffffff;
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        flex-direction: column;
        gap: 0;
        padding: 1rem 0;
        z-index: 999;
    }
    
    .nav-menu.active {
        display: flex;
    }
    
    .nav-link {
        padding: 0.75rem 2rem;
        border-bottom: none;
        border-left: 3px solid transparent;
    }
    
    .nav-link.active {
        border-left-color: #3b82f6;
        border-bottom: none;
        background-color: #f8fafc;
    }
    
    .nav-hamburger {
        display: flex;
        flex-direction: column;
        gap: 3px;
        cursor: pointer;
        padding: 0.5rem;
    }
    
    .nav-hamburger span {
        width: 20px;
        height: 2px;
        background-color: #374151;
        transition: all 0.3s ease;
    }
    
    .nav-hamburger span:nth-child(1) {
        top: calc(50% - 5px);
    }
    
    .nav-hamburger span:nth-child(2) {
        top: 50%;
        transform: translateY(-50%);
    }
    
    .nav-hamburger span:nth-child(3) {
        top: calc(50% + 3px);
    }
    
    .nav-hamburger.active span:nth-child(1) {
        transform: rotate(45deg);
        top: 50%;
    }
    
    .nav-hamburger.active span:nth-child(2) {
        opacity: 0;
    }
    
    .nav-hamburger.active span:nth-child(3) {
        transform: rotate(-45deg);
        top: 50%;
    }
    
    /* Progress Bar - Mobile */
    .progress-bar {
        padding: 0.75rem 1rem;
    }
    
    .progress-steps {
        gap: 0.5rem;
    }
    
    .progress-step {
        min-width: auto;
        flex: 1;
        padding: 0.5rem;
        font-size: 0.75rem;
    }
    
    .progress-step-title {
        display: none;
    }
    
    .progress-step-number {
        font-size: 0.875rem;
    }
    
    /* Container and Layout */
    .container {
        padding: 1rem;
        margin: 0;
        max-width: 100%;
    }
    
    .main-content {
        padding-top: 140px; /* Adjusted for mobile nav height */
    }
    
    .main-content.no-progress {
        padding-top: 80px;
    }
    
    /* Navigation Container */
    .nav-container {
        padding: 1rem;
        position: relative;
        display: grid;
        grid-template-columns: 44px 1fr 44px;
        align-items: center;
    }
    
    .nav-brand {
        justify-self: center;
        text-align: center;
    }
    
    .nav-user {
        justify-self: end;
    }
    
    /* Forms and Grids */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .add-child-form {
        grid-template-columns: 1fr;
    }
    
    .selected-children-list,
    .final-children-grid,
    .child-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    /* Archive Layout */
    .archive-layout {
        flex-direction: column;
        height: auto;
    }
    
    .archive-sidebar {
        width: 100%;
        height: auto;
        max-height: 40vh;
        overflow-y: auto;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }
    
    .archive-content {
        width: 100%;
        overflow: visible;
    }
    
    .archive-list {
        display: flex;
        gap: 0.5rem;
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }
    
    .archive-item {
        min-width: 150px;
        flex-shrink: 0;
    }
    
    /* Step Navigation */
    .step-actions {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .step-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    /* Cards and Sections */
    .summary-card {
        padding: 1rem;
    }
    
    .summary-stats {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    }
    
    .stat-item {
        text-align: center;
    }
    
    /* Child Management */
    .child-list-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        padding: 1rem;
    }
    
    .child-actions {
        width: 100%;
        display: flex;
        gap: 0.5rem;
    }
    
    .child-actions .btn {
        flex: 1;
    }
    
    /* Modal */
    .modal-content {
        margin: 1rem;
        width: calc(100% - 2rem);
        max-height: calc(100vh - 2rem);
        overflow-y: auto;
    }
    
    /* Tables and Lists */
    .absence-grid {
        grid-template-columns: 1fr;
    }
    
    .entry-stats {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .stat-item {
        font-size: 0.75rem;
    }
    
    /* Form Inputs */
    .form-input-large {
        font-size: 1rem;
    }
    
    /* Public View */
    .public-container {
        padding: 1rem;
    }
    
    .public-header h1 {
        font-size: 1.5rem;
    }
    
    /* Navigation Date */
    .nav-date {
        font-size: 0.875rem;
    }
    
    /* User Menu */
    .user-dropdown {
        right: 0;
        left: auto;
        min-width: 150px;
    }
    
    /* Finalization Step - Shorter Labels */
    .stat-label {
        font-size: 0.6rem;
        line-height: 1.2;
    }
    
    /* Override long German labels with shorter versions on mobile */
    .stat-item:nth-child(1) .stat-label::after {
        content: "Ausgewählt";
    }
    
    .stat-item:nth-child(2) .stat-label::after {
        content: "Abwesend";
    }
    
    .stat-item:nth-child(3) .stat-label::after {
        content: "Maximum";
    }
    
    .stat-item .stat-label {
        font-size: 0;
    }
    
    .stat-item .stat-label::after {
        font-size: 0.65rem;
        line-height: 1.2;
    }
}

.child-actions {
    display: flex;
    gap: 0.5rem;
}

/* Sibling management in modal */
#sibling-selector-container {
    position: relative;
    margin-top: 0.5rem;
}

#sibling-search-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 0.875rem;
}

#sibling-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    max-height: 150px;
    overflow-y: auto;
    z-index: 1001;
}

.search-result-item {
    padding: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.search-result-item:hover {
    background-color: #f3f4f6;
}

#selected-siblings-container {
    margin-top: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    min-height: 40px;
}

.sibling-pill {
    display: flex;
    align-items: center;
    background-color: #3b82f6;
    color: #ffffff;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.sibling-pill .remove-sibling {
    margin-left: 0.5rem;
    cursor: pointer;
    font-weight: bold;
    line-height: 1;
}

.sibling-pill .remove-sibling:hover {
    color: #dbeafe;
}

.modal-actions {
    margin-top: 1.5rem;
    text-align: right;
}

#edit-child-form label {
    font-weight: 500;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    display: block;
    color: #374151;
}

#edit-child-form input[type="text"] {
    width: 100%;
}

.child-poll-meta {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: var(--warning);
    font-weight: 600;
}

.poll-panel {
    margin: 1.5rem 0;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.poll-panel-header,
.management-section-header,
.poll-card-header,
.poll-panel-actions,
.poll-panel-stats,
.poll-id-groups {
    display: flex;
    gap: 1rem;
}

.poll-panel-header,
.management-section-header,
.poll-card-header {
    justify-content: space-between;
    align-items: flex-start;
}

.poll-panel-subtitle,
.poll-card-subtitle {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.poll-panel-stats {
    margin: 1rem 0;
    flex-wrap: wrap;
}

.poll-id-groups {
    flex-wrap: wrap;
}

.poll-id-group {
    flex: 1 1 280px;
    padding: 1rem;
    background: var(--surface-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.poll-id-group h3,
.poll-id-group h2 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.poll-id-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.poll-id-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    background: #e2e8f0;
    color: var(--text);
    font-weight: 600;
}

.poll-id-chip-free {
    background: #dcfce7;
    color: #166534;
}

.poll-id-chip-own {
    box-shadow: 0 0 0 2px var(--accent);
}

.poll-empty {
    color: var(--text-muted);
}

.poll-id-status-section {
    margin-top: 1.5rem;
}

.poll-id-status-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.poll-id-status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.poll-id-status-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.poll-id-number {
    font-weight: 700;
    color: var(--text);
}

.poll-id-own-label {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 700;
}

.poll-id-state {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.poll-id-state-selected {
    background: #e2e8f0;
    color: var(--text);
}

.poll-id-state-free {
    background: #dcfce7;
    color: #166534;
}

.poll-id-state-inactive {
    background: #f1f5f9;
    color: var(--text-muted);
}

.poll-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.poll-status-open {
    background: #dbeafe;
    color: #1d4ed8;
}

.poll-status-closed {
    background: #fef3c7;
    color: #b45309;
}

.poll-status-applied {
    background: #dcfce7;
    color: #166534;
}

.poll-page {
    max-width: 920px;
    margin: 0 auto;
    padding: 2rem;
}

.poll-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}

.poll-card-error {
    border-color: #fecaca;
}

.poll-response-form {
    margin: 1.25rem 0 1.5rem;
}

.poll-selection-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.poll-selection-title {
    font-weight: 700;
    color: var(--text);
}

.poll-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.poll-toggle-card {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.poll-toggle-card input[type="checkbox"] {
    margin-top: 0.2rem;
    width: 1.1rem;
    height: 1.1rem;
}

.poll-toggle-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.poll-toggle-content small,
.poll-closed-note,
.poll-current-response {
    color: var(--text-muted);
}

.poll-current-response {
    margin-top: 0.75rem;
    font-weight: 600;
}

.poll-form-actions {
    margin-top: 1rem;
}

.poll-empty-state {
    padding: 1rem 0 0;
}

.family-group-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.family-group-box {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.family-group-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.family-name {
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.family-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.family-link-row {
    width: 100%;
    margin-top: 0.9rem;
}

.family-link-input {
    width: 100%;
}

.family-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.qr-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.qr-page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.qr-page-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.qr-sheet {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
}

.qr-print-card {
    padding: 1.25rem;
    border: 2px dashed var(--border);
    border-radius: 18px;
    background: var(--surface);
    break-inside: avoid;
    page-break-inside: avoid;
}

.qr-card-header h2 {
    font-size: 1.1rem;
    margin-bottom: 0.35rem;
}

.qr-card-ids {
    font-size: 0.92rem;
    color: var(--text-muted);
}

.qr-card-body {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

.qr-code-image {
    flex: 0 0 auto;
    width: 140px;
    height: 140px;
    padding: 0.5rem;
    border-radius: 14px;
    background: #ffffff;
    border: 1px solid var(--border);
}

.qr-code-image svg {
    width: 100%;
    height: 100%;
    display: block;
}

.qr-card-meta {
    min-width: 0;
}

.qr-card-label {
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.qr-card-note {
    margin-top: 0.45rem;
    font-size: 0.92rem;
    line-height: 1.5;
    color: var(--text);
}

.family-child-list {
    margin-top: 1rem;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface);
}

.family-child-item {
    background: var(--surface);
}

.management-section-actions,
.poll-panel-actions {
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 768px) {
    .poll-page {
        padding: 1rem;
    }

    .poll-panel-header,
    .management-section-header,
    .poll-card-header,
    .qr-page-header {
        flex-direction: column;
    }

    .poll-id-status-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .qr-card-body {
        align-items: flex-start;
        flex-direction: column;
    }

    .family-group-header {
        flex-direction: column;
    }
}

/* === ADMIN MANAGE PAGE OVERRIDES === */
.admin-manage-page .manage-page-header {
    padding: 0 0 1rem;
    margin-bottom: 1.25rem;
    border: 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.admin-manage-page .manage-header-copy h1 {
    font-size: clamp(2rem, 2.4vw, 2.35rem);
    line-height: 1.02;
    margin-bottom: 0.55rem;
}

.admin-manage-page .manage-header-copy .page-subtitle {
    max-width: 700px;
    font-size: 0.96rem;
    line-height: 1.55;
    color: #526277;
}

.admin-manage-page .management-section {
    margin-bottom: 1.25rem;
    padding: 1rem 0 0;
    border: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
}

.admin-manage-page .management-section h2 {
    border-bottom: none;
    margin-bottom: 0.35rem;
    padding-bottom: 0;
    font-size: 1.05rem;
}

.admin-manage-page .management-section .page-subtitle {
    color: #6b7a8f;
}

.admin-manage-page .management-section-heading {
    margin-bottom: 0.9rem;
}

.admin-manage-page .management-toolbar {
    padding-top: 0;
    border-top: 0;
}

.admin-manage-page .add-child-form-polished {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 1fr auto;
    gap: 0.85rem;
}

.admin-manage-page .add-child-form-polished label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: #334155;
}

.admin-manage-page .add-child-submit {
    display: flex;
    align-items: flex-end;
}

.admin-manage-page .add-child-submit .btn {
    width: auto;
    min-height: 46px;
    padding-inline: 1.25rem;
}

.admin-manage-page .management-toolbar-actions {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.75rem;
    margin-top: 0.85rem;
    overflow-x: auto;
}

.admin-manage-page .family-group-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 0.85rem;
}

.admin-manage-page .family-group-box {
    padding: 0;
    border: 1px solid rgba(100, 116, 139, 0.24);
    border-radius: 16px;
    background: #f8fafc;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
    overflow: hidden;
}

.admin-manage-page .family-card-label {
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #e2e8f0;
}

.admin-manage-page .family-group-header {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr);
    align-items: stretch;
    margin-bottom: 0;
    background: #334155;
}

.admin-manage-page .family-header-id-spacer {
    background: #334155;
}

.admin-manage-page .family-header-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 8.5rem;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 0.9rem;
    background: transparent;
}

.admin-manage-page .family-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.admin-manage-page .family-child-list {
    margin-top: 0;
    border: 0;
    border-radius: 0;
    overflow: visible;
    background: transparent;
}

.admin-manage-page .family-members-list {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.admin-manage-page .family-member-row {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr) 8.5rem;
    align-items: stretch;
}

.admin-manage-page .family-member-row:not(:last-child) {
    border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.admin-manage-page .family-member-id {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.85rem 0.25rem;
    border-right: 1px solid rgba(148, 163, 184, 0.14);
    background: rgba(219, 228, 239, 0.45);
    color: #334155;
    font-size: 0.78rem;
    font-weight: 700;
}

.admin-manage-page .family-member-main {
    min-width: 0;
    padding: 0.8rem 0.9rem;
}

.admin-manage-page .family-member-name {
    font-size: 1rem;
    font-weight: 600;
    color: #0f172a;
    text-align: left;
}

.admin-manage-page .family-member-group {
    margin-top: 0.2rem;
    text-align: left;
    font-size: 0.84rem;
    color: #64748b;
}

.admin-manage-page .family-member-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0.8rem 0.9rem 0.8rem 0;
    border-left: 1px solid rgba(148, 163, 184, 0.14);
}

.admin-manage-page .family-member-actions .btn,
.admin-manage-page .family-group-header .btn {
    min-width: unset;
}

.admin-manage-page .family-action-menu {
    position: relative;
    display: block;
    width: 100%;
    flex: 0 0 auto;
}

.admin-manage-page .family-action-menu summary {
    list-style: none;
    cursor: pointer;
}

.admin-manage-page .family-action-menu > summary.btn {
    width: 100%;
    min-width: 0;
    max-width: none;
    flex: 0 0 auto;
    justify-content: center;
    white-space: nowrap;
    text-wrap: nowrap;
}

.admin-manage-page .family-action-menu summary::-webkit-details-marker {
    display: none;
}

.admin-manage-page .family-action-menu[open] summary {
    background: #eff6ff;
    border-color: rgba(37, 99, 235, 0.28);
    color: var(--accent);
}

.admin-manage-page .family-action-menu-list {
    position: absolute;
    top: calc(100% + 0.4rem);
    right: 0;
    z-index: 30;
    min-width: 220px;
    padding: 0.35rem;
    border: 1px solid rgba(148, 163, 184, 0.22);
    border-radius: 14px;
    background: #ffffff;
    box-shadow: 0 18px 30px rgba(15, 23, 42, 0.12);
}

.admin-manage-page .child-action-menu .family-action-menu-list {
    min-width: 180px;
}

.admin-manage-page .family-action-menu-list form {
    margin: 0;
}

.admin-manage-page .family-action-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.72rem 0.85rem;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: #1e293b;
    font-size: 0.88rem;
    text-align: left;
    cursor: pointer;
    white-space: nowrap;
}

.admin-manage-page .family-action-menu-item:hover {
    background: #f8fafc;
}

.admin-manage-page .manage-empty-state {
    padding: 2rem;
    border: 1px dashed rgba(148, 163, 184, 0.4);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.admin-manage-page .manage-empty-state h3 {
    margin-bottom: 0.5rem;
}

@media (max-width: 900px) {
    .admin-manage-page .manage-page-header,
    .admin-manage-page .management-section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-manage-page .add-child-form-polished {
        grid-template-columns: 1fr;
    }

    .admin-manage-page .management-toolbar-actions {
        padding-bottom: 0.25rem;
    }

    .admin-manage-page .family-group-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-manage-page .family-group-header {
        display: grid;
        grid-template-columns: 2.6rem minmax(0, 1fr);
    }

    .admin-manage-page .family-member-row {
        grid-template-columns: 1fr;
    }

    .admin-manage-page .family-member-id {
        justify-content: flex-start;
        padding: 0.8rem 0.9rem 0.25rem;
        border-right: 0;
        background: transparent;
    }

    .admin-manage-page .family-member-main {
        padding-top: 0;
        padding-bottom: 0.75rem;
    }

    .admin-manage-page .family-member-actions {
        justify-content: flex-start;
        padding: 0.8rem 0.9rem 0;
        border-top: 1px solid rgba(148, 163, 184, 0.12);
        border-left: 0;
    }

    .admin-manage-page .family-action-menu-list {
        left: 0;
        right: auto;
        min-width: min(220px, calc(100vw - 3rem));
    }
}
