/*
  Arij global styles, in the Jira Cloud (Atlassian) look. Tokens live in tokens.css.
  Component styles live next to their component in *.razor.css (CSS isolation). The classes below are global so any
  page or component can use them. Type sizes on a screen: 12px (--text-xs), 14px (--text-sm, the default), 20px+ for page titles.

  Buttons      .btn (default: grey)  .btn-primary (brand blue)  .btn-subtle (transparent)  .btn-link  .btn-danger  .btn-sm  .btn-sel (pressed)
               .icon-btn (32px square, icon only; give it an aria-label)
  Forms        .field (label + control + .field-help / .field-error, stacked)  .input  .select  .textarea
               .req (red asterisk)  .check (checkbox or radio + text on one line)  .form-actions
               .search-input (wrapper: an <Icon Name="search"/> then an .input inside)
  Layout       .page (main column)  .page-head (h1 + .page-actions on the right)  .page-lead (muted intro)
               .section-title (16px semibold)  .toolbar (row of filters)  .grid-2  .grid-3  .hstack  .vstack  .ml-auto
  Surfaces     .card (white, 1px border, 3px radius)  .card-title  .banner (.banner-success, .banner-error)  .codeblock
  Tables       .table (bold subtle th, 40px rows)  td.name (semibold)  .table .actions (right-aligned cell)
  Tabs         .tabs > .tab (.tab.on or aria-current="page" / aria-selected="true"): blue underline when selected
               .seg > button[aria-pressed="true"] (segmented control)
  Menus        .menu-item (button or link inside <Menu>)  .menu-item.danger  .menu-sep
  Small bits   .chip  .lozenge  .scope (.scope-write, .scope-admin)  .count  .kbd  .dot  .grip
  Text         .muted  .helper (12px muted)  .link  .mono  .ellipsis  .sr-only  .tabular
  Motion       .ripple-ink (injected by js/ripple.js on pointerdown; see the end of this file)
*/

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
    background: var(--surface);
    color: var(--fg);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    line-height: var(--leading-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: var(--text-xl); font-weight: 600; line-height: 1.2; letter-spacing: var(--tracking-display); color: var(--fg); }
h2 { font-size: var(--text-base); font-weight: 600; line-height: 1.25; }
h3 { font-size: var(--text-sm); font-weight: 600; line-height: var(--leading-tight); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
code { font-family: var(--font-mono); font-size: 0.875em; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
/* Headings and containers get focus programmatically (after navigation, dialogs opening): no ring. */
h1:focus, h1:focus-visible, [tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { box-shadow: none; }
input, select, textarea { font: inherit; color: inherit; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }
::selection { background: var(--selection); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- buttons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 32px; padding: 0 12px;
    border: 0; border-radius: var(--radius-sm);
    background: var(--tint); color: var(--fg-2);
    font-size: var(--text-sm); font-weight: 500; line-height: 1; white-space: nowrap; cursor: pointer; text-decoration: none;
    transition: background-color var(--motion-fast) ease-out, color var(--motion-fast) ease-out;
}
.btn:hover { background: var(--tint-2); color: var(--fg); text-decoration: none; }
.btn:active { background: var(--tint-3); }
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--tint); color: var(--slate-400); cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--accent); color: var(--accent-on); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-on); }
.btn-primary:active { background: var(--accent-active); }
.btn-primary:disabled { background: var(--tint); }
.btn-subtle, .btn-link { background: transparent; color: var(--fg-2); }
.btn-subtle:hover { background: var(--tint); }
.btn-link { color: var(--accent); }
.btn-link:hover { background: transparent; color: var(--accent-hover); text-decoration: underline; }
.btn-danger { background: var(--danger); color: var(--accent-on); }
.btn-danger:hover { background: var(--danger-hover); color: var(--accent-on); }
.btn-sel, .btn[aria-pressed="true"] { background: var(--accent-tint); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.btn-sm { height: 24px; padding: 0 8px; font-size: var(--text-sm); }
/* Short modifiers used by the issue screens (.btn.primary, .btn.sm, …): same looks as the long names above. */
.btn.primary { background: var(--accent); color: var(--accent-on); }
.btn.primary:hover { background: var(--accent-hover); color: var(--accent-on); }
.btn.primary:active { background: var(--accent-active); }
.btn.primary:disabled { background: var(--tint); color: var(--slate-400); }
.btn.subtle { background: transparent; color: var(--fg-2); }
.btn.subtle:hover { background: var(--tint); color: var(--fg); }
.btn.danger { background: var(--danger); color: var(--accent-on); }
.btn.danger:hover { background: var(--danger-hover); }
.btn.subtle.danger { background: transparent; color: var(--danger-ink); }
.btn.subtle.danger:hover { background: var(--danger-tint); }
.btn.sel { background: var(--accent-tint); color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent); }
.btn.sm { height: 24px; padding: 0 8px; }
.btn.push { margin-left: auto; }
.icon-btn {
    display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
    border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--fg-2); cursor: pointer;
}
.icon-btn:hover { background: var(--tint); color: var(--fg); }
.icon-btn:active { background: var(--tint-2); }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; background: transparent; }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 4px; align-content: start; min-width: 0; }
.field > label, .field > .label, fieldset.field > legend { font-size: var(--text-xs); font-weight: 600; color: var(--fg-2); padding: 0; }
fieldset.field { border: 0; margin: 0; padding: 0; }
.field > label.check, fieldset.field label.check { font-size: var(--text-sm); font-weight: 400; color: var(--fg); }
fieldset.field > legend { margin-bottom: 4px; }
.input, .select, .textarea {
    width: 100%; min-width: 0; height: 36px; padding: 0 8px;
    border: 1px solid var(--border-input); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--fg); font-size: var(--text-sm);
    transition: background-color var(--motion-fast) ease-out, border-color var(--motion-fast) ease-out;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.textarea { height: auto; min-height: 88px; padding: 8px; resize: vertical; line-height: var(--leading-body); }
.select {
    appearance: none; padding-right: 32px; cursor: pointer;
    background-image: linear-gradient(45deg, transparent 50%, var(--fg-2) 50%), linear-gradient(135deg, var(--fg-2) 50%, transparent 50%);
    background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%;
    background-size: 5px 5px; background-repeat: no-repeat;
}
.input:hover, .select:hover, .textarea:hover { background-color: var(--surface-sunken); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus); box-shadow: inset 0 0 0 1px var(--focus); background-color: var(--surface); outline: none; }
.input:disabled, .input[readonly], .select:disabled, .textarea:disabled { background: var(--surface-sunken); color: var(--muted); border-color: var(--border); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger); }
.field-help, .helper { font-size: var(--text-xs); color: var(--muted); }
.field-error { font-size: var(--text-xs); color: var(--danger-ink); }
.req { color: var(--danger); }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.form-actions { display: flex; align-items: center; gap: 8px; }
.search-input { position: relative; display: flex; align-items: center; width: 200px; }
.search-input > svg { position: absolute; left: 8px; width: 16px; height: 16px; color: var(--fg-2); pointer-events: none; }
.search-input > .input { height: 32px; padding-left: 30px; }

/* ---------- page layout ---------- */
.page { max-width: 1200px; display: grid; gap: 16px; align-content: start; }
.page-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 40px; }
.page-head h1 { margin-right: auto; }
.page-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.page-lead { color: var(--fg-2); max-width: 680px; margin-top: -8px; }
.section-title { font-size: var(--text-base); font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 720px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
.hstack { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vstack { display: grid; gap: 8px; align-content: start; }
.ml-auto { margin-left: auto; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 16px 20px; display: grid; gap: 12px; align-content: start; }
.card-title { font-size: var(--text-base); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-title svg { width: 18px; height: 18px; color: var(--fg-2); }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); border: 0; background: var(--tint); color: var(--fg); }
.banner > svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.banner-success { background: var(--success-tint); }
.banner-success > svg { color: var(--success-ink); }
.banner-error { background: var(--danger-tint); }
.banner-error > svg { color: var(--danger); }
.codeblock {
    font-family: var(--font-mono); font-size: var(--text-xs); line-height: 1.6;
    background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 12px; white-space: pre; overflow-x: auto; margin: 0;
}

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: var(--text-xs); font-weight: 600; color: var(--fg-2); padding: 8px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.table td { padding: 0 8px; height: 40px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover td { background: var(--surface-sunken); }
.table td.name { font-weight: 500; }
.table tr.selected td { background: var(--accent-tint); }
.table tr.inactive td { color: var(--muted); }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); }
.tab {
    position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 8px 6px; margin-bottom: -2px;
    color: var(--fg-2); font-weight: 500; border: 0; border-bottom: 2px solid transparent; background: none; cursor: pointer; text-decoration: none;
}
.tab:hover { color: var(--fg); text-decoration: none; border-bottom-color: var(--border-strong); }
.tab svg { width: 16px; height: 16px; }
.tab.on, .tab[aria-current="page"], .tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.seg { display: inline-flex; background: var(--tint); border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.seg > button, .seg > a {
    display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--fg-2); font-weight: 500; cursor: pointer; text-decoration: none;
}
.seg > button:hover, .seg > a:hover { color: var(--fg); text-decoration: none; }
.seg > button[aria-pressed="true"], .seg > a[aria-current="page"] { background: var(--surface); color: var(--accent); box-shadow: var(--elev-card); }

/* ---------- menus (content of <Menu>) ---------- */
.menu-item {
    display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 6px 12px;
    border: 0; border-radius: 0; background: transparent; color: var(--fg); text-align: left; cursor: pointer; text-decoration: none; white-space: nowrap;
    box-shadow: inset 2px 0 0 transparent;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--tint); text-decoration: none; box-shadow: inset 2px 0 0 var(--accent); }
.menu-item svg { width: 16px; height: 16px; color: var(--fg-2); flex: none; }
.menu-item.danger { color: var(--danger-ink); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 0; }

/* ---------- small bits ---------- */
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 6px; border-radius: var(--radius-sm); background: var(--tint); font-size: var(--text-xs); color: var(--fg); white-space: nowrap; }
.lozenge { display: inline-flex; align-items: center; height: 16px; padding: 0 4px; border-radius: var(--radius-sm); background: var(--lz-todo-bg); color: var(--lz-todo-fg); font-size: 11px; font-weight: 700; text-transform: uppercase; line-height: 16px; white-space: nowrap; }
.scope { display: inline-flex; align-items: center; height: 16px; padding: 0 4px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; text-transform: uppercase; background: var(--lz-todo-bg); color: var(--lz-todo-fg); }
.scope-write { background: var(--warn-tint); color: var(--warn-ink); }
.scope-admin { background: var(--danger-tint); color: var(--danger-ink); }
.count { display: inline-grid; place-items: center; min-width: 20px; height: 18px; padding: 0 6px; border-radius: var(--radius-pill); background: var(--tint-2); font-size: var(--text-xs); font-weight: 600; color: var(--fg); font-variant-numeric: tabular-nums; }
.kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: var(--radius-sm); padding: 0 5px; color: var(--fg-2); background: var(--surface); line-height: 16px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; flex: none; }
.grip { color: var(--muted); font-size: var(--text-xs); letter-spacing: -2px; user-select: none; }

/* ---------- text ---------- */
.muted { color: var(--muted); }
.link { color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; font: inherit; text-decoration: none; }
.link:hover { color: var(--accent-hover); text-decoration: underline; }
.mono { font-family: var(--font-mono); font-size: var(--text-xs); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tabular { font-variant-numeric: tabular-nums; }
.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; }

/* ---------- click feedback: ink ripple (js/ripple.js) and press states ---------- */
/* ripple.js appends a .ripple-wrap (clips the ink to the element's shape) holding one .ripple-ink, and removes both
   when the animation ends. Static elements get .ripple-host so the wrap can sit on top of them. */
.ripple-host { position: relative; }
.ripple-wrap {
    position: absolute; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
    border-radius: inherit; contain: strict;
}
.ripple-ink {
    position: absolute; pointer-events: none; border-radius: 50%;
    width: var(--ripple-size); height: var(--ripple-size); left: var(--ripple-x); top: var(--ripple-y);
    background: var(--ripple-ink); opacity: var(--ripple-opacity); transform: translate(-50%, -50%) scale(0);
    animation: ripple-ink 450ms cubic-bezier(0.2, 0, 0, 1) forwards;
}
/* On filled (primary, danger) buttons the text is white, so the ink is a soft white wash. */
.btn-primary > .ripple-wrap > .ripple-ink, .btn-danger > .ripple-wrap > .ripple-ink,
.btn.primary > .ripple-wrap > .ripple-ink, .btn.danger:not(.subtle) > .ripple-wrap > .ripple-ink { background: var(--ripple-ink-on-fill); --ripple-opacity: 0.32; }
/* Large surfaces (cards, rows) get a lighter wash. */
[data-issue-id] > .ripple-wrap > .ripple-ink { --ripple-opacity: 0.10; }
@keyframes ripple-ink {
    0% { transform: translate(-50%, -50%) scale(0); opacity: var(--ripple-opacity); }
    55% { transform: translate(-50%, -50%) scale(1); opacity: var(--ripple-opacity); }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 0; }
}
/* Press states: buttons nudge down, cards and rows sink slightly. */
.btn:not(:disabled):active, .icon-btn:not(:disabled):active { transform: translateY(0.5px); }
@media (prefers-reduced-motion: reduce) {
    .ripple-wrap { display: none; }
    .btn:not(:disabled):active, .icon-btn:not(:disabled):active { transform: none; }
}

/* Blazor's reconnect and error UI */
#blazor-error-ui { display: none; position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 1000; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--elev-raised); padding: 12px 16px; }
#blazor-error-ui .dismiss { cursor: pointer; margin-left: 12px; }
