:root {
    --bg: #f7f8fb;
    --panel: #ffffff;
    --ink: #172033;
    --muted: #667085;
    --line: #d9e0ea;
    --brand: #d96321;
    --brand-dark: #9a3412;
    --accent: #0f766e;
    --danger: #b42318;
    --radius: 8px;
}

html.dark {
    --bg: #0f1117;
    --panel: #1a1d27;
    --ink: #e2e8f4;
    --muted: #8b9cba;
    --line: #252a3c;
    --brand: #e07840;
    --brand-dark: #f4a261;
    --accent: #14b8a6;
    color-scheme: dark;
}
html.dark .site-header { background: rgba(15, 17, 23, .92); }
html.dark .nav-menu[open] summary { background: #1e2230; }
html.dark .nav-menu-panel { background: var(--panel); box-shadow: 0 18px 40px rgba(0,0,0,.4); }
html.dark .nav-menu-panel a:hover,
html.dark .nav-menu-panel .link-button:hover,
html.dark .nav-menu-panel .active { background: #252a3c; }
html.dark .button.secondary { background: var(--panel); }
html.dark input, html.dark select, html.dark textarea { background: #141720; }
html.dark .asset-link { background: var(--panel); }
html.dark .admin-tile { background: var(--panel); }
html.dark .admin-inline-form { background: var(--panel); }
html.dark .widget-column { background: #141720; }
html.dark .widget-card { background: var(--panel); }
html.dark .drag-handle, html.dark .order-badge { background: #252a3c; }
html.dark .release-summary { background: #141720; }
html.dark .table { background: var(--panel); }
html.dark .ticket-filter-bar { background: var(--panel); }
html.dark .sticky-actions { background: linear-gradient(to top, var(--bg) 70%, transparent); }
html.dark dialog { background: var(--panel); color: var(--ink); }
html.dark .captcha-row img { background: var(--panel); }
html.dark .alert, html.dark .alert-success { background: #0a2218; border-color: #14532d; color: #6ee7b7; }
html.dark .alert-error { background: #2a0808; border-color: #7f1d1d; color: #fca5a5; }
html.dark .alert-warning { background: #2a1a00; border-color: #78350f; color: #fcd34d; }
html.dark .badge { background: #0d2420; }
html.dark .badge-open { color: #93c5fd; background: #0c1a3a; border-color: #1e3a8a; }
html.dark .badge-in-progress { color: #fdba74; background: #2a1500; border-color: #7c2d12; }
html.dark .badge-waiting { color: #d8b4fe; background: #1e0a2e; border-color: #6b21a8; }
html.dark .badge-closed { color: #86efac; background: #0a2010; border-color: #14532d; }
html.dark .badge-priority-high { color: #fca5a5; background: #2a0808; border-color: #7f1d1d; }
html.dark .badge-confidential { color: #c084fc; background: #1e0a2e; border-color: #7c3aed; }
html.dark .notice-info { background: #2a1f00; border-color: #7a5a00; color: #fcd34d; }
html.dark .notice-confidential { background: #1e0a2e; border-color: #7c3aed; color: #c084fc; }
html.dark .notice-cookie-warn { background: #2a0f00; border-color: #c2410c; color: #fb923c; }
html.dark .nav-toggle[aria-expanded="true"] { background: #1e2230; border-color: #252a3c; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    line-height: 1.55;
}

a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, .92);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(14px);
}

.nav {
    max-width: 1180px;
    margin: 0 auto;
    padding: 10px 22px;
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-weight: 800;
}

.brand img { width: 38px; height: 38px; border-radius: var(--radius); }

.nav-links {
    display: flex;
    gap: 16px;
    flex: 1;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
}

.nav-main, .nav-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.nav-main { flex-wrap: wrap; gap: 4px; }
.nav-actions { flex-shrink: 0; gap: 6px; padding-left: 14px; border-left: 1px solid var(--line); }

/* hamburger: hidden on desktop */
.nav-toggle { display: none; }

.nav-toggle-dark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}
.nav-toggle-dark:hover { background: var(--line); }

.nav-links a, .link-button, .nav-menu summary {
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
    border: 0;
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
}

.nav-links a.active, .nav-links a:hover, .link-button.active, .nav-menu summary:hover { color: var(--ink); text-decoration: none; }

/* active underline indicator for main nav links */
.nav-main a {
    position: relative;
    padding: 5px 6px;
}
.nav-main a::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 6px;
    right: 6px;
    height: 2px;
    background: transparent;
    border-radius: 1px;
    transition: background .15s;
}
.nav-main a.active::after { background: var(--brand); }
.nav-main a:hover:not(.active)::after { background: var(--line); }

.nav-menu { position: relative; }
.nav-menu summary {
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 6px 9px;
    border-radius: var(--radius);
}
.nav-menu summary::-webkit-details-marker { display: none; }
.nav-menu[open] summary { background: #eef2f7; color: var(--ink); }
.nav-menu-panel {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 170px;
    z-index: 30;
    display: grid;
    gap: 2px;
    padding: 8px;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 18px 40px rgba(15, 23, 42, .12);
}
.nav-menu-panel-right { left: auto; right: 0; }
.nav-menu-panel a, .nav-menu-panel .link-button {
    display: block;
    width: 100%;
    padding: 8px 10px;
    text-align: left;
    border-radius: 6px;
}
.nav-menu-panel a:hover, .nav-menu-panel .link-button:hover, .nav-menu-panel .active {
    background: #f3f5f8;
    color: var(--ink);
}
.nav-auth {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
}

.shell { max-width: 1180px; margin: 0 auto; padding: 34px 22px 56px; }

.hero {
    min-height: 360px;
    display: grid;
    align-items: center;
    grid-template-columns: minmax(0, 1.1fr) minmax(300px, .9fr);
    gap: 36px;
    padding-bottom: 36px;
    border-bottom: 1px solid var(--line);
}

.hero h1 { font-size: 54px; line-height: 1; margin: 0 0 18px; letter-spacing: 0; }
.hero p { color: var(--muted); max-width: 620px; font-size: 18px; }

.hero-panel {
    background: #111827;
    color: #f8fafc;
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: 0 18px 60px rgba(15, 23, 42, .16);
}

.hero-panel code { color: #fbbf24; word-break: break-all; }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 15px;
    border-radius: var(--radius);
    border: 1px solid var(--brand);
    background: var(--brand);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.button.secondary { color: var(--brand-dark); background: white; }
.button.danger { background: var(--danger); border-color: var(--danger); }
.button:hover { text-decoration: none; filter: brightness(.96); }
.icon-button { gap: 6px; min-width: auto; }

.section-title { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin: 36px 0 18px; }
.section-title h2 { margin: 0; font-size: 28px; }
.section-title p { margin: 0; color: var(--muted); }
.section-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
    align-items: start;
}
.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
}

.card.featured { border-color: rgba(217, 99, 33, .45); box-shadow: inset 0 3px 0 var(--brand); }
.project-card {
    min-height: 310px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.project-card-compact { min-height: 250px; }
.project-card-head {
    display: grid;
    gap: 18px;
}
.project-card h3 {
    min-height: 58px;
    display: flex;
    align-items: flex-end;
    margin: 0;
    font-size: 20px;
    line-height: 1.25;
}
.project-card-summary {
    min-height: 104px;
    margin: 0;
    color: var(--ink);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
}
.project-card-compact .project-card-summary {
    min-height: 76px;
    -webkit-line-clamp: 3;
}
.project-card-details {
    border-top: 1px solid var(--line);
    padding-top: 8px;
}
.project-card-details summary {
    color: var(--brand-dark);
    cursor: pointer;
    font-weight: 700;
}
.project-card-details p {
    margin: 8px 0;
    color: var(--muted);
}
.project-card-actions {
    margin-top: auto;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.project-card-actions .button {
    min-width: 106px;
}
.meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.badge { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px; font-size: 12px; color: var(--accent); background: #eefdfb; }
.release-summary {
    display: grid;
    gap: 8px;
    margin: 12px 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #f8fafc;
}
.release-summary strong { font-size: 13px; }
.release-list {
    display: grid;
    gap: 10px;
}
.release-group {
    display: grid;
    gap: 6px;
}
.release-heading {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}
.release-heading span {
    color: var(--ink);
    font-weight: 700;
}
.asset-list {
    display: grid;
    gap: 6px;
}
.asset-link {
    display: grid;
    gap: 2px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: white;
    color: var(--ink);
}
.asset-link:hover {
    border-color: rgba(217, 99, 33, .45);
    text-decoration: none;
}
.asset-link span { font-weight: 700; }
.asset-link small {
    color: var(--muted);
    overflow-wrap: anywhere;
}
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.admin-tile {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 12px;
    padding: 18px;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--ink);
}
.admin-tile:hover { text-decoration: none; border-color: rgba(217, 99, 33, .45); box-shadow: 0 14px 36px rgba(15, 23, 42, .08); }
.admin-tile-icon {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: #111827;
    color: #f97316;
    font-weight: 800;
}
.admin-tile small { color: var(--muted); }
.mini-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}
.mini-row:last-child { border-bottom: 0; }
.mini-row span { color: var(--muted); font-size: 13px; }
.admin-inline-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
    gap: 12px;
    align-items: end;
    margin: 0 0 18px;
    padding: 14px;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.admin-inline-form p {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}
.widget-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(240px, 1fr));
    gap: 14px;
    align-items: start;
    overflow-x: auto;
    padding-bottom: 10px;
}
.widget-column {
    min-width: 240px;
    background: #eef2f7;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px;
}
.widget-column-header {
    min-height: 76px;
    padding: 6px 6px 12px;
}
.widget-column-header h2 { margin: 0 0 4px; font-size: 17px; }
.widget-column-header small { color: var(--muted); }
.widget-dropzone {
    min-height: 220px;
    display: grid;
    gap: 10px;
    align-items: start;
}
.widget-card {
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px;
    cursor: grab;
}
.widget-card.dragging { opacity: .55; cursor: grabbing; }
.widget-card p { margin: 10px 0; color: var(--muted); font-size: 14px; }
.widget-card-top {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: start;
}
.widget-card-top strong, .widget-card-top small { display: block; overflow-wrap: anywhere; }
.widget-card-top small { color: var(--muted); font-size: 12px; }
.drag-handle, .order-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
    border-radius: 6px;
    background: #f3f5f8;
    color: var(--muted);
    font-weight: 800;
}
.widget-card-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.widget-card-settings {
    margin-top: 10px;
    border-top: 1px solid var(--line);
    padding-top: 8px;
}
.widget-card-settings summary {
    color: var(--brand-dark);
    cursor: pointer;
    font-weight: 700;
}
.inline-check {
    display: inline-flex;
    gap: 8px;
    align-items: center;
}
.inline-check input { width: auto; }
.sticky-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    padding: 12px 0 0;
    background: linear-gradient(to top, var(--bg) 70%, rgba(247, 248, 251, 0));
}

.forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; align-items: start; }
label { display: block; font-weight: 700; font-size: 13px; margin: 12px 0 6px; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 11px;
    background: white;
    color: var(--ink);
}
textarea { min-height: 110px; resize: vertical; }

.alert, .alert-success { border: 1px solid #a7f3d0; background: #ecfdf5; color: #065f46; padding: 12px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-error   { border: 1px solid #fca5a5; background: #fef2f2; color: #991b1b; padding: 12px; border-radius: var(--radius); margin-bottom: 16px; }
.alert-warning { border: 1px solid #fde68a; background: #fffbeb; color: #92400e; padding: 12px; border-radius: var(--radius); margin-bottom: 16px; }
.error { color: var(--danger); font-size: 13px; }
.table { width: 100%; border-collapse: collapse; background: white; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.table th, .table td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table-wrap { overflow-x: auto; }
.compact-title { margin: 0 0 12px; align-items: center; }
.github-source-card { margin-bottom: 18px; }
.github-account { margin-bottom: 28px; }
.url-line {
    display: grid;
    gap: 2px;
    margin: 0 0 10px;
}
.url-line a {
    overflow-wrap: anywhere;
}
.url-line small {
    color: var(--muted);
}

.footer { border-top: 1px solid var(--line); color: var(--muted); padding: 26px 22px; text-align: center; }
.language-form { display: inline; }
.captcha-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 6px 0 10px; }
.captcha-row img { border: 1px solid var(--line); border-radius: var(--radius); background: white; }

.badge-open { color: #1e40af; background: #dbeafe; border-color: #93c5fd; }
.badge-in-progress { color: #92400e; background: #ffedd5; border-color: #fdba74; }
.badge-waiting { color: #6b21a8; background: #f3e8ff; border-color: #d8b4fe; }
.badge-closed { color: #166534; background: #dcfce7; border-color: #86efac; }
.badge-priority-low { color: var(--muted); background: var(--bg); border-color: var(--line); }
.badge-priority-high { color: #b42318; background: #fef2f2; border-color: #fca5a5; }

.ticket-filter-bar {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 14px;
    background: white;
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.ticket-filter-bar select,
.ticket-filter-bar input[type="text"] { width: auto; flex: 1; min-width: 130px; }

.status-group-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--line);
}
.status-group-header:first-of-type { margin-top: 0; }
.status-group-count { color: var(--muted); font-size: 13px; font-weight: 600; }
.tickets-section-label { font-size: 18px; font-weight: 700; color: var(--ink); margin: 32px 0 10px; padding-bottom: 10px; border-bottom: 2px solid var(--brand); }

.notice-info {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--radius);
    padding: 10px 13px;
    color: #92400e;
    font-size: 13px;
    margin: 0 0 14px;
}

dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 480px;
    width: calc(100% - 32px);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0;
    box-shadow: 0 18px 60px rgba(15, 23, 42, .18);
    margin: 0;
}

dialog::backdrop {
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(4px);
}

.dialog-inner { padding: 24px; }
.dialog-inner h2 { margin: 0 0 14px; color: var(--danger); font-size: 18px; }
.dialog-inner ul { margin: 0 0 20px; padding-left: 20px; display: grid; gap: 6px; }
.dialog-inner li { color: var(--ink); }

/* ── Avatars ──────────────────────────────────────────────────────────────── */
.avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--brand);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
    overflow: hidden;
    vertical-align: middle;
    text-decoration: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 72px; height: 72px; font-size: 26px; }

/* ── Login animation overlay (shown on first page load after login) ───────── */
@keyframes loginOverlayOut {
    0%, 55% { opacity: 1; }
    100%     { opacity: 0; pointer-events: none; }
}
@keyframes loginLogoIn {
    from { opacity: 0; transform: scale(0.7) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}
.login-anim {
    position: fixed; inset: 0; z-index: 9999;
    background: var(--panel);
    display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px;
    animation: loginOverlayOut 1.8s ease forwards;
}
.login-anim img { width: 72px; height: 72px; animation: loginLogoIn 0.45s cubic-bezier(.17,.67,.34,1.3) forwards; }
.login-anim strong { font-size: 22px; font-weight: 800; animation: loginLogoIn 0.45s cubic-bezier(.17,.67,.34,1.3) 0.1s both; }

/* ── Login page logo animation ────────────────────────────────────────────── */
@keyframes loginPageIn {
    from { opacity: 0; transform: translateY(-14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.login-logo {
    text-align: center; margin-bottom: 1.5rem;
    animation: loginPageIn 0.5s ease forwards;
}
.login-logo img { width: 60px; height: 60px; }
.login-logo span { display: block; font-weight: 800; font-size: 20px; margin-top: 6px; color: var(--ink); }

.notice-confidential {
    background: #fdf4ff;
    border: 1.5px solid #c084fc;
    border-radius: var(--radius);
    padding: 12px 14px;
    color: #6b21a8;
    font-size: 13px;
    margin: 0 0 14px;
}
.notice-cookie-warn {
    background: #fff7ed;
    border: 2px solid #ea580c;
    border-radius: var(--radius);
    padding: 12px 14px;
    color: #9a3412;
    font-size: 13px;
    margin: 0 0 14px;
}
.badge-confidential { color: #6b21a8; background: #fdf4ff; border-color: #c084fc; }

@media (max-width: 760px) {
    /* --- hamburger toggle button --- */
    .nav { flex-wrap: wrap; align-items: center; }
    .nav-toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        margin-left: auto;
        padding: 7px 11px;
        background: none;
        border: 1px solid var(--line);
        border-radius: var(--radius);
        font-size: 19px;
        line-height: 1;
        cursor: pointer;
        color: var(--ink);
        transition: background .15s, border-color .15s;
    }
    .nav-toggle[aria-expanded="true"] { background: #eef2f7; border-color: #c8d3e0; }

    /* --- collapsible nav panel --- */
    #nav-links {
        display: none;
        flex-direction: column;
        width: 100%;
        padding: 4px 0 12px;
        border-top: 1px solid var(--line);
        margin-top: 8px;
        gap: 0;
        animation: nav-open .18s ease;
    }
    #nav-links.open { display: flex; }
    @keyframes nav-open {
        from { opacity: 0; transform: translateY(-6px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* --- stacked main links --- */
    .nav-main {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        width: 100%;
    }
    .nav-main a {
        padding: 12px 8px;
        border-bottom: 1px solid var(--line);
        font-size: 15px;
    }
    .nav-main a:last-child { border-bottom: none; }
    .nav-main a::after { display: none; }
    .nav-main a.active { color: var(--brand); font-weight: 700; }

    /* --- actions row --- */
    .nav-actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        width: 100%;
        border-left: none;
        border-top: 1px solid var(--line);
        padding: 10px 0 0;
        margin-top: 6px;
        gap: 6px;
    }

    /* --- dropdowns become inline static on mobile --- */
    .nav-menu-panel, .nav-menu-panel-right {
        position: static;
        box-shadow: none;
        border: none;
        background: var(--bg);
        padding: 4px 0 4px 14px;
        min-width: 0;
    }

    .hero { grid-template-columns: 1fr; min-height: auto; }
    .hero h1 { font-size: 38px; }
    .admin-inline-form { grid-template-columns: 1fr; }
    .widget-board { grid-template-columns: repeat(4, 82vw); }
}

@media (max-width: 760px) {
    html.dark .nav-menu-panel,
    html.dark .nav-menu-panel-right { background: var(--bg); }
}
