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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    min-height: 100vh;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    border-radius: 16px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 3px solid transparent;
    background: linear-gradient(90deg, #4caf50, #2196f3, #9c27b0) bottom;
    background-size: 100% 3px;
    background-repeat: no-repeat;
}


body[data-display-mode="standalone"] header,
.hidden-in-pwa {
    display: none;
}

header h1 {
    background: linear-gradient(135deg, #2c5530 0%, #4caf50 50%, #2196f3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 10px;
    font-size: 2.5rem;
    font-weight: 700;
}

header p {
    color: #666;
    font-size: 1.1rem;
}

.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ddd;
}

.tab-button {
    background-color: transparent;
    border: none;
    padding: 15px 20px;
    cursor: pointer;
    font-size: 16px;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.tab-button:hover {
    background-color: #f0f0f0;
    color: #333;
}

.tab-button.active {
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    color: white;
    border-radius: 8px 8px 0 0;
    font-weight: 600;
}

.tab-content {
    display: none;
    padding: 20px 0;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    color: #2c5530;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.tab-content h3 {
    color: #2c5530;
    margin: 30px 0 15px 0;
    font-size: 1.4rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    max-width: 300px;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
    transform: translateY(-1px);
}

button {
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.4);
}

.record-item {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    transition: all 0.3s ease;
}

.record-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Phase-specific styling */
.record-item.phase-1 {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f8f0 100%);
    border-left: 4px solid #4caf50;
}

.record-item.phase-2 {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f8ff 100%);
    border-left: 4px solid #2196f3;
}

.record-item.phase-3 {
    background: linear-gradient(135deg, #f3e5f5 0%, #faf0fb 100%);
    border-left: 4px solid #9c27b0;
}

.record-item.phase-4 {
    background: linear-gradient(135deg, #fff3e0 0%, #fef8f0 100%);
    border-left: 4px solid #ff9800;
}

.record-item.user-injection {
    background: linear-gradient(135deg, #fff8e1 0%, #fffbf0 100%);
    border-left: 4px solid #ffc107;
}

.record-item-content {
    flex-grow: 1;
    padding-right: 40px;
}

.record-item-date {
    font-weight: 600;
    color: #2c5530;
    margin-bottom: 5px;
}

.record-item-details {
    color: #666;
    font-size: 14px;
}

.record-item-details-secondary {
    margin-top: 6px;
    color: #4a6572;
    font-size: 13px;
}

.delete-btn {
    background-color: transparent;
    color: #f0f0f0;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    position: absolute;
    top: 8px;
    right: 8px;
}

.delete-btn:hover {
    background-color: #f5f5f5;
    color: #dc3545;
    opacity: 1;
    transform: scale(1.1);
}

.predefined-label {
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chart-info {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
}

.chart-info p {
    font-weight: 600;
    margin-bottom: 10px;
    color: #2c5530;
}

.chart-info ul {
    list-style-type: none;
    padding-left: 0;
}

.chart-info li {
    padding: 3px 0;
    color: #666;
}

.chart-info li::before {
    content: "• ";
    color: #2c5530;
    font-weight: bold;
}

/* Chart controls and containers */
.chart-controls {
    display: flex;
    align-items: center;
    gap: 15px;
    margin: 20px 0;
    flex-wrap: wrap;
    padding: 15px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 10px;
    border: 1px solid #dee2e6;
}

.injection-range-controls {
    justify-content: space-between;
    flex-wrap: wrap;
}

.range-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #2c5530;
}

.range-display strong {
    font-size: 1rem;
    color: #0c3c5c;
}

.range-control-wrap {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}

.range-stepper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.range-adjust {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.4rem;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
}

.range-adjust:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

.range-presets {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.range-preset {
    padding: 10px 18px;
    font-size: 0.9rem;
    background: linear-gradient(135deg, rgba(255,255,255,0.5) 0%, rgba(240,248,255,0.9) 100%);
    color: #0c3c5c;
    border: 1px solid rgba(33, 150, 243, 0.4);
    box-shadow: none;
    transition: all 0.2s ease;
}

.range-preset:hover {
    box-shadow: 0 6px 15px rgba(33, 150, 243, 0.2);
}

.range-preset.active {
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 24px rgba(33, 150, 243, 0.3);
}

.chart-controls label {
    font-weight: 600;
    color: #2c5530;
    font-size: 16px;
}

.chart-controls select {
    padding: 10px 15px;
    border: 2px solid #4caf50;
    border-radius: 8px;
    font-size: 14px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 150px;
}

.chart-controls select:focus {
    outline: none;
    border-color: #2196f3;
    box-shadow: 0 0 8px rgba(33, 150, 243, 0.3);
}

.chart-container {
    position: relative;
    display: block;
    width: 100%;
    margin: 20px 0;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.enhanced-chart {
    border: 3px solid;
    border-image: linear-gradient(135deg, #4caf50 0%, #2196f3 50%, #9c27b0 100%) 1;
    background: linear-gradient(135deg, #ffffff 0%, #f0f8ff 100%);
}

.chart-tooltip {
    position: absolute;
    background: linear-gradient(135deg, #2c5530 0%, #4caf50 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    pointer-events: none;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 250px;
    text-align: center;
    white-space: nowrap;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.chart-tooltip.visible {
    opacity: 1;
    transform: translateY(-5px);
}

.chart-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -8px;
    border-width: 8px;
    border-style: solid;
    border-color: #4caf50 transparent transparent transparent;
}

canvas {
    max-width: 100%;
    min-height: 400px;
    margin: 20px 0;
    border: 3px solid transparent;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffffff 0%, #fafafa 100%);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

#injection-drug-chart {
    min-height: 600px;
    height: 600px;
}

.injection-section {
    margin-bottom: 30px;
}


.injection-mobile-nav {
    display: none;
    position: relative;
}

.mobile-nav-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.75) 0%, rgba(236, 242, 255, 0.55) 100%);
    color: #0c3c5c;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: none;
    transition: all 0.25s ease;
    touch-action: manipulation;
}

.mobile-nav-toggle:hover {
    box-shadow: 0 12px 24px rgba(33, 150, 243, 0.22);
}

.mobile-nav-current-label {
    flex: 1;
    text-align: center;
}

.mobile-nav-icon,
.mobile-nav-icon::before,
.mobile-nav-icon::after {
    display: none;
}

.mobile-nav-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition: max-height 0.25s ease, opacity 0.25s ease;
}

.injection-mobile-nav.open .mobile-nav-options {
    max-height: 320px;
    opacity: 1;
    pointer-events: auto;
}

.mobile-nav-button {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(33, 150, 243, 0.4);
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(240, 248, 255, 0.55) 100%);
    color: #0c3c5c;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    touch-action: manipulation;
}

.mobile-nav-button.active,
.mobile-nav-button:hover {
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    color: #fff;
    box-shadow: 0 8px 20px rgba(33, 150, 243, 0.2);
}

.injection-hero {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 30px;
    margin-bottom: 25px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1) 0%, rgba(33, 150, 243, 0.1) 100%);
    border-radius: 16px;
    border: 1px solid rgba(76, 175, 80, 0.2);
}

.hero-heading h2 {
    font-size: 2rem;
    color: #1d4730;
    margin-bottom: 8px;
}

.hero-heading p {
    color: #446a53;
    font-weight: 500;
}

.hero-status {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
    align-items: center;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 999px;
    background: linear-gradient(135deg, #4caf50 0%, #2196f3 100%);
    color: white;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 6px 20px rgba(33, 150, 243, 0.25);
    white-space: nowrap;
}

.injection-alert {
    display: none;
    padding: 18px 22px;
    border-radius: 14px;
    margin-bottom: 25px;
    background: linear-gradient(135deg, rgba(233, 30, 99, 0.15) 0%, rgba(156, 39, 176, 0.15) 100%);
    border: 1px solid rgba(156, 39, 176, 0.3);
    color: #6a1b9a;
    font-weight: 600;
    font-size: 1rem;
}

.injection-alert.visible {
    display: block;
}

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

.phase-card {
    padding: 18px;
    border-radius: 14px;
    border: 1px solid rgba(0,0,0,0.08);
    background: linear-gradient(135deg, #ffffff 0%, #f7fbff 100%);
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    position: relative;
    overflow: hidden;
}

.phase-card::before {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.12;
}

.phase-card.phase-1::before,
.phase-card.direction-start::before { background: linear-gradient(135deg, #4caf50, #81c784); }
.phase-card.phase-2::before,
.phase-card.direction-increase::before { background: linear-gradient(135deg, #2196f3, #64b5f6); }
.phase-card.phase-3::before,
.phase-card.direction-decrease::before { background: linear-gradient(135deg, #ff7043, #ff8a65); }
.phase-card.phase-4::before,
.phase-card.direction-maintain::before { background: linear-gradient(135deg, #9c27b0, #ba68c8); }

.phase-card h4 {
    margin-bottom: 6px;
    color: #1f3d2b;
    font-size: 1.05rem;
}

.phase-card p {
    margin-bottom: 4px;
    color: #425849;
    font-size: 0.9rem;
}

.phase-card.current-phase {
    border-color: rgba(33, 150, 243, 0.7);
    box-shadow: 0 16px 40px rgba(33, 150, 243, 0.2);
}

.phase-dose {
    font-weight: 700;
    font-size: 1.2rem;
    color: #0c3c5c;
}

.phase-range {
    font-weight: 600;
    color: #2c5530;
}

.phase-description {
    font-size: 0.9rem;
    color: #546e61;
    line-height: 1.4;
}

.injection-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    margin-bottom: 30px;
}

.metric-card {
    background: linear-gradient(135deg, #ffffff 0%, #f0f4ff 100%);
    border-radius: 18px;
    padding: 22px;
    border: 1px solid rgba(33, 150, 243, 0.2);
    box-shadow: 0 18px 36px rgba(33, 150, 243, 0.12);
    position: relative;
    overflow: hidden;
}

.metric-card::after {
    content: '';
    position: absolute;
    right: -30px;
    top: -30px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: rgba(33, 150, 243, 0.09);
    z-index: 0;
}

.metric-label {
    font-weight: 600;
    color: #1d4730;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.metric-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0c3c5c;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.metric-subtext {
    color: #5b7079;
    font-size: 0.9rem;
    position: relative;
    z-index: 1;
}

.chart-section {
    margin-bottom: 30px;
    padding: 24px;
    border-radius: 20px;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.08) 0%, rgba(33, 150, 243, 0.08) 100%);
    border: 1px solid rgba(76, 175, 80, 0.15);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.chart-header h3 {
    font-size: 1.5rem;
    color: #1d4730;
}

.chart-phase-indicator {
    margin-top: 8px;
    display: inline-flex;
    align-items: center;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(233, 30, 99, 0.12);
    color: #9c1b31;
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.chart-phase-indicator.phase-visible {
    box-shadow: 0 0 0 1px rgba(17, 24, 39, 0.08);
}

.chart-caption {
    font-size: 0.9rem;
    color: #446a53;
    margin: 6px 0 12px 0;
}

.chart-guide {
    padding: 22px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(12, 60, 92, 0.08) 0%, rgba(29, 71, 48, 0.05) 100%);
    border: 1px solid rgba(12, 60, 92, 0.1);
    margin-bottom: 35px;
}

.chart-guide h4 {
    margin-bottom: 15px;
    color: #0c3c5c;
}

.chart-guide ul {
    list-style: none;
    display: grid;
    gap: 10px;
    padding-left: 0;
}

.chart-guide-list {
    grid-template-columns: 1fr;
}

.chart-guide li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: #355261;
    font-size: 0.95rem;
}

.chart-guide-text {
    display: inline-block;
    line-height: 1.4;
}

.phase-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.legend-line {
    width: 0;
    height: 18px;
    border-left: 2px dotted rgba(12, 60, 92, 0.8);
    flex-shrink: 0;
    margin-right: 6px;
}

.legend-line.legend-now {
    border-color: rgba(12, 60, 92, 0.8);
}

.phase-dot.phase-2-5 { background: #4caf50; }
.phase-dot.phase-5 { background: #ff9800; }
.phase-dot.phase-10 { background: #f44336; }
.phase-dot.phase-15 { background: #9c27b0; }

.form-section,
.history-section {
    margin-bottom: 30px;
}

.records-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 28px;
    align-items: stretch;
}

.records-layout .history-section {
    margin-bottom: 0;
}

.history-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 28px;
    border-radius: 28px;
    background: linear-gradient(160deg, rgba(76, 175, 80, 0.12) 0%, rgba(33, 150, 243, 0.08) 100%);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 24px 48px rgba(12, 60, 92, 0.12);
    backdrop-filter: blur(6px);
    min-height: 0;
}

.history-card-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
}

.history-card-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: #1d4730;
}

.history-card-label {
    margin: 0;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(29, 71, 48, 0.65);
}

.history-card-primary {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    color: #0c3c5c;
}

.history-card-secondary {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(12, 60, 92, 0.75);
}

.history-card-action {
    background: rgba(255, 255, 255, 0.85);
    color: #0c3c5c;
    box-shadow: none;
    border-radius: 999px;
    padding: 10px 20px;
    font-size: 0.95rem;
    line-height: 1.2;
    border: 1px solid rgba(12, 60, 92, 0.12);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.history-card-action:hover,
.history-card-action:focus {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 12px 24px rgba(12, 60, 92, 0.2);
}

.history-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    min-height: 44px;
}

.history-chip {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(12, 60, 92, 0.08);
    color: #0c3c5c;
    font-size: 0.95rem;
    backdrop-filter: blur(4px);
}

.history-chip span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: rgba(12, 60, 92, 0.75);
    font-weight: 500;
}

.history-chip .chip-meta {
    font-size: 0.8rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(12, 60, 92, 0.6);
    font-weight: 600;
}

.history-chip strong {
    font-weight: 600;
}

.history-chip[data-phase]::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--chip-phase-color, #4caf50);
    flex-shrink: 0;
}

.history-chip.user-entry {
    background: rgba(255, 255, 255, 0.9);
}

.history-chip.empty-state {
    background: rgba(12, 60, 92, 0.04);
    border-style: dashed;
    color: rgba(12, 60, 92, 0.6);
    font-weight: 500;
}

.history-sheet {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.history-sheet.is-visible {
    pointer-events: auto;
    opacity: 1;
}

.history-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 24, 18, 0.35);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.35s ease;
}

.history-sheet.is-visible .history-sheet-backdrop {
    opacity: 1;
}

.history-sheet-panel {
    position: relative;
    width: min(640px, calc(100vw - 24px));
    max-height: min(80vh, 720px);
    background: rgba(255, 255, 255, 0.94);
    border-radius: 28px 28px 0 0;
    box-shadow: 0 -8px 50px rgba(12, 60, 92, 0.2);
    transform: translate3d(0, 120%, 0);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-sheet.is-visible .history-sheet-panel {
    transform: translate3d(0, 0, 0);
}

.history-sheet-handle {
    width: 56px;
    height: 6px;
    border-radius: 999px;
    background: rgba(12, 60, 92, 0.15);
    margin: 14px auto 6px;
}

.history-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px 20px;
    border-bottom: 1px solid rgba(12, 60, 92, 0.08);
    gap: 20px;
}

.history-sheet-title-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-sheet-title-group h2 {
    margin: 0;
    font-size: 1.25rem;
    color: #0c3c5c;
}

.history-sheet-subtitle {
    margin: 0;
    font-size: 0.95rem;
    color: rgba(12, 60, 92, 0.7);
}

.history-sheet-close {
    background: rgba(12, 60, 92, 0.08);
    color: #0c3c5c;
    border-radius: 999px;
    padding: 10px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: none;
    border: none;
}

.history-sheet-close:hover,
.history-sheet-close:focus {
    background: rgba(12, 60, 92, 0.16);
    transform: translateY(-1px);
}

.history-sheet-body {
    padding: 12px 24px 32px;
    overflow-y: auto;
    flex: 1;
    scroll-behavior: smooth;
}

.history-sheet-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.history-sheet-list .record-item {
    margin-bottom: 0;
    border-radius: 18px;
    border: 1px solid rgba(12, 60, 92, 0.08);
    box-shadow: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(248, 252, 250, 0.95));
}

.history-sheet-list .record-item:hover {
    box-shadow: 0 16px 32px rgba(12, 60, 92, 0.12);
}

.history-sheet-list .delete-btn {
    background: rgba(12, 60, 92, 0.08);
    color: #0c3c5c;
}

.history-sheet-list .delete-btn:hover {
    background: rgba(12, 60, 92, 0.16);
}

body.sheet-open {
    overflow: hidden;
}

@media (max-width: 960px) {
    .records-layout {
        grid-template-columns: 1fr;
    }

    .history-card {
        padding: 24px;
    }
}

@media (max-width: 600px) {
    .history-card-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .history-card-action {
        width: 100%;
        justify-content: center;
    }

    .history-sheet-panel {
        width: min(540px, calc(100vw - 16px));
        border-radius: 24px 24px 0 0;
    }

    .history-sheet-body {
        padding: 12px 20px 28px;
    }
}

.weight-section {
    margin-top: 20px;
}

.weight-section h2 {
    color: #1d4730;
    margin-bottom: 20px;
}

.weight-overview {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    align-items: stretch;
    margin-bottom: 30px;
}

.weight-chart-card {
    flex: 2 1 520px;
}

.weight-aside-stack {
    flex: 1 1 320px;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.weight-form-card {
    flex: none;
}

.profile-card {
    flex: none;
}

.profile-card-header {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-card-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.profile-card-tagline {
    margin: 0;
    color: #356046;
    font-size: 0.95rem;
}

.profile-reminder-highlight {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.18), rgba(33, 150, 243, 0.18));
    border: 1px solid rgba(76, 175, 80, 0.35);
    border-radius: 16px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: 0 12px 24px rgba(44, 85, 48, 0.08);
    margin-bottom: 16px;
}

.profile-reminder-highlight.profile-reminder-ready {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.24), rgba(33, 150, 243, 0.24));
    border-color: rgba(16, 83, 50, 0.6);
    box-shadow: 0 16px 28px rgba(26, 89, 58, 0.12);
}

.profile-reminder-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #1d4730;
    font-weight: 600;
}

.profile-reminder-value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #103b5d;
}

.profile-reminder-highlight.profile-reminder-ready .profile-reminder-value {
    color: #0f5132;
}

.profile-reminder-subtext {
    font-size: 0.9rem;
    color: #355261;
}

.profile-reminder-highlight.profile-reminder-ready .profile-reminder-subtext {
    color: #1d4730;
}

.profile-summary {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.profile-summary-heading {
    font-weight: 600;
    color: #1d4730;
    margin: 0;
}

.profile-summary-details {
    display: flex;
    flex-direction: column;
    gap: 6px;
    color: #355261;
    font-size: 0.95rem;
}

.weight-bmi-card {
    flex: none;
    min-height: 0;
}

.weight-bmi-card .metric-value {
    font-size: 2.2rem;
}

.metric-extra {
    position: relative;
    z-index: 1;
    color: #355261;
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}

.weight-history {
    margin-top: 20px;
}

.history-section h3,
.form-section h3 {
    color: #1d4730;
}

.history-section {
    padding: 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(240, 248, 255, 0.8) 100%);
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.data-vault-card {
    margin-top: 30px;
    padding: 24px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(240, 250, 255, 0.9) 100%);
    border: 1px solid rgba(33, 150, 243, 0.15);
    box-shadow: 0 12px 26px rgba(33, 150, 243, 0.1);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.data-vault-card h3 {
    color: #1d4730;
}

.vault-description {
    color: #355261;
    max-width: 520px;
}

.vault-pwa-status {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.pwa-status-label {
    font-weight: 600;
    color: #355261;
}

.pwa-status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: 999px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.15) 0%, rgba(76, 175, 80, 0.15) 100%);
    color: #0c3c5c;
    text-transform: uppercase;
    font-size: 0.75rem;
}

.pwa-status-pill.browser {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.25) 0%, rgba(255, 152, 0, 0.25) 100%);
    color: #5a3a00;
}

.pwa-status-pill.installed {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.25) 0%, rgba(33, 150, 243, 0.25) 100%);
    color: #104627;
}

.vault-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.vault-actions button {
    min-width: 160px;
}

.vault-status {
    min-height: 1.2em;
    color: #1d4730;
    font-weight: 600;
}

.vault-status.info {
    color: #0c3c5c;
}

.vault-status.success {
    color: #1b5e20;
}

.vault-status.error {
    color: #b71c1c;
}

.form-section form {
    padding: 20px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(245, 250, 255, 0.95) 100%);
    border: 1px solid rgba(33, 150, 243, 0.15);
    box-shadow: 0 12px 24px rgba(33, 150, 243, 0.12);
}

.empty-state {
    text-align: center;
    color: #666;
    padding: 40px 20px;
    font-style: italic;
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
    .container {
        padding: 10px;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }
    
    header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    header h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .tabs {
        flex-direction: column;
        margin-bottom: 15px;
        gap: 2px;
    }
    
    .tab-button {
        border-bottom: 1px solid #ddd;
        border-right: none;
        padding: 12px 16px;
        font-size: 16px;
        min-height: 44px; /* Better touch target */
        border-radius: 8px;
        margin-bottom: 2px;
    }
    
    .tab-button.active {
        border-bottom-color: transparent;
        border-radius: 8px;
    }
    
    .tab-content {
        padding: 15px 0;
    }
    
    .tab-content h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .tab-content h3 {
        font-size: 1.2rem;
        margin: 20px 0 10px 0;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group input,
    .form-group select {
        max-width: 100%;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 14px 12px;
        min-height: 44px; /* Better touch target */
    }
    
    button {
        min-height: 44px; /* Better touch target */
        padding: 12px 20px;
        font-size: 16px;
        width: 100%;
        max-width: 300px;
    }
    
    .record-item {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px;
        padding-right: 40px;
        margin-bottom: 8px;
        position: relative;
    }
    
    .record-item-content {
        width: 100%;
        margin-bottom: 10px;
        padding-right: 0;
    }
    
    .record-item-date {
        font-size: 14px;
        margin-bottom: 4px;
    }
    
    .record-item-details {
        font-size: 13px;
        line-height: 1.4;
    }
    
    .delete-btn {
        position: absolute;
        top: 6px;
        right: 6px;
        width: 28px;
        height: 28px;
        font-size: 18px;
    }
    
    .predefined-label {
        font-size: 10px;
        padding: 4px 8px;
    }

    .container {
        padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px));
    }

    #treatment-dashboard {
        padding-bottom: calc(50px + env(safe-area-inset-bottom, 0px));
    }

    .injection-mobile-nav {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        position: fixed;
        right: calc(env(safe-area-inset-right, 0px) + 20px);
        left: auto;
        bottom: calc(env(safe-area-inset-bottom, 0px) + 96px);
        transform: none;
        width: auto;
        padding: 0;
        gap: 0;
        background: transparent;
        border: none;
        box-shadow: none;
        z-index: 1200;
    }

    .mobile-nav-toggle {
        width: 50px;
        height: 50px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.42) 0%, rgba(210, 232, 255, 0.2) 100%);
        border: 1px solid rgba(255, 255, 255, 0.3);
        box-shadow: 0 16px 28px rgba(15, 30, 60, 0.20);
        backdrop-filter: blur(28px) saturate(220%) contrast(110%);
        -webkit-backdrop-filter: blur(28px) saturate(220%) contrast(110%);
        touch-action: manipulation;
    }

    .mobile-nav-icon,
    .mobile-nav-icon::before,
    .mobile-nav-icon::after {
        display: block;
        position: relative;
        width: 20px;
        height: 2px;
        background: #0c3c5c;
        border-radius: 2px;
        transition: transform 0.25s ease, opacity 0.25s ease;
    }

    .mobile-nav-icon::before,
    .mobile-nav-icon::after {
        content: '';
        position: absolute;
        left: 0;
    }

    .mobile-nav-icon::before {
        top: -7px;
    }

    .mobile-nav-icon::after {
        top: 7px;
    }

    .injection-mobile-nav.open .mobile-nav-icon {
        background: transparent;
    }

    .injection-mobile-nav.open .mobile-nav-icon::before {
        transform: translateY(7px) rotate(45deg);
    }

    .injection-mobile-nav.open .mobile-nav-icon::after {
        transform: translateY(-7px) rotate(-45deg);
    }

    .mobile-nav-options {
        position: absolute;
        bottom: calc(96px + env(safe-area-inset-bottom, 0px));
        right: 0;
        min-width: 200px;
        max-width: 68vw;
        padding: 12px;
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.34) 0%, rgba(210, 232, 255, 0.21) 70%, rgba(180, 215, 250, 0.14) 100%);
        border: 1px solid rgba(255, 255, 255, 0.28);
        border-radius: 20px;
        box-shadow: 0 18px 32px rgba(15, 30, 60, 0.18);
        backdrop-filter: blur(28px) saturate(220%) contrast(108%);
        -webkit-backdrop-filter: blur(28px) saturate(220%) contrast(108%);
        opacity: 0;
        pointer-events: none;
        transform: translateY(14px);
        max-height: none;
        transition: opacity 0.25s ease, transform 0.25s ease;
    }

    .injection-mobile-nav.open .mobile-nav-options {
        opacity: 1;
        pointer-events: auto;
        transform: translateY(0);
    }

    .mobile-nav-button {
        width: 100%;
        padding: 9px 11px;
        border-radius: 12px;
        border: 1px solid rgba(33, 150, 243, 0.32);
        background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(240, 248, 255, 0.6) 100%);
        color: #0c3c5c;
        text-align: left;
    }

    .chart-info {
        padding: 12px;
        margin-bottom: 15px;
        font-size: 14px;
    }
    
    .chart-info li {
        font-size: 13px;
        padding: 2px 0;
    }
    
    canvas {
        width: 100% !important;
        height: auto !important;
        max-height: 300px;
        margin: 15px 0;
        min-height: 250px;
    }
    
    .enhanced-chart {
        padding: 15px;
        margin: 15px 0;
    }
    
    .chart-controls {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        margin: 15px 0;
        padding: 12px;
        text-align: center;
    }

    .chart-header {
        flex-direction: column;
        align-items: center;
    }

    .chart-header h3 {
        text-align: center;
        width: 100%;
    }

    .chart-phase-indicator {
        align-self: center;
        margin-left: auto;
        margin-right: auto;
        text-align: center;
    }

    .chart-controls label {
        display: block;
        font-size: 14px;
        margin-bottom: 12px;
    }

    .range-display {
        width: 100%;
        justify-content: center;
        text-align: center;
    }

    .injection-range-controls {
        align-items: center;
        justify-content: center;
    }

    .range-control-wrap {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .range-stepper {
        justify-content: center;
        gap: 16px;
    }

    .range-adjust {
        width: 48px;
        height: 48px;
    }

    .range-presets {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }

    .range-preset {
        flex: 0 1 auto;
        min-width: 110px;
        padding: 10px 14px;
        text-align: center;
    }
    
    .chart-controls select {
        width: 100%;
        max-width: 200px;
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 12px;
    }
    
    .chart-container {
        width: 100%;
        overflow-x: auto;
    }
    
    .chart-tooltip {
        font-size: 11px;
        padding: 6px 8px;
        max-width: 150px;
    }
    
    .empty-state {
        padding: 30px 15px;
        font-size: 14px;
    }
}

/* Tablet responsiveness */
@media (max-width: 1024px) and (min-width: 769px) {
    .container {
        padding: 15px;
        max-width: 100%;
    }
    
    .tabs {
        justify-content: center;
    }
    
    .tab-button {
        flex: 1;
        max-width: 200px;
    }
    
    canvas {
        width: 100%;
        max-width: 600px;
    }
}

/* Small mobile devices */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    header h1 {
        font-size: 1.6rem;
    }
    
    .tab-button {
        padding: 10px 14px;
        font-size: 15px;
    }
    
    .form-group input,
    .form-group select {
        padding: 12px 10px;
    }
    
    .record-item {
        padding: 10px;
    }
    
    .chart-info {
        padding: 10px;
    }

    .injection-hero {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .hero-status {
        justify-content: flex-start;
    }

    .status-pill {
        width: 100%;
        justify-content: center;
    }

    .injection-mobile-nav {
        right: calc(env(safe-area-inset-right, 0px) + 14px);
        bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
    }

    .mobile-nav-toggle {
        width: 52px;
        height: 52px;
        box-shadow: 0 14px 26px rgba(15, 30, 60, 0.22);
    }

    .mobile-nav-options {
        min-width: 200px;
        max-width: 78vw;
        padding: 12px;
    }

    .mobile-nav-button {
        padding: 9px 12px;
    }

    .injection-section {
        display: none;
        margin-bottom: 0;
    }

    .injection-section.active {
        display: block;
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    }

    .phase-timeline,
    .injection-metrics {
        grid-template-columns: 1fr;
    }

    .chart-section {
        padding: 18px;
    }

    #injection-drug-chart {
        min-height: 420px;
        height: 420px;
    }

    .chart-guide {
        padding: 18px;
    }

    .chart-caption {
        font-size: 0.8rem;
        margin: 4px 0 10px 0;
    }

    .range-presets {
        flex-direction: column;
        gap: 8px;
    }

    .range-preset {
        width: 100%;
    }

    .weight-overview {
        flex-direction: column;
        align-items: stretch;
    }

    .weight-chart-card,
    .weight-form-card,
    .weight-aside-stack {
        flex: 1 1 100%;
    }

    .weight-bmi-card {
        width: 100%;
    }
}
