:root {
    /* Layout */
    --gh-header-height: 70px;           /* Site header bar height; sidebar offset below header */
    --gh-sidebar-width: 260px;          /* Primary navigation column width */
    --gh-context-width: 280px;          /* Right context / inspector column width */
    --gh-header-font-size: 14px;        /* Card/TableCard shell title (h3) font size */
    --gh-header-font-weight: 500;       /* Card/TableCard shell title font weight */
    --border-radius: 6px;             /* Default corner radius (buttons, cards, inputs) */
    --border-radius-lg: 8px;           /* Larger radius where extra rounding is needed */

    /* Typography */
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; /* App UI font stack (GitHub-like) */
    --font-size-label: 12px;            /* Standard label font size */
    --font-weight-label: 600;           /* Standard label font weight */
    --line-height-label: 16px;          /* Standard label line height */

    /* Core neutrals (Primer-aligned) */
    --white: #ffffff;                   /* Page and card surface background */
    --gh-text: #1f2328;                 /* Primary body and heading text */
    --gh-text-secondary: #656d76;       /* Muted labels, icons, secondary chrome */
    --bg: var(--white);                 /* Page background (alias of --white) */

    /* Gray surfaces (--gray-hover removed: identical to --gray-base) */
    --gray-base: #f3f4f6;               /* Toolbar/header strips, button idle fill */
    --gray-active: #eaebef;             /* Subtle active/hover surface (lists, rows) */
    --gray-border: #d0d7de;             /* Default 1px borders (cards, inputs, toggles) */
    --gray-active-dark: #afb8c1;        /* Stronger border on hover (segmented controls) */
    --gray-selected: #eaeef2;           /* Pressed/selected segment in toggle groups */
    --surface-inset: #fafbfc;           /* Inset panels and subtle recessed areas */

    /* Accent / focus (--input-border-focus removed: identical to --blue-accent) */
    --blue-accent: #0969da;             /* Links, focus rings, primary accent actions */

    /* Semantic: success */
    --success-fg: #1a7f37;              /* Success text and icon color */
    --success-bg: #dafbe1;              /* Success button/pill background (idle) */
    --success-bg-hover: #cceecc;        /* Success button background on hover */
    --success-border: #b1e5c0;          /* Success control border (idle) */
    --success-border-hover: #8cd19d;    /* Success control border on hover */
    --success-emphasis: #2da44e;        /* Strong success accent (active save, rings) */

    /* Semantic: danger (warning + error icons) */
    --danger-fg: #cf222e;               /* Error, delete, and destructive icon color */
    --danger-fg-hover: #a51d24;         /* Destructive text/icon on hover */

    /* Semantic: blocked link (dependencies found) */
    --blocked-link-fg: #6639ba;         /* Purple: dependency-blocked navigation links */

    /* Semantic: cancel (salmon neutral actions) */
    --cancel-bg: #ffebe9;               /* Cancel button background (idle) */
    --cancel-bg-hover: #ffd8d5;         /* Cancel button background on hover */
    --cancel-border: #ffd0cc;           /* Cancel button border (idle) */
    --cancel-border-hover: #f7a8a2;    /* Cancel button border on hover */

    /* Shared overlays & borders */
    --overlay-muted: rgba(175, 184, 193, 0.2);   /* Light wash over surfaces (dividers, hovers) */
    --border-subtle: rgba(27, 31, 36, 0.15);     /* Low-contrast separators and hairlines */
    --overlay-scrim: rgba(0, 0, 0, 0.02);        /* Placeholder/empty-state tint inside cards */

    /* Shadows & focus rings */
    --focus-ring-blue: 0 0 0 3px rgba(9, 105, 218, 0.3);           /* Keyboard focus on default controls */
    --focus-ring-success: 0 0 0 3px rgba(45, 164, 78, 0.3);        /* Keyboard focus on success controls */
    --focus-ring-danger: 0 0 0 3px rgba(207, 34, 46, 0.3);       /* Keyboard focus on destructive controls */
    --shadow-inset-pressed: inset 0 2px 4px rgba(27, 31, 35, 0.15); /* Inset shadow for pressed toggle segments */
    --shadow-dropdown: 0 8px 24px rgba(140, 149, 159, 0.2);        /* Floating menus and dropdown panels */
    --shadow-panel: 0 4px 12px rgba(140, 149, 159, 0.12);          /* Elevated side panels and overlays */
    --shadow-card: 0 1px 3px rgba(31, 35, 40, 0.04);               /* Default card shell elevation */
    --shadow-card-elevated: 0 1px 3px rgba(31, 35, 40, 0.06);    /* Slightly stronger card elevation */
    --inset-input-highlight: inset 0 1px 0 rgba(208, 215, 222, 0.2); /* Top inner highlight on inset fields */
    --shadow-button-secondary: 0 1px 0 rgba(27, 31, 36, 0.04), inset 0 1px 0 rgba(255, 255, 255, 0.25); /* Secondary button depth */
    --shadow-button-primary: 0 1px 0 rgba(27, 31, 36, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.03);   /* Primary button depth */

    /* Card / TableCard shell — layout rules in Card.razor.css and TableCard.razor.css */
    --card-header-height: 56px;
    --card-header-padding: 10px 16px;
    --card-body-padding: 12px 14px;
    --card-toolbar-gap: 8px;

    /* TableCard column header row (card grid + line list) */
    --tablecard-header-border-width: 2px;
    --tablecard-card-header-border-color: color-mix(in srgb, var(--gray-active-dark) 70%, black);
    --tablecard-list-header-border-color: color-mix(in srgb, var(--gray-active-dark) 40%, black);
    --color-canvas-default: var(--white);
    --surface-subtle: #f6f8fa;
    --info-bg: #ddf4ff;
    --info-border: rgba(84, 174, 255, 0.4);
    --warning-bg: #fff8c5;
    --warning-border: rgba(212, 167, 44, 0.4);
    --success-emphasis-hover: #2c974b;
}

/* Application canvas behind routed content */
*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    font-family: var(--font-stack);
    font-size: 14px;
    line-height: 1.5;
    color: var(--gh-text);
    background-color: var(--bg);
}

h1, h2, h3, h4, h5, h6 {
    margin-top: 0;
    margin-bottom: 0;
    font-weight: 600;
}

h1 { font-size: 32px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 16px; }
h5 { font-size: 14px; }
h6 { font-size: 12px; }

p {
    margin-top: 0;
    margin-bottom: 10px;
}

button,
input,
select,
textarea {
    margin: 0;
    font-family: inherit;
    font-size: 12px;
    line-height: inherit;
}

::placeholder {
    font-size: 12px;
    color: var(--gh-text-secondary);
    opacity: 1;
}

a {
    color: var(--blue-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.btn {
    position: relative;
    display: inline-block;
    padding: 5px 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    color: var(--gh-text);
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    appearance: none;
    background-color: var(--surface-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-button-secondary);
}

.btn:hover {
    text-decoration: none;
    background-color: var(--gray-base);
}

.btn:active {
    background-color: var(--gray-active);
    box-shadow: var(--shadow-inset-pressed);
}

.btn-primary {
    color: var(--white);
    background-color: var(--success-emphasis);
    box-shadow: var(--shadow-button-primary);
}

.btn-primary:hover,
.btn-primary:active {
    background-color: var(--success-emphasis-hover);
}

.btn-danger {
    color: var(--danger-fg);
}

.btn-danger:hover,
.btn-danger:active {
    color: var(--white);
    background-color: var(--danger-fg);
}

.btn-outline {
    color: var(--blue-accent);
}

.btn-outline:hover,
.btn-outline:active {
    color: var(--white);
    background-color: var(--blue-accent);
}

.btn:focus-visible {
    outline: 2px solid var(--blue-accent);
    outline-offset: 2px;
}

.btn:disabled,
.btn[aria-disabled="true"] {
    cursor: default;
    opacity: 0.6;
    pointer-events: none;
    box-shadow: none;
}

.btn-block {
    display: block;
    width: 100%;
}

.flash {
    position: relative;
    padding: 20px 16px;
    color: var(--gh-text);
    background-color: var(--info-bg);
    border: 1px solid var(--info-border);
    border-radius: var(--border-radius);
}

.flash-warn {
    background-color: var(--warning-bg);
    border-color: var(--warning-border);
}

.flash-error {
    background-color: var(--cancel-bg);
    border-color: var(--cancel-border);
}

.flash-success {
    background-color: var(--success-bg);
    border-color: var(--success-border);
}

.flash p:last-child {
    margin-bottom: 0;
}

.Box {
    background-color: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--border-radius);
}

.Box-header {
    padding: 16px;
    background-color: var(--surface-subtle);
    border-bottom: 1px solid var(--gray-border);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.Box-title {
    font-size: 14px;
    font-weight: 600;
}

.Box-body {
    padding: 16px;
    border-bottom: 1px solid var(--gray-border);
}

.Box-body:last-child {
    border-bottom: 0;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.Box-footer {
    padding: 16px;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.form-control,
.form-select {
    min-height: 32px;
    padding: 5px 12px;
    font-size: 14px;
    line-height: 20px;
    color: var(--gh-text);
    vertical-align: middle;
    background-color: var(--white);
    border: 1px solid var(--gray-border);
    border-radius: var(--border-radius);
    box-shadow: var(--inset-input-highlight);
}

.form-select {
    padding-right: 24px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--blue-accent);
    outline: none;
    box-shadow: var(--focus-ring-blue);
}

.form-control:disabled,
.form-select:disabled {
    color: var(--gh-text-secondary);
    background-color: var(--overlay-muted);
    cursor: not-allowed;
}

.form-control[readonly] {
    background-color: var(--surface-subtle);
}

.input-block {
    display: block;
    width: 100%;
}

.form-group {
    margin: 15px 0;
}

.form-group-header {
    margin: 0 0 6px;
}

.form-group-header label {
    font-weight: 600;
}

.form-group-body .form-control {
    width: 440px;
    max-width: 100%;
}

.form-group-body .input-block {
    width: 100%;
}

.form-checkbox {
    padding-left: 20px;
    margin: 15px 0;
}

.form-checkbox input[type="checkbox"] {
    float: left;
    margin: 5px 0 0 -20px;
}

.form-actions {
    text-align: right;
}

.note {
    margin: 4px 0 2px;
    font-size: 12px;
    color: var(--gh-text-secondary);
}

.container-md {
    max-width: 768px;
    margin-right: auto;
    margin-left: auto;
}

.Subhead {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--gray-border);
}

.Subhead-heading {
    flex: 1 1 auto;
    font-size: 24px;
    font-weight: 400;
}

.Subhead-description {
    flex: 1 1 100%;
    font-size: 14px;
    color: var(--gh-text-secondary);
}

.blankslate {
    padding: 32px;
    text-align: center;
}

.State {
    display: inline-block;
    padding: 5px 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 20px;
    text-align: center;
    white-space: nowrap;
    border-radius: 2em;
}

.State--success {
    color: var(--white);
    background-color: var(--success-emphasis);
}

.AnimatedEllipsis::after {
    display: inline-block;
    width: 1em;
    overflow: hidden;
    vertical-align: bottom;
    content: "...";
    animation: primer-ellipsis 1.2s steps(4, end) infinite;
}

@keyframes primer-ellipsis {
    from { width: 0; }
    to { width: 1em; }
}

@media (prefers-reduced-motion: reduce) {
    .AnimatedEllipsis::after {
        animation: none;
    }
}

.mr-2 { margin-right: 8px; }
.d-flex { display: flex; }
.d-block { display: block; }
.flex-column { flex-direction: column; }
.flex-items-center { align-items: center; }
.flex-justify-center { justify-content: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.p-4 { padding: 24px; }
.pt-6 { padding-top: 40px; }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-small { font-size: 12px; }
.text-muted { color: var(--gh-text-secondary); }
.text-danger { color: var(--danger-fg); }
.color-fg-success { color: var(--success-fg); }
.color-shadow-large { box-shadow: var(--shadow-dropdown); }

/* Local octicons: bind path fill to CSS color */
.octicon,
.icon-visual {
    fill: currentColor;
}

/* Primer-style tooltipped chrome controls */
.tooltipped {
    position: relative;
}

.tooltipped::after {
    position: absolute;
    z-index: 1000000;
    display: none;
    width: max-content;
    max-width: 250px;
    padding: 6px 10px !important;
    color: var(--white);
    background: var(--gh-text);
    border-radius: var(--border-radius);
    font-family: var(--font-stack);
    font-size: 13px !important;
    font-weight: 400;
    line-height: 1.5;
    text-align: center;
    white-space: pre-line;
    overflow-wrap: break-word;
    pointer-events: none;
    content: attr(aria-label);
}

.tooltipped:hover::after,
.tooltipped:focus-visible::after {
    display: block;
}

.tooltipped-s::after,
.tooltipped-se::after,
.tooltipped-sw::after {
    top: calc(100% + 6px);
}

.tooltipped-n::after,
.tooltipped-ne::after,
.tooltipped-nw::after {
    bottom: calc(100% + 6px);
}

.tooltipped-s::after,
.tooltipped-n::after {
    left: 50%;
    transform: translateX(-50%);
}

.tooltipped-se::after,
.tooltipped-ne::after {
    left: 0;
}

.tooltipped-sw::after,
.tooltipped-nw::after {
    right: 0;
}

.tooltipped-e::after,
.tooltipped-w::after {
    top: 50%;
    transform: translateY(-50%);
}

.tooltipped-e::after {
    left: calc(100% + 6px);
}

.tooltipped-w::after {
    right: calc(100% + 6px);
}

.tooltipped--dismissed::before,
.tooltipped--dismissed::after {
    display: none !important;
    animation: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.tooltipped:focus:not(:hover):not(:focus-visible)::before,
.tooltipped:focus:not(:hover):not(:focus-visible)::after {
    display: none !important;
    animation: none !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Base keycap styling for kbd elements */
kbd {
    display: inline-block;
    padding: 2px 4px;
    font-family: ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 11px;
    line-height: normal;
    color: var(--gh-text);
    background-color: var(--gray-base);
    border: 1px solid var(--gray-border);
    border-bottom-color: var(--gray-active-dark);
    border-radius: 4px;
    box-shadow: inset 0 -1px 0 var(--gray-active-dark);
}
