/* BTG Payroll Module — Styles
   Extends the design system in style.css (navy #284389, green #1DBF73,
   Archivo). Presentational only; loaded on payroll pages via block head.
*/

/* ============================
   Toolbar (quick links)
   ============================ */
.payroll-toolbar {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-link {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    color: var(--navy);
    background: rgba(40,67,137,0.08);
    transition: all 0.15s;
}

.toolbar-link:hover {
    background: rgba(40,67,137,0.15);
}

.back-link {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.back-link a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
}

.back-link a:hover {
    color: var(--navy);
}

.page-header-sub {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 0.15rem;
}

/* ============================
   Alerts
   ============================ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    line-height: 1.45;
}

.alert a {
    color: inherit;
    font-weight: 600;
}

.alert-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.alert-success {
    background: #d1fae5;
    border: 1px solid #6ee7b7;
    color: #065f46;
}

.alert-error {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

/* PH compliance module: A1/A13 tiering - every non-archived instance alerts,
   graded purely by days-to-due; the dashboard shows all three tiers so a
   filing due in three months is visible (quietly) rather than staying
   invisible until it's nearly late. */
.alert-informational {
    background: #eef2ff;
    border: 1px solid #c7d2fe;
    color: #3730a3;
}

.alert-urgent {
    background: #fee2e2;
    border: 1px solid #fca5a5;
    color: #b91c1c;
}

.alert-icon {
    flex-shrink: 0;
    font-weight: 700;
}

/* Module masthead kicker (owner decision, 18 Aug 2026): the PH compliance
   module presents as its own top-nav module - a small "YOOT AIOS" eyebrow
   above the page's own h1, reachable via the payroll toolbar's "Compliance"
   link rather than a literal top-nav entry. */
.module-kicker {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--navy);
    opacity: 0.65;
    margin-bottom: 0.2rem;
}

/* Fix-round I2: the friendly compliance error page. */
.compliance-error-card {
    max-width: 640px;
    margin: 2rem auto;
}

/* ============================
   Stat tiles
   ============================ */
.stat-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.stat-tile {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1rem 1.25rem;
}

.stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

.stat-currency {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-right: 0.3rem;
}

.stat-sub {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

/* ============================
   Status badges (run lifecycle + holidays + users)
   Reserved status colors: amber = needs action, blue = in flight,
   green = settled, gray = inert.
   ============================ */
.badge-pending_approval { background: #fef3c7; color: #92400e; }
.badge-approved         { background: #e0e7ff; color: #3730a3; }
.badge-issued           { background: #dbeafe; color: #1d4ed8; }
.badge-paid             { background: #d1fae5; color: #065f46; }
.badge-confirmed        { background: #d1fae5; color: #065f46; }
.badge-unconfirmed      { background: #fef3c7; color: #92400e; }
.badge-active           { background: #d1fae5; color: #065f46; }
.badge-deactivated      { background: #e5e7eb; color: #374151; }
.badge-role             { background: rgba(40,67,137,0.1); color: var(--navy); }
.badge-neutral          { background: #f0f2f5; color: #374151; }

/* PH compliance module: filing pipeline + invoice gate verdict badges
   (badge-paid is reused as-is from the run lifecycle above). */
.badge-computed         { background: #f0f2f5; color: #374151; }
.badge-prepared         { background: #e0e7ff; color: #3730a3; }
.badge-filed            { background: #dbeafe; color: #1d4ed8; }
.badge-receipt_archived { background: #d1fae5; color: #065f46; }
.badge-blocked          { background: #fee2e2; color: #991b1b; }
.badge-matched          { background: #d1fae5; color: #065f46; }
.badge-evidenced        { background: #fef3c7; color: #92400e; }
.badge-disputed         { background: #fee2e2; color: #991b1b; }
.badge-rejected         { background: #e5e7eb; color: #374151; }

/* A13: alert-tier badges (informational / warning / urgent) so severity is
   obvious at a glance, matching each tier's alert-* background. */
.badge-informational    { background: #eef2ff; color: #3730a3; }
.badge-warning          { background: #fef3c7; color: #92400e; }
.badge-urgent           { background: #fee2e2; color: #b91c1c; }

.badge-lg {
    font-size: 0.85rem;
    padding: 0.3rem 0.75rem;
    border-radius: 6px;
}

/* ============================
   Table refinements
   ============================ */
.cell-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-weight: 500;
}

th.cell-num { font-weight: 600; }

.cell-actions {
    text-align: right;
    white-space: nowrap;
}

/* ============================
   Inline forms (table cells, flag blocks)
   ============================ */
.inline-form {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap;
}

.inline-form .form-input {
    width: auto;
    flex: 1;
    min-width: 150px;
    padding: 0.35rem 0.6rem;
    font-size: 0.85rem;
}

/* ============================
   Flags
   ============================ */
.flag-count {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.15rem 0.6rem;
    border-radius: 10px;
    background: #d1fae5;
    color: #065f46;
    margin-left: 0.5rem;
    vertical-align: middle;
}

.flag-count-open {
    background: #fef3c7;
    color: #92400e;
}

.flag-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.flag-item {
    border: 1px solid #fcd34d;
    border-left: 4px solid var(--amber);
    border-radius: 8px;
    padding: 0.75rem 0.9rem;
    background: #fffbeb;
}

.flag-item.flag-resolved {
    border-color: var(--border);
    border-left-color: var(--green);
    background: var(--card-bg);
}

.flag-item-header {
    display: flex;
    gap: 0.6rem;
    align-items: baseline;
    flex-wrap: wrap;
    margin-bottom: 0.25rem;
}

.flag-type {
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #92400e;
}

.flag-resolved .flag-type {
    color: var(--green-dark);
}

.flag-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.flag-detail {
    font-size: 0.9rem;
    line-height: 1.45;
}

.flag-resolution {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.35rem;
}

.flag-item .inline-form {
    margin-top: 0.6rem;
}

/* ============================
   Detail page layout
   ============================ */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

.detail-grid .card {
    margin-bottom: 0;
}

.detail-grid + .card,
.action-bar {
    margin-top: 1rem;
}

.explanation-text {
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-line;
}

.action-bar {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

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

.btn-danger {
    background: var(--red);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* ============================
   Auth (login) card
   ============================ */
.auth-wrapper {
    max-width: 400px;
    margin: 2.5rem auto 0;
}

.auth-wrapper .btn {
    width: 100%;
}

/* ============================
   Account / narrow forms
   ============================ */
.narrow-card {
    max-width: 480px;
}

.signed-in-as {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.signed-in-as strong {
    color: var(--text);
}

.form-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin-top: 0.75rem;
}

.form-note code {
    background: #f0f2f5;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    font-size: 0.75rem;
}

/* ============================
   Responsive
   ============================ */
@media (min-width: 768px) {
    .detail-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 767px) {
    .inline-form .form-input {
        min-width: 120px;
    }

    .stat-value {
        font-size: 1.35rem;
    }

    .cell-actions .btn {
        padding: 0.3rem 0.6rem;
    }
}
