*,
*::before,
*::after {
    box-sizing: border-box;
}

/* ── Palette ────────────────────────────────────────
   --bg:        #F5EFE6  linen page background
   --surface:   #FDFAF6  cream card surface
   --border:    #E8DDD0  sand border
   --border-d:  #D5C8B8  darker border / divider
   --accent:    #A08060  taupe — primary
   --accent-d:  #7A5F42  dark taupe — hover / text
   --text:      #2E2720  espresso — headings
   --text-2:    #6B5744  warm brown — body
   --text-3:    #9A8878  muted warm — labels
   --sage:      #7A9E7E  sage green — success / done
   --sage-bg:   #EBF3EC  sage tint background
   --terra:     #C4856A  terracotta — warning
   --terra-bg:  #FAF0EB  terracotta tint
   --clay:      #B07070  clay rose — danger
   --clay-bg:   #F8EDEC  clay tint
────────────────────────────────────────────────── */

:root {
    --bg: #F5EFE6;
    --surface: #FDFAF6;
    --border: #E8DDD0;
    --border-d: #D5C8B8;
    --accent: #A08060;
    --accent-d: #7A5F42;
    --text: #2E2720;
    --text-2: #6B5744;
    --text-3: #9A8878;
    --sage: #7A9E7E;
    --sage-bg: #EBF3EC;
    --terra: #C4856A;
    --terra-bg: #FAF0EB;
    --clay: #B07070;
    --clay-bg: #F8EDEC;
}

body {
    font-family: 'Plus Jakarta Sans', 'Inter', 'Cairo', sans-serif;
    background-color: var(--bg);
    min-height: 100vh;
    color: var(--text-2);
}

::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-d);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent);
}

/* ── Base surface card ── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
}

/* ── Form inputs ── */
.f-input {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.f-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(160, 128, 96, 0.12);
}

.f-input::placeholder {
    color: var(--text-3);
}

/* ── Inline number field ── */
.num-input {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text);
    text-align: center;
    font-size: 11px;
    padding: 3px 5px;
    transition: border-color 0.15s;
}

.num-input:focus {
    outline: none;
    border-color: var(--accent);
}

.num-input:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── Progress bar ── */
.pbar {
    height: 3px;
    border-radius: 999px;
    background: var(--border);
    overflow: hidden;
}

.pfill {
    height: 100%;
    border-radius: 999px;
    background: var(--accent);
    transition: width 0.4s ease;
}

/* ── Pill / badge ── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Primary button ── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    background: var(--accent);
    color: var(--surface);
    transition: background 0.15s, transform 0.1s;
}

.btn:hover {
    background: var(--accent-d);
}

.btn:active {
    transform: scale(0.98);
}

/* ── Ghost button ── */
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-2);
    transition: background 0.15s, border-color 0.15s;
}

.btn-ghost:hover {
    background: var(--bg);
    border-color: var(--border-d);
}

/* ── Icon button ── */
.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-3);
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.icon-btn:hover {
    background: var(--surface);
    border-color: var(--border-d);
    color: var(--text);
}

/* ── Milestone sidebar item ── */
.ms-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.ms-item:hover {
    border-color: var(--border-d);
    background: #FAF6F0;
}

.ms-item.active {
    border-color: var(--accent);
    background: #FAF6F0;
}

/* ── Task card ── */
.task-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    transition: border-color 0.15s;
}

.task-card:hover {
    border-color: var(--border-d);
}

.task-card.done {
    background: var(--sage-bg);
    border-color: #C6DEC8;
}

/* ── Divider ── */
hr.div {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

/* ── Checkbox ── */
.cb-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.cb-wrap input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.cb-box {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1.5px solid var(--border-d);
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, border-color 0.15s;
}

.cb-wrap input:checked~.cb-box {
    background: var(--sage);
    border-color: var(--sage);
}

/* ── Select override ── */
select.f-input {
    cursor: pointer;
}

/* ── Stat card ── */
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 150px;
}

/* ── Spending row badges ── */
.sp-badge-material {
    background: #EDF0F8;
    color: #6070A0;
}

.sp-badge-labour {
    background: #F8F2E6;
    color: #9A7035;
}

.sp-badge-other {
    background: #F3EBF5;
    color: #8A60A0;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.anim-up {
    animation: fadeUp 0.25s ease forwards;
}

/* ── Tab Navigation ── */
.tab-btn {
    position: relative;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
    border-radius: 0;
}

.tab-btn:hover {
    color: var(--accent);
    background: rgba(160, 128, 96, 0.04);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-panel {
    animation: fadeUp 0.25s ease forwards;
}

/* ── Spin animation for loading icons ── */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ── Sidebar navigation ── */
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
}

.sidebar-link:hover {
    background: var(--bg);
    color: var(--text);
}

.sidebar-link.active {
    background: var(--bg);
    color: var(--accent);
    font-weight: 600;
}

/* ── Admin data table ── */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12px;
}

.data-table thead th {
    font-size: 9px;
    font-weight: 700;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-2);
}

.data-table tbody tr:hover {
    background: var(--bg);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}