:root {
    color-scheme: light;
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-muted: #f8fafb;
    --text: #20262e;
    --text-soft: #667085;
    --text-faint: #8993a1;
    --border: #d9dee5;
    --border-strong: #c6cdd6;
    --primary: #0f766e;
    --primary-hover: #0b5f59;
    --primary-soft: #e8f5f2;
    --blue: #2563a6;
    --blue-soft: #eaf2fb;
    --green: #25855a;
    --green-soft: #e9f6ef;
    --amber: #b54708;
    --amber-soft: #fff4e5;
    --danger: #b42318;
    --danger-hover: #922018;
    --danger-soft: #fff0ee;
    --sidebar: #18242a;
    --sidebar-text: #d6e0e4;
    --sidebar-soft: #91a4ac;
    --focus: #2f968c;
    --shadow: 0 1px 2px rgba(20, 31, 38, 0.06), 0 3px 10px rgba(20, 31, 38, 0.04);
    --radius: 6px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 16px;
    letter-spacing: 0;
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

[hidden] {
    display: none !important;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-size: 0.875rem;
    line-height: 1.5;
}

button,
input,
textarea,
select {
    color: inherit;
    font: inherit;
    letter-spacing: 0;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 100;
    padding: 8px 12px;
    border-radius: 5px;
    background: #fff;
    color: var(--text);
    box-shadow: var(--shadow);
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

.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;
}

.clipboard-fallback {
    position: fixed;
    top: -1000px;
    left: -1000px;
    width: 1px;
    height: 1px;
}

a {
    color: inherit;
    text-decoration: none;
}

h1,
h2,
h3,
p,
dl,
dd {
    margin: 0;
}

code,
.json-editor {
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

.icon {
    width: 1.1rem;
    height: 1.1rem;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.app-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    display: flex;
    width: 232px;
    flex-direction: column;
    background: var(--sidebar);
    color: var(--sidebar-text);
}

.brand {
    display: flex;
    height: 64px;
    align-items: center;
    gap: 11px;
    padding: 0 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border-radius: 6px;
    background: var(--primary);
    color: #fff;
}

.brand-mark .icon {
    width: 20px;
    height: 20px;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    color: #fff;
    font-size: 0.95rem;
    line-height: 1.1;
}

.brand small {
    margin-top: 3px;
    color: var(--sidebar-soft);
    font-size: 0.72rem;
}

.nav-list {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 4px;
    padding: 18px 10px;
}

.nav-item {
    position: relative;
    display: flex;
    min-height: 42px;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 5px;
    color: var(--sidebar-text);
    font-weight: 550;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
}

.nav-item.is-active {
    background: rgba(27, 152, 140, 0.18);
    color: #fff;
}

.nav-item.is-active::before {
    position: absolute;
    left: 0;
    width: 3px;
    height: 22px;
    border-radius: 0 2px 2px 0;
    background: #41b8aa;
    content: "";
}

.nav-item .icon {
    color: #9fb3ba;
}

.nav-item.is-active .icon {
    color: #58c9bb;
}

.sidebar-account {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 32px;
    align-items: center;
    gap: 9px;
    min-height: 68px;
    padding: 12px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.account-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    place-items: center;
    border: 1px solid #c5d9d5;
    border-radius: 50%;
    background: #e6f2ef;
    color: #146c63;
    font-size: 0.78rem;
    font-weight: 700;
}

.sidebar-account .account-avatar {
    border-color: rgba(255, 255, 255, 0.12);
    background: #2b3b42;
    color: #fff;
}

.account-meta {
    min-width: 0;
}

.account-meta strong,
.account-meta span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-meta strong {
    color: #fff;
    font-size: 0.8rem;
}

.account-meta span {
    color: var(--sidebar-soft);
    font-size: 0.7rem;
}

.sidebar-account .icon-button {
    color: var(--sidebar-soft);
}

.sidebar-account .icon-button:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.main-column {
    grid-column: 2;
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    height: 56px;
    align-items: center;
    gap: 10px;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.96);
}

.topbar-title {
    color: #36404a;
    font-size: 0.82rem;
    font-weight: 650;
}

.environment-badge {
    margin-left: auto;
    padding: 2px 7px;
    border: 1px solid var(--border);
    border-radius: 4px;
    color: var(--text-soft);
    font-size: 0.68rem;
    text-transform: uppercase;
}

.environment-badge:empty {
    display: none;
}

.topbar .menu-button {
    display: none;
}

.content {
    width: 100%;
    max-width: 1440px;
    min-height: calc(100vh - 56px);
    margin: 0 auto;
    padding: 26px 28px 48px;
}

.page-heading {
    display: flex;
    min-height: 52px;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.page-heading h1 {
    color: #20262e;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.25;
}

.page-heading p {
    margin-top: 5px;
    color: var(--text-soft);
    font-size: 0.8rem;
}

.title-extension {
    color: var(--text-faint);
    font-weight: 500;
}

.heading-actions,
.form-actions {
    display: flex;
    align-items: center;
    gap: 9px;
}

.breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 7px;
    color: var(--text-soft);
    font-size: 0.78rem;
}

.breadcrumb:hover,
.text-link:hover {
    color: var(--primary);
}

.breadcrumb .icon {
    width: 14px;
    height: 14px;
}

.button,
.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    cursor: pointer;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button {
    min-height: 38px;
    gap: 7px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
}

.button-primary {
    background: var(--primary);
    color: #fff;
}

.button-primary:hover {
    background: var(--primary-hover);
}

.button-secondary {
    border-color: var(--border-strong);
    background: var(--surface);
    color: #38434e;
}

.button-secondary:hover,
.button-quiet:hover {
    border-color: #aeb8c3;
    background: #f5f7f9;
}

.button-quiet {
    border-color: transparent;
    background: transparent;
    color: var(--text-soft);
}

.button-small {
    min-height: 32px;
    padding: 6px 9px;
    font-size: 0.78rem;
}

.button-full {
    width: 100%;
}

.icon-button {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    padding: 0;
    border-radius: 5px;
    background: transparent;
    color: #5a6673;
}

.icon-button:hover {
    background: #eef2f4;
    color: var(--text);
}

.icon-button-danger {
    color: var(--danger);
}

.icon-button-danger:hover {
    background: var(--danger-soft);
    color: var(--danger-hover);
}

.icon-button-bordered {
    border: 1px solid var(--border-strong);
    background: var(--surface);
}

.button:focus-visible,
.icon-button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    outline: 3px solid rgba(47, 150, 140, 0.25);
    outline-offset: 1px;
}

.surface,
.form-surface {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metrics {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.metric {
    display: flex;
    min-width: 0;
    min-height: 96px;
    align-items: center;
    gap: 13px;
    padding: 17px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric-icon,
.file-mark,
.empty-icon,
.state-icon {
    display: grid;
    place-items: center;
}

.metric-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 6px;
}

.metric-icon-teal {
    background: var(--primary-soft);
    color: var(--primary);
}

.metric-icon-green {
    background: var(--green-soft);
    color: var(--green);
}

.metric-icon-blue {
    background: var(--blue-soft);
    color: var(--blue);
}

.metric-icon-amber {
    background: var(--amber-soft);
    color: var(--amber);
}

.metric div {
    min-width: 0;
}

.metric span,
.metric strong {
    display: block;
}

.metric div > span {
    color: var(--text-soft);
    font-size: 0.76rem;
}

.metric strong {
    margin-top: 2px;
    overflow: hidden;
    color: #1e2830;
    font-size: 1.45rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.metric .metric-time {
    font-size: 1.05rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: 18px;
}

.dashboard-section {
    min-width: 0;
}

.section-heading {
    display: flex;
    min-height: 58px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.section-heading h2 {
    font-size: 0.95rem;
}

.section-heading span {
    color: var(--text-soft);
    font-size: 0.72rem;
}

.text-link {
    color: #376c82;
    font-size: 0.78rem;
    font-weight: 600;
}

.simple-list-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    min-height: 58px;
    align-items: center;
    gap: 10px;
    padding: 9px 16px;
    border-bottom: 1px solid #edf0f2;
}

.simple-list-row:last-child {
    border-bottom: 0;
}

.file-mark {
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    border-radius: 5px;
    background: var(--primary-soft);
    color: var(--primary);
}

.file-mark-neutral {
    background: #eef1f4;
    color: #60707c;
}

.file-mark .icon {
    width: 16px;
    height: 16px;
}

.simple-list-row div {
    min-width: 0;
}

.simple-list-row strong,
.simple-list-row div > span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simple-list-row strong {
    font-size: 0.8rem;
}

.simple-list-row div > span,
.simple-list-row time {
    color: var(--text-soft);
    font-size: 0.7rem;
}

.empty-compact {
    padding: 30px 16px;
    color: var(--text-soft);
    text-align: center;
}

.table-surface {
    overflow: hidden;
}

.table-toolbar {
    display: flex;
    min-height: 58px;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
}

.server-table-toolbar {
    justify-content: space-between;
    flex-wrap: wrap;
}

.table-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.table-filters select {
    min-width: 108px;
    height: 36px;
}

.search-box {
    position: relative;
    width: min(340px, 100%);
}

.search-box .icon {
    position: absolute;
    top: 50%;
    left: 11px;
    width: 16px;
    height: 16px;
    color: var(--text-faint);
    transform: translateY(-50%);
    pointer-events: none;
}

.search-box input {
    width: 100%;
    height: 36px;
    padding: 7px 11px 7px 35px;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: auto;
}

.data-table th,
.data-table td {
    padding: 11px 14px;
    border-bottom: 1px solid #e8ecef;
    vertical-align: middle;
    text-align: left;
}

.data-table th {
    height: 42px;
    background: var(--surface-muted);
    color: #5e6976;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.data-table td {
    min-height: 52px;
    color: #38434e;
    font-size: 0.78rem;
}

.data-table tbody tr:last-child td {
    border-bottom: 0;
}

.data-table tbody tr:hover {
    background: #fbfcfc;
}

.data-table time,
.muted {
    color: var(--text-soft);
}

.action-column {
    width: 116px;
    text-align: right !important;
}

.actions {
    white-space: nowrap;
    text-align: right !important;
}

.actions > a,
.actions > form {
    display: inline-flex;
    vertical-align: middle;
}

.action-group,
.status-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px;
}

.action-group {
    justify-content: flex-end;
}

.action-group > form {
    display: inline-flex;
}

.file-name,
.account-cell,
.url-cell {
    display: flex;
    align-items: center;
}

.file-name {
    gap: 9px;
}

.url-cell {
    min-width: 260px;
    gap: 3px;
}

.url-cell code,
.public-url-row code {
    overflow: hidden;
    color: #3f5964;
    font-size: 0.72rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-cell {
    min-width: 180px;
    gap: 10px;
}

.account-cell div {
    min-width: 0;
}

.account-cell strong,
.account-cell span {
    display: block;
}

.account-cell span {
    color: var(--text-soft);
    font-size: 0.7rem;
}

.status {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    gap: 5px;
    margin: 2px 3px 2px 0;
    padding: 2px 7px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 650;
}

.status i {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-success {
    background: var(--green-soft);
    color: #1c704b;
}

.status-muted {
    background: #edf0f2;
    color: #68747e;
}

.status-warning {
    background: var(--amber-soft);
    color: var(--amber);
}

.status-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.server-endpoint-cell {
    min-width: 150px;
}

.server-endpoint-cell strong,
.server-endpoint-cell span {
    display: block;
}

.server-endpoint-cell span {
    max-width: 240px;
    overflow: hidden;
    color: var(--text-soft);
    font-size: 0.7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.server-address {
    display: inline-block;
    min-width: 145px;
    color: #3f5964;
    font-size: 0.72rem;
    overflow-wrap: anywhere;
}

.server-probe-result {
    display: flex;
    min-width: 132px;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.server-probe-result .muted {
    font-size: 0.68rem;
}

.permission-summary,
.permission-readonly {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
}

.permission-chip,
.permission-more {
    display: inline-flex;
    min-height: 23px;
    align-items: center;
    padding: 2px 7px;
    border: 1px solid #d8e2e4;
    border-radius: 4px;
    background: #f5f9f9;
    color: #37656a;
    font-size: 0.66rem;
    white-space: nowrap;
}

.permission-more {
    border-color: var(--border);
    background: #f4f6f8;
    color: var(--text-soft);
}

.filter-empty {
    padding: 30px 16px;
    border-top: 1px solid var(--border);
    color: var(--text-soft);
    text-align: center;
}

.parameter-table-toolbar {
    justify-content: space-between;
    flex-wrap: wrap;
}

.content-search-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-box-compact {
    width: min(210px, 100%);
}

.select-column {
    width: 44px;
    text-align: center;
}

.select-column input[type="checkbox"] {
    vertical-align: middle;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.bulk-actions[hidden] {
    display: none;
}

.bulk-count {
    color: var(--text-soft);
    font-size: 0.78rem;
    white-space: nowrap;
}

.bulk-count strong {
    color: var(--text);
}

.match-count {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 7px;
    border-radius: 999px;
    background: #eef6f6;
    color: #37656a;
    font-size: 0.66rem;
    white-space: nowrap;
}

.notice-block {
    margin-bottom: 16px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f7f9fa;
}

.notice-block h2 {
    margin: 0 0 8px;
    font-size: 0.86rem;
}

.notice-block ul {
    margin: 0;
    padding-left: 18px;
    color: var(--text-soft);
    font-size: 0.76rem;
    line-height: 1.7;
}

.notice-block code {
    padding: 1px 5px;
    border-radius: 4px;
    background: #e9eef0;
    font-size: 0.72rem;
}

.notice-example {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    color: var(--text-soft);
    font-size: 0.72rem;
}

.notice-example code {
    padding: 4px 8px;
}

.bulk-target-list {
    max-height: 240px;
    margin: 0 0 14px;
    padding: 0;
    overflow-y: auto;
    list-style: none;
    font-size: 0.78rem;
}

.bulk-target-list li {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 5px 0;
    border-bottom: 1px solid var(--border);
}

.bulk-target-list li:last-child {
    border-bottom: none;
}

.bulk-target-list a {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.empty-state,
.state-page {
    display: flex;
    min-height: 260px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 40px 20px;
    text-align: center;
}

.empty-icon,
.state-icon {
    width: 54px;
    height: 54px;
    margin-bottom: 14px;
    border-radius: 8px;
    background: #eef3f4;
    color: #53747a;
}

.empty-icon .icon,
.state-icon .icon {
    width: 26px;
    height: 26px;
}

.empty-state h2,
.state-page h1 {
    font-size: 1.05rem;
}

.empty-state p,
.state-page p {
    margin: 5px 0 16px;
    color: var(--text-soft);
}

.state-icon-error {
    background: var(--danger-soft);
    color: var(--danger);
}

.state-icon-warning {
    background: var(--amber-soft);
    color: var(--amber);
}

.state-page code {
    margin: 0 0 18px;
    padding: 5px 8px;
    border-radius: 4px;
    background: #edf0f2;
    color: #53606c;
    font-size: 0.72rem;
}

.field {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 6px;
}

.field label {
    color: #3d4854;
    font-size: 0.78rem;
    font-weight: 650;
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--border-strong);
    border-radius: 5px;
    background: #fff;
}

input {
    height: 40px;
    padding: 8px 11px;
}

input:disabled {
    background: #f2f4f6;
    color: var(--text-soft);
}

input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.field-error {
    min-height: 0;
    color: var(--danger);
    font-size: 0.72rem;
}

.field-error:empty {
    display: none;
}

.field-hint {
    color: var(--text-soft);
    font-size: 0.7rem;
}

.validation-summary {
    margin-bottom: 16px;
    padding: 10px 12px;
    border: 1px solid #f0c4bf;
    border-radius: 5px;
    background: var(--danger-soft);
    color: #88241c;
    font-size: 0.78rem;
}

.validation-summary:empty,
.validation-summary-valid {
    display: none;
}

.validation-summary ul {
    margin: 0;
    padding-left: 18px;
}

.form-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-surface {
    padding: 22px;
}

.form-narrow {
    width: min(520px, 100%);
}

.form-page {
    max-width: 1040px;
}

.form-section {
    padding: 4px 0 25px;
    border-bottom: 1px solid var(--border);
}

.form-section + .form-section {
    padding-top: 25px;
}

.form-section header {
    margin-bottom: 16px;
}

.form-section h2,
.editor-actions h2 {
    font-size: 0.95rem;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.announcement-content-field {
    margin-top: 18px;
}

.sticky-actions {
    justify-content: flex-end;
    padding-top: 18px;
}

.check-row,
.toggle-row,
.permission-option {
    cursor: pointer;
}

.compact-check {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-soft);
    font-size: 0.76rem;
}

.compact-check input {
    width: 15px;
    height: 15px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
    align-self: end;
    min-height: 40px;
}

.toggle-row > input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.toggle {
    position: relative;
    width: 38px;
    height: 22px;
    flex: 0 0 38px;
    border-radius: 11px;
    background: #aeb7c0;
    transition: background-color 120ms ease;
}

.toggle i {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    transition: transform 120ms ease;
}

.toggle-row > input:checked + .toggle {
    background: var(--primary);
}

.toggle-row > input:checked + .toggle i {
    transform: translateX(16px);
}

.toggle-row > input:focus-visible + .toggle {
    outline: 3px solid rgba(47, 150, 140, 0.25);
    outline-offset: 2px;
}

.toggle-row > span:last-child strong,
.toggle-row > span:last-child small {
    display: block;
}

.toggle-row > span:last-child strong {
    font-size: 0.78rem;
}

.toggle-row > span:last-child small {
    color: var(--text-soft);
    font-size: 0.68rem;
}

.toggle-row.is-disabled {
    cursor: not-allowed;
    opacity: 0.62;
}

.permission-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.permission-option {
    position: relative;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    min-height: 58px;
    align-items: center;
    gap: 9px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
}

.permission-option:hover {
    border-color: #aab9bd;
    background: #fbfcfc;
}

.permission-option > input {
    position: absolute;
    opacity: 0;
}

.permission-check {
    display: grid;
    width: 19px;
    height: 19px;
    place-items: center;
    border: 1px solid #abb6c0;
    border-radius: 4px;
    color: transparent;
}

.permission-check .icon {
    width: 13px;
    height: 13px;
    stroke-width: 3;
}

.permission-option > input:checked + .permission-check {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
}

.permission-option > input:focus-visible + .permission-check {
    outline: 3px solid rgba(47, 150, 140, 0.25);
    outline-offset: 2px;
}

.permission-option strong,
.permission-option small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.permission-option strong {
    font-size: 0.76rem;
}

.permission-option small {
    color: var(--text-soft);
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.65rem;
}

.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 250px;
    align-items: start;
    gap: 16px;
}

.editor-main {
    min-width: 0;
    overflow: hidden;
    padding: 16px;
}

.field-inline-label {
    display: grid;
    grid-template-columns: 100px minmax(0, 420px);
    align-items: start;
    margin-bottom: 16px;
}

.field-inline-label > label {
    padding-top: 10px;
}

.file-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
}

.file-input input {
    border-radius: 5px 0 0 5px;
}

.file-input span {
    display: flex;
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-left: 0;
    border-radius: 0 5px 5px 0;
    background: #f2f4f6;
    color: var(--text-soft);
    font-family: "Cascadia Code", Consolas, monospace;
}

.editor-toolbar,
.public-url-row {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border: 1px solid var(--border);
    background: var(--surface-muted);
}

.editor-toolbar {
    padding: 4px 7px 4px 12px;
    border-radius: 5px 5px 0 0;
}

.editor-toolbar > span,
.public-url-row > span {
    color: #53606c;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.editor-toolbar > div {
    display: flex;
    gap: 2px;
}

.public-url-row {
    justify-content: flex-start;
    margin-bottom: 12px;
    padding: 8px 12px;
    border-radius: 5px;
}

.public-url-row code {
    margin-left: 8px;
}

.json-editor {
    display: block;
    width: 100%;
    min-height: 540px;
    resize: vertical;
    padding: 14px 16px;
    border-top: 0;
    border-radius: 0 0 5px 5px;
    background: #fbfcfd;
    color: #21333d;
    font-size: 0.82rem;
    line-height: 1.65;
    tab-size: 2;
    white-space: pre;
}

.editor-status {
    min-height: 29px;
    padding: 7px 2px 0;
    color: var(--text-soft);
    font-size: 0.7rem;
}

.editor-status.is-valid {
    color: var(--green);
}

.editor-status.is-invalid {
    color: var(--danger);
}

.editor-actions {
    position: sticky;
    top: 76px;
    padding: 16px;
}

.details-list {
    margin: 14px 0 18px;
}

.details-list > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 0;
    border-bottom: 1px solid #edf0f2;
    font-size: 0.74rem;
}

.details-list dt {
    color: var(--text-soft);
}

.details-list dd {
    overflow: hidden;
    color: #394650;
    font-weight: 600;
    text-overflow: ellipsis;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.tag-picker {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 7px;
    margin-top: 7px;
}

.tag-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    column-gap: 7px;
    align-items: center;
    padding: 8px 9px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface-muted);
    cursor: pointer;
}

.tag-option input {
    grid-row: span 2;
}

.tag-option small {
    color: var(--text-soft);
    font-size: 0.68rem;
}

.tag-entry {
    margin-top: 9px;
}

.tag {
    display: inline-block;
    padding: 3px 7px;
    border: 1px solid #d5e1e2;
    border-radius: 4px;
    background: #f1f7f7;
    color: #3b6468;
    font-size: 0.68rem;
    line-height: 1.2;
}

.muted {
    color: var(--text-soft);
}

.player-page-heading {
    align-items: flex-end;
    margin-bottom: 18px;
}

.player-heading-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 8px;
    color: var(--text-soft);
    font-size: 0.76rem;
}

.player-heading-meta code,
.player-info-item code {
    padding: 2px 5px;
    border-radius: 4px;
    background: #eef3f4;
    color: #3f5964;
    font-size: 0.72rem;
}

.player-heading-meta .status,
.player-info-item .status,
.player-roles-table .status {
    margin: 0;
}

.player-section {
    margin-bottom: 18px;
}

.player-section .section-heading {
    min-height: 64px;
    padding: 13px 20px;
}

.player-section .section-heading > div {
    min-width: 0;
}

.player-section .section-heading h2 {
    color: #26323b;
    font-size: 0.98rem;
}

.player-section .section-heading > div > span {
    display: block;
    margin-top: 3px;
    color: var(--text-soft);
    font-size: 0.72rem;
}

.player-section-count {
    flex: 0 0 auto;
    color: var(--text-soft);
    font-size: 0.72rem;
    font-weight: 650;
}

.player-info-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 0;
    padding: 4px 20px 20px;
}

.player-info-item {
    display: flex;
    min-width: 0;
    min-height: 76px;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    padding: 13px 16px;
    border-bottom: 1px solid #edf0f2;
}

.player-info-item dt {
    color: var(--text-soft);
    font-size: 0.7rem;
}

.player-info-item dd {
    display: flex;
    min-width: 0;
    min-height: 24px;
    align-items: center;
    gap: 7px;
    overflow-wrap: anywhere;
    color: #2f3b45;
    font-size: 0.8rem;
    font-weight: 650;
}

.player-info-item time {
    white-space: nowrap;
}

.player-info-item-wide {
    grid-column: 1 / -1;
}

.player-info-subtext {
    color: var(--text-soft);
    font-size: 0.68rem;
    font-weight: 400;
}

.player-note-text {
    max-width: 100%;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.player-server-list,
.player-tag-list {
    display: flex;
    max-width: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.player-server-chip {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 2px 7px;
    border: 1px solid #d9e4e5;
    border-radius: 4px;
    background: #f4f8f8;
    color: #3e686d;
    font-size: 0.68rem;
    font-weight: 650;
    white-space: nowrap;
}

.player-tag {
    display: inline-flex;
    min-width: 112px;
    max-width: 100%;
    min-height: 42px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 5px 8px;
    border: 1px solid #cfe0df;
    border-radius: 5px;
    background: #f2f8f7;
    color: #245f5c;
}

.player-tag strong,
.player-tag small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-tag strong {
    font-size: 0.72rem;
}

.player-tag small {
    color: #5f777b;
    font-size: 0.62rem;
    font-weight: 500;
}

.player-tag-list-compact {
    align-items: flex-start;
    gap: 4px;
}

.player-tag-list-compact .player-tag {
    min-width: 104px;
    min-height: 37px;
    padding: 4px 7px;
}

.player-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 18px 20px 20px;
}

.player-action-block {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface-muted);
}

.player-action-heading {
    margin-bottom: 12px;
}

.player-action-heading h3 {
    font-size: 0.8rem;
}

.player-action-heading span {
    display: block;
    margin-top: 3px;
    color: var(--text-soft);
    font-size: 0.68rem;
}

.player-current-action {
    margin-bottom: 9px;
    padding: 8px 9px;
    border: 1px solid #f0c4bf;
    border-radius: 4px;
    background: var(--danger-soft);
    color: var(--danger);
    font-size: 0.72rem;
}

.player-action-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.player-ban-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(170px, 1fr) auto;
    gap: 8px;
}

.player-ban-form input {
    min-width: 0;
}

.player-management-form {
    padding: 18px 20px 20px;
}

.player-management-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(240px, 0.7fr);
    gap: 22px;
}

.player-tag-picker {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-top: 0;
}

.player-tag-picker .tag-option,
.role-management-form .tag-option {
    min-width: 0;
    min-height: 52px;
    align-items: start;
    padding: 8px 9px;
}

.tag-option-copy {
    min-width: 0;
}

.tag-option-copy strong,
.tag-option-copy small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tag-option-copy strong {
    color: #31414a;
    font-size: 0.74rem;
}

.tag-option-copy small {
    margin-top: 2px;
    color: var(--text-soft);
    font-size: 0.64rem;
}

.tag-option-unknown {
    border-color: #e8cfae;
    background: #fffaf1;
}

.player-note-field textarea {
    min-height: 164px;
    resize: vertical;
}

.player-form-footer {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid #edf0f2;
}

.player-empty-state {
    display: flex;
    min-height: 128px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
    padding: 24px;
    color: var(--text-soft);
    text-align: center;
}

.player-empty-state strong {
    color: #3b4852;
    font-size: 0.8rem;
}

.player-empty-state span {
    font-size: 0.72rem;
}

.player-roles-table th:nth-child(2) {
    min-width: 126px;
}

.player-roles-table th:nth-child(5) {
    min-width: 190px;
}

.player-roles-table th:last-child {
    min-width: 210px;
}

.role-identity strong,
.role-identity small {
    display: block;
}

.role-identity strong {
    color: #2c3942;
    font-size: 0.8rem;
}

.role-identity small {
    margin-top: 3px;
    color: var(--text-soft);
    font-size: 0.66rem;
}

.role-level {
    color: #385f70;
    white-space: nowrap;
}

.role-note {
    display: block;
    max-width: 260px;
    margin-top: 7px;
    overflow-wrap: anywhere;
    color: var(--text-soft);
    font-size: 0.68rem;
    white-space: pre-wrap;
}

.role-actions-cell {
    vertical-align: top !important;
}

.role-action-list {
    display: flex;
    min-width: 190px;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
}

.role-action-list form {
    max-width: 100%;
}

.role-editor {
    width: 100%;
}

.role-editor summary {
    width: fit-content;
    padding: 4px 0;
    color: #376c82;
    cursor: pointer;
    font-size: 0.72rem;
    font-weight: 650;
}

.role-editor summary:hover {
    color: var(--primary);
}

.role-management-form {
    display: flex;
    max-width: 330px;
    flex-direction: column;
    gap: 9px;
    margin-top: 6px;
    padding: 11px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface-muted);
}

.role-management-form .tag-picker {
    grid-template-columns: 1fr;
    width: 100%;
    margin-top: 0;
}

.role-management-form .field {
    width: 100%;
}

.history-result {
    display: inline-flex;
    min-height: 23px;
    align-items: center;
    padding: 2px 7px;
    border-radius: 4px;
    background: var(--green-soft);
    color: #1c704b;
    font-size: 0.68rem;
    font-weight: 650;
}

.history-warning {
    display: block;
    margin-top: 4px;
    color: var(--danger);
    font-size: 0.68rem;
}

.editor-actions .button + .button {
    margin-top: 8px;
}

.toast {
    position: fixed;
    top: 68px;
    right: 20px;
    z-index: 60;
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr) 30px;
    width: min(400px, calc(100vw - 32px));
    min-height: 48px;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 13px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(20, 31, 38, 0.14);
}

.toast-success > .icon {
    color: var(--green);
}

.toast-error > .icon {
    color: var(--danger);
}

.toast-message {
    min-width: 0;
}

.toast-action {
    display: inline-block;
    margin-left: 6px;
    color: #2f7d78;
    font-size: 0.72rem;
    font-weight: 700;
    white-space: nowrap;
}

.toast-action:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

.toast.is-hiding {
    opacity: 0;
    transition: opacity 180ms ease;
}

.auth-page {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 28px 18px;
    background: #edf1f3;
}

.auth-shell {
    width: min(390px, 100%);
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 11px;
    margin-bottom: 18px;
}

.brand-mark-large {
    width: 42px;
    height: 42px;
    flex-basis: 42px;
}

.auth-brand strong,
.auth-brand span {
    display: block;
}

.auth-brand strong {
    font-size: 1.02rem;
}

.auth-brand div > span {
    color: var(--text-soft);
    font-size: 0.74rem;
}

.auth-panel {
    padding: 25px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 10px 28px rgba(28, 43, 50, 0.09);
}

.auth-panel header {
    margin-bottom: 22px;
}

.auth-panel h1 {
    font-size: 1.2rem;
}

.auth-panel header p {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 0.76rem;
}

.input-with-icon {
    position: relative;
}

.input-with-icon .icon {
    position: absolute;
    top: 50%;
    left: 11px;
    width: 16px;
    height: 16px;
    color: #7b8792;
    transform: translateY(-50%);
    pointer-events: none;
}

.input-with-icon input {
    padding-left: 36px;
}

.action-code {
    padding: 3px 6px;
    border-radius: 4px;
    background: #eef3f4;
    color: #3b6468;
    font-size: 0.7rem;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 1050px) {
    .metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .editor-layout {
        grid-template-columns: minmax(0, 1fr) 220px;
    }
}

@media (max-width: 767px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        width: min(280px, 84vw);
        transform: translateX(-105%);
        transition: transform 180ms ease;
    }

    body.sidebar-open {
        overflow: hidden;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        z-index: 30;
        background: rgba(12, 20, 24, 0.46);
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
    }

    .main-column {
        width: 100%;
    }

    .topbar {
        height: 54px;
        padding: 0 14px;
    }

    .topbar .menu-button {
        display: inline-flex;
    }

    .content {
        min-height: calc(100vh - 54px);
        padding: 20px 14px 38px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
        margin-bottom: 18px;
    }

    .page-heading h1 {
        overflow-wrap: anywhere;
        font-size: 1.32rem;
    }

    .heading-actions {
        width: 100%;
    }

    .heading-actions .button {
        flex: 1;
        min-width: 0;
        white-space: normal;
    }

    .metrics {
        grid-template-columns: 1fr 1fr;
        gap: 9px;
    }

    .metric {
        min-height: 88px;
        gap: 9px;
        padding: 13px;
    }

    .metric-icon {
        width: 36px;
        height: 36px;
        flex-basis: 36px;
    }

    .metric strong {
        font-size: 1.15rem;
    }

    .metric .metric-time {
        font-size: 0.84rem;
    }

    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
    }

    .responsive-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .responsive-table tr {
        padding: 11px 13px;
        border-bottom: 1px solid var(--border);
    }

    .responsive-table tr:last-child {
        border-bottom: 0;
    }

    .responsive-table td {
        display: grid;
        grid-template-columns: 100px minmax(0, 1fr);
        min-height: 38px;
        align-items: center;
        gap: 10px;
        padding: 5px 0;
        border: 0;
        text-align: left !important;
    }

    .responsive-table td::before {
        color: var(--text-soft);
        content: attr(data-label);
        font-size: 0.68rem;
        font-weight: 650;
    }

    .responsive-table .actions > *:first-child {
        margin-left: -5px;
    }

    .responsive-table td > .action-group,
    .responsive-table td > .status-group {
        grid-column: 2;
    }

    .responsive-table .action-group {
        justify-content: flex-start;
    }

    .server-table-toolbar {
        align-items: stretch;
    }

    .parameter-table-toolbar {
        align-items: stretch;
    }

    .parameter-table-toolbar .search-box,
    .parameter-table-toolbar .table-filters,
    .parameter-table-toolbar .content-search-form {
        width: 100%;
    }

    .content-search-form {
        flex-wrap: wrap;
    }

    .search-box-compact {
        flex: 1 1 150px;
        width: auto;
    }

    .bulk-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .server-table-toolbar .search-box,
    .server-table-toolbar .table-filters {
        width: 100%;
    }

    .table-filters select {
        flex: 1 1 108px;
    }

    .server-endpoint-cell span {
        max-width: none;
    }

    .server-probe-result {
        min-width: 0;
    }

    .url-cell {
        min-width: 0;
    }

    .url-cell code {
        min-width: 0;
    }

    .form-grid,
    .permission-grid {
        grid-template-columns: 1fr;
    }

    .editor-layout {
        display: flex;
        flex-direction: column;
    }

    .editor-main,
    .editor-actions {
        width: 100%;
    }

    .editor-actions {
        position: static;
    }

    .json-editor {
        min-height: 55vh;
        padding: 12px;
        font-size: 0.78rem;
    }

    .field-inline-label {
        grid-template-columns: 1fr;
    }

    .field-inline-label > label {
        padding: 0;
    }

    .toast {
        top: 64px;
        right: 16px;
    }
}

@media (max-width: 430px) {
    .metrics {
        grid-template-columns: 1fr;
    }

    .metric {
        min-height: 76px;
    }

    .responsive-table td {
        grid-template-columns: 82px minmax(0, 1fr);
    }

    .public-url-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .public-url-row code {
        width: 100%;
        margin-left: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}

@media (max-width: 1050px) {
    .player-info-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .player-action-grid,
    .player-management-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .player-page-heading {
        margin-bottom: 16px;
    }

    .player-section .section-heading {
        padding-right: 14px;
        padding-left: 14px;
    }

    .player-info-grid {
        grid-template-columns: 1fr;
        padding: 3px 14px 14px;
    }

    .player-info-item,
    .player-info-item-wide {
        grid-column: auto;
        min-height: 68px;
        padding: 11px 4px;
    }

    .player-info-item time {
        white-space: normal;
    }

    .player-action-grid,
    .player-management-form {
        padding-right: 14px;
        padding-left: 14px;
    }

    .player-ban-form {
        grid-template-columns: 1fr;
    }

    .player-form-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .player-form-footer .button {
        width: 100%;
    }

    .player-roles-table td > .player-tag-list,
    .player-roles-table td > .role-note,
    .player-roles-table td > .role-action-list,
    .player-roles-table td > .status,
    .player-roles-table td > .player-server-chip,
    .player-roles-table td > .role-level {
        grid-column: 2;
    }

    .player-roles-table .player-tag-list {
        align-items: stretch;
    }

    .player-roles-table .player-tag {
        min-width: 0;
    }

    .role-action-list {
        min-width: 0;
    }

    .role-management-form {
        max-width: none;
    }

    .player-history-section .section-heading,
    .player-roles-section .section-heading {
        align-items: flex-start;
    }
}

@media (max-width: 430px) {
    .player-heading-meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .player-tag {
        min-width: 0;
        width: 100%;
    }

    .player-tag-list {
        width: 100%;
    }
}

/* Email module */
.email-page-heading {
    align-items: flex-end;
}

.page-kicker {
    display: block;
    margin-bottom: 5px;
    color: var(--primary);
    font-size: 0.68rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.email-create-button {
    min-width: 126px;
}

.email-overview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin-bottom: 18px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--surface);
}

.email-overview-item {
    display: flex;
    min-height: 70px;
    flex-direction: column;
    justify-content: center;
    gap: 2px;
    padding: 10px 18px;
    border-right: 1px solid var(--border);
}

.email-overview-item:last-child {
    border-right: 0;
}

.email-overview-item span {
    color: var(--text-soft);
    font-size: 0.72rem;
}

.email-overview-item strong {
    color: var(--text);
    font-size: 1.25rem;
    line-height: 1.1;
}

.email-overview-item.is-alert strong {
    color: var(--danger);
}

.email-table-toolbar {
    justify-content: space-between;
}

.table-count {
    color: var(--text-soft);
    font-size: 0.74rem;
    white-space: nowrap;
}

.email-table th:nth-child(1) {
    min-width: 230px;
}

.email-table th:nth-child(2) {
    width: 150px;
}

.email-table th:nth-child(3) {
    width: 166px;
}

.email-table th:nth-child(4) {
    min-width: 150px;
}

.email-title-cell {
    min-width: 0;
}

.email-title {
    display: block;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 0.82rem;
}

.email-meta {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 5px;
}

.email-meta code {
    color: var(--text-faint);
    font-size: 0.68rem;
}

.email-table time,
.email-log-table time {
    white-space: nowrap;
}

.email-target-summary {
    display: inline-block;
    max-width: 240px;
    overflow-wrap: anywhere;
    color: #465462;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.72rem;
}

.email-action-group {
    justify-content: flex-end;
    gap: 4px;
}

.email-action {
    gap: 5px;
}

.email-action .icon {
    width: 14px;
    height: 14px;
}

.email-action-danger {
    color: var(--danger);
}

.email-action-danger:hover {
    border-color: #f0c4bf;
    background: var(--danger-soft);
    color: var(--danger-hover);
}

.email-log-heading {
    margin-bottom: 18px;
}

.email-log-title {
    max-width: 720px;
    overflow-wrap: anywhere;
}

.email-identity {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 9px;
    color: var(--text-soft);
    font-size: 0.72rem;
}

.email-identity .icon-button {
    width: 28px;
    height: 28px;
}

.email-filter-panel {
    margin-bottom: 16px;
    padding: 17px 18px;
}

.email-filter-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 16px;
}

.email-filter-heading h2 {
    font-size: 0.92rem;
}

.email-filter-heading p {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 0.72rem;
}

.email-filter-fields {
    display: flex;
    align-items: flex-end;
    gap: 14px;
}

.email-filter-fields .field {
    width: min(220px, 100%);
}

.email-failure-filter {
    display: flex;
    min-height: 40px;
    align-items: center;
    gap: 8px;
    color: #465462;
    font-size: 0.78rem;
}

.email-failure-filter input {
    margin: 0;
}

.email-filter-panel .form-actions {
    margin-top: 16px;
}

.email-log-toolbar {
    justify-content: space-between;
}

.email-log-toolbar > div {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.email-log-legend {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--text-soft);
    font-size: 0.68rem;
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
}

.status-dot-success {
    background: var(--green);
}

.status-dot-danger {
    margin-left: 4px;
    background: var(--danger);
}

.email-operation {
    color: #465462;
    font-weight: 650;
}

.server-chip {
    display: inline-block;
    padding: 2px 6px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--surface-muted);
    color: #465462;
    font-family: "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 0.7rem;
}

.email-error-text {
    max-width: 360px;
    margin: 0;
    overflow-wrap: anywhere;
    color: #465462;
    font-size: 0.74rem;
    line-height: 1.45;
}

.email-request-cell code {
    display: inline-block;
    max-width: 118px;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.email-form-page {
    max-width: 920px;
}

.email-details-page {
    max-width: 920px;
}

.email-details-section {
    margin-bottom: 18px;
    padding: 22px;
}

.email-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    gap: 18px 24px;
    margin: 0;
}

.email-details-wide {
    grid-column: 1 / -1;
}

.email-details-grid dt {
    margin-bottom: 5px;
    color: var(--text-soft);
    font-size: 0.72rem;
}

.email-details-grid dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.email-details-message,
.email-details-items {
    margin: 0;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
    line-height: 1.7;
}

.email-details-items {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
    font-size: 0.76rem;
}

.email-form-section {
    padding-top: 0;
}

.email-form-section header p {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 0.74rem;
}

.email-message-field,
.email-json-field {
    margin-top: 18px;
}

.email-json-field .json-editor {
    min-height: 112px;
    padding: 11px;
    font-size: 0.76rem;
    line-height: 1.55;
}

.field-label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.email-scope-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface-muted);
}

.field-label {
    color: #3d4854;
    font-size: 0.78rem;
    font-weight: 650;
}

.email-scope-switch .toggle-row {
    align-self: auto;
}

.email-scope-panel {
    margin-top: 14px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fcfdfd;
}

.email-server-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 8px;
}

.email-server-select-all,
.email-server-option {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.email-server-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    max-height: 240px;
    overflow-y: auto;
    padding: 3px;
}

.email-server-option {
    min-height: 42px;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 5px;
    background: var(--surface);
}

.email-server-option:has(input:checked) {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.email-server-option:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.email-server-option input,
.email-server-select-all input {
    flex-shrink: 0;
    margin: 0;
}

.email-time-grid {
    margin-top: 18px;
}

.email-form-actions {
    margin-top: 2px;
    padding-bottom: 8px;
}

.email-readonly-notice {
    display: flex;
    min-height: 118px;
    align-items: center;
    gap: 14px;
    max-width: 920px;
    padding: 22px;
}

.email-readonly-notice .empty-icon {
    margin: 0;
}

.email-readonly-notice h2 {
    font-size: 0.96rem;
}

.email-readonly-notice p {
    margin-top: 4px;
    color: var(--text-soft);
    font-size: 0.76rem;
}

.email-readonly-notice .button {
    margin-left: auto;
}

@media (max-width: 767px) {
    .email-page-heading {
        align-items: stretch;
    }

    .email-create-button {
        width: 100%;
    }

    .email-overview {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .email-overview-item:nth-child(2) {
        border-right: 0;
    }

    .email-overview-item:nth-child(-n + 2) {
        border-bottom: 1px solid var(--border);
    }

    .email-table-toolbar,
    .email-filter-heading,
    .email-log-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .email-table-toolbar .search-box {
        width: 100%;
    }

    .email-table-toolbar .table-count {
        align-self: flex-start;
    }

    .email-action-group {
        justify-content: flex-start;
    }

    .email-action {
        min-height: 36px;
    }

    .email-filter-fields {
        align-items: stretch;
        flex-direction: column;
    }

    .email-filter-fields .field {
        width: 100%;
    }

    .email-failure-filter {
        min-height: 34px;
    }

    .email-filter-panel .form-actions {
        align-items: stretch;
        flex-direction: column-reverse;
    }

    .email-filter-panel .form-actions .button {
        width: 100%;
    }

    .email-log-legend {
        align-self: flex-start;
    }

    .email-log-table .email-error-text,
    .email-log-table .email-request-cell > * {
        grid-column: 2;
    }

    .email-readonly-notice {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .email-readonly-notice .button {
        width: 100%;
        margin-left: 0;
    }
}
