/* ==========================================================================
   签证预约 - 前端全局样式
   目录：
     1. 设计令牌（CSS 变量）
     2. 基础布局与版心
     3. 按钮（通用/主/次/运行/停止/删除/禁用）
     4. 表格
     5. 模态框
     6. 状态标签与图例
     7. 表单控件
     8. 页头与工具栏
     9. 实例列表卡片（桌面端）
    10. 日期区间编辑行
    11. 移动端卡片
    12. 响应式适配
   ========================================================================== */

/* -------------------------- 0. 全局工具规则 -------------------------- */
/* 确保 HTML `hidden` 属性始终生效，避免被 .xxx { display: flex/grid/... } 覆盖 */
[hidden] {
    display: none !important;
}

/* -------------------------- 1. 设计令牌 -------------------------- */
:root {
    --bg-page: #f5f7fb;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --warning: #f59e0b;
    --danger: #ef4444;
}

/* -------------------------- 2. 基础布局与版心 -------------------------- */
body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: var(--bg-page);
    color: var(--text-primary);
}

body.instances-body {
    height: 100vh;
    min-height: 100vh;
    box-sizing: border-box;
    display: flex;
    overflow: hidden;
}

.container {
    width: 100%;
    max-width: none;
    flex: 1 1 auto;
    min-height: 0;
    margin: 0 auto;
    background-color: var(--bg-card);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

h1 {
    color: #333;
    text-align: center;
    margin: 0;
}

/* -------------------------- 3. 按钮 -------------------------- */
button {
    padding: 8px 16px;
    background-color: #4caf50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font: inherit;
}

button:hover {
    background-color: #45a049;
}

button.delete {
    background-color: #f44336;
}

button.delete:hover {
    background-color: #d32f2f;
}

button.run {
    background-color: #2196f3;
}

button.run:hover {
    background-color: #0b7dda;
}

button.stop {
    background-color: var(--warning);
}

button.stop:hover {
    background-color: #d97706;
}

button.copy {
    background-color: #6b7280;
}

button.copy:hover {
    background-color: #4b5563;
}

button.clear-profile {
    background-color: #0f766e;
}

button.clear-profile:hover {
    background-color: #0d5f59;
}

button:disabled {
    background-color: #9e9e9e !important;
    color: #f0f0f0;
    cursor: not-allowed;
    opacity: 0.8;
}

/* -------------------------- 4. 表格 -------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: left;
}

th {
    background-color: #f2f2f2;
}

tr:nth-child(even) {
    background-color: #f9f9f9;
}

/* -------------------------- 5. 模态框 -------------------------- */
.modal {
    display: none;
    position: fixed;
    z-index: 10;
    inset: 0;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 6vh auto;
    padding: 20px;
    border: 1px solid #888;
    width: min(80%, 600px);
    max-height: 88vh;
    overflow-y: auto;
    border-radius: 12px;
    box-sizing: border-box;
}

.modal-content--wide {
    width: min(94%, 720px);
}

.instance-modal-content {
    width: min(94vw, 880px);
    padding: 12px 14px 14px;
    border-radius: 8px;
}

.instance-modal-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.instance-modal-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.2;
    flex-shrink: 0;
}

.instance-modal-header .close {
    float: none;
    flex-shrink: 0;
    font-size: 24px;
    margin-left: 2px;
}

.instance-modal-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 0 auto;
}

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

.instance-form-grid .form-group {
    margin-bottom: 0;
    min-width: 0;
}

.instance-form-grid label {
    margin-bottom: 3px;
    font-size: 13px;
    font-weight: 600;
}

.instance-form-grid input,
.instance-form-grid select {
    padding: 6px 8px;
    font-size: 14px;
}

.instance-form-grid .number-range {
    gap: 6px;
}

.instance-form-grid .range-row {
    margin-bottom: 4px;
}

.copyable-input {
    position: relative;
}

.copyable-input input {
    min-width: 0;
    padding-right: 38px;
}

.copyable-input .field-copy-btn {
    position: absolute;
    top: 50%;
    right: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-height: 0;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #6e6e73;
}

.copyable-input .field-copy-btn:hover {
    background: rgba(0, 122, 255, 0.1);
    color: #007aff;
}

.copyable-input .field-copy-btn:focus-visible {
    outline: 2px solid rgba(0, 122, 255, 0.45);
    outline-offset: 1px;
}

.copyable-input .field-copy-btn svg {
    width: 17px;
    height: 17px;
    fill: currentColor;
}

.copyable-input .field-copy-btn.is-success {
    color: #16813c;
}

.copyable-input .field-copy-btn.is-error {
    color: #d70015;
}

.instance-form-grid #addRangeBtn {
    margin-top: 2px;
}

.form-span-3 {
    grid-column: span 3;
}

.form-span-4 {
    grid-column: span 4;
}

.form-span-5 {
    grid-column: span 5;
}

.form-span-6 {
    grid-column: span 6;
}

.form-span-8 {
    grid-column: span 8;
}

.form-span-12 {
    grid-column: 1 / -1;
}

.instance-form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    padding-top: 0;
}

.instance-form-actions .btn-primary {
    min-width: 88px;
}

.batch-add-textarea {
    width: 100%;
    min-height: 260px;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid rgba(60, 60, 67, 0.22);
    border-radius: 8px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    resize: vertical;
}

.batch-add-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
}

.batch-add-result {
    margin: 12px 0 0;
    padding: 10px 12px;
    max-height: 180px;
    overflow: auto;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    font-size: 12px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.col-select {
    width: 36px;
    text-align: center;
    vertical-align: middle;
}

.col-select input[type="checkbox"],
.instance-select-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.mobile-card-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.mobile-card-select {
    flex-shrink: 0;
    padding-top: 4px;
    cursor: pointer;
}

.mobile-card-top .mobile-card-header {
    flex: 1;
    min-width: 0;
}

.signup-lead,
.field-hint {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0 0 12px;
}

.signup-status {
    min-height: 1.25em;
    margin: 0 0 12px;
    font-size: 14px;
    color: var(--text-primary);
}

.signup-status-error {
    color: var(--danger);
    font-weight: 600;
}

.signup-fieldset {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px 6px;
    margin-bottom: 16px;
}

.signup-fieldset legend {
    padding: 0 6px;
    font-weight: 600;
    font-size: 15px;
}

.signup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: black;
}

/* -------------------------- 6. 状态标签与图例 -------------------------- */
.status {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 12px;
    color: white;
    white-space: nowrap;
}

.status-idle { background-color: #888; }
.status-queued { background-color: #607d8b; }
.status-running { background-color: #2196f3; }
.status-logging { background-color: #ff9800; }
.status-scheduling { background-color: #9c27b0; }
.status-invalidCredentials { background-color: #b45309; }
.status-noAppointmentEntry { background-color: #64748b; }
.status-bookedInRange { background-color: #0d9488; }
.status-success { background-color: #4caf50; }
.status-failed { background-color: #f44336; }
.status-ipBanned { background-color: #e65100; }

.status-cell-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.status-cell-wrap-mobile {
    align-items: flex-end;
    flex-shrink: 0;
}

.last-write-hint,
.schedule-api-latency-hint,
.poll-state-hint {
    font-size: 0.72em;
    line-height: 1.3;
    color: #64748b;
    white-space: nowrap;
}

/* 列表中「本实例走代理」的醒目标记（与状态圆角标签区分） */
.user-title-line,
.mobile-title-line {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}

.instance-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    padding: 2px 9px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    line-height: 1.35;
}

.instance-badge-proxy {
    color: #0c4a6e;
    background: linear-gradient(180deg, #fef3c7 0%, #fde68a 100%);
    border: 1px solid #d97706;
    box-shadow: 0 1px 2px rgba(180, 83, 9, 0.2);
}

.instance-badge-applicant-count {
    color: #1e3a8a;
    background: linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
    border: 1px solid #3b82f6;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.18);
    min-width: 1.4em;
    justify-content: center;
}

.instance-badge-interview-waiver {
    color: #065f46;
    background: linear-gradient(180deg, #d1fae5 0%, #a7f3d0 100%);
    border: 1px solid #059669;
    box-shadow: 0 1px 2px rgba(4, 120, 87, 0.18);
}

.visa-type-line {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* -------------------------- 7. 表单控件 -------------------------- */
.form-group {
    margin-bottom: 15px;
}

label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-hint {
    margin: 6px 0 0;
    color: #6e6e73;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
}

input,
select {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    border: 1px solid #ddd;
    border-radius: 4px;
    font: inherit;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: normal;
    cursor: pointer;
    padding: 8px 0;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    padding: 0;
    margin: 0;
    cursor: pointer;
}

.checkbox-label span {
    user-select: none;
}

.number-range {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
}

.number-range span {
    color: var(--text-secondary);
    white-space: nowrap;
}

/* -------------------------- 8. 页头与工具栏 -------------------------- */
.page-header {
    text-align: center;
    margin-bottom: 16px;
}

.page-header .subtitle {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 14px;
}

.local-ip {
    margin: 8px 0 0;
    color: var(--primary);
    font-size: 14px;
    font-weight: 600;
}

/* 只读横幅 */
.readonly-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 6px;
    padding: 8px 14px;
    margin-bottom: 10px;
    font-size: 14px;
    color: #92400e;
}

.readonly-banner strong {
    color: #78350f;
}

.btn-sm {
    padding: 4px 10px;
    font-size: 13px;
}

/* 节点选择器 */
.node-selector-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.node-selector-wrap label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    margin: 0;
}

#nodeSwitcher {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font: inherit;
    font-size: 13px;
    background: #fff;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 120px;
}

#nodeSwitcher:focus {
    outline: 2px solid var(--primary);
    outline-offset: 1px;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 16px 0 12px;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toolbar-right label {
    margin: 0 4px 0 0;
    font-weight: 600;
    color: var(--text-secondary);
}

.toolbar-right input[type="number"] {
    width: 96px;
}

.btn-primary {
    background-color: var(--primary);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: #64748b;
}

.btn-secondary:hover {
    background-color: #4b5563;
}

/* 用 <a> 伪装成按钮的辅助样式（工具栏入口） */
a.btn-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font: inherit;
    line-height: 1.2;
    cursor: pointer;
}

.btn-danger {
    background-color: #dc2626;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

.btn-danger:disabled {
    background-color: #fca5a5;
    cursor: not-allowed;
}

.btn-sprint {
    background-color: #ea580c;
}

.btn-sprint:hover {
    background-color: #c2410c;
}

.btn-sprint:disabled {
    background-color: #fdba74;
    cursor: not-allowed;
}

/* -------------------------- 9. 实例列表卡片（桌面端） -------------------------- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-weight: 600;
}

.status-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.status-legend .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
    vertical-align: middle;
}

.status-legend .dot.idle { background: #888; }
.status-legend .dot.queued { background: #607d8b; }
.status-legend .dot.running { background: #2196f3; }
.status-legend .dot.logging { background: #ff9800; }
.status-legend .dot.scheduling { background: #9c27b0; }
.status-legend .dot.invalidCredentials { background: #b45309; }
.status-legend .dot.noAppointmentEntry { background: #64748b; }
.status-legend .dot.bookedInRange { background: #0d9488; }
.status-legend .dot.success { background: #4caf50; }
.status-legend .dot.failed { background: #f44336; }
.status-legend .dot.ipBanned { background: #e65100; }

.ip-ban-hint {
    margin-top: 4px;
    font-size: 12px;
    line-height: 1.35;
    color: #e65100;
    white-space: normal;
}

.location-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background-color: #f8fafc;
}

.location-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    max-width: 180px;
    padding: 5px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    background-color: #ffffff;
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
}

.location-tab:hover {
    border-color: #94a3b8;
    background-color: #eef2ff;
}

.location-tab[aria-selected="true"] {
    border-color: var(--primary);
    background-color: var(--primary);
    color: #ffffff;
}

.location-tab-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.location-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: 4px;
    background-color: #e2e8f0;
    color: #475569;
    font-size: 12px;
    font-weight: 700;
}

.location-tab[aria-selected="true"] .location-tab-count {
    background-color: rgba(255, 255, 255, 0.22);
    color: #ffffff;
}

.mobile-list {
    display: none;
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
}

.table-wrap {
    width: 100%;
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow: auto;
    border-radius: 8px;
}

.table-wrap table {
    width: 100%;
}

#instancesTable {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
}

#instancesTable th,
#instancesTable td {
    box-sizing: border-box;
}

#instancesTable td {
    vertical-align: top;
    overflow-wrap: anywhere;
}

/* 列：勾选 | 序号 | 用户信息 | 位置 | 日期区间 | 状态 | 操作 */
#instancesTable th:nth-child(1),
#instancesTable td:nth-child(1) {
    width: 40px;
    text-align: center;
    white-space: nowrap;
}

#instancesTable th:nth-child(2),
#instancesTable td:nth-child(2) {
    width: 48px;
    text-align: center;
    white-space: nowrap;
}

#instancesTable th:nth-child(3),
#instancesTable td:nth-child(3) {
    width: 28%;
}

#instancesTable th:nth-child(4),
#instancesTable td:nth-child(4) {
    width: 10%;
}

#instancesTable th:nth-child(5),
#instancesTable td:nth-child(5) {
    width: 22%;
}

#instancesTable th:nth-child(6),
#instancesTable td:nth-child(6) {
    width: 12%;
}

#instancesTable th:nth-child(7),
#instancesTable td:nth-child(7) {
    width: 200px;
}

thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: #f8fafc;
}

tbody tr:hover {
    background-color: #f3f4f6;
}

.visa-type-group-row:hover {
    background-color: transparent;
}

.visa-type-group-cell {
    padding: 8px 12px;
    background-color: #f1f5f9;
    border-color: #cbd5e1;
}

.visa-type-group-title,
.mobile-visa-type-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.visa-type-group-name,
.mobile-visa-type-name {
    min-width: 0;
    color: #0f172a;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.visa-type-group-count,
.mobile-visa-type-count {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 4px;
    background-color: #e0f2fe;
    color: #075985;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
    white-space: nowrap;
}

td.empty {
    text-align: center;
    color: var(--text-secondary);
}

.cell-title {
    font-weight: 700;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

.cell-sub {
    font-size: 0.75em;
    color: #888;
    margin-top: 2px;
}

.cell-sub-booked {
    color: #0b5cab;
    font-weight: 600;
}

.ranges-cell {
    max-width: none;
}

.range-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    min-width: 0;
}

.range-chip {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    min-height: 24px;
    padding: 2px 8px;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    background-color: #eff6ff;
    color: #1e40af;
    font-size: 12px;
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.range-chip-more,
.range-chip-empty {
    border-color: #d1d5db;
    background-color: #f3f4f6;
    color: #4b5563;
    font-weight: 700;
}

.actions-cell {
    min-width: 210px;
}

.action-button-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
}

.action-button-grid .action-button,
.mobile-card-actions .action-button {
    width: 100%;
    min-width: 0;
    padding: 5px 6px;
    line-height: 1.15;
    white-space: nowrap;
}

/* -------------------------- 10. 日期区间编辑行 -------------------------- */
.range-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.range-row .range-start,
.range-row .range-end {
    flex: 1 1 0;
}

.range-row button {
    flex-shrink: 0;
}

/* -------------------------- 11. 移动端卡片 -------------------------- */
.mobile-empty {
    padding: 24px 16px;
    text-align: center;
    color: var(--text-secondary);
}

.mobile-instance-card {
    border-top: 1px solid var(--border);
    padding: 16px;
}

.mobile-instance-card:first-child {
    border-top: none;
}

.mobile-visa-type-group {
    padding: 10px 16px;
    border-top: 1px solid #cbd5e1;
    border-bottom: 1px solid var(--border);
    background-color: #f1f5f9;
}

.mobile-visa-type-group:first-child {
    border-top: none;
}

.mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
}

.mobile-card-name {
    min-width: 0;
}

.mobile-card-title {
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
    word-break: break-word;
}

.mobile-card-subtitle {
    margin-top: 4px;
    color: var(--text-secondary);
    font-size: 13px;
    word-break: break-all;
}

.mobile-card-meta {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    margin-bottom: 12px;
}

.mobile-meta-item {
    min-width: 0;
}

.mobile-meta-item-wide {
    grid-column: 1 / -1;
}

.mobile-meta-label {
    display: block;
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

.mobile-meta-value {
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.mobile-meta-value .range-chip-list {
    max-width: none;
}

.mobile-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.mobile-card-actions button {
    width: 100%;
    min-height: 40px;
}

/* -------------------------- 12. 响应式适配 -------------------------- */
@media (max-width: 900px) {
    body {
        padding: 12px;
    }

    .container {
        padding: 14px;
        border-radius: 12px;
    }

    .page-header {
        margin-bottom: 12px;
    }

    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .toolbar-left,
    .toolbar-right {
        width: 100%;
    }

    .toolbar-left button {
        width: 100%;
        min-height: 44px;
    }

    .toolbar-right {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .toolbar-right label {
        margin: 0;
        align-self: center;
    }

    .toolbar-right input[type="number"],
    .toolbar-right button {
        width: 100%;
        min-height: 44px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .status-legend {
        gap: 8px 12px;
    }

    .location-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        padding: 10px 12px;
    }

    .location-tab {
        max-width: 160px;
        flex: 0 0 auto;
        min-height: 36px;
    }

    .table-wrap {
        display: none;
    }

    .mobile-list {
        display: block;
    }

    .modal {
        padding: 12px;
        box-sizing: border-box;
    }

    .modal-content {
        width: 100%;
        margin: 0 auto;
        max-height: calc(100vh - 24px);
        padding: 16px;
    }

    .instance-modal-content {
        width: 100%;
    }

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

    .form-span-3,
    .form-span-4,
    .form-span-5,
    .form-span-6,
    .form-span-8,
    .form-span-12,
    .instance-form-actions {
        grid-column: 1 / -1;
    }

    .range-row {
        flex-direction: column;
        align-items: stretch;
    }

    .range-row button {
        width: 100%;
        min-height: 42px;
    }

    .instance-form-actions .btn-primary {
        width: 100%;
        min-height: 42px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 8px;
    }

    .container {
        padding: 12px;
    }

    .toolbar-right,
    .mobile-card-meta,
    .mobile-card-actions {
        grid-template-columns: 1fr;
    }

    .status {
        font-size: 11px;
    }

    input,
    select,
    button {
        font-size: 16px;
    }
}

/* -------------------------- 13. 主页面苹果风格刷新 -------------------------- */
body.instances-body {
    padding: 18px;
    background:
        linear-gradient(180deg, #f7f8fb 0%, #edf1f7 100%);
    color: #1d1d1f;
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Arial, sans-serif;
    line-height: 1.45;
}

.instances-body .container {
    width: min(100%, 1680px);
    padding: 0;
    gap: 14px;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
}

.instances-body .page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin: 0;
}

.instances-body .page-title-block {
    min-width: 0;
}

.instances-body .page-kicker,
.instances-body .card-kicker,
.instances-body .toolbar-label,
.instances-body .overview-label {
    color: #6e6e73;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.instances-body h1 {
    margin: 2px 0 0;
    color: #1d1d1f;
    text-align: left;
    font-size: clamp(26px, 3vw, 38px);
    font-weight: 750;
    line-height: 1.08;
}

.instances-body .page-header-side {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 220px;
}

.instances-body .local-ip,
.instances-body .platform-target-badge {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    margin: 0;
    padding: 6px 12px;
    border: 1px solid rgba(60, 60, 67, 0.14);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    color: #424245;
    font-size: 13px;
    font-weight: 650;
    box-shadow: 0 10px 30px rgba(20, 24, 32, 0.06);
    backdrop-filter: blur(18px);
}

.instances-body .platform-target-badge[data-target="prod"] {
    border-color: rgba(191, 87, 0, 0.28);
    background: rgba(255, 237, 213, 0.88);
    color: #9a3412;
}

.instances-body .platform-target-badge[data-target="local"] {
    border-color: rgba(15, 118, 110, 0.22);
    background: rgba(204, 251, 241, 0.78);
    color: #0f766e;
}

.instances-body .overview-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(110px, 1fr));
    gap: 10px;
}

.instances-body .overview-card {
    min-width: 0;
    padding: 14px 16px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 14px 34px rgba(20, 24, 32, 0.08);
    backdrop-filter: blur(18px);
}

.instances-body .overview-card strong {
    display: block;
    margin-top: 6px;
    color: #1d1d1f;
    font-size: 28px;
    font-weight: 760;
    line-height: 1;
}

.instances-body .overview-card-node strong {
    overflow: hidden;
    font-size: 16px;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.instances-body .overview-card-resource {
    --resource-color: #8e8e93;
    --resource-glow: rgba(142, 142, 147, 0.16);
    background:
        radial-gradient(circle at 100% 0, var(--resource-glow), transparent 55%),
        rgba(255, 255, 255, 0.8);
    transition: border-color 0.2s ease, background-color 0.2s ease;
}

.instances-body .overview-card-resource[data-level="normal"] {
    --resource-color: #34c759;
    --resource-glow: rgba(52, 199, 89, 0.15);
    border-color: rgba(52, 199, 89, 0.2);
}

.instances-body .overview-card-resource[data-level="warning"] {
    --resource-color: #ff9500;
    --resource-glow: rgba(255, 149, 0, 0.16);
    border-color: rgba(255, 149, 0, 0.22);
}

.instances-body .overview-card-resource[data-level="critical"] {
    --resource-color: #ff3b30;
    --resource-glow: rgba(255, 59, 48, 0.16);
    border-color: rgba(255, 59, 48, 0.22);
}

.instances-body .resource-metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.instances-body .overview-card-resource strong {
    margin-top: 0;
    color: var(--resource-color);
    transition: color 0.2s ease;
}

.instances-body .resource-meter {
    height: 5px;
    margin-top: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(60, 60, 67, 0.1);
}

.instances-body .resource-meter-fill {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--resource-color);
    box-shadow: 0 0 10px var(--resource-glow);
    transition: width 0.45s ease, background-color 0.2s ease;
}

.instances-body .readonly-banner {
    margin: 0;
    padding: 10px 12px;
    border: 1px solid rgba(191, 120, 0, 0.22);
    border-radius: 8px;
    background: rgba(255, 249, 235, 0.92);
    color: #6d4c00;
    box-shadow: 0 10px 24px rgba(120, 82, 0, 0.08);
}

.instances-body .readonly-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    background: #fff3c4;
    color: #7a4f00;
    font-size: 12px;
    font-weight: 750;
}

.instances-body .readonly-text {
    flex: 1 1 auto;
    min-width: 0;
}

.instances-body .toolbar {
    display: grid;
    grid-template-columns: auto auto minmax(320px, 1fr);
    align-items: center;
    gap: 6px;
    margin: 0;
}

.instances-body .toolbar-section {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    min-width: 0;
    gap: 4px;
    padding: 4px 5px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.7);
    box-shadow: 0 8px 18px rgba(20, 24, 32, 0.05);
    backdrop-filter: blur(18px);
}

.instances-body .toolbar-right {
    justify-content: flex-end;
}

.instances-body .toolbar-label {
    flex: 0 0 auto;
    padding: 0 2px;
    color: #86868b;
    font-size: 11px;
}

.instances-body button,
.instances-body a.btn-link,
.instances-body a.btn-text,
.instances-body .btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    flex-shrink: 0;
    min-height: 30px;
    padding: 4px 10px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 6px;
    background: rgba(242, 242, 247, 0.92);
    color: #1d1d1f;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    box-shadow: none;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.instances-body button:hover,
.instances-body a.btn-link:hover,
.instances-body a.btn-text:hover,
.instances-body .btn-secondary:hover {
    border-color: rgba(60, 60, 67, 0.18);
    background: #e9e9ef;
    color: #111113;
}

.instances-body button:active,
.instances-body a.btn-link:active,
.instances-body a.btn-text:active {
    transform: translateY(1px);
}

.instances-body button:focus-visible,
.instances-body a.btn-link:focus-visible,
.instances-body a.btn-text:focus-visible,
.instances-body input:focus-visible,
.instances-body select:focus-visible {
    outline: 3px solid rgba(0, 122, 255, 0.22);
    outline-offset: 2px;
}

.instances-body .btn-primary {
    border-color: #0077ed;
    background: #007aff;
    color: #ffffff;
}

.instances-body .btn-primary:hover {
    border-color: #0068d6;
    background: #006edb;
    color: #ffffff;
}

.instances-body .btn-danger,
.instances-body button.delete,
.instances-body .action-button.delete {
    border-color: rgba(255, 59, 48, 0.16);
    background: #ff3b30;
    color: #ffffff;
}

.instances-body .btn-danger:hover,
.instances-body button.delete:hover,
.instances-body .action-button.delete:hover {
    border-color: rgba(211, 47, 47, 0.24);
    background: #e03028;
    color: #ffffff;
}

.instances-body .btn-text,
.instances-body a.btn-text {
    border-color: transparent;
    background: transparent;
    color: #424245;
    font-weight: 600;
    box-shadow: none;
    padding: 4px 8px;
}

.instances-body .btn-text:hover,
.instances-body a.btn-text:hover {
    border-color: transparent;
    background: rgba(60, 60, 67, 0.08);
    color: #1d1d1f;
}

.instances-body .btn-text:disabled {
    background: transparent;
    color: #a1a1a6;
    cursor: not-allowed;
}

.instances-body button.run,
.instances-body .action-button.run {
    border-color: rgba(0, 122, 255, 0.14);
    background: rgba(0, 122, 255, 0.1);
    color: #0057b8;
}

.instances-body button.run:hover,
.instances-body .action-button.run:hover {
    background: rgba(0, 122, 255, 0.16);
}

.instances-body button.stop,
.instances-body .action-button.stop {
    border-color: rgba(255, 149, 0, 0.18);
    background: rgba(255, 149, 0, 0.12);
    color: #8a5200;
}

.instances-body button.stop:hover,
.instances-body .action-button.stop:hover {
    background: rgba(255, 149, 0, 0.2);
}

.instances-body button.copy,
.instances-body .action-button.copy,
.instances-body button.clear-profile,
.instances-body .action-button.clear-profile {
    background: rgba(242, 242, 247, 0.96);
    color: #424245;
}

.instances-body button.copy:hover,
.instances-body .action-button.copy:hover,
.instances-body button.clear-profile:hover,
.instances-body .action-button.clear-profile:hover {
    background: #e5e5ea;
}

.instances-body button:disabled,
.instances-body .btn-danger:disabled {
    border-color: rgba(60, 60, 67, 0.08) !important;
    background: rgba(235, 235, 240, 0.72) !important;
    color: #a1a1a6 !important;
    opacity: 1;
    cursor: not-allowed;
    transform: none;
}

.instances-body .node-selector-wrap {
    flex: 0 1 200px;
    min-width: 140px;
    padding: 0 2px 0 4px;
}

.instances-body .node-selector-wrap label {
    color: #6e6e73;
    font-size: 11px;
    font-weight: 700;
}

.instances-body #nodeSwitcher {
    min-width: 120px;
    height: 30px;
    padding: 0 28px 0 8px;
    border: 1px solid rgba(60, 60, 67, 0.16);
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.92);
    color: #1d1d1f;
    font-size: 13px;
    font-weight: 600;
}

.instances-body .card {
    overflow: hidden;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    box-shadow: 0 16px 42px rgba(20, 24, 32, 0.09);
    backdrop-filter: blur(18px);
}

.instances-body .card-header {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(60, 60, 67, 0.1);
    background: rgba(250, 250, 252, 0.82);
}

.instances-body .card-header-side {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px 14px;
    min-width: 0;
}

.instances-body .instance-sort-wrap {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6e6e73;
    font-size: 12px;
    white-space: nowrap;
}

.instances-body .instance-sort-wrap label {
    font-weight: 650;
}

.instances-body .instance-sort-wrap select {
    min-height: 30px;
    padding: 4px 8px;
    border: 1px solid rgba(60, 60, 67, 0.16);
    border-radius: 8px;
    background: #fff;
    color: #1d1d1f;
    font-size: 12px;
}

.instances-body .card-title-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.instances-body .card-title {
    color: #1d1d1f;
    font-size: 17px;
    font-weight: 750;
    line-height: 1.2;
}

.instances-body .status-legend {
    gap: 8px 12px;
    color: #6e6e73;
    font-size: 12px;
}

.instances-body .status-legend .dot {
    width: 7px;
    height: 7px;
    margin-right: 5px;
}

.instances-body .status-legend .dot.idle { background: #8e8e93; }
.instances-body .status-legend .dot.queued { background: #5856d6; }
.instances-body .status-legend .dot.running { background: #007aff; }
.instances-body .status-legend .dot.logging { background: #ff9500; }
.instances-body .status-legend .dot.scheduling { background: #af52de; }
.instances-body .status-legend .dot.invalidCredentials { background: #bf5b00; }
.instances-body .status-legend .dot.noAppointmentEntry { background: #64748b; }
.instances-body .status-legend .dot.bookedInRange { background: #0d9488; }
.instances-body .status-legend .dot.success { background: #34c759; }
.instances-body .status-legend .dot.failed { background: #ff3b30; }
.instances-body .status-legend .dot.ipBanned { background: #ff7a00; }

.instances-body .location-tabs {
    flex-wrap: nowrap;
    gap: 6px;
    padding: 10px 14px;
    overflow-x: auto;
    border-bottom: 1px solid rgba(60, 60, 67, 0.1);
    background: rgba(246, 247, 250, 0.72);
}

.instances-body .location-tab {
    flex: 0 0 auto;
    min-height: 30px;
    max-width: 220px;
    padding: 5px 9px;
    border-color: rgba(60, 60, 67, 0.12);
    border-radius: 8px;
    background: transparent;
    color: #424245;
    font-size: 13px;
    font-weight: 650;
}

.instances-body .location-tab:hover {
    background: rgba(0, 122, 255, 0.08);
    color: #0057b8;
}

.instances-body .location-tab[aria-selected="true"] {
    border-color: #007aff;
    background: #007aff;
    color: #ffffff;
}

.instances-body .location-tab-count {
    min-width: 20px;
    height: 19px;
    border-radius: 999px;
    background: rgba(60, 60, 67, 0.1);
    color: #6e6e73;
}

.instances-body .location-tab[aria-selected="true"] .location-tab-count {
    background: rgba(255, 255, 255, 0.24);
    color: #ffffff;
}

.instances-body .table-wrap {
    border-radius: 0;
}

.instances-body #instancesTable {
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
}

.instances-body th,
.instances-body td {
    border: 0;
    border-bottom: 1px solid rgba(60, 60, 67, 0.1);
    padding: 10px 12px;
}

.instances-body th.col-select,
.instances-body td.col-select {
    width: 40px;
    padding-left: 10px;
    padding-right: 4px;
    text-align: center;
    vertical-align: middle;
}

.instances-body #instancesTable th:nth-child(2),
.instances-body #instancesTable td:nth-child(2) {
    padding-left: 4px;
    padding-right: 4px;
    color: #86868b;
    font-variant-numeric: tabular-nums;
}

.instances-body #instancesTable td:nth-child(4) {
    color: #424245;
    font-weight: 650;
    white-space: nowrap;
}

.instances-body .actions-cell {
    min-width: 210px;
    width: 228px;
}

.instances-body thead th {
    background: rgba(248, 249, 252, 0.96);
    color: #6e6e73;
    font-size: 12px;
    font-weight: 750;
    letter-spacing: 0.02em;
}

.instances-body tbody tr {
    background: #ffffff;
}

.instances-body tbody tr:nth-child(even) {
    background: #fbfbfd;
}

.instances-body tbody tr:hover {
    background: #f5f8ff;
}

.instances-body .visa-type-group-cell {
    padding: 9px 14px;
    border-bottom: 1px solid rgba(60, 60, 67, 0.1);
    background: #f2f4f8;
}

.instances-body .visa-type-group-name,
.instances-body .mobile-visa-type-name {
    color: #1d1d1f;
    font-size: 13px;
    font-weight: 760;
}

.instances-body .visa-type-group-count,
.instances-body .mobile-visa-type-count {
    border-radius: 999px;
    background: rgba(0, 122, 255, 0.1);
    color: #0062cc;
}

.instances-body .cell-title {
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 750;
}

.instances-body .cell-sub {
    margin-top: 2px;
    color: #6e6e73;
    font-size: 12px;
    line-height: 1.35;
}

.instances-body .user-title-line,
.instances-body .mobile-title-line {
    gap: 6px;
}

.instances-body .range-chip-list {
    gap: 4px;
}

.instances-body .status-cell-wrap {
    gap: 3px;
}

.instances-body .cell-sub-booked {
    color: #0062cc;
}

.instances-body .instance-badge {
    border-radius: 999px;
    letter-spacing: 0.02em;
}

.instances-body .instance-badge-proxy {
    border: 1px solid rgba(255, 149, 0, 0.22);
    background: rgba(255, 149, 0, 0.12);
    color: #8a5200;
    box-shadow: none;
}

.instances-body .instance-badge-applicant-count {
    border: 1px solid rgba(59, 130, 246, 0.22);
    background: rgba(59, 130, 246, 0.12);
    color: #1d4ed8;
    box-shadow: none;
}

.instances-body .range-chip {
    min-height: 23px;
    border-color: rgba(0, 122, 255, 0.15);
    border-radius: 999px;
    background: rgba(0, 122, 255, 0.08);
    color: #0057b8;
    font-size: 12px;
    font-weight: 650;
}

.instances-body .range-chip-more,
.instances-body .range-chip-empty {
    border-color: rgba(60, 60, 67, 0.12);
    background: rgba(242, 242, 247, 0.86);
    color: #6e6e73;
}

.instances-body .status {
    min-height: 23px;
    padding: 2px 8px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
    line-height: 1.2;
}

.instances-body .status-idle {
    border-color: rgba(142, 142, 147, 0.2);
    background: rgba(142, 142, 147, 0.12);
    color: #55555a;
}

.instances-body .status-queued {
    border-color: rgba(88, 86, 214, 0.2);
    background: rgba(88, 86, 214, 0.1);
    color: #3f3cbb;
}

.instances-body .status-running {
    border-color: rgba(0, 122, 255, 0.2);
    background: rgba(0, 122, 255, 0.1);
    color: #0057b8;
}

.instances-body .status-logging {
    border-color: rgba(255, 149, 0, 0.2);
    background: rgba(255, 149, 0, 0.12);
    color: #8a5200;
}

.instances-body .status-scheduling {
    border-color: rgba(175, 82, 222, 0.2);
    background: rgba(175, 82, 222, 0.1);
    color: #7b2fb1;
}

.instances-body .status-invalidCredentials {
    border-color: rgba(191, 91, 0, 0.22);
    background: rgba(191, 91, 0, 0.12);
    color: #8a3f00;
}

.instances-body .status-noAppointmentEntry {
    border-color: rgba(100, 116, 139, 0.22);
    background: rgba(100, 116, 139, 0.12);
    color: #475569;
}

.instances-body .status-bookedInRange {
    border-color: rgba(13, 148, 136, 0.22);
    background: rgba(13, 148, 136, 0.12);
    color: #0f766e;
}

.instances-body .status-success {
    border-color: rgba(52, 199, 89, 0.22);
    background: rgba(52, 199, 89, 0.12);
    color: #137d34;
}

.instances-body .status-failed {
    border-color: rgba(255, 59, 48, 0.22);
    background: rgba(255, 59, 48, 0.1);
    color: #bf1d16;
}

.instances-body .status-ipBanned {
    border-color: rgba(255, 122, 0, 0.22);
    background: rgba(255, 122, 0, 0.12);
    color: #9a4d00;
}

.instances-body .last-write-hint,
.instances-body .schedule-api-latency-hint,
.instances-body .poll-state-hint,
.instances-body .ip-ban-hint {
    color: #86868b;
    font-size: 11px;
}

.instances-body .ip-ban-hint {
    color: #9a4d00;
}

.instances-body .poll-state-hint-warn,
.poll-state-hint-warn {
    color: #9a4d00;
}

.instances-body .poll-state-hint-sprint,
.poll-state-hint-sprint {
    color: #c2410c;
}

.instances-body .action-button-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
}

.instances-body .action-button-grid .action-button {
    min-height: 28px;
    padding: 4px 6px;
    overflow: hidden;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.instances-body .mobile-card-actions .action-button {
    min-height: 40px;
    padding: 8px 10px;
    overflow: hidden;
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.instances-body td.empty,
.instances-body .mobile-empty {
    color: #86868b;
}

.instances-body input,
.instances-body select {
    min-height: 36px;
    border: 1px solid rgba(60, 60, 67, 0.16);
    border-radius: 8px;
    background-color: rgba(255, 255, 255, 0.94);
    color: #1d1d1f;
    font-size: 14px;
}

.instances-body input::placeholder {
    color: #a1a1a6;
}

.instances-body label {
    color: #424245;
    font-size: 13px;
    font-weight: 700;
}

.instances-body .modal {
    background: rgba(20, 22, 28, 0.34);
    backdrop-filter: blur(18px);
}

.instances-body .modal-content {
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    background: rgba(250, 250, 252, 0.96);
    box-shadow: 0 30px 90px rgba(20, 24, 32, 0.24);
}

.instances-body .instance-modal-content {
    padding: 14px;
}

.instances-body .instance-modal-header {
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(60, 60, 67, 0.1);
}

.instances-body .instance-modal-title {
    color: #1d1d1f;
    font-weight: 760;
}

.settings-modal-content {
    width: min(92vw, 460px);
    padding: 14px 16px 16px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding-top: 12px;
}

.settings-section {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.72);
}

.settings-section-title {
    margin: 0 0 10px;
    color: #6e6e73;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.settings-grid {
    display: grid;
    gap: 12px;
}

.settings-form .form-group {
    margin-bottom: 0;
}

.settings-form .checkbox-label {
    padding: 0;
    gap: 10px;
    align-items: flex-start;
    color: #1d1d1f;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.35;
}

.settings-form .checkbox-label input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

.settings-toggle-desc {
    display: block;
    margin-top: 2px;
    color: #6e6e73;
    font-size: 12px;
    font-weight: 500;
}

.settings-form .form-hint {
    margin-top: 8px;
}

.avoid-panel {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
    border: 1px solid rgba(60, 60, 67, 0.12);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.76);
    box-shadow: 0 10px 24px rgba(20, 24, 32, 0.05);
}

.avoid-panel[data-active="yes"] {
    border-color: rgba(191, 87, 0, 0.45);
    background: #fff4e5;
    box-shadow: 0 10px 24px rgba(154, 52, 18, 0.08);
}

.avoid-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.avoid-panel-copy h2 {
    margin: 0;
    color: #1d1d1f;
    font-size: 16px;
    font-weight: 750;
    line-height: 1.3;
}

.avoid-panel[data-active="yes"] .avoid-panel-copy h2 {
    color: #9a3412;
}

.avoid-panel-copy p {
    margin: 4px 0 0;
    max-width: 760px;
    color: #6e6e73;
    font-size: 13px;
    line-height: 1.45;
}

.avoid-panel-actions {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    gap: 8px;
}

.avoid-count {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 2px 10px;
    border-radius: 999px;
    background: rgba(60, 60, 67, 0.08);
    color: #424245;
    font-size: 12px;
    font-weight: 700;
}

.avoid-panel[data-active="yes"] .avoid-count {
    background: #ffedd5;
    color: #9a3412;
}

.avoid-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.avoid-status {
    margin: 0;
    font-size: 13px;
    font-weight: 650;
}

.avoid-status.is-error {
    color: #bf1d16;
}

.avoid-status.is-ok {
    color: #0f766e;
}

@media (max-width: 720px) {
    .avoid-panel-head {
        flex-direction: column;
    }

    .avoid-row {
        flex-wrap: wrap;
    }
}

.avoid-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.avoid-row select,
.avoid-row input[type="date"] {
    min-width: 0;
    padding: 6px 8px;
    border: 1px solid rgba(60, 60, 67, 0.22);
    border-radius: 8px;
    font-size: 13px;
}

.avoid-row select {
    flex: 0 0 96px;
}

.avoid-row input[type="date"] {
    flex: 1 1 0;
}

.avoid-row-sep {
    color: #6e6e73;
}

.avoid-row-remove {
    flex: 0 0 auto;
    border: 0;
    background: transparent;
    color: #bf1d16;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

.avoid-empty {
    color: #6e6e73;
    font-size: 13px;
}

.settings-form .form-hint.is-error {
    color: #bf1d16;
}

.settings-form .instance-form-actions {
    padding-top: 2px;
}

.instances-body .instance-form-grid {
    gap: 10px;
    padding-top: 12px;
}

.instances-body .close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    color: #6e6e73;
    font-size: 24px;
    line-height: 1;
}

.instances-body .close:hover {
    background: rgba(60, 60, 67, 0.1);
    color: #1d1d1f;
}

.instances-body .range-row {
    gap: 8px;
}

.instances-body .mobile-list {
    background: #ffffff;
}

.instances-body .mobile-instance-card {
    border-top: 1px solid rgba(60, 60, 67, 0.1);
    background: #ffffff;
}

.instances-body .mobile-instance-card:nth-of-type(even) {
    background: #fbfbfd;
}

.instances-body .mobile-visa-type-group {
    border-color: rgba(60, 60, 67, 0.1);
    background: #f2f4f8;
}

.instances-body .mobile-card-title {
    color: #1d1d1f;
    font-weight: 760;
}

.instances-body .mobile-card-subtitle,
.instances-body .mobile-meta-label {
    color: #6e6e73;
}

@media (max-width: 1180px) {
    .instances-body .overview-grid {
        grid-template-columns: repeat(3, minmax(150px, 1fr));
    }

    .instances-body .toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .instances-body .toolbar-right {
        grid-column: 1 / -1;
        justify-content: stretch;
    }
}

@media (max-width: 900px) {
    body.instances-body {
        height: auto;
        min-height: 100vh;
        padding: 12px;
        overflow: auto;
    }

    .instances-body .container {
        min-height: auto;
    }

    .instances-body .page-header {
        align-items: stretch;
        flex-direction: column;
        gap: 10px;
    }

    .instances-body .page-header-side,
    .instances-body .local-ip,
    .instances-body .platform-target-badge {
        width: 100%;
        justify-content: flex-start;
        box-sizing: border-box;
    }

    .instances-body .overview-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .instances-body .overview-card-node {
        grid-column: 1 / -1;
    }

    .instances-body .toolbar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .instances-body .toolbar-section {
        width: auto;
        display: grid;
        grid-template-columns: auto repeat(2, minmax(0, 1fr));
    }

    .instances-body .toolbar-right {
        grid-template-columns: 1fr 1fr;
    }

    .instances-body .toolbar-right .node-selector-wrap {
        grid-column: 1 / -1;
        min-width: 0;
    }

    .instances-body .toolbar-left button:not(.btn-text),
    .instances-body .toolbar-right button:not(.btn-text),
    .instances-body .toolbar-right a.btn-link,
    .instances-body .toolbar-sync button:not(.btn-text) {
        width: 100%;
        min-height: 40px;
    }

    .instances-body .toolbar-left .btn-text,
    .instances-body .toolbar-right .btn-text,
    .instances-body .toolbar-sync .btn-text {
        width: auto;
        min-height: 30px;
        justify-self: start;
    }

    .instances-body .card-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .instances-body .card-header-side {
        width: 100%;
        justify-content: flex-start;
    }

    .instances-body .status-legend {
        width: 100%;
    }

    .instances-body .modal-content {
        width: 100%;
        margin: 0 auto;
        max-height: calc(100vh - 24px);
    }
}

@media (max-width: 560px) {
    body.instances-body {
        padding: 8px;
    }

    .instances-body h1 {
        font-size: 26px;
    }

    .instances-body .overview-grid,
    .instances-body .toolbar-section,
    .instances-body .toolbar-right,
    .instances-body .mobile-card-meta,
    .instances-body .mobile-card-actions {
        grid-template-columns: 1fr;
    }

    .instances-body .toolbar-label {
        padding: 0;
    }

    .instances-body .overview-card {
        padding: 12px;
    }

    .instances-body .overview-card strong {
        font-size: 24px;
    }

    .instances-body input,
    .instances-body select,
    .instances-body button,
    .instances-body a.btn-link,
    .instances-body a.btn-text {
        font-size: 16px;
    }

    .instances-body .instance-modal-header {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .instances-body .instance-modal-toolbar {
        order: 3;
        width: 100%;
    }
}

/* -------------------------- 14. 桌面端紧凑优化 -------------------------- */
@media (min-width: 901px) {
    body.instances-body {
        height: auto;
        min-height: 100vh;
        overflow: auto;
    }

    .instances-body .container {
        flex: 0 0 auto;
        gap: 10px;
        min-height: auto;
    }

    .instances-body .page-header {
        align-items: center;
        gap: 12px;
    }

    .instances-body .page-kicker {
        display: none;
    }

    .instances-body h1 {
        margin-top: 0;
        font-size: 24px;
        line-height: 1.08;
    }

    .instances-body .local-ip,
    .instances-body .platform-target-badge {
        min-height: 30px;
        padding: 4px 10px;
        font-size: 12px;
    }

    .instances-body .overview-grid {
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 8px;
    }

    .instances-body .overview-card {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 36px;
        padding: 6px 12px;
    }

    .instances-body .overview-card strong {
        margin-top: 0;
        font-size: 20px;
    }

    .instances-body .overview-card-resource {
        display: block;
    }

    .instances-body .overview-card-resource .resource-meter {
        margin-top: 5px;
    }

    .instances-body .overview-card-node strong {
        max-width: 72%;
        font-size: 14px;
    }

    .instances-body .toolbar {
        grid-template-columns: auto auto minmax(360px, 1fr);
        gap: 5px;
    }

    .instances-body .toolbar-section {
        gap: 4px;
        padding: 3px 4px;
    }

    .instances-body button,
    .instances-body a.btn-link,
    .instances-body a.btn-text,
    .instances-body .btn-secondary {
        min-height: 30px;
        padding: 4px 10px;
        font-size: 13px;
    }

    .instances-body .btn-text,
    .instances-body a.btn-text {
        padding: 4px 8px;
    }

    .instances-body #nodeSwitcher {
        height: 30px;
        font-size: 13px;
    }

    .instances-body .card {
        flex: 0 0 auto;
        min-height: auto;
    }

    .instances-body .card-header {
        padding: 8px 14px;
    }

    .instances-body .card-title {
        font-size: 15px;
    }

    .instances-body .card-kicker {
        display: none;
    }

    .instances-body .card-kicker,
    .instances-body .toolbar-label,
    .instances-body .overview-label {
        font-size: 11px;
        letter-spacing: 0.03em;
    }

    .instances-body .location-tabs {
        gap: 6px;
        padding: 8px 12px;
    }

    .instances-body .location-tab {
        min-height: 28px;
        padding: 4px 9px;
        font-size: 12px;
    }

    .instances-body .table-wrap {
        flex: 0 0 auto;
        min-height: auto;
        overflow: visible;
    }

    .instances-body th,
    .instances-body td {
        padding: 8px 10px;
    }

    .instances-body th.col-select,
    .instances-body td.col-select {
        padding-left: 10px;
        padding-right: 4px;
    }

    .instances-body .visa-type-group-cell {
        padding: 7px 12px;
    }

    .instances-body .action-button-grid {
        gap: 4px;
    }

    .instances-body .action-button-grid .action-button {
        min-height: 28px;
        padding: 4px 6px;
        font-size: 12px;
    }

    .instances-body .mobile-instance-card {
        padding: 12px 14px;
    }

    .instances-body .mobile-card-header {
        margin-bottom: 8px;
    }

    .instances-body .mobile-card-meta {
        gap: 8px 10px;
        margin-bottom: 10px;
    }
}
