:root {
    --bg: #f5f7f8;
    --surface: #ffffff;
    --surface-2: #eef3f4;
    --ink: #172026;
    --muted: #66737d;
    --line: #dbe2e5;
    --accent: #1e776f;
    --accent-dark: #155b55;
    --warning: #a36200;
    --danger: #b42318;
    --ok: #237a3b;
    --shadow: 0 12px 32px rgba(23, 32, 38, 0.08);
}

html[data-theme="dark"] {
    --bg: #11181d;
    --surface: #182229;
    --surface-2: #223039;
    --ink: #edf3f5;
    --muted: #9fb0ba;
    --line: #33434d;
    --accent: #42b9aa;
    --accent-dark: #86ddd2;
    --warning: #f0bd64;
    --danger: #ff8c82;
    --ok: #7fd694;
    --shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

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

input[type="checkbox"] {
    width: auto;
    min-height: auto;
}

.checkbox-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--ink);
    font-size: 0.92rem;
    font-weight: 700;
    margin: 0;
}

.checkbox-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fbfcfc;
}

.checkbox-grid .checkbox-line {
    min-width: 0;
}

.checkbox-grid .checkbox-line span {
    overflow-wrap: anywhere;
}

.permission-grid {
    background: var(--surface-2);
}

.topbar {
    background: #172026;
    color: #fff;
    border-bottom: 4px solid var(--accent);
}

.topbar-inner,
.layout {
    max-width: 1480px;
    margin: 0 auto;
    padding-left: 28px;
    padding-right: 28px;
}

.topbar-inner {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

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

.brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #36a395, #e6b450);
    display: grid;
    place-items: center;
    color: #172026;
    font-weight: 800;
}

.brand h1 {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.1;
}

.brand span {
    display: block;
    color: #b8c4ca;
    font-size: 0.8rem;
    margin-top: 2px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.nav a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    border-radius: 7px;
    padding: 7px 11px;
    color: #c9d3d7;
    font-weight: 700;
}

.nav .nav-icon-button {
    width: 36px;
    min-height: 36px;
    padding: 0;
    display: inline-grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1;
}

.nav a.active,
.nav a:hover {
    background: rgba(255, 255, 255, 0.11);
    color: #fff;
}

.logout-form {
    margin: 0;
}

.logout-form button {
    cursor: pointer;
}

.logout-form button:hover,
.nav .nav-icon-button:hover,
.nav .nav-icon-button.active {
    background: rgba(255, 255, 255, 0.11);
    color: #fff;
}

.theme-toggle {
    width: 36px;
    min-height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 7px;
    padding: 0;
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
    font-weight: 800;
    line-height: 1;
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
}

.theme-icon {
    display: block;
}

.icon-svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.theme-icon-light {
    display: none;
}

html[data-theme="dark"] .theme-icon-dark {
    display: none;
}

html[data-theme="dark"] .theme-icon-light {
    display: inline;
}

.layout {
    padding-top: 24px;
    padding-bottom: 42px;
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: var(--bg);
}

.auth-card {
    width: min(100%, 420px);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.auth-brand {
    color: var(--ink);
    margin-bottom: 18px;
}

.auth-brand span {
    color: var(--muted);
}

.auth-card h2 {
    margin: 0 0 16px;
    font-size: 1.35rem;
}

.full-width {
    width: 100%;
}

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

.page-head h2 {
    margin: 0;
    font-size: 1.45rem;
}

.page-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.notice {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-left: 4px solid var(--accent);
    background: var(--surface);
    border-radius: 8px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

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

.grid {
    display: grid;
    gap: 14px;
}

.stats {
    grid-template-columns: repeat(4, minmax(160px, 1fr));
    margin-bottom: 18px;
}

.stat,
.panel,
.toolbar,
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.stat {
    min-height: 92px;
    padding: 14px;
}

.stat span,
.subtle {
    color: var(--muted);
    font-size: 0.84rem;
}

.stat strong {
    display: block;
    font-size: 1.65rem;
    line-height: 1.1;
    margin-top: 8px;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 430px;
    gap: 18px;
    align-items: start;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
    gap: 18px;
    align-items: start;
}

.dashboard-tabs-panel {
    overflow: hidden;
}

.tabs {
    display: flex;
    gap: 6px;
    padding: 10px;
    border-bottom: 1px solid var(--line);
    background: #f9fbfb;
    overflow-x: auto;
}

.tab-link {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 8px 12px;
    color: var(--muted);
    font-weight: 800;
    white-space: nowrap;
}

.tab-link.active,
.tab-link:hover {
    border-color: #bde1dc;
    background: #edf7f5;
    color: var(--accent-dark);
}

.tab-panel[hidden] {
    display: none;
}

.spend-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(160px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.spend-summary > div {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfc;
    padding: 12px;
}

.spend-summary span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 800;
}

.spend-summary strong {
    display: block;
    margin-top: 5px;
    font-size: 1.25rem;
}

.toolbar,
.panel-body {
    padding: 14px;
}

.panel-head {
    padding: 14px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.panel-head h3 {
    margin: 0;
    font-size: 1rem;
}

label {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.required-mark {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    background: #fff7e8;
    border: 1px solid #f1d099;
    color: var(--warning);
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    border: 1px solid #cbd5da;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    padding: 9px 10px;
}

input:disabled,
select:disabled,
textarea:disabled {
    background: #e7ecef;
    border-color: #b7c3ca;
    color: #7a8790;
    cursor: not-allowed;
    opacity: 1;
}

input:disabled::placeholder,
textarea:disabled::placeholder {
    color: #9ba7ae;
}

input[required]:not([disabled]),
select[required]:not([disabled]),
textarea[required]:not([disabled]) {
    border-left: 4px solid #e6b450;
    padding-left: 7px;
}

select[multiple] {
    min-height: 118px;
}

textarea {
    min-height: 96px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid rgba(30, 119, 111, 0.18);
    border-color: var(--accent);
}

.filters,
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.filters {
    grid-template-columns: minmax(220px, 1fr) 210px 210px auto;
    align-items: end;
}

.log-search-form {
    grid-template-columns: minmax(260px, 1fr) auto auto;
}

.full {
    grid-column: 1 / -1;
}

.resource-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.cost-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    align-items: start;
}

.ghost-field {
    visibility: hidden;
    pointer-events: none;
}

.field-help {
    margin-top: 6px;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.35;
}

.multi-picker {
    position: relative;
}

.multi-picker-control {
    width: 100%;
    min-height: 40px;
    border: 1px solid #cbd5da;
    border-radius: 7px;
    background: #fff;
    color: var(--ink);
    padding: 5px 8px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    cursor: pointer;
}

.multi-picker-control:focus {
    outline: 3px solid rgba(30, 119, 111, 0.18);
    border-color: var(--accent);
}

.multi-picker-values {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    min-width: 0;
}

.multi-picker-placeholder {
    color: var(--muted);
    padding: 4px 2px;
}

.multi-picker-pill {
    min-height: 26px;
    border: 1px solid #bde1dc;
    border-radius: 999px;
    background: #edf7f5;
    color: var(--accent-dark);
    padding: 2px 8px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.multi-picker-menu {
    position: absolute;
    z-index: 30;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 220px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--surface);
    box-shadow: 0 16px 36px rgba(23, 32, 38, 0.18);
    padding: 6px;
}

.multi-picker-option {
    width: 100%;
    min-height: 34px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--ink);
    padding: 7px 8px;
    text-align: left;
    cursor: pointer;
}

.multi-picker-option:hover,
.multi-picker-option[aria-selected="true"] {
    background: #edf7f5;
    color: var(--accent-dark);
}

.relationship-section-title {
    margin-bottom: 8px;
}

.link-context-grid {
    display: grid;
    grid-template-columns: minmax(180px, 0.75fr) minmax(0, 1.25fr);
    gap: 12px;
}

.relationship-rows {
    display: grid;
    gap: 8px;
}

.relationship-row {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 10px;
}

.relationship-row-grid {
    display: grid;
    grid-template-columns: minmax(160px, 0.55fr) minmax(0, 1fr) 88px;
    gap: 10px;
    align-items: start;
}

.relationship-row-actions {
    display: flex;
    justify-content: flex-end;
    align-items: flex-start;
    gap: 6px;
    padding-top: 22px;
}

.relationship-row select[multiple] {
    min-height: 74px;
}

.relationship-row label {
    margin-bottom: 5px;
}

.icon-button {
    width: 38px;
    height: 38px;
    border: 1px solid transparent;
    border-radius: 7px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1;
}

.icon-button.secondary {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--ink);
}

.icon-button.danger {
    background: #fff3f1;
    border-color: #f2b8b1;
    color: var(--danger);
}

.link-context-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 10px;
}

.button {
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 7px;
    padding: 9px 13px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 700;
    white-space: nowrap;
}

.button.primary {
    background: var(--accent);
    color: #fff;
}

.button.primary:hover {
    background: var(--accent-dark);
}

.button.secondary {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--ink);
}

.button.danger {
    background: #fff3f1;
    border-color: #f2b8b1;
    color: var(--danger);
}

.button.disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.table-wrap {
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

.roles-table {
    table-layout: fixed;
}

.roles-table-role {
    width: 28%;
}

.roles-table-actions {
    width: 132px;
}

.roles-table td:last-child,
.roles-table th:last-child {
    white-space: nowrap;
}

.roles-table td:nth-child(2) {
    overflow-wrap: anywhere;
}

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

th {
    background: #f9fbfb;
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0;
}

tr:last-child td {
    border-bottom: 0;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: #f7fbfa;
}

.resource-name {
    font-weight: 800;
    display: block;
}

.pill {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #edf7f5;
    color: var(--accent-dark);
    border: 1px solid #bde1dc;
    font-size: 0.78rem;
    font-weight: 800;
    white-space: nowrap;
}

.pill.warning {
    background: #fff7e8;
    color: var(--warning);
    border-color: #f1d099;
}

.pill.danger {
    background: #fff3f1;
    color: var(--danger);
    border-color: #f2b8b1;
}

.row-actions,
.form-actions,
.period-form,
.pagination {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.row-actions .button {
    min-height: 32px;
    padding: 6px 9px;
}

.table-actions {
    flex-wrap: nowrap;
}

.renew-actions {
    justify-content: flex-end;
}

.profile-actions,
.role-delete-row {
    justify-content: flex-end;
}

.profile-section {
    margin-top: 16px;
}

.role-delete-row {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.link-clear-button {
    margin-top: 8px;
}

.period-form {
    justify-content: flex-end;
}

.period-form > div {
    min-width: 190px;
}

.pagination {
    justify-content: flex-end;
}

.pagination .button.disabled {
    pointer-events: none;
}

.pagination .page-number.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pagination-status {
    color: var(--muted);
    font-weight: 700;
}

.active-row td {
    background: #edf7f5;
    font-weight: 700;
}

.side-stack,
.list {
    display: grid;
    gap: 14px;
}

.detail-row {
    display: grid;
    grid-template-columns: 0.8fr 1fr auto;
    gap: 8px;
    margin-bottom: 8px;
}

.detail-row .button {
    min-height: 40px;
}

.mini-item {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    background: #fbfcfc;
}

.split-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.split-item a {
    min-width: 0;
}

.split-item .button {
    min-height: 32px;
    padding: 6px 9px;
}

.resource-title-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 2px;
}

.expiry-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 28px;
    padding: 4px 9px;
    border: 1px solid #bde1dc;
    border-radius: 999px;
    background: #edf7f5;
    color: var(--accent-dark);
    font-size: 0.78rem;
    font-weight: 900;
    line-height: 1.15;
    white-space: nowrap;
}

.expiry-pill span {
    font-weight: 900;
}

.expiry-pill strong {
    font-size: 0.72rem;
}

.expiry-pill.warning {
    border-color: #f1d099;
    background: #fff7e8;
    color: var(--warning);
}

.expiry-pill.danger {
    border-color: #f2b8b1;
    background: #fff3f1;
    color: var(--danger);
}

.expiry-bubbles {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.expiry-bubble {
    width: 34px;
    height: 34px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    font-size: 0.86rem;
    font-weight: 900;
}

.expiry-bubble.danger {
    background: #fff3f1;
    border-color: #f2b8b1;
    color: var(--danger);
}

.expiry-bubble.warning {
    background: #fff7e8;
    border-color: #f1d099;
    color: var(--warning);
}

.expiry-bubble.safe {
    background: #eef8f6;
    border-color: #b9d8d4;
    color: #1c5f58;
}

.detail-list dl {
    margin: 0;
    display: grid;
    grid-template-columns: 128px minmax(0, 1fr) 128px minmax(0, 1fr);
    gap: 7px 10px;
}

.detail-list dt {
    color: var(--muted);
    font-weight: 700;
}

.detail-list dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.empty {
    padding: 28px;
    text-align: center;
    color: var(--muted);
}

.enum-group {
    display: grid;
    grid-template-columns: minmax(220px, 0.35fr) minmax(0, 0.65fr);
    gap: 14px;
}

.settings-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.settings-layout > * {
    min-width: 0;
}

.settings-sidebar {
    position: sticky;
    top: 16px;
}

.settings-expiry-panel {
    margin-bottom: 18px;
}

.expiry-settings-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
    gap: 12px;
    align-items: start;
}

.expiry-settings-form .button {
    align-self: start;
    margin-top: 27px;
}

.compact-form,
.inline-add-form {
    display: grid;
    gap: 10px;
}

.inline-add-form {
    grid-template-columns: minmax(220px, 1fr) 180px auto;
    align-items: end;
    margin-bottom: 14px;
}

.meta-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.meta-list-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfc;
    padding: 8px;
}

.meta-list-row.active {
    border-color: #9cd4cc;
    background: #edf7f5;
}

.meta-list-row a {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.meta-list-row strong {
    overflow-wrap: anywhere;
}

.meta-list-row span {
    color: var(--muted);
    font-size: 0.8rem;
}

.meta-list-row .button {
    min-height: 32px;
    padding: 6px 9px;
}

.meta-description {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfc;
    padding: 12px;
    margin-bottom: 14px;
}

.meta-description strong {
    display: block;
    margin-bottom: 4px;
}

.meta-description p {
    margin: 0;
    color: var(--muted);
}

.settings-table input,
.settings-table select {
    min-width: 110px;
}

.drag-column,
.drag-cell {
    width: 72px;
    text-align: center;
}

.drag-handle {
    width: 36px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #f2f5f6;
    color: var(--muted);
    cursor: grab;
    font-weight: 900;
}

.drag-handle:active {
    cursor: grabbing;
}

.settings-table tr[draggable="true"] {
    cursor: grab;
}

.settings-table tr.dragging {
    opacity: 0.45;
}

.settings-order-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    background: #f2f5f6;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 2px 5px;
    overflow-wrap: anywhere;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(23, 32, 38, 0.45);
}

.modal-backdrop[hidden] {
    display: none;
}

.modal {
    width: min(560px, 100%);
    max-height: calc(100vh - 36px);
    overflow: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 24px 60px rgba(23, 32, 38, 0.25);
}

.view-modal {
    width: min(980px, 100%);
}

.role-modal {
    width: min(900px, 100%);
}

.permission-pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: flex-start;
    min-width: 0;
}

.permission-pill-list .pill {
    min-height: 24px;
    padding: 2px 8px;
    line-height: 1.25;
    align-self: flex-start;
}

.resource-form-panel {
    max-width: 1040px;
}

.mini-panel {
    display: grid;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.mini-panel:first-child {
    padding-top: 0;
    border-top: 0;
}

.mini-panel h4 {
    margin: 0;
    font-size: 0.95rem;
}

.modal-resource-name {
    min-height: 40px;
    display: flex;
    align-items: center;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fbfcfc;
    font-weight: 800;
}

html[data-theme="dark"] .topbar {
    background: #0b1014;
}

html[data-theme="dark"] .brand span,
html[data-theme="dark"] .nav a {
    color: #b7c7cf;
}

html[data-theme="dark"] .tabs,
html[data-theme="dark"] th,
html[data-theme="dark"] .mini-item,
html[data-theme="dark"] .meta-list-row,
html[data-theme="dark"] .meta-description,
html[data-theme="dark"] .relationship-row,
html[data-theme="dark"] .checkbox-grid,
html[data-theme="dark"] .modal-resource-name,
html[data-theme="dark"] .spend-summary > div {
    background: #1d2830;
}

html[data-theme="dark"] .checkbox-line {
    color: var(--ink);
}

html[data-theme="dark"] input,
html[data-theme="dark"] select,
html[data-theme="dark"] textarea,
html[data-theme="dark"] .multi-picker-control {
    background: #11181d;
    border-color: #40515c;
    color: var(--ink);
}

html[data-theme="dark"] .multi-picker-menu {
    background: #1d2830;
    border-color: #40515c;
}

html[data-theme="dark"] .multi-picker-option:hover,
html[data-theme="dark"] .multi-picker-option[aria-selected="true"],
html[data-theme="dark"] .multi-picker-pill {
    background: #163531;
    border-color: #2e756d;
    color: #9ce5dc;
}

html[data-theme="dark"] .drag-handle {
    background: #26333c;
    border-color: #4b5d68;
    color: #b7c7cf;
}

html[data-theme="dark"] input:disabled,
html[data-theme="dark"] select:disabled,
html[data-theme="dark"] textarea:disabled {
    background: #26333c;
    border-color: #4b5d68;
    color: #9fb0ba;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #788b96;
}

html[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
html[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(1) brightness(1.3);
    opacity: 0.9;
}

html[data-theme="dark"] .button.secondary {
    background: #223039;
    border-color: #40515c;
    color: var(--ink);
}

html[data-theme="dark"] .icon-button.secondary {
    background: #223039;
    border-color: #40515c;
    color: var(--ink);
}

html[data-theme="dark"] .button.danger,
html[data-theme="dark"] .icon-button.danger,
html[data-theme="dark"] .pill.danger,
html[data-theme="dark"] .expiry-pill.danger,
html[data-theme="dark"] .expiry-bubble.danger,
html[data-theme="dark"] .notice.error {
    background: #3a201f;
    border-color: #7b3834;
    color: #ffaaa3;
}

html[data-theme="dark"] .required-mark,
html[data-theme="dark"] .pill.warning,
html[data-theme="dark"] .expiry-pill.warning,
html[data-theme="dark"] .expiry-bubble.warning {
    background: #332819;
    border-color: #76572b;
    color: #f2c578;
}

html[data-theme="dark"] .pill,
html[data-theme="dark"] .expiry-pill,
html[data-theme="dark"] .expiry-bubble.safe,
html[data-theme="dark"] .tab-link.active,
html[data-theme="dark"] .tab-link:hover {
    background: #163531;
    border-color: #2e756d;
    color: #9ce5dc;
}

html[data-theme="dark"] .clickable-row:hover td,
html[data-theme="dark"] .active-row td {
    background: #172f2c;
}

html[data-theme="dark"] .code {
    background: #11181d;
    border-color: #40515c;
}

@media (max-width: 1120px) {
    .workspace,
    .dashboard-grid,
    .enum-group,
    .settings-layout {
        grid-template-columns: 1fr;
    }

    .expiry-settings-form {
        grid-template-columns: 1fr;
    }

    .settings-sidebar {
        position: static;
    }

    .stats {
        grid-template-columns: repeat(2, minmax(160px, 1fr));
    }
}

@media (max-width: 760px) {
    .topbar-inner,
    .layout {
        padding-left: 16px;
        padding-right: 16px;
    }

    .topbar-inner,
    .page-head,
    .period-form,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }

            .filters,
            .detail-row,
            .form-grid,
            .link-context-grid,
            .cost-grid,
            .resource-meta-grid,
            .relationship-row-grid,
            .stats,
            .inline-add-form {
                grid-template-columns: 1fr;
            }

    .relationship-row-actions {
        justify-content: flex-end;
        padding-top: 0;
    }

    .link-context-actions .button {
        width: 100%;
    }

    .split-item {
        grid-template-columns: 1fr;
    }

    .detail-list dl {
        grid-template-columns: 112px minmax(0, 1fr);
    }

    .table-wrap {
        overflow-x: auto;
    }

    table {
        min-width: 840px;
    }
}
