 :root {
            --color-primary: #2180a1;
            --color-primary-dark: #1a6a8c;
            --color-bg: #f3f6f9;
            --color-sidebar: #2c3e50;
            --color-surface: #ffffff;
            --color-surface-soft: #f7fafc;
            --color-surface-elevated: rgba(255, 255, 255, 0.92);
            --color-text: #23313f;
            --color-text-muted: #6a7b8c;
            --color-border: #d9e1e8;
            --color-input-bg: #ffffff;
            --color-input-border: #cfd8e3;
            --color-hover: #ecf2f6;
            --color-overlay: rgba(15, 23, 42, 0.56);
            --color-scrollbar-track: #e5edf3;
            --color-scrollbar-thumb: #a7b6c4;
            --color-scrollbar-thumb-hover: #879aab;
            --color-success: #27ae60;
            --color-warning: #f39c12;
            --color-danger: #e74c3c;
        }

        html {
            color-scheme: light;
            scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
        }

        html.dark-mode {
            color-scheme: dark;
            --color-primary: #6db7e3;
            --color-primary-dark: #4d93bd;
            --color-bg: #0f151c;
            --color-sidebar: #151c24;
            --color-surface: #18212b;
            --color-surface-soft: #1d2833;
            --color-surface-elevated: rgba(24, 33, 43, 0.94);
            --color-text: #e3ebf3;
            --color-text-muted: #99a7b6;
            --color-border: #2a3642;
            --color-input-bg: #111922;
            --color-input-border: #354352;
            --color-hover: #202b36;
            --color-overlay: rgba(3, 8, 14, 0.78);
            --color-scrollbar-track: #0c1218;
            --color-scrollbar-thumb: #435262;
            --color-scrollbar-thumb-hover: #5d7186;
        }

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

        * {
            scrollbar-width: thin;
            scrollbar-color: var(--color-scrollbar-thumb) var(--color-scrollbar-track);
        }

        *::-webkit-scrollbar {
            width: 12px;
            height: 12px;
        }

        *::-webkit-scrollbar-track {
            background: var(--color-scrollbar-track);
        }

        *::-webkit-scrollbar-thumb {
            background: var(--color-scrollbar-thumb);
            border: 3px solid var(--color-scrollbar-track);
            border-radius: 999px;
        }

        *::-webkit-scrollbar-thumb:hover {
            background: var(--color-scrollbar-thumb-hover);
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background-color: var(--color-bg);
            color: var(--color-text);
            transition: background-color 0.3s, color 0.3s;
        }

        @media (min-width: 901px) {
            html.dashboard-active,
            html.dashboard-active body {
                overflow-y: hidden;
            }

            html.dashboard-active .main-content {
                padding-bottom: 0;
            }
        }

        .container { display: flex; min-height: 100vh; }

        .sidebar {
            width: 260px;
            background-color: var(--color-sidebar);
            color: white;
            padding: 20px;
            position: fixed;
            height: 100vh;
            overflow-y: auto;
            border-right: 1px solid var(--color-border);
            transition: background-color 0.3s;
        }

        .logo {
            font-size: 20px;
            font-weight: bold;
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 2px solid rgba(255,255,255,0.1);
        }

        .menu-item {
            padding: 12px 15px;
            margin-bottom: 5px;
            border-radius: 5px;
            cursor: pointer;
            transition: background-color 0.3s;
        }
        .menu-item:hover { background-color: rgba(255,255,255,0.1); }
        .menu-item.active { background-color: var(--color-primary); }

        html.dark-mode .menu-item.active { background-color: #2e86c1; }

        .main-content { 
            margin-left: 260px; 
            flex: 1; 
            padding: 0 30px 30px;
            transition: background-color 0.3s;
        }

        .header {
            background-color: var(--color-surface);
            padding: 20px;
            border-radius: 8px;
            margin-bottom: 30px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
            transition: background-color 0.3s;
        }

        html.dark-mode .header { box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

        .header h1 { color: var(--color-primary); }

        html.dark-mode .header h1 {
            color: #7cb3d4;
        }

        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
            gap: 16px;
            margin-bottom: 16px;
        }

        .stat-card {
            background-color: var(--color-surface);
            padding: 18px 24px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            transition: background-color 0.3s;
        }

        html.dark-mode .stat-card { box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

        .stat-card h3 { font-size: 14px; color: #666; margin-bottom: 8px; }

        html.dark-mode .stat-card h3 { color: #a0a0a0; }

        .stat-card .number { font-size: 30px; font-weight: bold; color: var(--color-primary); }

        html.dark-mode .stat-card .number {
            color: #7cb3d4;
        }

        .dashboard-panel,
        .dashboard-week-panel {
            background: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: 8px;
            padding: 14px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.08);
        }

        .dashboard-week-panel {
            margin-bottom: 16px;
        }

        html.dark-mode .dashboard-panel,
        html.dark-mode .dashboard-week-panel {
            box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        }

        .dashboard-panel-header {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 14px;
            margin-bottom: 12px;
        }

        .dashboard-panel-header h2 {
            margin: 0;
            color: var(--color-text);
            font-size: 16px;
            line-height: 1.2;
        }

        .dashboard-panel-header p {
            margin: 4px 0 0;
            color: var(--color-text-muted);
            font-size: 12px;
            line-height: 1.35;
        }

        .dashboard-link-button {
            flex: 0 0 auto;
            padding: 6px 10px;
            border: 1px solid rgba(33, 128, 161, 0.24);
            border-radius: 5px;
            background: rgba(33, 128, 161, 0.08);
            color: var(--color-primary-dark);
            font-size: 12px;
            font-weight: 700;
            cursor: pointer;
            transition: background-color 0.2s ease, border-color 0.2s ease;
        }

        .dashboard-link-button:hover {
            background: rgba(33, 128, 161, 0.14);
            border-color: rgba(33, 128, 161, 0.34);
        }

        .dashboard-week-strip {
            display: grid;
            grid-template-columns: repeat(7, minmax(88px, 1fr));
            gap: 8px;
            overflow-x: auto;
            padding-bottom: 2px;
        }

        .dashboard-week-day {
            min-width: 88px;
            min-height: 78px;
            padding: 9px 10px;
            border: 1px solid var(--color-border);
            border-radius: 8px;
            background: var(--color-surface-soft);
            color: inherit;
            font-family: inherit;
            text-align: left;
            cursor: pointer;
            transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
        }

        .dashboard-week-day:hover {
            transform: translateY(-1px);
            background: var(--color-hover);
            border-color: rgba(33, 128, 161, 0.28);
        }

        .dashboard-week-day:focus-visible,
        .dashboard-link-button:focus-visible,
        .dashboard-more-events:focus-visible {
            outline: 3px solid rgba(33, 128, 161, 0.16);
            outline-offset: 2px;
        }

        .dashboard-week-day.today {
            border-color: rgba(33, 128, 161, 0.35);
            background: rgba(33, 128, 161, 0.08);
        }

        .dashboard-week-label {
            color: var(--color-text-muted);
            font-size: 11px;
            font-weight: 800;
            text-transform: uppercase;
        }

        .dashboard-week-number {
            margin-top: 3px;
            color: var(--color-text);
            font-size: 22px;
            font-weight: 800;
            line-height: 1;
        }

        .dashboard-week-count {
            margin-top: 7px;
            color: var(--color-text-muted);
            font-size: 11px;
            font-weight: 700;
        }

        .dashboard-week-dots {
            display: flex;
            gap: 3px;
            min-height: 6px;
            margin-top: 6px;
        }

        .dashboard-event-list {
            display: grid;
            gap: 8px;
        }

        .dashboard-event-item {
            display: grid;
            gap: 3px;
            padding: 10px 12px;
            border: 1px solid var(--color-border);
            border-left: 4px solid var(--color-primary);
            border-radius: 8px;
            background: var(--color-surface-soft);
        }

        .dashboard-event-item.vaccine { border-left-color: #2f80ed; }
        .dashboard-event-item.sterilization { border-left-color: #a855f7; }
        .dashboard-event-item.deworming { border-left-color: #27ae60; }

        .dashboard-event-title {
            color: var(--color-text);
            font-size: 13px;
            font-weight: 800;
            line-height: 1.3;
        }

        .dashboard-event-meta {
            color: var(--color-text-muted);
            font-size: 12px;
            line-height: 1.35;
            overflow-wrap: anywhere;
        }

        .dashboard-more-events {
            justify-self: stretch;
            width: 100%;
            min-height: 34px;
            padding: 7px 10px;
            border: 1px solid rgba(33, 128, 161, 0.16);
            border-radius: 8px;
            background: rgba(33, 128, 161, 0.06);
            color: var(--color-primary-dark);
            font-size: 12px;
            font-weight: 800;
            text-align: center;
            cursor: pointer;
            transition: background-color 0.2s ease, border-color 0.2s ease;
        }

        .dashboard-more-events:hover {
            background: rgba(33, 128, 161, 0.1);
            border-color: rgba(33, 128, 161, 0.26);
        }

        .dashboard-empty-state {
            padding: 16px;
            border: 1px dashed var(--color-border);
            border-radius: 8px;
            color: var(--color-text-muted);
            font-size: 13px;
            text-align: center;
            background: var(--color-surface-soft);
        }

        html.dark-mode .dashboard-link-button {
            background: rgba(93, 173, 226, 0.12);
            border-color: rgba(93, 173, 226, 0.22);
            color: #9fd4f1;
        }

        html.dark-mode .dashboard-week-day.today {
            border-color: rgba(93, 173, 226, 0.38);
            background: rgba(93, 173, 226, 0.13);
        }

        html.dark-mode .dashboard-week-day:hover {
            background: rgba(93, 173, 226, 0.12);
            border-color: rgba(93, 173, 226, 0.18);
        }

        html.dark-mode .dashboard-event-item {
            background: rgba(255,255,255,0.05);
            border-color: rgba(255,255,255,0.08);
        }

        html.dark-mode .dashboard-event-item.vaccine { border-left-color: #5aa2ff; }
        html.dark-mode .dashboard-event-item.sterilization { border-left-color: #c084fc; }
        html.dark-mode .dashboard-event-item.deworming { border-left-color: #4ade80; }

        html.dark-mode .dashboard-more-events {
            background: rgba(93, 173, 226, 0.08);
            border-color: rgba(93, 173, 226, 0.14);
            color: #9fd4f1;
        }

        html.dark-mode .dashboard-more-events:hover {
            background: rgba(93, 173, 226, 0.12);
            border-color: rgba(93, 173, 226, 0.24);
        }

        @media (max-width: 640px) {
            .dashboard-panel,
            .dashboard-week-panel {
                padding: 15px;
            }

            .dashboard-panel-header {
                align-items: stretch;
                flex-direction: column;
            }

            .dashboard-link-button {
                width: 100%;
            }

            .dashboard-week-strip {
                grid-template-columns: repeat(7, minmax(84px, 1fr));
            }
        }

        .table-container {
            background-color: var(--color-surface);
            padding: 20px;
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
            margin-bottom: 30px;
            overflow-x: auto;
            transition: background-color 0.3s;
        }

        html.dark-mode .table-container { box-shadow: 0 2px 4px rgba(0,0,0,0.3); }

        table { width: 100%; border-collapse: collapse; }
        table th {
            background-color: var(--color-primary);
            color: white;
            padding: 12px;
            text-align: left;
            font-weight: 600;
        }
        
        html.dark-mode table th {
            background-color: #3d5a80;
            color: #e8e8e8;
        }
        table td { 
            padding: 12px; 
            border-bottom: 1px solid var(--color-border); 
            vertical-align: middle;
            transition: background-color 0.3s;
        }
        table tr:hover { background-color: var(--color-hover); }

        .btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 8px;
            padding: 10px 20px;
            border: none;
            border-radius: 5px;
            cursor: pointer;
            font-size: 14px;
            transition: background-color 0.3s;
        }
        .btn:disabled,
        button:disabled {
            cursor: not-allowed;
            opacity: 0.72;
        }
        .btn-loading {
            pointer-events: none;
        }
        .button-spinner {
            width: 14px;
            height: 14px;
            border: 2px solid currentColor;
            border-right-color: transparent;
            border-radius: 50%;
            flex: 0 0 auto;
            animation: buttonSpin 0.7s linear infinite;
        }
        @keyframes buttonSpin {
            to { transform: rotate(360deg); }
        }
        .btn-primary { background-color: var(--color-primary); color: white; }
        .btn-primary:hover { background-color: var(--color-primary-dark); }
        .btn-success { background-color: var(--color-success); color: white; }
        .btn-success:hover { background-color: #229954; }
        .btn-warning { background-color: var(--color-warning); color: white; }
        .btn-warning:hover { background-color: #d68910; }
        .btn-danger { background-color: var(--color-danger); color: white; }
        .btn-danger:hover { background-color: #cb4335; }
        .btn-secondary { background-color: #6c757d; color: white; }
        .btn-small { padding: 5px 10px; font-size: 12px; margin-right: 3px; margin-bottom: 2px; }

        html.dark-mode .btn-primary { background-color: #2e86c1; color: white; }
        html.dark-mode .btn-primary:hover { background-color: #1f5a8f; }
        html.dark-mode .btn-success { background-color: #27ae60; }
        html.dark-mode .btn-success:hover { background-color: #2ecc71; }
        html.dark-mode .btn-warning { background-color: #e67e22; }
        html.dark-mode .btn-warning:hover { background-color: #f39c12; }
        html.dark-mode .btn-danger { background-color: #e74c3c; }
        html.dark-mode .btn-danger:hover { background-color: #ff6b6b; }
        html.dark-mode .btn-secondary { background-color: #5a6c7d; }
        html.dark-mode .btn-secondary:hover { background-color: #6f8296; }

        .modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0; top: 0;
            width: 100%; height: 100%;
            background-color: var(--color-overlay);
            overflow-y: auto;
        }
        .modal-content {
            background-color: var(--color-surface);
            margin: 30px auto;
            border-radius: 8px;
            max-width: 950px;
            width: 92%;
            border: 1px solid var(--color-border);
            box-shadow: 0 4px 20px rgba(0,0,0,0.3);
            transition: background-color 0.3s;
        }

        .modal-header {
            background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
            color: white;
            padding: 18px 22px;
            border-radius: 8px 8px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        .modal-header h2 { margin: 0; font-size: 18px; }
        .close { color: white; font-size: 26px; font-weight: bold; cursor: pointer; line-height: 1; }
        .close:hover { color: #ddd; }

        .modal-body {
            padding: 22px;
            max-height: calc(100vh - 180px);
            overflow-y: auto;
            background-color: var(--color-surface);
            color: var(--color-text);
        }
        .modal-footer {
            padding: 16px 22px;
            border-top: 1px solid var(--color-border);
            background-color: var(--color-surface-soft);
            display: flex;
            justify-content: flex-end;
            gap: 10px;
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
            gap: 13px;
            margin-bottom: 10px;
        }
        .form-group { margin-bottom: 13px; }
        .form-group label {
            display: block;
            margin-bottom: 4px;
            font-weight: 500;
            font-size: 13px;
            color: var(--color-text);
        }
        .form-group input,
        .form-group select,
        .form-group textarea {
            width: 100%;
            padding: 8px 10px;
            border: 1px solid var(--color-input-border);
            border-radius: 4px;
            font-size: 13px;
            background-color: var(--color-input-bg);
            color: var(--color-text);
            color-scheme: inherit;
            transition: background-color 0.3s, color 0.3s, border-color 0.2s, box-shadow 0.2s;
        }

        html.dark-mode .form-group input,
        html.dark-mode .form-group select,
        html.dark-mode .form-group textarea {
            background-color: var(--color-input-bg);
            color: var(--color-text);
            border-color: var(--color-input-border);
        }

        .form-group input::placeholder,
        .form-group textarea::placeholder,
        .search-bar input::placeholder,
        .auth-form input::placeholder {
            color: var(--color-text-muted);
        }

        .form-group input:focus,
        .form-group select:focus,
        .form-group textarea:focus,
        .search-bar input:focus,
        .auth-form input:focus {
            outline: none;
            border-color: var(--color-primary);
            box-shadow: 0 0 0 3px rgba(33, 128, 161, 0.16);
        }

        .form-group input[type="date"]::-webkit-calendar-picker-indicator {
            cursor: pointer;
        }

        html.dark-mode .form-group input[type="date"] {
            color-scheme: dark;
        }

        html.dark-mode .form-group input[type="date"]::-webkit-calendar-picker-indicator {
            width: 18px;
            height: 18px;
            opacity: 1;
            cursor: pointer;
            background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23e3ebf3' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M16 2v4'/%3E%3Crect width='18' height='18' x='3' y='4' rx='2'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E") center / 16px 16px no-repeat;
        }

        .form-group input.input-error,
        .form-group select.input-error,
        .form-group textarea.input-error {
            border-color: var(--color-danger);
        }
        .form-group textarea { resize: vertical; min-height: 70px; }
        .form-note {
            margin: 6px 0 0;
            color: var(--color-text-muted);
            font-size: 12px;
            line-height: 1.35;
        }

        .form-section {
            background-color: var(--color-surface-soft);
            padding: 16px 18px;
            border-radius: 6px;
            margin-bottom: 16px;
            border: 1px solid var(--color-border);
            border-left: 4px solid var(--color-primary);
            transition: background-color 0.3s;
        }

        .form-section h3 {
            margin-bottom: 13px;
            color: var(--color-primary);
            font-size: 15px;
        }

        html.dark-mode .form-section h3 {
            color: #7cb3d4;
        }

        .search-bar { margin-bottom: 18px; }
        .search-bar input {
            padding: 10px;
            width: 100%;
            border: 1px solid var(--color-input-border);
            border-radius: 4px;
            font-size: 14px;
            background-color: var(--color-input-bg);
            color: var(--color-text);
            color-scheme: inherit;
            transition: background-color 0.3s, border-color 0.2s, box-shadow 0.2s;
        }

        .badge { padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; white-space: nowrap; }
        .badge-success { background-color: #d4edda; color: #155724; }
        .badge-warning { background-color: #fff3cd; color: #856404; }
        .badge-danger  { background-color: #f8d7da; color: #721c24; }
        .badge-info    { background-color: #cce5ff; color: #004085; }

        html.dark-mode .badge-success { background-color: #1e5631; color: #70d076; }
        html.dark-mode .badge-warning { background-color: #704020; color: #ffd966; }
        html.dark-mode .badge-danger  { background-color: #6b2422; color: #ff7f7f; }
        html.dark-mode .badge-info    { background-color: #1d3a5e; color: #5eb3ff; }

        #animalsTable {
            table-layout: fixed;
            width: 100%;
        }

        #animalsTable th,
        #animalsTable td {
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        #animalsTable th:nth-child(1), #animalsTable td:nth-child(1) { width: 7%; }
        #animalsTable th:nth-child(2), #animalsTable td:nth-child(2) { width: 7%; }
        #animalsTable th:nth-child(3), #animalsTable td:nth-child(3) { width: 14%; }
        #animalsTable th:nth-child(4), #animalsTable td:nth-child(4) { width: 16%; }
        #animalsTable th:nth-child(5), #animalsTable td:nth-child(5) { width: 14%; }
        #animalsTable th:nth-child(6), #animalsTable td:nth-child(6) { width: 9%; }
        #animalsTable th:nth-child(7), #animalsTable td:nth-child(7) {
            width: 33%;
            overflow: visible;
            white-space: normal;
        }

        #animalsTable .btn-small {
            white-space: nowrap;
            margin: 2px 3px 2px 0;
        }

        .hidden { display: none !important; }

        .vaccine-entry {
            display: grid;
            grid-template-columns: 1fr 160px auto;
            gap: 8px;
            margin-bottom: 8px;
            align-items: end;
        }
        .vaccine-entry .form-group { margin-bottom: 0; }
        .btn-add-vaccine {
            background-color: var(--color-success);
            color: white;
            padding: 7px 14px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
            margin-bottom: 10px;
            transition: background-color 0.3s;
        }
        .btn-add-vaccine:hover { background-color: #229954; }
        .btn-remove {
            background-color: var(--color-danger);
            color: white;
            padding: 7px 10px;
            border: none;
            border-radius: 4px;
            cursor: pointer;
            font-size: 13px;
            white-space: nowrap;
            transition: background-color 0.3s;
        }
        .btn-remove:hover { background-color: #cb4335; }

        html.dark-mode .btn-add-vaccine { background-color: #27ae60; }
        html.dark-mode .btn-add-vaccine:hover { background-color: #2ecc71; }
        html.dark-mode .btn-remove { background-color: #e74c3c; }
        html.dark-mode .btn-remove:hover { background-color: #ff6b6b; }

        .animal-search-wrapper { position: relative; }
        .animal-search-results {
            position: absolute;
            background-color: var(--color-surface);
            border: 1px solid var(--color-border);
            border-radius: 4px;
            max-height: 200px;
            overflow-y: auto;
            width: 100%;
            z-index: 200;
            box-shadow: 0 4px 8px rgba(0,0,0,0.15);
            transition: background-color 0.3s;
        }

        .animal-search-item {
            padding: 9px 12px;
            cursor: pointer;
            border-bottom: 1px solid var(--color-border);
            font-size: 13px;
            color: var(--color-text);
            transition: background-color 0.3s;
        }
        .animal-search-item:hover { background-color: var(--color-hover); }
        .animal-search-item strong { color: var(--color-primary); }

        html.dark-mode .animal-search-item strong {
            color: #7cb3d4;
        }

        .toggle-switch { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
        .switch { position: relative; display: inline-block; width: 46px; height: 22px; }
        .switch input { opacity: 0; width: 0; height: 0; }
        .slider {
            position: absolute; cursor: pointer;
            top: 0; left: 0; right: 0; bottom: 0;
            background-color: #ccc; transition: .3s; border-radius: 22px;
        }
        .slider:before {
            position: absolute; content: "";
            height: 16px; width: 16px; left: 3px; bottom: 3px;
            background-color: white; transition: .3s; border-radius: 50%;
        }
        input:checked + .slider { background-color: var(--color-primary); }
        input:checked + .slider:before { transform: translateX(24px); }

        html.dark-mode .slider { background-color: #555; }
        html.dark-mode .slider:before { background-color: #ddd; }

        .info-modal-content {
            max-width: 980px;
        }

        .info-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
        }

        .info-item,
        .detail-card {
            min-width: 0;
            padding: 12px 14px;
            background-color: var(--color-surface-soft);
            border-radius: 6px;
            font-size: 14px;
            line-height: 1.4;
            border: 1px solid var(--color-border);
            transition: background-color 0.3s, border-color 0.3s;
        }

        .info-item strong,
        .detail-label {
            color: var(--color-primary);
            display: block;
            margin-bottom: 4px;
            font-size: 13px;
            font-weight: 700;
        }

        html.dark-mode .info-item strong,
        html.dark-mode .detail-label {
            color: #7cb3d4;
        }

        .detail-panel {
            display: grid;
            gap: 18px;
        }

        .detail-section {
            display: grid;
            gap: 12px;
        }

        .detail-section-title {
            margin: 0;
            color: var(--color-primary);
            font-size: 16px;
            line-height: 1.25;
        }

        html.dark-mode .detail-section-title {
            color: #7cb3d4;
        }

        .detail-grid {
            display: grid;
            grid-template-columns: repeat(2, minmax(0, 1fr));
            gap: 12px;
        }

        .detail-grid.detail-grid-3 {
            grid-template-columns: repeat(3, minmax(0, 1fr));
        }

        .detail-grid.detail-grid-4 {
            grid-template-columns: repeat(4, minmax(0, 1fr));
        }

        .detail-grid.detail-grid-5 {
            grid-template-columns: repeat(5, minmax(0, 1fr));
        }

        .colony-summary-grid {
            display: grid;
            grid-template-columns: repeat(5, minmax(0, 1fr));
            gap: 12px;
        }

        .colony-summary-card {
            min-width: 0;
            padding: 18px 20px;
            background-color: var(--color-surface);
            border: 1px solid rgba(0, 0, 0, 0.03);
            border-radius: 8px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }

        html.dark-mode .colony-summary-card {
            background-color: var(--color-surface);
            border-color: rgba(0, 0, 0, 0.08);
            box-shadow: 0 2px 4px rgba(0,0,0,0.3);
        }

        .colony-summary-label {
            color: #666;
            font-size: 14px;
            font-weight: 700;
            line-height: 1.25;
        }

        html.dark-mode .colony-summary-label {
            color: #a0a0a0;
        }

        .colony-summary-number {
            margin-top: 12px;
            color: var(--color-primary);
            font-size: 30px;
            font-weight: 800;
            line-height: 1;
        }

        html.dark-mode .colony-summary-number {
            color: #7cb3d4;
        }

        .colony-summary-number.warning {
            color: var(--color-warning);
        }

        html.dark-mode .colony-summary-number.warning {
            color: var(--color-warning);
        }


        .detail-card.detail-card-wide {
            grid-column: 1 / -1;
        }

        .detail-value {
            color: var(--color-text);
            font-size: 15px;
            overflow-wrap: anywhere;
        }

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

        .detail-list {
            margin: 0;
            padding-left: 18px;
        }

        .detail-list li {
            margin: 4px 0;
        }

        .detail-table-wrap {
            overflow-x: auto;
            border: 1px solid var(--color-border);
            border-radius: 8px;
            background-color: var(--color-surface);
        }

        .detail-table-wrap table {
            min-width: 680px;
        }

        .detail-empty-state {
            padding: 18px;
            border: 1px dashed var(--color-border);
            border-radius: 8px;
            color: var(--color-text-muted);
            background-color: var(--color-surface-soft);
            font-style: italic;
        }

        /* Notification toast */
        #toast {
            position: fixed;
            top: 24px;
            left: 50%;
            transform: translateX(-50%);
            padding: 14px 22px;
            border-radius: 6px;
            color: white;
            font-size: 14px;
            z-index: 9999;
            opacity: 0;
            box-shadow: 0 14px 32px rgba(0,0,0,0.18);
            transition: opacity 0.4s;
            pointer-events: none;
            max-width: min(92vw, 520px);
            text-align: center;
        }
        #toast.show { opacity: 1; }
        #toast.toast-success { background-color: var(--color-success); }
        #toast.toast-error   { background-color: var(--color-danger); }
        #toast.toast-warning { background-color: var(--color-warning); }

        html.dark-mode #toast.toast-success { background-color: #2ecc71; }
        html.dark-mode #toast.toast-error { background-color: #ff6b6b; }
        html.dark-mode #toast.toast-warning { background-color: #f39c12; }

        .settings-section {
            margin-bottom: 30px;
            padding-bottom: 20px;
            border-bottom: 1px solid var(--color-border);
        }

        .settings-section:last-child {
            border-bottom: none;
        }

        .settings-section h3 {
            color: var(--color-primary);
            margin-bottom: 15px;
            font-size: 16px;
        }

        html.dark-mode .settings-section h3 {
            color: #7cb3d4;
        }

        .settings-item {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 10px 0;
        }

        .settings-item label {
            font-weight: 500;
        }

        .admin-user-form {
            display: grid;
            grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) auto;
            gap: 12px;
            align-items: end;
            margin-bottom: 10px;
        }

        .admin-user-form .form-group {
            margin-bottom: 0;
        }

        .admin-users-message {
            min-height: 18px;
            margin: 10px 0;
            color: var(--color-text-muted);
            font-size: 13px;
        }

        .admin-users-table-wrap {
            overflow-x: auto;
        }

        .admin-users-table select {
            min-width: 145px;
            padding: 6px 8px;
            border: 1px solid var(--color-input-border);
            border-radius: 4px;
            background: var(--color-input-bg);
            color: var(--color-text);
        }

        @media (max-width: 760px) {
            .admin-user-form {
                grid-template-columns: 1fr;
            }
        }
/* Auth Styles */
.auth-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background:
        radial-gradient(circle at top, rgba(109, 183, 227, 0.18), transparent 34%),
        var(--color-overlay);
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.auth-form {
    background: var(--color-surface);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--color-border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    width: 400px;
    text-align: center;
    color: var(--color-text);
}

.auth-form h2 {
    margin-bottom: 30px;
    color: var(--color-primary);
    font-size: 24px;
}

.auth-form input:not([type="checkbox"]) {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 1px solid var(--color-input-border);
    border-radius: 8px;
    font-size: 16px;
    background-color: var(--color-input-bg);
    color: var(--color-text);
    color-scheme: inherit;
    transition: border-color 0.3s, box-shadow 0.2s, background-color 0.3s;
}

.auth-remember {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    width: 100%;
    min-height: 22px;
    margin-top: -4px;
    margin-bottom: 14px;
}

.auth-remember-checkbox {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    line-height: 0;
}

.auth-remember-checkbox input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    position: absolute;
    opacity: 0;
    inset: 0;
    width: 18px;
    height: 18px;
    padding: 0;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    cursor: pointer;
    z-index: 1;
}

.auth-remember-checkmark {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--color-border);
    border-radius: 4px;
    background: var(--color-surface, #fff);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms ease, border-color 150ms ease;
    pointer-events: none;
}

.auth-remember-checkbox input[type="checkbox"]:checked + .auth-remember-checkmark {
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.auth-remember-checkbox input[type="checkbox"]:checked + .auth-remember-checkmark::after {
    content: '';
    display: block;
    width: 10px;
    height: 6px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: translateY(-1px) rotate(-45deg);
}

.auth-remember-checkbox input[type="checkbox"]:focus-visible + .auth-remember-checkmark {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

.auth-remember-text {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    line-height: 1.2;
}

.auth-form button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.auth-form #loginBtn {
    background-color: var(--color-primary);
    color: white;
}

.auth-form #loginBtn:hover {
    background-color: var(--color-primary-dark);
}

.auth-form #sendResetEmailBtn,
.auth-form #saveNewPasswordBtn {
    background-color: var(--color-primary);
    color: white;
}

.auth-form #sendResetEmailBtn:hover,
.auth-form #saveNewPasswordBtn:hover {
    background-color: var(--color-primary-dark);
}

.auth-form .auth-text-button {
    width: auto;
    padding: 2px 4px;
    margin: -2px 0 8px 0;
    border-radius: 4px;
    background: transparent;
    color: var(--color-primary);
    font-size: 13px;
    line-height: 1.3;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.auth-form .auth-text-button:hover {
    color: var(--color-primary-dark);
    background: transparent;
}

.auth-form button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

.auth-divider {
    margin: 12px 0;
    display: flex;
    align-items: center;
    text-align: center;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: var(--color-border);
}

.auth-divider::before {
    margin-right: 10px;
}

.auth-divider::after {
    margin-left: 10px;
}

.auth-divider span {
    padding: 0 10px;
    color: var(--color-text-muted);
    font-size: 14px;
    background-color: var(--color-surface);
}

.btn-guest {
    background-color: var(--color-surface-soft);
    color: var(--color-text);
    border: 1px solid var(--color-input-border);
}

.btn-guest:hover {
    background-color: var(--color-hover);
}

#authMessage {
    min-height: 1.4em;
    margin: 4px 0 16px 0;
    color: #dc3545;
    font-size: 14px;
}

#authMessage:empty {
    min-height: 0;
    margin: 0;
}

.btn-description {
    margin: -2px 0 6px 0;
    font-size: 12px;
    color: var(--color-text-muted);
    text-align: center;
    line-height: 1.4;
}

/* Top Bar + User Menu */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 82px;
    margin: 0 -30px 20px;
    padding: 16px 30px;
    background: rgba(255,255,255,0.88);
    border-bottom: 1px solid rgba(44, 62, 80, 0.08);
    backdrop-filter: blur(18px);
}

.app-topbar-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 0;
    color: #24425d;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.calendar-corner,
.notifications-corner,
.user-corner {
    position: relative;
}

.topbar-icon-button {
    position: relative;
    width: 46px;
    height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(44, 62, 80, 0.1);
    border-radius: 50%;
    background: var(--color-surface-elevated);
    color: var(--color-text);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}

.topbar-icon-button svg {
    width: 22px;
    height: 22px;
}

.topbar-icon-button:hover,
.calendar-corner.open .topbar-icon-button,
.notifications-corner.open .topbar-icon-button {
    transform: translateY(-1px);
    border-color: rgba(33, 128, 161, 0.22);
    box-shadow: 0 12px 24px rgba(29, 55, 88, 0.14);
}

.topbar-icon-button:focus-visible,
.calendar-day:focus-visible,
.panel-icon-button:focus-visible {
    outline: 3px solid rgba(33, 128, 161, 0.18);
    outline-offset: 3px;
}

.notification-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid var(--color-surface-elevated);
    border-radius: 999px;
    background: var(--color-danger);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 16px;
    text-align: center;
}

.health-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    z-index: 120;
    border: 1px solid rgba(44, 62, 80, 0.12);
    background: var(--color-surface-elevated);
    box-shadow: 0 24px 60px rgba(25, 42, 69, 0.18);
    backdrop-filter: blur(22px);
}

.calendar-panel {
    width: min(390px, calc(100vw - 40px));
    padding: 16px;
    border-radius: 18px;
}

.calendar-panel-header,
.notification-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.calendar-month-label {
    flex: 1;
    color: var(--color-text);
    font-size: 15px;
    font-weight: 800;
    text-align: center;
    text-transform: capitalize;
}

.panel-icon-button {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    background: var(--color-surface-soft);
    color: var(--color-text);
    cursor: pointer;
}

.panel-icon-button svg {
    width: 18px;
    height: 18px;
}

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

.calendar-weekdays {
    margin-bottom: 6px;
}

.calendar-weekdays span {
    color: var(--color-text-muted);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
}

.calendar-day {
    position: relative;
    min-width: 0;
    aspect-ratio: 1;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: var(--color-text);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.calendar-day:hover {
    background: var(--color-hover);
}

.calendar-day.outside-month {
    color: var(--color-text-muted);
    opacity: 0.48;
}

.calendar-day.today {
    border-color: rgba(33, 128, 161, 0.42);
    background: rgba(33, 128, 161, 0.1);
    color: var(--color-primary-dark);
}

.calendar-day.selected {
    background: var(--color-primary);
    color: #fff;
}

.calendar-day.has-events {
    border-color: rgba(33, 128, 161, 0.2);
}

.calendar-dots {
    display: flex;
    justify-content: center;
    gap: 2px;
    min-height: 5px;
}

.calendar-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-primary);
}

.calendar-dot.vaccine { background: #2f80ed; }
.calendar-dot.sterilization { background: #a855f7; }
.calendar-dot.deworming { background: #27ae60; }
.calendar-dot.extra { background: var(--color-warning); }
.calendar-day.selected .calendar-dot { background: #fff; }

.calendar-panel-note {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 700;
    text-align: center;
}

.health-event-item,
.notification-item {
    padding: 10px 11px;
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-primary);
    border-radius: 8px;
    background: var(--color-surface-soft);
}

.health-event-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.health-event-main {
    min-width: 0;
}

.health-event-delete {
    flex: 0 0 auto;
    padding: 6px 9px;
    border: 1px solid rgba(231, 76, 60, 0.2);
    border-radius: 6px;
    background: rgba(231, 76, 60, 0.08);
    color: #b83b2d;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.health-event-delete:hover {
    background: rgba(231, 76, 60, 0.14);
    border-color: rgba(231, 76, 60, 0.32);
}

.health-event-item.vaccine,
.notification-item.vaccine { border-left-color: #2f80ed; }
.health-event-item.sterilization,
.notification-item.sterilization { border-left-color: #a855f7; }
.health-event-item.deworming,
.notification-item.deworming { border-left-color: #27ae60; }

.health-event-title,
.notification-message {
    color: var(--color-text);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.health-event-meta,
.notification-date {
    margin-top: 4px;
    color: var(--color-text-muted);
    font-size: 12px;
    line-height: 1.35;
}

.health-empty-state {
    padding: 12px;
    border: 1px dashed var(--color-border);
    border-radius: 8px;
    color: var(--color-text-muted);
    font-size: 13px;
    text-align: center;
}

.health-day-modal-content {
    display: grid;
    gap: 10px;
}

.health-day-summary {
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(33, 128, 161, 0.1);
    color: var(--color-primary-dark);
    font-size: 13px;
    font-weight: 800;
}

.notification-panel {
    width: min(360px, calc(100vw - 40px));
    padding: 16px;
    border-radius: 18px;
}

.notification-title {
    color: var(--color-text);
    font-size: 15px;
    font-weight: 800;
}

.notification-subtitle {
    margin-top: 2px;
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 700;
}

.notification-list {
    display: grid;
    gap: 9px;
    max-height: 330px;
    overflow-y: auto;
}

.table-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 18px;
    min-width: 0;
}

.table-toolbar-split {
    justify-content: space-between;
}

.table-toolbar-end {
    justify-content: flex-end;
}

.table-toolbar .btn {
    white-space: nowrap;
}

.table-toolbar .search-bar {
    margin-bottom: 0;
}

.search-bar-inline {
    flex: 1;
    min-width: 0;
}

.user-menu-trigger {
    width: 52px;
    height: 52px;
    padding: 0;
    border: 1px solid rgba(44, 62, 80, 0.1);
    border-radius: 50%;
    background: var(--color-surface-elevated);
    color: var(--color-text);
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.user-menu-trigger:hover,
.user-corner.open .user-menu-trigger {
    transform: translateY(-1px);
    border-color: rgba(33, 128, 161, 0.22);
    box-shadow: 0 12px 24px rgba(29, 55, 88, 0.14);
}

.user-menu-trigger:focus-visible,
.user-menu-action:focus-visible {
    outline: 3px solid rgba(33, 128, 161, 0.18);
    outline-offset: 3px;
}

.user-avatar {
    width: 100%;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #f9fcff;
    background:
        radial-gradient(circle at 30% 30%, rgba(255,255,255,0.26), transparent 40%),
        linear-gradient(135deg, #2f7f9d 0%, #244c78 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 10px 18px rgba(34, 74, 116, 0.18);
}

.user-avatar svg {
    width: 60%;
    height: 60%;
}

.user-avatar-trigger {
    width: 52px;
    height: 52px;
}

.user-avatar-panel {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
}

.user-menu-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: min(320px, calc(100vw - 40px));
    padding: 14px;
    border-radius: 22px;
    border: 1px solid rgba(44, 62, 80, 0.12);
    background: var(--color-surface-elevated);
    box-shadow: 0 24px 60px rgba(25, 42, 69, 0.18);
    backdrop-filter: blur(22px);
}

.user-menu-header {
    display: flex;
    align-items: center;
    gap: 14px;
}

.user-menu-copy {
    min-width: 0;
    flex: 1;
}

.user-menu-name {
    font-size: 16px;
    font-weight: 700;
    color: #23374d;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-menu-email {
    font-size: 13px;
    font-weight: 600;
    color: #6c7e8f;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.user-menu-status {
    display: inline-flex;
    align-items: center;
    margin-top: 10px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(33, 128, 161, 0.1);
    color: var(--color-primary-dark);
    font-size: 12px;
    font-weight: 700;
}

.user-menu-divider {
    height: 1px;
    margin: 14px 0 10px;
    background: linear-gradient(90deg, rgba(44, 62, 80, 0.08), rgba(44, 62, 80, 0.18), rgba(44, 62, 80, 0.08));
}

.user-menu-actions {
    display: grid;
    gap: 8px;
}

.user-menu-action {
    width: 100%;
    padding: 13px 14px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: var(--color-surface-soft);
    color: var(--color-text);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

.user-menu-action:hover {
    transform: translateY(-1px);
    background: #edf5f8;
    border-color: rgba(33, 128, 161, 0.22);
}

.user-menu-action.danger {
    background: rgba(231, 76, 60, 0.08);
    color: #b83b2d;
    border-color: rgba(231, 76, 60, 0.14);
}

.user-menu-action.danger:hover {
    background: rgba(231, 76, 60, 0.12);
    border-color: rgba(231, 76, 60, 0.22);
}

html.dark-mode .app-topbar {
    background: rgba(28, 31, 35, 0.9);
    border-bottom-color: rgba(255,255,255,0.06);
}

html.dark-mode .app-topbar-title {
    color: #edf5fb;
}

html.dark-mode .user-menu-panel {
    background: var(--color-surface-elevated);
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 22px 48px rgba(0,0,0,0.3);
}

html.dark-mode .user-menu-name {
    color: #edf5fb;
}

html.dark-mode .user-menu-email {
    color: #98a8b8;
}

html.dark-mode .user-menu-status {
    background: rgba(93, 173, 226, 0.12);
    color: #9fd4f1;
}

html.dark-mode .user-menu-action {
    background: rgba(255,255,255,0.05);
    color: #edf5fb;
    border-color: rgba(255,255,255,0.08);
}

html.dark-mode .user-menu-action:hover {
    background: rgba(93, 173, 226, 0.12);
    border-color: rgba(93, 173, 226, 0.18);
}

html.dark-mode .user-menu-action.danger {
    background: rgba(231, 76, 60, 0.12);
    color: #ffaba1;
    border-color: rgba(231, 76, 60, 0.14);
}

html.dark-mode .topbar-icon-button,
html.dark-mode .panel-icon-button {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.08);
    color: #edf5fb;
}

html.dark-mode .health-panel {
    background: var(--color-surface-elevated);
    border-color: rgba(255,255,255,0.08);
    box-shadow: 0 22px 48px rgba(0,0,0,0.3);
}

html.dark-mode .calendar-month-label,
html.dark-mode .notification-title,
html.dark-mode .health-event-title,
html.dark-mode .notification-message {
    color: #edf5fb;
}

html.dark-mode .calendar-day.today {
    background: rgba(93, 173, 226, 0.13);
    border-color: rgba(93, 173, 226, 0.38);
    color: #9fd4f1;
}

html.dark-mode .calendar-day.selected {
    background: #2e86c1;
    color: #fff;
}

html.dark-mode .health-event-item,
html.dark-mode .notification-item {
    background: rgba(255,255,255,0.05);
    border-color: rgba(255,255,255,0.08);
}

html.dark-mode .health-event-delete {
    background: rgba(231, 76, 60, 0.12);
    border-color: rgba(231, 76, 60, 0.18);
    color: #ffaba1;
}

html.dark-mode .health-event-delete:hover {
    background: rgba(231, 76, 60, 0.18);
    border-color: rgba(231, 76, 60, 0.28);
}

html.dark-mode .health-event-item.vaccine,
html.dark-mode .notification-item.vaccine { border-left-color: #5aa2ff; }

html.dark-mode .health-event-item.sterilization,
html.dark-mode .notification-item.sterilization { border-left-color: #c084fc; }

html.dark-mode .health-event-item.deworming,
html.dark-mode .notification-item.deworming { border-left-color: #4ade80; }

html.dark-mode .health-day-summary {
    background: rgba(93, 173, 226, 0.12);
    color: #9fd4f1;
}

@media (max-width: 900px) {
    .app-topbar {
        margin-bottom: 18px;
    }

    .app-topbar-title {
        font-size: 24px;
    }

    .detail-grid,
    .detail-grid.detail-grid-3,
    .detail-grid.detail-grid-4,
    .detail-grid.detail-grid-5,
    .colony-summary-grid,
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .main-content {
        padding: 0 18px 18px;
    }

    .app-topbar {
        margin: 0 -18px 20px;
        padding: 14px 18px;
        min-height: 74px;
    }

    .app-topbar-title {
        font-size: 21px;
    }

    .table-toolbar,
    .table-toolbar-split {
        flex-direction: column;
        align-items: stretch;
    }

    .table-toolbar .btn {
        width: 100%;
    }

    .user-menu-trigger,
    .user-avatar-trigger {
        width: 48px;
        height: 48px;
    }

    .topbar-actions {
        gap: 8px;
    }

    .topbar-icon-button {
        width: 42px;
        height: 42px;
    }

    .calendar-panel,
    .notification-panel {
        position: fixed;
        top: 82px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }

    .modal-content {
        width: 96%;
        margin: 12px auto;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

}

/* App blur effect */
#app.blurred {
    filter: blur(3px);
    pointer-events: none;
}

/* Import/Export Styles */
.import-export-section {
    margin-bottom: 20px;
}

.export-card {
    padding: 15px;
    background: var(--color-surface-soft);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: all 0.2s ease;
}

.export-card:hover {
    background: var(--color-hover);
    border-color: var(--color-primary);
}

.export-card h5 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
}

.export-card .count-text {
    margin: 0;
    font-size: 12px;
    color: var(--color-text-muted);
}

.export-card .btn {
    margin-top: auto;
}

.file-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.file-picker-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.form-group .file-picker-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin-bottom: 0;
    padding: 8px 14px;
    border: none;
    border-radius: 5px;
    background: var(--color-primary);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
}

.form-group .file-picker-button:hover {
    background: var(--color-primary-dark);
}

.form-group .file-picker-input:focus-visible + .file-picker-button {
    box-shadow: 0 0 0 3px rgba(33, 128, 161, 0.16);
}

.file-picker-name {
    min-width: 0;
    color: var(--color-text-muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

html.dark-mode .form-group .file-picker-button {
    background: #2e86c1;
}

html.dark-mode .form-group .file-picker-button:hover {
    background: #1f5a8f;
}

#importPreview {
    border: 1px solid var(--color-border);
}

#importPreview h5 {
    margin: 0 0 10px 0;
    color: var(--color-primary);
}

#importPreviewContent {
    max-height: 300px;
    overflow-y: auto;
    padding: 10px 0;
}

.preview-item {
    padding: 8px;
    border-bottom: 1px solid var(--color-border);
    font-size: 13px;
}

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

.preview-item strong {
    color: var(--color-primary);
}

#importResult {
    border: 1px solid var(--color-border);
}

#importResult.success {
    background: rgba(39, 174, 96, 0.1);
    border-color: var(--color-success);
}

#importResult.error {
    background: rgba(231, 76, 60, 0.1);
    border-color: var(--color-danger);
}

.hidden {
    display: none;
}
