html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    height: 100%;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow: hidden;
    /* Prevent overscroll/bounce on iOS */
    overscroll-behavior: none;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

/* Layout - Mobile First */
.page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile - accounts for browser chrome */
    overflow: hidden;
    position: relative;
}

main {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Important for flex children to shrink properly */
    overflow: hidden;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Top Row / Header */
.top-row {
    background-color: #1b6ec2;
    color: white;
    border-bottom: 1px solid #1861ac;
    height: 3.5rem;
    min-height: 3.5rem; /* Prevent shrinking */
    display: flex;
    align-items: center;
    padding: 0 1rem;
    flex-shrink: 0;
    z-index: 100;
}

.app-logo {
    flex: 1;
    display: flex;
    align-items: center;
}

.logo-image {
    height: 2rem;
    width: auto;
    filter: brightness(0) invert(1); /* Make logo white for blue header */
}

.top-row a, .top-row .btn-link {
    whitespace: nowrap;
    margin-left: 1.5rem;
    color: white;
}

.top-row a:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-row-end {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.top-row-end > * {
    display: inline-flex;
    align-items: center;
}

/* Home Switcher */
.home-switcher {
    display: flex;
    align-items: center;
}

.home-select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: inherit;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    min-height: 36px;
    max-width: 180px;
    text-overflow: ellipsis;
}

.home-select:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.home-select:focus {
    outline: none;
    border-color: rgba(255, 255, 255, 0.7);
}

.home-select option {
    background: #1b6ec2;
    color: white;
}

.home-name {
    font-weight: 500;
    font-size: 0.875rem;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Hamburger Menu Button */
.hamburger-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.75rem;
    cursor: pointer;
    padding: 0.5rem;
    margin-right: 1rem;
    min-height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hamburger-icon {
    display: block;
    line-height: 1;
}

/* Sidebar Navigation - Mobile: Off-canvas */
.sidebar {
    background-color: #f7f7f7;
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    height: 100dvh; /* Dynamic viewport height for mobile */
    z-index: 200;
    transition: left 0.3s ease-in-out;
    overflow: hidden;
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    left: 0;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 150;
}

/* Navigation Menu */
.nav-menu {
    padding: 1rem 0;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0; /* Important for overflow to work in flex children */
    box-sizing: border-box;
}

.nav-menu nav {
    flex: 1;
    overflow-y: auto;
    min-height: 0; /* Allow shrinking */
    -webkit-overflow-scrolling: touch;
}

.nav-version {
    padding: 0.75rem 1.5rem;
    font-size: 0.75rem;
    color: #718096;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
    background-color: #f7f7f7; /* Match sidebar background */
}

.nav-item {
    padding: 0;
}

.nav-link {
    display: block;
    padding: 0.75rem 1.5rem;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
    min-height: 44px;
    display: flex;
    align-items: center;
}

.nav-link:hover {
    background-color: #e2e8f0;
}

.nav-link.active {
    background-color: #1b6ec2;
    color: white;
}

.nav-link span {
    font-size: 1rem;
}

/* Content Area */
.content {
    padding: 1rem;
}

.px-4 {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Table Styles - Mobile: Card Layout */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    overflow-x: auto;
    display: block;
}

.table thead {
    display: none;
}

.table tbody {
    display: block;
}

.table tr {
    display: block;
    margin-bottom: 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 1rem;
    background-color: white;
}

.table td {
    display: block;
    text-align: left !important;
    padding: 0.5rem 0;
    border: none;
}

.table td:before {
    content: attr(data-label);
    font-weight: bold;
    display: block;
    margin-bottom: 0.25rem;
    color: #4a5568;
}

.table td:first-child {
    border-top: none;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 5px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

/* Button Styles - Touch Friendly */
button, .btn-primary, .btn-secondary, .btn-small, .btn-danger {
    border: none;
    border-radius: 6px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    text-align: center;
    display: inline-block;
    min-height: 44px; /* Minimum touch target size */
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn-primary:hover {
    background-color: #1861ac;
}

.btn-secondary {
    color: #333;
    background-color: #e2e8f0;
    border: 1px solid #cbd5e0;
}

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

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    min-height: 44px; /* Phase 17.1: Enforce 44px touch target minimum */
}

.btn-danger {
    background-color: #e53e3e;
    color: white;
}

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

.btn-success {
    background-color: #2E7D32;
    color: white;
}

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

/* Page action row - horizontal on desktop, wraps on mobile */
.page-actions-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

@media (max-width: 480px) {
    .page-actions-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .page-actions-row > button {
        text-align: center;
        min-height: 44px;
    }
}

/* Form Styles - Touch Friendly */
.form-input, input[type="text"], input[type="number"], input[type="date"],
input[type="datetime-local"], textarea, select {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    box-sizing: border-box;
    min-height: 44px;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.form-container {
    background-color: white;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.form-container h3 {
    margin-top: 0;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

.error-message {
    background-color: #fff5f5;
    border: 1px solid #fc8181;
    color: #c53030;
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.success-message {
    background-color: #f0fff4;
    border: 1px solid #68d391;
    color: #22543d;
    padding: 0.75rem;
    border-radius: 6px;
    margin-top: 1rem;
}

/* Plant Card Styles */
.plant-card {
    background-color: white;
    border: 1px solid #cbd5e0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 1rem;
}

.plant-info {
    flex: 1;
}

.plant-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.plant-details {
    font-size: 0.875rem;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.care-status {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.875rem;
}

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

/* Plant Card Image */
.plant-image-container {
    flex-shrink: 0;
}

/* Note: .plant-card-image styles are now defined in Plants.razor scoped styles */

.plant-image-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    background-color: #f0fff4;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #48bb78;
}

.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e2e8f0;
    border-top-color: #48bb78;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Detail Pages */
.detail-card {
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.detail-card h3 {
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: #2d3748;
    border-bottom: 2px solid #1b6ec2;
    padding-bottom: 0.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.detail-item {
    padding: 0.5rem 0;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item strong {
    display: block;
    margin-bottom: 0.25rem;
    color: #4a5568;
    font-size: 0.875rem;
}

.detail-item span {
    color: #2d3748;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHR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DI1NC4yNyAxOS4wNzA5IDI1Mi45MzYgMTcuMzQ5NSAyNTEuNTQ4IDE1LjYwNCAyNTAuMTA1IDEzLjgzMzEgMjQ4LjYwNyAxMi4wMzQ4IDI0Ny4wNTQgMTAuMjA3NSAyNDUuNDQ2IDguMzQ5NTYgMjQzLjc4MiA2LjQ1OTY4IDI0Mi4wNjMgNC41MzYzOSAyNDAuMjg4IDIuNTc4MTYgMjM4LjQ1OCAwLjU4MzU1NyAyMzYuNTcyIDEuMjk0MDZlLTAzIDIzNC42MyAwLjAxODQyMSAyMzUuNzUgMC4wMTg0MjEgMjM1Ljc1IDAuMDE4NDIxIDIzNS43NSAwLjAxODQyMSAyMzUuNzUgMC4wMTg0MjEgMjM1Ljc1IDAuMDE4NDIxIDIzNS43NSAwLjAxODQyMSAyMzUuNzUgMC4wMTg0MjEgMjM1Ljc1IDAuMDE4NDIxIDIzNS43NSAwLjAxODQyMSAyMzUuNzUgMC4wMTg0MjEgMjM1Ljc1IjogZmlsbD0iI0ZGRkZGRiIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* Responsive Typography */
h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: #2d3748;
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: #2d3748;
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    color: #718096;
}

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

/* Utility Classes */
.flex-column {
    display: flex;
    flex-direction: column;
}

.flex {
    display: flex;
}

.gap-1 {
    gap: 0.25rem;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.mt-1 {
    margin-top: 0.25rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-1 {
    margin-bottom: 0.25rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

/* Touch-friendly checkboxes */
input[type="checkbox"] {
    width: 24px;
    height: 24px;
    cursor: pointer;
}

/* Desktop Styles - 768px and up */
@media (min-width: 768px) {
    .page {
        flex-direction: row;
    }

    .hamburger-btn {
        display: none;
    }

    .sidebar {
        position: sticky;
        left: auto;
        transform: none;
        width: 250px;
        height: 100vh;
        height: 100dvh;
        top: 0;
        box-shadow: none;
        transition: none;
        flex-shrink: 0;
    }

    .sidebar.open {
        left: auto;
    }

    .sidebar-overlay {
        display: none !important;
    }

    main {
        flex: 1;
        min-width: 0; /* Prevent overflow on narrow content */
    }

    .top-row {
        background-color: #f7f7f7;
        color: #333;
        border-bottom: 1px solid #d6d5d5;
        padding-left: 2rem;
    }

    .top-row h1 {
        color: #333;
        font-size: 1.5rem;
    }

    /* Desktop home switcher styles */
    .home-select {
        background: rgba(0, 0, 0, 0.05);
        border-color: rgba(0, 0, 0, 0.2);
        color: #333;
    }

    .home-select:hover {
        background: rgba(0, 0, 0, 0.1);
        border-color: rgba(0, 0, 0, 0.3);
    }

    .home-select:focus {
        border-color: #1b6ec2;
    }

    .home-select option {
        background: white;
        color: #333;
    }

    .home-name {
        color: #333;
    }

    .content {
        padding: 1.5rem 2rem;
    }

    /* Desktop table styles */
    .table {
        display: table;
    }

    .table thead {
        display: table-header-group;
    }

    .table tbody {
        display: table-row-group;
    }

    .table tr {
        display: table-row;
        margin-bottom: 0;
        border: none;
        border-radius: 0;
        padding: 0;
        background-color: transparent;
    }

    .table thead tr {
        background-color: #f7f7f7;
    }

    .table td {
        display: table-cell;
        padding: 0.75rem;
        border-bottom: 1px solid #e2e8f0;
    }

    .table th {
        padding: 0.75rem;
        text-align: left;
        border-bottom: 2px solid #cbd5e0;
        font-weight: 600;
    }

    .table td:before {
        display: none;
    }

    h2 {
        font-size: 2rem;
    }

    h3 {
        font-size: 1.5rem;
    }

    .plant-card {
        flex-direction: row;
        align-items: center;
    }

    .plant-actions {
        flex-shrink: 0;
    }

    input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }
}

/* ===================================
   PWA Install Prompt
   =================================== */

.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateY(0);
    transition: transform 0.3s ease-out, opacity 0.3s ease-out;
    opacity: 1;
}

.install-prompt.dismissed {
    transform: translateY(100%);
    opacity: 0;
}

.install-prompt-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.install-prompt-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    color: #2E7D32;
}

.install-prompt-text {
    flex: 1;
    min-width: 0;
}

.install-prompt-title {
    font-weight: 600;
    font-size: 1rem;
    color: #1a1a1a;
    margin-bottom: 0.25rem;
}

.install-prompt-subtitle {
    font-size: 0.875rem;
    color: #666;
}

.install-prompt-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.install-btn {
    background: #2E7D32;
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.install-btn:hover {
    background: #256628;
}

.install-btn:active {
    background: #1e5620;
}

.dismiss-btn {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.dismiss-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
    color: #333;
}

/* Mobile responsiveness for install prompt */
@media (max-width: 480px) {
    .install-prompt-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .install-prompt-icon {
        align-self: flex-start;
    }

    .install-prompt-text {
        margin-bottom: 0.5rem;
    }

    .install-prompt-subtitle {
        display: none; /* Hide subtitle on very small screens */
    }

    .install-prompt-actions {
        width: 100%;
        flex-direction: row;
    }

    .install-btn,
    .dismiss-btn {
        flex: 1;
        text-align: center;
    }
}

/* ===================================
   PWA Update Notification
   =================================== */

.update-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #2E7D32 0%, #388E3C 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1001; /* Higher than install prompt */
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.update-notification-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.update-notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: white;
    animation: spin 2s linear infinite;
}

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

.update-notification-text {
    flex: 1;
    min-width: 0;
}

.update-notification-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    margin-bottom: 0.125rem;
}

.update-notification-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
}

.update-notification-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.update-btn {
    background: white;
    color: #2E7D32;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.update-btn:hover {
    background: #f5f5f5;
    transform: scale(1.05);
}

.update-btn:active {
    background: #e0e0e0;
    transform: scale(0.95);
}

.update-dismiss-btn {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.update-dismiss-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Mobile responsiveness for update notification */
@media (max-width: 480px) {
    .update-notification-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .update-notification-icon {
        align-self: flex-start;
    }

    .update-notification-subtitle {
        display: none;
    }

    .update-notification-actions {
        width: 100%;
    }

    .update-btn,
    .update-dismiss-btn {
        flex: 1;
        text-align: center;
    }
}

/* ===================================
   Notification Permission Banner (Phase 15)
   =================================== */

.notification-permission-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #1976D2 0%, #1565C0 100%);
    color: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideUpBanner 0.3s ease-out;
}

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

.notification-permission-content {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

.notification-permission-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    color: white;
    animation: bellRing 2s ease-in-out infinite;
}

@keyframes bellRing {
    0%, 100% {
        transform: rotate(0deg);
    }
    10% {
        transform: rotate(15deg);
    }
    20% {
        transform: rotate(-15deg);
    }
    30% {
        transform: rotate(10deg);
    }
    40% {
        transform: rotate(-10deg);
    }
    50% {
        transform: rotate(0deg);
    }
}

.notification-permission-text {
    flex: 1;
    min-width: 0;
}

.notification-permission-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    margin-bottom: 0.125rem;
}

.notification-permission-subtitle {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
}

.notification-permission-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.notification-enable-btn {
    background: white;
    color: #1976D2;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.notification-enable-btn:hover:not(:disabled) {
    background: #f5f5f5;
    transform: scale(1.05);
}

.notification-enable-btn:active:not(:disabled) {
    background: #e0e0e0;
    transform: scale(0.95);
}

.notification-enable-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.notification-dismiss-btn {
    background: transparent;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.notification-dismiss-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.8);
}

/* Mobile responsiveness for notification permission banner */
@media (max-width: 480px) {
    .notification-permission-content {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    .notification-permission-icon {
        align-self: flex-start;
    }

    .notification-permission-subtitle {
        display: none;
    }

    .notification-permission-actions {
        width: 100%;
    }

    .notification-enable-btn,
    .notification-dismiss-btn {
        flex: 1;
        text-align: center;
    }
}

/* ===================================
   Offline Indicator
   =================================== */

.offline-indicator {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #FF9800 0%, #F57C00 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    z-index: 1000;
    animation: slideUp 0.3s ease-out;
}

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

.offline-indicator-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
}

.offline-indicator-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    color: white;
}

.offline-indicator-text {
    font-size: 0.875rem;
    font-weight: 500;
    color: white;
    white-space: nowrap;
}

/* Mobile responsiveness for offline indicator */
@media (max-width: 480px) {
    .offline-indicator {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .offline-indicator-content {
        justify-content: center;
    }
}

/* ===================================
   User Menu
   =================================== */

.user-menu {
    position: relative;
}

.user-menu-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.user-menu-button:hover {
    background: #f5f5f5;
    border-color: #2E7D32;
}

.user-name {
    font-weight: 500;
    color: #333;
}

.dropdown-arrow {
    color: #666;
    font-size: 0.8rem;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    z-index: 1000;
}

.user-info {
    padding: 1rem;
}

.user-email {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.user-provider {
    font-size: 0.8rem;
    color: #666;
}

.user-menu-dropdown hr {
    margin: 0;
    border: none;
    border-top: 1px solid #eee;
}

.menu-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    color: #333;
    transition: background 0.2s ease;
}

.menu-item:hover {
    background: #f5f5f5;
}

.menu-item.logout {
    color: #d32f2f;
}

.menu-item.logout:hover {
    background: #fee;
}

.btn-login {
    padding: 0.5rem 1.5rem;
    background: #2E7D32;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-login:hover {
    background: #25682a;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.3);
}

@media (max-width: 768px) {
    .user-menu-dropdown {
        right: -1rem;
    }
}

/* ===================================
   Seed Inventory Warnings & Status
   =================================== */

/* Alert Banner */
.alert-banner {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 8px;
}

.alert-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-item.warning {
    color: #856404;
}

.alert-item.danger {
    color: #721c24;
}

/* Warning row styles */
.row-inactive {
    opacity: 0.5;
}

.row-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
}

.row-expired {
    background-color: rgba(220, 53, 69, 0.1) !important;
}

/* Desktop: table row hover with warning states */
@media (min-width: 768px) {
    .table tbody tr.row-warning:hover {
        background-color: rgba(255, 193, 7, 0.2) !important;
    }

    .table tbody tr.row-expired:hover {
        background-color: rgba(220, 53, 69, 0.2) !important;
    }
}

/* Mobile: card warning styles */
@media (max-width: 767px) {
    .table tr.row-warning {
        border-color: #ffc107;
        border-width: 2px;
    }

    .table tr.row-expired {
        border-color: #dc3545;
        border-width: 2px;
    }
}

/* Inline badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-left: 0.25rem;
    font-size: 0.75rem;
}

.badge-warning {
    color: #856404;
}

.badge-danger {
    color: #721c24;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-badge.active {
    background-color: #d4edda;
    color: #155724;
}

.status-badge.inactive {
    background-color: #e2e8f0;
    color: #4a5568;
}

.status-badge.low {
    background-color: #fff3cd;
    color: #856404;
}

.status-badge.expired {
    background-color: #f8d7da;
    color: #721c24;
}

.status-badge.empty {
    background-color: #e2e8f0;
    color: #718096;
}

/* Text colors for summary */
.text-warning {
    color: #856404;
}

.text-danger {
    color: #dc3545;
}

/* ===================================
   Sort Controls
   =================================== */

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

.sort-group label {
    font-size: 0.875rem;
    color: #4a5568;
    white-space: nowrap;
}

.sort-select {
    width: auto;
    min-width: 140px;
    padding: 0.5rem;
    min-height: auto;
}

/* Toolbar layout */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    align-items: center;
}

@media (max-width: 600px) {
    .sort-group {
        width: 100%;
        justify-content: space-between;
    }

    .sort-select {
        flex: 1;
    }
}

/* ===================================
   Phase 17 - Mobile UI Enhancements
   =================================== */

/* ---------------------------------
   17.1 Global Mobile Improvements
   --------------------------------- */

/* Touch Target Enforcement */
.touch-target {
    min-height: 44px;
    min-width: 44px;
}

/* Full-width action buttons on narrow screens */
@media (max-width: 480px) {
    .btn-full-mobile {
        width: 100%;
    }

    /* Form actions stack vertically */
    .form-actions {
        flex-direction: column;
    }

    .form-actions > button,
    .form-actions > .btn-primary,
    .form-actions > .btn-secondary,
    .form-actions > .btn-danger {
        width: 100%;
    }

    /* Page action buttons stack on very narrow screens */
    .page-actions {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
    }

    .page-actions > button,
    .page-actions > a {
        width: 100%;
        text-align: center;
    }
}

/* Button Groups - Stack vertically on mobile */
.btn-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .btn-group {
        flex-direction: column;
    }

    .btn-group > button,
    .btn-group > .btn-primary,
    .btn-group > .btn-secondary,
    .btn-group > .btn-danger,
    .btn-group > a {
        width: 100%;
        text-align: center;
    }

    .btn-group-horizontal-mobile {
        flex-direction: row;
    }

    .btn-group-horizontal-mobile > button,
    .btn-group-horizontal-mobile > a {
        flex: 1;
    }
}

/* ---------------------------------
   Horizontal Scrolling Tab Bar
   --------------------------------- */
.tab-bar {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e2e8f0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-behavior: smooth;
    padding-bottom: 2px; /* Ensure border is visible */
}

.tab-bar::-webkit-scrollbar {
    display: none;
}

.tab-bar .tab-button {
    flex-shrink: 0;
    white-space: nowrap;
    padding: 0.75rem 1rem;
    min-width: fit-content;
}

/* Tab scroll indicators */
.tab-bar-container {
    position: relative;
}

.tab-bar-container::before,
.tab-bar-container::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 2px;
    width: 20px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity 0.2s;
}

.tab-bar-container::before {
    left: 0;
    background: linear-gradient(to right, white, transparent);
}

.tab-bar-container::after {
    right: 0;
    background: linear-gradient(to left, white, transparent);
}

.tab-bar-container.scroll-left::before {
    opacity: 1;
}

.tab-bar-container.scroll-right::after {
    opacity: 1;
}

@media (max-width: 768px) {
    .tab-bar .tab-button {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .tab-bar .tab-button {
        padding: 0.5rem 0.625rem;
        font-size: 0.8125rem;
    }
}

/* ---------------------------------
   Modal/Dialog Mobile Optimization
   --------------------------------- */
.modal-overlay {
    padding: 1rem;
    box-sizing: border-box;
}

.modal {
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal {
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        padding: 1.5rem 1rem calc(env(safe-area-inset-bottom) + 1rem);
        max-height: 90vh;
        max-height: 90dvh;
        animation: slideUpModal 0.3s ease-out;
    }

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

    .modal-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
        margin-top: 1.5rem;
    }

    .modal-actions > button {
        width: 100%;
        min-height: 48px;
    }

    /* Primary action first in reversed column */
    .modal-actions > .btn-primary,
    .modal-actions > .btn-danger {
        order: -1;
    }
}

/* Full-screen modal option for complex forms */
.modal-fullscreen-mobile {
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    margin: 0;
}

@media (max-width: 480px) {
    .modal-fullscreen-mobile {
        border-radius: 0;
        animation: none;
    }
}

/* ---------------------------------
   Form Keyboard Handling
   --------------------------------- */
/* Visual Viewport - fixes iOS keyboard issues */
@supports (height: 100dvh) {
    .main-content {
        height: 100dvh;
    }
}

/* Improve form focus on mobile */
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #1b6ec2;
    outline-offset: 2px;
}

/* Prevent zoom on iOS when focusing inputs */
@media (max-width: 768px) {
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="password"],
    input[type="search"],
    input[type="tel"],
    input[type="url"],
    input[type="date"],
    input[type="datetime-local"],
    input[type="time"],
    textarea,
    select {
        font-size: 16px; /* Prevents iOS zoom */
    }
}

/* Form input group for inline label/input */
.form-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 480px) {
    .form-input-group.inline {
        flex-direction: row;
        align-items: center;
    }

    .form-input-group.inline label {
        flex-shrink: 0;
        width: 150px;
    }

    .form-input-group.inline input,
    .form-input-group.inline select,
    .form-input-group.inline textarea {
        flex: 1;
    }
}

/* Sticky form actions at bottom on mobile */
.form-actions-sticky {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

@media (max-width: 768px) {
    .form-actions-sticky {
        position: sticky;
        bottom: 0;
        background: white;
        padding: 1rem;
        margin: 1rem -1rem -1rem;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        z-index: 10;
    }

    .form-actions-sticky button {
        flex: 1;
        min-width: 0;
    }
}

/* ---------------------------------
   Quick Action Floating Button (FAB)
   --------------------------------- */
.fab {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom) + 1rem);
    right: 1rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #1b6ec2;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(27, 110, 194, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 100;
    transition: transform 0.2s, box-shadow 0.2s;
}

.fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(27, 110, 194, 0.5);
}

.fab:active {
    transform: scale(0.95);
}

.fab-success {
    background: #2E7D32;
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.4);
}

.fab-success:hover {
    box-shadow: 0 6px 16px rgba(46, 125, 50, 0.5);
}

/* FAB with expandable actions */
.fab-container {
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom) + 1rem);
    right: 1rem;
    z-index: 100;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.75rem;
}

.fab-actions {
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
    opacity: 0;
    transform: scale(0.8) translateY(10px);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s;
}

.fab-container.open .fab-actions {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.fab-action {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: white;
    color: #333;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: transform 0.2s, background 0.2s;
}

.fab-action:hover {
    background: #f7fafc;
    transform: scale(1.1);
}

.fab-action-label {
    position: absolute;
    right: 100%;
    margin-right: 0.75rem;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.375rem 0.75rem;
    border-radius: 4px;
    font-size: 0.875rem;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.2s;
}

.fab-action:hover .fab-action-label {
    opacity: 1;
}

/* Hide FAB on desktop if not needed */
@media (min-width: 768px) {
    .fab-mobile-only {
        display: none;
    }
}

/* ---------------------------------
   Collapsible Sections
   --------------------------------- */
.collapsible {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.collapsible-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: #f7fafc;
    cursor: pointer;
    user-select: none;
    min-height: 44px;
    transition: background 0.2s;
}

.collapsible-header:hover {
    background: #edf2f7;
}

.collapsible-header h3,
.collapsible-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.collapsible-icon {
    font-size: 1.25rem;
    color: #718096;
    transition: transform 0.2s;
}

.collapsible.open .collapsible-icon {
    transform: rotate(180deg);
}

.collapsible-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.collapsible.open .collapsible-content {
    max-height: 2000px; /* Large enough for content */
}

.collapsible-body {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
}

/* ---------------------------------
   Swipe Actions (for list items)
   --------------------------------- */
.swipe-container {
    position: relative;
    overflow: hidden;
}

.swipe-content {
    position: relative;
    z-index: 1;
    background: white;
    transition: transform 0.2s ease-out;
}

.swipe-actions {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: stretch;
    z-index: 0;
}

.swipe-actions-left {
    left: 0;
    right: auto;
}

.swipe-action {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1.5rem;
    color: white;
    font-weight: 500;
    min-width: 80px;
}

.swipe-action-water {
    background: #3182ce;
}

.swipe-action-edit {
    background: #ed8936;
}

.swipe-action-delete {
    background: #e53e3e;
}

/* ---------------------------------
   Mobile Card Optimizations
   --------------------------------- */
.card-compact {
    padding: 0.75rem;
}

.card-compact .plant-name {
    font-size: 1rem;
}

.card-compact .plant-details {
    font-size: 0.8125rem;
}

.card-compact .plant-image-placeholder,
.card-compact .plant-card-image {
    width: 60px;
    height: 60px;
}

/* Two-column grid on tablets, single column on phones */
.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 480px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

/* ---------------------------------
   Pull-to-Refresh Indicator
   --------------------------------- */
.pull-to-refresh {
    position: absolute;
    top: -50px;
    left: 0;
    right: 0;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #718096;
    font-size: 0.875rem;
}

.pull-to-refresh-icon {
    margin-right: 0.5rem;
    transition: transform 0.2s;
}

.pull-to-refresh.refreshing .pull-to-refresh-icon {
    animation: spin 1s linear infinite;
}

/* ---------------------------------
   Bottom Sheet Component
   --------------------------------- */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.bottom-sheet-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.bottom-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    border-radius: 16px 16px 0 0;
    z-index: 1001;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    max-height: 90vh;
    max-height: 90dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.bottom-sheet-overlay.open .bottom-sheet {
    transform: translateY(0);
}

.bottom-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 0.75rem;
    cursor: grab;
}

.bottom-sheet-handle::before {
    content: '';
    width: 40px;
    height: 4px;
    background: #cbd5e0;
    border-radius: 2px;
}

.bottom-sheet-header {
    padding: 0 1rem 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.bottom-sheet-header h3 {
    margin: 0;
    font-size: 1.125rem;
}

.bottom-sheet-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
    padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
}

/* ---------------------------------
   Safe Area Handling
   --------------------------------- */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .safe-area-bottom {
        padding-bottom: env(safe-area-inset-bottom);
    }

    .install-prompt,
    .notification-permission-banner {
        padding-bottom: calc(env(safe-area-inset-bottom) + 1rem);
    }
}

/* ---------------------------------
   Landscape Orientation Handling
   --------------------------------- */
@media (max-height: 500px) and (orientation: landscape) {
    .top-row {
        height: 2.75rem;
        min-height: 2.75rem;
    }

    .hamburger-btn {
        font-size: 1.5rem;
        padding: 0.375rem;
    }

    .logo-image {
        height: 1.5rem;
    }

    .modal {
        max-height: calc(100vh - 1rem);
        max-height: calc(100dvh - 1rem);
    }

    .bottom-sheet {
        max-height: 85vh;
        max-height: 85dvh;
    }
}

/* ---------------------------------
   Phase 17.1a - Unified Page Styling
   --------------------------------- */

/* Page Toolbar - consistent action bar across all list pages */
.page-toolbar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    align-items: center;
}

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

@media (max-width: 480px) {
    .page-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

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

/* Filter Section - standardized filter styling */
.filter-section {
    background: #f7fafc;
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    margin-bottom: 1rem;
}

.filter-section .filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.filter-section .filter-group label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
}

.filter-section .filter-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

@media (max-width: 480px) {
    .filter-section .filter-row {
        flex-direction: column;
    }

    .filter-section .filter-group {
        width: 100%;
    }
}

/* Page Footer - consistent bottom section for list pages */
.page-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.page-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    color: #4a5568;
    flex-wrap: wrap;
}

.page-stats span {
    white-space: nowrap;
}

@media (max-width: 480px) {
    .page-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .page-stats {
        justify-content: center;
        gap: 1rem;
    }
}

/* Empty State - unified styling for empty lists */
.empty-state {
    padding: 2rem;
    text-align: center;
    color: #718096;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px dashed #e2e8f0;
}

.empty-state p {
    margin: 0 0 1rem 0;
}

.empty-state p:last-child {
    margin-bottom: 0;
}

.empty-state .btn {
    margin-top: 0.5rem;
}

/* Alert Messages - standardized alert styling */
.alert {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.alert-warning {
    background: #fef3cd;
    border-left: 4px solid #ffc107;
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-left: 4px solid #17a2b8;
    color: #0c5460;
}

.alert-success {
    background: #d4edda;
    border-left: 4px solid #28a745;
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-left: 4px solid #dc3545;
    color: #721c24;
}

/* Content Grid - unified card grid layout */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

@media (max-width: 480px) {
    .content-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 320px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* Content Cards - vertical list of cards */
.content-cards {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Standard Card Styling */
.card {
    background: white;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.card-header {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #2d3748;
}

.card-body {
    font-size: 0.9rem;
    color: #4a5568;
}

.card-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Page Header styling */
.page-header {
    margin-bottom: 1rem;
}

.page-header h2 {
    margin: 0 0 0.25rem 0;
    color: #2d3748;
}

.page-header p {
    margin: 0;
    color: #718096;
    font-size: 0.9rem;
}
