:root {
    --app-bg: #f0f2f5;
    --app-surface: #ffffff;
    --app-border: #e2e6eb;
    --app-text: #1a1d21;
    --app-muted: #6c757d;
    --app-accent: #0d6efd;
    --app-sidebar-width: 280px;
    --recent-bg: #eef3f9;
}

body {
    background: var(--app-bg);
    color: var(--app-text);
    min-height: 100vh;
}

body.login-locked #app-shell {
    display: none !important;
}

#app-shell.d-none {
    display: none !important;
}

.app-header {
    background: var(--app-surface);
    border-bottom: 1px solid var(--app-border);
    position: sticky;
    top: 0;
    z-index: 1020;
}

.app-header .brand {
    font-weight: 700;
    letter-spacing: -0.02em;
    font-size: 1.15rem;
}

.queue-chip {
    cursor: pointer;
    user-select: none;
    border: 1px solid var(--app-border);
    background: #f8f9fa;
}

.queue-chip:hover,
.queue-chip.active {
    border-color: var(--app-accent);
    background: #e7f1ff;
}

.recent-strip {
    background: var(--recent-bg);
    border-bottom: 1px solid var(--app-border);
    padding: 0.75rem 0;
    --color: #E1E1E1;
    background-color: #F3F3F3;
    background-image: linear-gradient(0deg, transparent 24%, var(--color) 25%, var(--color) 26%, transparent 27%, transparent 74%, var(--color) 75%, var(--color) 76%, transparent 77%, transparent), linear-gradient(90deg, transparent 24%, var(--color) 25%, var(--color) 26%, transparent 27%, transparent 74%, var(--color) 75%, var(--color) 76%, transparent 77%, transparent);
    background-size: 55px 55px;
}

.recent-strip .recent-scroll {
    display: flex;
    gap: 0.65rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    scrollbar-width: thin;
}

.recent-card {
    flex: 0 0 auto;
    width: 240px;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    padding: 0.65rem 0.75rem;
    cursor: pointer;
    text-align: left;
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.recent-card:hover {
    border-color: var(--app-accent);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.12);
}

.recent-card .title {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.repo-sidebar {
    position: sticky;
    top: 4.5rem;
    max-height: calc(100vh - 5.5rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
}

.repo-sidebar .nav-link {
    color: #495057;
    border-radius: 0.375rem;
    padding: 0.4rem 0.75rem;
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.repo-sidebar .nav-link:hover,
.repo-sidebar .nav-link.active {
    background-color: #e9ecef;
    color: #212529;
}

.repo-section {
    scroll-margin-top: 5rem;
    border-radius: 5px;
    overflow: hidden;
}

.table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8f9fa;
}

tr.mr-highlight {
    animation: highlight-fade 2.5s ease;
}

@keyframes highlight-fade {
    0% { background-color: #fff3cd; }
    100% { background-color: transparent; }
}

tr.stale-mr td:first-child a {
    color: #a35c00;
}

.markdown-body {
    font-size: 0.925rem;
    line-height: 1.55;
}

.markdown-body pre {
    background: #f6f8fa;
    padding: 0.75rem;
    border-radius: 0.375rem;
    overflow-x: auto;
}

.markdown-body code {
    background: #f6f8fa;
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}

.markdown-body pre code {
    background: transparent;
    padding: 0;
}

.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.75rem 0;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid var(--app-border);
    padding: 0.4rem 0.6rem;
}

.activity-item {
    font-size: 0.8rem;
    border-bottom: 1px solid var(--app-border);
    padding: 0.5rem 0;
}

.activity-item:last-child {
    border-bottom: 0;
}

.filters-bar {
    background: var(--app-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
}

.status-pill {
    cursor: pointer;
}

.batch-progress {
    font-size: 0.85rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    padding-left: 0.45rem;
    padding-right: 0.45rem;
}

.btn-icon .bi {
    font-size: 1rem;
    line-height: 1;
}

.btn-icon .badge {
    font-size: 0.65rem;
    font-weight: 600;
}

#login-modal .modal-content {
    border: 0;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.login-backdrop-custom {
    background: linear-gradient(145deg, #1e293b 0%, #334155 50%, #475569 100%);
}

.repo-header {
    background: #fff;
    padding: 5px 10px;
}

.repo-memo {
    font-size: 0.8rem;
    font-weight: 400;
    max-width: 28rem;
}

.help-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    font-size: 1rem;
    line-height: 1;
}

.help-tip .help-tip-popover {
    display: none;
    position: absolute;
    right: calc(100% + 0.5rem);
    top: 0;
    /* transform: translateY(-50%); */
    z-index: 1080;
    padding: 0.4rem;
    background: #fff;
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    width: max-content;
    max-width: min(420px, 70vw);
}

.help-tip:hover .help-tip-popover,
.help-tip:focus .help-tip-popover,
.help-tip:focus-within .help-tip-popover {
    display: block;
}

.help-tip .help-tip-popover img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 0.25rem;
}

.status-pill {
    font-size: 0.8rem;
}