:root {
    --admin-ink: #18222d;
    --admin-muted: #66727f;
    --admin-line: #dce2e7;
    --admin-bg: #f3f5f7;
    --admin-panel: #ffffff;
    --admin-primary: #1769aa;
    --admin-primary-dark: #0e4f86;
    --admin-teal: #137f78;
    --admin-danger: #b43b45;
    --admin-warning: #a46709;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--admin-ink); font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif; letter-spacing: 0; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }

/* Login */
.login-body { min-height: 100vh; background: #e9eef1; display: grid; place-items: center; padding: 32px; }
.login-shell { width: min(980px, 100%); min-height: 590px; display: grid; grid-template-columns: 1.08fr .92fr; background: #fff; border: 1px solid #d5dde2; box-shadow: 0 18px 48px rgba(24,34,45,.12); }
.login-context { background: #173f5f; color: #fff; padding: 64px 58px; display: flex; flex-direction: column; justify-content: center; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 52px; }
.login-brand span { width: 42px; height: 42px; display: grid; place-items: center; background: #fff; color: #173f5f; border-radius: 6px; font-weight: 800; }
.login-brand strong { font-size: 24px; }
.login-context h1 { margin: 0 0 18px; max-width: 420px; font-size: 36px; line-height: 1.25; font-weight: 700; }
.login-context > p { margin: 0; color: #d9e6ee; font-size: 16px; line-height: 1.8; }
.login-context dl { margin: 46px 0 0; display: grid; gap: 18px; }
.login-context dl div { border-left: 3px solid #55b7a7; padding-left: 16px; }
.login-context dt { font-weight: 700; }
.login-context dd { margin: 4px 0 0; color: #bed1dc; font-size: 13px; }
.login-panel { padding: 70px 58px; display: flex; flex-direction: column; justify-content: center; }
.login-title span { color: var(--admin-primary); font-size: 13px; font-weight: 700; }
.login-title h2 { margin: 8px 0; font-size: 30px; }
.login-title p { margin: 0 0 30px; color: var(--admin-muted); }
.login-form { display: grid; }
.login-form label { display: grid; gap: 8px; margin-top: 18px; color: #394653; font-size: 13px; font-weight: 700; }
.login-form input[type=text], .login-form input[type=password] { width: 100%; height: 46px; border: 1px solid #cbd4da; border-radius: 6px; padding: 0 13px; outline: none; }
.login-form input:focus { border-color: var(--admin-primary); box-shadow: 0 0 0 3px rgba(23,105,170,.12); }
.login-form .remember-check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.login-form button { height: 46px; margin-top: 25px; border: 0; border-radius: 6px; background: var(--admin-primary); color: #fff; font-weight: 700; }
.login-form button:hover { background: var(--admin-primary-dark); }
.form-error, .field-error { color: var(--admin-danger); font-size: 13px; }
.form-error ul { margin: 0; padding-left: 18px; }

/* Admin framework */
.admin-body { background: var(--admin-bg); }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.admin-sidebar { position: sticky; top: 0; height: 100vh; padding: 22px 16px 16px; background: #1c2935; color: #d9e2e8; display: flex; flex-direction: column; z-index: 20; }
.admin-brand { min-height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 8px 18px; border-bottom: 1px solid #31404d; }
.admin-brand-mark { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 38px; border-radius: 6px; background: #4f9d94; color: #fff; font-weight: 800; }
.admin-brand strong, .admin-brand small { display: block; }
.admin-brand strong { font-size: 19px; color: #fff; }
.admin-brand small { margin-top: 2px; color: #9fb0bd; font-size: 11px; white-space: nowrap; }
.admin-nav { flex: 1; overflow-y: auto; padding-top: 16px; }
.admin-nav p { margin: 18px 10px 7px; color: #738796; font-size: 11px; font-weight: 700; }
.admin-nav a { min-height: 42px; display: flex; align-items: center; gap: 11px; margin: 3px 0; padding: 0 12px; border-radius: 5px; color: #bfccd5; font-size: 14px; }
.admin-nav a span { width: 22px; color: #71899a; font-size: 11px; font-weight: 700; text-align: center; }
.admin-nav a:hover { background: #273745; color: #fff; }
.admin-nav a.active { background: #f5f7f8; color: #172430; font-weight: 700; }
.admin-nav a.active span { color: var(--admin-teal); }
.sidebar-footer { min-height: 58px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 14px 5px 0; border-top: 1px solid #31404d; }
.admin-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #506271; color: #fff; }
.sidebar-footer strong, .sidebar-footer small { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sidebar-footer strong { color: #fff; font-size: 12px; }
.sidebar-footer small { color: #8196a5; font-size: 10px; }
.logout-form button { border: 0; background: transparent; color: #aebdc7; font-size: 11px; padding: 4px; }
.admin-main { min-width: 0; }
.admin-topbar { height: 64px; position: sticky; top: 0; z-index: 15; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 28px; background: rgba(255,255,255,.97); border-bottom: 1px solid var(--admin-line); }
.sidebar-toggle { display: none; border: 0; background: transparent; font-size: 22px; }
.workspace-switcher { display: flex; align-items: center; gap: 10px; }
.workspace-switcher label { color: var(--admin-muted); font-size: 12px; }
.workspace-switcher select { height: 34px; min-width: 190px; border: 1px solid #cfd7dc; border-radius: 5px; padding: 0 30px 0 10px; background: #fff; }
.topbar-status { display: flex; align-items: center; gap: 7px; color: var(--admin-muted); font-size: 12px; }
.topbar-status span { width: 8px; height: 8px; border-radius: 50%; background: #2f9b62; }
.admin-content { width: min(1440px, 100%); margin: 0 auto; padding: 28px; }
.admin-alert { margin-bottom: 18px; padding: 12px 14px; border: 1px solid #a9d3bc; border-radius: 6px; background: #eef8f2; color: #21603e; font-size: 13px; }
.admin-alert.danger { border-color: #e5b2b7; background: #fff1f2; color: #8d2c35; }
.admin-alert.warning { border-color: #e5cd9d; background: #fff9eb; color: #80520b; }

/* Page-level admin UI */
.page-heading { min-height: 76px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.page-heading > div { min-width: 0; }
.page-heading span { display: block; margin-bottom: 5px; color: var(--admin-teal); font-size: 12px; font-weight: 700; }
.page-heading h1 { margin: 0; font-size: 26px; line-height: 1.3; }
.page-heading p { margin: 7px 0 0; color: var(--admin-muted); font-size: 13px; }
.btn-primary-action, .btn-secondary-action { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; padding: 0 15px; border-radius: 5px; font-size: 13px; font-weight: 700; }
.btn-primary-action { background: var(--admin-primary); color: #fff; }
.btn-primary-action:hover { background: var(--admin-primary-dark); color: #fff; }
.btn-secondary-action { border: 1px solid #c8d1d7; background: #fff; color: #34424e; }
.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric-row article { min-height: 126px; padding: 20px; background: var(--admin-panel); border: 1px solid var(--admin-line); border-radius: 7px; }
.metric-row span, .metric-row small { display: block; color: var(--admin-muted); font-size: 12px; }
.metric-row strong { display: block; margin: 10px 0 8px; font-size: 30px; line-height: 1; }
.content-section, .form-section { margin-bottom: 18px; background: var(--admin-panel); border: 1px solid var(--admin-line); border-radius: 7px; }
.content-section { padding: 20px; }
.form-section { padding: 22px; }
.compact-section { padding-bottom: 24px; }
.section-heading { min-height: 42px; display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 17px; }
.section-heading h2 { margin: 0; font-size: 17px; line-height: 1.4; }
.section-heading p { margin: 5px 0 0; color: var(--admin-muted); font-size: 12px; }
.section-heading > a { color: var(--admin-primary); font-size: 12px; font-weight: 700; }
.setup-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--admin-line); border: 1px solid var(--admin-line); }
.setup-steps a { min-height: 76px; display: flex; align-items: center; gap: 12px; padding: 15px; background: #fff; }
.setup-steps a:hover { background: #f7fafb; }
.setup-steps > a > span { width: 30px; height: 30px; display: grid; place-items: center; flex: 0 0 30px; border-radius: 50%; background: #e6f1f0; color: var(--admin-teal); font-weight: 700; }
.setup-steps strong, .setup-steps small { display: block; }
.setup-steps strong { font-size: 13px; }
.setup-steps small { margin-top: 4px; color: var(--admin-muted); font-size: 11px; }

/* Forms and tables */
.filter-bar { margin-bottom: 18px; padding: 15px 18px; background: #fff; border: 1px solid var(--admin-line); border-radius: 7px; }
.filter-bar form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.filter-bar label { display: grid; gap: 5px; color: var(--admin-muted); font-size: 11px; }
.filter-bar input, .filter-bar select { width: 210px; height: 36px; border: 1px solid #ccd5da; border-radius: 5px; padding: 0 10px; background: #fff; }
.filter-bar button { height: 36px; border: 0; border-radius: 5px; padding: 0 15px; background: #263c4d; color: #fff; font-size: 12px; }
.filter-bar form > a { height: 36px; display: inline-flex; align-items: center; color: var(--admin-muted); font-size: 12px; }
.table-wrap { width: 100%; overflow-x: auto; }
.admin-table { width: 100%; min-width: 760px; border-collapse: collapse; }
.admin-table th { height: 42px; padding: 0 12px; border-bottom: 1px solid #cfd7dc; color: #66727f; background: #f8f9fa; font-size: 11px; font-weight: 700; text-align: left; white-space: nowrap; }
.admin-table td { height: 58px; padding: 10px 12px; border-bottom: 1px solid #e7ebee; color: #35424d; font-size: 12px; vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table td strong, .admin-table td small { display: block; }
.admin-table td strong { color: #1d2933; font-size: 13px; }
.admin-table td small { margin-top: 3px; color: #85909a; font-size: 10px; }
.admin-table code { color: #236067; font-size: 11px; }
.action-column { width: 220px; }
.row-actions { white-space: nowrap; }
.row-actions > a, .row-actions > form, .card-actions > a, .card-actions > form { display: inline-block; vertical-align: middle; }
.row-actions a, .row-actions button, .card-actions a, .card-actions button { border: 0; background: transparent; color: var(--admin-primary); font-size: 11px; padding: 4px 6px; }
.row-actions .danger-link, .card-actions .danger-link { color: var(--admin-danger); }
.status-badge { display: inline-flex; align-items: center; min-height: 24px; padding: 0 8px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.status-badge.enabled { background: #e9f6ef; color: #216845; }
.status-badge.disabled { background: #edf0f2; color: #68737c; }
.status-badge.error { background: #ffedef; color: #a6313b; }
.health-dot { width: 8px; height: 8px; display: inline-block; margin-left: 7px; border-radius: 50%; }
.health-dot.ok { background: #2c9a63; }
.health-dot.bad { background: #ce4b55; }
.empty-cell { height: 100px !important; color: var(--admin-muted) !important; text-align: center; }
.empty-panel { padding: 35px 20px; border: 1px dashed #cfd6dc; color: var(--admin-muted); text-align: center; font-size: 12px; }
.editor-form { padding-bottom: 70px; }
.form-grid { display: grid; gap: 17px; }
.form-grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid label { min-width: 0; display: grid; gap: 7px; color: #4c5964; font-size: 12px; font-weight: 700; }
.form-grid label > span { display: inline; color: var(--admin-danger); }
.form-grid input:not([type=checkbox]):not([type=color]), .form-grid select, .form-grid textarea { width: 100%; min-width: 0; border: 1px solid #cbd4da; border-radius: 5px; background: #fff; outline: none; }
.form-grid input:not([type=checkbox]):not([type=color]), .form-grid select { height: 39px; padding: 0 10px; }
.form-grid textarea { padding: 9px 10px; resize: vertical; line-height: 1.6; }
.form-grid input:focus, .form-grid select:focus, .form-grid textarea:focus { border-color: var(--admin-primary); box-shadow: 0 0 0 3px rgba(23,105,170,.1); }
.form-grid .readonly-field, .readonly-field { background: #eef1f3 !important; color: #6f7a82; cursor: not-allowed; }
.icon-config-field { min-width: 0; display: grid; gap: 11px; }
.field-title { color: #4c5964; font-size: 12px; font-weight: 700; }
.field-title > span { color: var(--admin-danger); }
.mode-segments { width: fit-content; display: flex; border: 1px solid #cbd4da; border-radius: 5px; overflow: hidden; }
.mode-segments label { margin: 0; cursor: pointer; }
.mode-segments input { position: absolute; width: 1px !important; height: 1px !important; min-width: 0 !important; margin: -1px; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; }
.mode-segments span { min-width: 92px; height: 34px; display: grid; place-items: center; background: #fff; color: #65717a; font-size: 10px; }
.mode-segments label + label span { border-left: 1px solid #cbd4da; }
.mode-segments input:checked + span { background: var(--admin-primary); color: #fff; }
.icon-mode-panel[hidden], .source-panel[hidden], .connection-test-result[hidden] { display: none !important; }
.icon-choice-grid { display: grid; grid-template-columns: repeat(8, minmax(76px, 1fr)); gap: 8px; }
.icon-choice { min-width: 0; min-height: 80px; display: grid; place-items: center; align-content: center; gap: 5px; position: relative; border: 1px solid #d7dfe3; border-radius: 6px; background: #fff; cursor: pointer; }
.icon-choice input { position: absolute; width: 1px !important; height: 1px !important; min-width: 0 !important; margin: -1px; padding: 0 !important; border: 0 !important; opacity: 0; }
.icon-choice > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: #eaf2f8; color: #1769aa; font-size: 10px; font-weight: 800; }
.icon-choice strong { max-width: 100%; overflow: hidden; color: #58656f; font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.icon-choice:has(input:checked), .icon-choice.selected { border-color: var(--admin-primary); box-shadow: 0 0 0 2px rgba(23,105,170,.12); }
.icon-choice:has(input:checked) > span, .icon-choice.selected > span { background: var(--admin-primary); color: #fff; }
.source-summary { margin-bottom: 17px; }
.source-panel { margin-top: 16px; padding-top: 16px; border-top: 1px solid #e2e7ea; }
.jump-panel { margin-top: 15px; padding: 15px 0 2px; border-top: 1px solid #e2e7ea; }
.jump-panel[hidden] { display: none !important; }
.connection-test-button { min-width: 88px; }
.connection-test-button:disabled { opacity: .6; cursor: wait; }
.connection-test-result { margin-top: 16px; padding: 11px 13px; border-left: 3px solid #80909b; background: #f2f4f5; color: #53616a; font-size: 10px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.connection-test-result.success { border-color: #27806f; background: #edf8f5; color: #21695e; }
.connection-test-result.error { border-color: #b54a54; background: #fff2f3; color: #8f343c; }
.runtime-variable-list { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.runtime-variable { min-width: 0; display: grid; gap: 4px; padding: 10px; border: 1px solid #dce5e8; border-radius: 6px; background: #f8fbfb; }
.runtime-variable code { overflow: hidden; color: #216d68; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.runtime-variable span { overflow: hidden; color: #53616a; font-size: 10px; white-space: nowrap; text-overflow: ellipsis; }
.runtime-variable small { color: #8a969d; font-size: 9px; }
.editable-row.constant { grid-template-columns: 160px minmax(180px, .8fr) minmax(260px, 1.5fr) 32px; }
.editable-row.constant-item { grid-template-columns: 160px minmax(180px, .8fr) minmax(260px, 1.5fr) 32px; }
.constant-key { min-width: 0; display: grid; gap: 3px; }
.constant-key code { overflow: hidden; color: #216d68; font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.constant-key small { color: #8a969d; font-size: 9px; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.switch-field { grid-template-columns: 34px minmax(0, 1fr); align-items: center; }
.switch-field > input { grid-row: span 2; width: 34px; height: 18px; }
.switch-field > span { color: var(--admin-muted) !important; font-size: 10px; font-weight: 400; }
.sticky-actions { position: sticky; bottom: 0; z-index: 10; min-height: 62px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 10px 16px; border: 1px solid #d2d9de; background: rgba(255,255,255,.97); box-shadow: 0 -6px 18px rgba(24,34,45,.06); }
.sticky-actions a { min-height: 38px; display: inline-flex; align-items: center; padding: 0 15px; color: var(--admin-muted); font-size: 12px; }
.sticky-actions button { min-height: 38px; border: 0; border-radius: 5px; padding: 0 18px; background: var(--admin-primary); color: #fff; font-size: 12px; font-weight: 700; }
.subtable-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; margin: 22px 0 10px; }
.subtable-heading strong, .subtable-heading small { display: block; }
.subtable-heading small { margin-top: 3px; color: var(--admin-muted); font-size: 10px; }
.btn-small { min-height: 32px; border: 1px solid #bfcbd2; border-radius: 5px; background: #fff; color: var(--admin-primary); padding: 0 11px; font-size: 11px; }
.editable-table { width: 100%; overflow-x: auto; }
.editable-row { min-width: 900px; display: grid; align-items: center; gap: 7px; padding: 7px 8px; border-bottom: 1px solid #e2e7ea; }
.editable-row.header { grid-template-columns: 1fr 2fr 60px 80px 34px; background: #f5f7f8; color: var(--admin-muted); font-size: 10px; font-weight: 700; }
.editable-row.mapping { grid-template-columns: 130px 120px 1.3fr 88px 120px 120px 50px 160px 34px; background: #f5f7f8; color: var(--admin-muted); font-size: 10px; font-weight: 700; }
.editable-row.header-item { grid-template-columns: 1fr 2fr 60px 80px 34px; }
.editable-row.mapping-item { grid-template-columns: 130px 120px 1.3fr 88px 120px 120px 50px 160px 34px; }
.editable-row input:not([type=checkbox]), .editable-row select { width: 100%; height: 34px; min-width: 0; border: 1px solid #cdd5da; border-radius: 4px; padding: 0 8px; background: #fff; font-size: 11px; }
.editable-row input[type=checkbox] { width: 16px; height: 16px; justify-self: center; }
.icon-remove { width: 28px; height: 28px; border: 0; border-radius: 4px; background: #fff0f1; color: var(--admin-danger); font-size: 18px; line-height: 1; }

/* Agent admin */
.agent-admin-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.agent-admin-card { min-width: 0; padding: 17px; border: 1px solid #dce2e6; border-radius: 7px; background: #fff; }
.agent-card-head { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.agent-symbol { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 7px; background: #e8f2f3; color: #1c6e72; font-weight: 800; }
.agent-card-head h3 { margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; }
.agent-card-head small { display: block; margin-top: 3px; color: var(--admin-muted); font-size: 10px; }
.agent-admin-card > p { height: 42px; margin: 16px 0; overflow: hidden; color: var(--admin-muted); font-size: 12px; line-height: 1.7; }
.agent-admin-card dl { margin: 0; padding: 10px 0; border-top: 1px solid #e8ecef; border-bottom: 1px solid #e8ecef; }
.agent-admin-card dl div { display: flex; justify-content: space-between; gap: 12px; margin: 5px 0; font-size: 11px; }
.agent-admin-card dt { color: var(--admin-muted); font-weight: 400; }
.agent-admin-card dd { min-width: 0; margin: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-actions { margin-top: 11px; text-align: right; }
.category-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.category-list > span { padding: 7px 10px; border: 1px solid #d5dfe3; border-radius: 5px; background: #f8fafb; font-size: 11px; }
.category-list small { margin-left: 5px; color: var(--admin-muted); }
.category-list em { color: var(--admin-muted); font-size: 12px; }
.inline-create-form { display: grid; grid-template-columns: 1.2fr 1.2fr 100px 100px; gap: 8px; max-width: 700px; }
.inline-create-form input { height: 36px; min-width: 0; border: 1px solid #cbd4da; border-radius: 5px; padding: 0 9px; }
.inline-create-form button { border: 0; border-radius: 5px; background: #263c4d; color: #fff; font-size: 11px; }

/* Mobile configuration */
.mobile-config-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; align-items: start; gap: 22px; }
.mobile-config-fields { min-width: 0; padding-bottom: 20px; }
.toggle-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.toggle-grid label { min-height: 66px; display: flex; align-items: center; gap: 11px; padding: 12px; border: 1px solid #d7dfe4; border-radius: 6px; }
.toggle-grid input { width: 18px; height: 18px; flex: 0 0 auto; }
.toggle-grid strong, .toggle-grid small { display: block; }
.toggle-grid strong { font-size: 12px; }
.toggle-grid small { margin-top: 4px; color: var(--admin-muted); font-size: 10px; line-height: 1.5; }
.agent-check-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 16px; }
.agent-check-list label { min-width: 0; display: flex; align-items: center; gap: 9px; padding: 10px; border: 1px solid #d9e0e4; border-radius: 5px; }
.agent-check-list strong, .agent-check-list small { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.agent-check-list strong { font-size: 11px; }
.agent-check-list small { color: var(--admin-muted); font-size: 9px; }
.color-field { display: grid !important; grid-template-columns: 42px minmax(0, 1fr); gap: 7px; }
.color-field input[type=color] { width: 42px; height: 39px; padding: 2px; border: 1px solid #cbd4da; border-radius: 5px; background: #fff; }
.dynamic-data-note { display: flex; align-items: flex-start; gap: 14px; margin-top: 16px; padding: 12px 14px; border-left: 3px solid var(--admin-teal); background: #f1f7f6; }
.dynamic-data-note strong { flex: 0 0 auto; color: #245f5b; font-size: 11px; }
.dynamic-data-note span { color: #5e6e70; font-size: 11px; line-height: 1.6; }
.mobile-live-preview { position: sticky; top: 86px; padding: 15px; border: 1px solid #d6dde2; border-radius: 7px; background: #eef1f3; }
.preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.preview-heading strong, .preview-heading small { display: block; }
.preview-heading strong { font-size: 12px; }
.preview-heading small { max-width: 270px; margin-top: 3px; overflow: hidden; color: var(--admin-muted); font-size: 9px; white-space: nowrap; text-overflow: ellipsis; }
.preview-heading button { border: 1px solid #c5ced4; border-radius: 4px; background: #fff; color: var(--admin-primary); font-size: 10px; padding: 5px 8px; }
.phone-frame { width: 340px; height: 650px; max-width: 100%; margin: 0 auto; overflow: hidden; border: 8px solid #27313a; border-radius: 28px; background: #fff; box-shadow: 0 14px 28px rgba(24,34,45,.18); }
.phone-frame iframe { width: 100%; height: 100%; border: 0; background: #f4f6f8; }
.mobile-live-preview > p { margin: 12px 0 0; color: var(--admin-muted); font-size: 10px; text-align: center; }

/* Employee mobile workbench */
.mobile-body { min-height: 100vh; background: #f0f3f5; color: #1d2730; padding-bottom: 72px; }
.mobile-workbench { width: min(100%, 560px); min-height: 100vh; margin: 0 auto; background: #f4f6f8; }
.mobile-appbar { height: 54px; display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; align-items: center; position: sticky; top: 0; z-index: 5; padding-top: env(safe-area-inset-top); background: #fff; border-bottom: 1px solid #e3e8eb; }
.mobile-appbar h1 { margin: 0; overflow: hidden; font-size: 17px; font-weight: 700; text-align: center; white-space: nowrap; text-overflow: ellipsis; }
.mobile-appbar button, .mobile-appbar > a, .mobile-appbar > span { min-width: 46px; height: 54px; display: grid; place-items: center; border: 0; background: transparent; color: #384652; font-size: 22px; }
.mobile-appbar > span.chat-status { min-width: 46px; color: #2a8a61; font-size: 9px; }
.mobile-message { margin: 12px; padding: 10px; border: 1px solid #e3c891; border-radius: 6px; background: #fff9e9; color: #7b510d; font-size: 11px; }
.employee-overview { min-height: 132px; display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 12px; margin: 12px; padding: 18px; border-radius: var(--mobile-radius); background: var(--mobile-theme); color: #fff; box-shadow: var(--mobile-shadow); }
.employee-avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.2); border: 2px solid rgba(255,255,255,.55); font-weight: 700; }
.employee-avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.employee-greeting { min-width: 0; }
.employee-greeting small { opacity: .76; font-size: 10px; }
.employee-greeting h2 { margin: 4px 0 6px; overflow: hidden; font-size: 16px; white-space: nowrap; text-overflow: ellipsis; }
.employee-greeting p { margin: 0; opacity: .85; font-size: 11px; }
.pending-summary { min-width: 60px; text-align: center; }
.pending-summary strong, .pending-summary span { display: block; }
.pending-summary strong { font-size: 28px; }
.pending-summary span { opacity: .8; font-size: 9px; }
.mobile-module { margin: 12px; padding: 16px; border-radius: var(--mobile-radius); background: #fff; box-shadow: var(--mobile-shadow); }
.mobile-module-heading { min-height: 26px; display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 13px; }
.mobile-module-heading h2 { margin: 0; font-size: 15px; }
.mobile-module-heading a { color: var(--mobile-theme); font-size: 10px; }
.mobile-agent-list { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: none; }
.mobile-agent-list::-webkit-scrollbar { display: none; }
.mobile-agent-item { width: 68px; flex: 0 0 68px; text-align: center; }
.mobile-agent-item > span { width: 44px; height: 44px; display: grid; place-items: center; margin: 0 auto 7px; border-radius: 12px; background: #eaf2f8; color: var(--mobile-theme); font-size: 12px; font-weight: 800; }
.mobile-agent-item strong, .mobile-agent-item small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mobile-agent-item strong { font-size: 10px; }
.mobile-agent-item small { display: none; }
.mobile-agent-list.card-style .mobile-agent-item { width: 142px; flex-basis: 142px; display: grid; grid-template-columns: 38px minmax(0, 1fr); text-align: left; padding: 10px; border: 1px solid #e0e6e9; border-radius: var(--mobile-radius); }
.mobile-agent-list.card-style .mobile-agent-item > span { grid-row: span 2; width: 38px; height: 38px; margin: 0 8px 0 0; }
.mobile-agent-list.card-style .mobile-agent-item small { display: block; margin-top: 4px; color: #7a858e; font-size: 8px; }
.mobile-category-tabs { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.mobile-category-tabs button { min-height: 28px; flex: 0 0 auto; border: 1px solid #dce3e7; border-radius: 14px; background: #fff; color: #6f7b84; padding: 0 11px; font-size: 9px; }
.mobile-category-tabs button.active { border-color: var(--mobile-theme); background: var(--mobile-theme); color: #fff; }
.mobile-approval-list { display: grid; grid-template-columns: repeat(var(--approval-columns), minmax(0, 1fr)); gap: 8px; }
.mobile-approval-item { min-width: 0; min-height: 84px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid #e3e8eb; border-radius: var(--mobile-radius); background: #fbfcfc; }
.mobile-approval-item > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 7px; background: #edf4f3; color: #247670; font-size: 9px; font-weight: 800; }
.mobile-approval-item strong { margin-top: 5px; color: #1f2c35; font-size: 17px; }
.mobile-approval-item small { max-width: 100%; overflow: hidden; color: #6f7b84; font-size: 8px; white-space: nowrap; text-overflow: ellipsis; padding: 0 4px; }
.mobile-approval-item.has-error { border-color: #e8aeb3; background: #fff5f6; }
.mobile-task-item { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-top: 1px solid #e7ebee; }
.mobile-task-item:first-of-type { border-top: 0; }
.mobile-task-item > div { min-width: 0; }
.mobile-task-item strong, .mobile-task-item span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mobile-task-item strong { font-size: 11px; }
.mobile-task-item span { margin-top: 6px; color: #7b858d; font-size: 9px; }
.mobile-task-item em { margin-right: 5px; color: var(--mobile-theme); font-style: normal; }
.mobile-task-item time { flex: 0 0 auto; color: #929ba2; font-size: 8px; }
.mobile-empty { padding: 24px 10px; color: #89939b; font-size: 10px; text-align: center; }
.mobile-page-section { padding: 12px; }
.mobile-search { margin-bottom: 12px; }
.mobile-search input { width: 100%; height: 40px; border: 1px solid #d8e0e4; border-radius: 7px; background: #fff; padding: 0 12px; outline: none; font-size: 11px; }
.mobile-search input:focus { border-color: var(--mobile-theme, #1769aa); }
.mobile-agent-directory { display: grid; gap: 9px; }
.mobile-agent-directory > a { min-height: 76px; display: grid; grid-template-columns: 46px minmax(0, 1fr) 20px; align-items: center; gap: 11px; padding: 12px; border: 1px solid #e1e7ea; border-radius: 8px; background: #fff; box-shadow: 0 3px 10px rgba(30,42,56,.05); }
.mobile-agent-directory > a > span { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; background: #eaf2f8; color: #1769aa; font-size: 11px; font-weight: 800; }
.mobile-agent-directory strong, .mobile-agent-directory small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mobile-agent-directory strong { font-size: 12px; }
.mobile-agent-directory small { margin-top: 5px; color: #7a858e; font-size: 9px; }
.mobile-agent-directory em { color: #a0a9b0; font-size: 20px; font-style: normal; text-align: center; }

/* Agent chat */
.chat-body { padding-bottom: 0; }
.chat-workbench { height: 100vh; display: grid; grid-template-rows: 54px minmax(0, 1fr) auto; overflow: hidden; }
.chat-stream { min-height: 0; overflow-y: auto; padding: 16px 12px 24px; }
.chat-time { margin-bottom: 16px; color: #8b959c; font-size: 9px; text-align: center; }
.chat-message { display: flex; align-items: flex-start; gap: 8px; margin-bottom: 17px; }
.chat-message > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 34px; border-radius: 8px; background: #e8f1f7; color: #1769aa; font-size: 9px; font-weight: 800; }
.chat-message > div { max-width: 78%; }
.chat-message p { margin: 0; padding: 11px 13px; border-radius: 4px 10px 10px 10px; background: #fff; box-shadow: 0 3px 10px rgba(30,42,56,.06); font-size: 11px; line-height: 1.7; white-space: pre-wrap; }
.chat-message.user { justify-content: flex-end; }
.chat-message.user > span { order: 2; background: var(--mobile-theme, #1769aa); color: #fff; }
.chat-message.user p { background: var(--mobile-theme, #1769aa); color: #fff; border-radius: 10px 4px 10px 10px; }
.message-tools { display: flex; gap: 4px; margin-top: 5px; }
.message-tools button { border: 0; background: transparent; color: #7c8790; padding: 3px 5px; font-size: 8px; }
.chat-composer { display: grid; grid-template-columns: 34px minmax(0, 1fr) 38px 38px; align-items: end; gap: 6px; padding: 9px 10px calc(8px + env(safe-area-inset-bottom)); border-top: 1px solid #dce3e7; background: #fff; }
.chat-composer textarea { min-height: 38px; max-height: 110px; resize: none; border: 1px solid #d7dfe3; border-radius: 7px; padding: 9px 10px; outline: none; font-size: 11px; line-height: 1.5; }
.chat-composer > button { width: 34px; height: 38px; border: 0; border-radius: 7px; background: #edf1f3; color: #45535f; font-size: 11px; }
.chat-composer > button.recording { background: #fff0f1; color: #b43b45; }
.chat-composer > button.send-button { background: var(--mobile-theme, #1769aa); color: #fff; font-size: 18px; }
.chat-composer small { grid-column: 1 / -1; color: #9aa3aa; font-size: 7px; text-align: center; }

/* Application entry and profile */
.application-entry { margin: 12px; padding: 28px 20px; border-radius: 8px; background: #fff; box-shadow: 0 4px 14px rgba(30,42,56,.07); text-align: center; }
.application-entry-icon { width: 62px; height: 62px; display: grid; place-items: center; margin: 0 auto 14px; border-radius: 14px; background: #eaf2f8; color: #1769aa; font-size: 16px; font-weight: 800; }
.application-entry h2 { margin: 0; font-size: 18px; }
.application-entry > p { margin: 8px 0 22px; color: #77828b; font-size: 10px; line-height: 1.7; }
.application-entry dl { margin: 0 0 24px; border-top: 1px solid #e5eaed; text-align: left; }
.application-entry dl div { min-height: 44px; display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid #e5eaed; font-size: 10px; }
.application-entry dt { color: #7a858e; }
.application-entry dd { margin: 0; color: #2f3c46; }
.mobile-primary-button { width: 100%; min-height: 44px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: 7px; background: var(--mobile-theme, #1769aa); color: #fff; font-size: 11px; font-weight: 700; }
.mobile-primary-button:disabled { background: #aab3b9; }
.miniapp-info { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 8px; margin-top: 16px; padding: 12px; background: #f4f7f8; color: #52606a; font-size: 9px; text-align: left; word-break: break-all; }
.profile-header { min-height: 126px; display: flex; align-items: center; gap: 14px; margin: 12px; padding: 22px; border-radius: 8px; background: #173f5f; color: #fff; }
.profile-header > span { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.5); }
.profile-header h2 { margin: 0; font-size: 16px; }
.profile-header p { margin: 6px 0 0; opacity: .72; font-size: 9px; }
.profile-menu { margin: 12px; overflow: hidden; border-radius: 8px; background: #fff; box-shadow: 0 4px 14px rgba(30,42,56,.06); }
.profile-menu a { min-height: 68px; display: grid; grid-template-columns: 36px minmax(0, 1fr) 18px; align-items: center; gap: 11px; padding: 10px 14px; border-bottom: 1px solid #e7ebee; }
.profile-menu a:last-child { border-bottom: 0; }
.profile-menu a > span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 7px; background: #edf3f6; color: #1769aa; font-size: 9px; font-weight: 700; }
.profile-menu strong, .profile-menu small { display: block; }
.profile-menu strong { font-size: 11px; }
.profile-menu small { margin-top: 4px; color: #818b93; font-size: 8px; }
.profile-menu em { color: #a0a9b0; font-size: 18px; font-style: normal; }
.mobile-tabbar { width: min(100%, 560px); height: 62px; position: fixed; left: 50%; bottom: 0; z-index: 8; display: flex; justify-content: space-around; transform: translateX(-50%); padding-bottom: env(safe-area-inset-bottom); background: rgba(255,255,255,.98); border-top: 1px solid #dfe5e8; }
.mobile-tabbar a { min-width: 70px; display: grid; place-items: center; align-content: center; gap: 3px; color: #78838c; font-size: 9px; }
.mobile-tabbar a span { font-size: 18px; line-height: 1; }
.mobile-tabbar a.active { color: var(--mobile-theme); }

.user-identity { min-width: 190px; display: flex; align-items: center; gap: 10px; }
.user-identity > img, .user-identity > span { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 50%; object-fit: cover; }
.user-identity > span { display: grid; place-items: center; background: #e7f0ef; color: #1e716a; font-weight: 700; }
.user-identity strong, .user-identity small { display: block; }
.permission-action form { margin: 0; }
.access-toggle { width: 78px; height: 30px; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 15px; padding: 3px 8px 3px 4px; color: #fff; font-size: 9px; }
.access-toggle > span { width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(20,30,40,.25); }
.access-toggle.allowed { background: #287d70; }
.access-toggle.blocked { flex-direction: row-reverse; background: #a94a52; }
.break-text { max-width: 260px; white-space: normal; word-break: break-all; font-size: 9px; line-height: 1.5; }
.profile-header > img { width: 54px; height: 54px; flex: 0 0 54px; border-radius: 50%; object-fit: cover; border: 2px solid rgba(255,255,255,.5); }
.access-denied-page { display: grid; place-items: center; padding: 24px; }
.access-denied-page > section { width: min(100%, 380px); padding: 34px 24px; border: 1px solid #e0e5e8; border-radius: 8px; background: #fff; text-align: center; box-shadow: 0 8px 24px rgba(30,42,56,.08); }
.access-denied-page > section > span { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 18px; border-radius: 50%; background: #fff0f1; color: #aa3d47; font-size: 24px; font-weight: 700; }
.access-denied-page h1 { margin: 0; font-size: 18px; }
.access-denied-page p { margin: 10px 0 22px; color: #78838b; font-size: 11px; line-height: 1.7; }
.access-denied-page button { min-width: 112px; height: 38px; border: 0; border-radius: 5px; background: #216d68; color: #fff; font-size: 11px; }

@media (max-width: 1180px) {
    .agent-admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mobile-config-layout { grid-template-columns: minmax(0, 1fr) 355px; }
    .agent-check-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .icon-choice-grid { grid-template-columns: repeat(4, minmax(76px, 1fr)); }
    .runtime-variable-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
    .admin-shell { grid-template-columns: 1fr; }
    .admin-sidebar { position: fixed; left: -260px; width: 246px; transition: left .2s ease; box-shadow: 10px 0 26px rgba(20,31,40,.18); }
    .sidebar-open .admin-sidebar { left: 0; }
    .sidebar-toggle { display: block; }
    .admin-topbar { justify-content: flex-start; }
    .topbar-status { margin-left: auto; }
    .metric-row, .setup-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .mobile-config-layout { grid-template-columns: 1fr; }
    .mobile-live-preview { position: static; width: min(390px, 100%); margin: 0 auto; }
    .form-grid.cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid.cols-3 .span-3 { grid-column: span 2; }
}

@media (max-width: 680px) {
    .login-body { padding: 0; }
    .login-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; }
    .login-context { min-height: 210px; padding: 30px 24px; justify-content: flex-start; }
    .login-brand { margin-bottom: 20px; }
    .login-context h1 { font-size: 25px; }
    .login-context dl { display: none; }
    .login-panel { padding: 36px 24px; justify-content: flex-start; }
    .admin-topbar { padding: 0 15px; }
    .workspace-switcher label, .topbar-status { display: none; }
    .workspace-switcher select { min-width: 0; max-width: 58vw; }
    .admin-content { padding: 20px 14px; }
    .page-heading { min-height: 0; flex-direction: column; }
    .page-heading h1 { font-size: 22px; }
    .metric-row, .setup-steps, .agent-admin-grid, .toggle-grid, .agent-check-list { grid-template-columns: 1fr; }
    .form-grid.cols-2, .form-grid.cols-3 { grid-template-columns: 1fr; }
    .form-grid .span-2, .form-grid .span-3, .form-grid.cols-3 .span-3 { grid-column: span 1; }
    .form-section, .content-section { padding: 16px; }
    .filter-bar form { display: grid; grid-template-columns: 1fr 1fr; }
    .filter-bar label:first-of-type { grid-column: span 2; }
    .filter-bar input, .filter-bar select { width: 100%; }
    .inline-create-form { grid-template-columns: 1fr; }
    .phone-frame { height: 610px; }
    .icon-choice-grid { grid-template-columns: repeat(2, minmax(76px, 1fr)); }
    .runtime-variable-list { grid-template-columns: 1fr 1fr; }
}
