@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Rajdhani:wght@500;600;700&display=swap');

:root {
    --bg: #0b0f0a;
    --bg-2: #11160f;
    --panel: #151b12;
    --panel-2: #1a2116;
    --line: rgba(174, 191, 110, 0.16);
    --line-2: rgba(174, 191, 110, 0.32);
    --text: #e6e9d8;
    --muted: #9aa18d;
    --dim: #6f7764;
    --accent: #aebf6e;
    --accent-2: #c7d98a;
    --danger: #d07a55;
    --ok: #8fb06a;
    --warn: #d6a93e;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(1200px 700px at 15% -10%, rgba(174, 191, 110, 0.13), transparent 60%),
        radial-gradient(900px 600px at 110% 10%, rgba(120, 145, 90, 0.08), transparent 60%),
        var(--bg);
    color: var(--text);
    font-family: Inter, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.45;
}

body {
    min-height: 100vh;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.muted {
    color: var(--muted);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border: 1px solid var(--line-2);
    border-radius: 11px;
    background:
        linear-gradient(145deg, rgba(174, 191, 110, 0.18), rgba(174, 191, 110, 0.04));
    color: var(--accent-2);
    font-family: Rajdhani, sans-serif;
    font-weight: 700;
    font-size: 16px;
    letter-spacing: 0.04em;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.brand-title {
    font-family: Rajdhani, sans-serif;
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.08em;
}

.brand-title span {
    color: var(--accent);
}

.brand-sub {
    margin-top: 4px;
    color: var(--dim);
    font-family: Rajdhani, sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.18em;
}

.brand.small .brand-mark {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    font-size: 13px;
}

.brand.small .brand-title {
    font-size: 17px;
}

/* ---------- auth ---------- */

.auth {
    position: relative;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    overflow: hidden;
}

.auth-glow {
    position: absolute;
    width: 700px;
    height: 700px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(174, 191, 110, 0.14), transparent 65%);
    filter: blur(10px);
    pointer-events: none;
}

.auth-card {
    position: relative;
    width: 100%;
    max-width: 410px;
    padding: 32px;
    background: linear-gradient(180deg, rgba(21, 27, 18, 0.98), rgba(14, 18, 12, 0.98));
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.auth-card h1 {
    margin: 26px 0 6px;
    font-family: Rajdhani, sans-serif;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.auth-card > .muted {
    margin: 0 0 22px;
    font-size: 12.5px;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.field > span {
    color: var(--muted);
    font-family: Rajdhani, sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 13px;
    color: var(--text);
    background: #0b1009;
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: none;
    transition: border-color 120ms, box-shadow 120ms;
}

.field textarea {
    resize: vertical;
    min-height: 74px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--line-2);
    box-shadow: 0 0 0 3px rgba(174, 191, 110, 0.08);
}

.field input[type="file"] {
    padding: 9px;
    color: var(--muted);
    font-size: 12px;
}

.field input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 10px;
    color: var(--text);
    background: var(--panel-2);
    border: 1px solid var(--line);
    border-radius: 7px;
}

.check {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 4px 0 14px;
    color: var(--muted);
    font-size: 12.5px;
}

.check input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.form-error {
    min-height: 18px;
    margin: 10px 0 0;
    color: var(--danger);
    font-size: 12px;
}

/* ---------- buttons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    background: transparent;
    color: var(--text);
    font-weight: 600;
    font-size: 12.5px;
    transition: transform 80ms, background 120ms, border-color 120ms, opacity 120ms;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.btn.primary {
    color: #10150c;
    background: var(--accent);
    border-color: var(--accent);
}

.btn.primary:hover {
    background: var(--accent-2);
}

.btn.ghost {
    color: var(--muted);
    border-color: var(--line);
    background: rgba(174, 191, 110, 0.04);
}

.btn.ghost:hover {
    color: var(--text);
    border-color: var(--line-2);
}

.btn.danger {
    color: #f0b49c;
    border-color: rgba(208, 122, 85, 0.35);
    background: rgba(208, 122, 85, 0.08);
}

.btn.small {
    min-height: 34px;
    padding: 0 11px;
    font-size: 11.5px;
}

.btn.full {
    width: 100%;
}

.icon-btn {
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 21px;
    line-height: 1;
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

/* ---------- app shell ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    height: 64px;
    padding: 0 24px;
    background: rgba(11, 15, 10, 0.86);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-chip {
    padding: 6px 10px;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 11.5px;
}

.layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: calc(100vh - 64px);
}

.sidebar {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px 14px;
    border-right: 1px solid var(--line);
    background: rgba(13, 17, 11, 0.5);
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    width: 100%;
    padding: 11px 13px;
    color: var(--muted);
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 500;
}

.nav-item:hover {
    color: var(--text);
    background: rgba(174, 191, 110, 0.04);
}

.nav-item.active {
    color: var(--text);
    background: rgba(174, 191, 110, 0.1);
    border-color: var(--line);
}

.nav-icon {
    width: 18px;
    color: var(--accent);
    font-size: 14px;
    text-align: center;
}

.sidebar-note {
    padding: 13px;
    color: var(--dim);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.5;
}

.sidebar-note b {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-weight: 600;
}

.content {
    min-width: 0;
    padding: 30px;
}

.page {
    display: none;
    max-width: 1120px;
    margin: 0 auto;
}

.page.active {
    display: block;
    animation: page-in 180ms ease both;
}

@keyframes page-in {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 22px;
}

.eyebrow {
    color: var(--dim);
    font-family: Rajdhani, sans-serif;
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.18em;
}

.page-head h2 {
    margin: 7px 0 5px;
    font-family: Rajdhani, sans-serif;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.page-head p {
    margin: 0;
    max-width: 620px;
    font-size: 12.5px;
}

/* ---------- lists / cards ---------- */

.list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.row-card {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: linear-gradient(180deg, rgba(24, 31, 20, 0.92), rgba(18, 23, 15, 0.92));
    border: 1px solid var(--line);
    border-radius: 12px;
}

.row-card:hover {
    border-color: var(--line-2);
}

.row-title {
    display: flex;
    align-items: center;
    gap: 9px;
    font-weight: 600;
    font-size: 14px;
}

.row-sub {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
}

.mono {
    font-family: 'Cascadia Mono', Consolas, monospace;
    font-size: 12px;
}

.row-side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge.ok {
    color: var(--ok);
    border-color: rgba(143, 176, 106, 0.3);
    background: rgba(143, 176, 106, 0.08);
}

.badge.off {
    color: var(--dim);
    border-color: var(--line);
}

.badge.warn {
    color: var(--warn);
    border-color: rgba(214, 169, 62, 0.3);
    background: rgba(214, 169, 62, 0.08);
}

.empty {
    padding: 44px 24px;
    color: var(--muted);
    text-align: center;
    border: 1px dashed var(--line);
    border-radius: 12px;
    font-size: 13px;
}

.empty b {
    display: block;
    margin-bottom: 5px;
    color: var(--text);
    font-size: 15px;
}

.mod-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.mod-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 18px;
    background: linear-gradient(180deg, rgba(24, 31, 20, 0.94), rgba(18, 23, 15, 0.94));
    border: 1px solid var(--line);
    border-radius: 12px;
}

.mod-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.mod-name {
    font-family: Rajdhani, sans-serif;
    font-size: 19px;
    font-weight: 600;
    line-height: 1.2;
}

.mod-version {
    color: var(--accent);
    font-size: 11px;
    font-weight: 600;
}

.mod-desc {
    min-height: 36px;
    color: var(--muted);
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.mod-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mod-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 4px;
}

.panel {
    padding: 20px;
    background: rgba(21, 27, 18, 0.75);
    border: 1px solid var(--line);
    border-radius: 12px;
    margin-bottom: 14px;
}

.form-panel h3 {
    margin: 0 0 16px;
    font-family: Rajdhani, sans-serif;
    font-size: 20px;
    font-weight: 600;
}

.release-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.release-version {
    font-family: Rajdhani, sans-serif;
    font-size: 34px;
    font-weight: 600;
    line-height: 1;
}

.release-links {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 12px;
    color: var(--muted);
    font-size: 11.5px;
}

.release-links a {
    color: var(--accent);
    text-decoration: none;
    overflow-wrap: anywhere;
}

.release-notes {
    margin-top: 12px;
    color: var(--muted);
    font-size: 12.5px;
    white-space: pre-wrap;
}

/* ---------- progress ---------- */

.progress {
    position: relative;
    height: 8px;
    margin: 12px 0;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
}

.progress i {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    transition: width 120ms;
}

.progress span {
    display: block;
    margin-top: 5px;
    color: var(--dim);
    font-size: 11px;
}

.progress.inline {
    display: flex;
    align-items: center;
    gap: 10px;
    height: auto;
    margin: 0;
    background: transparent;
}

.progress.inline i {
    width: 90px;
    height: 6px;
    border-radius: 999px;
}

/* ---------- modal ---------- */

.modal {
    width: min(600px, calc(100vw - 32px));
    max-height: calc(100vh - 48px);
    padding: 0;
    color: var(--text);
    background: var(--panel);
    border: 1px solid var(--line-2);
    border-radius: 14px;
    box-shadow: var(--shadow);
}

.modal::backdrop {
    background: rgba(4, 6, 4, 0.7);
    backdrop-filter: blur(3px);
}

.modal form {
    padding: 22px;
    overflow-y: auto;
    max-height: calc(100vh - 48px);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
}

.modal-head h3 {
    margin: 0;
    font-family: Rajdhani, sans-serif;
    font-size: 22px;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 18px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 14px;
}

/* ---------- toasts ---------- */

.toasts {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(360px, calc(100vw - 36px));
    pointer-events: none;
}

.toast {
    padding: 12px 14px;
    color: var(--text);
    background: rgba(21, 27, 18, 0.98);
    border: 1px solid var(--line-2);
    border-left: 3px solid var(--accent);
    border-radius: 9px;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    font-size: 12.5px;
    animation: toast-in 160ms ease both;
    pointer-events: auto;
}

.toast.error {
    border-left-color: var(--danger);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        flex-direction: row;
        align-items: center;
        padding: 10px 14px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .sidebar-note {
        display: none;
    }

    .content {
        padding: 20px 16px;
    }

    .page-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .row-card {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .row-side {
        justify-content: flex-start;
    }
}

@media (max-width: 620px) {
    .topbar {
        padding: 0 14px;
    }

    .brand.small .brand-title {
        font-size: 14px;
    }

    .user-chip {
        display: none;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .page-head h2 {
        font-size: 24px;
    }
}

.download-link {
    display: block;
    margin-top: 18px;
    color: var(--accent);
    font-size: 12px;
    text-align: center;
    text-decoration: none;
}

.download-link:hover {
    text-decoration: underline;
}

/* ---------- applications ---------- */

.nav-badge {
    margin-left: auto;
    min-width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    padding: 0 5px;
    color: #10150c;
    background: var(--accent);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}

.settings-panel {
    padding: 16px 18px;
}

.settings-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 18px;
}

.copy-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.copy-row input {
    min-width: 0;
    flex: 1;
    height: 36px;
    padding: 0 10px;
    color: var(--text);
    background: #0b1009;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-family: 'Cascadia Mono', Consolas, monospace;
    font-size: 11px;
}

.settings-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
}

.app-filters {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px 190px;
    gap: 10px;
    align-items: end;
    margin: 16px 0 12px;
}

.app-filters .field {
    margin-bottom: 0;
}

.field.grow {
    min-width: 0;
}

.app-card {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 15px 18px;
    background: linear-gradient(180deg, rgba(24, 31, 20, 0.92), rgba(18, 23, 15, 0.92));
    border: 1px solid var(--line);
    border-radius: 12px;
}

.app-card:hover {
    border-color: var(--line-2);
}

.app-name {
    font-size: 14px;
    font-weight: 600;
}

.app-sub {
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
}

.app-side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.app-status {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.app-status.new { color: var(--accent-2); border-color: rgba(174, 191, 110, 0.4); background: rgba(174, 191, 110, 0.1); }
.app-status.review { color: var(--warn); border-color: rgba(214, 169, 62, 0.35); background: rgba(214, 169, 62, 0.08); }
.app-status.interview { color: #9fb8da; border-color: rgba(122, 155, 181, 0.35); background: rgba(122, 155, 181, 0.1); }
.app-status.reserve { color: #c5b28b; border-color: rgba(196, 163, 90, 0.35); background: rgba(196, 163, 90, 0.08); }
.app-status.accepted { color: var(--ok); border-color: rgba(143, 176, 106, 0.4); background: rgba(143, 176, 106, 0.1); }
.app-status.rejected { color: #e3a58d; border-color: rgba(208, 122, 85, 0.4); background: rgba(208, 122, 85, 0.1); }
.app-status.archived { color: var(--dim); border-color: var(--line); background: rgba(255, 255, 255, 0.03); }

.app-modal {
    width: min(940px, calc(100vw - 32px));
}

.app-modal-body {
    padding: 22px;
    overflow-y: auto;
    max-height: calc(100vh - 48px);
}

.app-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
    gap: 18px;
}

.app-section {
    margin-bottom: 18px;
}

.app-section h4 {
    margin: 0 0 9px;
    color: var(--muted);
    font-family: Rajdhani, sans-serif;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.app-facts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.app-fact {
    padding: 9px 11px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.app-fact span {
    display: block;
    color: var(--dim);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.app-fact b {
    display: block;
    margin-top: 3px;
    font-size: 12.5px;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.answers-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 420px;
    overflow-y: auto;
    padding-right: 3px;
}

.answer-row {
    padding: 9px 11px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: 8px;
}

.answer-row span {
    display: block;
    color: var(--dim);
    font-size: 10.5px;
}

.answer-row b {
    display: block;
    margin-top: 3px;
    color: var(--text);
    font-size: 12.5px;
    font-weight: 400;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.status-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.status-actions .btn.active {
    border-color: var(--accent);
    background: rgba(174, 191, 110, 0.14);
    color: var(--text);
}

.comments-list,
.history-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
    max-height: 260px;
    overflow-y: auto;
}

.comment-item,
.history-item {
    padding: 9px 11px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--line);
    border-radius: 8px;
    font-size: 12px;
}

.comment-item .meta,
.history-item .meta {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
    color: var(--dim);
    font-size: 10.5px;
}

.comment-item p,
.history-item p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.comment-form {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.comment-form input {
    flex: 1;
    min-width: 0;
}

.app-empty {
    padding: 36px 20px;
    text-align: center;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 12px;
}

@media (max-width: 900px) {
    .settings-grid,
    .app-detail-grid {
        grid-template-columns: 1fr;
    }

    .app-filters {
        grid-template-columns: 1fr;
    }

    .app-card {
        grid-template-columns: 1fr;
    }

    .app-side {
        justify-content: flex-start;
    }
}
