/* ==========================================================================
   FairChoice CRM — 2026-11-09 upgrades
   Today, Referral partners, Data health, Search, grouped navigation.
   Loaded after ui-shell.css. Additive: removing this file and its <link>
   leaves the earlier interface as it was.
   ========================================================================== */

/* ------------------------------------------------------- grouped sidebar --- */

.app-auth .sidebar-nav .sidebar-section {
    margin: 12px 11px 3px;
}

.app-auth .sidebar-nav .sidebar-section:first-child {
    margin-top: 2px;
}

.app-auth .sidebar-nav .nav-badge {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    color: #ffffff;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.5;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.app-auth .sidebar-nav .nav-badge.is-hot {
    background: #d9822b;
}

@media (min-width: 1001px) {
    /* in the icon rail the headings are hidden; a hairline keeps the groups apart */
    html[data-rail="1"] .app-auth .sidebar-nav .nav-group-start {
        margin-top: 7px;
        box-shadow: 0 -4px 0 -3px rgba(255, 255, 255, 0.14);
    }

    html[data-rail="1"] .app-auth .sidebar-nav .nav-badge {
        position: absolute;
        top: 3px;
        right: 5px;
        min-width: 17px;
        padding: 0 4px;
        font-size: 0.6rem;
        line-height: 17px;
    }
}

/* ------------------------------------------------------------ app search --- */

.appbar-search {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 4px 0 0;
}

.appbar-search svg {
    position: absolute;
    left: 10px;
    width: 16px;
    height: 16px;
    color: var(--brand-dark);
    opacity: 0.6;
    pointer-events: none;
}

.appbar-search input {
    width: clamp(170px, 22vw, 340px);
    height: 34px;
    padding: 0 34px 0 32px;
    border: 1px solid rgba(4, 148, 165, 0.22);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.78);
    font: inherit;
    font-size: 0.88rem;
    box-shadow: none;
    transition: border-color 0.15s ease, background 0.15s ease, width 0.2s ease;
}

.appbar-search input:focus {
    outline: none;
    border-color: var(--brand);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(4, 148, 165, 0.16);
}

.appbar-search kbd {
    position: absolute;
    right: 8px;
    padding: 0 6px;
    border: 1px solid rgba(4, 148, 165, 0.25);
    border-radius: 5px;
    background: rgba(4, 148, 165, 0.07);
    color: var(--muted);
    font: 700 0.7rem/1.5 inherit;
    pointer-events: none;
}

.appbar-search input:focus + kbd {
    display: none;
}

.appbar-search-link {
    display: none;
}

@media (max-width: 760px) {
    .appbar-search {
        display: none;
    }

    .appbar-search-link {
        display: inline-flex;
    }
}

.search-page-form {
    display: flex;
    gap: 8px;
    margin: 0 0 var(--d-gap);
}

.search-page-form input {
    flex: 1;
    min-width: 0;
    height: 46px;
}

.search-page-form button {
    height: 46px;
    padding: 0 20px;
}

kbd {
    padding: 0 5px;
    border: 1px solid var(--line-strong);
    border-radius: 5px;
    background: var(--bg-soft);
    font-size: 0.8em;
    font-weight: 700;
}

/* ------------------------------------------------- needs-attention strip --- */

.attention-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 9px;
    margin: 0 0 var(--d-gap);
}

.attention-tile {
    position: relative;
    display: grid;
    gap: 1px;
    padding: 10px 12px 10px 15px;
    overflow: hidden;
    border: 1px solid rgba(4, 148, 165, 0.16);
    border-radius: 12px;
    background: var(--card);
    color: var(--ink);
    box-shadow: 0 6px 16px rgba(4, 51, 71, 0.06);
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.attention-tile::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: rgba(4, 148, 165, 0.35);
}

.attention-tile:hover {
    border-color: rgba(4, 148, 165, 0.5);
    box-shadow: 0 10px 22px rgba(4, 51, 71, 0.11);
    transform: translateY(-1px);
}

.attention-tile span {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--muted);
}

.attention-tile strong {
    font-size: var(--d-metric-num);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.attention-tile em {
    font-size: 0.74rem;
    font-style: normal;
    color: var(--muted);
}

.attention-tile.is-hot::before {
    background: #d9822b;
}

.attention-tile.is-hot strong {
    color: #a65a12;
}

html[data-density="compact"] .attention-tile em {
    display: none;
}

/* ------------------------------------------------------------ Today page --- */

.jump-row {
    margin-bottom: var(--d-gap);
}

.today-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--d-gap);
    align-items: start;
}

.today-grid > .panel {
    min-width: 0;
    margin: 0;
}

@media (min-width: 1600px) {
    .today-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .today-grid > .today-wide {
        grid-column: 1 / -1;
    }
}

.today-grid .table-wrap {
    max-height: 460px;
}

.app-auth .panel-head .panel-hint {
    margin: 3px 0 0;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--muted);
}

.app-auth .panel-head .brand-kicker {
    font-size: 0.62rem;
}

.app-auth tr.is-done td {
    opacity: 0.55;
}

.app-auth tr.is-today td {
    background: rgba(4, 148, 165, 0.07);
}

.app-auth td.empty-row,
p.empty-row {
    padding: 16px 12px;
    color: var(--muted);
    font-style: italic;
    text-align: center;
    white-space: normal;
}

.app-auth td.row-actions {
    width: 1%;
    text-align: right;
    white-space: nowrap;
}

/* ui-shell.css draws every in-table link as a small control chip; a client
   name is a name, so it reads as bold text and the "Open" chip is the control */
.app-auth tbody td a.name-link {
    display: inline;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--ink);
    font-size: inherit;
    font-weight: 700;
    box-shadow: none;
}

.app-auth tbody td a.name-link:hover {
    background: none;
    color: var(--brand-dark);
    text-decoration: underline;
    box-shadow: none;
}

.app-auth td .status-pill {
    padding: 2px 8px;
    font-size: 0.7rem;
    text-transform: none;
    vertical-align: 1px;
}

/* ---------------------------------------------------------- Data health --- */

.metric-card.health-link {
    color: inherit;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.metric-card.health-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(4, 51, 71, 0.11);
}

.metric-card strong small {
    font-size: 0.55em;
    font-weight: 700;
    color: var(--muted);
}

.metric-card strong.metric-date {
    font-size: 1.05rem;
}

.inline-form {
    display: inline;
    margin: 0;
}

.app-auth button.chip-button {
    display: inline-flex;
    align-items: center;
    min-height: var(--d-chip-h);
    margin-right: 4px;
    padding: 0 10px;
    border: 1px solid rgba(152, 101, 27, 0.4);
    line-height: 1;  /* td.row-actions sets line-height 0 for the link chips */
    border-radius: 999px;
    background: transparent;
    color: var(--warn);
    font-size: 0.76rem;
    font-weight: 700;
    box-shadow: none;
    cursor: pointer;
}

.app-auth button.chip-button:hover {
    background: rgba(152, 101, 27, 0.1);
    transform: none;
}

/* ---------------------------------------------------- Referral partners --- */

.inline-bar {
    display: inline-block;
    width: 70px;
    height: 6px;
    margin-right: 9px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--brand) var(--w, 0%), rgba(4, 148, 165, 0.13) var(--w, 0%));
    vertical-align: 1px;
}

.app-auth .page-head .brand-kicker a {
    color: inherit;
}

.app-auth .page-head .brand-kicker a:hover {
    text-decoration: underline;
}

@media (max-width: 760px) {
    .inline-bar {
        width: 36px;
    }
}

.app-auth tbody td a.name-link.soft {
    font-weight: 500;
}

.fix-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0 0 10px;
    font-size: 0.85rem;
    color: var(--muted);
}

.fix-bar button {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.86rem;
}

/* ------------------------------------------- tracker sync visibility (2026-11-11) --- */

.app-auth .sidebar-footer .sync-source {
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.76rem;
    line-height: 1.4;
}

.app-auth .sidebar-footer .sync-source a {
    color: #ffffff;
    font-weight: 700;
}

.review-banner {
    margin: 0 0 var(--d-gap);
    padding: 10px 14px;
    border: 1px solid rgba(152, 101, 27, 0.35);
    border-left: 4px solid #d9822b;
    border-radius: 12px;
    background: #fff8ec;
    color: #5c3b0d;
    font-size: 0.88rem;
    line-height: 1.5;
}

.review-banner a {
    margin-left: 6px;
    font-weight: 700;
    color: var(--brand-dark);
    text-decoration: underline;
}
