:root {
    --bg: #EEF1F5;
    --surface: #FFFFFF;
    --ink: #1B2430;
    --ink-soft: #5A6675;
    --line: #D7DDE4;

    --weight: #2A6FB0;
    --weight-soft: #E3EEF8;
    --cal: #B2660A;
    --cal-soft: #F7ECDC;

    --radius: 14px;
    --shadow: 0 1px 2px rgba(27,36,48,.06), 0 8px 24px rgba(27,36,48,.08);
    --font: "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    -webkit-font-smoothing: antialiased;
}

.stage {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; margin-bottom: 28px; flex-wrap: wrap;
}
.home-link {
    display: inline-block; font-weight: 600; font-size: .85rem;
    color: var(--ink-soft); text-decoration: none; margin-bottom: 6px;
}
.home-link:hover { text-decoration: underline; }

h1 { font-size: 1.6rem; font-weight: 700; margin: 0; }
h2 { font-size: 1.2rem; font-weight: 700; margin: 0 0 6px; }
.lede { color: var(--ink-soft); margin: 0 0 16px; }

.user-select {
    font: inherit; padding: 8px 12px; border-radius: 10px;
    border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}

.entry-cards {
    display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
    margin-bottom: 32px;
}
.entry-card {
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 18px; border-top: 4px solid var(--line);
}
.entry-card--weight { border-top-color: var(--weight); }
.entry-card--calories { border-top-color: var(--cal); }
.entry-card label { display: block; font-weight: 600; margin-bottom: 10px; font-size: .92rem; }

.entry-row { display: flex; gap: 10px; }
.entry-row input {
    flex: 1; font: inherit; padding: 10px 12px;
    border-radius: 10px; border: 1px solid var(--line);
}
.entry-row .primary {
    font: inherit; font-weight: 600; cursor: pointer;
    border-radius: 10px; padding: 10px 18px; border: none;
    background: var(--ink); color: #fff;
}
.entry-row .primary:hover { background: #0f1620; }

.entry-msg { min-height: 1.2em; font-size: .85rem; color: var(--ink-soft); margin: 8px 0 0; }
.entry-msg.error { color: #B23A2E; }

.history-table {
    width: 100%; border-collapse: collapse;
    background: var(--surface); border: 1px solid var(--line);
    border-radius: var(--radius); overflow: hidden;
    box-shadow: var(--shadow);
}
.history-table th, .history-table td {
    text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line);
    font-size: .92rem;
}
.history-table th { background: var(--bg); font-weight: 700; }
.history-table .highlight-col { background: var(--cal-soft); color: var(--cal); font-weight: 700; }
.history-table tr:last-child td { border-bottom: none; }

.empty-msg { color: var(--ink-soft); text-align: center; padding: 20px; }
.empty-msg.hidden { display: none; }

@media (max-width: 560px) {
    .entry-cards { grid-template-columns: 1fr; }
    .history-table { font-size: .82rem; }
    .history-table th, .history-table td { padding: 8px 8px; }
}
