/* Disciplina — mobile-first styles on top of Bootstrap 5 */
:root {
    --brand: #0f766e;
    --brand-dark: #115e59;
    --brand-soft: #ccfbf1;
    --bottom-nav-height: 64px;
}

body {
    background: #f4f6f8;
    -webkit-tap-highlight-color: transparent;
}

.bg-brand { background-color: var(--brand) !important; }
.text-brand { color: var(--brand) !important; }

.btn-brand {
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand-dark);
    --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark);
    --bs-btn-active-border-color: var(--brand-dark);
}

.btn-outline-brand {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand-dark);
}

a { color: var(--brand); }

/* ---------- Mobile header + bottom navigation ---------- */
.mobile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: .75rem 1rem;
    padding-top: calc(.75rem + env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 1020;
}

.has-bottom-nav main {
    padding-bottom: calc(var(--bottom-nav-height) + 1.5rem + env(safe-area-inset-bottom)) !important;
}

@media (min-width: 768px) {
    .has-bottom-nav main { padding-bottom: 2rem !important; }
}

.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: #fff;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1030;
}

.bottom-nav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #6b7280;
    text-decoration: none;
    font-size: .7rem;
    gap: 2px;
}

.bottom-nav a i { font-size: 1.3rem; }
.bottom-nav a.active { color: var(--brand); font-weight: 600; }

.bottom-nav-add {
    width: 56px;
    height: 56px;
    margin-top: -28px;
    border-radius: 50%;
    border: 4px solid #f4f6f8;
    background: var(--brand);
    color: #fff;
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(15, 118, 110, .35);
}

.quick-add { height: auto !important; border-radius: 1rem 1rem 0 0; }
.quick-add-list .dropdown-item {
    padding: .9rem .5rem;
    font-size: 1.05rem;
    border-bottom: 1px solid #f1f1f1;
}
.quick-add-list .dropdown-item i { width: 1.8rem; display: inline-block; }

/* ---------- Guest pages ---------- */
.guest-body { background: linear-gradient(180deg, var(--brand-soft) 0%, #f4f6f8 45%); min-height: 100vh; }
.guest-container { max-width: 440px; padding-top: 3rem; padding-bottom: 3rem; }
.brand-mark {
    width: 56px; height: 56px; border-radius: 16px; margin: 0 auto;
    background: var(--brand); color: #fff; font-size: 1.8rem;
    display: flex; align-items: center; justify-content: center;
}

/* ---------- Components ---------- */
.card { border-radius: .9rem; }
.progress-thin { height: 6px; }
.progress-bar { width: 0; transition: width .4s ease; }

.metric {
    display: flex;
    flex-direction: column;
    padding: .6rem .75rem;
    background: #fff;
    border-radius: .75rem;
    height: 100%;
}
.metric-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; color: #6b7280; }
.metric-value { font-size: clamp(.9rem, 4vw, 1.1rem); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-hint { font-size: .72rem; color: #9ca3af; }
.metric-grid .metric { background: #f8fafc; }
.metric-grid .card.metric { background: #fff; }

.chart-box { position: relative; height: 240px; }
.chart-box-sm { height: 160px; }

.amount-input { font-size: 1.6rem; font-weight: 600; }

.module-option { cursor: pointer; border: 2px solid transparent; }
.module-option:has(input:checked) { border-color: var(--brand); background: #f0fdfa; }

.wizard-steps { display: flex; gap: .75rem; }
.wizard-step { display: flex; align-items: center; gap: .35rem; color: #9ca3af; text-decoration: none; font-size: .85rem; }
.wizard-dot {
    width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 2px solid currentColor;
    display: inline-flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 600;
}
.wizard-step.current { color: var(--brand); font-weight: 600; }
.wizard-step.done { color: var(--brand-dark); }
.wizard-step.done .wizard-dot { background: var(--brand); color: #fff; border-color: var(--brand); }

.tx-void { opacity: .55; }
.tx-void .fw-semibold { text-decoration: line-through; }

.kind-tabs .nav-link { border-radius: .6rem; }
.kind-tabs .nav-link.active:not(.bg-danger):not(.bg-success) { background: var(--brand); }

.debug-trace { white-space: pre-wrap; max-height: 60vh; overflow: auto; }

details > summary { cursor: pointer; }
.provider-logo {
    width: 36px; height: 36px; flex: 0 0 36px; border: 1px solid #e5e7eb; border-radius: 8px;
    background: #fff; display: inline-flex; align-items: center; justify-content: center;
    color: #374151; font-size: .85rem; font-weight: 700;
}
.provider-logo img { width: 22px; height: 22px; object-fit: contain; }
.provider-suggestions {
    position: absolute; z-index: 1080; top: calc(100% + 4px); left: 0; right: 0;
    max-height: 320px; overflow-y: auto;
}
.provider-suggestions [hidden] { display: none; }
.min-w-0 { min-width: 0; }
.recurring-card-grid .card { min-height: 220px; }
.upcoming-card-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem; }
.upcoming-card-grid .card { min-width: 0; min-height: 245px; }
.finance-subnav {
    display: flex; gap: .35rem; overflow-x: auto; padding-bottom: .25rem;
    scrollbar-width: thin; white-space: nowrap;
}
.finance-subnav-link {
    display: inline-flex; align-items: center; gap: .35rem; padding: .45rem .65rem;
    border: 1px solid #d1d5db; border-radius: 6px; color: #374151; text-decoration: none;
    background: #fff; font-size: .85rem;
}
.finance-subnav-link:hover { border-color: var(--brand); color: var(--brand-dark); }
.finance-subnav-link.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.forecast-opening { border-left: 4px solid var(--brand) !important; }
.forecast-card { min-height: 310px; }
.forecast-equation { display: grid; gap: .45rem; }
.forecast-equation > div { display: flex; justify-content: space-between; gap: 1rem; padding-top: .45rem; border-top: 1px solid #eef0f2; font-size: .85rem; }
.context-note {
    display: flex; align-items: flex-start; gap: .65rem; padding: .7rem .8rem;
    border-left: 4px solid; border-radius: 6px; font-size: .79rem; line-height: 1.35;
}
.context-note > i { font-size: 1.15rem; margin-top: .05rem; }
.context-note > div { display: grid; gap: .15rem; }
.context-note strong { font-size: .82rem; }
.context-note-info { color: #134e4a; background: #ecfdf5; border-color: #0f766e; }
.context-note-warning { color: #78350f; background: #fffbeb; border-color: #f59e0b; }
.finance-filter-bar { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .2rem; }
.transaction-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
.payment-calendar-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.payment-number { width: 2rem; height: 2rem; flex: 0 0 2rem; border-radius: 50%; background: #f0fdfa; color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; font-size: .78rem; font-weight: 700; }
.activity-date { width: 145px; }
.activity-log-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.habit-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; }
.habit-card { border-top: 4px solid var(--brand) !important; }
.habit-card.habit-blue { border-top-color: #2563eb !important; }.habit-card.habit-red { border-top-color: #dc2626 !important; }.habit-card.habit-amber { border-top-color: #d97706 !important; }.habit-card.habit-violet { border-top-color: #7c3aed !important; }
.habit-icon { width: 34px; height: 34px; flex: 0 0 34px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #f0fdfa; color: var(--brand); }
.habit-day { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .2rem; color: #9ca3af; font-size: .68rem; }.habit-day i { font-size: 1rem; }.habit-day.done { color: #15803d; }.habit-day.skipped { color: #6b7280; }
@media (max-width: 1199.98px) { .upcoming-card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .upcoming-card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 767.98px) { .transaction-card-grid, .payment-calendar-grid { grid-template-columns: 1fr; } }
@media (max-width: 767.98px) { .activity-log-grid { grid-template-columns: 1fr; } }
@media (max-width: 991.98px) { .habit-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575.98px) { .habit-grid { grid-template-columns: 1fr; } }
@media (max-width: 479.98px) { .upcoming-card-grid { grid-template-columns: 1fr; } }
.setup-card:hover { box-shadow: 0 .25rem .75rem rgba(0, 0, 0, .08) !important; }

/* Larger tap targets on touch screens */
@media (pointer: coarse) {
    .btn-sm { padding: .4rem .7rem; }
    .list-group-item { padding-top: .8rem; padding-bottom: .8rem; }
}
