/* ===== Dashboard ===== */
:root { --db-green: #1b7a43; --db-red: #d32f2f; }

.db-page { min-width: 0; }

.db-banner { border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; font-size: 14px; line-height: 1.5; background: #fff6e5; border: 1px solid #f3d089; color: #6b4a00; }
.db-banner[hidden] { display: none; }
.db-banner strong { font-weight: 700; }
.db-banner a { color: inherit; font-weight: 700; }

.db-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.db-cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-bottom: 0; }
.db-cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 0; }
.db-card { background: #fff; border: 1px solid var(--border, #d9dee5); border-radius: 12px; padding: 16px; min-width: 0; }
.db-card span { display: block; font-size: 13px; color: var(--muted, #6b7785); margin-bottom: 6px; }
.db-card span b { font-weight: 700; color: var(--text, #1f2933); }
.db-card strong { display: block; font-size: 22px; overflow-wrap: anywhere; }
.db-card small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted, #6b7785); }
.db-card-red strong { color: var(--db-red); }

.db-panel { background: #fff; border: 1px solid var(--border, #d9dee5); border-radius: 12px; padding: 18px; margin-bottom: 18px; min-width: 0; }
.db-panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.db-panel-head h3 { margin: 0 0 3px; font-size: 18px; }
.db-panel-head p { margin: 0; font-size: 13px; color: var(--muted, #6b7785); }
.db-panel-head input, .db-panel-head select { min-width: 150px; border: 1px solid var(--border, #d9dee5); border-radius: 8px; padding: 10px 12px; font-size: 14px; font-family: inherit; background: #fff; -webkit-appearance: none; appearance: none; box-sizing: border-box; max-width: 100%; }
.db-panel-head select { padding-right: 30px; background-image: linear-gradient(45deg, transparent 50%, #6b7785 50%), linear-gradient(135deg, #6b7785 50%, transparent 50%); background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }

.db-quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }

.db-flow { display: grid; grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr; gap: 8px; align-items: stretch; margin-bottom: 16px; }
.db-flow-box { border: 1px solid #eef1f4; background: #f6f8fa; border-radius: 10px; padding: 12px; min-width: 0; }
.db-flow-box span { display: block; font-size: 12px; color: var(--muted, #6b7785); margin-bottom: 4px; }
.db-flow-box strong { font-size: 17px; overflow-wrap: anywhere; }
.db-flow-total { background: #fdf0f0; border-color: #f5cccc; }
.db-flow-total strong { color: var(--db-red); }
.db-flow-op { align-self: center; font-size: 20px; font-weight: 700; color: var(--muted, #6b7785); }
.db-red { color: var(--db-red); }
.db-green { color: var(--db-green); }

.db-tabs { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.db-tab { border: 1px solid var(--border, #d9dee5); background: #fff; border-radius: 20px; padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--text, #1f2933); }
.db-tab.active { background: var(--db-green); border-color: var(--db-green); color: #fff; }

.db-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.db-table { width: 100%; min-width: 0; border-collapse: collapse; font-size: 14px; }
.db-table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted, #6b7785); padding: 8px 10px; background: #f6f8fa; white-space: nowrap; }
.db-table td { padding: 10px; border-bottom: 1px solid #eef1f4; white-space: nowrap; }
.db-table .num { text-align: right; }
.db-table tfoot td { font-weight: 700; background: #f6f8fa; }
.db-table a { color: var(--db-green); font-weight: 600; text-decoration: none; }
.db-year-table { min-width: 720px; }
.db-empty { text-align: center; color: var(--muted, #6b7785); padding: 20px 10px !important; white-space: normal !important; }
.db-now td { background: #f4f9f6; }

.db-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.db-two .db-panel { margin-bottom: 18px; }
.db-list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #eef1f4; font-size: 14px; }
.db-list-row:last-child { border-bottom: 0; }
.db-list-row b { display: block; font-weight: 600; }
.db-list-row small { color: var(--muted, #6b7785); font-size: 12px; }
.db-list-row > div:first-child { min-width: 0; overflow-wrap: anywhere; }
.db-list-row > div:last-child { text-align: right; flex: 0 0 auto; }

/* clickable numbers */
a.db-card, a.db-flow-box { text-decoration: none; color: inherit; }
.db-card-link:hover, .db-flow-link:hover { border-color: var(--db-green); box-shadow: 0 2px 10px rgba(27, 122, 67, .15); }
.db-card-link::after { content: "View customers ›"; display: block; margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--db-green); }
.db-flow-link em { display: block; margin-top: 4px; font-size: 11px; font-style: normal; font-weight: 600; color: var(--db-green); }
.db-sub { margin: 4px 0 8px; font-size: 14px; }
.db-age { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.db-age a { display: block; text-decoration: none; color: inherit; border: 1px solid #eef1f4; background: #f6f8fa; border-radius: 10px; padding: 10px 12px; }
.db-age a:hover { border-color: var(--db-green); }
.db-age span { display: block; font-size: 12px; color: var(--muted, #6b7785); }
.db-age strong { display: block; font-size: 16px; margin-top: 2px; }
.db-age small { font-size: 11px; color: var(--muted, #6b7785); }
.db-age a.db-age-old strong { color: var(--db-red); }
.db-year-note { margin-bottom: 12px; font-size: 14px; }
.db-year-note a { color: var(--db-green); font-weight: 700; }
.db-table td a.db-cell { display: inline-block; text-decoration: none; color: inherit; border-bottom: 1px dashed var(--db-green); }
.db-table td a.db-cell small { display: block; font-size: 11px; color: var(--muted, #6b7785); text-align: right; }

@media (max-width: 900px) {
    .db-cards { grid-template-columns: 1fr 1fr; }
    .db-cards-3, .db-cards-2 { grid-template-columns: 1fr; }
    .db-two { grid-template-columns: 1fr; gap: 0; }
    .db-flow { grid-template-columns: 1fr 1fr; }
    .db-flow-op { display: none; }
    .db-card strong { font-size: 18px; }
    .db-age { grid-template-columns: 1fr 1fr; }
}

/* ===== Dashboard hub (big boxes) ===== */
.hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.hub-tile { display: flex; align-items: center; gap: 14px; padding: 20px 18px; background: #fff; border: 1px solid var(--border, #d9dee5); border-radius: 16px; text-decoration: none; color: inherit; transition: box-shadow .15s, transform .15s, border-color .15s; min-width: 0; }
.hub-tile:hover { box-shadow: 0 8px 22px rgba(16, 60, 40, .12); transform: translateY(-2px); }
.hub-icon { flex: none; width: 54px; height: 54px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; }
.hub-body { flex: 1; min-width: 0; display: block; }
.hub-title { display: block; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #6b7785); margin-bottom: 4px; }
.hub-body strong { display: block; font-size: 24px; overflow-wrap: anywhere; }
.hub-body small { display: block; margin-top: 4px; font-size: 12px; color: var(--muted, #6b7785); }
.hub-arrow { flex: none; font-size: 28px; color: #b4bec7; line-height: 1; }
.hub-green .hub-icon { background: linear-gradient(135deg, #176b45, #2f9d6b); }
.hub-red .hub-icon { background: linear-gradient(135deg, #b4232f, #e25563); }
.hub-red .hub-body strong { color: var(--db-red); }
.hub-amber .hub-icon { background: linear-gradient(135deg, #a8600a, #e0a040); }
.hub-blue .hub-icon { background: linear-gradient(135deg, #0b4f8a, #3a86c8); }
.hub-purple .hub-icon { background: linear-gradient(135deg, #6a2c91, #a066c7); }
.hub-purple .hub-body strong { color: #6a2c91; font-size: 20px; }
.hub-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }


/* ===== Back button ===== */
.db-back {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 10px;
    margin: 0 0 16px;
    padding: 6px 18px 6px 6px;
    background: #ffffff;
    border: 1px solid #d8e1db;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(16, 60, 40, 0.1);
    color: #176b45;
    font-size: 15px;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: box-shadow 0.15s, transform 0.15s, background 0.15s;
}

.db-back::before {
    content: "";
    flex: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #176b45 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 5l-7 7 7 7'/%3E%3C/svg%3E") center / 18px no-repeat;
}

.db-back:hover {
    background: #eef6f1;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(16, 60, 40, 0.16);
}

.db-back:active {
    transform: scale(0.97);
}

@media (max-width: 900px) {
    .hub-grid { grid-template-columns: 1fr; gap: 12px; }
    .hub-body strong { font-size: 22px; }
}