/* Home Page - Patient Management (Prototype Match) */

/* ========================================
   MAIN LAYOUT CONTAINER
   ======================================== */
.emr-patient-layout {
    display: flex;
    height: calc(100vh - var(--emr-header-height, 64px));
    overflow: hidden;
}

/* ========================================
   LEFT SIDEBAR - Patient List (280px)
   ======================================== */
.patient-sidebar {
    width: 260px;
    min-width: 260px;
    background: white;
    border-right: 1px solid var(--emr-border, #dadce0);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 16px;
    font-weight: 500;
    color: var(--emr-text-secondary, #5f6368);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.8px;
}

.create-patient-btn {
    margin: 8px 16px 16px 16px;
    background: white;
    color: var(--emr-text-primary, #202124);
    border: none;
    padding: 12px 20px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: pointer;
    box-shadow: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
    transition: all 0.2s;
    font-family: inherit;
}

.create-patient-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(60, 64, 67, 0.25);
    background: #fafafa;
}

.create-patient-btn svg {
    color: var(--emr-primary, #1a73e8);
}

.patient-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 8px 16px 8px;
}

.patient-item {
    padding: 10px 12px;
    border-radius: 0 24px 24px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: background 0.1s;
    margin-bottom: 4px;
}

.patient-item:hover {
    background: var(--emr-hover-bg, #f1f3f4);
}

.patient-item.active {
    background: var(--emr-secondary, #e8f0fe);
    color: var(--emr-primary, #1a73e8);
}

.patient-item.active .patient-name {
    color: var(--emr-primary, #1a73e8);
    font-weight: 500;
}

/* Avatar (Prototype Match) */
.avatar,
.patient-avatar {
    width: 32px;
    height: 32px;
    background: #eee;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    font-size: 14px;
    color: var(--emr-text-secondary, #5f6368);
    flex-shrink: 0;
}

.avatar.large,
.patient-avatar.large {
    width: 40px;
    height: 40px;
    font-size: 18px;
    background: #1a73e8;
    color: #fff;
    flex-shrink: 0;
}

.patient-info {
    flex: 1;
    min-width: 0;
}

.patient-info .patient-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--emr-text-primary, #202124);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.patient-info .patient-meta {
    font-size: 12px;
    color: var(--emr-text-secondary, #5f6368);
}

.patient-info .patient-dob {
    font-size: 11px;
    color: var(--emr-text-secondary, #80868b);
    margin-top: 2px;
}

/* ========================================
   SIDEBAR HEADER WITH CONTROLS
   ======================================== */
.sidebar-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 12px 8px 16px;
    gap: 8px;
    min-height: 44px;
}

.sidebar-header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.sidebar-header-title {
    font-weight: 500;
    color: var(--emr-text-secondary, #5f6368);
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 0.8px;
    white-space: nowrap;
}

.sidebar-clear-search {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    color: #5f6368;
    display: flex;
    align-items: center;
    gap: 4px;
}

.sidebar-clear-search:hover {
    background: #f1f3f4;
}

.search-result-badge {
    background: #e8f0fe;
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 12px;
    color: #1a73e8;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-controls {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.sidebar-control-btn {
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #5f6368;
    transition: all 0.15s;
}

.sidebar-control-btn:hover {
    background: #f1f3f4;
    color: #202124;
}

.sidebar-control-btn.pin-btn.pinned {
    color: #1a73e8;
}

.sidebar-control-btn.pin-btn.pinned:hover {
    background: #e8f0fe;
}

/* ========================================
   COLLAPSED SIDEBAR STATE
   ======================================== */
.patient-sidebar.collapsed {
    width: 56px;
    min-width: 56px;
    transition: width 0.2s ease;
}

.patient-sidebar.collapsed .sidebar-header-row {
    padding: 12px 8px;
    justify-content: center;
}

.patient-sidebar.collapsed .sidebar-controls {
    flex-direction: column;
    gap: 4px;
}

.patient-sidebar.collapsed .pin-btn {
    display: none;
}

.patient-sidebar.collapsed .patient-list {
    padding: 0 4px 16px 4px;
}

.patient-sidebar.collapsed .patient-item {
    padding: 8px;
    border-radius: 50%;
    justify-content: center;
    margin-bottom: 4px;
}

.patient-sidebar.collapsed .patient-item.collapsed {
    justify-content: center;
}

.patient-sidebar.collapsed .patient-avatar {
    width: 36px;
    height: 36px;
    font-size: 14px;
}

/* Transition for smooth expand/collapse */
.patient-sidebar {
    transition: width 0.2s ease;
}

/* ========================================
   MAIN CONTENT AREA
   ======================================== */
.content-area {
    flex: 1;
    min-width: 0;
    background: var(--emr-bg-main, #f8f9fa);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Content Header (Prototype Match) */
.content-header {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--emr-border, #dadce0);
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-shrink: 0;
}

/* Patient Info Row (Prototype Match) */
.patient-info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
}

.patient-info-left {
    display: flex;
    gap: 12px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.patient-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.patient-name-title {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #202124;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.patient-meta-row {
    margin-top: 2px;
    font-size: 12px;
    display: flex;
    gap: 8px;
    color: #202124;
    flex-wrap: wrap;
}

.patient-meta-row .meta-label {
    color: #5f6368;
}

.patient-meta-row .dot {
    color: #dadce0;
}

.header-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Primary Button (Prototype Match) */
.btn-primary {
    background: var(--emr-primary, #1a73e8);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-family: inherit;
    white-space: nowrap;
}

.btn-primary:hover {
    background: #1557b0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transform: translateY(-1px);
}

/* Icon Action Buttons (Edit, Delete Patient) */
.btn-icon-action {
    width: 32px;
    height: 32px;
    background: white;
    color: #5f6368;
    border: 1px solid #dadce0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-icon-action:hover {
    background: #f1f3f4;
    color: #1a73e8;
    border-color: #1a73e8;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-icon-action.delete {
    color: #5f6368;
}

.btn-icon-action.delete:hover {
    background: #fce8e6;
    color: #d93025;
    border-color: #d93025;
}

/* Record Info Box (Prototype Match - This is the key component) */
.record-info-box {
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.record-info-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 150px;
    flex-shrink: 0;
}

.record-icon-box {
    background: #e8f0fe;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.record-viewing-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.record-label-text {
    font-size: 10px;
    color: #5f6368;
    text-transform: uppercase;
    font-weight: 500;
}

.record-title-link {
    font-weight: 600;
    color: #1a73e8;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-divider {
    height: 28px;
    border-left: 1px solid #dadce0;
    flex-shrink: 0;
}

.record-details-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    flex: 1;
    min-width: 0;
}

.record-detail-item {
    font-size: 12px;
    white-space: nowrap;
}

.record-detail-item .detail-label {
    font-size: 11px;
    color: #5f6368;
}

.record-detail-item .detail-value {
    font-size: 12px;
    font-weight: 500;
    color: #202124;
}

/* ========================================
   FILTER TOOLBAR (Prototype Match)
   ======================================== */
.filter-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    border-bottom: 1px solid #e0e0e0;
    background: #fff;
    flex-shrink: 0;
}

.filter-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.filter-dropdown {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #5f6368;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    background: #f1f3f4;
    flex-shrink: 0;
}

.filter-dropdown svg {
    flex-shrink: 0;
}

.filter-dropdown select {
    border: none;
    background: transparent;
    outline: none;
    color: #5f6368;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
}

.filter-chips {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    flex-shrink: 1;
    min-width: 0;
}

.filter-chips::-webkit-scrollbar {
    display: none;
}

.filter-chip {
    border: 1px solid #dadce0;
    background: #fff;
    color: #5f6368;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    font-family: inherit;
    flex-shrink: 0;
}

.filter-chip:hover {
    background: #f1f3f4;
}

.filter-chip.active {
    border-color: #1a73e8;
    background: #e8f0fe;
    color: #1a73e8;
}

/* Filter Chips Dropdown (hidden on desktop, shown on small screens) */
.filter-chips-dropdown {
    display: none;
    border: 1px solid #dadce0;
    background: #f1f3f4;
    color: #5f6368;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
    outline: none;
}

/* View Mode Toggle (Prototype Match) */
.view-toggle-group {
    background: #f1f3f4;
    border-radius: 4px;
    padding: 2px;
    display: flex;
    gap: 2px;
}

.view-toggle-btn {
    border: none;
    background: transparent;
    border-radius: 4px;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    color: #5f6368;
}

.view-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

.view-toggle-btn.active {
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    color: #1a73e8;
}

/* ========================================
   RECORDS GRID (Prototype Match)
   ======================================== */
.records-grid-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Record Group (Prototype Match) */
.record-group {
    margin-bottom: 24px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.record-group:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.record-group.active {
    border-color: #1a73e8;
    box-shadow: 0 0 0 1px #1a73e8, 0 4px 12px rgba(26, 115, 232, 0.12);
}

/* Record Group Header (contains title and delete button) */
.record-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    gap: 8px;
}

.record-group-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 500;
    color: #202124;
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    flex: 1;
    min-width: 0;
}

.record-group-title:hover {
    background: #f1f3f4;
}

/* Chevron icon - push to right */
.record-group-title > svg:last-child {
    margin-left: auto;
    flex-shrink: 0;
}

.record-group-info {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex: 1;
    gap: 12px;
    min-width: 0;
    overflow: hidden;
    justify-content: flex-start;
}

.record-group-name {
    font-size: 14px;
    font-weight: 600;
    color: #202124;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.record-group-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: #5f6368;
    flex-shrink: 0;
    white-space: nowrap;
}

.record-group-meta .record-code {
    font-weight: 500;
    color: #1a73e8;
    overflow: hidden;
    text-overflow: ellipsis;
}

.record-group-meta .record-date {
    color: #80868b;
    flex-shrink: 0;
}

/* Record Actions Container */
.record-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
}

.record-group:hover .record-actions {
    opacity: 1;
}

/* Record Edit Button */
.record-edit-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    color: #5f6368;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.record-edit-btn:hover {
    background: #e8f0fe;
    color: #1a73e8;
}

/* Record Delete Button */
.record-delete-btn {
    width: 32px;
    height: 32px;
    background: transparent;
    color: #5f6368;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.record-delete-btn:hover {
    background: #fce8e6;
    color: #d93025;
}

/* Record Status Badge */
.record-status-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    margin-left: 8px;
}

.record-status-badge.status-warning {
    background: #fef7e0;
    color: #f9a825;
}

.record-status-badge.status-info {
    background: #e8f0fe;
    color: #1a73e8;
}

.record-status-badge.status-success {
    background: #e6f4ea;
    color: #137333;
}

.record-status-badge.status-secondary {
    background: #f1f3f4;
    color: #5f6368;
}

/* Forms Grid (Prototype Match) */
.forms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 130px));
    gap: 10px;
    margin-top: 10px;
}

/* ========================================
   FORM CARD (Prototype Match)
   ======================================== */
.form-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.form-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e0;
}

.form-card.active {
    border-color: #1a73e8;
    background: #f8faff;
    box-shadow: 0 0 0 1px #1a73e8, 0 4px 12px rgba(26, 115, 232, 0.1);
}

.form-card.create-card {
    border: 1px dashed var(--emr-primary, #1a73e8);
    background: #f8faff;
}

.form-card.create-card.upload-card {
    border: 1px dashed #34a853;
    background: #f8fff8;
}

.form-card.create-card .form-thumbnail {
    background: transparent !important;
}

.form-card.create-card .form-info {
    background: white;
}

.form-card.create-card:hover {
    background: #eef2fa;
    box-shadow: 0 4px 8px rgba(26, 115, 232, 0.15);
}

.form-card.create-card.upload-card:hover {
    background: #eefaee;
    box-shadow: 0 4px 8px rgba(52, 168, 83, 0.15);
}

/* Thumbnail Area (Portrait ratio for A4-like appearance) */
.form-thumbnail {
    height: 130px;
    background-color: #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* Card Actions Overlay (Prototype Match - Bottom Centered) */
.card-actions-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.05);
    display: none;
    align-items: flex-end;
    justify-content: center;
    gap: 8px;
    padding-bottom: 12px;
    z-index: 10;
}

.form-card:hover .card-actions-overlay {
    display: flex;
}

/* Action Button (Prototype Match - Round 32px) */
.action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 1px solid #dadce0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #5f6368;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.action-btn:hover {
    background: #f1f3f4;
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    color: #1a73e8;
}

.action-btn.delete:hover {
    color: #d93025;
    background: #fce8e6;
}

/* Placeholder Document (Prototype Match) */
.placeholder-doc {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Form Info (Prototype Match) */
.form-info {
    padding: 8px 10px;
    background: white;
}

.form-name,
.form-title {
    font-size: 12px;
    font-weight: 500;
    color: #202124;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.form-name.create {
    color: #1a73e8;
}

.form-date {
    font-size: 10px;
    color: #5f6368;
}

/* Form Meta Row (date + status badge) */
.form-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 4px;
    flex-wrap: wrap;
}

/* Form Status Badge (inline with date) */
.form-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
    white-space: nowrap;
}

.form-status-badge.status-signed {
    background: #e6f4ea;
    color: #137333;
}

.form-status-badge.status-missing {
    background: #fef7e0;
    color: #b06000;
}

.form-status-badge.status-unsigned {
    background: #f1f3f4;
    color: #5f6368;
}

/* Card Status Badges (Prototype Match) */
.card-status-badge {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    z-index: 5;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 4px;
}

.card-status-badge.status-signed {
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #ceead6;
}

.card-status-badge.status-missing {
    background: #fef7e0;
    color: #b06000;
    border: 1px solid #feefc3;
}

.card-status-badge.status-unsigned {
    background: #f1f3f4;
    color: #5f6368;
    border: 1px solid #dadce0;
}

/* List Status Badges (for table/list view) */
.list-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.list-status-badge.status-signed {
    background: #e6f4ea;
    color: #137333;
    border: 1px solid #ceead6;
}

.list-status-badge.status-missing {
    background: #fef7e0;
    color: #b06000;
    border: 1px solid #feefc3;
}

.list-status-badge.status-unsigned {
    background: #f1f3f4;
    color: #5f6368;
    border: 1px solid #dadce0;
}

/* ========================================
   LIST VIEW STYLES (Prototype Match)
   ======================================== */
.list-view-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 4px;
    font-size: 14px;
    margin-top: 12px;
}

.list-view-table th {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 2px solid #e8eaed;
    color: #3c4043;
    font-size: 13px;
    font-weight: 600;
    background: #f1f3f4;
    text-transform: uppercase;
    letter-spacing: 0.2px;
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.list-view-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
    white-space: nowrap;
}

.list-row {
    cursor: pointer;
    transition: all 0.15s ease;
    background: white;
}

.list-row:hover {
    background-color: #f8f9fa !important;
}

.list-row.active td {
    background-color: #e8f0fe !important;
    color: #1a73e8;
}

.list-row.active td:first-child {
    box-shadow: inset 4px 0 0 #1a73e8;
}

.create-row {
    cursor: pointer;
    background: #fff;
}

.create-row:hover td {
    background: #eef2fa !important;
}

.create-row td {
    border-bottom: 1px dashed #e8eaed !important;
}

/* Row Actions */
.row-actions {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
}

.icon-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #5f6368;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.icon-btn:hover {
    background: #f1f3f4;
    color: #1a73e8;
}

.icon-btn.delete:hover {
    background: #fce8e6;
    color: #d93025;
}

/* ========================================
   RIGHT PANEL - Document Preview (Prototype Match)
   ======================================== */
.preview-panel {
    flex: 1 1 0;
    min-width: 400px;
    max-width: 800px;
    background: white;
    border-left: 1px solid var(--emr-border, #dadce0);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -2px 0 8px rgba(0, 0, 0, 0.05);
}

.preview-panel.expanded {
    flex: 1 1 0;
    max-width: 800px;
}

.panel-header {
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--emr-border, #dadce0);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    font-weight: 500;
    color: #202124;
}

.panel-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-outline,
.btn-outline-small {
    background: white;
    color: var(--emr-primary, #1a73e8);
    border: 1px solid var(--emr-border, #dadce0);
    padding: 9px 17px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-outline:hover,
.btn-outline-small:hover {
    background: var(--emr-secondary, #e8f0fe);
    border-color: var(--emr-primary, #1a73e8);
}

.btn-icon {
    background: transparent;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--emr-text-secondary, #5f6368);
    cursor: pointer;
    transition: background 0.2s;
}

.btn-icon:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #202124;
}

/* Close preview button - hidden on desktop */
.btn-icon.close-preview {
    display: none;
}

/* Preview backdrop - hidden on desktop */
.preview-backdrop {
    display: none;
}

/* Three-dot menu - Always visible on all devices */
.mobile-actions {
    display: block;
}

/* Hide hover-based card actions - replaced by three-dot menu */
.desktop-actions {
    display: none !important;
}

/* Card Menu Container */
.card-menu-container {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 15;
}

/* When dropdown is open, elevate the container above backdrop */
.card-menu-container:has(.card-dropdown-menu) {
    z-index: 1001;
}

.card-menu-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: white;
    border: 1px solid #dadce0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #5f6368;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s;
}

.card-menu-btn:hover {
    background: #f1f3f4;
    color: #202124;
}

.card-dropdown-menu {
    position: fixed;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    min-width: 160px;
    padding: 6px 0;
    z-index: 1000;
}

.card-dropdown-menu .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    color: #202124;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.card-dropdown-menu .dropdown-item:hover {
    background: #f1f3f4;
}

.card-dropdown-menu .dropdown-item.delete {
    color: #d93025;
}

.card-dropdown-menu .dropdown-item.delete:hover {
    background: #fce8e6;
}

/* Backdrop for closing dropdown when clicking outside */
.dropdown-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 999;
    background: transparent;
    cursor: default;
}

/* Patient Selector Button - hidden on desktop */
.patient-selector-btn {
    display: none;
}

/* Patient Selector Dropdown - hidden on desktop */
.patient-selector-dropdown {
    display: none;
}

/* Inline Preview (Prototype Match) */
.preview-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    height: 100%;
    overflow-y: auto;
    padding: 16px;
}

.preview-paper {
    background: white;
    margin: 24px;
    padding: 40px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    border-radius: 2px;
}

.paper-header {
    display: flex;
    justify-content: space-between;
    border-bottom: 2px solid #000;
    padding-bottom: 16px;
    margin-bottom: 24px;
}

.clinic-name {
    margin: 0;
    font-size: 16px;
    color: #1a73e8;
}

.paper-header-right {
    text-align: right;
}

.doc-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.doc-date {
    font-size: 12px;
    color: #5f6368;
    margin-top: 4px;
}

.paper-patient-info {
    margin-bottom: 24px;
    background: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
}

.paper-patient-info .patient-name {
    font-size: 14px;
    font-weight: 600;
}

.paper-patient-info .patient-id {
    font-size: 12px;
    color: #5f6368;
}

.paper-body {
    font-size: 14px;
    line-height: 1.6;
    color: #5f6368;
}

/* Empty Preview State */
.empty-preview {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: #80868b;
}

.empty-preview p {
    margin-top: 16px;
    font-size: 13px;
    text-align: center;
}

/* New Preview Styles */
.preview-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #5f6368;
}

.preview-loading .emr-spinner {
    margin-bottom: 16px;
}

.preview-file-container {
    width: 100%;
    height: 100%;
    background: #f0f2f5;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px;
}

.preview-file-container embed,
.preview-file-container iframe {
    flex: 1;
    border: none;
    width: 100%;
    max-width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    background: white;
}

.preview-image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    overflow: auto;
}

.preview-image-wrapper img {
    max-width: 100%;
    max-height: 100%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: white;
}

.preview-unknown-file {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px;
    text-align: center;
}

.preview-unknown-file p {
    margin: 16px 0;
    color: #5f6368;
}


/* ========================================
   STATES
   ======================================== */
.no-patient-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #80868b;
}

.no-patient-selected p {
    margin-top: 16px;
    font-size: 14px;
}

.loading-state,
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px;
    color: #80868b;
    flex: 1;
}

.loading-state p,
.empty-state p {
    margin-top: 16px;
    font-size: 14px;
}

.loading-state-small,
.empty-state-small {
    padding: 24px;
    text-align: center;
    color: #80868b;
    font-size: 13px;
}

/* Spinner */
.emr-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e8eaed;
    border-top-color: var(--emr-primary, #1a73e8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.emr-spinner-small {
    width: 24px;
    height: 24px;
    border: 2px solid #e8eaed;
    border-top-color: var(--emr-primary, #1a73e8);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ========================================
   LEGACY SUPPORT (Keep for backward compatibility)
   ======================================== */
.btn-create-record {
    background: var(--emr-primary, #1a73e8);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-family: inherit;
    white-space: nowrap;
}

.btn-create-record:hover {
    background: #1557b0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Old card-actions (deprecated - use card-actions-overlay instead) */
.card-actions {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transform: translateY(-4px);
    transition: all 0.2s ease;
    z-index: 10;
}

.form-card:hover .card-actions {
    opacity: 1;
    transform: translateY(0);
}

.card-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: white;
    color: var(--emr-text-secondary, #5f6368);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: all 0.15s;
}

.card-action-btn:hover {
    background: var(--emr-primary, #1a73e8);
    color: white;
    transform: scale(1.05);
}

.card-action-btn.delete:hover {
    background: #d93025;
    color: white;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Desktop Large (1400px+) - Default styles above */

/* Desktop Medium - HD screens (1280px - 1400px) */
@media (max-width: 1400px) {
    .patient-sidebar {
        width: 240px;
        min-width: 240px;
    }

    .preview-panel,
    .preview-panel.expanded {
        flex: 1 1 0;
        min-width: 300px;
        max-width: 600px;
    }

    /* Compact toolbar for balanced layout */
    .filter-toolbar {
        padding: 3px 6px;
        gap: 4px;
    }

    .filter-dropdown {
        padding: 2px 5px;
        gap: 3px;
        font-size: 10px;
    }

    .filter-dropdown select {
        font-size: 10px;
    }

    .filter-chips {
        display: none;
    }

    .filter-chips-dropdown {
        display: block;
        padding: 2px 5px;
        font-size: 10px;
    }

    .view-toggle-group {
        padding: 1px;
    }

    .view-toggle-btn {
        width: 24px;
        height: 24px;
    }

    .view-toggle-btn svg {
        width: 12px;
        height: 12px;
    }

    .content-header {
        padding: 10px 14px;
        gap: 10px;
    }

    .avatar.large,
    .patient-avatar.large {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .patient-info-left {
        gap: 10px;
    }

    .patient-name-title {
        font-size: 16px;
    }

    .patient-meta-row {
        font-size: 11px;
        gap: 6px;
    }

    .record-info-box {
        padding: 8px 10px;
        gap: 12px;
    }

    .record-info-left {
        min-width: 140px;
        gap: 8px;
    }

    .record-icon-box {
        padding: 5px;
    }

    .record-label-text {
        font-size: 9px;
    }

    .record-title-link {
        font-size: 12px;
    }

    .record-details-grid {
        gap: 6px 12px;
    }

    .record-detail-item {
        font-size: 11px;
    }

    .record-detail-item .detail-label {
        font-size: 10px;
    }

    .record-detail-item .detail-value {
        font-size: 11px;
    }

    .record-divider {
        height: 24px;
    }

    .forms-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 140px));
        gap: 10px;
    }

    .form-thumbnail {
        height: 150px;
    }

    .form-info {
        padding: 8px 10px;
    }

    .form-title,
    .form-name {
        font-size: 12px;
    }

    .form-date {
        font-size: 10px;
    }

    .record-group {
        padding: 12px;
        margin-bottom: 16px;
    }

    .record-group-header {
        margin-bottom: 10px;
    }

    .record-group-title {
        font-size: 14px;
        padding: 6px;
        gap: 6px;
    }

    .record-group-info {
        gap: 12px;
    }

    .record-group-name {
        font-size: 13px;
    }

    .record-group-meta {
        font-size: 11px;
        gap: 10px;
    }

    .records-grid-container {
        padding: 12px;
    }

    .action-btn {
        width: 26px;
        height: 26px;
    }

    .card-status-badge {
        padding: 2px 6px;
        font-size: 10px;
        top: 6px;
        right: 6px;
    }

    .card-actions-overlay {
        padding-bottom: 8px;
        gap: 6px;
    }

    .placeholder-doc svg {
        width: 32px;
        height: 32px;
    }

    .form-card.create-card .form-thumbnail svg {
        width: 40px;
        height: 40px;
    }

    /* Smaller header buttons */
    .btn-primary {
        padding: 5px 10px;
        font-size: 11px;
        gap: 4px;
    }

    .btn-icon-action {
        width: 28px;
        height: 28px;
    }

    .header-actions {
        gap: 6px;
    }
}

/* Tablet Landscape (1024px - 1200px) */
@media (max-width: 1200px) {
    .patient-sidebar {
        width: 220px;
        min-width: 220px;
    }

    .preview-panel,
    .preview-panel.expanded {
        flex: 1 1 0;
        min-width: 280px;
        max-width: 500px;
    }

    /* More compact toolbar */
    .filter-toolbar {
        padding: 2px 5px;
        gap: 3px;
    }

    .filter-dropdown {
        padding: 2px 4px;
        gap: 2px;
        font-size: 9px;
    }

    .filter-dropdown select {
        font-size: 9px;
    }

    .filter-chips-dropdown {
        font-size: 9px;
        padding: 2px 4px;
    }

    .view-toggle-group {
        padding: 1px;
    }

    .view-toggle-btn {
        width: 22px;
        height: 22px;
    }

    .view-toggle-btn svg {
        width: 11px;
        height: 12px;
    }

    .content-header {
        padding: 10px 14px;
        gap: 10px;
    }

    .patient-info-left {
        gap: 10px;
    }

    .patient-name-title {
        font-size: 16px;
    }

    .patient-meta-row {
        font-size: 11px;
        gap: 6px;
        flex-wrap: wrap;
    }

    .record-info-box {
        padding: 8px 12px;
        gap: 12px;
        flex-wrap: wrap;
    }

    .record-details-grid {
        grid-template-columns: auto;
        row-gap: 4px;
    }

    .forms-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 120px));
        gap: 8px;
    }

    .form-thumbnail {
        height: 110px;
    }

    .form-info {
        padding: 6px 8px;
    }

    .form-title,
    .form-name {
        font-size: 11px;
    }

    .form-date {
        font-size: 9px;
    }

    .record-group {
        padding: 10px;
        margin-bottom: 12px;
    }

    .record-group-title {
        font-size: 13px;
        padding: 4px;
    }

    .record-group-info {
        gap: 10px;
    }

    .record-group-name {
        font-size: 12px;
    }

    .record-group-meta {
        font-size: 10px;
        gap: 8px;
    }

    .records-grid-container {
        padding: 10px;
    }

    .placeholder-doc svg {
        width: 28px;
        height: 28px;
    }

    .form-card.create-card .form-thumbnail svg {
        width: 36px;
        height: 36px;
    }

    .action-btn {
        width: 24px;
        height: 24px;
    }

    /* Smaller header elements */
    .avatar.large,
    .patient-avatar.large {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .btn-primary {
        padding: 4px 8px;
        font-size: 10px;
        gap: 3px;
    }

    .btn-icon-action {
        width: 26px;
        height: 26px;
    }

    .header-actions {
        gap: 4px;
    }

    .record-divider {
        height: 20px;
    }
}

/* Tablet Portrait (768px - 1024px) */
@media (max-width: 1024px) {
    .emr-patient-layout {
        flex-direction: column;
        position: relative;
    }

    /* Patient Sidebar - Compact dropdown style on tablet */
    .patient-sidebar {
        width: 100%;
        min-width: auto;
        max-height: none;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--emr-border, #dadce0);
        overflow: visible;
        padding: 8px 12px;
        background: white;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
    }

    .sidebar-header {
        padding: 0;
        font-size: 10px;
        display: none;
    }

    .sidebar-header-row {
        display: none;
    }

    .sidebar-controls {
        display: none;
    }

    /* Reset collapsed state on tablet */
    .patient-sidebar.collapsed {
        width: 100%;
        min-width: auto;
    }

    .create-patient-btn {
        margin: 0;
        padding: 8px 14px;
        font-size: 13px;
        order: 2;
    }

    .create-patient-btn span {
        display: none;
    }

    .patient-list {
        display: none;
    }

    /* Patient Selector Button - show on tablet */
    .patient-selector-btn {
        display: flex !important;
        align-items: center;
        gap: 10px;
        padding: 10px 14px;
        background: white;
        border: 1px solid #dadce0;
        border-radius: 8px;
        cursor: pointer;
        flex: 1;
        min-width: 200px;
        order: 1;
    }

    .patient-selector-btn:hover {
        background: #f8f9fa;
        border-color: #1a73e8;
    }

    .patient-selector-btn .selector-avatar {
        width: 32px;
        height: 32px;
        background: #1a73e8;
        color: white;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: 500;
        font-size: 14px;
        flex-shrink: 0;
    }

    .patient-selector-btn .selector-info {
        flex: 1;
        text-align: left;
        min-width: 0;
    }

    .patient-selector-btn .selector-name {
        font-weight: 500;
        font-size: 14px;
        color: #202124;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .patient-selector-btn .selector-meta {
        font-size: 12px;
        color: #5f6368;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .patient-selector-btn .selector-arrow {
        color: #5f6368;
        flex-shrink: 0;
    }

    /* Patient Selector Dropdown */
    .patient-selector-dropdown {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 1000;
        display: none;
        align-items: flex-end;
        justify-content: center;
    }

    .patient-selector-dropdown.show {
        display: flex;
    }

    .patient-selector-content {
        background: white;
        width: 100%;
        max-height: 70vh;
        border-radius: 16px 16px 0 0;
        display: flex;
        flex-direction: column;
        animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }

    .patient-selector-header {
        padding: 16px;
        border-bottom: 1px solid #e8eaed;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .patient-selector-header h3 {
        margin: 0;
        font-size: 16px;
        font-weight: 600;
    }

    .patient-selector-close {
        width: 32px;
        height: 32px;
        border: none;
        background: #f1f3f4;
        border-radius: 50%;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        color: #5f6368;
    }

    .patient-selector-list {
        flex: 1;
        overflow-y: auto;
        padding: 8px;
    }

    .patient-selector-item {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 12px;
        border-radius: 8px;
        cursor: pointer;
        transition: background 0.15s;
    }

    .patient-selector-item:hover {
        background: #f1f3f4;
    }

    .patient-selector-item.active {
        background: #e8f0fe;
    }

    .patient-selector-item .patient-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    /* Patient Selector Search Bar */
    .patient-selector-search {
        padding: 12px 16px;
        border-bottom: 1px solid #e8eaed;
        background: #f8f9fa;
    }

    .selector-search-box {
        display: flex;
        align-items: center;
        background: white;
        border: 1px solid #dadce0;
        border-radius: 24px;
        padding: 8px 12px;
        gap: 8px;
        transition: border-color 0.2s, box-shadow 0.2s;
    }

    .selector-search-box:focus-within {
        border-color: #1a73e8;
        box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.2);
    }

    .selector-search-icon {
        color: #5f6368;
        flex-shrink: 0;
    }

    .selector-search-input {
        flex: 1;
        border: none;
        outline: none;
        font-size: 15px;
        color: #202124;
        background: transparent;
        min-width: 0;
    }

    .selector-search-input::placeholder {
        color: #80868b;
    }

    .selector-search-clear {
        width: 28px;
        height: 28px;
        border: none;
        background: #f1f3f4;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: #5f6368;
        flex-shrink: 0;
        transition: background 0.15s;
    }

    .selector-search-clear:hover {
        background: #e8eaed;
        color: #202124;
    }

    .selector-search-btn {
        width: 36px;
        height: 36px;
        border: none;
        background: #1a73e8;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        color: white;
        flex-shrink: 0;
        transition: background 0.15s;
    }

    .selector-search-btn:hover {
        background: #1557b0;
    }

    .selector-search-result-info {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-top: 10px;
        flex-wrap: wrap;
    }

    .search-term-badge {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        background: #e8f0fe;
        color: #1a73e8;
        padding: 4px 10px;
        border-radius: 12px;
        font-size: 13px;
        font-weight: 500;
    }

    .search-count {
        font-size: 13px;
        color: #5f6368;
    }

    .search-clear-btn {
        border: none;
        background: none;
        color: #d93025;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        padding: 4px 8px;
        border-radius: 4px;
        transition: background 0.15s;
    }

    .search-clear-btn:hover {
        background: #fce8e6;
    }

    /* Note: desktop/mobile actions switching is now handled by
       touch detection media query at the bottom of this file.
       On non-touch devices, keep desktop hover actions.
       On touch devices, show mobile three-dot menu. */

    .patient-item.active {
        background: var(--emr-secondary, #e8f0fe);
    }

    .patient-info {
        max-width: 150px;
    }

    /* Content Area */
    .content-area {
        flex: 1;
        min-height: 0;
        overflow: hidden;
    }

    .content-header {
        padding: 12px 16px;
    }

    .patient-info-row {
        flex-direction: row;
        align-items: flex-start;
        gap: 8px;
        flex-wrap: nowrap;
    }

    .patient-info-left {
        flex: 1;
        min-width: 0;
    }

    .header-actions {
        flex-shrink: 0;
        gap: 6px;
        align-self: flex-start;
    }

    .btn-primary span {
        display: none;
    }

    .btn-primary {
        padding: 0;
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-primary svg {
        width: 18px;
        height: 18px;
    }

    .btn-icon-action {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .btn-icon-action svg {
        width: 18px;
        height: 18px;
    }

    /* Compact patient info for tablet */
    .avatar.large,
    .patient-avatar.large {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .patient-name-title {
        font-size: 16px;
    }

    .patient-meta-row {
        font-size: 11px;
        gap: 4px;
    }

    .patient-details {
        gap: 2px;
    }

    .record-info-box {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .record-divider {
        display: none;
    }

    .record-details-grid {
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
    }

    /* Filter Toolbar */
    .filter-toolbar {
        padding: 8px 12px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .filter-left {
        flex-wrap: wrap;
        gap: 8px;
    }

    .filter-chips {
        display: none;
    }

    /* Document Cards - Compact on iPad */
    .forms-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 105px));
        gap: 6px;
    }

    .form-thumbnail {
        height: 90px;
    }

    .form-info {
        padding: 5px 7px;
    }

    .form-title,
    .form-name {
        font-size: 10px;
    }

    .form-date {
        font-size: 8px;
    }

    .form-status-badge {
        font-size: 8px;
        padding: 1px 4px;
        gap: 2px;
    }

    .form-meta-row {
        gap: 4px;
        margin-top: 2px;
    }

    .card-menu-btn {
        width: 26px;
        height: 26px;
    }

    .card-menu-container {
        top: 4px;
        right: 4px;
    }

    .placeholder-doc svg {
        width: 22px;
        height: 22px;
    }

    .form-card.create-card .form-thumbnail svg {
        width: 24px;
        height: 24px;
    }

    .record-group {
        padding: 10px;
        margin-bottom: 12px;
    }

    .record-group-header {
        margin-bottom: 8px;
    }

    .record-group-title {
        font-size: 12px;
        padding: 4px;
        gap: 6px;
    }

    .record-group-name {
        font-size: 12px;
    }

    .record-group-meta {
        font-size: 10px;
        gap: 6px;
    }

    .records-grid-container {
        padding: 10px;
    }

    /* Preview Panel - Slide from right */
    .preview-panel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 85vw !important;
        max-width: 750px !important;
        min-width: auto !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-left: 1px solid var(--emr-border, #dadce0);
        border-top: none;
        border-radius: 0;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        overflow: hidden;
    }

    .preview-panel.expanded {
        transform: translateX(0);
        width: 85vw !important;
        max-width: 750px !important;
        height: 100vh !important;
    }

    .panel-header {
        padding: 12px 16px;
        border-bottom: 1px solid var(--emr-border, #dadce0);
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    /* Close button for preview panel - show on tablet */
    .btn-icon.close-preview {
        display: flex !important;
        width: 36px;
        height: 36px;
        background: #f1f3f4;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        border: none;
        color: #5f6368;
        transition: all 0.2s;
    }

    .btn-icon.close-preview:hover {
        background: #e8eaed;
        color: #202124;
    }

    /* Backdrop when preview is open */
    .preview-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.3s ease, visibility 0.3s ease;
    }

    .preview-backdrop.show {
        display: block;
        opacity: 1;
        visibility: visible;
    }

    /* Hide drag handle on tablet */
    .preview-panel::before {
        display: none;
    }

    .records-grid-container {
        padding: 12px;
        padding-bottom: 80px; /* Space for preview panel toggle */
    }

    .record-group {
        padding: 12px;
        margin-bottom: 16px;
    }

    .forms-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    .form-thumbnail {
        height: 160px;
    }
}

/* Mobile (< 768px) */
@media (max-width: 768px) {
    .emr-patient-layout {
        height: calc(100vh - var(--emr-header-height, 64px) - 60px); /* Account for bottom nav */
    }

    .patient-sidebar {
        max-height: 120px;
    }

    .patient-sidebar.expanded {
        max-height: 40vh;
    }

    .sidebar-header {
        padding: 8px 12px;
        font-size: 10px;
    }

    .create-patient-btn {
        margin: 4px 12px 8px 12px;
        padding: 8px 14px;
        font-size: 13px;
        border-radius: 20px;
    }

    .create-patient-btn span {
        display: none;
    }

    .patient-item {
        padding: 6px 10px;
    }

    .patient-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .patient-info .patient-name {
        font-size: 13px;
    }

    .patient-info .patient-meta {
        font-size: 11px;
    }

    /* Content Header */
    .content-header {
        padding: 10px 12px;
        gap: 10px;
    }

    .avatar.large,
    .patient-avatar.large {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .patient-name-title {
        font-size: 16px;
    }

    .patient-meta-row {
        font-size: 11px;
        flex-wrap: wrap;
    }

    .patient-meta-row .dot {
        display: none;
    }

    .patient-meta-row span {
        display: block;
        width: 100%;
    }

    .header-actions {
        gap: 6px;
    }

    .btn-primary {
        padding: 0;
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-primary svg {
        width: 18px;
        height: 18px;
    }

    .btn-icon-action {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .btn-icon-action svg {
        width: 18px;
        height: 18px;
    }

    /* Record Info Box */
    .record-info-box {
        padding: 10px 12px;
        margin-top: 8px;
    }

    .record-info-left {
        gap: 10px;
    }

    .record-icon-box {
        padding: 6px;
    }

    .record-label-text {
        font-size: 10px;
    }

    .record-title-link {
        font-size: 13px;
    }

    .record-details-grid {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .record-detail-item {
        font-size: 12px;
    }

    /* Filter Toolbar */
    .filter-toolbar {
        padding: 6px 10px;
    }

    .filter-dropdown {
        padding: 4px 8px;
        font-size: 12px;
    }

    .filter-dropdown select {
        font-size: 12px;
    }

    .view-toggle-group {
        display: none;
    }

    /* Records Grid */
    .records-grid-container {
        padding: 10px;
        padding-bottom: 100px;
    }

    .record-group {
        padding: 10px;
        margin-bottom: 12px;
    }

    .record-group-header {
        margin-bottom: 10px;
    }

    .record-group-title {
        font-size: 14px;
        padding: 6px;
    }

    .record-actions {
        opacity: 1;
    }

    .record-edit-btn,
    .record-delete-btn {
        width: 28px;
        height: 28px;
    }

    .forms-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .form-thumbnail {
        height: 120px;
    }

    .form-info {
        padding: 8px;
    }

    .form-title,
    .form-name {
        font-size: 12px;
    }

    .form-date {
        font-size: 10px;
    }

    .card-status-badge {
        padding: 2px 6px;
        font-size: 9px;
        top: 6px;
        right: 6px;
    }

    .card-actions-overlay {
        padding-bottom: 8px;
        gap: 6px;
    }

    .action-btn {
        width: 28px;
        height: 28px;
    }

    /* List View Table */
    .list-view-table {
        font-size: 12px;
    }

    .list-view-table th {
        padding: 8px 10px;
        font-size: 10px;
    }

    .list-view-table td {
        padding: 8px 10px;
    }

    .list-status-badge {
        padding: 2px 6px;
        font-size: 10px;
    }

    .row-actions {
        opacity: 1; /* Always visible on mobile */
    }

    .icon-btn {
        width: 24px;
        height: 24px;
    }

    /* Preview Panel */
    .preview-panel.expanded {
        height: 70vh;
    }

    .panel-header {
        padding: 20px 16px 12px 16px;
    }

    .panel-title {
        font-size: 14px;
    }

    .btn-outline-small {
        padding: 6px 10px;
        font-size: 12px;
    }

    .btn-outline-small span {
        display: none;
    }

    .preview-paper {
        margin: 12px;
        padding: 20px;
    }

    /* No Patient Selected */
    .no-patient-selected svg {
        width: 60px;
        height: 60px;
    }

    .no-patient-selected p {
        font-size: 13px;
    }

    /* Empty State */
    .empty-state,
    .loading-state {
        padding: 32px;
    }

    .empty-state svg,
    .loading-state svg {
        width: 48px;
        height: 48px;
    }

    .empty-state p,
    .loading-state p {
        font-size: 13px;
    }
}

/* Small Mobile (< 480px) */
@media (max-width: 480px) {
    .patient-sidebar {
        max-height: 100px;
    }

    .patient-list {
        gap: 6px;
    }

    .patient-info {
        max-width: 120px;
    }

    .content-header {
        padding: 8px 10px;
    }

    .avatar.large,
    .patient-avatar.large {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .patient-details {
        gap: 2px;
    }

    .patient-name-title {
        font-size: 15px;
    }

    .patient-meta-row {
        font-size: 10px;
    }

    .btn-primary,
    .btn-icon-action {
        width: 32px;
        height: 32px;
        padding: 6px;
    }

    .record-info-box {
        padding: 8px 10px;
    }

    .forms-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }

    .form-thumbnail {
        height: 100px;
    }

    .form-card.create-card .form-thumbnail svg {
        width: 28px;
        height: 28px;
    }

    .placeholder-doc svg {
        width: 24px;
        height: 24px;
    }
}

/* ========================================
   LARGER SCREENS - Full HD (1600px+)
   ======================================== */
@media (min-width: 1600px) {
    .patient-sidebar {
        width: 300px;
        min-width: 300px;
    }

    .preview-panel,
    .preview-panel.expanded {
        width: 750px;
        min-width: 600px;
    }

    .forms-grid {
        grid-template-columns: repeat(auto-fill, minmax(110px, 140px));
        gap: 10px;
    }

    .form-thumbnail {
        height: 140px;
    }

    .form-info {
        padding: 8px 10px;
    }

    .form-title,
    .form-name {
        font-size: 12px;
    }

    .form-date {
        font-size: 10px;
    }

    .record-group {
        padding: 20px;
        margin-bottom: 24px;
    }

    .record-group-name {
        font-size: 15px;
        max-width: 280px;
    }

    .records-grid-container {
        padding: 20px;
    }

    .content-header {
        padding: 16px 24px;
        gap: 14px;
    }

    .patient-name-title {
        font-size: 20px;
    }

    .patient-meta-row {
        font-size: 13px;
    }

    .avatar.large,
    .patient-avatar.large {
        width: 48px;
        height: 48px;
        font-size: 20px;
    }

    .btn-primary {
        padding: 10px 18px;
        font-size: 14px;
    }

    .btn-icon-action {
        width: 40px;
        height: 40px;
    }

    .record-info-box {
        padding: 12px 16px;
        gap: 20px;
    }

    .record-label-text {
        font-size: 11px;
    }

    .record-title-link {
        font-size: 14px;
    }

    .record-detail-item {
        font-size: 13px;
    }

    .record-detail-item .detail-label {
        font-size: 12px;
    }

    .record-detail-item .detail-value {
        font-size: 13px;
    }
}

/* ========================================
   LARGER SCREENS - Full HD+ (1920px+)
   ======================================== */
@media (min-width: 1920px) {
    .patient-sidebar {
        width: 320px;
        min-width: 320px;
    }

    .preview-panel,
    .preview-panel.expanded {
        width: 850px;
        min-width: 700px;
    }

    .forms-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 150px));
        gap: 12px;
    }

    .form-thumbnail {
        height: 150px;
    }

    .form-info {
        padding: 8px 10px;
    }

    .form-title,
    .form-name {
        font-size: 12px;
    }

    .form-date {
        font-size: 10px;
    }

    .record-group {
        padding: 24px;
        margin-bottom: 28px;
    }

    .record-group-name {
        font-size: 16px;
        max-width: 320px;
    }

    .record-group-meta {
        font-size: 13px;
    }

    .records-grid-container {
        padding: 24px;
    }

    .content-header {
        padding: 20px 28px;
        gap: 16px;
    }

    .patient-name-title {
        font-size: 22px;
    }

    .patient-meta-row {
        font-size: 14px;
        gap: 12px;
    }

    .avatar.large,
    .patient-avatar.large {
        width: 52px;
        height: 52px;
        font-size: 22px;
    }

    .btn-primary {
        padding: 10px 20px;
        font-size: 14px;
    }

    .btn-icon-action {
        width: 42px;
        height: 42px;
    }

    .record-info-box {
        padding: 14px 20px;
        gap: 24px;
    }

    .action-btn {
        width: 36px;
        height: 36px;
    }

    .card-status-badge {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* ========================================
   LARGER SCREENS - 2K (2560px+)
   ======================================== */
@media (min-width: 2560px) {
    .patient-sidebar {
        width: 360px;
        min-width: 360px;
    }

    .sidebar-header {
        padding: 20px;
        font-size: 12px;
    }

    .create-patient-btn {
        padding: 14px 24px;
        font-size: 15px;
        border-radius: 28px;
    }

    .patient-item {
        padding: 12px 16px;
        gap: 14px;
    }

    .patient-avatar {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }

    .patient-info .patient-name {
        font-size: 15px;
    }

    .patient-info .patient-meta {
        font-size: 13px;
    }

    .preview-panel,
    .preview-panel.expanded {
        width: 1000px;
        min-width: 800px;
    }

    .forms-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 160px));
        gap: 14px;
    }

    .form-card {
        border-radius: 10px;
    }

    .form-thumbnail {
        height: 160px;
    }

    .form-info {
        padding: 10px 12px;
    }

    .form-title,
    .form-name {
        font-size: 13px;
        margin-bottom: 2px;
    }

    .form-date {
        font-size: 11px;
    }

    .record-group {
        padding: 28px;
        margin-bottom: 32px;
        border-radius: 12px;
    }

    .record-group-name {
        font-size: 18px;
    }

    .record-group-meta {
        font-size: 14px;
        gap: 12px;
    }

    .records-grid-container {
        padding: 28px;
    }

    .content-header {
        padding: 28px 40px;
        gap: 20px;
    }

    .avatar.large,
    .patient-avatar.large {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }

    .patient-name-title {
        font-size: 28px;
    }

    .patient-meta-row {
        font-size: 15px;
        gap: 16px;
    }

    .record-info-box {
        padding: 16px 20px;
        gap: 28px;
    }

    .action-btn {
        width: 40px;
        height: 40px;
    }

    .card-status-badge {
        padding: 6px 12px;
        font-size: 13px;
        border-radius: 6px;
    }

    .filter-toolbar {
        padding: 10px 16px;
    }

    .filter-chip {
        padding: 6px 16px;
        font-size: 14px;
    }

    .btn-primary {
        padding: 12px 22px;
        font-size: 15px;
    }

    .btn-icon-action {
        width: 44px;
        height: 44px;
    }
}

/* ========================================
   LARGER SCREENS - 4K (3840px+)
   ======================================== */
@media (min-width: 3840px) {
    .patient-sidebar {
        width: 440px;
        min-width: 440px;
    }

    .sidebar-header {
        padding: 24px;
        font-size: 14px;
    }

    .create-patient-btn {
        padding: 18px 32px;
        font-size: 18px;
        border-radius: 32px;
        gap: 16px;
    }

    .patient-item {
        padding: 16px 20px;
        gap: 16px;
        margin-bottom: 6px;
    }

    .patient-avatar {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }

    .patient-info .patient-name {
        font-size: 18px;
    }

    .patient-info .patient-meta {
        font-size: 15px;
    }

    .preview-panel,
    .preview-panel.expanded {
        width: 1200px;
        min-width: 1000px;
    }

    .panel-header {
        padding: 20px 24px;
    }

    .panel-title {
        font-size: 18px;
    }

    .forms-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 180px));
        gap: 16px;
    }

    .form-card {
        border-radius: 12px;
    }

    .form-thumbnail {
        height: 180px;
    }

    .form-info {
        padding: 12px 14px;
    }

    .form-title,
    .form-name {
        font-size: 14px;
        margin-bottom: 3px;
    }

    .form-date {
        font-size: 12px;
        margin-top: 4px;
    }

    .record-group {
        padding: 36px;
        margin-bottom: 40px;
        border-radius: 16px;
    }

    .record-group-header {
        margin-bottom: 24px;
    }

    .record-group-title {
        font-size: 20px;
        padding: 12px;
        gap: 12px;
    }

    .record-group-name {
        font-size: 22px;
    }

    .record-group-meta {
        font-size: 16px;
        gap: 16px;
    }

    .records-grid-container {
        padding: 36px;
    }

    .content-header {
        padding: 36px 48px;
        gap: 24px;
    }

    .avatar.large,
    .patient-avatar.large {
        width: 72px;
        height: 72px;
        font-size: 28px;
    }

    .patient-name-title {
        font-size: 36px;
    }

    .patient-meta-row {
        font-size: 18px;
        gap: 20px;
    }

    .record-info-box {
        padding: 20px 28px;
        gap: 36px;
        border-radius: 12px;
    }

    .record-icon-box {
        padding: 12px;
        border-radius: 10px;
    }

    .record-label-text {
        font-size: 13px;
    }

    .record-title-link {
        font-size: 18px;
    }

    .action-btn {
        width: 48px;
        height: 48px;
    }

    .card-status-badge {
        padding: 8px 16px;
        font-size: 15px;
        border-radius: 8px;
        top: 16px;
        right: 16px;
    }

    .card-actions-overlay {
        gap: 12px;
        padding-bottom: 20px;
    }

    .filter-toolbar {
        padding: 12px 20px;
    }

    .filter-dropdown {
        padding: 8px 12px;
        font-size: 16px;
    }

    .filter-chip {
        padding: 8px 20px;
        font-size: 16px;
        border-radius: 20px;
    }

    .view-toggle-btn {
        padding: 8px;
    }

    .btn-primary {
        padding: 14px 28px;
        font-size: 18px;
        border-radius: 8px;
    }

    .btn-icon-action {
        width: 52px;
        height: 52px;
    }

    .btn-outline,
    .btn-outline-small {
        padding: 12px 24px;
        font-size: 16px;
    }

    .placeholder-doc svg {
        width: 60px;
        height: 60px;
    }

    .form-card.create-card .form-thumbnail svg {
        width: 72px;
        height: 72px;
    }

    /* List View for 4K */
    .list-view-table {
        font-size: 18px;
    }

    .list-view-table th {
        padding: 16px 24px;
        font-size: 16px;
    }

    .list-view-table td {
        padding: 16px 24px;
    }

    .list-status-badge {
        padding: 6px 14px;
        font-size: 15px;
    }

    .icon-btn {
        width: 36px;
        height: 36px;
    }
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS (Mobile/Tablet only)
   ======================================== */
@media (max-width: 1024px) and (hover: none) and (pointer: coarse) {
    /* Always show action buttons on touch devices */
    .card-actions-overlay {
        display: flex;
        background: transparent;
    }

    .record-actions {
        opacity: 1;
    }

    .row-actions {
        opacity: 1;
    }

    /* Larger touch targets */
    .patient-item {
        min-height: 48px;
    }

    .filter-chip {
        min-height: 36px;
        padding: 8px 14px;
    }

    .action-btn,
    .icon-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .btn-icon-action {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ========================================
   LANDSCAPE ORIENTATION (Mobile)
   ======================================== */
@media (max-width: 896px) and (orientation: landscape) {
    .emr-patient-layout {
        flex-direction: row;
    }

    .patient-sidebar {
        width: 200px;
        min-width: 200px;
        max-height: none;
        border-bottom: none;
        border-right: 1px solid var(--emr-border, #dadce0);
    }

    .patient-list {
        flex-direction: column;
        flex-wrap: nowrap;
        overflow-x: visible;
        overflow-y: auto;
    }

    .patient-item {
        border-radius: 0 20px 20px 0;
    }

    .preview-panel {
        position: relative;
        width: 280px !important;
        height: auto;
        max-height: none;
        border-top: none;
        border-left: 1px solid var(--emr-border, #dadce0);
        border-radius: 0;
    }

    .preview-panel::before {
        display: none;
    }

    .preview-panel.expanded {
        height: auto;
        width: 280px !important;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .patient-sidebar,
    .preview-panel,
    .filter-toolbar,
    .header-actions,
    .card-actions-overlay,
    .record-actions,
    .row-actions {
        display: none !important;
    }

    .emr-patient-layout {
        display: block;
    }

    .content-area {
        margin: 0;
        padding: 0;
    }

    .records-grid-container {
        padding: 0;
    }

    .record-group {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    .form-card {
        box-shadow: none;
        border: 1px solid #000;
    }
}

/* ========================================
   CARD ACTION BOTTOM SHEET (Mobile/Tablet)
   ======================================== */
.card-action-sheet {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.card-action-sheet.show {
    display: flex;
    opacity: 1;
    visibility: visible;
}

.action-sheet-content {
    background: white;
    width: 100%;
    max-width: 500px;
    border-radius: 16px 16px 0 0;
    padding: 0;
    transform: translateY(100%);
    animation: slideUpSheet 0.35s ease forwards;
    overflow: hidden;
}

@keyframes slideUpSheet {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.card-action-sheet:not(.show) .action-sheet-content {
    animation: slideDownSheet 0.25s ease forwards;
}

@keyframes slideDownSheet {
    from {
        transform: translateY(0);
    }
    to {
        transform: translateY(100%);
    }
}

.action-sheet-header {
    padding: 16px 20px 12px 20px;
    border-bottom: 1px solid #e8eaed;
    position: relative;
}

.action-sheet-handle {
    width: 40px;
    height: 4px;
    background: #dadce0;
    border-radius: 2px;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
}

.action-sheet-title {
    font-size: 16px;
    font-weight: 600;
    color: #202124;
    margin-top: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-sheet-actions {
    padding: 8px 0;
}

.action-sheet-item {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    padding: 14px 20px;
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
    text-align: left;
}

.action-sheet-item:hover {
    background: #f8f9fa;
}

.action-sheet-item:active {
    background: #f1f3f4;
}

.action-sheet-item .action-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-sheet-item .action-icon.edit {
    background: #e8f0fe;
    color: #1a73e8;
}

.action-sheet-item .action-icon.print {
    background: #e6f4ea;
    color: #137333;
}

.action-sheet-item .action-icon.delete {
    background: #fce8e6;
    color: #d93025;
}

.action-sheet-item .action-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.action-sheet-item .action-label {
    font-size: 16px;
    font-weight: 500;
    color: #202124;
}

.action-sheet-item .action-text .action-desc {
    font-size: 13px;
    color: #5f6368;
}

.action-sheet-item.delete .action-label {
    color: #d93025;
}

.action-sheet-cancel {
    width: 100%;
    padding: 16px 20px;
    background: #f8f9fa;
    border: none;
    border-top: 1px solid #e8eaed;
    font-size: 16px;
    font-weight: 500;
    color: #5f6368;
    cursor: pointer;
    transition: background 0.15s;
}

.action-sheet-cancel:hover {
    background: #f1f3f4;
}

.action-sheet-cancel:active {
    background: #e8eaed;
}

/* ========================================
   TOUCH DEVICE OPTIMIZATIONS
   Uses classes added by JS in index.html:
   - .has-touch = device has touch capability
   - .is-touch-device = user is using touch input
   - .is-mouse-device = user is using mouse input
   ======================================== */

/* Touch-friendly target sizes for touch devices */
html.is-touch-device .action-btn,
html.is-touch-device .icon-btn,
html.is-touch-device .card-menu-btn,
html.has-touch:not(.is-mouse-device) .action-btn,
html.has-touch:not(.is-mouse-device) .icon-btn,
html.has-touch:not(.is-mouse-device) .card-menu-btn {
    min-width: 44px;
    min-height: 44px;
}

html.is-touch-device .btn-icon-action,
html.has-touch:not(.is-mouse-device) .btn-icon-action {
    min-width: 44px;
    min-height: 44px;
}

html.is-touch-device .filter-chip,
html.has-touch:not(.is-mouse-device) .filter-chip {
    min-height: 40px;
    padding: 8px 14px;
}

html.is-touch-device .patient-item,
html.has-touch:not(.is-mouse-device) .patient-item {
    min-height: 48px;
}

/* Always show record actions and row actions */
.record-actions {
    opacity: 1;
}

.row-actions {
    opacity: 1;
}

/* CSS fallback for touch devices */
@media (hover: none) and (pointer: coarse) {
    .action-btn,
    .icon-btn,
    .card-menu-btn {
        min-width: 44px;
        min-height: 44px;
    }

    .btn-icon-action {
        min-width: 44px;
        min-height: 44px;
    }

    .filter-chip {
        min-height: 40px;
        padding: 8px 14px;
    }

    .patient-item {
        min-height: 48px;
    }
}