:root {
    --nex-dark: #131e29;
    --nex-orange: #ff6b00;
    /* Text and button backgrounds: >= 4.5:1 against white (WCAG AA). --nex-orange is for accents. */
    --nex-orange-text: #b34a00;
    --nex-orange-text-hover: #8f3900;
    --text: #1f2a37;
    --muted: #5f6a7a;
    --border: #dfe3e8;
    --surface: #f6f7f9;
    --success-bg: #e8f5ec;
    --success-border: #2e8b57;
    --info-bg: #eaf1fb;
    --info-border: #3b6fb6;
    --warning-bg: #fff4e5;
    --warning-border: #b34a00;
    font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #ffffff;
    line-height: 1.55;
}

a {
    color: var(--nex-orange-text);
}

code {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    padding: 0 4px;
    font-size: 0.9em;
}

.button {
    display: inline-block;
    padding: 10px 18px;
    border: 0;
    border-radius: 6px;
    background: var(--nex-orange-text);
    color: #ffffff;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.button:hover {
    background: var(--nex-orange-text-hover);
}

.user form {
    margin: 0;
}

.button-quiet {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.button-quiet:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    gap: 32px;
    height: 56px;
    padding: 0 20px;
    background: var(--nex-dark);
    border-bottom: 3px solid var(--nex-orange);
    color: #ffffff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    white-space: nowrap;
}

.brand img {
    height: 26px;
}

.brand span {
    padding-left: 12px;
    border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.topnav {
    display: flex;
    gap: 20px;
    flex: 1;
}

.topnav a,
.topnav span {
    color: #c5ccd6;
    text-decoration: none;
    padding: 16px 0 14px;
    border-bottom: 3px solid transparent;
}

.topnav .active {
    color: #ffffff;
    border-bottom-color: var(--nex-orange);
}

.user {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
}

.avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--nex-orange);
    font-size: 13px;
    font-weight: 700;
}

/* Layout */
.layout {
    display: flex;
    min-height: calc(100vh - 59px);
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    padding: 20px 12px;
    background: var(--surface);
    border-right: 1px solid var(--border);
}

.space {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 16px;
    border-bottom: 1px solid var(--border);
}

.space small {
    display: block;
    color: var(--muted);
}

.space-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--nex-dark);
    color: var(--nex-orange);
    font-weight: 700;
}

.sidebar-title {
    margin: 16px 8px 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tree ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tree ul ul {
    padding-left: 16px;
}

.tree a {
    display: block;
    padding: 5px 8px;
    border-radius: 4px;
    color: var(--text);
    text-decoration: none;
}

.tree a:hover {
    background: #eceff3;
}

.tree a.current {
    background: #ffe9d9;
    color: var(--nex-dark);
    font-weight: 600;
}

.content {
    flex: 1;
    max-width: 860px;
    padding: 24px 48px 64px;
}

.breadcrumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: var(--muted);
    font-size: 14px;
}

.breadcrumbs a {
    color: var(--muted);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: underline;
}

h1 {
    margin: 12px 0 4px;
    font-size: 30px;
    line-height: 1.2;
}

h2 {
    margin-top: 28px;
    font-size: 20px;
}

.byline {
    margin: 0 0 20px;
    color: var(--muted);
    font-size: 14px;
}

/* Content blocks */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}

th,
td {
    padding: 8px 12px;
    border: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: var(--surface);
    width: 30%;
}

thead th {
    width: auto;
}

.panel {
    margin: 16px 0;
    padding: 12px 16px;
    border-left: 4px solid var(--info-border);
    border-radius: 4px;
    background: var(--info-bg);
}

.panel-success {
    border-left-color: var(--success-border);
    background: var(--success-bg);
}

.panel-warning {
    border-left-color: var(--warning-border);
    background: var(--warning-bg);
}

.panel-wallet {
    border-left-color: var(--nex-orange);
    background: #fff7f0;
}

.panel-wallet dl {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 32px;
    margin: 10px 0 0;
}

.panel-wallet dt {
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
}

.panel-wallet dd {
    margin: 0;
    font-weight: 600;
}

.lozenge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 3px;
    background: #e9ecf0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.lozenge-success {
    background: var(--success-bg);
    color: #1d6b40;
}

.tasks {
    list-style: none;
    padding-left: 0;
}

.tasks li {
    padding: 4px 0 4px 28px;
    position: relative;
}

.tasks li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    width: 16px;
    height: 16px;
    border: 2px solid #9aa4b2;
    border-radius: 3px;
}

.tasks li.done {
    color: var(--muted);
    text-decoration: line-through;
}

.tasks li.done::before {
    background: var(--nex-orange);
    border-color: var(--nex-orange);
}

/* Sign-in page */
.signin-page {
    background: linear-gradient(165deg, #f0f4fa 0%, #ffffff 45%, #f8f9fb 100%);
}

.signin {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
}

.card {
    max-width: 420px;
    padding: 36px;
    border: 1px solid var(--border);
    border-top: 4px solid var(--nex-orange);
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 30px rgba(19, 30, 41, 0.08);
    text-align: center;
}

.signin-logo {
    height: 34px;
}

.notice {
    padding: 8px;
    border-radius: 4px;
    background: var(--success-bg);
}

@media (max-width: 800px) {
    .topnav,
    .user-name {
        display: none;
    }

    .topbar {
        justify-content: space-between;
        gap: 12px;
        padding: 0 12px;
    }

    .brand span {
        display: none;
    }

    .layout {
        flex-direction: column;
    }

    .sidebar {
        width: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .content {
        padding: 16px;
    }
}
