:root {
    --bg: #000;
    --color: #ddd;
    --accent: #d4a017;
    --dim: #555;
    --link: #31b0fa;
    --input-bg: #1a1a1a;
    --border: #333;
    --hover: #222;
}

body {
    background: var(--bg);
    color: var(--color);
    font-family: "Courier New", Courier, monospace;
    font-size: 14px;
    line-height: 1.5;
    margin: 0;
    padding: 0;
}

/* Layout */

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}
#app {
    display: grid;
    height: 100vh;
    grid-template: auto 1fr / 18em 1fr;
    grid-template-areas: "h h" "s m";
}
header {
    grid-area: h;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5em 1em;
    border-bottom: 1px solid var(--border);
}
#logo > img {
    vertical-align: middle;
    margin-right: 0.5em;
}
header .utils > * {
    margin-left: 1em;
}

.sidebar {
    grid-area: s;
    border-right: 1px solid var(--border);
    padding: 0.5em;
    overflow-y: auto;
}
.sidebar input[type="search"] {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0.5em;
    background: var(--input-bg);
    color: var(--color);
    border: 1px solid var(--border);
    padding: 0.3em 0.5em;
    font-family: inherit;
}

.content {
    grid-area: m;
    padding: 1em;
    overflow-y: auto;
}

/* Sidebar nav sections */

.nav-section {
    margin: 0.5em 0 0.2em;
    padding: 0.2em 0.5em;
    color: var(--dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.85em;
    border-bottom: 1px solid var(--border);
}

/* Sidebar nav items */

.view-links {
    margin: 0;
    padding: 0;
}
.sidebar:focus-within .view-links > button {
    color: var(--color);
}
.view-links > button {
    display: block;
    width: 100%;
    padding: 0.2em 0.5em;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--dim);
    border: none;
    border-bottom: 1px solid var(--border);
    background: none;
    font: inherit;
    text-align: left;
    border-radius: 0;
}
.view-links > button:last-child {
    border-bottom: none;
}
.view-links > button:hover {
    background: var(--hover);
    color: var(--color);
}
.view-links > button.selected {
    color: var(--accent) !important;
    border-bottom-color: var(--accent);
}

/* Headings */

h2 {
    color: var(--accent);
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.3em;
    margin-top: 0;
}
h3 {
    color: var(--accent);
    margin: 1em 0 0.5em;
}
h3::before {
    content: "── ";
}
h3::after {
    content: " ──";
}
h4 {
    color: var(--color);
    margin: 0.5em 0 0.3em;
    font-weight: bold;
}

/* Details / summary (collapsible sections) */

details {
    margin: 0.5em 0;
    border: 1px solid var(--border);
}
details[open] {
    border-color: var(--accent);
}
summary {
    cursor: pointer;
    padding: 0.3em 0.5em;
    background: var(--hover);
    color: var(--accent);
    user-select: none;
}
summary:hover {
    background: #2a2a2a;
}
details[open] summary {
    border-bottom: 1px solid var(--border);
}

/* Tables */

table {
    border-collapse: collapse;
    width: 100%;
}
th, td {
    border: 1px solid var(--border);
    padding: 0.3em 0.5em;
    text-align: left;
}
th {
    color: var(--accent);
    font-weight: bold;
}

/* Form elements */

textarea, select, input {
    background: var(--input-bg);
    color: var(--color);
    border: 1px solid var(--border);
    padding: 0.3em 0.5em;
    font-family: inherit;
    font-size: inherit;
    box-sizing: border-box;
}
textarea:focus, select:focus, input:focus {
    outline: none;
    border-color: var(--accent);
}

button, input[type=button], input[type=submit], ::file-selector-button {
    background: var(--input-bg);
    color: var(--color);
    border: 1px solid var(--border);
    padding: 0.3em 0.7em;
    cursor: pointer;
    font-family: inherit;
    font-size: inherit;
}
button:hover, input[type=button]:hover, input[type=submit]:hover {
    border-color: var(--accent);
    color: var(--accent);
}
button:active, input[type=button]:active, input[type=submit]:active {
    background: var(--accent);
    color: var(--bg);
}
button[disabled] {
    opacity: 0.4;
    cursor: default;
}
button[disabled]:hover {
    border-color: var(--border);
    color: var(--color);
}

/* Links */

a[href], a[href]:visited, button.link {
    border: none;
    color: var(--link);
    background: none;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    font-size: inherit;
}
a[href]:hover {
    text-decoration: underline;
}

/* Radio pills */

label.radio {
    display: inline-block;
    margin-right: 0.5em;
    margin-bottom: 0.5em;
    padding: 0.3em 0.7em;
    border: 1px solid var(--border);
    cursor: pointer;
    user-select: none;
}
label.radio:has(input:checked) {
    color: var(--accent);
    border-color: var(--accent);
}
label.radio input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
label.radio:focus-within {
    color: var(--accent);
    border-color: var(--accent);
}

/* Asset checkboxes → [x] / [ ] style */

.downloads label {
    display: inline-block;
    margin-right: 0.5em;
    margin-bottom: 0.5em;
    padding: 0.2em 0;
    cursor: pointer;
    user-select: none;
    font-family: inherit;
    border-bottom: 1px solid transparent;
}
.downloads label.selected {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.downloads label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.downloads label:focus-within {
    color: var(--accent);
    border-bottom-color: var(--accent);
}
.downloads label::before {
    content: "[ ] ";
    color: var(--dim);
}
.downloads label.selected::before {
    content: "[x] ";
    color: var(--accent);
}

/* Toast notifications */

.toasts {
    position: fixed;
    bottom: 1em;
    right: 1em;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.3em;
}
.toast {
    background: #1a1a1a;
    border: 1px solid var(--border);
    padding: 0.5em 1em;
    max-width: 30em;
    animation: fadein 0.2s;
    font-family: inherit;
    opacity: 1;
}
.toast.info {
    border-color: var(--accent);
    color: var(--accent);
}
.toast.error {
    background: #100;
    border-color: #c00;
    color: #c00;
}
@keyframes fadein {
    from { opacity: 0; transform: translateY(0.5em); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Terminal output block */

.term {
    background: #000;
    border: 1px solid var(--border);
    padding: 0.5em;
    word-break: break-all;
    font-family: inherit;
    white-space: pre-wrap;
}
.term a {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--link);
}

/* Misc */

.green { color: #0a0; }
.red   { color: #c00; }
.copy { font-size: small; }

.links > * { margin-left: 1ex; }
.links > *:first-child { margin-left: 0; }

.flat > * { margin-left: 1ex; }
.flat > *:first-child { margin-left: 0; }

.error {
    display: flex;
    background: rgba(200,0,0,0.15);
    border: 1px solid #c00;
    padding: 0.5em;
    margin: 0.5em 0;
    justify-content: space-between;
    align-items: center;
}
.error .btn-close {
    background: #600;
    color: white;
    border: none;
    padding: 0.3em 0.7em;
    cursor: pointer;
}

.notif {
    display: inline-block;
    position: relative;
}
.notif > div:first-child {
    position: absolute;
    min-width: 100%; height: 100%;
    background: var(--bg);
    opacity: 85%;
    text-align: center;
}

.text-and-file {
    position: relative;
    display: block;
}
.text-and-file textarea {
    width: 100%;
    box-sizing: border-box;
}
.text-and-file input[type="file"] {
    position: absolute;
    bottom: 0;
    right: 0;
}
