
:root {
    --primary: #39856f;
    --primary-dark: #245b49;
    --background: #f4f7f6;
    --surface: #ffffff;
    --text: #203d34;
    --muted: #728780;
    --border: #e5ece8;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--background);
    color: var(--text);
    -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
    margin: 0;
}

h1 {
    font-size: 27px;
    letter-spacing: -0.8px;
}

h2 {
    font-size: 21px;
}

h3 {
    font-size: 16px;
}

p {
    line-height: 1.5;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

button:focus-visible,
input:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}

.app-container {
    max-width: 600px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 24px 20px 120px;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 24px;
}

.eyebrow {
    color: var(--muted);
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 1px;
    margin-bottom: 7px;
}

.muted {
    color: var(--muted);
    font-size: 13px;
}

.header .muted {
    margin-top: 6px;
}

.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ddece5;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    font-size: 23px;
}

.hero-card {
    padding: 24px;
    border-radius: 24px;
    background: linear-gradient(
        135deg,
        #245b49,
        #39856f
    );
    color: white;
    margin-bottom: 18px;
    box-shadow: 0 8px 24px #245b491a;
}

.hero-label {
    font-size: 11px;
    letter-spacing: 1.5px;
    opacity: 0.85;
    margin-bottom: 12px;
}

.hero-card h2 {
    line-height: 1.4;
    margin-bottom: 22px;
}

.hero-card p {
    font-size: 13px;
}

.progress-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 8px 0 12px;
}

.progress-info h1 {
    font-size: 34px;
}

.progress-info span {
    font-size: 12px;
    opacity: 0.9;
}

.progress-track {
    background: #ffffff33;
    height: 9px;
    border-radius: 20px;
    overflow: hidden;
}

#progress-fill {
    width: 0%;
    height: 100%;
    background: #c4eed8;
    border-radius: 20px;
    transition: width 0.3s ease;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    box-shadow: 0 3px 12px #203d3405;
}

.card h2 {
    margin-top: 12px;
    font-size: 28px;
}

.card h3 {
    margin-bottom: 5px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 22px;
}

.purple {
    background: #ede6f5;
}

.blue {
    background: #e3edf5;
}

.yellow {
    background: #f8eed8;
}

.section-title {
    font-size: 18px;
    margin: 24px 0 12px;
}

.routine-card {
    display: flex;
    align-items: center;
    gap: 14px;
}

.routine-details {
    flex: 1;
    min-width: 0;
}

#breakfast-check {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    accent-color: var(--primary);
    cursor: pointer;
}

.empty-state {
    text-align: center;
    padding: 30px 20px;
}

.empty-icon {
    font-size: 32px;
    margin-bottom: 14px;
}

.empty-state p {
    margin-top: 7px;
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fade-in 0.2s ease;
}

.page:not(#home) > .muted {
    margin: 8px 0 24px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    display: flex;
    justify-content: space-around;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 12px 4px;
    padding-bottom: calc(
        12px + env(safe-area-inset-bottom, 0px)
    );
    z-index: 100;
    box-shadow: 0 -4px 20px #203d3408;
}

.nav-btn {
    flex: 1;
    background: none;
    border: none;
    color: var(--muted);
    font-size: 10px;
    font-weight: 500;
    padding: 5px 2px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 7px;
}

.nav-btn span {
    font-size: 21px;
}

.nav-btn.active {
    background: #e5f1eb;
    color: var(--primary-dark);
    font-weight: bold;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(3px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 360px) {
    .app-container {
        padding-left: 14px;
        padding-right: 14px;
    }

    h1 {
        font-size: 24px;
    }

    .hero-card {
        padding: 19px;
    }

    .card {
        padding: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}



/* =====================================
   PHASE 3: PEPTIDE MANAGEMENT
   ===================================== */

.primary-btn,
.secondary-btn {
    width: 100%;
    border: none;
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 12px;
    min-height: 46px;
}

.primary-btn {
    background: var(--primary);
    color: white;
}

.primary-btn:hover {
    background: var(--primary-dark);
}

.secondary-btn {
    background: var(--background);
    color: var(--text);
    border: 1px solid var(--border);
}

.filter-tabs {
    display: flex;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 5px;
    border-radius: 14px;
    margin: 8px 0 20px;
}

.filter-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--muted);
    padding: 12px 8px;
    border-radius: 10px;
    font-weight: bold;
    font-size: 13px;
}

.filter-btn.active {
    background: #ddece5;
    color: var(--primary-dark);
}

#peptide-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.peptide-card {
    padding: 20px;
}

.peptide-card-header {
    display: flex;
    align-items: center;
    gap: 13px;
    margin-bottom: 17px;
}

.peptide-card-name {
    flex: 1;
    min-width: 0;
}

.peptide-card-name h3 {
    font-size: 18px;
    overflow-wrap: anywhere;
}

.peptide-status {
    color: var(--primary);
    font-size: 12px;
    font-weight: bold;
}

.peptide-card.is-archived
.peptide-status {
    color: var(--muted);
}

.peptide-info {
    border-top: 1px solid var(--border);
    padding-top: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
    font-size: 13px;
    margin-bottom: 12px;
}

.info-row span:first-child {
    color: var(--muted);
    flex-shrink: 0;
}

.info-row span:last-child {
    text-align: right;
    font-weight: 500;
    overflow-wrap: anywhere;
    min-width: 0;
}

.peptide-notes {
    background: var(--background);
    padding: 12px;
    border-radius: 10px;
    font-size: 13px;
    margin-top: 8px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.card-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

.action-btn {
    flex: 1;
    border: none;
    border-radius: 10px;
    min-height: 42px;
    padding: 10px;
    font-size: 13px;
    font-weight: bold;
}

.edit-btn {
    color: var(--primary-dark);
    background: #e5f1eb;
}

.archive-btn {
    color: var(--muted);
    background: var(--background);
}

/* Peptide form */

#peptide-dialog {
    width: calc(100% - 28px);
    max-width: 480px;
    max-height: 90vh;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    color: var(--text);
    overflow-y: auto;
}

#peptide-dialog::backdrop {
    background: rgba(20, 40, 33, 0.55);
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.close-btn {
    border: none;
    background: var(--background);
    color: var(--muted);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 25px;
    flex-shrink: 0;
}

#peptide-form label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    margin: 14px 0 7px;
}

#peptide-form input,
#peptide-form select,
#peptide-form textarea {
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
}

#peptide-form textarea {
    resize: vertical;
}

#peptide-form input:focus,
#peptide-form select:focus,
#peptide-form textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.form-disclaimer {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.5;
    margin: 16px 0;
}



/* =====================================
   PHASE 4: INJECTION LOGGING
   ===================================== */

.log-injection-btn {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 13px;
    margin-top: 16px;
    font-size: 14px;
    font-weight: bold;
    min-height: 44px;
}

.log-injection-btn:hover {
    background: var(--primary-dark);
}

.injection-history {
    margin-top: 28px;
}

.injection-history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
}

.injection-history-header h2 {
    font-size: 19px;
}

.history-count {
    background: #e5f1eb;
    color: var(--primary-dark);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 20px;
    font-weight: bold;
}

#injection-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.injection-record-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.injection-record-header > div:last-child {
    min-width: 0;
    overflow-wrap: anywhere;
}

.injection-record-icon {
    background: #e5f1eb;
    color: var(--primary-dark);
}

.injection-record-info {
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

.delete-btn {
    background: #fcebea;
    color: #a33b35;
}

/* Injection logging form */

#injection-dialog {
    width: calc(100% - 28px);
    max-width: 480px;
    max-height: 90vh;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--surface);
    color: var(--text);
    overflow-y: auto;
}

#injection-dialog::backdrop {
    background: rgba(20, 40, 33, 0.55);
}

#injection-form label {
    display: block;
    font-size: 13px;
    font-weight: bold;
    margin: 14px 0 7px;
}

#injection-form input,
#injection-form select,
#injection-form textarea {
    width: 100%;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--background);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
}

#injection-form textarea {
    resize: vertical;
}

#injection-form input:focus,
#injection-form select:focus,
#injection-form textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.injection-peptide-name {
    background: #e5f1eb;
    color: var(--primary-dark);
    padding: 14px;
    border-radius: 12px;
    font-weight: bold;
    overflow-wrap: anywhere;
}

.injection-warning {
    background: #faf3e5;
    color: #795c24;
    border-radius: 10px;
    padding: 12px;
    font-size: 12px;
    line-height: 1.5;
    margin: 16px 0;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

@media (max-width: 360px) {
    #injection-dialog {
        padding: 17px;
    }

    #injection-form .form-row {
        grid-template-columns: 1fr;
    }
}
/* v1 additions */
body.dark{--background:#16231f;--surface:#23352e;--text:#eef8f2;--muted:#b1c4ba;--border:#40554b;--primary:#39856f;--primary-dark:#a4dfc7}body.dark .secondary-btn,body.dark .edit-btn,body.dark .filter-btn.active{color:#245b49;background:#dcece3}body.dark .nav-btn.active{color:#245b49}.tool-card{margin:14px 0}.tool-card label{display:block;margin:12px 0 5px;font-size:13px;font-weight:bold}.tool-card input:not([type=checkbox]),.tool-card select,.tool-card textarea{width:100%;min-width:0;padding:11px;border:1px solid var(--border);border-radius:10px;background:var(--background);color:var(--text);font:inherit}.tool-card textarea{resize:vertical}.tool-card .primary-btn{margin-top:14px}.cal-grid{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;text-align:center}.cal-grid button{min-height:42px;border:1px solid transparent;background:var(--background);color:var(--text);border-radius:9px;padding:3px;font-size:13px}.cal-grid button.selected{background:#39856f;color:white}.cal-grid button.today{border-color:#39856f}.cal-grid small{display:block;font-size:10px}.cal-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:15px}.cal-head button{padding:8px 14px;border:0;border-radius:8px;background:var(--background);color:var(--text)}.record-line{border-top:1px solid var(--border);padding:12px 0;overflow-wrap:anywhere}.record-line button{margin-top:8px}.weekdays{display:flex;flex-wrap:wrap;gap:10px}.weekdays label{font-weight:normal}.tool-card h3{margin-bottom:8px}.tool-card .muted{margin:8px 0}.history-tools{margin:12px 0;display:flex;gap:8px;flex-wrap:wrap}.history-tools input{flex:1;min-width:100px;padding:9px;border:1px solid var(--border);border-radius:9px;background:var(--surface);color:var(--text)}.history-tools button{border:0;border-radius:9px;padding:9px;background:var(--background);color:var(--text)}.chart-wrap{width:100%;overflow:hidden}.chart-wrap svg{width:100%;height:auto}.notice{padding:12px;background:#faf3e5;color:#795c24;border-radius:10px;font-size:13px;margin:12px 0}.tool-card .action-btn{margin-right:5px}.tool-card input[type=file]{max-width:100%}body.dark .archive-btn{color:var(--text)}

[hidden]{display:none!important}
