:root {
    --desktop: #008080;
    --desktop-dark: #006666;
    --surface: #c0c0c0;
    --surface-light: #dfdfdf;
    --surface-lighter: #f4f4f4;
    --surface-dark: #808080;
    --ink: #000000;
    --muted: #4a4a4a;
    --title: #000080;
    --title-light: #1084d0;
    --title-inactive: #7f7f7f;
    --title-inactive-light: #b5b5b5;
    --danger: #a40000;
    --danger-light: #d52d2d;
    --success: #087b24;
    --warning: #8a6200;
    --focus: #000080;
    --white: #ffffff;
    --shadow: #404040;
    --border-raised: var(--white) var(--ink) var(--ink) var(--white);
    --border-sunken: var(--shadow) var(--white) var(--white) var(--shadow);
    --font-ui: Tahoma, "MS Sans Serif", "Segoe UI", Arial, sans-serif;
    --font-mono: "Courier New", Courier, monospace;
    --taskbar-height: 38px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    font-family: var(--font-ui);
    font-size: 14px;
    color: var(--ink);
    background: var(--desktop);
}

body {
    min-height: 100vh;
    margin: 0;
    line-height: 1.4;
}

body.admin-desktop,
body.login-desktop {
    background-color: var(--desktop);
    background-image:
        linear-gradient(45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(255, 255, 255, 0.025) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.025) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.025) 75%);
    background-position: 0 0, 0 4px, 4px -4px, -4px 0;
    background-size: 8px 8px;
}

img {
    max-width: 100%;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 4px;
    font-size: clamp(1.55rem, 2vw, 2rem);
    line-height: 1.1;
}

h2 {
    font-size: 1rem;
}

a {
    color: #000080;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: #0000d0;
}

code,
pre {
    font-family: var(--font-mono);
}

code {
    overflow-wrap: anywhere;
}

button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}

button,
summary,
a.button,
a.start-button {
    -webkit-tap-highlight-color: transparent;
}

:focus-visible {
    outline: 2px dotted var(--focus);
    outline-offset: 2px;
}

::selection {
    color: var(--white);
    background: var(--title);
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: fixed;
    z-index: 1000;
    top: 6px;
    left: 6px;
    padding: 8px 12px;
    color: var(--ink);
    background: var(--surface);
    border: 2px solid;
    border-color: var(--border-raised);
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

/* Windows and chrome */
.window {
    color: var(--ink);
    background: var(--surface);
    border: 2px solid;
    border-color: var(--border-raised);
    box-shadow: 1px 1px 0 var(--shadow);
}

.title-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 28px;
    padding: 3px 4px;
    color: var(--white);
    background: linear-gradient(90deg, var(--title), var(--title-light));
    gap: 8px;
}

.title-bar--inactive {
    background: linear-gradient(90deg, var(--title-inactive), var(--title-inactive-light));
}

.title-bar--danger {
    background: linear-gradient(90deg, #750000, var(--danger-light));
}

.title-bar--success {
    background: linear-gradient(90deg, #065d1a, #23a041);
}

.title-bar__text {
    display: flex;
    align-items: center;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
    gap: 6px;
}

.title-bar__icon {
    display: inline-grid;
    width: 18px;
    height: 18px;
    place-items: center;
    color: var(--title);
    font-size: 11px;
    background: var(--white);
    border: 1px solid var(--ink);
}

.title-bar__meta {
    overflow: hidden;
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.title-bar__link {
    flex: 0 0 auto;
    color: var(--white);
    font-size: 0.78rem;
}

.title-bar__link:hover {
    color: var(--white);
}

.title-bar__controls {
    display: flex;
    flex: 0 0 auto;
    gap: 2px;
}

.window-control {
    display: grid;
    width: 19px;
    height: 19px;
    place-items: center;
    color: var(--ink);
    font-weight: 800;
    line-height: 1;
    background: var(--surface);
    border: 2px solid;
    border-color: var(--border-raised);
}

.status-bar {
    display: flex;
    min-height: 25px;
    padding: 3px;
    gap: 3px;
}

.status-bar__field {
    min-width: 0;
    padding: 2px 6px;
    overflow: hidden;
    font-size: 0.76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid;
    border-color: var(--border-sunken);
}

.inset-panel {
    background: var(--surface-light);
    border: 2px solid;
    border-color: var(--border-sunken);
}

/* Controls */
.button,
button.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 5px 13px;
    color: var(--ink);
    font-weight: 500;
    line-height: 1.1;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    background: var(--surface);
    border: 2px solid;
    border-color: var(--border-raised);
    box-shadow: 1px 1px 0 var(--shadow);
}

.button:hover {
    color: var(--ink);
    background: var(--surface-light);
}

.button:active,
.button.is-pressed {
    padding-top: 6px;
    padding-right: 12px;
    padding-bottom: 4px;
    padding-left: 14px;
    border-color: var(--border-sunken);
    box-shadow: none;
}

.button--primary {
    font-weight: 700;
    outline: 1px solid var(--ink);
    outline-offset: -5px;
}

.button--danger {
    color: #6e0000;
    font-weight: 700;
}

.button--compact {
    min-height: 27px;
    padding: 3px 9px;
    font-size: 0.78rem;
}

.button--icon {
    min-width: 25px;
    min-height: 25px;
    padding: 1px 6px;
    font-weight: 800;
}

.button[disabled],
.button.is-disabled,
[aria-disabled="true"] {
    color: var(--surface-dark);
    cursor: not-allowed;
    text-shadow: 1px 1px var(--white);
    pointer-events: none;
}

input,
select,
textarea {
    width: 100%;
    min-height: 33px;
    padding: 6px 8px;
    background: var(--white);
    border: 2px solid;
    border-color: var(--border-sunken);
    border-radius: 0;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

input[readonly],
textarea[readonly] {
    color: var(--muted);
    background: var(--surface-lighter);
}

input[type="checkbox"],
input[type="radio"] {
    flex: 0 0 auto;
    width: 18px;
    min-height: 18px;
    margin: 0;
    accent-color: var(--title);
}

label,
legend {
    font-weight: 700;
}

fieldset {
    min-width: 0;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--surface-dark);
}

legend {
    padding: 0 5px;
}

.field-group,
.field-row {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 4px;
}

.field-group > small,
.field-row > small {
    color: var(--muted);
    font-size: 0.74rem;
}

.field-group--grow {
    flex: 1 1 280px;
}

.check-row {
    display: inline-flex;
    align-items: flex-start;
    font-weight: 400;
    cursor: pointer;
    gap: 7px;
}

.check-group {
    justify-content: center;
    gap: 8px;
}

.form-actions,
.button-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.form-actions--end {
    justify-content: flex-end;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 13px 16px;
}

.form-grid__wide {
    grid-column: 1 / -1;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.split-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.inline-form,
.button-row form,
.table-actions form,
.agreement-preview__actions form,
.server-card__actions form {
    margin: 0;
}

.filter-window,
.disclosure-window {
    margin-bottom: 16px;
}

.filter-form {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    padding: 12px;
    gap: 10px;
}

.filter-form > .field-group:not(.field-group--grow) {
    flex: 1 1 150px;
    max-width: 220px;
}

.filter-form__actions {
    display: flex;
    flex: 0 0 auto;
    gap: 6px;
}

.password-field,
.copy-field {
    display: flex;
    align-items: stretch;
    gap: 5px;
}

.password-field input,
.copy-field input {
    min-width: 0;
}

/* App shell */
.desktop {
    min-height: 100vh;
    padding: 8px 8px calc(var(--taskbar-height) + 10px);
}

.app-header {
    position: relative;
    z-index: 30;
    margin-bottom: 8px;
}

.app-header__toolbar {
    display: flex;
    min-height: 58px;
    align-items: center;
    padding: 8px 10px;
    gap: 14px;
}

.brand-line {
    display: flex;
    align-items: center;
    gap: 9px;
}

.brand-line > span:last-child {
    display: flex;
    flex-direction: column;
}

.brand-line small {
    color: var(--muted);
    font-size: 0.72rem;
}

.brand-mark,
.start-button__logo {
    display: inline-grid;
    place-items: center;
    color: var(--white);
    font-weight: 900;
    font-style: italic;
    background: linear-gradient(135deg, #e32219 0 25%, #198f27 25% 50%, #245dc1 50% 75%, #e9c514 75%);
    border: 1px solid var(--ink);
    text-shadow: 1px 1px var(--ink);
}

.brand-mark {
    width: 36px;
    height: 36px;
    font-size: 1.35rem;
}

.header-session {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 10px;
}

.session-user {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    background: var(--surface-light);
    border: 1px solid;
    border-color: var(--border-sunken);
    gap: 7px;
}

.admin-layout {
    display: grid;
    grid-template-columns: 225px minmax(0, 1fr);
    align-items: start;
    gap: 10px;
}

.sidebar {
    position: sticky;
    top: 8px;
    min-height: 420px;
}

.nav-tree {
    display: flex;
    flex-direction: column;
    padding: 7px;
    gap: 2px;
}

.nav-tree__item {
    display: flex;
    min-height: 35px;
    align-items: center;
    padding: 7px 8px;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid transparent;
    gap: 8px;
}

.nav-tree__item > span {
    display: inline-grid;
    width: 22px;
    height: 22px;
    place-items: center;
    color: var(--title);
    background: var(--surface-lighter);
    border: 1px solid var(--surface-dark);
}

.nav-tree__item:hover {
    color: var(--ink);
    background: var(--surface-light);
    border-color: var(--surface-dark);
}

.nav-tree__item.is-active {
    color: var(--white);
    background: var(--title);
    border-color: var(--white);
}

.nav-tree__item.is-active > span {
    color: var(--white);
    background: transparent;
    border-color: var(--white);
}

.sidebar__status {
    display: flex;
    margin: 8px;
    padding: 8px;
    flex-direction: column;
    gap: 5px;
}

.sidebar__status > span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar__status small {
    color: var(--muted);
}

.main-column {
    min-width: 0;
}

.taskbar {
    position: fixed;
    z-index: 100;
    right: 0;
    bottom: 0;
    left: 0;
    display: flex;
    height: var(--taskbar-height);
    align-items: center;
    padding: 3px 5px;
    background: var(--surface);
    border-top: 2px solid var(--white);
    box-shadow: 0 -1px 0 var(--surface-dark);
    gap: 6px;
}

.start-button {
    display: inline-flex;
    height: 30px;
    align-items: center;
    padding: 2px 7px;
    color: var(--ink);
    font-weight: 800;
    text-decoration: none;
    background: var(--surface);
    border: 2px solid;
    border-color: var(--border-raised);
    box-shadow: 1px 1px var(--shadow);
    gap: 5px;
}

.start-button:hover {
    color: var(--ink);
}

.start-button__logo {
    width: 20px;
    height: 20px;
    font-size: 0.7rem;
}

.taskbar__app {
    display: flex;
    width: min(280px, 38vw);
    height: 29px;
    align-items: center;
    padding: 3px 9px;
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 2px solid;
    border-color: var(--border-sunken);
    gap: 6px;
}

.taskbar__tray {
    display: flex;
    height: 29px;
    align-items: center;
    margin-left: auto;
    padding: 3px 8px;
    border: 2px solid;
    border-color: var(--border-sunken);
    gap: 8px;
}

.nav-toggle {
    display: none;
}

/* Shared content */
.page-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-bottom: 14px;
    padding: 14px 16px;
    background: rgba(223, 223, 223, 0.95);
    border: 2px solid;
    border-color: var(--border-raised);
    box-shadow: 1px 1px var(--shadow);
    gap: 16px;
}

.page-heading p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.page-heading__actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 7px;
}

.eyebrow {
    margin-bottom: 3px;
    color: var(--title);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.panel {
    min-width: 0;
    margin-bottom: 14px;
}

.panel__body {
    padding: 12px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 14px;
    gap: 10px;
}

.stat-card {
    min-width: 0;
}

.stat-card__body {
    display: flex;
    min-height: 92px;
    align-items: center;
    padding: 12px;
    gap: 11px;
}

.stat-card__body > div {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.stat-card__body strong {
    overflow: hidden;
    font-size: clamp(1.35rem, 2.4vw, 2rem);
    line-height: 1.15;
    text-overflow: ellipsis;
}

.stat-card__body span:last-child {
    color: var(--muted);
    font-size: 0.75rem;
}

.stat-card__icon {
    display: grid;
    width: 43px;
    height: 43px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--white);
    font-size: 1.45rem;
    background: var(--title);
    border: 2px solid;
    border-color: var(--border-raised);
    box-shadow: 1px 1px var(--shadow);
}

.stat-card__money {
    font-size: clamp(1.1rem, 2vw, 1.65rem) !important;
}

.dashboard-grid,
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
    align-items: start;
    gap: 0 12px;
}

.detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel--wide {
    min-width: 0;
}

.quick-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.flash-stack {
    display: grid;
    margin-bottom: 12px;
    gap: 6px;
}

.flash {
    display: flex;
    align-items: center;
    padding: 8px;
    background: var(--surface-light);
    border: 2px solid;
    border-color: var(--border-raised);
    box-shadow: 1px 1px var(--shadow);
    gap: 9px;
}

.flash__icon {
    display: grid;
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    place-items: center;
    color: var(--white);
    font-weight: 800;
    background: var(--title);
    border-radius: 50%;
}

.flash > span:nth-child(2) {
    flex: 1;
}

.flash--success .flash__icon {
    background: var(--success);
}

.flash--error .flash__icon {
    background: var(--danger);
}

.flash--warning .flash__icon {
    color: var(--ink);
    background: #f4d71f;
}

.inline-alert {
    padding: 8px 10px;
    background: #eef4ff;
    border: 1px solid var(--title);
}

.inline-alert--error {
    color: #650000;
    background: #ffe7e7;
    border-color: var(--danger);
}

.inline-alert--warning {
    color: #3f3000;
    background: #fff7c6;
    border-color: var(--warning);
}

.inline-alert--info {
    color: #00005f;
    background: #e8efff;
    border-color: var(--title);
}

.legal-note {
    margin: 14px 0;
}

.empty-state {
    display: flex;
    min-height: 190px;
    align-items: center;
    justify-content: center;
    padding: 25px;
    flex-direction: column;
    text-align: center;
}

.empty-state > span:first-child {
    display: grid;
    width: 48px;
    height: 48px;
    margin-bottom: 9px;
    place-items: center;
    color: var(--white);
    font-size: 1.65rem;
    background: var(--title);
    border: 2px solid;
    border-color: var(--border-raised);
}

.empty-state strong {
    font-size: 1rem;
}

.empty-state p {
    max-width: 500px;
    margin: 5px 0 12px;
    color: var(--muted);
}

.empty-state--small {
    min-height: 110px;
    padding: 16px;
}

.empty-state--large {
    min-height: 320px;
}

.compact-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.compact-list__row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    padding: 7px;
    color: var(--ink);
    text-decoration: none;
    border: 1px solid var(--surface-dark);
    gap: 8px;
}

.compact-list__row:hover {
    color: var(--ink);
    background: var(--white);
}

.compact-list__row > span:nth-child(2) {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.compact-list__row small {
    overflow: hidden;
    color: var(--muted);
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.compact-list__value {
    font-weight: 800;
}

/* Tables */
.table-scroll {
    width: 100%;
    overflow-x: auto;
    background: var(--white);
    border-top: 1px solid var(--surface-dark);
    scrollbar-color: var(--surface-dark) var(--surface);
}

.data-table {
    width: 100%;
    min-width: 720px;
    border-spacing: 0;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.data-table th,
.data-table td {
    padding: 8px 9px;
    text-align: left;
    vertical-align: middle;
    border-right: 1px solid var(--surface-dark);
    border-bottom: 1px solid var(--surface-dark);
}

.data-table th:last-child,
.data-table td:last-child {
    border-right: 0;
}

.data-table th {
    position: sticky;
    z-index: 2;
    top: 0;
    color: var(--ink);
    font-size: 0.76rem;
    white-space: nowrap;
    background: var(--surface);
    border-top: 1px solid var(--white);
    box-shadow: inset 1px 1px var(--white), inset -1px -1px var(--shadow);
}

.data-table tbody tr:nth-child(even) {
    background: #f2f2f2;
}

.data-table tbody tr:hover:not(.detail-row) {
    background: #dfe9ff;
}

.data-table--compact {
    min-width: 560px;
    font-size: 0.77rem;
}

.data-table--compact th,
.data-table--compact td {
    padding: 6px;
}

.data-table--users {
    min-width: 1180px;
}

.data-table--payments {
    min-width: 1050px;
}

.data-table--audit {
    min-width: 1100px;
}

.detail-row td {
    padding: 4px 8px 8px;
    background: var(--surface-light);
}

.cell-note {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.7rem;
    white-space: nowrap;
}

.money-cell {
    font-weight: 800;
    white-space: nowrap;
}

.error-cell {
    max-width: 320px;
    color: var(--danger);
    overflow-wrap: anywhere;
}

.table-actions {
    width: 1%;
    white-space: nowrap;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 9px;
    gap: 12px;
}

.pagination__status {
    min-width: 70px;
    text-align: center;
}

.badge,
.badge-row {
    display: inline-flex;
    align-items: center;
}

.badge-row {
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    min-height: 22px;
    padding: 2px 7px;
    color: var(--ink);
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    background: var(--surface-light);
    border: 1px solid var(--surface-dark);
}

.badge--active,
.badge--paid,
.badge--success,
.badge--online,
.badge--healthy,
.badge--published {
    color: #064f18;
    background: #d9f2df;
    border-color: #2f8b45;
}

.badge--pending,
.badge--warning,
.badge--waiting_user,
.badge--waiting_for_user,
.badge--provisioning,
.badge--retry,
.badge--running,
.badge--draft {
    color: #5c4300;
    background: #fff1a8;
    border-color: #9b770f;
}

.badge--error,
.badge--failed,
.badge--blocked,
.badge--offline {
    color: #6b0000;
    background: #ffd9d9;
    border-color: #a80000;
}

.badge--new,
.badge--open,
.badge--in_progress {
    color: #00006b;
    background: #dce7ff;
    border-color: #254b9b;
}

.badge--expired,
.badge--none,
.badge--disabled,
.badge--refunded,
.badge--archived,
.badge--closed,
.badge--resolved,
.badge--cancelled,
.badge--partially_refunded,
.badge--maintenance,
.badge--unknown,
.badge--suspended {
    color: #3d3d3d;
    background: #e4e4e4;
    border-color: #777;
}

.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
    background: #777;
    border: 1px solid var(--ink);
    border-radius: 50%;
    box-shadow: inset 1px 1px rgba(255, 255, 255, 0.7);
}

.status-dot--online,
.status-dot--healthy,
.status-dot--active {
    background: #19a43b;
}

.status-dot--offline,
.status-dot--error {
    background: #cf2424;
}

.status-dot--degraded,
.status-dot--warning {
    background: #e9c514;
}

.text-muted {
    color: var(--muted);
}

.text-danger {
    color: var(--danger);
    font-weight: 700;
}

/* User details */
.breadcrumb {
    display: flex;
    margin-bottom: 8px;
    padding: 5px 8px;
    color: var(--ink);
    background: var(--surface-light);
    border: 2px solid;
    border-color: var(--border-raised);
    gap: 7px;
}

.profile-hero {
    margin-bottom: 12px;
}

.profile-hero__body {
    display: flex;
    align-items: center;
    padding: 15px;
    gap: 15px;
}

.profile-hero__identity {
    min-width: 0;
}

.profile-hero__identity h1 {
    overflow-wrap: anywhere;
}

.profile-hero__identity p:not(.eyebrow) {
    margin-bottom: 7px;
}

.profile-hero__actions {
    display: flex;
    align-items: stretch;
    margin-left: auto;
    flex-direction: column;
    gap: 7px;
}

.profile-hero__actions form,
.profile-hero__actions .button {
    width: 100%;
}

.avatar {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    object-fit: cover;
    color: var(--white);
    font-weight: 800;
    background: var(--title);
    border: 2px solid;
    border-color: var(--border-raised);
    box-shadow: 1px 1px var(--shadow);
}

.avatar--large {
    width: 88px;
    height: 88px;
    font-size: 1.8rem;
}

.avatar--small {
    width: 36px;
    height: 36px;
    font-size: 0.82rem;
}

.avatar--tiny {
    width: 28px;
    height: 28px;
    font-size: 0.68rem;
}

.avatar--initials {
    text-transform: uppercase;
}

.user-cell {
    display: flex;
    min-width: 185px;
    align-items: center;
    gap: 8px;
}

.user-cell > span:last-child {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.user-cell small {
    color: var(--muted);
}

.metric-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    margin-bottom: 13px;
    padding: 5px;
    background: var(--surface);
    border: 2px solid;
    border-color: var(--border-raised);
    box-shadow: 1px 1px var(--shadow);
    gap: 5px;
}

.metric {
    display: flex;
    min-height: 68px;
    justify-content: center;
    padding: 8px;
    flex-direction: column;
}

.metric > span {
    color: var(--muted);
    font-size: 0.72rem;
}

.metric > strong {
    font-size: 1.25rem;
}

.metric > small {
    color: var(--muted);
    font-size: 0.68rem;
}

.metric__small-value {
    font-size: 0.92rem !important;
}

.property-list {
    margin: 0;
}

.property-list > div {
    display: grid;
    grid-template-columns: minmax(110px, 0.8fr) minmax(0, 1.2fr);
    padding: 7px 0;
    border-bottom: 1px dotted var(--surface-dark);
    gap: 8px;
}

.property-list > div:last-child {
    border-bottom: 0;
}

.property-list dt {
    color: var(--muted);
}

.property-list dd {
    min-width: 0;
    margin: 0;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.property-list--compact > div {
    padding: 5px 0;
}

.separated-form {
    margin-top: 13px;
    padding-top: 12px;
    border-top: 1px solid var(--surface-dark);
}

/* Disclosure, nodes and plans */
details > summary {
    cursor: pointer;
}

.disclosure-window > summary {
    list-style: none;
}

.disclosure-window > summary::-webkit-details-marker,
.nested-details > summary::-webkit-details-marker {
    display: none;
}

.summary-marker {
    font-weight: 800;
    transition: transform 120ms ease;
}

.disclosure-window[open] .summary-marker {
    transform: rotate(180deg);
}

.server-grid,
.plan-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 13px;
}

.server-card,
.plan-card {
    min-width: 0;
    margin-bottom: 3px;
}

.server-card__body,
.plan-card__body {
    padding: 12px;
}

.server-card__headline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 9px;
    gap: 8px;
}

.server-card__headline > div {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.server-card__headline code {
    color: var(--muted);
    font-size: 0.76rem;
}

.server-metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 9px 0;
    gap: 4px;
}

.server-metrics > div {
    display: flex;
    min-width: 0;
    padding: 6px;
    flex-direction: column;
    text-align: center;
    background: var(--surface-light);
    border: 1px solid var(--surface-dark);
}

.server-metrics dt {
    color: var(--muted);
    font-size: 0.66rem;
}

.server-metrics dd {
    margin: 2px 0 0;
    overflow: hidden;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.progress {
    height: 19px;
    margin: 8px 0 11px;
    padding: 2px;
    background: var(--white);
    border: 2px solid;
    border-color: var(--border-sunken);
}

.progress > span {
    display: block;
    width: min(var(--progress, 0%), 100%);
    height: 100%;
    background: repeating-linear-gradient(90deg, var(--title) 0 9px, transparent 9px 11px);
}

.server-card__actions {
    margin: 11px 0;
}

.nested-details {
    margin-top: 8px;
    border: 1px solid var(--surface-dark);
}

.nested-details > summary {
    padding: 7px 9px;
    font-weight: 700;
    list-style: none;
    background: var(--surface-light);
}

.nested-details > summary::before {
    display: inline-block;
    width: 15px;
    content: "+";
}

.nested-details[open] > summary::before {
    content: "−";
}

.nested-details__body {
    padding: 11px;
    border-top: 1px solid var(--surface-dark);
}

.danger-zone {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 10px;
    padding: 8px;
    color: var(--danger);
    background: #f7dddd;
    border: 1px solid var(--danger);
    gap: 8px;
}

.plan-card.is-muted {
    filter: saturate(0.5);
}

.plan-card__price {
    display: flex;
    align-items: baseline;
    margin-bottom: 8px;
    gap: 6px;
}

.plan-card__price strong {
    color: var(--title);
    font-size: 1.8rem;
}

.plan-card__price span {
    color: var(--muted);
}

.feature-list {
    display: grid;
    margin: 12px 0;
    padding: 0;
    list-style: none;
    gap: 5px;
}

.feature-list span {
    color: var(--success);
    font-weight: 800;
}

.plan-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding: 7px;
}

.plan-card .badge-row {
    justify-content: space-between;
    width: 100%;
    margin-bottom: 10px;
}

/* Support */
.support-layout,
.agreements-layout {
    display: grid;
    grid-template-columns: minmax(280px, 0.85fr) minmax(430px, 1.6fr);
    align-items: start;
    gap: 12px;
}

.ticket-list,
.conversation,
.agreement-list,
.agreement-preview {
    min-width: 0;
}

.ticket-list__body,
.agreement-list__body {
    max-height: 690px;
    overflow-y: auto;
    background: var(--white);
    border: 2px solid;
    border-color: var(--border-sunken);
}

.ticket-item,
.agreement-item {
    display: flex;
    padding: 9px;
    color: var(--ink);
    flex-direction: column;
    text-decoration: none;
    border-bottom: 1px solid var(--surface-dark);
    gap: 3px;
}

.ticket-item:hover,
.agreement-item:hover {
    color: var(--ink);
    background: #e7edff;
}

.ticket-item.is-selected,
.agreement-item.is-selected {
    color: var(--white);
    background: var(--title);
}

.ticket-item.is-selected .badge,
.agreement-item.is-selected .badge {
    color: var(--ink);
}

.ticket-item.is-selected small,
.ticket-item.is-selected .ticket-item__preview,
.agreement-item.is-selected small {
    color: var(--white);
}

.ticket-item__line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-width: 0;
    gap: 7px;
}

.ticket-item__line strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-item__line time,
.ticket-item__preview {
    color: var(--muted);
    font-size: 0.72rem;
}

.ticket-item__preview {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.conversation__meta,
.agreement-preview__toolbar {
    display: flex;
    flex-wrap: wrap;
    padding: 8px 10px;
    background: var(--surface-light);
    border-bottom: 1px solid var(--surface-dark);
    gap: 8px 18px;
}

.conversation__messages {
    display: flex;
    max-height: 480px;
    min-height: 260px;
    padding: 12px;
    overflow-y: auto;
    flex-direction: column;
    background: var(--white);
    border: 2px solid;
    border-color: var(--border-sunken);
    gap: 9px;
}

.message-bubble {
    width: min(82%, 680px);
    padding: 8px;
    background: #f1f1f1;
    border: 1px solid var(--surface-dark);
    box-shadow: 1px 1px var(--surface-dark);
}

.message-bubble--admin {
    align-self: flex-end;
    background: #dfe8ff;
    border-color: #7387bb;
}

.message-bubble header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    font-size: 0.72rem;
    gap: 8px;
}

.message-bubble header time {
    color: var(--muted);
}

.message-bubble__text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.reply-form {
    display: flex;
    padding: 10px;
    flex-direction: column;
    gap: 6px;
}

.reply-form__footer,
.conversation__actions form {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conversation__actions {
    padding: 0 10px 10px;
}

.conversation__actions label {
    white-space: nowrap;
}

.conversation__actions select {
    min-width: 180px;
}

/* Agreements and audit */
.agreement-item > span:first-child {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
}

.agreement-preview > .inline-alert {
    margin: 10px 10px 0;
}

.document-preview {
    max-height: 650px;
    min-height: 320px;
    padding: 18px;
    overflow-y: auto;
    line-height: 1.58;
    background: var(--white);
    border: 2px solid;
    border-color: var(--border-sunken);
}

.document-preview h1,
.document-preview h2,
.document-preview h3 {
    color: var(--title);
}

.document-preview table {
    border-collapse: collapse;
}

.document-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.document-preview th,
.document-preview td {
    padding: 5px;
    border: 1px solid var(--surface-dark);
}

.agreement-preview__actions {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
    gap: 8px;
}

.inline-details summary {
    color: var(--title);
    text-decoration: underline;
}

.inline-details pre {
    width: min(430px, 70vw);
    max-height: 220px;
    margin: 5px 0 0;
    padding: 7px;
    overflow: auto;
    white-space: pre-wrap;
    background: var(--white);
    border: 1px solid var(--surface-dark);
}

/* Login */
.login-screen {
    display: grid;
    min-height: 100vh;
    padding: 24px;
    place-content: center;
}

.login-window {
    width: min(590px, calc(100vw - 32px));
}

.login-window__body {
    display: grid;
    grid-template-columns: 95px minmax(0, 1fr);
    padding: 24px;
    gap: 20px;
}

.login-emblem {
    display: grid;
    width: 82px;
    height: 82px;
    place-items: center;
    color: var(--white);
    font-size: 2.3rem;
    font-weight: 900;
    font-style: italic;
    background: linear-gradient(135deg, var(--title), var(--title-light));
    border: 3px solid;
    border-color: var(--border-raised);
    box-shadow: 2px 2px var(--shadow);
    text-shadow: 2px 2px var(--ink);
}

.login-copy > p {
    color: var(--muted);
}

.login-copy .flash {
    margin-bottom: 12px;
}

.login-note {
    margin: 13px 0 0;
    color: var(--white);
    font-size: 0.75rem;
    text-align: center;
    text-shadow: 1px 1px var(--shadow);
}

/* Responsive */
@media (max-width: 1180px) {
    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .server-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .desktop {
        padding: 5px 5px calc(var(--taskbar-height) + 7px);
    }

    .admin-layout {
        grid-template-columns: 1fr;
    }

    .nav-toggle {
        display: inline-flex;
    }

    .sidebar {
        position: relative;
        top: 0;
        display: none;
        min-height: 0;
    }

    .sidebar.is-open {
        display: block;
    }

    .nav-tree {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar__status {
        display: none;
    }

    .dashboard-grid,
    .detail-grid,
    .support-layout,
    .agreements-layout {
        grid-template-columns: 1fr;
    }

    .ticket-list__body,
    .agreement-list__body {
        max-height: 340px;
    }

    .plan-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    :root {
        --taskbar-height: 42px;
    }

    html {
        font-size: 13px;
    }

    .app-header__toolbar {
        flex-wrap: wrap;
    }

    .brand-line small,
    .session-user {
        display: none;
    }

    .header-session {
        margin-left: auto;
    }

    .page-heading {
        align-items: stretch;
        padding: 11px;
        flex-direction: column;
    }

    .page-heading__actions,
    .page-heading__actions .button {
        width: 100%;
    }

    .stat-grid {
        grid-template-columns: 1fr 1fr;
    }

    .stat-card__body {
        min-height: 75px;
        padding: 8px;
    }

    .stat-card__icon {
        width: 34px;
        height: 34px;
        font-size: 1.1rem;
    }

    .filter-form {
        align-items: stretch;
        flex-direction: column;
    }

    .filter-form > .field-group:not(.field-group--grow),
    .filter-form > .field-group--grow {
        width: 100%;
        max-width: none;
        flex-basis: auto;
    }

    .filter-form__actions,
    .filter-form__actions .button {
        width: 100%;
    }

    .form-grid,
    .split-fields {
        grid-template-columns: 1fr;
    }

    .form-grid__wide {
        grid-column: auto;
    }

    .profile-hero__body {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .profile-hero__actions {
        width: 100%;
        margin-left: 0;
        flex-direction: row;
    }

    .metric-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .server-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .message-bubble {
        width: 94%;
    }

    .reply-form__footer,
    .conversation__actions form {
        align-items: stretch;
        flex-direction: column;
    }

    .conversation__actions select,
    .conversation__actions .button {
        width: 100%;
    }

    .login-screen {
        padding: 12px;
    }

    .login-window__body {
        grid-template-columns: 1fr;
        padding: 17px;
    }

    .login-emblem {
        width: 58px;
        height: 58px;
        font-size: 1.5rem;
    }

    .taskbar__app {
        display: none;
    }

    .nav-tree {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 420px) {
    .stat-grid,
    .metric-strip {
        grid-template-columns: 1fr;
    }

    .profile-hero__body {
        flex-direction: column;
    }

    .profile-hero__actions {
        flex-direction: column;
    }

    .password-field,
    .copy-field {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media print {
    body {
        background: var(--white) !important;
    }

    .app-header,
    .sidebar,
    .taskbar,
    .page-heading__actions,
    .filter-window,
    .button,
    form {
        display: none !important;
    }

    .desktop,
    .main-column {
        padding: 0;
    }

    .admin-layout {
        display: block;
    }

    .window,
    .page-heading {
        box-shadow: none;
    }
}
