.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0;
    cursor: pointer;
    font-size: 13px;
    font-family: var(--ascii-font-family);
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    text-shadow: 0 0 5px var(--primary-color);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    line-height: 1;
    vertical-align: middle;
    margin: 0 4px;
    gap: 0;
    text-align: center;
}

.nav-btn::before {
    content: '╔═══════════════╗';
    display: block;
    width: 100%;
    text-align: center;
    color: var(--primary-color);
    opacity: 0.7;
    pointer-events: none;
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1.2;
    text-shadow: 0 0 3px var(--primary-color);
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    height: auto;
}

.nav-btn::after {
    content: '╚═══════════════╝';
    display: block;
    width: 100%;
    text-align: center;
    color: var(--primary-color);
    opacity: 0.7;
    pointer-events: none;
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1.2;
    text-shadow: 0 0 3px var(--primary-color);
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    height: auto;
}

.nav-btn > * {
    display: block;
    line-height: 1.2;
    padding: 6px 0;
    margin: 0;
    text-align: center;
    font-size: 13px;
    font-family: var(--ascii-font-family);
    width: 100%;
    box-sizing: border-box;
    letter-spacing: inherit;
    text-indent: 0;
    padding-left: 0;
    padding-right: 0;
}


.nav-btn:hover {
    background: rgba(var(--primary-rgb), 0.05);
    text-shadow: 0 0 10px var(--primary-color);
}

.nav-btn:hover::before,
.nav-btn:hover::after {
    opacity: 0.9;
    text-shadow: 0 0 8px var(--primary-color);
}

.nav-btn.active {
    background: rgba(251, 185, 84, 0.15);
    color: var(--torch-gold);
    text-shadow: 0 0 10px var(--torch-gold), 0 0 20px var(--torch-gold);
    animation: runePulse 2s ease-in-out infinite;
    text-align: center !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    justify-content: center;
}

.nav-btn.active::before {
    content: '╔═══════════════╗\A╔╩═══════════════╩╗\A║▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓║';
    color: var(--torch-gold);
    opacity: 1;
    text-shadow: 0 0 8px var(--torch-gold);
    white-space: pre;
    line-height: 1.2;
    margin: 0;
    padding: 0;
    text-align: center;
    width: 100%;
}

.nav-btn.active::after {
    content: '║▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓║\A╚╦═══════════════╦╝\A╚═══════════════╝';
    color: var(--torch-gold);
    opacity: 1;
    text-shadow: 0 0 8px var(--torch-gold);
    white-space: pre;
    line-height: 1.2;
    margin: 0;
    padding: 0;
    text-align: center;
    width: 100%;
}

.nav-btn.active > * {
    margin: 0;
    text-align: center;
    box-sizing: border-box;
    padding: 6px 0;
    padding-left: 0 !important;
    padding-right: 0 !important;
    letter-spacing: 2px;
    text-indent: 0;
    width: 100%;
    display: block;
    position: relative;
    left: 0;
    right: 0;
}

.page { display: none; }
.page.active { display: block; }

.card {
    background: rgba(26, 26, 26, 0.6);
    border: none;
    border-top: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    border-left: 1px solid rgba(var(--primary-rgb), 0.3);
    border-right: 1px solid rgba(var(--primary-rgb), 0.3);
    padding: 0;
    margin-bottom: 20px;
    position: relative;
    box-shadow:
            0 0 10px rgba(var(--primary-rgb), 0.15),
            inset 0 0 15px rgba(var(--primary-rgb), 0.03);
    font-family: var(--ascii-font-family);
    box-sizing: border-box;
    transition: box-shadow 0.3s ease;
}

.card::before {
    content: '┏\A┗';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1;
    color: var(--primary-color);
    text-shadow: 0 0 3px var(--primary-color);
    white-space: pre;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1;
}

.card::after {
    content: '┓\A┛';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1;
    color: var(--primary-color);
    text-shadow: 0 0 3px var(--primary-color);
    white-space: pre;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: right;
    z-index: 1;
}

body:has(.torch-left) .card {
    box-shadow:
            0 0 10px rgba(var(--primary-rgb), 0.15),
            inset 0 0 15px rgba(var(--primary-rgb), 0.03),
            -30px 0 60px rgba(255, 165, 0, 0.08),
            -60px 0 100px rgba(255, 100, 0, 0.04);
}

body:has(.torch-right) .card {
    box-shadow:
            0 0 10px rgba(var(--primary-rgb), 0.15),
            inset 0 0 15px rgba(var(--primary-rgb), 0.03),
            30px 0 60px rgba(255, 165, 0, 0.08),
            60px 0 100px rgba(255, 100, 0, 0.04);
}

.card:hover {
    animation: torchFlickerBorder 1.5s ease-in-out infinite;
}


.card-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
    flex-wrap: wrap;
    gap: 10px;
    border: none;
    border-bottom: 2px solid var(--primary-color);
    padding: 15px 20px;
    background: rgba(var(--primary-rgb), 0.05);
    position: relative;
}

.card-header .card-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
}

.card-header > .btn,
.card-header > button,
.card-header > div:has(button) {
    margin-left: auto;
    z-index: 2;
}

.card-header::before {
    content: '┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1.2;
    color: var(--primary-color);
    text-shadow: 0 0 3px var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    z-index: 0;
    opacity: 0.8;
    text-align: center;
}

.card-header::after {
    content: '┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1.2;
    color: var(--primary-color);
    text-shadow: 0 0 3px var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    z-index: 0;
    opacity: 0.8;
    text-align: center;
}

.card-header > * {
    position: relative;
    z-index: 1;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    text-shadow: 
        0 0 5px rgba(var(--primary-rgb), 0.5),
        0 0 10px rgba(var(--primary-rgb), 0.3);
    display: inline-block;
    align-items: center;
    line-height: 1.2;
    font-family: var(--ascii-font-family);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 auto;
    padding: 0;
    text-align: center;
    width: auto;
}

.card-title::before {
    content: '⚔═══[ ';
    color: var(--torch-gold);
    text-shadow: 0 0 5px var(--torch-gold);
    line-height: 1.2;
    font-size: 13px;
    font-family: var(--ascii-font-family);
    display: inline-block;
    vertical-align: baseline;
}

.card-title::after {
    content: ' ]═══⚔';
    color: var(--torch-gold);
    text-shadow: 0 0 5px var(--torch-gold);
    line-height: 1.2;
    font-size: 13px;
    font-family: var(--ascii-font-family);
    display: inline-block;
    vertical-align: baseline;
}

.card > *:not(.card-header) {
    padding: 20px;
}

.btn {
    background: transparent;
    color: var(--primary-color);
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    font-family: var(--ascii-font-family);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    position: relative;
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    line-height: 1;
    vertical-align: middle;
    margin: 2px;
    gap: 0;
}

.btn::before {
    content: '╔═══════════════╗';
    display: block;
    width: 100%;
    text-align: center;
    color: var(--primary-color);
    opacity: 0.7;
    pointer-events: none;
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1.2;
    text-shadow: 0 0 3px var(--primary-color);
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
}

.btn::after {
    content: '╚═══════════════╝';
    display: block;
    width: 100%;
    text-align: center;
    color: var(--primary-color);
    opacity: 0.7;
    pointer-events: none;
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1.2;
    text-shadow: 0 0 3px var(--primary-color);
    margin: 0;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
}

.btn > * {
    display: block;
    line-height: 1.2;
    padding: 5px 18px;
    margin: 0;
    text-align: center;
    font-size: 13px;
    font-family: var(--ascii-font-family);
}

.btn > *::before {
    content: '▶ ';
    opacity: 0;
    transition: opacity 0.2s;
    margin-right: 4px;
}

.btn:hover > *::before {
    opacity: 0.7;
}

.btn:hover {
    text-shadow: 0 0 10px var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 0 10px var(--primary-color), 0 0 20px rgba(var(--primary-rgb), 0.3);
}

.btn:hover::before,
.btn:hover::after {
    opacity: 1;
    text-shadow: 0 0 8px var(--primary-color);
}

/* Button States */
.btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: var(--glow-medium, 0 0 10px rgba(var(--primary-rgb), 0.4));
}

.btn:disabled, .btn[disabled] {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

.nav-btn:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: var(--glow-medium, 0 0 10px rgba(var(--primary-rgb), 0.4));
}

/* Card Elevated Modifier */
.card--elevated {
    box-shadow: var(--shadow-card, 0 0 10px rgba(var(--primary-rgb), 0.15)),
                0 4px 20px rgba(0, 0, 0, 0.4);
}

.btn-secondary {
    background: transparent;
    color: var(--text-primary);
}

.btn-secondary::before {
    content: '┌───────────────┐';
    color: var(--text-secondary);
    opacity: 0.6;
    line-height: 1.2;
}

.btn-secondary::after {
    content: '└───────────────┘';
    color: var(--text-secondary);
    opacity: 0.6;
    line-height: 1.2;
}

.btn-danger {
    background: transparent;
    color: var(--blood-red);
}

.btn-danger::before {
    color: var(--blood-red);
}

.btn-danger::after {
    color: var(--blood-red);
}

.btn-danger > *::after {
    content: ' ☠';
    color: var(--blood-red);
    text-shadow: 0 0 5px var(--blood-red);
    margin-left: 4px;
}

.btn-danger:hover {
    text-shadow: 0 0 10px var(--blood-red);
    box-shadow: 0 0 10px var(--blood-red), 0 0 20px rgba(204, 0, 0, 0.3);
}

.btn-danger:hover::before,
.btn-danger:hover::after {
    color: var(--blood-red);
    text-shadow: 0 0 8px var(--blood-red);
}
.btn-small {
    font-size: 12px;
}

.btn-small > * {
    padding: 4px 10px;
    font-size: 12px;
}

.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--bg-dungeon-stone);
    border: none;
    border-top: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    border-left: 1px solid rgba(var(--primary-rgb), 0.3);
    border-right: 1px solid rgba(var(--primary-rgb), 0.3);
    padding: 0;
    position: relative;
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.1);
    font-family: var(--ascii-font-family);
}

.stat-card::before {
    content: '┏\A┗';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1;
    color: var(--primary-color);
    text-shadow: 0 0 3px var(--primary-color);
    white-space: pre;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    z-index: 1;
}

.stat-card::after {
    content: '┓\A┛';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 0;
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1;
    color: var(--primary-color);
    text-shadow: 0 0 3px var(--primary-color);
    white-space: pre;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    text-align: right;
    z-index: 1;
}

.stat-card > * {
    position: relative;
    z-index: 2;
    padding: 20px;
    text-align: center;
}

.stat-card h3 {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin: 0 auto 8px auto;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    padding-top: 45px;
    line-height: 1.2;
    font-family: var(--ascii-font-family);
    text-align: center;
    width: 100%;
    box-sizing: border-box;
    display: block;
}

.stat-card h3::before {
    content: '╱╲\A╱☠╲\A╱══╲';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--ascii-font-family);
    font-size: 13px;
    line-height: 1.2;
    white-space: pre;
    text-align: center;
    color: var(--torch-gold);
    text-shadow: 0 0 5px var(--torch-gold);
    opacity: 0.8;
    margin: 0;
    padding: 0;
    display: block;
    width: auto;
}

.stat-card:nth-child(2) h3::before {
    content: '╱╲\A╱⚔╲\A╱══╲';
}

.stat-card:nth-child(3) h3::before {
    content: '╱╲\A╱🧪╲\A╱══╲';
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: var(--glow);
    text-align: center;
    margin: 10px 0;
    line-height: 1.2;
    font-family: var(--ascii-font-family);
}

.stat-sub {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 5px;
    text-align: center;
    line-height: 1.2;
    font-family: var(--ascii-font-family);
}

.form-group { margin-bottom: 15px; }
.form-group label { display: block; margin-bottom: 5px; color: var(--text-secondary); font-size: 14px; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--primary-color);
    color: var(--text-primary);
    padding: 10px 12px;
    font-size: 14px;
    font-family: var(--ascii-font-family);
    transition: all 0.2s;
    box-shadow: 0 0 2px var(--primary-color);
    position: relative;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--glow);
    background: rgba(var(--primary-rgb), 0.05);
}

select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
}

select option {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

select option:hover,
select option:focus,
select option:checked {
    background: rgba(var(--primary-rgb, 0, 255, 0), 0.2) !important;
    color: var(--primary-color) !important;
}

#analysis-select {
    background: var(--bg-primary) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
}

#analysis-select option {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

#analysis-select option:hover,
#analysis-select option:focus,
#analysis-select option:checked {
    background: rgba(var(--primary-rgb), 0.2) !important;
    color: var(--primary-color) !important;
}

.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px; }

.status-normal {
    color: var(--primary-color);
    text-shadow: 0 0 5px rgba(var(--primary-rgb), 0.5);
}
.status-low {
    color: var(--blue);
    text-shadow: 0 0 5px rgba(0, 170, 255, 0.5);
}
.status-high {
    color: var(--red);
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}
.status-slightly-high {
    color: var(--yellow);
    text-shadow: 0 0 5px rgba(255, 255, 0, 0.5);
}

.delta {
    font-size: 12px;
    padding: 2px 6px;
    border: 1px solid;
    font-weight: 600;
}
.delta-up {
    border-color: var(--red);
    color: var(--red);
    text-shadow: 0 0 5px rgba(255, 0, 0, 0.5);
}
.delta-down {
    border-color: var(--blue);
    color: var(--blue);
    text-shadow: 0 0 5px rgba(0, 170, 255, 0.5);
}
.delta-same {
    border-color: #666;
    color: #666;
}

.drug-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    transition: all 0.2s;
}

.drug-card:hover {
    background: rgba(var(--primary-rgb), 0.05);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.2);
}

.drug-info h4 {
    font-size: 1em;
    margin-bottom: 4px;
    color: var(--primary-color);
}
.drug-info p {
    color: var(--text-secondary);
    font-size: 13px;
}

.drug-badge {
    padding: 4px 10px;
    border: 1px solid;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
}
.badge-oral {
    border-color: var(--purple);
    color: var(--purple);
    text-shadow: 0 0 5px rgba(170, 0, 255, 0.5);
}
.badge-inject {
    border-color: var(--blue);
    color: var(--blue);
    text-shadow: 0 0 5px rgba(0, 170, 255, 0.5);
}

.log-entry {
    display: flex;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}

.log-date { color: var(--text-secondary); font-size: 13px; min-width: 100px; }
.log-content { flex: 1; }
.log-drug { font-weight: 500; }
.log-dose { color: var(--text-secondary); font-size: 13px; }

.analysis-selector { 
    display: flex; 
    gap: 10px; 
    margin-bottom: 20px; 
    flex-wrap: wrap; 
    align-items: center; 
}

.analysis-selector label {
    color: var(--text-secondary);
    font-size: 14px;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    height: 42px;
    line-height: 1;
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

.analysis-selector select,
#analysis-select {
    flex: 1;
    min-width: 250px;
    background: var(--bg-primary) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-primary) !important;
    padding: 10px 35px 10px 12px !important;
    font-size: 14px !important;
    font-family: inherit !important;
    transition: all 0.2s;
    cursor: pointer;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300ff00' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
    height: 42px !important;
    line-height: 22px !important;
    box-sizing: border-box !important;
    vertical-align: middle !important;
}

.analysis-selector select option {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    padding: 8px 12px !important;
}

.analysis-selector select option:hover,
.analysis-selector select option:focus,
.analysis-selector select option:checked,
.analysis-selector select option:active {
    background: rgba(var(--primary-rgb), 0.2) !important;
    color: var(--primary-color) !important;
}

.analysis-selector select:focus {
    outline: none !important;
    border-color: var(--primary-color) !important;
    box-shadow: var(--glow) !important;
    background-color: rgba(var(--primary-rgb), 0.05) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300ff00' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
}

.analysis-selector select:hover {
    background-color: rgba(var(--primary-rgb), 0.05) !important;
    border-color: var(--primary-color) !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2300ff00' d='M6 9L1 4h10z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 12px !important;
}
/* ═══════════════════════════════════════════════════════════════════════════════
   ADDITIONS TO COMPONENTS.CSS - Missing styles
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Indicators */
.indicator {
    width: 12px;
    height: 12px;
    display: inline-block;
    margin-right: 8px;
    font-family: monospace;
    line-height: 1;
    vertical-align: middle;
    flex-shrink: 0;
    text-align: center;
}

.ind-normal {
    color: var(--primary-color);
    text-shadow: 0 0 5px var(--primary-color);
}
.ind-normal::before { content: '●'; }

.ind-low {
    color: var(--blue);
    text-shadow: 0 0 5px var(--blue);
}
.ind-low::before { content: '●'; }

.ind-slightly-high {
    color: var(--yellow);
    text-shadow: 0 0 5px var(--yellow);
}
.ind-slightly-high::before { content: '●'; }

.ind-high {
    color: var(--red);
    text-shadow: 0 0 5px var(--red);
}
.ind-high::before { content: '●'; }

.ind-pending {
    color: #666;
}
.ind-pending::before { content: '○'; }

/* Legend */
.legend {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-family: inherit;
}
.empty-state h3 {
    margin-bottom: 10px;
    color: var(--primary-color);
    text-shadow: 0 0 5px rgba(var(--primary-rgb), 0.5);
}

/* Loading and Error */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-family: inherit;
}
.loading::after {
    content: '...';
    animation: blink 1s infinite;
}

.error {
    color: var(--red);
    padding: 20px;
    text-align: center;
    text-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
    border: 1px solid var(--red);
    font-family: inherit;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

.tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.2s;
    position: relative;
}

.tab::before {
    content: '> ';
    opacity: 0;
    transition: opacity 0.2s;
}

.tab:hover {
    color: var(--text-primary);
    background: rgba(var(--primary-rgb, 0, 255, 0), 0.1);
}

.tab.active {
    color: var(--primary-color);
    background: rgba(var(--primary-rgb, 0, 255, 0), 0.15);
    text-shadow: 0 0 5px var(--primary-color);
}

.tab.active::before {
    opacity: 1;
}

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

/* Parameter name with tooltip */
.parameter-name {
    position: relative;
    cursor: help;
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--text-secondary);
    text-underline-offset: 3px;
    display: inline-block;
}

.parameter-name:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    padding: 12px 16px;
    width: 350px;
    z-index: 1000;
    box-shadow: 0 0 20px currentColor;
    font-size: 13px;
    line-height: 1.6;
    color: var(--text-primary);
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    margin-top: 8px;
    left: 0;
    top: 100%;
    white-space: normal;
    font-family: inherit;
}

.parameter-name:hover .tooltip {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}



.tooltip-title {
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--primary-color);
    font-size: 14px;
    text-shadow: 0 0 5px rgba(var(--primary-rgb), 0.5);
}

.tooltip-description {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Mini graph tooltip */
.mini-graph-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 8px;
    z-index: 1000;
    pointer-events: none;
    animation: fadeIn 0.2s ease-in;
    min-width: 260px;
    max-width: 320px;
}

.mini-graph-tooltip svg {
    width: 100%;
    height: auto;
    max-width: 100%;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(5px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* Table cell positioning for tooltips */
table td {
    position: relative;
}

table td:nth-child(2),
table td:nth-child(3),
table td:nth-child(4) {
    white-space: nowrap;
}

table td:first-child {
    white-space: normal;
    word-break: break-word;
}

.status-bar {
    font-family: var(--ascii-font-family);
    font-size: 14px;
    line-height: 1;
    color: var(--text-primary);
    white-space: pre;
    letter-spacing: 0;
    margin: 5px 0;
}

.status-bar-label {
    display: inline-block;
    min-width: 8ch;
    color: var(--text-secondary);
}

.status-bar-fill {
    display: inline-block;
    color: var(--primary-color);
    text-shadow: 0 0 3px var(--primary-color);
}

.status-bar-empty {
    display: inline-block;
    color: var(--text-secondary);
    opacity: 0.3;
}

.message-log {
    font-family: var(--ascii-font-family);
    font-size: 12px;
    line-height: 1.2;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border);
    padding: 10px;
    max-height: 200px;
    overflow-y: auto;
    white-space: pre-wrap;
    letter-spacing: 0;
}

.message-log-entry {
    margin: 2px 0;
    padding: 2px 0;
}

.message-log-entry::before {
    content: '> ';
    color: var(--text-secondary);
    opacity: 0.6;
}

.inventory-panel {
    font-family: var(--ascii-font-family);
    font-size: 12px;
    line-height: 1;
    color: var(--primary-color);
    white-space: pre;
    letter-spacing: 0;
    border: 1px solid var(--border);
    padding: 5px;
    background: rgba(0, 0, 0, 0.2);
}

.inventory-panel-header {
    border-bottom: 1px solid var(--border);
    padding-bottom: 2px;
    margin-bottom: 2px;
    color: var(--accent);
    text-shadow: 0 0 3px var(--accent);
}

.inventory-panel-item {
    padding: 1px 0;
    color: var(--text-primary);
}

.inventory-panel-item::before {
    content: '  ';
}

/* Workouts page */
.workouts-layout {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) minmax(320px, 2fr) minmax(220px, 1fr);
    gap: 4px;
    align-items: start;
}

.workouts-panel {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.workouts-panel-title {
    color: var(--text-secondary);
    font-size: 12px;
    letter-spacing: 2px;
    text-transform: uppercase;
    text-align: center;
}

.workout-days {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.workout-days:empty {
    display: none;
}

.workout-days > *:empty {
    display: none;
}

.workout-day-card {
    background: rgba(12, 12, 12, 0.6);
    border: 1px solid var(--border);
    padding: 8px 10px;
    text-align: left;
    font-family: var(--ascii-font-family);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.workout-day-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.2);
}

.workout-day-card.active {
    border-color: var(--torch-gold);
    box-shadow: 0 0 12px rgba(251, 185, 84, 0.4);
    color: var(--torch-gold);
}

.workout-day-name {
    font-size: 14px;
    text-transform: uppercase;
}

.workout-day-focus {
    color: var(--text-secondary);
    font-size: 12px;
    margin-top: 6px;
}

.workout-exercises {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.workout-exercises:empty {
    display: none;
}

.workout-exercises > *:empty {
    display: none;
}

.workout-exercise-card {
    border: 1px solid var(--border);
    background: rgba(18, 18, 18, 0.6);
    padding: 8px 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.workout-exercise-card.active {
    border-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.3);
}

.workout-exercise-title {
    font-size: 14px;
    color: var(--primary-color);
    margin-bottom: 4px;
    text-transform: uppercase;
}

.workout-set-list {
    display: grid;
    gap: 4px;
}

.workout-set-card {
    border: 1px dashed var(--border);
    padding: 6px 8px;
    background: rgba(15, 15, 15, 0.5);
    margin-bottom: 0;
    transition: all 0.2s ease;
}

.workout-set-card:hover {
    border-color: var(--primary-color);
    background: rgba(15, 15, 15, 0.7);
}

.workout-set-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-weight: bold;
    color: var(--text-primary);
}

.workout-set-details {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 6px;
    font-size: 12px;
    color: var(--text-secondary);
}

.workout-set-details span {
    padding: 4px 8px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid var(--border);
    border-radius: 2px;
}

.workout-set-notes {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px dashed var(--border);
}

.workout-day-actions,
.workout-exercise-actions,
.workout-set-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.workout-day-actions .btn-small,
.workout-exercise-actions .btn-small,
.workout-set-actions .btn-small {
    padding: 6px 12px;
    font-size: 11px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--ascii-font-family);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.workout-day-actions .btn-small:hover,
.workout-exercise-actions .btn-small:hover,
.workout-set-actions .btn-small:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.2);
    color: var(--primary-color);
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.3);
    text-shadow: 0 0 4px var(--primary-color);
}

.workout-day-actions .btn-small:active,
.workout-exercise-actions .btn-small:active,
.workout-set-actions .btn-small:active {
    transform: scale(0.95);
}

.workout-day-actions .btn-small.btn-danger,
.workout-exercise-actions .btn-small.btn-danger,
.workout-set-actions .btn-small.btn-danger {
    border-color: var(--blood-red, #cc0000);
    color: var(--blood-red, #cc0000);
}

.workout-day-actions .btn-small.btn-danger:hover,
.workout-exercise-actions .btn-small.btn-danger:hover,
.workout-set-actions .btn-small.btn-danger:hover {
    background: rgba(204, 0, 0, 0.2);
    box-shadow: 0 0 8px rgba(204, 0, 0, 0.4);
    text-shadow: 0 0 4px var(--blood-red, #cc0000);
}

.btn-primary {
    padding: 8px 16px;
    border: 1px solid var(--primary-color);
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
    font-family: var(--ascii-font-family);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 0 4px var(--primary-color);
}

.btn-primary:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.25);
    color: var(--primary-color);
    box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.4);
    text-shadow: 0 0 8px var(--primary-color);
    transform: translateY(-1px);
}

.btn-add {
    margin-top: 12px;
    width: 100%;
    padding: 10px;
    border: 2px dashed var(--border);
    background: rgba(var(--primary-rgb), 0.05);
    color: var(--text-secondary);
    font-family: var(--ascii-font-family);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.15);
    color: var(--primary-color);
    box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.3);
    text-shadow: 0 0 4px var(--primary-color);
}

.workout-exercise-muscle {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 6px;
    font-style: italic;
}

.workout-day-title {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-style: italic;
}

.workout-program-card {
    border: 1px solid var(--border);
    background: rgba(12, 12, 12, 0.6);
    padding: 8px 10px;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.workout-program-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(var(--primary-rgb), 0.2);
}

.workout-program-card.active {
    border-color: var(--torch-gold);
    box-shadow: 0 0 12px rgba(251, 185, 84, 0.4);
}

.workout-program-title {
    font-size: 15px;
    color: var(--primary-color);
    text-transform: uppercase;
    margin-bottom: 4px;
    font-weight: bold;
}

.workout-program-notes {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 6px;
    font-style: italic;
}

.workout-program-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.workout-program-actions .btn-small {
    padding: 6px 12px;
    font-size: 11px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--ascii-font-family);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.workout-program-actions .btn-small:hover {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.2);
    color: var(--primary-color);
    box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.3);
    text-shadow: 0 0 4px var(--primary-color);
}

.workout-program-actions .btn-small.btn-danger {
    border-color: var(--blood-red, #cc0000);
    color: var(--blood-red, #cc0000);
}

.workout-program-actions .btn-small.btn-danger:hover {
    background: rgba(204, 0, 0, 0.2);
    box-shadow: 0 0 8px rgba(204, 0, 0, 0.4);
    text-shadow: 0 0 4px var(--blood-red, #cc0000);
}

.workout-day-actions .btn-small:first-child,
.workout-exercise-actions .btn-small:first-child,
.workout-set-actions .btn-small:first-child {
    font-size: 14px;
    padding: 6px 10px;
    background: rgba(var(--primary-rgb), 0.1);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.workout-day-actions .btn-small:first-child:hover,
.workout-exercise-actions .btn-small:first-child:hover,
.workout-set-actions .btn-small:first-child:hover {
    background: rgba(var(--primary-rgb), 0.25);
    transform: scale(1.05);
}

.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-secondary);
    border: 1px dashed var(--border);
    background: rgba(0, 0, 0, 0.2);
}

.empty-state p {
    margin-bottom: 15px;
    font-size: 13px;
}

.error-state {
    text-align: center;
    padding: 20px;
    color: var(--blood-red, #cc0000);
    border: 1px solid var(--blood-red, #cc0000);
    background: rgba(204, 0, 0, 0.1);
}

.workout-programs {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.workout-programs:empty {
    display: none;
}

.workout-programs > *:empty {
    display: none;
}

.workout-sets {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.workout-sets:empty {
    display: none;
}

.workout-sets > *:empty {
    display: none;
}

.muscle-ascii {
    border: 1px solid var(--border);
    padding: 16px;
    background: rgba(0, 0, 0, 0.4);
    color: var(--text-primary);
    font-family: var(--ascii-font-family);
    font-size: 8px;
    line-height: 1.1;
    white-space: pre;
    min-height: 220px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    max-width: 100%;
    position: relative;
}

.muscle-ascii-label {
    display: block;
    color: var(--text-secondary);
    margin-bottom: 10px;
    letter-spacing: 2px;
    font-size: 10px;
    text-align: center;
    width: 100%;
}

.muscle-ascii-highlight {
    color: var(--primary-color);
    text-shadow: 0 0 8px rgba(var(--primary-rgb), 0.6);
    display: block;
    text-align: left;
    max-width: 100%;
    overflow: hidden;
    margin: 0 auto;
    white-space: pre;
    word-wrap: break-word;
    font-family: var(--ascii-font-family);
    letter-spacing: 0;
    width: max-content;
    box-sizing: border-box;
}

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

/* Course Tabs */
.course-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 10px;
}

.course-tab {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px 20px;
    cursor: pointer;
    font-size: 12px;
    font-family: var(--ascii-font-family);
    transition: all 0.3s ease;
    text-shadow: 0 0 5px transparent;
    border-bottom: 2px solid transparent;
}

.course-tab:hover {
    color: var(--primary-color);
    text-shadow: 0 0 8px var(--primary-color);
}

.course-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-color);
}

.course-tab-content {
    display: none;
}

.course-tab-content.active {
    display: block;
    animation: tabFadeIn 0.3s ease-out;
}

/* Tab content animation */
@keyframes tabFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.tab-content.active {
    animation: tabFadeIn 0.3s ease-out;
}

/* Page transition animation */
.page.active {
    animation: tabFadeIn 0.25s ease-out;
}

/* Inventory Cards Grid */
.inventory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.inventory-card {
    background: rgba(var(--primary-rgb), 0.03);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.inventory-card:hover {
    background: rgba(var(--primary-rgb), 0.08);
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(var(--primary-rgb), 0.3);
    transform: translateY(-2px);
}

.inventory-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
}

.inventory-drug-name {
    font-size: 15px;
    font-weight: bold;
    color: var(--primary-color);
    margin: 0;
    flex: 1;
    line-height: 1.3;
    text-shadow: 0 0 8px var(--primary-color);
}

.inventory-stock {
    font-size: 18px;
    font-weight: bold;
    padding: 4px 10px;
    border-radius: 4px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid var(--border);
    min-width: 45px;
    text-align: center;
}

.inventory-card-body {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.inventory-stat {
    text-align: center;
}

.inventory-stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.inventory-stat-value {
    font-size: 16px;
    font-weight: bold;
    color: var(--text-primary);
}

.inventory-card-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.inventory-date {
    font-size: 11px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 4px;
}

.inventory-date-label {
    font-size: 14px;
}

.inventory-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid var(--primary-color);
    border-radius: 8px;
}

.inventory-total-label {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    color: var(--primary-color);
}

.inventory-total-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-color);
}

.stock-positive {
    color: var(--success);
    font-weight: bold;
}

.stock-negative {
    color: var(--error);
    font-weight: bold;
}

.stock-low {
    color: var(--warning);
    font-weight: bold;
}

/* Purchase Entry */
.purchase-entry {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    flex-wrap: wrap;
    gap: 10px;
}

.purchase-entry:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

.purchase-info {
    flex: 1;
    min-width: 250px;
}

.purchase-drug {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.purchase-details {
    font-size: 12px;
    color: var(--text-secondary);
    word-wrap: break-word;
}

.purchase-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.stat-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-left: 8px;
}

.stat-badge.positive {
    background: rgba(var(--success-rgb), 0.2);
    color: var(--success);
}

.stat-badge.negative {
    background: rgba(var(--error-rgb), 0.2);
    color: var(--error);
}

/* Charts Container */
#consumption-chart,
#purchase-vs-consumption-chart {
    min-height: 350px;
    width: 100%;
}

/* Donut Charts */
#stats-donut-chart,
#dashboard-donut-chart {
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Quick Actions Bar */
.quick-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 12px;
    border: 1px dashed var(--border);
    background: rgba(var(--primary-rgb), 0.03);
}

.quick-action-btn {
    background: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 8px 20px;
    font-family: var(--ascii-font-family);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all var(--transition-fast, 0.15s) ease;
    text-shadow: 0 0 3px var(--primary-color);
}

.quick-action-btn:hover {
    background: rgba(var(--primary-rgb), 0.15);
    box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.4);
    text-shadow: 0 0 8px var(--primary-color);
    transform: translateY(-1px);
}

.quick-action-btn:active {
    transform: scale(0.97);
}

/* Dashboard Overview Layout */
.dashboard-overview {
    display: grid;
    grid-template-columns: auto repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 20px;
    align-items: stretch;
}

/* Flatten stat-cards into parent grid */
.dashboard-overview > .stat-cards {
    display: contents;
}

/* Compact stat cards in dashboard context */
.dashboard-overview > .stat-cards > .stat-card > * {
    padding: 12px 15px;
}

.dashboard-overview > .stat-cards > .stat-card h3 {
    padding-top: 40px;
}

.dashboard-donut-container {
    position: sticky;
    top: 20px;
    overflow: hidden;
}

.dashboard-donut-container .card {
    margin-bottom: 0;
}

/* Hide redundant card-header — title is already inside ASCII donut art */
.dashboard-donut-container .card-header {
    display: none;
}

/* Reduce oversized donut container in dashboard */
.dashboard-donut-container .ascii-donut-container-large {
    min-height: auto;
    padding: 10px;
}

/* Stats Overview Layout */
.stats-overview {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    margin-bottom: 20px;
    align-items: start;
}

.stats-donut-container {
    position: sticky;
    top: 20px;
}

.stats-donut-container .card {
    margin-bottom: 0;
}

/* Inventory Card with Chart */
.inventory-card-with-chart {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
}

.inventory-donut-chart {
    flex-shrink: 0;
    width: 120px;
    height: 120px;
}

.inventory-card-with-chart .inventory-card-body {
    flex: 1;
    margin-bottom: 0;
}

/* Consumed value highlight */
.consumed-value {
    color: #ff4444 !important;
    text-shadow: 0 0 8px rgba(255, 68, 68, 0.5);
}

/* Responsive for dashboard/stats overview */
@media (max-width: 1100px) {
    .dashboard-overview {
        grid-template-columns: auto 1fr;
    }

    .dashboard-overview > .stat-cards {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 900px) {
    .dashboard-overview,
    .stats-overview {
        grid-template-columns: 1fr;
    }

    .dashboard-donut-container,
    .stats-donut-container {
        position: static;
    }

    .dashboard-donut-container .card,
    .stats-donut-container .card {
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .inventory-card-with-chart {
        flex-direction: column;
        align-items: center;
    }

    .inventory-donut-chart {
        margin-bottom: 10px;
    }

    .inventory-card-with-chart .inventory-card-body {
        width: 100%;
    }
}

/* Log Entry (same styling as intake logs) */
.log-entry {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
    flex-wrap: wrap;
    gap: 10px;
}

.log-entry:hover {
    background: rgba(var(--primary-rgb), 0.05);
}

.log-info {
    flex: 1;
    min-width: 250px;
}

.log-drug {
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.log-details {
    font-size: 12px;
    color: var(--text-secondary);
}

.log-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .course-tabs {
        flex-wrap: wrap;
        gap: 5px;
    }

    .course-tab {
        padding: 8px 12px;
        font-size: 11px;
    }

    .inventory-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 12px;
    }

    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
    }

    .purchase-entry,
    .log-entry {
        flex-direction: column;
        align-items: flex-start;
    }

    .purchase-actions,
    .log-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

@media (max-width: 480px) {
    /* Cards: hide decorative corners and simplify */
    .card::before, .card::after { display: none; }
    .card-header::before, .card-header::after { display: none; }
    .card { padding: 0; border: 1px solid var(--border); }
    .card-header {
        padding: 10px 12px;
        gap: 6px;
    }
    .card-header .card-title {
        position: static;
        transform: none;
        width: 100%;
        text-align: center;
    }
    .card-header > .btn,
    .card-header > button,
    .card-header > div:has(button) {
        margin-left: 0;
        width: 100%;
        text-align: center;
    }

    /* Grids: single column */
    .inventory-grid { grid-template-columns: 1fr; }
    .stat-cards { grid-template-columns: 1fr; gap: 8px; }
    .form-row { grid-template-columns: 1fr; gap: 8px; }

    .inventory-card-body {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .inventory-stat {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .inventory-stat-label,
    .inventory-stat-value { display: inline; }

    .inventory-total {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }

    /* Quick actions */
    .quick-actions { flex-direction: column; gap: 6px; }
    .quick-actions .btn { width: 100%; font-size: 12px; }

    /* Analysis selector: stack vertically */
    .analysis-selector {
        flex-direction: column;
        gap: 6px;
    }
    .analysis-selector label { display: none; }
    .analysis-selector select,
    #analysis-select {
        min-width: 0 !important;
        width: 100% !important;
    }
    .analysis-selector .btn {
        width: 100%;
        font-size: 12px;
    }

    /* Workouts layout */
    .workouts-layout { grid-template-columns: 1fr !important; }
    .muscle-ascii { min-height: 160px; font-size: 7px; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ASCII DONUT / PIE CHART - 3D Style
   ═══════════════════════════════════════════════════════════════════════════════ */

.ascii-donut {
    font-family: var(--ascii-font-family);
    font-size: 12px;
    line-height: 1.2;
    letter-spacing: 0;
    white-space: pre;
    color: var(--text-primary);
    margin: 0;
    padding: 10px;
    background: transparent;
    text-align: center;
    display: inline-block;
}

.ascii-donut-small {
    font-size: 11px;
}

.ascii-donut-large {
    font-size: 13px;
}

.ascii-donut-3d {
    position: relative;
}

/* Donut segments colors */
.donut-consumed {
    color: #ff4444;
    text-shadow: 0 0 8px rgba(255, 68, 68, 0.8), 0 0 15px rgba(255, 68, 68, 0.4);
}

.donut-remaining {
    color: #00ff00;
    text-shadow: 0 0 8px rgba(0, 255, 0, 0.8), 0 0 15px rgba(0, 255, 0, 0.4);
}

/* Center percentage */
.donut-percent {
    color: var(--primary-color);
    font-weight: bold;
    text-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
    animation: donutPulse 2s ease-in-out infinite;
}

/* 3D Shadow effect */
.donut-shadow {
    color: #222;
    opacity: 0.3;
    text-shadow: none;
}

/* Empty state */
.donut-empty {
    color: var(--text-secondary);
    font-size: 10px;
    letter-spacing: 1px;
}

/* Legend styling */
.donut-legend {
    margin-top: 8px;
    font-size: 11px;
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Container for ASCII donut */
.ascii-donut-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.ascii-donut-container-small {
    min-height: 140px;
    padding: 10px;
}

.ascii-donut-container-large {
    min-height: 300px;
    padding: 20px;
}

/* Animation for percentage pulse */
@keyframes donutPulse {
    0%, 100% {
        text-shadow: 0 0 10px var(--primary-color), 0 0 20px var(--primary-color);
    }
    50% {
        text-shadow: 0 0 15px var(--primary-color), 0 0 30px var(--primary-color), 0 0 40px var(--primary-color);
    }
}

/* Consumed segment glow animation */
@keyframes consumedGlow {
    0%, 100% {
        text-shadow: 0 0 8px rgba(255, 68, 68, 0.8), 0 0 15px rgba(255, 68, 68, 0.4);
    }
    50% {
        text-shadow: 0 0 12px rgba(255, 68, 68, 1), 0 0 25px rgba(255, 68, 68, 0.6), 0 0 35px rgba(255, 68, 68, 0.3);
    }
}

/* Remaining segment glow animation */
@keyframes remainingGlow {
    0%, 100% {
        text-shadow: 0 0 8px rgba(0, 255, 0, 0.8), 0 0 15px rgba(0, 255, 0, 0.4);
    }
    50% {
        text-shadow: 0 0 12px rgba(0, 255, 0, 1), 0 0 25px rgba(0, 255, 0, 0.6), 0 0 35px rgba(0, 255, 0, 0.3);
    }
}

/* Shadow depth animation */
@keyframes shadowPulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.6;
    }
}

/* Apply animations */
.ascii-donut-container:hover .donut-consumed {
    animation: consumedGlow 1.5s ease-in-out infinite;
}

.ascii-donut-container:hover .donut-remaining {
    animation: remainingGlow 1.5s ease-in-out infinite;
}

.ascii-donut-container:hover .donut-shadow {
    animation: shadowPulse 2s ease-in-out infinite;
}

/* ASCII Donut hover effect */
.ascii-donut-container:hover .ascii-donut {
    transform: scale(1.02);
    transition: transform 0.3s ease;
}

.ascii-donut-container:hover .donut-consumed {
    text-shadow: 0 0 12px rgba(255, 68, 68, 1), 0 0 25px rgba(255, 68, 68, 0.6);
}

.ascii-donut-container:hover .donut-remaining {
    text-shadow: 0 0 12px rgba(0, 255, 0, 1), 0 0 25px rgba(0, 255, 0, 0.6);
}

/* Inventory card ASCII donut */
.inventory-ascii-donut {
    flex-shrink: 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.inventory-ascii-donut .ascii-donut {
    font-size: 9px;
    padding: 5px;
}

/* Dashboard ASCII donut */
.dashboard-ascii-donut {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px;
}

/* Stats page ASCII donut */
.stats-ascii-donut {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

/* Responsive ASCII donut */
@media (max-width: 768px) {
    .ascii-donut {
        font-size: 10px;
    }

    .ascii-donut-large {
        font-size: 11px;
    }

    .ascii-donut-container {
        min-height: 160px;
    }

    .ascii-donut-container-large {
        min-height: 220px;
    }
}

@media (max-width: 480px) {
    .ascii-donut {
        font-size: 9px;
    }

    .ascii-donut-container {
        min-height: 140px;
        padding: 8px;
    }
}
