:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #0ea5a4;
    --accent: #eef2ff;
    --light: #f8fafc;
    --dark: #1e293b;
    --muted: #64748b;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --border-radius: 10px;
    --border-radius-lg: 16px;
    --box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    --box-shadow-lg: 0 12px 28px rgba(15, 23, 42, 0.12);
    --transition: all 0.2s ease;
    --sidebar-width: 260px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background: var(--light);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* Landscape Layout */
.landscape-container {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas: 
        "sidebar header"
        "sidebar main";
    min-height: 100vh;
    gap: 0;
}

/* Header */
.header {
    grid-area: header;
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid #e1e5e9;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 100;
}

.page-title {
    font-size: 1.5rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: var(--border-radius);
    border: 1px solid #e9ecef;
}

.user-info img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary);
}

.user-info div h4 {
    color: var(--dark);
    margin-bottom: 2px;
    font-size: 1rem;
}

.user-info div p {
    color: #6c757d;
    font-size: 0.85rem;
    text-transform: capitalize;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: #f8f9fa;
}

/* Sidebar */
.sidebar {
    grid-area: sidebar;
    background: #0f172a;
    color: white;
    padding: 0;
    box-shadow: 4px 0 12px rgba(0,0,0,0.1);
    z-index: 200;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    width: var(--sidebar-width);
}

.logo {
    padding: 1.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.logo h2 {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-weight: 600;
}

.logo i {
    color: var(--secondary);
    font-size: 1.5rem;
}

.nav-links {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
}

.nav-links li {
    margin: 3px 0.75rem;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.nav-links li a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    transition: var(--transition);
    border-radius: var(--border-radius);
    font-weight: 500;
}

.nav-links li a i {
    width: 20px;
    text-align: center;
    font-size: 1.05rem;
}

.nav-links li:hover a {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.nav-links li.active a {
    background: var(--primary);
    color: white;
}

/* Main Content */
.main-content {
    grid-area: main;
    padding: 1.5rem;
    overflow-y: auto;
    background: transparent;
    min-height: calc(100vh - 80px);
}

/* Dashboard Stats - Landscape Optimized */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.stat-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    cursor: pointer;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    padding: 1.75rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
    border: 1px solid #eef1f6;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--box-shadow-lg);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    background: var(--accent);
    color: var(--primary);
}

.stat-info {
    flex: 1;
}

.stat-info h3 {
    font-size: 2.2rem;
    margin-bottom: 3px;
    color: var(--dark);
    font-weight: 700;
}

.stat-info p {
    color: var(--muted);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Cards */
.card {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--box-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid #eef1f6;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eef1f6;
    flex-wrap: wrap;
    gap: 1rem;
}

.card-title {
    font-size: 1.2rem;
    color: var(--dark);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title i {
    color: var(--primary);
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.help-text {
    color: var(--muted);
    font-size: 0.85rem;
    margin-top: 4px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: var(--transition);
    background: white;
    font-family: inherit;
}

textarea {
    resize: vertical;
}

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

/* Buttons */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    line-height: normal;
    appearance: none;
    -webkit-appearance: none;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid #cbd5e1;
    color: var(--dark);
}

.btn-outline:hover {
    background: var(--dark);
    border-color: var(--dark);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

/* Distinct, labeled action-button colors so View/Edit/Delete/Print/Rx
   can never be mistaken for one another at a glance. Solid flat fills,
   matching the HRMS reference style. */
.btn-view {
    background: #64748b;
    color: white;
}

.btn-view:hover {
    background: #475569;
}

.btn-edit {
    background: #3b82f6;
    color: white;
}

.btn-edit:hover {
    background: #2563eb;
}

.btn-print {
    background: #0ea5a4;
    color: white;
}

.btn-print:hover {
    background: #0d9488;
}

.btn-rx {
    background: #7c3aed;
    color: white;
}

.btn-rx:hover {
    background: #6d28d9;
}

.btn-activate {
    background: #22c55e;
    color: white;
}

.btn-activate:hover {
    background: #16a34a;
}

.btn-deactivate {
    background: #f59e0b;
    color: white;
}

.btn-deactivate:hover {
    background: #d97706;
}

.btn-sm {
    padding: 7px 12px;
    font-size: 0.82rem;
}

.action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.action-buttons .btn {
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    border-radius: 6px;
    box-shadow: none;
}

.action-buttons .btn:hover {
    transform: none;
    box-shadow: none;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin: 1rem 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th, td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #eef1f6;
}

th {
    background: #f8fafc;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr {
    transition: var(--transition);
}

tr:hover {
    background: #f8fafc;
}

/* Status Badges */
.status {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status.scheduled {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

.status.confirmed {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.status.completed {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.cancelled {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Prescription Specific Styles */
.simple-prescription {
    max-width: 100%;
    margin: 0 auto;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    overflow: hidden;
}

/* Clinic Header Styles */
.clinic-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 2px solid #3498db;
    background: white;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-left, .header-center, .header-right {
    flex: 1;
    min-width: 200px;
}

.header-left {
    text-align: left;
}

.header-center {
    text-align: center;
}

.header-right {
    text-align: right;
}

.clinic-logo {
    max-height: 70px;
    max-width: 120px;
    object-fit: contain;
}

/* AI Assistant chat */
.ai-chat-window {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 55vh;
    overflow-y: auto;
    padding: 16px;
    background: #f8fafc;
    border-radius: var(--border-radius);
    border: 1px solid #eef1f6;
    margin-bottom: 1rem;
}

.ai-bubble {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.92rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-bubble-user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-bubble-assistant {
    align-self: flex-start;
    background: white;
    color: var(--dark);
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 4px;
}

.ai-chat-form {
    display: flex;
    gap: 10px;
}

.ai-chat-form input {
    flex: 1;
}

.ai-draft-box {
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-radius: var(--border-radius);
    padding: 14px 16px;
    margin-bottom: 1rem;
}

.ai-draft-box label {
    color: #6d28d9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.ai-draft-box .help-text {
    margin: 4px 0 10px;
}

.clinic-name-fallback {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
}

.urgent-checkbox {
    width: auto;
    margin-right: 4px;
}

.urgent-label {
    color: var(--danger);
    font-weight: 700;
    font-size: 0.75rem;
}

.doctor-name {
    font-weight: bold;
    font-size: 0.95rem;
    margin-bottom: 4px;
}

.doctor-specialty {
    font-size: 0.85rem;
    color: #666;
}

.clinic-contact {
    font-size: 0.8rem;
    line-height: 1.3;
}

.phone {
    font-weight: bold;
}

.address {
    color: #666;
}

/* Medicines Table Styles */
.medicines-table-container {
    margin-top: 1rem;
    overflow-x: auto;
}

.medicines-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid #ddd;
    min-width: 500px;
}

.medicines-table th {
    background: #3498db;
    color: white;
    padding: 10px;
    text-align: left;
    font-weight: bold;
    font-size: 0.9rem;
    white-space: nowrap;
}

.medicines-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.medicine-input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    min-width: 0;
}

.medicine-input:focus {
    outline: none;
    border-color: #3498db;
}

/* Patient Info Section */
.patient-info-simple {
    padding: 1.5rem;
    border-bottom: 2px solid #3498db;
}

.info-row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.info-item {
    flex: 1;
    min-width: 200px;
}

.info-item label {
    font-weight: bold;
    color: #333;
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.info-value {
    padding: 8px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #ddd;
    font-size: 0.9rem;
    min-height: 20px;
}

/* Patient Search */
.patient-search-simple {
    background: #f8f9fa;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.search-results-simple {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    margin-top: 10px;
    display: none;
}

.search-result-simple {
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}

.search-result-simple:hover {
    background: #e3f2fd;
}

.search-result-empty {
    color: var(--muted);
    cursor: default;
    text-align: center;
}

.search-result-empty:hover {
    background: white;
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    border: 1px solid transparent;
    font-weight: 500;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

/* Login Page */
.login-body {
    background: linear-gradient(135deg, #1e293b 0%, var(--primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-container {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.18);
    padding: 3rem;
    width: 100%;
    max-width: 450px;
}

/* Prevent zoom on form elements in iOS */
input, select, textarea {
    font-size: 16px !important;
}

/* Prevent zoom on focus */
@media screen and (max-width: 768px) {
    input:focus, select:focus, textarea:focus {
        font-size: 16px !important;
        transform: none !important;
    }
}

/* Ensure proper touch targets without zoom */
.btn, .medicine-input, .search-result-simple {
    touch-action: manipulation;
}

/* Prevent double-tap zoom */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Print Styles - UPDATED */
@media print {
    .sidebar, .header, .btn, .action-buttons, .mobile-menu-btn, .mobile-overlay,
    .patient-search-simple, .no-print {
        display: none !important;
    }
    
    .prescription-container, .simple-prescription {
        box-shadow: none;
        margin: 0;
        padding: 0;
        border: none;
        width: 100% !important;
    }
    
    .main-content {
        padding: 0;
        margin: 0;
    }
    
    .landscape-container {
        display: block;
    }
    
    body {
        background: white;
        margin: 0;
        padding: 0;
    }
    
    .clinic-header {
        border-bottom: 2px solid #000 !important;
    }
    
    .info-value, .medicines-content {
        background: white !important;
        border: 1px solid #000 !important;
    }
    
    .medicines-table {
        border: 1px solid #000 !important;
    }
    
    .medicines-table th {
        background: #f0f0f0 !important;
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    /* NEW PRINT STYLES ADDED */
    body {
        background: white !important;
        margin: 0 !important;
        padding: 15px !important;
        font-size: 12px !important;
    }
    
    .print-container, .simple-prescription, .prescription-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-shadow: none !important;
        border: none !important;
        position: relative !important;
    }
    
    .tests-table th,
    .medicines-table th {
        background: #2c7fb8 !important;
        color: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    .doctor-footer {
        position: fixed !important;
        bottom: 50px !important;
        right: 50px !important;
        margin-top: 0 !important;
    }
    
    .tests-table, .medicines-table {
        border: 1px solid #000 !important;
        width: 100% !important;
    }
    
    .tests-table th, .medicines-table th,
    .tests-table td, .medicines-table td {
        border: 1px solid #000 !important;
        padding: 8px !important;
    }
    
    .landscape-container {
        display: block !important;
        transform: none !important;
    }
    
    .main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
    }
}

/* Doctor Signature Print Styles */
@media print {
    .doctor-footer {
        position: fixed !important;
        bottom: 50px !important;
        right: 50px !important;
        margin-top: 0 !important;
    }
    
    .doctor-signature-simple {
        text-align: right;
    }
}

/* Mobile Responsiveness */
@media (max-width: 1024px) {
    /* Tablet and unfolded phones - Keep desktop layout but adjust spacing */
    .main-content {
        padding: 1rem;
    }
    
    .card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }
    
    .page-title {
        font-size: 1.3rem;
    }
    
    /* Make prescription form more compact */
    .simple-prescription {
        max-width: 100%;
        margin: 0;
    }
    
    .clinic-header {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    
    .clinic-logo {
        max-height: 50px;
        max-width: 100px;
    }
    
    .doctor-name {
        font-size: 0.85rem;
    }
    
    .doctor-specialty {
        font-size: 0.75rem;
    }
    
    .clinic-contact {
        font-size: 0.7rem;
    }
    
    .patient-info-simple {
        padding: 1rem;
    }
    
    .medicines-section {
        padding: 1rem;
    }
    
    /* Make medicines table scrollable but keep original size */
    .medicines-table-container {
        margin-top: 0.5rem;
    }
    
    .medicines-table {
        min-width: 600px;
        font-size: 0.85rem;
    }
    
    .medicine-input {
        padding: 6px;
        font-size: 0.8rem;
    }
    
    /* Dashboard adjustments */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1.5rem;
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .stat-icon {
        width: 60px;
        height: 60px;
    }
    
    .stat-info h3 {
        font-size: 2rem;
    }
}

@media (max-width: 768px) {
    /* Small tablets - Switch to mobile layout only when necessary */
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 280px;
        z-index: 1000;
        transition: left 0.3s ease;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .header {
        padding: 0.75rem;
    }
    
    .mobile-menu-btn {
        display: block !important;
    }
    
    /* Compact prescription layout */
    .clinic-header {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .header-left, .header-center, .header-right {
        min-width: 30%;
        text-align: center;
    }
    
    .info-row {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .info-item {
        min-width: 45%;
        margin-bottom: 0.5rem;
    }
    
    .action-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .action-buttons .btn {
        width: auto;
        min-width: 120px;
    }
}

@media (max-width: 480px) {
    /* Small phones - Force single column */
    .landscape-container {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "header"
            "main";
        grid-template-rows: auto 1fr;
    }
    
    .clinic-header {
        flex-direction: column;
    }
    
    .header-left, .header-center, .header-right {
        min-width: 100%;
        text-align: center;
        margin-bottom: 0.5rem;
    }
    
    .info-row {
        flex-direction: column;
    }
    
    .info-item {
        min-width: 100%;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons .btn {
        width: 100%;
    }
    
    /* Make tables more compact */
    .medicines-table {
        min-width: 400px;
        font-size: 0.8rem;
    }
    
    .medicines-table th,
    .medicines-table td {
        padding: 4px 6px;
    }
}

/* Always ensure tables are scrollable on mobile */
.table-container,
.medicines-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Fix for menu button on prescription page */
.mobile-menu-btn {
    position: relative;
    z-index: 1000;
}

/* Animation for page transitions */
.main-content {
    animation: fadeIn 0.5s ease-in-out;
}

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

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #1a5f8a;
}


/* === PATCH: Enable proper mobile layout === */

@media (max-width: 768px) {
    /* Stack header and main content */
    .landscape-container {
        grid-template-columns: 1fr;
        grid-template-areas:
            "header"
            "main";
    }

    /* Sidebar hidden by default, slide in when active */
    .sidebar {
        left: -100%;
        top: 0;
        position: fixed;
        width: 240px;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    .sidebar.active {
        left: 0;
    }

    /* Show mobile menu button only on small screens */
    .mobile-menu-btn {
        display: block !important;
    }

    /* Main content padding smaller */
    .main-content {
        padding: 1rem;
        min-height: calc(100vh - 70px);
    }

    /* Make info rows stack */
    .info-row {
        flex-direction: column;
    }
    .info-item {
        min-width: 100%;
    }

    /* Ensure tables are scrollable instead of zooming */
    table,
    .medicines-table {
        width: 100% !important;
        min-width: unset !important;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 1rem;
    }
    th, td {
        font-size: 0.8rem;
        padding: 6px 8px;
    }
}