/* Design tokens. The MudBlazor palette in Components/HelmTheme.cs carries the same values; change both together. */
:root {
    --helm-bg: #171b21;
    --helm-rail: #1b2027;
    --helm-panel: #222831;
    --helm-raised: #2a313b;
    --helm-raised-hover: #313945;
    --helm-line: #2c333d;
    --helm-line-strong: #38414c;
    --helm-text: #e6eaf0;
    --helm-muted: #8e98a6;
    --helm-faint: #5d6773;
    --helm-accent: #3ccf72;
    --helm-accent-soft: rgba(60, 207, 114, 0.14);
    --helm-blue: #3d8bfd;
    --helm-amber: #e9b44c;
    --helm-red: #f0625d;
    --helm-purple: #a48bff;
    --helm-radius: 6px;
    --helm-mono: "Cascadia Mono", "JetBrains Mono", Consolas, "Courier New", monospace;
}

html, body {
    background: var(--helm-bg);
    color: var(--helm-text);
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--helm-blue);
}

::selection {
    background: rgba(61, 139, 253, 0.35);
}

* {
    scrollbar-width: thin;
    scrollbar-color: var(--helm-line-strong) transparent;
}

.helm-muted { color: var(--helm-muted); }
.helm-strong { font-weight: 600; }
.helm-small { font-size: 0.75rem; }
.helm-mono { font-family: var(--helm-mono); font-size: 12px; }
.helm-hidden { display: none !important; }
.helm-spacer { flex: 1; }

.helm-center-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 50vh;
    gap: 4px;
    text-align: center;
}

.helm-flash { animation: helm-flash 2s ease-out; }

@keyframes helm-flash {
    from { box-shadow: 0 0 0 3px var(--helm-accent); }
    to { box-shadow: 0 0 0 0 transparent; }
}

/* ---- Shell: icon rail, top bar, page */

.helm-shell {
    display: flex;
    min-height: 100vh;
}

.helm-rail {
    position: fixed;
    inset: 0 auto 0 0;
    width: 76px;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--helm-rail);
    border-right: 1px solid var(--helm-line);
}

.helm-rail-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    background: var(--helm-accent);
    color: #0d1a12;
}

.helm-rail-brand:hover {
    filter: brightness(1.06);
}

.helm-rail {
    overflow-y: auto;
}

.helm-rail-nav {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
}

.helm-rail-divider {
    height: 1px;
    margin: 6px 16px;
    background: var(--helm-line);
}

.helm-rail-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 10px 4px;
    color: var(--helm-muted);
    text-decoration: none;
    font-size: 0.68rem;
    font-weight: 500;
    transition: color 0.12s, background 0.12s;
}

.helm-rail-item .mud-icon-root {
    font-size: 22px;
}

.helm-rail-item:hover {
    color: var(--helm-text);
    background: rgba(255, 255, 255, 0.03);
}

.helm-rail-item.active {
    color: var(--helm-text);
}

.helm-rail-item.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--helm-accent);
}

.helm-rail-item.active .mud-icon-root {
    color: var(--helm-accent);
}

.helm-main {
    flex: 1;
    min-width: 0;
    margin-left: 76px;
    display: flex;
    flex-direction: column;
}

.helm-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 56px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px;
    background: rgba(27, 32, 39, 0.92);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--helm-line);
}

.helm-wordmark {
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.22em;
    white-space: nowrap;
}

.helm-wordmark span {
    font-weight: 500;
    letter-spacing: 0.08em;
    color: var(--helm-muted);
}

.helm-search {
    width: min(380px, 34vw);
    margin-left: 10px;
}

.helm-search-field .mud-input-outlined {
    background: var(--helm-panel);
}

.helm-search-field .mud-input-outlined-border {
    border-color: transparent !important;
}

.helm-online {
    display: flex;
    gap: 4px;
}

.helm-me {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 6px 4px 4px;
    border-radius: 20px;
    cursor: pointer;
    color: var(--helm-text);
}

.helm-me:hover {
    background: var(--helm-panel);
}

.helm-me-name {
    font-weight: 600;
    font-size: 0.82rem;
}

.helm-signout {
    margin: 0;
}

.helm-signout button {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 6px 16px;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.helm-signout button:hover {
    background: var(--mud-palette-action-default-hover);
}

.helm-page {
    padding: 20px 24px 96px;
    width: 100%;
    max-width: 1880px;
    margin: 0 auto;
}

/* ---- Page headers and banners */

.helm-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 16px;
}

.helm-eyebrow {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--helm-accent);
    margin-bottom: 2px;
}

.helm-title {
    margin: 0;
    font-size: 1.45rem;
    font-weight: 650;
    letter-spacing: -0.015em;
    line-height: 1.2;
}

.helm-banner {
    position: relative;
    height: 132px;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 16px;
    background: var(--helm-panel);
}

.helm-banner-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: saturate(0.9);
}

.helm-banner-shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(23, 27, 33, 0.94) 0%, rgba(23, 27, 33, 0.78) 32%, rgba(23, 27, 33, 0.25) 70%, rgba(23, 27, 33, 0.45) 100%),
        linear-gradient(0deg, rgba(23, 27, 33, 0.55) 0%, transparent 55%);
}

.helm-banner-content {
    position: relative;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
}

.helm-banner-subtitle {
    margin-top: 4px;
    font-size: 0.82rem;
    color: #c5ccd6;
}

.helm-banner-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

/* ---- Panels (the flat slate blocks everything sits in) */

.helm-panel {
    background: var(--helm-panel);
    border-radius: 8px;
    overflow: hidden;
}

.helm-panel-header {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--helm-line);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--helm-muted);
}

.helm-panel-note {
    font-size: 0.75rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
    color: var(--helm-faint);
}

.helm-panel-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid var(--helm-line);
    background: rgba(233, 180, 76, 0.06);
}

/* ---- Avatars */

.helm-avatar-wrap {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    vertical-align: middle;
}

.helm-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: #fff;
    font-weight: 600;
    letter-spacing: 0.02em;
    flex-shrink: 0;
    user-select: none;
}

.helm-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.helm-avatar.empty {
    color: var(--helm-faint);
    border: 1px dashed var(--helm-line-strong);
}

.helm-avatar.online {
    box-shadow: 0 0 0 2px var(--helm-rail), 0 0 0 3.5px var(--helm-accent);
}

.helm-avatar-name {
    white-space: nowrap;
}

/* ---- Toolbars and filters */

.helm-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.helm-toolbar .helm-filter-text {
    max-width: 240px;
}

.helm-filter-box {
    width: 190px;
    flex: 0 0 auto;
}

.helm-toolbar .mud-input-outlined, .helm-filter-box .mud-input-outlined {
    background: var(--helm-panel);
}

.helm-assignee-filter {
    display: inline-flex;
    gap: 3px;
    padding: 3px 6px;
    border-radius: 20px;
    background: var(--helm-panel);
}

.helm-assignee-filter button {
    border: 0;
    padding: 0;
    background: none;
    cursor: pointer;
    border-radius: 50%;
    opacity: 0.45;
    transition: opacity 0.12s, transform 0.12s;
}

.helm-assignee-filter button:hover {
    opacity: 0.85;
}

.helm-assignee-filter button.selected {
    opacity: 1;
    transform: translateY(-1px);
}

/* ---- Board */

.helm-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(250px, 1fr));
    gap: 14px;
    align-items: start;
    overflow-x: auto;
}

.helm-column {
    background: var(--helm-panel);
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 330px);
    max-height: calc(100vh - 330px);
}

.helm-column-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 14px 10px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--helm-muted);
}

.helm-column-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.helm-column-dot.Backlog { background: var(--helm-faint); }
.helm-column-dot.InProgress { background: var(--helm-blue); box-shadow: 0 0 8px rgba(61, 139, 253, 0.6); }
.helm-column-dot.Testing { background: var(--helm-amber); box-shadow: 0 0 8px rgba(233, 180, 76, 0.5); }
.helm-column-dot.Completed { background: var(--helm-accent); box-shadow: 0 0 8px rgba(60, 207, 114, 0.5); }

.helm-column-header .helm-count {
    color: var(--helm-faint);
    font-weight: 600;
    letter-spacing: 0;
}

.helm-column-header .helm-points {
    margin-left: auto;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
    color: var(--helm-faint);
}

.helm-zone {
    flex: 1;
    overflow-y: auto;
    padding: 2px 10px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 80px;
    border-radius: 6px;
    transition: background 0.12s;
}

.helm-zone.helm-can-drop {
    background: rgba(60, 207, 114, 0.05);
    outline: 1px dashed rgba(60, 207, 114, 0.45);
    outline-offset: -5px;
}

.helm-zone.helm-no-drop {
    opacity: 0.6;
}

.helm-dragging {
    opacity: 0.4;
}

.helm-column-footer {
    padding: 4px 10px 10px;
}

.helm-quick-create {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.helm-ghost-button {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 8px 10px;
    border: 1px dashed var(--helm-line-strong);
    border-radius: var(--helm-radius);
    background: none;
    color: var(--helm-muted);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.helm-ghost-button:hover {
    color: var(--helm-text);
    border-color: var(--helm-accent);
}

/* ---- Cards */

.helm-card {
    display: block;
    position: relative;
    background: var(--helm-raised);
    border-radius: var(--helm-radius);
    padding: 11px 12px 9px;
    color: var(--helm-text);
    cursor: grab;
    transition: background 0.12s, transform 0.12s, box-shadow 0.12s;
}

.helm-card:hover {
    background: var(--helm-raised-hover);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.helm-card:hover .helm-card-menu {
    opacity: 1;
}

.helm-card-epic-bar {
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
}

.helm-card-title {
    font-size: 0.86rem;
    line-height: 1.4;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding-right: 22px;
}

.helm-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.helm-card-footer {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 10px;
    font-size: 0.73rem;
    color: var(--helm-muted);
}

.helm-card-footer .helm-key {
    font-weight: 600;
    letter-spacing: 0.02em;
}

.helm-card-menu {
    position: absolute;
    top: 4px;
    right: 2px;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.12s;
}

.helm-card-menu:focus-within {
    opacity: 1;
}

.helm-stretched-link {
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: inherit;
}

.helm-stretched-link:focus-visible {
    outline: 2px solid var(--helm-accent);
    outline-offset: -2px;
}

.helm-row-actions {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.helm-card-stat {
    display: inline-flex;
    align-items: center;
    gap: 2px;
}

.helm-card-stat .mud-icon-root {
    font-size: 14px;
}

.helm-overdue {
    color: var(--helm-red);
}

/* ---- Tags, chips and small markers */

.helm-tag {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    border-radius: 4px;
    padding: 0 7px;
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 19px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.helm-tag.label {
    background: rgba(255, 255, 255, 0.06);
    color: #c5ccd6;
}

.helm-tag.epic {
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}

.helm-points-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.07);
    color: var(--helm-text);
    font-size: 0.68rem;
    font-weight: 700;
}

.helm-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.helm-status.Backlog { background: rgba(142, 152, 166, 0.14); color: #b9c1cc; }
.helm-status.InProgress { background: rgba(61, 139, 253, 0.15); color: #6ea8ff; }
.helm-status.Testing { background: rgba(233, 180, 76, 0.15); color: #f0c46c; }
.helm-status.Completed { background: rgba(60, 207, 114, 0.14); color: #5fdb8d; }

.helm-type-icon.Task { color: var(--helm-blue); }
.helm-type-icon.Bug { color: var(--helm-red); }
.helm-type-icon.Story { color: var(--helm-accent); }
.helm-type-icon.Epic { color: var(--helm-purple); }

.helm-priority.Highest { color: var(--helm-red); }
.helm-priority.High { color: #f2905a; }
.helm-priority.Medium { color: var(--helm-amber); }
.helm-priority.Low { color: var(--helm-blue); }
.helm-priority.Lowest { color: #7fb0ff; }

/* ---- Ticket page */

.helm-ticket {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 22px;
    align-items: start;
}

@media (max-width: 1000px) {
    .helm-ticket {
        grid-template-columns: 1fr;
    }
}

.helm-ticket-main {
    background: var(--helm-panel);
    border-radius: 8px;
    padding: 20px 22px 24px;
}

.helm-breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--helm-muted);
    margin-bottom: 10px;
}

.helm-breadcrumbs a {
    color: var(--helm-muted);
    text-decoration: none;
}

.helm-breadcrumbs a:hover {
    color: var(--helm-text);
}

.helm-title-input .mud-input {
    border-bottom: 1px dashed var(--helm-line-strong);
}

.helm-title-input .mud-input:focus-within {
    border-bottom-color: var(--helm-accent);
}

.helm-title-input input {
    font-size: 1.45rem !important;
    font-weight: 650 !important;
    letter-spacing: -0.015em !important;
    line-height: 1.3 !important;
}

.helm-section {
    margin-top: 26px;
}

.helm-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.helm-section-header h2, .helm-section-title {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--helm-muted);
    margin: 0;
}

.helm-description-view {
    border-radius: var(--helm-radius);
    padding: 8px 10px;
    margin: -8px -10px;
    cursor: text;
    min-height: 48px;
    transition: background 0.12s;
}

.helm-description-view:hover {
    background: rgba(255, 255, 255, 0.025);
}

.helm-sidebar {
    position: sticky;
    top: 76px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.helm-fields {
    background: var(--helm-panel);
    border-radius: 8px;
    padding: 6px 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.helm-fields-title {
    padding: 8px 0 6px;
    margin: 0 -16px 4px;
    padding-left: 16px;
    border-bottom: 1px solid var(--helm-line);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--helm-muted);
}

.helm-field-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 34px;
}

.helm-field-row > label, .helm-field-label {
    font-size: 0.76rem;
    font-weight: 500;
    color: var(--helm-muted);
}

.helm-field-row.changed > label::after {
    content: " •";
    color: var(--helm-amber);
}

.helm-fields .mud-input-outlined {
    background: var(--helm-raised);
}

.helm-fields .mud-input-outlined-border {
    border-color: transparent !important;
}

.helm-meta {
    font-size: 0.75rem;
    color: var(--helm-muted);
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 2px 6px;
}

.helm-points-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.helm-points-picker button {
    min-width: 30px;
    height: 26px;
    border-radius: 13px;
    border: 0;
    background: var(--helm-raised);
    color: var(--helm-text);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0 8px;
    transition: background 0.12s;
}

.helm-points-picker button:hover {
    background: var(--helm-raised-hover);
}

.helm-points-picker button.selected {
    background: var(--helm-accent);
    color: #0d1a12;
}

.helm-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.helm-color-swatches button {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    padding: 0;
}

.helm-color-swatches button.selected {
    border-color: #fff;
    box-shadow: 0 0 0 2px var(--helm-panel) inset;
}

.helm-save-bar {
    position: sticky;
    bottom: 16px;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 24px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #2a2a23;
    border: 1px solid rgba(233, 180, 76, 0.5);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

.helm-ticket-list {
    display: flex;
    flex-direction: column;
    border-radius: var(--helm-radius);
    overflow: hidden;
    gap: 2px;
}

.helm-ticket-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: var(--helm-text);
    background: var(--helm-raised);
}

.helm-ticket-row:hover {
    background: var(--helm-raised-hover);
}

.helm-ticket-row .helm-key {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--helm-muted);
    white-space: nowrap;
}

.helm-ticket-row .helm-row-title {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.helm-ticket-row.done .helm-row-title {
    text-decoration: line-through;
    color: var(--helm-muted);
}

/* ---- Attachments */

.helm-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.helm-thumb {
    position: relative;
    width: 150px;
    border-radius: var(--helm-radius);
    overflow: hidden;
    background: var(--helm-raised);
    font-size: 0.74rem;
}

.helm-thumb img, .helm-thumb video, .helm-thumb .helm-file-icon {
    display: block;
    width: 100%;
    height: 96px;
    object-fit: cover;
    background: #12161b;
    cursor: zoom-in;
}

.helm-thumb .helm-file-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--helm-muted);
}

.helm-thumb .helm-thumb-name {
    padding: 5px 8px 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.helm-thumb .helm-thumb-name a {
    color: var(--helm-text);
    text-decoration: none;
}

.helm-thumb .helm-thumb-meta {
    padding: 0 8px 6px;
    color: var(--helm-muted);
}

.helm-thumb .helm-thumb-remove {
    position: absolute;
    top: 3px;
    right: 3px;
    opacity: 0;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 50%;
}

.helm-thumb:hover .helm-thumb-remove {
    opacity: 1;
}

.helm-thumb.add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    background: transparent;
    border: 1px dashed var(--helm-line-strong);
}

.helm-lightbox {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(8, 10, 13, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    cursor: zoom-out;
}

.helm-lightbox img {
    max-width: 94vw;
    max-height: 88vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
}

.helm-lightbox a {
    color: #fff;
    font-size: 0.85rem;
}

/* ---- Markdown, rendered */

.helm-md {
    line-height: 1.65;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.helm-md > :first-child { margin-top: 0; }
.helm-md > :last-child { margin-bottom: 0; }

.helm-md h1, .helm-md h2, .helm-md h3, .helm-md h4 {
    margin: 1.1em 0 0.5em;
    line-height: 1.3;
    font-weight: 650;
    letter-spacing: -0.01em;
}

.helm-md h1 { font-size: 1.4rem; }
.helm-md h2 { font-size: 1.2rem; }
.helm-md h3 { font-size: 1.05rem; }
.helm-md h4 { font-size: 0.95rem; }

.helm-md p, .helm-md ul, .helm-md ol, .helm-md blockquote, .helm-md pre, .helm-md table {
    margin: 0 0 0.8em;
}

.helm-md ul, .helm-md ol {
    padding-left: 1.6em;
}

.helm-md li + li {
    margin-top: 0.15em;
}

.helm-md ul.contains-task-list {
    list-style: none;
    padding-left: 0.3em;
}

.helm-md .task-list-item input {
    margin-right: 0.5em;
    vertical-align: middle;
    accent-color: var(--helm-accent);
}

.helm-md blockquote {
    border-left: 3px solid var(--helm-accent);
    padding: 0.1em 0 0.1em 0.9em;
    color: var(--helm-muted);
}

.helm-md code {
    font-family: var(--helm-mono);
    font-size: 0.84em;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 4px;
    padding: 0.1em 0.38em;
}

.helm-md pre {
    background: #14181d;
    border-radius: var(--helm-radius);
    padding: 12px 14px;
    overflow-x: auto;
}

.helm-md pre code {
    padding: 0;
    background: none;
    font-size: 0.8rem;
}

.helm-md table {
    border-collapse: collapse;
    display: block;
    overflow-x: auto;
}

.helm-md th, .helm-md td {
    border: 1px solid var(--helm-line-strong);
    padding: 6px 11px;
}

.helm-md th {
    background: rgba(255, 255, 255, 0.04);
    font-weight: 600;
}

.helm-md img {
    max-width: 100%;
    max-height: 520px;
    border-radius: var(--helm-radius);
    cursor: zoom-in;
    vertical-align: top;
}

.helm-md video {
    max-width: 100%;
    max-height: 520px;
    height: auto;
    border-radius: var(--helm-radius);
    background: #000;
}

.helm-md hr {
    border: 0;
    border-top: 1px solid var(--helm-line-strong);
    margin: 1.2em 0;
}

.helm-md a.helm-ticket-ref {
    font-weight: 600;
    text-decoration: none;
    color: var(--helm-accent);
    background: var(--helm-accent-soft);
    border-radius: 4px;
    padding: 0 4px;
}

.helm-md-empty {
    color: var(--helm-faint);
    font-style: italic;
}

/* ---- Markdown editor */

.helm-md-editor {
    border: 1px solid var(--helm-line-strong);
    border-radius: var(--helm-radius);
    background: #1c2128;
    overflow: hidden;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.helm-md-editor:focus-within {
    border-color: var(--helm-accent);
    box-shadow: 0 0 0 3px var(--helm-accent-soft);
}

.helm-md-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1px;
    padding: 4px 6px;
    border-bottom: 1px solid var(--helm-line);
    background: var(--helm-raised);
}

.helm-md-toolbar .helm-md-sep {
    width: 1px;
    height: 18px;
    background: var(--helm-line-strong);
    margin: 0 4px;
}

.helm-md-toolbar .helm-md-mode {
    margin-left: auto;
    display: flex;
    gap: 2px;
    padding: 2px;
    border-radius: 6px;
    background: #1c2128;
}

.helm-md-toolbar .helm-md-mode button {
    border: 0;
    background: none;
    color: var(--helm-muted);
    font: inherit;
    font-size: 0.76rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 4px;
    cursor: pointer;
}

.helm-md-toolbar .helm-md-mode button.active {
    background: var(--helm-raised-hover);
    color: var(--helm-text);
}

.helm-md-heading-button {
    font-weight: 700;
    font-size: 0.76rem;
    min-width: 28px;
}

.helm-md-editor textarea {
    display: block;
    width: 100%;
    border: 0;
    outline: none;
    resize: vertical;
    padding: 12px 14px;
    background: transparent;
    color: var(--helm-text);
    font-family: var(--helm-mono);
    font-size: 0.84rem;
    line-height: 1.6;
    max-height: 70vh;
    overflow-y: auto;
    tab-size: 4;
}

.helm-md-editor textarea::placeholder {
    color: var(--helm-faint);
}

.helm-md-editor textarea.helm-drop {
    background: var(--helm-accent-soft);
}

.helm-md-editor .helm-md-preview {
    padding: 12px 14px;
    min-height: 120px;
    max-height: 70vh;
    overflow-y: auto;
}

.helm-md-editor.split .helm-md-panes {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.helm-md-editor.split .helm-md-preview {
    border-left: 1px solid var(--helm-line);
}

.helm-md-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    font-size: 0.7rem;
    color: var(--helm-faint);
    border-top: 1px solid var(--helm-line);
}

/* ---- Comments and history */

.helm-activity-item {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 0;
}

.helm-activity-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px;
    font-size: 0.82rem;
    margin-bottom: 4px;
}

.helm-activity-head .helm-who {
    font-weight: 600;
}

.helm-activity-head .helm-when {
    color: var(--helm-faint);
    font-size: 0.74rem;
}

.helm-via {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 0.66rem;
    font-weight: 700;
    padding: 0 7px;
    border-radius: 9px;
    background: rgba(164, 139, 255, 0.15);
    color: var(--helm-purple);
}

.helm-comment-actions {
    display: flex;
    gap: 2px;
    margin-top: 2px;
}

.helm-comment-actions button {
    border: 0;
    background: none;
    color: var(--helm-faint);
    font: inherit;
    font-size: 0.74rem;
    padding: 2px 4px;
    cursor: pointer;
}

.helm-comment-actions button:hover {
    color: var(--helm-text);
}

.helm-history-line {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr);
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--helm-line);
    font-size: 0.82rem;
}

.helm-history-line:last-child {
    border-bottom: 0;
}

.helm-history-line .helm-who,
.helm-history-line .helm-via {
    margin-right: 4px;
}

.helm-history-value {
    display: inline-block;
    padding: 0 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    font-size: 0.76rem;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: bottom;
}

.helm-history-value.old {
    text-decoration: line-through;
    color: var(--helm-muted);
}

.helm-diff {
    margin-top: 6px;
    border-radius: var(--helm-radius);
    overflow: auto;
    max-height: 420px;
    background: #14181d;
    font-family: var(--helm-mono);
    font-size: 0.75rem;
    line-height: 1.55;
    padding: 4px 0;
}

.helm-diff div {
    padding: 0 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.helm-diff .Added { background: rgba(60, 207, 114, 0.12); }
.helm-diff .Added::before { content: "+ "; color: var(--helm-accent); }
.helm-diff .Removed { background: rgba(240, 98, 93, 0.12); }
.helm-diff .Removed::before { content: "- "; color: var(--helm-red); }
.helm-diff .Same::before { content: "  "; }

/* ---- Epics */

.helm-epic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

.helm-epic-card {
    position: relative;
    display: block;
    border-radius: 8px;
    background: var(--helm-panel);
    padding: 16px 18px 14px;
    color: var(--helm-text);
    text-decoration: none;
    overflow: hidden;
    transition: background 0.12s;
}

.helm-epic-card::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 4px;
    background: var(--epic-color, var(--helm-purple));
}

.helm-epic-card:hover {
    background: #262d37;
}

.helm-progress {
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
    margin: 12px 0 8px;
}

.helm-progress > div {
    height: 100%;
    background: var(--helm-accent);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ---- Monitor */

.helm-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.helm-tile {
    border-radius: 8px;
    padding: 14px 16px;
    background: var(--helm-panel);
}

.helm-tile .helm-tile-label {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--helm-muted);
}

.helm-tile .helm-tile-value {
    font-size: 1.6rem;
    font-weight: 650;
    letter-spacing: -0.02em;
    margin-top: 4px;
}

.helm-tile .helm-tile-note {
    font-size: 0.72rem;
    color: var(--helm-faint);
}

.helm-log {
    border-radius: 8px;
    background: #12161b;
    color: #c9d1d9;
    overflow-y: auto;
    padding: 8px 0;
    font-family: var(--helm-mono);
    font-size: 12px;
    line-height: 1.55;
}

.helm-log-line {
    padding: 0 12px;
    white-space: pre-wrap;
    word-break: break-word;
}

.helm-log-line:hover { background: rgba(255, 255, 255, 0.03); }
.helm-log-time { color: #5d6773; margin-right: 8px; }
.helm-log-level { display: inline-block; width: 34px; font-weight: 700; }
.helm-log-category { color: #7d8794; margin-right: 8px; }
.helm-log-line.Verbose .helm-log-level, .helm-log-line.Debug .helm-log-level { color: #5d6773; }
.helm-log-line.Verbose, .helm-log-line.Debug { color: #7d8794; }
.helm-log-line.Information .helm-log-level { color: var(--helm-accent); }
.helm-log-line.Warning .helm-log-level { color: var(--helm-amber); }
.helm-log-line.Warning { color: #f0d58c; }
.helm-log-line.Error .helm-log-level, .helm-log-line.Fatal .helm-log-level { color: #ff7b72; }
.helm-log-line.Error, .helm-log-line.Fatal { color: #ffb4ae; background: rgba(255, 123, 114, 0.07); }
.helm-log-exception { color: #ffb4ae; opacity: 0.85; padding-left: 20px; }

/* ---- People and permissions */

.helm-perm-table-wrap {
    overflow-x: auto;
}

.helm-perm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.helm-perm-table th {
    padding: 10px 12px;
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--helm-muted);
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--helm-line);
}

.helm-perm-table td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--helm-line);
}

.helm-perm-table tr:last-child td {
    border-bottom: 0;
}

.helm-perm-table .center { text-align: center; }
.helm-perm-table .right { text-align: right; }
.helm-perm-table td.center > * { display: inline-flex; }
.helm-perm-table tr.changed td { background: rgba(233, 180, 76, 0.06); }
.helm-perm-table tr.disabled td { opacity: 0.5; }

/* ---- Sign-in pages (server-rendered, over the game's art) */

.helm-auth {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 32px clamp(24px, 7vw, 120px);
    overflow: hidden;
    background: #0e1014;
}

.helm-auth-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.helm-auth-shade {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(90deg, rgba(14, 16, 20, 0.96) 0%, rgba(14, 16, 20, 0.86) 30%, rgba(14, 16, 20, 0.35) 62%, rgba(14, 16, 20, 0.15) 100%),
        linear-gradient(0deg, rgba(14, 16, 20, 0.6) 0%, transparent 40%);
}

.helm-auth-card {
    position: relative;
    width: min(380px, 100%);
}

.helm-auth-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
    color: var(--helm-text);
    text-decoration: none;
}

.helm-auth-brand .helm-auth-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--helm-accent);
    color: #0d1a12;
}

.helm-auth-brand b {
    display: block;
    font-size: 1.05rem;
    letter-spacing: 0.24em;
}

.helm-auth-brand span {
    display: block;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--helm-muted);
}

.helm-auth-card h1 {
    margin: 0 0 4px;
    font-size: 1.6rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.helm-auth-card label {
    display: block;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--helm-muted);
    margin: 16px 0 6px;
}

.helm-auth-caption {
    position: absolute;
    right: 24px;
    bottom: 20px;
    font-size: 0.68rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: rgba(230, 234, 240, 0.55);
}

.helm-input {
    width: 100%;
    padding: 11px 13px;
    border-radius: var(--helm-radius);
    border: 1px solid var(--helm-line-strong);
    background: rgba(28, 33, 40, 0.9);
    color: var(--helm-text);
    font: inherit;
    font-size: 0.92rem;
    transition: border-color 0.12s, box-shadow 0.12s;
}

.helm-input:focus {
    outline: none;
    border-color: var(--helm-accent);
    box-shadow: 0 0 0 3px var(--helm-accent-soft);
}

.helm-check {
    display: flex !important;
    align-items: center;
    gap: 8px;
    font-weight: 400 !important;
    color: var(--helm-text) !important;
}

.helm-check input {
    accent-color: var(--helm-accent);
}

.helm-primary-button {
    width: 100%;
    margin-top: 22px;
    padding: 11px;
    border: 0;
    border-radius: var(--helm-radius);
    background: var(--helm-accent);
    color: #0d1a12;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: filter 0.12s;
}

.helm-primary-button:hover {
    filter: brightness(1.08);
}

.helm-form-error {
    margin-top: 14px;
    padding: 9px 12px;
    border-radius: var(--helm-radius);
    background: rgba(240, 98, 93, 0.12);
    color: #ff9a95;
    font-size: 0.84rem;
}

.helm-form-note {
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--helm-muted);
}

/* ---- Integrations */

.helm-code-block {
    position: relative;
    background: #14181d;
    border-radius: var(--helm-radius);
    padding: 11px 46px 11px 13px;
    font-family: var(--helm-mono);
    font-size: 0.76rem;
    white-space: pre-wrap;
    word-break: break-all;
}

.helm-code-block .helm-copy {
    position: absolute;
    top: 4px;
    right: 4px;
}

/* ---- MudBlazor adjustments for the flat look */

.mud-dialog {
    background: var(--helm-panel) !important;
    border: 1px solid var(--helm-line);
}

.mud-popover {
    border: 1px solid var(--helm-line);
}

.mud-table.mud-table-outlined {
    border-color: transparent;
}

.mud-tabs-tabbar {
    background: transparent !important;
    border-bottom: 1px solid var(--helm-line);
}

.mud-tab {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.72rem !important;
    font-weight: 700 !important;
    min-height: 42px !important;
}

/* ---- Blazor's own error bar */

#blazor-error-ui {
    background: #5c1f1f;
    color: #fff;
    bottom: 0;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.4);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 4000;
}

#blazor-error-ui a {
    color: #fff;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.helm-warning-text {
    color: var(--helm-amber);
}

/* Every click on Blazor Server waits a network round trip before anything changes, so buttons must answer the press in
   the browser at once. MudBlazor's ripple fades over a second and read as "sticky"; a short press-down replaces it. */
.mud-ripple::after {
    display: none !important;
}

.mud-button-root {
    transition: background-color 80ms ease, box-shadow 80ms ease, transform 60ms ease !important;
}

.mud-button-root:active:not(:disabled) {
    transform: translateY(1px) scale(0.98);
    filter: brightness(0.92);
}
