/* Task pane styles — Outlook side panel is typically 320px wide.
   Colors use FluentUI design tokens so they adapt to light/dark mode automatically. */
html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

#app {
    width: 100%;
    height: 100%;
}

.task-pane {
    padding: 12px 16px;
}

/* ── Focus indication ────────────────────────────────────────────────────────────
   The Fluent web components (search, buttons, checkbox, data-grid) use their own
   built-in Fluent/Outlook focus rings. This rule only covers plain native elements that
   have no built-in ring (e.g. the error-bar dismiss link). WCAG 2.1 AA 2.4.7 / 1.4.11. */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible,
input:focus-visible {
    outline: 2px solid var(--focus-stroke-outer, var(--neutral-foreground-rest, #242424));
    outline-offset: 1px;
    border-radius: calc(var(--control-corner-radius, 4) * 1px);
}

/* Content visible only to screen readers (accessible names / live status). */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* NOTE: FluentDataGrid 4.10+ renders a native HTML <table> — NOT fluent-data-grid-cell
   custom elements — so any cell styling must target td/th (scoped via the grid's
   Class="doc-grid").
   Header th and body td default to slightly different horizontal padding (~1px), which
   nudges the select-all checkbox off the row checkboxes. Force BOTH to the same value —
   chosen to match the default look, keeping enough left inset that the checkbox focus
   ring isn't clipped at the pane edge. */
.doc-grid td,
.doc-grid th {
    padding-left: 12px !important;
    padding-right: 8px !important;
}

/* The grid renders as a native auto-layout <table> (the component's display:grid rule
   doesn't apply), so a single long nowrap document name widens the column beyond the
   task pane; focusing a row's ✕ then sideways-scrolls the overflow-hidden wrapper and
   the rows appear blank/shifted. Fixed layout makes the column track the pane width
   (also when the pane is resized wider) so the name span's ellipsis can do its job. */
.doc-grid {
    table-layout: fixed;
    width: 100%;
}

/* The stealth button's inner control has large built-in padding, pushing "Name" far
   from its checkbox. 6px left + the stack's 4px gap ≈ the ~10px the checkbox uses
   between its box and label, so "Name" lines up with the document names below. */
.name-sort-btn::part(control) {
    padding: 0 6px;
}

/* Row selection checkboxes use the document name as their label. In the narrow task
   pane a long name must truncate with an ellipsis; otherwise the row overflows and
   focusing the ✕ scrolls the cell sideways, hiding the checkbox. FluentCheckbox lays
   its label out in shadow DOM, so we constrain the `label` part (only reachable via
   ::part) and let the inner span's own ellipsis styling do the truncation. */
fluent-checkbox {
    max-width: 100%;
}

fluent-checkbox::part(label) {
    min-width: 0;
    overflow: hidden;
}

h2 {
    font-size: 18px;
    margin: 0 0 12px 0;
    color: var(--neutral-foreground-rest);
}

h3 {
    font-size: 14px;
    font-weight: 600;
    margin: 16px 0 6px 0;
    color: var(--neutral-foreground-rest);
}

dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 12px;
    margin: 0;
}

dt {
    font-weight: 600;
    color: var(--neutral-foreground-hint);
    white-space: nowrap;
}

dd {
    margin: 0;
    word-break: break-word;
}

.body-preview {
    font-style: italic;
    color: var(--neutral-foreground-hint);
}

.status-text {
    color: var(--neutral-foreground-hint);
    margin: 8px 0;
}

.alert-danger {
    color: var(--error-foreground, #a4262c);
    background: var(--error-background, #fde7e9);
    padding: 8px 10px;
    border-radius: 2px;
    margin: 8px 0;
}

button {
    background: var(--accent-fill-rest, #0078d4);
    color: var(--foreground-on-accent-rest, white);
    border: none;
    padding: 6px 16px;
    border-radius: 2px;
    cursor: pointer;
    font-size: 14px;
    font-family: inherit;
    margin-top: 8px;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

button:hover:not(:disabled) {
    background: var(--accent-fill-hover, #106ebe);
}

.contact-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0 0;
}

.contact-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--neutral-stroke-rest);
    line-height: 1.5;
}

.contact-list li:last-child {
    border-bottom: none;
}

.contact-list a {
    color: var(--accent-foreground-rest, #0078d4);
    text-decoration: none;
    font-size: 12px;
}

.contact-list a:hover {
    text-decoration: underline;
}

#blazor-error-ui {
    background: var(--warning-background, lightyellow);
    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;
}

.loading-progress-text {
    padding: 16px;
    color: var(--neutral-foreground-hint);
}

.token-box {
    font-family: "Courier New", monospace;
    font-size: 11px;
    word-break: break-all;
    background: var(--neutral-fill-secondary-rest);
    border: 1px solid var(--neutral-stroke-rest);
    border-radius: 2px;
    padding: 8px;
    color: var(--neutral-foreground-rest);
    max-height: 120px;
    overflow-y: auto;
}

/* Token claims list */
.claims-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 4px 0;
    margin-top: 8px;
    font-size: 12px;
}

.claims-list dt {
    font-weight: 600;
    color: var(--neutral-foreground-hint);
    margin-top: 4px;
}

.claims-list dd {
    margin: 0;
    word-break: break-all;
    color: var(--neutral-foreground-rest);
}

.claim-row {
    border-left: 3px solid var(--accent-fill-rest, #0078d4);
    padding: 4px 6px;
    background: var(--neutral-fill-secondary-rest);
    border-radius: 0 2px 2px 0;
}

.claim-header-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.claim-desc {
    font-size: 11px;
    color: var(--neutral-foreground-hint);
}

.claim-value {
    font-size: 12px;
    margin-top: 2px;
    word-break: break-all;
    color: var(--neutral-foreground-rest);
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.claim-ts-raw {
    color: var(--neutral-foreground-hint);
    font-size: 11px;
}

.claim-ts-dt {
    font-weight: 600;
}

.claim-ts-rel {
    font-size: 11px;
    color: var(--success-foreground, #107c10);
}
