:root {
    --hb-bg: #f3fbfd;
    --hb-surface: #ffffff;
    --hb-surface-soft: #eafdff;
    --hb-text: #12313c;
    --hb-muted: #617783;
    --hb-border: #caedf3;
    --hb-border-strong: #99dce7;
    --hb-primary: #0891b2;
    --hb-primary-dark: #0e7490;
    --hb-primary-soft: #d8f7fb;
    --hb-shadow: 0 18px 50px rgba(8, 145, 178, 0.11);
}

* {
    letter-spacing: 0;
}

body {
    min-height: 100vh;
    background:
        linear-gradient(180deg, rgba(217, 250, 255, 0.8) 0, rgba(243, 251, 253, 0.95) 260px),
        var(--hb-bg);
    color: var(--hb-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", "PingFang SC", sans-serif;
}

a {
    color: var(--hb-primary-dark);
}

.app-header {
    border-bottom: 1px solid rgba(153, 220, 231, 0.62);
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-nav {
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--hb-text);
    font-weight: 800;
    text-decoration: none;
    font-size: 1.05rem;
}

.brand-mark,
.setup-icon,
.empty-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--hb-primary);
    color: #ffffff;
    box-shadow: 0 10px 22px rgba(8, 145, 178, 0.2);
}

.nav-add {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.app-main {
    padding-top: 34px;
    padding-bottom: 56px;
}

.page-head {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.page-head h1 {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 2.3rem);
    font-weight: 850;
    line-height: 1.14;
}

.page-head p {
    margin: 8px 0 0;
    color: var(--hb-muted);
    font-weight: 500;
}

.btn {
    border-radius: 8px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
}

.btn-primary {
    --bs-btn-bg: var(--hb-primary);
    --bs-btn-border-color: var(--hb-primary);
    --bs-btn-hover-bg: var(--hb-primary-dark);
    --bs-btn-hover-border-color: var(--hb-primary-dark);
    --bs-btn-active-bg: var(--hb-primary-dark);
    --bs-btn-active-border-color: var(--hb-primary-dark);
    box-shadow: 0 12px 24px rgba(8, 145, 178, 0.18);
}

.btn-outline-secondary {
    --bs-btn-color: var(--hb-text);
    --bs-btn-border-color: var(--hb-border-strong);
    --bs-btn-hover-bg: var(--hb-primary-soft);
    --bs-btn-hover-border-color: var(--hb-primary);
    --bs-btn-hover-color: var(--hb-text);
}

.app-alert {
    border-radius: 8px;
    border: 0;
    box-shadow: var(--hb-shadow);
}

.content-panel,
.form-panel,
.detail-card,
.setup-panel {
    background: var(--hb-surface);
    border: 1px solid var(--hb-border);
    border-radius: 8px;
    box-shadow: var(--hb-shadow);
}

.content-panel {
    overflow: hidden;
}

.record-table {
    --bs-table-bg: transparent;
}

.record-table thead th {
    color: var(--hb-muted);
    font-size: 0.82rem;
    font-weight: 800;
    padding: 16px 20px;
    border-bottom: 1px solid var(--hb-border);
}

.record-table tbody td {
    padding: 18px 20px;
    border-bottom-color: rgba(202, 237, 243, 0.72);
    vertical-align: middle;
}

.record-table tbody tr:last-child td {
    border-bottom: 0;
}

.record-row {
    cursor: pointer;
    transition: background-color 0.16s ease, transform 0.16s ease;
}

.record-row:hover {
    background: var(--hb-surface-soft);
}

.record-date-link {
    display: inline-flex;
    flex-direction: column;
    gap: 3px;
    text-decoration: none;
    color: var(--hb-text);
    font-weight: 800;
}

.record-date-link small {
    color: var(--hb-muted);
    font-weight: 600;
}

.note-cell {
    max-width: 460px;
    color: var(--hb-muted);
}

.mood-badge {
    min-width: 54px;
    display: inline-flex;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 800;
    border: 1px solid transparent;
}

.mood-bright {
    color: #056674;
    background: #d7fbff;
    border-color: #95e7f0;
}

.mood-ok {
    color: #166534;
    background: #dcfce7;
    border-color: #9ae6b4;
}

.mood-dim {
    color: #475569;
    background: #e8eef4;
    border-color: #cbd5e1;
}

.mood-irritated {
    color: #9f1239;
    background: #ffe4ec;
    border-color: #f9a8bd;
}

.empty-state {
    min-height: 320px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    padding: 42px;
    text-align: center;
}

.empty-state h2,
.empty-state h1 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 850;
}

.empty-icon {
    width: 52px;
    height: 52px;
    font-size: 1.35rem;
}

.form-panel {
    padding: 26px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.option-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.field-block {
    min-width: 0;
}

.form-label {
    margin-bottom: 9px;
    color: var(--hb-text);
    font-weight: 800;
}

.form-control {
    border-color: var(--hb-border-strong);
    border-radius: 8px;
    padding: 12px 13px;
    color: var(--hb-text);
}

.form-control:focus {
    border-color: var(--hb-primary);
    box-shadow: 0 0 0 0.22rem rgba(8, 145, 178, 0.14);
}

.choice-group {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
}

.btn-choice {
    min-height: 42px;
    min-width: 74px;
    border: 1px solid var(--hb-border-strong);
    background: #ffffff;
    color: var(--hb-text);
    box-shadow: none;
}

.btn-check:checked + .btn-choice,
.btn-check:checked + .btn-choice:hover,
.btn-check:checked:focus + .btn-choice {
    background: var(--hb-primary);
    border-color: var(--hb-primary);
    color: #ffffff;
    box-shadow: 0 10px 20px rgba(8, 145, 178, 0.18);
}

.btn-check:focus + .btn-choice,
.btn-choice:hover {
    border-color: var(--hb-primary);
    background: var(--hb-primary-soft);
    color: var(--hb-text);
}

textarea.form-control {
    resize: vertical;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 24px;
}

.detail-card {
    padding: 28px;
}

.detail-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 22px;
    border-bottom: 1px solid var(--hb-border);
}

.detail-top > div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.detail-date {
    font-size: 1.3rem;
    font-weight: 850;
}

.detail-top strong {
    color: var(--hb-primary-dark);
    font-size: 1.45rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin: 24px 0;
}

.detail-grid div {
    padding: 16px;
    border: 1px solid var(--hb-border);
    border-radius: 8px;
    background: #fbfeff;
}

.detail-grid dt {
    color: var(--hb-muted);
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 7px;
}

.detail-grid dd {
    margin: 0;
    color: var(--hb-text);
    font-size: 1.05rem;
    font-weight: 800;
}

.notes-box {
    padding: 18px;
    border-radius: 8px;
    background: var(--hb-surface-soft);
    border: 1px solid var(--hb-border);
}

.notes-box h2 {
    margin: 0 0 10px;
    font-size: 1rem;
    font-weight: 850;
}

.notes-box p {
    margin: 0;
    color: var(--hb-text);
    white-space: pre-wrap;
}

.detail-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
}

.detail-actions form {
    margin: 0;
}

.setup-panel {
    max-width: 760px;
    margin: 34px auto;
    padding: 30px;
}

.setup-panel h1 {
    margin: 18px 0 8px;
    font-size: 1.6rem;
    font-weight: 850;
}

.setup-panel pre {
    padding: 14px;
    border-radius: 8px;
    background: #ecfeff;
    border: 1px solid var(--hb-border);
}

.setup-error {
    color: #9f1239;
    word-break: break-word;
}

@media (max-width: 767.98px) {
    .app-main {
        padding-top: 22px;
    }

    .page-head {
        align-items: stretch;
        flex-direction: column;
    }

    .page-head .btn {
        width: 100%;
    }

    .form-grid,
    .option-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .form-panel,
    .detail-card {
        padding: 20px;
    }

    .record-table {
        min-width: 680px;
    }

    .detail-top {
        align-items: flex-start;
        flex-direction: column;
    }

    .detail-top > div {
        align-items: flex-start;
        flex-direction: column;
    }

    .detail-date {
        font-size: 1.18rem;
    }

    .detail-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .detail-actions .btn,
    .detail-actions form,
    .detail-actions button {
        width: 100%;
    }
}
