@font-face {
    font-family: "Fira Sans Condensed";
    src: url("fonts/FiraSansCondensed-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Fira Sans Condensed";
    src: url("fonts/FiraSansCondensed-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Fira Sans Condensed";
    src: url("fonts/FiraSansCondensed-SemiBold.woff2") format("woff2");
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Fira Sans Condensed";
    src: url("fonts/FiraSansCondensed-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    --pw-ink: #08332e;
    --pw-muted: #5d756d;
    --pw-accent: #1daa61;
    --pw-accent-deep: #0f7a49;
    --pw-paper: #f3f6f4;
    --pw-line: #d5e3dc;
    --pw-header: #0d4f45;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; height: 100%; }

body {
    font-family: "Fira Sans Condensed", sans-serif;
    font-size: 16.5px;
    font-weight: 700;
    color: var(--pw-ink);
    background: var(--pw-paper);
}

button, input, textarea, select {
    font-family: inherit;
    font-weight: 700;
}

body *:not(.bi):not([class^="bi-"]):not([class*=" bi-"]) {
    font-weight: 700;
}

a { color: var(--pw-accent-deep); }
.text-danger { color: #9b2335; }

h1:focus { outline: none; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

.page-toolbar {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.page-title {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.1;
}

.page-sub {
    margin: 0.2rem 0 0;
    color: var(--pw-muted);
    font-size: 0.86rem;
    max-width: 46rem;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.count-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 2.15rem;
    padding: 0.3rem 0.85rem 0.3rem 0.7rem;
    border-radius: 999px;
    background: #e7f8ef;
    color: #0c6340;
    border: 1px solid #b7e4cc;
    font-size: 0.875rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}
.count-pill .bi { font-size: 1.05rem; color: #25d366; line-height: 1; }
.count-pill strong { font-weight: 700; }

.tb-btn {
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    min-height: 2.15rem;
    padding: 0.4rem 0.85rem;
    border-radius: 0.45rem;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(8, 51, 46, 0.08);
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}
.tb-btn .bi,
.tb-btn .tb-icon {
    font-size: 1rem;
    line-height: 1;
    display: inline-block;
    flex: 0 0 auto;
}
.tb-btn .tb-icon { width: 1rem; height: 1rem; }
.tb-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(8, 51, 46, 0.12); }
.tb-btn:disabled { opacity: 0.65; cursor: wait; transform: none; box-shadow: none; }

.tb-btn-refresh {
    background: #1d4e89;
    border-color: #1d4e89;
    color: #fff;
}
.tb-btn-refresh:hover { background: #163c69; border-color: #163c69; color: #fff; }
.tb-btn-refresh.is-busy .bi { animation: tb-spin 0.7s linear infinite; }

@keyframes tb-spin {
    to { transform: rotate(360deg); }
}

.tb-btn-clear {
    background: #fff8ef;
    border-color: #e0b56a;
    color: #8a5a12;
}
.tb-btn-clear:hover { background: #ffefd4; border-color: #d97706; color: #6b450d; }

.tb-btn-add,
.tb-btn-chats {
    background: var(--pw-accent-deep);
    border-color: var(--pw-accent-deep);
    color: #fff;
}
.tb-btn-add:hover,
.tb-btn-chats:hover {
    background: #0c6340;
    border-color: #0c6340;
    color: #fff;
}

.tb-btn-back {
    background: #fff;
    border-color: #c5d8d0;
    color: #34514a;
}
.tb-btn-back:hover { background: #f3faf6; border-color: #9ec3b6; color: #08332e; }

.tb-btn-danger {
    background: #9b2335;
    border-color: #9b2335;
    color: #fff;
}
.tb-btn-danger:hover { background: #7d1c2b; border-color: #7d1c2b; color: #fff; }

.tb-btn-warn {
    background: #c2410c;
    border-color: #c2410c;
    color: #fff;
}
.tb-btn-warn:hover { background: #9a3412; border-color: #9a3412; color: #fff; }
.tb-btn-warn:disabled { color: #fff; }
.tb-btn-warn.is-busy .bi { animation: tb-spin 0.7s linear infinite; }

.tb-btn-app {
    background: #9b2335;
    border-color: #9b2335;
    color: #fff;
}
.tb-btn-app:hover { background: #7d1c2b; border-color: #7d1c2b; color: #fff; }
.tb-btn-app:disabled { color: #fff; }

.view-switch {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #c5d8d0;
    border-radius: 0.45rem;
    overflow: hidden;
    min-height: 2.15rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(8, 51, 46, 0.08);
}
.view-switch-btn {
    font: inherit;
    font-size: 0.875rem;
    font-weight: 700;
    border: 0;
    background: #fff;
    color: #34514a;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.view-switch-btn + .view-switch-btn { border-left: 1px solid #c5d8d0; }
.view-switch-btn .bi { font-size: 1rem; line-height: 1; }
.view-switch-btn:hover { background: #e7f6ef; }
.view-switch-btn.on {
    background: var(--pw-accent-deep);
    color: #fff;
}
.view-switch-btn.on:hover { background: #0c6340; color: #fff; }

@media (max-width: 720px) {
    .toolbar-actions {
        width: 100%;
    }
    .count-pill,
    .view-switch {
        flex: 1 1 auto;
    }
    .view-switch { justify-content: stretch; }
    .view-switch-btn { flex: 1; }
    .tb-btn { flex: 1 1 auto; }
}

.row-actions { display: inline-flex; gap: 0.25rem; }

.row-count {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--pw-header);
    background: #e7f3ef;
    border: 1px solid var(--pw-line);
    padding: 0.18rem 0.45rem;
    font-variant-numeric: tabular-nums;
}

.btn {
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 700;
    border-radius: 0.15rem;
    border: 1px solid var(--pw-accent-deep);
    background: #fff;
    color: var(--pw-accent-deep);
    padding: 0.32rem 0.65rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    line-height: 1.2;
}

.btn:hover { background: #e7f6ef; }

.btn-primary { background: var(--pw-accent-deep); color: #fff; }
.btn-primary:hover { background: #0c6340; color: #fff; }

.btn-sm { font-size: 0.75rem; padding: 0.18rem 0.45rem; }

.btn-danger { border-color: #9b2335; color: #9b2335; background: #fff; }
.btn-danger:hover { background: #9b2335; color: #fff; }

.btn-ghost { border-color: #c5d8d0; color: var(--pw-ink); background: #fff; }
.btn-ghost:hover { background: #f3faf6; }

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.field { display: flex; flex-direction: column; gap: 0.22rem; min-width: 0; }
.field-label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #3d5c54;
}
.field-label .bi { font-size: 0.85rem; color: #0f7a49; line-height: 1; }
.control, textarea.control {
    width: 100%;
    border: 1px solid #c5d8d0;
    border-radius: 0.15rem;
    background: #fff;
    color: var(--pw-ink);
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 700;
    padding: 0.32rem 0.45rem;
}
.control { min-height: 2.15rem; }
textarea.control { min-height: 6.5rem; resize: vertical; font-weight: 700; }
.control:focus { outline: 2px solid rgba(29, 170, 97, 0.35); border-color: var(--pw-accent-deep); }

.form-error {
    background: #fff1f0;
    color: #8d2433;
    border: 1px solid #f0c2c4;
    padding: 0.4rem 0.55rem;
    font-size: 0.82rem;
}

.note {
    background: #e7f6ef;
    color: #0c6340;
    border: 1px solid #b7e4cc;
    padding: 0.4rem 0.55rem;
    font-size: 0.82rem;
}

.pill {
    display: inline-flex;
    align-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 0.08rem 0.4rem;
    border-radius: 999px;
    white-space: nowrap;
}
.pill-ok { background: #e5f8ee; color: #0c6340; }
.pill-bad { background: #fde8e8; color: #9b2335; }
.pill-wait { background: #fff4d8; color: #8a5a12; }
.pill-info { background: #e7f1fb; color: #1d4e89; }
.pill-muted { background: #eef1f0; color: #4d5e58; }
.pill-sm { font-size: 0.68rem; padding: 0.06rem 0.35rem; flex: 0 0 auto; max-width: 11rem; overflow: hidden; text-overflow: ellipsis; }

.modal-back {
    position: fixed;
    inset: 0;
    background: rgba(7, 40, 36, 0.46);
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.modal-card {
    width: min(34rem, 100%);
    background: #fff;
    border: 1px solid var(--pw-line);
    box-shadow: 0 18px 50px rgba(7, 40, 36, 0.22);
    padding: 1rem 1rem 0.9rem;
}

.modal-card h2 {
    margin: 0 0 0.35rem;
    font-size: 1.15rem;
}

.modal-card p { margin: 0 0 0.8rem; color: #34564e; font-size: 0.9rem; }

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.4rem;
    margin-top: 0.9rem;
}

.check {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
}

.mono {
    font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
    font-size: 0.78rem;
}

article.content:has(.wa-app) {
    padding: 0 !important;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.blazor-error-boundary {
    background: #9b2335;
    padding: 1rem 1rem 1rem 1rem;
    color: white;
}

#blazor-error-ui {
    background: #fff8d6;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

@media (max-width: 720px) {
    .modal-grid { grid-template-columns: 1fr; }
}

/* Footer with build version */
.app-footer {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.3rem 1.15rem;
    border-top: 1px solid #d5e3dc;
    background: #ffffff;
    color: #5d756d;
    font-family: "Fira Sans Condensed", system-ui, sans-serif;
    font-weight: 700;
    font-size: 0.74rem;
    letter-spacing: 0.02em;
    line-height: 1.3;
}
.app-footer-ver { margin-left: auto; white-space: nowrap; }
.app-footer-ver b { color: #0d4f45; font-variant-numeric: tabular-nums; }
.app-footer-float {
    position: fixed;
    right: 0.6rem;
    bottom: 0.5rem;
    z-index: 60;
    padding: 0.18rem 0.55rem;
    border: 1px solid #d5e3dc;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 4px 12px rgba(8, 51, 46, 0.08);
    pointer-events: none;
}
@media (max-width: 640.98px) {
    .app-footer { padding: 0.25rem 0.6rem; font-size: 0.7rem; }
    .app-footer-name { display: none; }
}

.pw-app-restart-overlay {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(8, 20, 18, 0.72);
    color: #fff;
    padding: 1.5rem;
    text-align: center;
}
.pw-app-restart-card {
    max-width: 28rem;
    background: #10231f;
    border: 1px solid #3a5e55;
    border-radius: 0.9rem;
    padding: 1.4rem 1.5rem 1.3rem;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
}
.pw-app-restart-card h2 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
}
.pw-app-restart-card p {
    margin: 0;
    color: #d5e6e0;
    font-size: 0.95rem;
    line-height: 1.45;
}
.pw-app-restart-card .pw-app-restart-err { color: #fecaca; margin-top: 0.7rem; font-weight: 700; }
