ul { list-style: none; padding: 0; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; 
    margin: 0 auto; 
    max-width: 800px; 
    padding: 1rem; 
    font-size: 18px; 
    line-height: 1.5;
    overflow-x: hidden;
    word-wrap: break-word;
    background-color: #f5f5f7;
}

/* Admin pages need full width */
body.admin {
    max-width: none;
    width: 100%;
    padding: 0;
}

body.admin main {
    max-width: none;
    width: 100%;
    padding: 0;
    margin: 0;
}
header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 1rem; 
    flex-wrap: wrap;
    background-color: white;
    padding: 1rem;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
header h1 {
    font-size: 1.4rem;
    margin: 0;
    flex: 1;
    min-width: 0;
}
header nav {
    margin-left: 1rem;
}
header nav a {
    text-decoration: none;
    color: #007AFF;
    font-weight: 500;
}
ul { list-style: none; padding: 0; }

.table-wrapper { 
    width: 100%; 
    overflow-x: auto; 
    -webkit-overflow-scrolling: touch;
}

.sightings-table { 
    width: 100%; 
    border-collapse: collapse; 
    font-size: 1rem; 
}
.sightings-table th,
.sightings-table td { 
    padding: 0.5rem 0.6rem; 
    border-bottom: 1px solid #ddd; 
    text-align: left; 
}
.sightings-table th a { 
    text-decoration: none; 
    color: inherit; 
}
.sightings-table tr:nth-child(even) { 
    background-color: #f9f9f9; 
}

/* Constrain wide location text on mobile while keeping table scrollable */
.sightings-table td.location { 
    max-width: 12rem; 
    white-space: nowrap; 
    overflow: hidden; 
    text-overflow: ellipsis; 
}

.report-card { 
    margin-bottom: 1.5rem; 
}
.report-card h2 { 
    margin-top: 0.5rem; 
}

/* Manage Alerts Page Styles */
.manage-alerts {
    width: 100%;
    box-sizing: border-box;
    max-width: 900px;
    margin: 0 auto;
}

/* Alerts Controls */
.alerts-controls {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: 500;
}

.control-toggle {
    display: flex;
    background: #f0f0f0;
    border-radius: 8px;
    padding: 2px;
    border: none;
    cursor: pointer;
}

.toggle-option {
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.2s;
    cursor: pointer;
    background: transparent;
    color: #666;
}

.toggle-option.active {
    background: #007AFF;
    color: white;
    font-weight: 500;
}

.control-button {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    border: 1px solid #007AFF;
    background: white;
    color: #007AFF;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.control-button:hover {
    background: #007AFF;
    color: white;
}

/* Simple View Styles */
.alerts-sheet.simple-view .alert-card {
    padding: 0.75rem 1rem;
    min-height: auto;
}

.alerts-sheet.simple-view .alert-card-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alerts-sheet.simple-view .alert-content {
    flex-direction: row;
    align-items: center;
    gap: 0;
}

.alerts-sheet.simple-view .alert-species {
    font-size: 1rem;
    margin: 0;
}

.alerts-sheet.simple-view .alert-location,
.alerts-sheet.simple-view .alert-time {
    display: none;
}

.alerts-sheet.simple-view .alert-toggle {
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.alerts-sheet.simple-view .alert-toggle .pill-text {
    display: none;
}

.alerts-sheet.simple-view .alert-toggle .pill-icon {
    margin: 0;
    font-size: 0.9rem;
}

.alerts-sheet.simple-view .alert-toggle.muted {
    background: #e0e0e0;
}

.alerts-sheet.simple-view .alert-toggle.muted::before {
    content: '○';
    color: #999;
    font-size: 0.9rem;
}

.alerts-sheet.simple-view .group-title {
    font-size: 0.9rem;
    padding: 0.5rem 0;
}

.manage-alerts h2 {
    font-size: 2rem;
    margin-bottom: 0.25rem;
    color: #1d1d1f;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.user-info {
    font-size: 0.875rem;
    color: #8e8e93;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #fafbfc 100%);
    border-radius: 8px;
    border-left: 3px solid #007AFF;
}

.user-info strong {
    color: #1d1d1f;
    font-weight: 600;
}

.page-description {
    font-size: 0.9375rem;
    color: #6e6e73;
    margin-bottom: 2rem;
    line-height: 1.6;
    padding: 0 0.25rem;
}

.alerts-section {
    margin-bottom: 2.5rem;
    background-color: white;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.04);
    transition: box-shadow 0.2s ease;
}

.alerts-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.1);
}

.following-section {
    background: linear-gradient(135deg, #ffffff 0%, #f8fff9 100%);
    border-left: 4px solid #34C759;
    border-left-width: 4px;
}

.muted-section {
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f7 100%);
    border-left: 4px solid #8E8E93;
    border-left-width: 4px;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    width: 100%;
    box-sizing: border-box;
    flex-wrap: nowrap;
    gap: 0.75rem;
}

.section-header h3 {
    font-size: 1.375rem;
    margin: 0;
    color: #1d1d1f;
    font-weight: 700;
    flex: 1;
    min-width: 0;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.section-count {
    background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
    color: white;
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 0.375rem 0.875rem;
    border-radius: 20px;
    min-width: 32px;
    text-align: center;
    flex-shrink: 0;
    line-height: 1.4;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(0, 122, 255, 0.25);
    letter-spacing: 0.01em;
}

.muted-section .section-count {
    background: linear-gradient(135deg, #8E8E93 0%, #6E6E73 100%);
    box-shadow: 0 2px 4px rgba(142, 142, 147, 0.2);
}

.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
}

.alert-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.125rem 1.25rem;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.08);
    gap: 1rem;
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    flex-wrap: nowrap;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.alert-item:hover {
    border-color: rgba(0, 122, 255, 0.3);
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.12), 0 2px 4px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
}

.alert-item:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.1s ease;
}

.alert-item.loading {
    opacity: 0.6;
    pointer-events: none;
}

.alert-item.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #007AFF;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.following-item {
    border-left: 4px solid #34C759;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.following-item:hover {
    background: linear-gradient(135deg, #ffffff 0%, #ecfdf5 100%);
    border-left-color: #30d158;
}

.muted-item {
    opacity: 0.92;
    border-left: 4px solid #8E8E93;
    background: linear-gradient(135deg, #fafafa 0%, #f5f5f7 100%);
}

.muted-item:hover {
    opacity: 1;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    border-left-color: #6e6e73;
}

.alert-main {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert-species {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1d1d1f;
    line-height: 1.3;
    letter-spacing: -0.01em;
}

.alert-species a {
    color: #007AFF;
    text-decoration: none;
    transition: color 0.2s ease;
}

.alert-species a:hover {
    color: #0051D5;
    text-decoration: underline;
}

.alert-species a:active {
    opacity: 0.7;
}

.alert-location {
    font-size: 0.9375rem;
    color: #6e6e73;
    word-break: break-word;
    line-height: 1.5;
    font-weight: 500;
}

.alert-time {
    font-size: 0.8125rem;
    color: #8e8e93;
    display: flex;
    align-items: center;
    gap: 0.625rem;
    margin-top: 0.125rem;
}

.relative-time {
    font-weight: 600;
    color: #34C759;
    background: rgba(52, 199, 89, 0.1);
    padding: 0.125rem 0.5rem;
    border-radius: 6px;
    font-size: 0.75rem;
}

.muted-item .relative-time {
    color: #8E8E93;
    background: rgba(142, 142, 147, 0.1);
}

.absolute-time {
    color: #8e8e93;
    font-size: 0.75rem;
    font-weight: 500;
}

.alert-action {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    min-width: 48px;
    min-height: 48px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #e5e5e7 0%, #d1d1d6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    padding: 0;
    pointer-events: none;
    line-height: 1;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.following-item .alert-action {
    background: linear-gradient(135deg, #34C759 0%, #30d158 100%);
    box-shadow: 0 2px 6px rgba(52, 199, 89, 0.3);
}

.muted-item .alert-action {
    background: linear-gradient(135deg, #d1d1d6 0%, #c7c7cc 100%);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.alert-item:hover .alert-action {
    transform: scale(1.05);
}

.alert-action .icon {
    display: block;
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* Empty States */
.empty-state {
    padding: 3rem 1.5rem;
    text-align: center;
    color: #6e6e73;
}

.empty-state::before {
    content: "📭";
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.empty-state p {
    margin: 0.75rem 0;
    font-size: 1rem;
    font-weight: 500;
    color: #1d1d1f;
}

.empty-hint {
    font-size: 0.875rem;
    color: #8e8e93;
    font-style: normal;
    font-weight: 400;
}

.full-empty {
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 16px;
    padding: 4rem 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.04);
    margin-top: 1rem;
}

.full-empty::before {
    content: "🐦";
    font-size: 4rem;
    display: block;
    margin-bottom: 1.5rem;
    opacity: 0.7;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #1d1d1f 0%, #2d2d2f 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 90%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9375rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-undo {
    background: rgba(0, 122, 255, 0.2);
    border: 1px solid rgba(0, 122, 255, 0.3);
    color: #5ac8fa;
    font-weight: 600;
    cursor: pointer;
    padding: 0.375rem 0.875rem;
    margin-left: auto;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.toast-undo:hover {
    background: rgba(0, 122, 255, 0.3);
    border-color: rgba(0, 122, 255, 0.5);
}

.toast-undo:active {
    opacity: 0.7;
    transform: scale(0.95);
}

@media (max-width: 600px) {
    body { 
        padding: 0.75rem; 
        font-size: 19px; 
    }
    header {
        padding: 0.875rem;
    }
    header h1 { 
        font-size: 1.3rem; 
    }
    header nav {
        margin-left: 0.5rem;
    }
    
    .manage-alerts h2 {
        font-size: 1.75rem;
        margin-bottom: 0.5rem;
    }
    
    .user-info {
        padding: 0.625rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    .page-description {
        font-size: 0.9375rem;
        margin-bottom: 1.75rem;
    }
    
    .section-header {
        gap: 0.5rem;
        margin-bottom: 1rem;
        padding-bottom: 0.875rem;
    }
    
    .section-header h3 {
        font-size: 1.25rem;
    }
    
    .section-count {
        font-size: 0.75rem;
        padding: 0.3125rem 0.75rem;
        min-width: 28px;
    }
    
    .alerts-section {
        padding: 1.25rem;
        margin-bottom: 2rem;
    }
    
    .alert-item {
        padding: 1rem;
        gap: 0.875rem;
    }
    
    .alert-species {
        font-size: 1.0625rem;
    }
    
    .alert-location {
        font-size: 0.9375rem;
    }
    
    .alert-time {
        font-size: 0.8125rem;
        gap: 0.5rem;
    }
    
    .relative-time {
        font-size: 0.6875rem;
        padding: 0.125rem 0.4375rem;
    }
    
    .absolute-time {
        font-size: 0.6875rem;
    }
    
    .alert-action {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
        font-size: 1.375rem;
    }
    
    .empty-state {
        padding: 2.5rem 1.25rem;
    }
    
    .empty-state::before {
        font-size: 2.5rem;
        margin-bottom: 0.875rem;
    }
    
    .full-empty {
        padding: 3rem 1.5rem;
    }
    
    .full-empty::before {
        font-size: 3rem;
        margin-bottom: 1.25rem;
    }
    
    .toast {
        bottom: 1.5rem;
        padding: 0.875rem 1.25rem;
        font-size: 0.9375rem;
        max-width: 85%;
    }
}

/* Prevent horizontal overflow */
* {
    max-width: 100%;
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
}

/* ============================================
   SHEET LAYOUT BASE
   ============================================ */
body.sheet-mode {
    background-color: #f6f7f8;
    padding: 0;
}

body.sheet-mode main {
    padding: 0;
    max-width: 100%;
}

.sheet-header {
    background-color: white;
    border-bottom: 1px solid #e5e5e7;
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.sheet-header .back-link {
    color: #007AFF;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.5rem 0;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.sheet-header .back-link:active {
    opacity: 0.6;
}

/* ============================================
   ALERTS LIST CARDS
   ============================================ */
.alerts-sheet {
    padding: 1rem;
    padding-bottom: 6rem; /* Space for sticky CTA */
    max-width: 100%;
}

.sheet-header-content {
    margin-bottom: 1.5rem;
    padding: 0 0.25rem;
}

.sheet-header-content h1 {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
    color: #1d1d1f;
    letter-spacing: -0.02em;
}

.sheet-header-content .subtitle {
    font-size: 0.9375rem;
    color: #6e6e73;
    margin: 0;
    font-weight: 400;
}

.alerts-group {
    margin-bottom: 2rem;
}

.group-title {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #8e8e93;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 0.75rem 0;
    padding: 0 0.5rem;
}

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

.alert-card {
    background-color: white;
    border-radius: 14px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    min-height: 44px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.alert-card:active {
    transform: scale(0.98);
}

.alert-card-link {
    flex: 1;
    text-decoration: none;
    color: inherit;
    min-width: 0;
}

.alert-content {
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.alert-species {
    font-size: 1.0625rem;
    font-weight: 600;
    color: #1d1d1f;
    line-height: 1.3;
}

.alert-location {
    font-size: 0.9375rem;
    color: #6e6e73;
    line-height: 1.4;
}

.alert-time {
    font-size: 0.8125rem;
    color: #8e8e93;
    margin-top: 0.125rem;
}

/* ============================================
   BADGES, PILLS, SWITCHES
   ============================================ */
.alert-toggle {
    flex-shrink: 0;
    padding: 0.5rem 0.875rem;
    border-radius: 20px;
    border: none;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.375rem;
    min-height: 44px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.alert-toggle.following {
    background-color: #34C759;
    color: white;
}

.alert-toggle.muted {
    background-color: #e5e5e7;
    color: #6e6e73;
}

.alert-toggle.locked {
    background-color: #e5e5e7;
    color: #8e8e93;
    cursor: not-allowed;
    opacity: 0.7;
}

.alert-toggle.follow-unauthenticated {
    background: linear-gradient(135deg, #0088cc 0%, #0066aa 100%);
    color: white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 136, 204, 0.2);
}

.alert-toggle.follow-unauthenticated:hover {
    background: linear-gradient(135deg, #0099dd 0%, #0077bb 100%);
    box-shadow: 0 2px 6px rgba(0, 136, 204, 0.3);
}

.alert-toggle.follow-unauthenticated:active {
    transform: scale(0.95);
    box-shadow: 0 1px 3px rgba(0, 136, 204, 0.2);
}

.alert-toggle:not(.locked):active {
    transform: scale(0.95);
}

.pill-icon {
    font-size: 0.875rem;
    line-height: 1;
}

.pill-text {
    font-size: 0.875rem;
}

.status-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge.active {
    background-color: #34C759;
    color: white;
}

.status-badge.inactive {
    background-color: #8e8e93;
    color: white;
}

/* ============================================
   SIGHTING DETAIL SHEET
   ============================================ */
.sighting-sheet {
    padding: 1rem;
    padding-bottom: 2rem;
    max-width: 100%;
}

.sighting-header {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    width: 100%;
}

.sighting-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin: 0;
    color: #1d1d1f;
    letter-spacing: -0.02em;
    flex: 1;
    min-width: 0;
}

.sighting-header .status-badge {
    flex-shrink: 0;
    white-space: nowrap;
}

.sighting-header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    margin: 0;
    color: #1d1d1f;
    letter-spacing: -0.02em;
    flex: 1;
    min-width: 0;
}

.key-facts {
    background-color: white;
    border-radius: 14px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.fact-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.fact-row-clickable {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.2s ease;
    border-radius: 8px;
    margin: -0.875rem -0.5rem;
    padding: 0.875rem 0.5rem;
}

.fact-row-clickable:hover {
    background-color: rgba(0, 122, 255, 0.05);
}

.fact-row-clickable:active {
    background-color: rgba(0, 122, 255, 0.1);
}

.fact-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.fact-row:first-child {
    padding-top: 0;
}

.fact-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    width: 24px;
    text-align: center;
}

.fact-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}

.fact-label {
    font-size: 0.8125rem;
    color: #8e8e93;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.fact-value {
    font-size: 0.9375rem;
    color: #1d1d1f;
    font-weight: 500;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.fact-secondary {
    font-size: 0.8125rem;
    color: #8e8e93;
    font-weight: 400;
    margin-left: 0.5rem;
}

.map-link-icon {
    font-size: 1rem;
    line-height: 1;
    margin-left: 0.5rem;
    opacity: 0.7;
}

.field-notes-card {
    background-color: white;
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.field-notes-card h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0 0 0.75rem 0;
}

.field-notes-card p {
    font-size: 0.9375rem;
    color: #1d1d1f;
    line-height: 1.6;
    margin: 0;
}

.activity-section {
    background-color: white;
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.activity-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0 0 1rem 0;
}

.calendar-view {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* Use CSS Grid when supported, fallback to flexbox */
@supports (display: grid) {
    .calendar-view {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
        flex-wrap: nowrap;
    }
}

/* Fallback for browsers without grid support */
@supports not (display: grid) {
    .calendar-day {
        flex: 0 0 calc(14.28% - 0.43rem);
        min-width: 0;
        max-width: calc(14.28% - 0.43rem);
    }
}

.calendar-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.calendar-day-label {
    font-size: 0.75rem;
    color: #8e8e93;
    font-weight: 500;
    text-align: center;
    min-height: 1.25rem;
}

.calendar-day-square {
    width: 100%;
    min-height: 40px;
    border: 1px solid #e5e5e7;
    border-radius: 4px;
    display: flex;
    flex-direction: column;
    background-color: #fafafa;
    position: relative;
    overflow: hidden;
}

/* Use aspect-ratio for modern browsers, fallback to min-height for older ones */
@supports (aspect-ratio: 1) {
    .calendar-day-square {
        aspect-ratio: 1;
        min-height: 0;
    }
}

/* Fallback: use padding-bottom trick for square */
@supports not (aspect-ratio: 1) {
    .calendar-day-square {
        padding-bottom: 100%;
        height: 0;
        display: block;
    }
    
    .calendar-slot {
        position: absolute;
        left: 0;
        right: 0;
        width: 100%;
    }
    
    .calendar-slot.morning {
        top: 0;
        height: 50%;
    }
    
    .calendar-slot.afternoon {
        bottom: 0;
        height: 50%;
    }
}

.calendar-slot {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 20px;
}

.calendar-slot.morning {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.calendar-slot.present {
    background-color: rgba(52, 199, 89, 0.15);
}

.calendar-slot.absent {
    background-color: rgba(255, 59, 48, 0.1);
}

.calendar-icon {
    font-size: 0.875rem;
    font-weight: 700;
    line-height: 1;
}

.calendar-icon.present {
    color: #34C759;
}

.calendar-icon.absent {
    color: #FF3B30;
}

.calendar-legend {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: #6e6e73;
}

.legend-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 2px;
}

.legend-icon.present {
    color: #34C759;
    background-color: rgba(52, 199, 89, 0.15);
}

.legend-icon.absent {
    color: #FF3B30;
    background-color: rgba(255, 59, 48, 0.1);
}

.updates-section {
    background-color: white;
    border-radius: 14px;
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.updates-section h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #1d1d1f;
    margin: 0 0 1rem 0;
}

.updates-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.update-item {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
}

.update-time {
    font-size: 0.8125rem;
    color: #8e8e93;
    font-weight: 500;
    flex-shrink: 0;
    width: 80px;
    min-width: 80px;
}

.update-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    min-width: 0;
}

.update-status-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    margin-top: 0.125rem;
}

.update-status-icon.present {
    background-color: #34C759;
    color: white;
}

.update-status-icon.absent {
    background-color: #FF3B30;
    color: white;
}

.update-status-icon.unknown {
    background-color: #e5e5e7;
    color: #8e8e93;
}

.update-text {
    font-size: 0.9375rem;
    color: #1d1d1f;
    line-height: 1.5;
    flex: 1;
    min-width: 0;
}

/* ============================================
   STICKY CTA
   ============================================ */
.sticky-cta {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: white;
    border-top: 1px solid #e5e5e7;
    padding: 1rem;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cta-button {
    display: block;
    width: 100%;
    padding: 0.875rem 1.25rem;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.cta-button.primary {
    background-color: #007AFF;
    color: white;
}

.cta-button.primary:active {
    background-color: #0051D5;
    transform: scale(0.98);
}

.cta-button.secondary {
    background-color: #e5e5e7;
    color: #1d1d1f;
}

.cta-button.secondary:active {
    background-color: #d1d1d6;
    transform: scale(0.98);
}

.cta-banner {
    background-color: white;
    border-radius: 14px;
    padding: 1.25rem;
    margin-top: 1rem;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.cta-banner p {
    font-size: 0.9375rem;
    color: #6e6e73;
    margin: 0 0 1rem 0;
}

/* ============================================
   MODAL
   ============================================ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background-color: white;
    border-radius: 16px;
    padding: 1.5rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.modal-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0 0 0.75rem 0;
    color: #1d1d1f;
}

.modal-content p {
    font-size: 0.9375rem;
    color: #6e6e73;
    margin: 0 0 1.5rem 0;
    line-height: 1.5;
}

.modal-close {
    margin-top: 1rem;
    width: 100%;
    padding: 0.75rem;
    background-color: #e5e5e7;
    color: #1d1d1f;
    border: none;
    border-radius: 10px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 44px;
}

.modal-close:active {
    background-color: #d1d1d6;
    transform: scale(0.98);
}

/* ============================================
   TOAST NOTIFICATIONS (Updated)
   ============================================ */
.toast {
    position: fixed;
    bottom: 6rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: linear-gradient(135deg, #1d1d1f 0%, #2d2d2f 100%);
    color: white;
    padding: 1rem 1.25rem;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    display: flex;
    align-items: center;
    gap: 1rem;
    max-width: 90%;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.9375rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-undo {
    background: rgba(0, 122, 255, 0.2);
    border: 1px solid rgba(0, 122, 255, 0.3);
    color: #5ac8fa;
    font-weight: 600;
    cursor: pointer;
    padding: 0.375rem 0.875rem;
    margin-left: auto;
    font-size: 0.875rem;
    border-radius: 6px;
    transition: all 0.2s ease;
    min-height: 32px;
}

.toast-undo:hover {
    background: rgba(0, 122, 255, 0.3);
    border-color: rgba(0, 122, 255, 0.5);
}

.toast-undo:active {
    opacity: 0.7;
    transform: scale(0.95);
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
/* Telegram browser banner */
#telegram-browser-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #0088cc 0%, #0066aa 100%);
    color: white;
    z-index: 10000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    padding: 0.75rem 1rem;
}

.telegram-banner-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 100%;
}

.telegram-banner-content span {
    font-size: 0.875rem;
    font-weight: 500;
    flex: 1;
}

.telegram-banner-button {
    background-color: white;
    color: #0088cc;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    min-height: 36px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}

.telegram-banner-button:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Add padding to body when banner is present */
/* Using body class instead of :has() for better webview compatibility */
body.has-telegram-banner {
    padding-top: 3.5rem;
}

body.sheet-mode.has-telegram-banner {
    padding-top: 3.5rem;
}

body.sheet-mode.has-telegram-banner .sheet-header {
    top: 3.5rem;
}

@media (max-width: 430px) {
    .alerts-sheet,
    .sighting-sheet {
        padding: 0.875rem;
    }
    
    .sheet-header-content h1 {
        font-size: 1.75rem;
    }
    
    .sighting-header h1 {
        font-size: 1.625rem;
    }
    
    .alert-card {
        padding: 0.875rem;
    }
    
    .alert-species {
        font-size: 1rem;
    }
    
    .alert-toggle {
        padding: 0.4375rem 0.75rem;
        font-size: 0.8125rem;
        min-height: 40px;
    }
    
    .calendar-view {
        gap: 0.375rem;
    }
    
    .calendar-day-label {
        font-size: 0.6875rem;
    }
    
    .calendar-icon {
        font-size: 0.75rem;
    }
    
    .calendar-legend {
        gap: 1rem;
        font-size: 0.75rem;
    }
    
    .legend-icon {
        width: 14px;
        height: 14px;
        font-size: 0.6875rem;
    }
    
    .toast {
        bottom: 2rem;
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
}

/* ========================================
   Admin Dashboard Styles
   ======================================== */

.admin-header {
    background: #2c3e50;
    color: white;
    padding: 1rem 2rem;
    margin-bottom: 2rem;
}

.admin-header-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.admin-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.admin-header h1 a {
    color: white;
    text-decoration: none;
}

.admin-nav {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-nav a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.2s;
}

.admin-nav a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.admin-container {
    width: 100%;
    margin: 0;
    padding: 1rem;
    box-sizing: border-box;
    overflow-x: visible;
}

@media (min-width: 1200px) {
    .admin-container {
        padding: 1.5rem;
    }
}

.admin-message {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.admin-message-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.admin-message-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.admin-page {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    width: 100%;
    box-sizing: border-box;
    overflow-x: visible;
}

.admin-page h2 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.5rem;
}

.admin-section {
    margin-bottom: 1.5rem;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-section h3 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    color: #34495e;
    font-size: 1.1rem;
}

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

.admin-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #3498db;
}

.admin-card h3 {
    margin: 0 0 0.5rem;
    font-size: 0.9rem;
    color: #7f8c8d;
    text-transform: uppercase;
    font-weight: 600;
}

.admin-stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.admin-stat-detail {
    font-size: 0.9rem;
    color: #7f8c8d;
}

.admin-table {
    width: 100%;
    min-width: 100%;
    border-collapse: collapse;
    background: white;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    table-layout: auto;
}

.admin-table th {
    background: #f8f9fa;
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.85rem;
    white-space: nowrap;
}

.sortable-header {
    text-decoration: none;
    color: inherit;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.sortable-header:hover {
    color: #007AFF;
}

.sort-arrow {
    font-size: 0.8em;
    color: #007AFF;
}

.admin-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid #dee2e6;
    vertical-align: middle;
}

.admin-table tr:hover {
    background: #f8f9fa;
}

.admin-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.admin-badge-success {
    background: #d4edda;
    color: #155724;
}

.admin-badge-error {
    background: #f8d7da;
    color: #721c24;
}

.admin-badge-neutral {
    background: #e2e3e5;
    color: #383d41;
}

/* Status Icons */
.admin-status-icon {
    text-align: center;
    width: 40px;
}

.status-icon {
    display: inline-block;
    font-size: 1.2rem;
    line-height: 1;
    font-weight: bold;
}

.status-icon.status-active {
    color: #27ae60;
}

.status-icon.status-closed {
    color: #95a5a6;
}

.admin-link {
    color: #3498db;
    text-decoration: none;
    margin-right: 1rem;
}

.admin-link:hover {
    text-decoration: underline;
}

.admin-link-danger {
    color: #e74c3c;
}

.admin-action-buttons {
    white-space: nowrap;
}

.admin-action-buttons .admin-link,
.admin-action-buttons button {
    display: inline-block;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.admin-table td.location {
    max-width: 250px;
    word-break: break-word;
}

.admin-table td.admin-date {
    white-space: nowrap;
    font-size: 0.85rem;
}

.admin-table td.admin-number {
    text-align: center;
    font-weight: 600;
    color: #7f8c8d;
}

.admin-form {
    max-width: 600px;
    margin-top: 1rem;
}

.admin-form-group {
    margin-bottom: 1.5rem;
}

.admin-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.admin-input,
.admin-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
}

.admin-input:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.admin-button {
    padding: 0.75rem 1.5rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
    display: inline-block;
}

.admin-button:hover {
    background: #2980b9;
}

.admin-filters {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 4px;
}

.admin-filter-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.admin-filter-form input,
.admin-filter-form select {
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.9rem;
}

.admin-filter-form button {
    padding: 0.5rem 1rem;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
}

.admin-filter-form button:hover {
    background: #2980b9;
}

.admin-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.admin-pagination-link {
    padding: 0.5rem 1rem;
    background: #3498db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
}

.admin-pagination-link:hover {
    background: #2980b9;
}

.admin-pagination-info {
    color: #7f8c8d;
}

.admin-detail-section {
    margin-bottom: 2rem;
}

.admin-code-block {
    background: #f4f4f4;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    max-height: 500px;
    overflow-y: auto;
}

.admin-error-text {
    color: #e74c3c;
    font-weight: 600;
}

.admin-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.admin-button {
    padding: 0.75rem 1.5rem;
    background: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
    display: inline-block;
}

.admin-button:hover {
    background: #2980b9;
}

.admin-button-danger {
    background: #e74c3c;
}

.admin-button-danger:hover {
    background: #c0392b;
}

.admin-form {
    max-width: 500px;
}

.admin-form-group {
    margin-bottom: 1rem;
}

.admin-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.admin-input,
.admin-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 1rem;
}

.admin-warning-section {
    background: #fff3cd;
    padding: 1rem;
    border-radius: 4px;
    border-left: 4px solid #ffc107;
    margin-bottom: 2rem;
}

.admin-danger-section {
    background: #f8f9fa;
    padding: 1.5rem;
    border-radius: 4px;
    border-left: 4px solid #e74c3c;
    margin-top: 2rem;
}

.admin-danger-section h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.admin-danger-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.admin-button-warning {
    background: #f39c12;
}

.admin-button-warning:hover {
    background: #e67e22;
}

.admin-duplicate-row {
    background: #fff3cd;
}

.admin-duplicate-row:hover {
    background: #ffeaa7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .admin-page {
        padding: 1rem;
    }
    
    .admin-header-content {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .admin-nav {
        width: 100%;
    }
    
    .admin-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-table {
        font-size: 0.8rem;
        min-width: 600px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .admin-table td.location {
        max-width: 150px;
    }
    
    .admin-filter-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .admin-filter-form input,
    .admin-filter-form select,
    .admin-filter-form button {
        width: 100%;
    }
    
    .admin-action-buttons {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .admin-action-buttons .admin-link {
        flex: 1;
        min-width: 80px;
        text-align: center;
        padding: 0.4rem 0.6rem;
    }
    
    .admin-danger-actions {
        flex-direction: column;
    }
    
    .admin-danger-actions .admin-button {
        width: 100%;
    }
    
    .admin-table td.location {
        max-width: none;
    }
    
    .admin-table td.admin-date {
        white-space: normal;
    }
}
