:root {
    --jh-bg: #111111;
    --jh-surface: #1a1a1a;
    --jh-surface-soft: #242424;
    --jh-text: #f6f1e8;
    --jh-muted: #b9ad9f;
    --jh-border: #3a342d;
    --jh-accent: #f4b860;
    --jh-accent-soft: #3a2a15;
    --jh-danger: #f08a8a;
    --jh-success: #9bd18b;
    --jh-radius: 16px;
    --jh-max-width: 1120px;
}

* {
    box-sizing: border-box;
}

html {
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    background: var(--jh-bg);
    color: var(--jh-text);
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(244, 184, 96, 0.16), transparent 32rem),
        radial-gradient(circle at bottom right, rgba(155, 209, 139, 0.08), transparent 28rem),
        var(--jh-bg);
    color: var(--jh-text);
}

a {
    color: var(--jh-accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

header,
main,
footer {
    width: min(100% - 2rem, var(--jh-max-width));
    margin: 0 auto;
}

header {
    padding: 1.5rem 0 1rem;
}

main {
    padding: 1.5rem 0 3rem;
}

footer {
    padding: 2rem 0;
    color: var(--jh-muted);
}

h1,
h2,
h3 {
    line-height: 1.1;
}

h1 {
    font-size: clamp(2rem, 5vw, 4rem);
    margin: 0 0 1rem;
}

h2 {
    margin-top: 2rem;
    font-size: 1.45rem;
}

h3 {
    margin-top: 1.25rem;
}

p,
li,
dd,
dt,
label,
input,
textarea,
select,
button {
    font-size: 1rem;
    line-height: 1.6;
}

p {
    color: var(--jh-muted);
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
    margin: 1rem 0;
}

nav a {
    display: inline-flex;
    align-items: center;
    min-height: 2.25rem;
    padding: 0.35rem 0.75rem;
    border: 1px solid var(--jh-border);
    border-radius: 999px;
    background: rgba(26, 26, 26, 0.72);
}

nav a:hover {
    background: var(--jh-accent-soft);
    text-decoration: none;
}

section,
article,
.card {
    margin: 1rem 0;
    padding: 1.25rem;
    border: 1px solid var(--jh-border);
    border-radius: var(--jh-radius);
    background: rgba(26, 26, 26, 0.84);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    overflow: hidden;
    border-radius: var(--jh-radius);
}

th,
td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--jh-border);
    text-align: left;
    vertical-align: top;
}

th {
    color: var(--jh-text);
    background: var(--jh-surface-soft);
}

td {
    color: var(--jh-muted);
    background: rgba(26, 26, 26, 0.72);
}

dl {
    display: grid;
    grid-template-columns: minmax(10rem, 16rem) 1fr;
    gap: 0.65rem 1rem;
}

dt {
    color: var(--jh-text);
    font-weight: 700;
}

dd {
    margin: 0;
    color: var(--jh-muted);
}

form {
    display: grid;
    gap: 1rem;
}

input,
textarea,
select {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid var(--jh-border);
    border-radius: 12px;
    background: #0f0f0f;
    color: var(--jh-text);
}

input[type="checkbox"] {
    width: auto;
}

button,
.button {
    display: inline-flex;
    width: fit-content;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1rem;
    border: 1px solid var(--jh-accent);
    border-radius: 999px;
    background: var(--jh-accent);
    color: #18120a;
    font-weight: 700;
    cursor: pointer;
}

button:hover,
.button:hover {
    filter: brightness(1.08);
    text-decoration: none;
}

hr {
    border: 0;
    border-top: 1px solid var(--jh-border);
}

img {
    max-width: 100%;
    height: auto;
    border-radius: var(--jh-radius);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    border: 1px solid var(--jh-border);
    border-radius: 999px;
    color: var(--jh-muted);
    background: var(--jh-surface-soft);
    font-size: 0.85rem;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1rem 0;
}

@media (max-width: 720px) {
    dl {
        grid-template-columns: 1fr;
    }

    table {
        display: block;
        overflow-x: auto;
    }

    nav a {
        width: 100%;
    }
}

form[method="get"] {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 1rem;
}

form[method="get"] label {
    width: 100%;
}

form[method="get"] select {
    max-width: 24rem;
}


.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1000;
    padding: 0.65rem 0.9rem;
    border-radius: 999px;
    background: var(--jh-accent);
    color: #18120a;
    font-weight: 700;
    transform: translateY(-200%);
}

.skip-link:focus {
    transform: translateY(0);
}

:focus-visible {
    outline: 3px solid var(--jh-accent);
    outline-offset: 3px;
}

.site-header h1 a,
.console-header h1 a,
.chaos-portal-header h1 a {
    color: inherit;
}

.site-kicker {
    margin: 0;
    color: var(--jh-accent);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tenant-banner,
.portal-user-banner,
.portal-organization-banner {
    margin: 1rem 0;
    padding: 0.8rem 1rem;
    border: 1px solid var(--jh-border);
    border-radius: 12px;
    background: var(--jh-surface-soft);
}

.header-action {
    display: inline-flex;
    margin: 0.5rem 0 0;
}

.alert {
    padding: 0.9rem 1rem;
    border: 1px solid var(--jh-border);
    border-radius: 12px;
}

.alert-warning {
    border-color: var(--jh-accent);
    background: var(--jh-accent-soft);
}

.field-error,
[th\:errors] {
    color: var(--jh-danger);
}

.empty-state {
    color: var(--jh-muted);
    font-style: italic;
}

.actions form {
    display: inline-flex;
}

pre {
    max-width: 100%;
    overflow-x: auto;
    padding: 1rem;
    border: 1px solid var(--jh-border);
    border-radius: 12px;
    background: #0f0f0f;
    color: var(--jh-text);
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
    }
}
