:root{
    --sidebar-w:228px;
    --top-h:60px;
    --radius-sm:8px;
    --radius-md:12px;
    --radius-lg:16px;
    --accent:#5c67f2;
    --accent-strong:#4f58e6;
    --accent-soft:rgba(92,103,242,.10);
    --bg:#f6f8fc;
    --bg-elevated:#eef3fb;
    --border:#e2e8f0;
    --border-strong:#d7deea;
    --text-main:#1e293b;
    --text-sub:#64748b;
    --surface:#ffffff;
    --surface-soft:#f4f7fb;
    --surface-muted:#eef2f7;
    --success:#22c55e;
    --danger:#ef4444;
    --warning:#b45309;
    --shadow-soft:0 4px 8px rgba(15,23,42,.06);
}

*,
*::before,
*::after{
    box-sizing:border-box;
}

html,
body,
#app{
    width:100%;
    height:100%;
    margin:0;
}

html{
    background:var(--bg);
}

body{
    font-family:"Microsoft YaHei",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
    background:
        radial-gradient(circle at top right, rgba(92,103,242,.08), transparent 28%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-elevated) 100%);
    color:var(--text-main);
    overflow:hidden;
}

button,
input,
select{
    font:inherit;
}

button{
    cursor:pointer;
}

button:disabled,
input:disabled{
    cursor:not-allowed;
    opacity:.58;
}

*::-webkit-scrollbar{
    width:4px;
    height:4px;
}

*::-webkit-scrollbar-track{
    background:transparent;
}

*::-webkit-scrollbar-thumb{
    background:rgba(100,116,139,.38);
    border-radius:999px;
}

*::-webkit-scrollbar-thumb:hover{
    background:rgba(100,116,139,.72);
}

.app-shell{
    min-height:100%;
}

.login-page{
    min-height:100%;
    display:grid;
    place-items:center;
    padding:32px 18px;
}

.login-panel{
    width:min(430px,100%);
    padding:22px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    box-shadow:var(--shadow-soft);
}

.login-brand{
    display:flex;
    align-items:center;
    gap:12px;
    margin-bottom:22px;
}

.brand-mark{
    width:42px;
    height:42px;
    border-radius:50%;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
    color:#fff;
    background:linear-gradient(180deg,var(--accent) 0%,var(--accent-strong) 100%);
    font-size:17px;
    font-weight:800;
    box-shadow:0 10px 18px rgba(92,103,242,.20);
}

.brand-mark-image{
    display:block;
    padding:5px;
    border-radius:8px;
    object-fit:cover;
    background:linear-gradient(180deg, rgba(255,255,255,.96) 0%, rgba(238,243,252,.98) 100%);
    border:1px solid var(--border);
    box-shadow:0 10px 18px rgba(15,23,42,.08);
}

.login-title{
    margin:0;
    font-size:21px;
    line-height:1.25;
}

.login-copy{
    margin:5px 0 0;
    color:var(--text-sub);
    font-size:13px;
    line-height:1.6;
}

.field{
    display:grid;
    gap:8px;
    margin-bottom:14px;
}

.field span{
    font-size:13px;
    font-weight:700;
    color:var(--text-sub);
}

.input{
    width:100%;
    height:42px;
    border:1px solid var(--border-strong);
    border-radius:var(--radius-md);
    padding:0 12px;
    color:var(--text-main);
    background:var(--surface);
    outline:none;
}

.input::placeholder{
    color:#5f6d82;
}

.input:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 4px var(--accent-soft);
}

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

.captcha-question{
    min-height:42px;
    display:flex;
    align-items:center;
    padding:0 12px;
    border:1px solid var(--border-strong);
    border-radius:var(--radius-md);
    color:var(--text-main);
    background:var(--surface-soft);
    font-weight:800;
}

.captcha-refresh{
    min-width:72px;
}

.layout{
    min-height:100%;
    display:grid;
    grid-template-columns:var(--sidebar-w) minmax(0,1fr);
    min-width:0;
}

.sidebar{
    height:100vh;
    min-width:0;
    min-height:0;
    display:flex;
    flex-direction:column;
    padding:14px 12px;
    background:linear-gradient(180deg,var(--surface) 0%,var(--surface-soft) 100%);
    border-right:1px solid var(--border);
}

.brand{
    min-height:58px;
    display:flex;
    align-items:center;
    gap:10px;
    padding:6px 8px 14px;
    border-bottom:1px solid var(--border);
}

.brand-copy{
    min-width:0;
}

.brand-title{
    margin:0;
    color:var(--text-main);
    font-size:16px;
    line-height:1.2;
}

.brand-subtitle{
    margin:4px 0 0;
    color:var(--text-sub);
    font-size:12px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.nav{
    flex:1 1 auto;
    min-height:0;
    display:grid;
    align-content:start;
    gap:6px;
    margin-top:12px;
    padding-bottom:10px;
    overflow-y:auto;
    overflow-x:hidden;
}

.nav-btn{
    width:100%;
    min-height:40px;
    display:flex;
    align-items:center;
    gap:10px;
    padding:0 10px;
    border:1px solid transparent;
    border-radius:var(--radius-md);
    color:var(--text-sub);
    background:transparent;
    text-align:left;
    transition:background-color .18s ease, color .18s ease, border-color .18s ease;
}

.nav-btn:hover{
    color:var(--text-main);
    background:var(--surface-muted);
}

.nav-btn.active{
    color:var(--accent-strong);
    background:var(--accent-soft);
    border-color:rgba(92,103,242,.18);
}

.nav-icon{
    width:26px;
    height:26px;
    border-radius:50%;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
    color:inherit;
    background:rgba(100,116,139,.10);
    font-size:12px;
    font-weight:800;
}

.nav-btn.active .nav-icon{
    color:#fff;
    background:var(--accent);
}

.nav-label{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:13px;
    font-weight:700;
}

.nav-group{
    display:grid;
    gap:4px;
}

.nav-group-btn{
    position:relative;
}

.nav-arrow{
    margin-left:auto;
    color:var(--text-sub);
    font-size:16px;
    line-height:1;
    transform:rotate(-90deg);
    transition:transform .18s ease, color .18s ease;
}

.nav-group.expanded .nav-arrow{
    transform:rotate(0deg);
    color:var(--accent-strong);
}

.nav-submenu{
    display:none;
    gap:3px;
    padding-left:36px;
}

.nav-group.expanded .nav-submenu{
    display:grid;
}

.nav-sub-btn{
    width:100%;
    min-height:32px;
    display:flex;
    align-items:center;
    gap:8px;
    padding:0 9px;
    border:1px solid transparent;
    border-radius:var(--radius-sm);
    color:var(--text-sub);
    background:transparent;
    text-align:left;
    font-size:12px;
    font-weight:700;
    transition:background-color .18s ease, color .18s ease, border-color .18s ease;
}

.nav-sub-btn:hover{
    color:var(--text-main);
    background:var(--surface-muted);
}

.nav-sub-btn.active{
    color:var(--accent-strong);
    background:rgba(92,103,242,.08);
    border-color:rgba(92,103,242,.16);
}

.nav-sub-dot{
    width:6px;
    height:6px;
    border-radius:999px;
    flex-shrink:0;
    background:rgba(100,116,139,.38);
}

.nav-sub-btn.active .nav-sub-dot{
    background:var(--accent);
}

.status-dot{
    width:8px;
    height:8px;
    border-radius:999px;
    display:inline-flex;
    flex-shrink:0;
    background:var(--success);
    box-shadow:0 0 0 4px rgba(34,197,94,.12);
}

.main{
    min-width:0;
    min-height:0;
    height:100vh;
    padding:14px;
    overflow:auto;
}

.main.no-topbar{
    padding-top:14px;
}

.main-fixed{
    display:flex;
    flex-direction:column;
    overflow:hidden;
}

.topbar{
    min-height:var(--top-h);
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    gap:16px;
    margin-bottom:12px;
    padding:0 14px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    box-shadow:0 4px 8px rgba(15,23,42,.04);
}

.page-title{
    margin:0;
    color:var(--text-main);
    font-size:20px;
    line-height:1.25;
}

.page-desc{
    margin:4px 0 0;
    color:var(--text-sub);
    font-size:13px;
}

.user-badge{
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:9px;
    min-width:0;
    color:var(--text-sub);
    font-size:13px;
}

.account-menu{
    position:relative;
    flex:0 0 auto;
}

.account-avatar-btn{
    width:38px;
    height:38px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:0;
    border:1px solid var(--border);
    border-radius:50%;
    background:var(--surface-soft);
    cursor:pointer;
    transition:background-color .18s ease, border-color .18s ease, transform .18s ease;
}

.account-avatar-btn:hover,
.account-avatar-btn[aria-expanded="true"]{
    border-color:var(--accent);
    background:var(--accent-soft);
}

.account-avatar-btn .sub-avatar{
    width:30px;
    height:30px;
    border-radius:50%;
    font-size:16px;
}

.account-popover{
    position:absolute;
    top:46px;
    right:0;
    z-index:40;
    width:min(320px, calc(100vw - 32px));
    padding:14px;
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    background:var(--surface);
    box-shadow:0 12px 24px rgba(15,23,42,.12);
}

.account-popover[hidden]{
    display:none;
}

.account-popover-head{
    display:flex;
    align-items:center;
    gap:10px;
    padding-bottom:12px;
    margin-bottom:12px;
    border-bottom:1px solid var(--border);
}

.account-popover-name{
    color:var(--text-main);
    font-size:14px;
    font-weight:800;
}

.account-popover-role{
    margin-top:3px;
    color:var(--text-sub);
    font-size:12px;
}

.account-popover-form{
    display:grid;
    gap:10px;
}

.account-popover-form .field{
    margin:0;
}

.account-popover-form .btn{
    width:100%;
}

.sync-pill{
    min-height:28px;
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:0 10px;
    border:1px solid rgba(34,197,94,.20);
    border-radius:999px;
    color:#15803d;
    background:rgba(34,197,94,.10);
    font-weight:700;
}

.btn{
    min-height:38px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    padding:0 14px;
    background:var(--surface);
    color:var(--text-main);
    font-weight:700;
    transition:background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.btn:hover{
    border-color:var(--border-strong);
    background:var(--surface-soft);
}

.btn:active{
    transform:translateY(1px);
}

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

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

.btn.ghost{
    background:transparent;
}

.grid-stats,
.metric-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(150px,1fr));
    gap:12px;
    margin-bottom:12px;
}

.stat{
    min-height:112px;
    padding:14px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
}

.stat-label{
    color:var(--text-sub);
    font-size:13px;
    font-weight:700;
}

.stat-value{
    margin-top:8px;
    color:var(--text-main);
    font-size:27px;
    font-weight:800;
    line-height:1.1;
}

.stat-note{
    margin-top:9px;
    color:var(--text-sub);
    font-size:12px;
}

.panel{
    min-width:0;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    overflow:hidden;
}

.panel:has(> .table){
    overflow:auto;
}

.panel-head{
    min-height:54px;
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:10px 14px;
    border-bottom:1px solid var(--border);
    background:var(--surface);
}

.panel-title{
    min-width:0;
    color:var(--text-main);
    font-size:15px;
    font-weight:800;
}

.panel-actions{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    justify-content:flex-end;
    gap:8px;
}

.toolbar{
    min-width:0;
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:10px;
}

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

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

.table th{
    color:var(--text-sub);
    font-weight:800;
    background:var(--surface-soft);
}

.table tr:last-child td{
    border-bottom:none;
}

.overview-latest-table{
    min-width:780px;
    table-layout:fixed;
}

.overview-latest-table th:nth-child(1),
.overview-latest-table td:nth-child(1),
.overview-latest-table th:nth-child(2),
.overview-latest-table td:nth-child(2){
    width:120px;
}

.overview-latest-table th:nth-child(4),
.overview-latest-table td:nth-child(4){
    width:190px;
    white-space:nowrap;
}

.overview-message-text{
    display:-webkit-box;
    max-height:44px;
    overflow:hidden;
    color:var(--text-main);
    line-height:1.6;
    overflow-wrap:anywhere;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
}

.muted{
    color:var(--text-sub);
}

.tag{
    min-height:24px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:0 8px;
    border-radius:999px;
    background:var(--surface-muted);
    color:var(--text-sub);
    font-size:12px;
    font-weight:700;
    white-space:nowrap;
}

.tag.success{
    color:#15803d;
    background:rgba(34,197,94,.10);
}

.tag.warning{
    color:var(--warning);
    background:rgba(245,158,11,.12);
}

.tag.info{
    color:#2563eb;
    background:rgba(37,99,235,.10);
}

.empty{
    padding:28px 16px;
    text-align:center;
    color:var(--text-sub);
    line-height:1.6;
}

.account-log-panel .panel-head{
    min-height:68px;
}

.account-log-panel .muted{
    margin:5px 0 0;
    font-size:12px;
    line-height:1.5;
}

.account-log-empty{
    display:flex;
    align-items:center;
    gap:12px;
    margin:14px;
    padding:14px;
    border:1px dashed var(--border-strong);
    border-radius:var(--radius-md);
    background:var(--surface-soft);
}

.account-log-icon{
    width:38px;
    height:38px;
    border-radius:var(--radius-md);
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex-shrink:0;
    color:var(--accent-strong);
    background:var(--accent-soft);
    font-size:14px;
    font-weight:800;
}

.account-log-empty h3{
    margin:0;
    color:var(--text-main);
    font-size:14px;
}

.account-log-empty p{
    margin:4px 0 0;
    color:var(--text-sub);
    font-size:12px;
    line-height:1.55;
}

.account-log-filter{
    display:flex;
    flex-wrap:wrap;
    align-items:end;
    gap:12px;
    padding:14px;
    border-bottom:1px solid var(--border);
    background:var(--surface);
}

.log-filter-field{
    display:flex;
    flex-direction:column;
    gap:6px;
    min-width:220px;
}

.log-filter-field > span{
    color:var(--text-sub);
    font-size:12px;
    font-weight:800;
}

.log-time-trigger{
    width:360px;
    max-width:100%;
    min-height:42px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:0 13px;
    border:1px solid var(--border-strong);
    border-radius:var(--radius-md);
    background:var(--surface);
    color:var(--text-main);
    font:inherit;
    font-size:13px;
    cursor:pointer;
}

.log-time-trigger:hover,
.log-time-trigger[aria-expanded="true"]{
    border-color:var(--accent);
    box-shadow:0 0 0 3px var(--accent-soft);
}

.log-time-trigger small{
    color:var(--text-sub);
    font-size:12px;
}

.log-time-popover{
    position:fixed;
    z-index:30;
    width:min(610px,calc(100vw - 24px));
    display:grid;
    grid-template-columns:140px minmax(0,1fr);
    overflow:hidden;
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    background:var(--surface);
    box-shadow:0 18px 40px rgba(15,23,42,.16);
}

.log-time-popover[hidden]{
    display:none;
}

.log-time-shortcuts{
    display:flex;
    flex-direction:column;
    gap:2px;
    padding:10px;
    border-right:1px solid var(--border);
    background:var(--surface-soft);
}

.log-time-shortcuts button{
    min-height:34px;
    padding:0 9px;
    border:0;
    border-radius:var(--radius-sm);
    background:transparent;
    color:var(--text-sub);
    text-align:left;
    font:inherit;
    font-size:13px;
    cursor:pointer;
}

.log-time-shortcuts button:hover{
    color:var(--accent-strong);
    background:var(--accent-soft);
}

.log-time-custom{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
    padding:16px;
}

.log-time-custom label{
    display:flex;
    flex-direction:column;
    gap:6px;
}

.log-time-custom span{
    color:var(--text-sub);
    font-size:12px;
    font-weight:800;
}

.log-time-actions{
    grid-column:1 / -1;
    display:flex;
    justify-content:flex-end;
    gap:10px;
    padding:12px 16px;
    border-top:1px solid var(--border);
    background:var(--surface);
}

.account-log-table{
    min-width:900px;
    border-top:1px solid var(--border);
    table-layout:fixed;
}

.account-log-table th:nth-child(1),
.account-log-table td:nth-child(1){
    width:180px;
}

.account-log-table th:nth-child(2),
.account-log-table td:nth-child(2){
    width:220px;
}

.account-log-table th:nth-child(3),
.account-log-table td:nth-child(3),
.account-log-table th:nth-child(5),
.account-log-table td:nth-child(5){
    width:150px;
}

.operation-log-action{
    min-width:0;
}

.operation-log-text{
    display:-webkit-box;
    max-height:44px;
    overflow:hidden;
    line-height:1.6;
    overflow-wrap:anywhere;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
}

.log-pagination{
    min-height:58px;
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:10px;
    padding:12px 14px;
    border-top:1px solid var(--border);
    background:var(--surface);
}

.log-pagination-total,
.log-page-jump{
    color:var(--text-sub);
    font-size:13px;
}

.log-page-size{
    width:120px;
    min-height:38px;
}

.log-page-btn,
.log-page-current{
    width:38px;
    height:38px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:var(--radius-sm);
    font-size:18px;
    font-weight:800;
}

.log-page-btn{
    border:1px solid var(--border);
    background:var(--surface-soft);
    color:var(--text-sub);
}

.log-page-btn:hover:not(:disabled){
    border-color:var(--accent);
    color:var(--accent-strong);
    background:var(--accent-soft);
}

.log-page-btn:disabled{
    opacity:.45;
}

.log-page-current{
    background:var(--accent);
    color:#fff;
    font-size:14px;
}

.log-page-jump{
    display:inline-flex;
    align-items:center;
    gap:8px;
}

.log-page-jump .input{
    width:76px;
    min-height:38px;
    text-align:center;
}

.split{
    display:grid;
    grid-template-columns:minmax(280px,.92fr) minmax(0,1.4fr);
    gap:12px;
}

.customer-record-page{
    display:grid;
    grid-template-rows:auto minmax(0,1fr);
    gap:12px;
    min-height:calc(100vh - 104px);
}

.customer-record-filter{
    display:grid;
    grid-template-columns:repeat(2,minmax(180px,240px)) minmax(240px,1fr) auto;
    gap:12px;
    align-items:end;
    padding:14px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
}

.compact-field{
    margin-bottom:0;
}

.customer-search-field{
    min-width:0;
}

.customer-record-board{
    min-height:0;
    display:grid;
    grid-template-columns:minmax(280px,.9fr) minmax(0,1.55fr);
    gap:12px;
}

.customer-list-panel,
.chat-record-panel{
    min-height:0;
    display:flex;
    flex-direction:column;
}

.customer-list-panel .list{
    min-height:0;
    overflow:auto;
}

.customer-list-item{
    display:grid;
    gap:4px;
}

.customer-name{
    font-size:14px;
    font-weight:800;
    color:var(--text-main);
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.customer-list-item.active .customer-name{
    color:var(--accent-strong);
}

.customer-meta{
    color:var(--text-sub);
    font-size:12px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.list{
    display:grid;
}

.list-item{
    min-height:62px;
    padding:12px 14px;
    border:none;
    border-bottom:1px solid var(--border);
    background:var(--surface);
    color:var(--text-main);
    text-align:left;
}

.list-item:hover,
.list-item.active{
    background:var(--surface-soft);
}

.list-item.active{
    color:var(--accent-strong);
}

.list-item strong{
    display:block;
    margin-bottom:4px;
    font-size:14px;
}

.chat{
    display:grid;
    gap:10px;
    padding:14px;
    max-height:calc(100vh - 160px);
    overflow:auto;
    background:linear-gradient(180deg,var(--surface) 0%,var(--surface-soft) 100%);
}

.bubble{
    max-width:76%;
    padding:10px 12px;
    border-radius:12px;
    color:var(--text-main);
    background:var(--surface);
    border:1px solid var(--border);
    line-height:1.55;
}

.bubble.out{
    margin-left:auto;
    color:#fff;
    background:var(--accent);
    border-color:var(--accent);
}

.bubble-time{
    display:block;
    margin-top:6px;
    font-size:11px;
    opacity:.72;
}

.bubble-translation{
    display:block;
    margin-top:8px;
    padding-top:8px;
    border-top:1px solid rgba(100,116,139,.18);
    color:inherit;
    opacity:.82;
}

.web-mr-page{
    min-height:0;
    flex:1 1 auto;
    display:flex;
    flex-direction:column;
    overflow:hidden;
}

.web-mr-shell{
    flex:1 1 auto;
    min-height:0;
    height:100%;
    width:100%;
}

.web-mr-toolbar{
    grid-template-columns:minmax(190px,.8fr) minmax(190px,.8fr) minmax(240px,1.2fr) 112px;
}

.web-mr-search-field{
    min-width:0;
}

.mr-shell{
    min-height:0;
    display:grid;
    grid-template-rows:auto minmax(0,1fr);
    gap:12px;
}

.mr-toolbar{
    display:grid;
    gap:12px;
    align-items:center;
    padding:14px 16px;
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
}

.mr-toolbar-status{
    grid-column:1 / -1;
    display:flex;
    align-items:center;
    gap:10px;
    min-height:18px;
    color:var(--text-sub);
    font-size:12px;
}

.mr-status-badge{
    min-height:24px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:0 10px;
    border-radius:999px;
    font-size:11px;
    font-weight:800;
}

.mr-status-badge.ok{
    color:#15803d;
    background:rgba(34,197,94,.12);
}

.mr-status-badge.loading{
    color:var(--accent-strong);
    background:var(--accent-soft);
}

.mr-field{
    min-width:0;
    display:flex;
    align-items:center;
    gap:10px;
}

.mr-label{
    flex:0 0 auto;
    color:var(--text-sub);
    font-size:13px;
    font-weight:800;
}

.mr-select{
    width:100%;
    height:40px;
    border:1px solid var(--border-strong);
    border-radius:var(--radius-md);
    padding:0 12px;
    color:var(--text-main);
    background:var(--surface);
    outline:none;
}

.mr-select:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 4px var(--accent-soft);
}

.mr-filter-btn{
    min-height:40px;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    padding:0 14px;
    font-weight:800;
}

.mr-filter-btn{
    color:var(--text-main);
    background:var(--surface-soft);
}

.web-mr-board{
    --mr-account-col:minmax(220px,.9fr);
    --mr-friend-col:minmax(240px,1fr);
    --mr-chat-col:minmax(0,2fr);
    --mr-info-drawer-w:clamp(280px,26vw,340px);
    position:relative;
    min-height:0;
    height:100%;
    display:grid;
    grid-template-columns:var(--mr-account-col) var(--mr-friend-col) var(--mr-chat-col);
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    overflow:hidden;
}

.web-mr-board.is-info-open{
    grid-template-columns:var(--mr-account-col) var(--mr-friend-col) var(--mr-chat-col);
}

.mr-col{
    min-width:0;
    min-height:0;
    display:flex;
    flex-direction:column;
    border-right:1px solid var(--border);
    background:var(--surface);
    overflow:hidden;
}

.mr-col:last-child{
    border-right:none;
}

.mr-col-head,
.mr-chat-head{
    min-height:58px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:0 14px;
    border-bottom:1px solid var(--border);
    background:var(--surface);
}

.mr-col-title{
    font-size:15px;
    font-weight:900;
}

.mr-head-actions,
.mr-chat-actions{
    display:flex;
    align-items:center;
    gap:8px;
}

.mr-info-toggle{
    min-height:34px;
    border:1px solid var(--border-strong);
    border-radius:var(--radius-sm);
    padding:0 12px;
    color:var(--text-main);
    background:var(--surface-soft);
    font-size:13px;
    font-weight:800;
}

.mr-info-toggle:hover,
.mr-info-toggle.active{
    border-color:rgba(92,103,242,.35);
    color:var(--accent-strong);
    background:var(--accent-soft);
}

.mr-collapse-btn{
    width:30px;
    height:30px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:none;
    border-radius:10px;
    padding:0;
    color:var(--accent);
    background:transparent;
}

.mr-collapse-btn:hover{
    background:var(--accent-soft);
}

.mr-collapse-icon{
    position:relative;
    display:block;
    width:18px;
    height:14px;
}

.mr-collapse-icon span{
    position:absolute;
    left:0;
    right:6px;
    height:2px;
    border-radius:999px;
    background:currentColor;
}

.mr-collapse-icon span:nth-child(1){ top:1px; }
.mr-collapse-icon span:nth-child(2){ top:6px; }
.mr-collapse-icon span:nth-child(3){ top:11px; }

.mr-collapse-icon::after{
    content:"";
    position:absolute;
    top:4px;
    right:0;
    width:6px;
    height:6px;
    border-right:2px solid currentColor;
    border-bottom:2px solid currentColor;
    transform:rotate(-45deg);
}

.mr-collapse-btn[data-collapse-direction="right"] .mr-collapse-icon::after{
    transform:rotate(135deg);
}

.mr-collapse-btn.is-collapsed[data-collapse-direction="left"] .mr-collapse-icon::after{
    transform:rotate(135deg);
}

.mr-collapse-btn.is-collapsed[data-collapse-direction="right"] .mr-collapse-icon::after{
    transform:rotate(-45deg);
}

.mr-list,
.mr-chat-body{
    min-height:0;
    overflow:auto;
}

.mr-account-card,
.mr-friend-card{
    width:100%;
    border:none;
    border-bottom:1px solid var(--border);
    padding:12px;
    color:var(--text-main);
    background:var(--surface);
    text-align:left;
}

.mr-account-card:hover,
.mr-account-card.active,
.mr-friend-card:hover,
.mr-friend-card.active{
    background:var(--surface-soft);
}

.mr-account-card.active,
.mr-friend-card.active{
    color:var(--accent-strong);
}

.mr-account-row,
.mr-friend-card{
    display:flex;
    align-items:center;
    gap:10px;
}

.mr-account-body,
.mr-friend-body{
    min-width:0;
}

.mr-account-name,
.mr-friend-name{
    font-size:14px;
    font-weight:900;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.mr-account-sub,
.mr-account-meta,
.mr-account-note,
.mr-friend-sub,
.mr-friend-meta{
    margin-top:3px;
    color:var(--text-sub);
    font-size:12px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.mr-friend-avatar,
.mr-avatar.friend{
    width:38px;
    height:38px;
    flex:0 0 auto;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:12px;
    color:#fff;
    background:var(--accent);
    font-weight:900;
}

.mr-chat-user{
    min-width:0;
    display:flex;
    align-items:center;
    gap:10px;
}

.mr-chat-name{
    font-size:15px;
    font-weight:900;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.mr-chat-sub{
    margin-top:4px;
    color:var(--text-sub);
    font-size:12px;
}

.mr-chat-body{
    display:grid;
    align-content:start;
    gap:10px;
    padding:14px;
    background:var(--surface-soft);
}

.mr-day{
    display:flex;
    justify-content:center;
    margin:2px 0 4px;
}

.mr-day span{
    min-height:24px;
    display:inline-flex;
    align-items:center;
    padding:0 10px;
    border-radius:999px;
    color:var(--text-sub);
    background:var(--surface);
    font-size:12px;
    font-weight:800;
}

.mr-msg{
    display:flex;
}

.mr-msg.out{
    justify-content:flex-end;
}

.mr-bubble{
    max-width:min(78%,560px);
    padding:10px 12px;
    border:1px solid var(--border);
    border-radius:12px;
    color:var(--text-main);
    background:var(--surface);
    line-height:1.58;
}

.mr-msg.out .mr-bubble{
    border-color:rgba(92,103,242,.25);
    background:rgba(92,103,242,.08);
}

.mr-msg-meta{
    margin-bottom:6px;
    color:var(--text-sub);
    font-size:12px;
}

.mr-msg-text,
.mr-msg-translation{
    white-space:pre-wrap;
    word-break:break-word;
}

.mr-msg-translation{
    margin-top:8px;
    padding-top:8px;
    border-top:1px solid rgba(100,116,139,.18);
    color:#475569;
}

.mr-info-drawer{
    position:absolute;
    top:0;
    right:0;
    bottom:0;
    z-index:5;
    width:var(--mr-info-drawer-w);
    border-left:1px solid var(--border);
    border-right:none;
    background:var(--surface);
    box-shadow:-4px 0 8px rgba(15,23,42,.06);
}

.mr-info-head{
    min-height:58px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:0 14px;
    border-bottom:1px solid var(--border);
}

.mr-info-title{
    font-size:15px;
    font-weight:900;
}

.mr-info-sub{
    max-width:220px;
    margin-top:4px;
    color:var(--text-sub);
    font-size:12px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.mr-info-close{
    width:30px;
    height:30px;
    flex:0 0 auto;
    border:none;
    border-radius:var(--radius-sm);
    color:var(--text-sub);
    background:transparent;
    font-size:20px;
    line-height:1;
}

.mr-info-close:hover{
    color:var(--text-main);
    background:var(--surface-soft);
}

.mr-info-body{
    min-height:0;
    overflow:auto;
    padding:14px;
    background:var(--surface-soft);
}

.mr-info-section{
    margin-bottom:14px;
    padding:12px;
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    background:var(--surface);
}

.mr-info-section:last-child{
    margin-bottom:0;
}

.mr-info-section-title{
    margin-bottom:10px;
    font-size:13px;
    font-weight:900;
}

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

.mr-detail-field{
    min-width:0;
    padding:8px;
    border-radius:var(--radius-sm);
    background:var(--surface-soft);
}

.mr-detail-field span,
.mr-log-meta{
    color:var(--text-sub);
    font-size:12px;
}

.mr-detail-field strong{
    display:block;
    margin-top:4px;
    overflow:hidden;
    color:var(--text-main);
    font-size:13px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.mr-detail-tags{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin-top:10px;
}

.mr-detail-tags span{
    min-height:24px;
    display:inline-flex;
    align-items:center;
    border-radius:999px;
    padding:0 8px;
    color:var(--accent-strong);
    background:var(--accent-soft);
    font-size:12px;
    font-weight:800;
}

.mr-log-list{
    display:grid;
    gap:8px;
}

.mr-log-item{
    border-left:3px solid var(--accent);
    border-radius:var(--radius-sm);
    padding:9px 10px;
    background:var(--surface-soft);
}

.mr-log-item.level-green{
    border-left-color:var(--success);
}

.mr-log-item.level-red{
    border-left-color:var(--danger);
}

.mr-log-meta{
    display:flex;
    justify-content:space-between;
    gap:8px;
    margin-bottom:6px;
}

.mr-log-content{
    color:var(--text-main);
    font-size:13px;
    line-height:1.6;
    white-space:pre-wrap;
    word-break:break-word;
}

.mr-info-empty{
    padding:18px 10px;
    color:var(--text-sub);
    font-size:13px;
    line-height:1.6;
    text-align:center;
}

.mr-list-empty,
.mr-chat-empty{
    display:grid;
    place-items:center;
    align-content:center;
    gap:8px;
    min-height:180px;
    padding:18px;
    color:var(--text-sub);
    text-align:center;
}

.mr-empty-box{
    width:36px;
    height:36px;
    border-radius:12px;
    background:var(--surface-muted);
}

.mr-empty-sub{
    font-size:12px;
    line-height:1.55;
}

.web-mr-board.is-account-collapsed{
    --mr-account-col:64px;
}

.web-mr-board.is-friend-collapsed{
    --mr-friend-col:72px;
}

.web-mr-board.is-account-collapsed .mr-account-body,
.web-mr-board.is-friend-collapsed .mr-friend-body{
    display:none;
}

.form-row{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr)) auto;
    gap:10px;
    padding:14px;
}

.textarea{
    min-height:132px;
    padding:11px 12px;
    resize:vertical;
    line-height:1.55;
}

.script-summary-row{
    display:grid;
    grid-template-columns:repeat(4,minmax(130px,1fr));
    gap:10px;
    margin-bottom:12px;
}

.script-summary-item{
    min-height:78px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:6px;
    padding:12px 14px;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    background:var(--surface);
}

.script-summary-item span{
    color:var(--text-sub);
    font-size:12px;
    font-weight:800;
}

.script-summary-item strong{
    color:var(--text-main);
    font-size:24px;
    line-height:1;
}

.script-editor-panel{
    margin-bottom:12px;
}

.ephemeral-notice,
.script-notice{
    overflow:hidden;
    transition:opacity .18s ease, transform .18s ease, margin .18s ease, padding .18s ease, max-height .18s ease;
}

.ephemeral-notice.is-leaving,
.script-notice.is-leaving{
    margin-bottom:0;
    padding-top:0;
    padding-bottom:0;
    max-height:0;
    opacity:0;
    transform:translateY(-6px);
}

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

.script-group-inline{
    min-width:min(420px, 42vw);
    display:grid;
    grid-template-columns:auto minmax(220px,1fr);
    align-items:center;
    gap:8px;
}

.script-group-inline span{
    color:var(--text-sub);
    font-size:13px;
    font-weight:800;
    white-space:nowrap;
}

.script-content-field{
    grid-column:1 / -1;
}

.script-textarea{
    min-height:154px;
}

.script-submit{
    align-self:end;
    width:100%;
    min-height:42px;
}

.script-submit-field span{
    visibility:hidden;
}

.script-library-panel{
    margin-bottom:12px;
}

.script-filter-bar{
    display:grid;
    grid-template-columns:minmax(260px,1fr) minmax(160px,.42fr) minmax(150px,.36fr) auto;
    gap:10px;
    align-items:end;
    padding:12px 14px;
    border-bottom:1px solid var(--border);
    background:var(--surface-soft);
}

.script-search-field{
    min-width:0;
}

.script-filter-actions{
    display:flex;
    gap:8px;
    align-items:center;
}

.script-list{
    display:grid;
}

.script-row{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:14px;
    padding:14px;
    border-bottom:1px solid var(--border);
    background:var(--surface);
}

.script-row:last-child{
    border-bottom:none;
}

.script-row.is-inactive{
    background:linear-gradient(180deg, rgba(244,247,251,.92) 0%, rgba(255,255,255,.96) 100%);
}

.script-row-main{
    min-width:0;
    display:grid;
    gap:10px;
}

.script-card-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}

.script-title-block{
    min-width:0;
}

.script-title-block h3{
    margin:0;
    overflow:hidden;
    color:var(--text-main);
    font-size:15px;
    line-height:1.35;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.script-meta{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin-top:5px;
    color:var(--text-sub);
    font-size:12px;
}

.script-content{
    margin:0;
    max-width:82ch;
    color:var(--text-main);
    font-size:13px;
    line-height:1.65;
    white-space:pre-wrap;
    word-break:break-word;
}

.script-tags{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
}

.script-tags span{
    min-height:24px;
    display:inline-flex;
    align-items:center;
    padding:0 8px;
    border-radius:999px;
    color:var(--text-sub);
    background:var(--surface-muted);
    font-size:12px;
    font-weight:700;
}

.script-actions{
    display:flex;
    flex-wrap:wrap;
    justify-content:flex-end;
    align-content:flex-start;
    gap:8px;
    min-width:232px;
}

.btn.subtle{
    background:transparent;
}

.knowledge-summary-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(130px,1fr));
    gap:10px;
    margin-bottom:12px;
}

.knowledge-summary-card{
    min-height:86px;
    display:grid;
    align-content:center;
    gap:6px;
    padding:13px 14px;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    background:var(--surface);
}

.knowledge-summary-card span,
.knowledge-summary-card small{
    color:var(--text-sub);
    font-size:12px;
    line-height:1.4;
}

.knowledge-summary-card span{
    font-weight:800;
}

.knowledge-summary-card strong{
    color:var(--text-main);
    font-size:24px;
    line-height:1;
}

.knowledge-upload-panel,
.knowledge-assignment-panel,
.knowledge-recall-panel,
.knowledge-source-panel{
    margin-bottom:12px;
}

.knowledge-head-copy{
    margin:5px 0 0;
    color:var(--text-sub);
    font-size:12px;
    line-height:1.5;
}

.knowledge-upload-body{
    display:grid;
    grid-template-columns:minmax(280px,.9fr) minmax(320px,1.1fr);
    gap:14px;
    padding:14px;
}

.knowledge-dropzone{
    min-height:190px;
    display:grid;
    place-items:center;
    align-content:center;
    gap:10px;
    padding:18px;
    border:1px dashed rgba(92,103,242,.48);
    border-radius:var(--radius-md);
    background:linear-gradient(180deg, rgba(92,103,242,.08) 0%, rgba(244,247,251,.78) 100%);
    text-align:center;
}

.knowledge-dropzone strong{
    color:var(--text-main);
    font-size:15px;
}

.knowledge-dropzone span{
    max-width:48ch;
    color:var(--text-sub);
    font-size:13px;
    line-height:1.6;
    overflow-wrap:anywhere;
}

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

.knowledge-simple-form .field{
    min-width:0;
}

.knowledge-category-row{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:8px;
}

.knowledge-category-row .btn{
    min-height:42px;
    white-space:nowrap;
}

.knowledge-group-select .link-route-multi-menu{
    position:fixed;
    z-index:70;
    margin-top:0;
    max-height:320px;
    overflow:hidden;
}

.knowledge-group-select .link-route-option-list{
    max-height:240px;
    overflow-y:auto;
    overscroll-behavior:contain;
}

.knowledge-group-option-row span{
    min-width:0;
    display:flex;
    align-items:center;
    gap:8px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.knowledge-group-option-row .group-dot{
    flex:0 0 auto;
}

.knowledge-assignment-list{
    display:grid;
    gap:8px;
    padding:14px;
}

.knowledge-assignment-row{
    display:grid;
    grid-template-columns:minmax(220px,1fr) auto auto minmax(170px,.62fr) minmax(280px,.9fr);
    align-items:center;
    gap:12px;
    min-height:66px;
    padding:10px 12px;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    background:var(--surface);
}

.knowledge-assignment-main{
    min-width:0;
}

.knowledge-assignment-row strong{
    display:block;
    color:var(--text-main);
    font-size:13px;
    line-height:1.45;
}

.knowledge-assignment-row small{
    display:block;
    margin-top:4px;
    color:var(--text-sub);
    font-size:12px;
    line-height:1.45;
}

.knowledge-doc-count{
    justify-self:start;
    display:inline-flex;
    align-items:center;
    min-height:32px;
    padding:0 12px;
    border-radius:999px;
    background:var(--surface-muted);
    color:var(--text-sub);
    font-size:12px;
    font-weight:700;
    white-space:nowrap;
}

.knowledge-assignment-picker{
    min-width:0;
}

.knowledge-assignment-picker .knowledge-group-select{
    width:100%;
}

.knowledge-category-delete-btn{
    justify-self:start;
    min-height:34px;
    padding:0 12px;
    white-space:nowrap;
}

.knowledge-recall-body{
    display:grid;
    gap:14px;
    padding:14px;
}

.knowledge-recall-question textarea{
    min-height:92px;
    resize:vertical;
}

.knowledge-recall-controls{
    display:grid;
    gap:8px;
    max-width:560px;
}

.knowledge-recall-label{
    color:var(--muted);
    font-weight:800;
}

.knowledge-recall-actions{
    display:grid;
    grid-template-columns:minmax(260px, 1fr) 144px;
    align-items:stretch;
    gap:12px;
}

.knowledge-recall-button{
    width:100%;
    min-height:0;
    white-space:nowrap;
}

.knowledge-recall-empty{
    display:flex;
    align-items:center;
    gap:10px;
    min-height:54px;
    padding:12px 14px;
    border:1px dashed var(--border);
    border-radius:14px;
    background:var(--soft);
    color:var(--muted);
}

.knowledge-recall-empty strong{
    color:var(--text);
    white-space:nowrap;
}

.knowledge-recall-result{
    display:grid;
    gap:12px;
    padding:14px;
    border:1px solid var(--border);
    border-radius:14px;
    background:var(--surface);
}

.knowledge-recall-result-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    color:var(--muted);
}

.knowledge-recall-result-head strong{
    color:var(--text);
}

.knowledge-recall-hit-list{
    display:grid;
    gap:10px;
    max-height:340px;
    overflow:auto;
    padding-right:4px;
}

.knowledge-recall-hit{
    display:grid;
    gap:8px;
    padding:12px;
    border:1px solid var(--border);
    border-radius:12px;
    background:var(--soft);
}

.knowledge-recall-hit-head,
.knowledge-recall-hit-meta{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
}

.knowledge-recall-hit-head strong{
    color:var(--text);
}

.knowledge-recall-hit-head span,
.knowledge-recall-hit-meta span{
    color:var(--muted);
    font-size:13px;
    font-weight:800;
}

.knowledge-recall-hit-meta{
    justify-content:flex-start;
    flex-wrap:wrap;
}

.knowledge-recall-hit-meta span{
    padding:4px 8px;
    border-radius:999px;
    background:#eef3f9;
}

.knowledge-recall-hit p{
    margin:0;
    color:var(--text);
    line-height:1.7;
    white-space:pre-wrap;
    word-break:break-word;
}

.knowledge-search-input{
    width:min(320px, 32vw);
}

.knowledge-table-scroll{
    max-height:360px;
    overflow:auto;
}

.knowledge-source-table{
    min-width:960px;
}

.knowledge-source-table thead th{
    position:sticky;
    top:0;
    z-index:1;
    background:var(--surface-muted);
}

.knowledge-source-table th:nth-child(2),
.knowledge-source-table td:nth-child(2),
.knowledge-source-table th:nth-child(3),
.knowledge-source-table td:nth-child(3),
.knowledge-source-table th:nth-child(4),
.knowledge-source-table td:nth-child(4){
    width:104px;
}

.knowledge-source-table th:nth-child(5),
.knowledge-source-table td:nth-child(5){
    width:110px;
}

.knowledge-source-table th:nth-child(6),
.knowledge-source-table td:nth-child(6){
    width:150px;
}

.knowledge-source-table th:nth-child(7),
.knowledge-source-table td:nth-child(7){
    width:260px;
}

.knowledge-source-table strong{
    display:block;
    color:var(--text-main);
    font-size:13px;
    line-height:1.45;
}

.knowledge-group-inline{
    display:flex;
    flex-wrap:wrap;
    gap:5px;
    margin-top:6px;
}

.knowledge-group-inline span{
    max-width:120px;
    min-height:22px;
    display:inline-flex;
    align-items:center;
    overflow:hidden;
    padding:0 7px;
    border-radius:999px;
    color:var(--text-sub);
    background:var(--surface-muted);
    font-size:12px;
    font-weight:700;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.knowledge-category-overlay{
    position:fixed;
    inset:0;
    z-index:60;
    display:grid;
    place-items:center;
    padding:18px;
    background:rgba(15,23,42,.26);
    animation:confirm-fade .16s ease;
}

.knowledge-category-overlay.leaving{
    opacity:0;
    transition:opacity .16s ease;
}

.knowledge-category-dialog{
    width:min(360px,100%);
    display:grid;
    gap:12px;
    padding:14px;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    background:var(--surface);
    box-shadow:0 14px 28px rgba(15,23,42,.16);
    animation:confirm-pop .18s ease;
}

.knowledge-category-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}

.knowledge-category-head h3{
    margin:0;
    color:var(--text-main);
    font-size:16px;
    line-height:1.35;
}

.knowledge-category-head p{
    margin:5px 0 0;
    color:var(--text-sub);
    font-size:12px;
    line-height:1.55;
}

.knowledge-category-actions{
    display:flex;
    justify-content:flex-end;
    gap:8px;
}

.lead-editor-panel,
.lead-import-panel{
    margin-bottom:12px;
}

.lead-form{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:12px;
    padding:14px;
}

.lead-note-field{
    grid-column:1 / -1;
}

.lead-submit{
    align-self:end;
}

.lead-import-form{
    display:grid;
    grid-template-columns:minmax(0,1.5fr) minmax(180px,.45fr) minmax(160px,.4fr) auto;
    gap:12px;
    align-items:end;
    padding:14px;
}

.lead-import-form .textarea{
    min-height:118px;
}

.lead-table strong{
    display:block;
    margin-bottom:4px;
}

.lead-table{
    min-width:900px;
}

.lead-note{
    max-width:260px;
    white-space:pre-wrap;
    word-break:break-word;
}

.link-route-modal .proxy-modal-head p{
    margin:5px 0 0;
    color:var(--text-sub);
    font-size:13px;
    line-height:1.5;
}

.link-route-modal{
    width:min(1040px,calc(100vw - 48px));
    height:min(820px,calc(100vh - 48px));
    max-height:calc(100vh - 48px);
    grid-template-rows:auto minmax(0,1fr) auto;
    overflow:hidden;
}

.link-route-modal-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;
    min-height:0;
    overflow:auto;
    padding:2px 4px 16px 0;
}

.link-route-modal .proxy-modal-actions{
    position:relative;
    z-index:3;
    margin:0 -18px -18px;
    padding:14px 18px 18px;
    border-top:1px solid var(--border);
    background:var(--surface);
}

.link-route-targets,
.link-route-target-preview-field{
    grid-column:auto;
}

.link-route-target-preview-field{
    grid-column:span 2;
}

.link-route-group-list,
.link-route-target-preview{
    min-height:260px;
    max-height:260px;
    overflow:auto;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
}

.link-route-group-list{
    display:grid;
    align-content:start;
}

.link-route-group-option{
    min-height:52px;
    display:grid;
    grid-template-columns:auto auto minmax(0,1fr);
    align-items:center;
    gap:10px;
    padding:10px 12px;
    border-bottom:1px solid var(--border);
    cursor:pointer;
}

.link-route-group-option:last-child{
    border-bottom:none;
}

.link-route-group-option input{
    width:18px;
    height:18px;
    margin:0;
    accent-color:var(--accent);
}

.link-route-group-main{
    min-width:0;
    display:grid;
    gap:3px;
}

.link-route-group-main strong{
    overflow:hidden;
    color:var(--text-main);
    font-size:14px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.link-route-group-main small{
    color:var(--text-sub);
    font-size:12px;
}

.link-route-target-preview{
    display:grid;
    align-content:start;
}

.link-route-preview-list{
    display:grid;
}

.link-route-preview-row{
    min-height:52px;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:4px 10px;
    align-items:center;
    padding:10px 12px;
    border-bottom:1px solid var(--border);
}

.link-route-preview-row:last-child{
    border-bottom:none;
}

.link-route-preview-row span{
    overflow:hidden;
    color:var(--text-main);
    font-weight:800;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.link-route-preview-row strong{
    color:var(--accent-strong);
    font-size:13px;
    white-space:nowrap;
}

.link-route-preview-row small{
    grid-column:1 / -1;
    color:var(--text-sub);
    font-size:12px;
}

.link-route-block-countries{
    grid-column:1 / -1;
}

.link-route-block-devices{
    grid-column:1 / -1;
}

.link-route-multi{
    position:relative;
}

.link-route-multi-control{
    min-height:46px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:6px 10px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
    cursor:pointer;
}

.link-route-multi-control:focus,
.link-route-multi.is-open .link-route-multi-control{
    border-color:var(--accent);
    box-shadow:0 0 0 4px var(--accent-soft);
    outline:0;
}

.link-route-multi-values{
    min-width:0;
    display:flex;
    flex:1;
    flex-wrap:wrap;
    gap:6px;
}

.link-route-multi-placeholder{
    min-height:30px;
    display:inline-flex;
    align-items:center;
    color:var(--text-muted);
    font-size:13px;
}

.link-route-select-chip{
    min-height:30px;
    display:inline-flex;
    align-items:center;
    gap:6px;
    padding:0 10px;
    border-radius:7px;
    background:var(--surface-soft);
    color:var(--text-sub);
    font-size:13px;
    font-weight:800;
}

.link-route-select-chip button{
    width:18px;
    height:18px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:0;
    border:0;
    border-radius:999px;
    color:var(--text-muted);
    background:transparent;
    font-size:16px;
    line-height:1;
}

.link-route-select-chip button:hover{
    color:var(--danger);
    background:rgba(239,68,68,.08);
}

.link-route-multi-arrow{
    flex:0 0 auto;
    color:var(--text-muted);
    font-size:18px;
    line-height:1;
}

.link-route-multi-menu{
    position:relative;
    z-index:8;
    display:none;
    margin-top:8px;
    max-height:300px;
    overflow:auto;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
    box-shadow:0 16px 34px rgba(15,23,42,.18);
}

.link-route-multi.is-open .link-route-multi-menu{
    display:block;
}

.link-route-option-list{
    display:grid;
}

.link-route-multi-search-wrap{
    position:sticky;
    top:0;
    z-index:2;
    padding:8px;
    border-bottom:1px solid var(--border);
    background:var(--surface);
}

.link-route-multi-search{
    width:100%;
    min-height:36px;
    padding:0 10px;
    border:1px solid var(--border);
    border-radius:7px;
    color:var(--text-main);
    background:var(--surface-soft);
    font:inherit;
    outline:0;
}

.link-route-multi-search:focus{
    border-color:var(--accent);
    box-shadow:0 0 0 3px var(--accent-soft);
}

.link-route-option-row{
    min-height:42px;
    display:grid;
    grid-template-columns:minmax(0,1fr) auto auto;
    align-items:center;
    gap:12px;
    padding:0 14px;
    border-bottom:1px solid var(--border);
    color:var(--text-sub);
    cursor:pointer;
    font-size:14px;
    font-weight:800;
}

.link-route-option-row:last-child{
    border-bottom:none;
}

.link-route-option-row:hover,
.link-route-option-row:has(input:checked){
    color:var(--accent-strong);
    background:var(--surface-muted);
}

.link-route-option-row input{
    position:absolute;
    opacity:0;
    pointer-events:none;
}

.link-route-option-row span{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.link-route-option-row small{
    color:var(--text-muted);
    font-size:12px;
    font-weight:800;
}

.link-route-option-row b{
    min-width:14px;
    color:var(--accent);
    opacity:0;
    font-size:14px;
}

.link-route-option-row:has(input:checked) b{
    opacity:1;
}

.link-route-option-row[hidden],
.link-route-option-empty[hidden]{
    display:none;
}

.link-route-option-empty{
    min-height:46px;
    display:flex;
    align-items:center;
    justify-content:center;
    color:var(--text-muted);
    font-size:13px;
    font-weight:800;
}

.link-route-device-list{
    display:flex;
    min-height:42px;
    flex-wrap:wrap;
    align-items:center;
    gap:8px;
}

.link-route-device-option{
    min-height:34px;
    display:inline-flex;
    align-items:center;
    gap:7px;
    padding:0 10px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
    color:var(--text-main);
    font-size:13px;
    font-weight:800;
}

.link-route-device-option input{
    width:16px;
    height:16px;
    margin:0;
    accent-color:var(--accent);
}

.link-route-block-summary{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.link-route-block-summary span{
    min-height:30px;
    display:inline-flex;
    align-items:center;
    padding:0 10px;
    border:1px solid #fecaca;
    border-radius:8px;
    background:#fff1f2;
    color:#be123c;
    font-size:12px;
    font-weight:800;
}

.link-route-list{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(340px,1fr));
    gap:12px;
}

.link-route-card{
    display:flex;
    min-height:168px;
    flex-direction:column;
    gap:12px;
    padding:16px;
    border:1px solid var(--border);
    border-radius:12px;
    background:var(--surface);
}

.link-route-card-head{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
}

.link-route-card-head-simple{
    justify-content:flex-end;
}

.link-route-card h3{
    margin:0 0 6px;
    color:var(--text-main);
    font-size:18px;
}

.link-route-url{
    max-width:100%;
    color:var(--accent-strong);
    font-family:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;
    font-size:12px;
    line-height:1.5;
    word-break:break-all;
}

.link-route-metrics{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.link-route-metrics span,
.link-route-target{
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface-soft);
}

.link-route-metrics span{
    min-height:30px;
    display:inline-flex;
    align-items:center;
    padding:0 10px;
    color:var(--text-sub);
    font-size:12px;
    font-weight:800;
}

.link-route-metrics .link-route-name-pill{
    max-width:220px;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.link-route-target-list{
    display:grid;
    gap:8px;
}

.link-route-target{
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:4px 10px;
    padding:10px;
}

.link-route-target span{
    color:var(--text-main);
    font-weight:800;
}

.link-route-target strong{
    color:var(--accent-strong);
}

.link-route-target small{
    grid-column:1 / -1;
    color:var(--text-muted);
    word-break:break-all;
}

.link-route-clicks{
    display:grid;
    gap:6px;
    padding-top:4px;
}

.link-route-click-head,
.link-route-click-row{
    display:grid;
    grid-template-columns:minmax(150px,1.2fr) minmax(88px,.7fr) minmax(92px,.7fr) minmax(88px,.7fr) minmax(96px,.7fr);
    gap:10px;
    align-items:center;
}

.link-route-click-head{
    color:var(--text-sub);
    font-size:12px;
    font-weight:800;
}

.link-route-click-row{
    color:var(--text-sub);
    font-size:12px;
}

.link-route-click-row span{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.compact-input{
    width:auto;
    min-width:120px;
    height:34px;
    padding:0 9px;
    font-size:12px;
}

.proxy-page{
    display:grid;
    gap:12px;
}

.proxy-metrics{
    margin-bottom:0;
}

.proxy-file-input{
    padding:9px 10px;
}

.proxy-list-panel{
    overflow:auto;
}

.proxy-list-head{
    align-items:center;
    padding-top:12px;
    padding-bottom:12px;
}

.proxy-list-head .toolbar{
    justify-content:flex-end;
    flex:1 1 620px;
}

.proxy-list-sub{
    margin-top:4px;
    color:var(--text-sub);
    font-size:12px;
    font-weight:700;
}

.knowledge-group-inline .is-empty{
    color:var(--text-muted);
    background:var(--surface-soft);
}

.proxy-filter-bar{
    display:grid;
    grid-template-columns:minmax(260px,1fr) repeat(3,minmax(150px,190px)) auto auto;
    gap:12px;
    align-items:end;
    padding:14px;
    border-bottom:1px solid var(--border);
    background:var(--surface);
}

.proxy-search-field{
    min-width:0;
}

.proxy-table{
    min-width:1120px;
    table-layout:fixed;
}

.proxy-table th:nth-child(2),
.proxy-table td:nth-child(2){
    width:25%;
}

.proxy-table th:nth-child(3),
.proxy-table td:nth-child(3){
    width:16%;
}

.proxy-table th:nth-child(4),
.proxy-table td:nth-child(4){
    width:13%;
}

.proxy-table th:nth-child(5),
.proxy-table td:nth-child(5){
    width:132px;
}

.proxy-table th:nth-child(6),
.proxy-table td:nth-child(6){
    width:17%;
}

.proxy-table th:nth-child(7),
.proxy-table td:nth-child(7){
    width:124px;
}

.proxy-table th:last-child,
.proxy-table td:last-child{
    width:250px;
}

.check-cell{
    width:42px;
}

.proxy-address{
    max-width:100%;
    font-family:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;
    color:var(--text-main);
    font-weight:800;
    word-break:break-all;
}

.proxy-meta{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    margin-top:6px;
    color:var(--text-sub);
    font-size:12px;
    line-height:1.45;
}

.proxy-location{
    font-weight:800;
    color:var(--text-main);
    word-break:break-word;
}

.proxy-table td:nth-child(6){
    word-break:break-word;
}

.proxy-error{
    margin-top:6px;
    color:#b91c1c;
    font-size:12px;
    line-height:1.45;
    word-break:break-word;
}

.proxy-actions{
    align-items:center;
    display:flex;
    flex-wrap:nowrap;
    gap:8px;
    min-width:232px;
}

.proxy-actions .btn{
    min-width:66px;
    padding:0 10px;
    white-space:nowrap;
}

.proxy-assignee-select{
    width:128px;
    max-width:100%;
    min-width:0;
    padding-right:28px;
}

.tag.danger{
    color:#b91c1c;
    background:rgba(239,68,68,.10);
}

.ghost-danger{
    color:#b91c1c;
    border-color:rgba(239,68,68,.28);
    background:rgba(239,68,68,.06);
}

.proxy-modal-overlay{
    z-index:65;
}

.proxy-modal{
    width:min(720px,100%);
    max-height:calc(100vh - 48px);
    max-height:calc(100dvh - 48px);
    display:grid;
    grid-template-rows:auto minmax(0,1fr) auto;
    gap:14px;
    padding:18px;
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    background:var(--surface);
    box-shadow:0 18px 46px rgba(15,23,42,.22);
    overflow:hidden;
    animation:confirm-pop .18s ease-out;
}

.proxy-modal-large{
    width:min(840px,100%);
}

.proxy-modal-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    padding-bottom:4px;
}

.proxy-modal-head h3{
    margin:0;
    color:var(--text-main);
    font-size:18px;
    line-height:1.25;
}

.proxy-modal-close{
    width:34px;
    height:34px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    color:var(--text-sub);
    background:var(--surface-soft);
    font-size:24px;
    line-height:1;
}

.proxy-modal-grid{
    min-height:0;
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;
    overflow:auto;
    padding-right:2px;
}

.proxy-modal-wide{
    grid-column:1 / -1;
}

.proxy-batch-textarea{
    min-height:180px;
    max-height:min(38vh,260px);
    resize:vertical;
}

.proxy-modal-actions{
    display:flex;
    flex-wrap:wrap;
    justify-content:flex-end;
    gap:10px;
    padding-top:4px;
}

.translation-cache-toolbar{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom:12px;
}

.translation-cache-filter-fields{
    min-width:0;
    flex:1 1 auto;
    display:grid;
    grid-template-columns:minmax(220px,1fr) minmax(150px,180px) minmax(130px,150px) minmax(120px,130px);
    gap:10px;
}

.translation-cache-toolbar-actions{
    flex:0 0 auto;
    display:flex;
    align-items:center;
    gap:8px;
    white-space:nowrap;
}

.translation-cache-toolbar-actions .btn{
    min-width:64px;
    height:42px;
}

.translation-cache-keyword-input{
    min-width:0;
}

.translation-cache-language-select{
    min-width:0;
}

.translation-cache-provider-select,
.translation-cache-status-select{
    min-width:0;
}

.translation-cache-table{
    min-width:1080px;
    table-layout:fixed;
}

.translation-cache-table th:nth-child(1),
.translation-cache-table td:nth-child(1){
    width:44%;
}

.translation-cache-table th:nth-child(2),
.translation-cache-table td:nth-child(2){
    width:130px;
}

.translation-cache-table th:nth-child(3),
.translation-cache-table td:nth-child(3){
    width:130px;
}

.translation-cache-table th:nth-child(4),
.translation-cache-table td:nth-child(4),
.translation-cache-table th:nth-child(5),
.translation-cache-table td:nth-child(5){
    width:80px;
}

.translation-cache-table th:nth-child(6),
.translation-cache-table td:nth-child(6){
    width:150px;
}

.translation-cache-table th:nth-child(7),
.translation-cache-table td:nth-child(7){
    width:150px;
}

.translation-cache-text{
    min-width:0;
}

.translation-cache-text strong,
.translation-cache-text p,
.translation-cache-text small{
    display:block;
    overflow:hidden;
    text-overflow:ellipsis;
    overflow-wrap:anywhere;
}

.translation-cache-text strong{
    color:var(--text-main);
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
}

.translation-cache-text p{
    margin:6px 0 0;
    color:var(--text-sub);
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
}

.translation-cache-text small{
    margin-top:6px;
    color:var(--text-sub);
    white-space:nowrap;
}

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

.translation-cache-pagination{
    border-top:1px solid var(--border);
}

.translation-cache-modal{
    width:min(680px,calc(100vw - 48px));
    max-height:calc(100vh - 96px);
    display:grid;
    grid-template-rows:auto minmax(0,1fr) auto;
    gap:10px;
    padding:16px;
    overflow:hidden;
}

.translation-cache-modal .proxy-modal-head{
    align-items:center;
    padding-bottom:0;
}

.translation-cache-modal .proxy-modal-head h3{
    font-size:17px;
}

.translation-cache-modal .proxy-modal-head p{
    margin:4px 0 0;
    color:var(--text-sub);
    font-size:12px;
    line-height:1.45;
}

.translation-cache-modal-grid{
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:10px;
    min-height:0;
    overflow-y:auto;
    padding:2px 4px 2px 0;
}

.translation-cache-modal .compact-field{
    gap:6px;
}

.translation-cache-modal-wide{
    grid-column:1 / -1;
}

.translation-cache-modal-textarea{
    height:auto;
    min-height:78px;
    max-height:128px;
    padding:9px 12px;
    line-height:1.5;
    resize:vertical;
}

.translation-cache-modal .proxy-modal-actions{
    margin:0 -16px -16px;
    padding:10px 16px;
    border-top:1px solid var(--border);
    background:var(--surface);
}

@media (max-width:1180px){
    .translation-cache-toolbar{
        align-items:stretch;
        flex-direction:column;
    }

    .translation-cache-toolbar-actions{
        justify-content:flex-end;
    }
}

@media (max-width:920px){
    .translation-cache-filter-fields,
    .translation-cache-modal-grid{
        grid-template-columns:1fr;
    }

    .translation-cache-modal{
        width:min(620px,calc(100vw - 24px));
        max-height:calc(100vh - 48px);
    }

    .translation-cache-modal-wide{
        grid-column:auto;
    }
}

.table-actions{
    display:flex;
    flex-wrap:wrap;
    gap:8px;
}

.ai-config-section{
    margin-bottom:14px;
}

.section-note{
    margin-top:4px;
    color:var(--text-sub);
    font-size:12px;
    line-height:1.6;
}

.subaccount-layout{
    display:grid;
    grid-template-columns:minmax(260px,.78fr) minmax(0,1.32fr);
    gap:12px;
    margin-bottom:14px;
}

.group-create-form{
    display:grid;
    grid-template-columns:minmax(0,1fr) 48px auto;
    gap:10px;
    padding:14px;
    border-bottom:1px solid var(--border);
}

.color-input{
    min-width:48px;
    padding:4px;
}

.group-list{
    display:grid;
}

.desktop-group-panel{
    height:500px;
    display:flex;
    flex-direction:column;
}

.desktop-group-panel .panel-head,
.desktop-group-panel .group-create-form{
    flex:0 0 auto;
}

.desktop-group-list{
    min-height:0;
    flex:1 1 auto;
    overflow-y:auto;
}

.group-row{
    min-height:48px;
    display:flex;
    align-items:center;
    gap:10px;
    padding:10px 14px;
    border-bottom:1px solid var(--border);
}

.group-row:last-child{
    border-bottom:none;
}

.group-dot{
    width:10px;
    height:10px;
    border-radius:999px;
    background:var(--group-color,#94a3b8);
    flex:0 0 auto;
}

.group-name{
    min-width:0;
    flex:1 1 auto;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:13px;
    font-weight:800;
}

.danger-text{
    color:var(--danger);
}

.empty.compact{
    padding:18px 14px;
    text-align:left;
}

.subaccount-form{
    display:grid;
    gap:14px;
    padding:14px;
}

.subaccount-avatar-editor{
    display:grid;
    grid-template-columns:auto minmax(0,1fr);
    gap:14px;
    align-items:center;
}

.avatar-preview{
    width:66px;
    height:66px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid var(--border);
    border-radius:18px;
    background:var(--surface-soft);
}

.avatar-editor-main{
    display:grid;
    gap:10px;
}

.avatar-select-row{
    display:flex;
    flex-wrap:wrap;
    align-items:flex-end;
    gap:10px;
}

.avatar-select-field{
    min-width:180px;
    margin:0;
}

.avatar-upload{
    width:max-content;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-height:34px;
    padding:0 12px;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    background:var(--surface-soft);
    color:var(--text-sub);
    font-size:12px;
    font-weight:800;
    cursor:pointer;
}

.avatar-upload input{
    display:none;
}

.sub-avatar{
    width:36px;
    height:36px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:12px;
    background:var(--avatar-color,#5c67f2);
    color:#fff;
    font-size:19px;
    font-weight:900;
    overflow:hidden;
    flex:0 0 auto;
}

.avatar-preview .sub-avatar{
    width:52px;
    height:52px;
    border-radius:16px;
    font-size:27px;
}

.sub-avatar.image img{
    width:100%;
    height:100%;
    object-fit:cover;
}

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

.form-grid.three{
    grid-template-columns:repeat(3,minmax(0,1fr));
}

.form-grid .span-two{
    grid-column:span 2;
}

.action-field{
    align-self:end;
}

.sub-account-cell{
    display:flex;
    align-items:center;
    gap:10px;
    min-width:180px;
}

.cell-title{
    color:var(--text-main);
    font-weight:800;
}

.cell-sub{
    margin-top:3px;
    color:var(--text-sub);
    font-size:12px;
}

.group-pill{
    min-height:24px;
    display:inline-flex;
    align-items:center;
    max-width:150px;
    padding:0 9px;
    border-radius:999px;
    border:1px solid color-mix(in srgb,var(--group-color,#94a3b8) 36%,var(--border));
    background:color-mix(in srgb,var(--group-color,#94a3b8) 12%,var(--surface));
    color:color-mix(in srgb,var(--group-color,#475569) 70%,var(--text-main));
    font-size:12px;
    font-weight:800;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}

.group-pill-list{
    display:flex;
    flex-wrap:wrap;
    gap:6px;
    max-width:280px;
}

.group-pill-list.compact{
    max-width:220px;
}

.group-pill-more{
    border-color:var(--border);
    background:var(--surface-muted);
    color:var(--text-sub);
}

.repeat-fan-panel{
    margin-bottom:12px;
}

.repeat-fan-head{
    align-items:flex-start;
}

.repeat-fan-filter-bar{
    display:grid;
    grid-template-columns:180px 220px minmax(260px,1fr) auto;
    gap:12px;
    align-items:end;
    padding:14px;
    border-bottom:1px solid var(--border);
    background:var(--surface);
}

.repeat-fan-search-field{
    min-width:0;
}

.repeat-fan-table{
    table-layout:fixed;
}

.repeat-fan-table-scroll{
    min-height:356px;
    max-height:420px;
    overflow:auto;
    background:var(--surface);
}

.repeat-fan-table-scroll .table{
    min-width:720px;
}

.repeat-fan-table-scroll .table th{
    position:sticky;
    top:0;
    z-index:1;
}

.repeat-fan-table-scroll .table td{
    height:68px;
}

.repeat-fan-table-scroll .empty{
    min-height:276px;
}

.repeat-fan-table th:nth-child(1),
.repeat-fan-table td:nth-child(1){
    width:260px;
}

.repeat-fan-table th:nth-child(2),
.repeat-fan-table td:nth-child(2){
    width:120px;
}

.repeat-fan-line{
    min-height:30px;
    display:flex;
    align-items:center;
    gap:8px;
    padding:4px 0;
}

.repeat-fan-line + .repeat-fan-line{
    border-top:1px solid var(--border);
}

.repeat-fan-line-main{
    min-width:120px;
    max-width:220px;
    overflow:hidden;
    color:var(--text-main);
    font-size:13px;
    font-weight:800;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.repeat-fan-line-sub{
    min-width:0;
    overflow:hidden;
    color:var(--text-sub);
    font-size:12px;
    text-overflow:ellipsis;
    white-space:nowrap;
}

.repeat-fan-account-table{
    table-layout:fixed;
}

.repeat-fan-account-scroll .table{
    min-width:860px;
}

.repeat-fan-account-table th:nth-child(1),
.repeat-fan-account-table td:nth-child(1){
    width:240px;
}

.repeat-fan-account-table th:nth-child(3),
.repeat-fan-account-table td:nth-child(3),
.repeat-fan-account-table th:nth-child(4),
.repeat-fan-account-table td:nth-child(4){
    width:120px;
}

.repeat-fan-account-table th:nth-child(5),
.repeat-fan-account-table td:nth-child(5){
    width:170px;
}

.group-check-list{
    display:grid;
    grid-template-columns:1fr;
    gap:0;
    padding:0;
    border:0;
    border-radius:0;
    background:var(--surface);
}

.manager-scope-list{
    max-height:430px;
    overflow-y:auto;
}

.group-check-item{
    min-width:0;
    display:flex;
    align-items:center;
    gap:8px;
    min-height:48px;
    padding:10px 14px;
    border:0;
    border-bottom:1px solid var(--border);
    border-radius:0;
    background:var(--surface);
    color:var(--text-main);
    font-size:13px;
    font-weight:800;
    cursor:pointer;
}

.group-check-item:hover{
    background:var(--surface-soft);
}

.group-check-item:last-child{
    border-bottom:none;
}

.group-check-item input{
    width:15px;
    height:15px;
    accent-color:var(--accent);
    flex:0 0 auto;
}

.ai-provider-grid,
.tts-provider-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(320px,1fr));
    gap:12px;
    padding:14px;
}

.ai-provider-card,
.tts-provider-card{
    display:grid;
    gap:12px;
    padding:14px;
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    background:var(--surface);
}

.ai-provider-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}

.ai-provider-head h3{
    margin:0;
    color:var(--text-main);
    font-size:16px;
    line-height:1.35;
}

.key-status{
    display:block;
    margin-top:5px;
    color:var(--text-sub);
    font-size:12px;
}

.ai-simple-grid{
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(520px,1fr));
    gap:12px;
    padding:14px;
}

.ai-key-card{
    display:grid;
    grid-template-columns:minmax(0,1fr) 168px;
    gap:14px;
    align-items:stretch;
    min-height:236px;
    padding:14px;
    border:1px solid var(--border);
    border-radius:var(--radius-lg);
    background:var(--surface);
}

.ai-key-card-main{
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:12px;
}

.ai-key-card-head{
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
}

.ai-key-title-row{
    display:flex;
    flex-wrap:wrap;
    align-items:center;
    gap:8px;
}

.ai-key-card h3{
    margin:0;
    color:var(--text-main);
    font-size:16px;
    line-height:1.35;
}

.ai-key-count-pill{
    min-height:24px;
    display:inline-flex;
    align-items:center;
    padding:0 8px;
    border-radius:999px;
    color:var(--accent-strong);
    background:var(--accent-soft);
    font-size:12px;
    font-weight:800;
}

.ai-key-card p{
    max-width:62ch;
    margin:5px 0 0;
    color:var(--text-sub);
    font-size:12px;
    line-height:1.55;
}

.toggle-field{
    flex:0 0 auto;
    min-height:34px;
    display:inline-flex;
    align-items:center;
    gap:8px;
    padding:0 10px;
    border:1px solid var(--border);
    border-radius:999px;
    color:var(--text-sub);
    background:var(--surface-soft);
    font-size:13px;
    font-weight:800;
}

.toggle-field input{
    width:16px;
    height:16px;
    accent-color:var(--accent);
}

.key-pool-textarea{
    min-height:82px;
    resize:vertical;
    font-family:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;
    font-size:12px;
    line-height:1.55;
}

.ai-key-help{
    margin-top:-4px;
    color:var(--text-sub);
    font-size:12px;
    line-height:1.55;
}

.ai-key-actions{
    display:grid;
    grid-template-columns:112px 112px;
    gap:8px;
    align-items:center;
    margin-top:auto;
}

.ai-key-save-btn{
    width:100%;
    min-width:0;
}

.ai-key-delete-btn{
    width:100%;
    min-width:0;
}

.ai-key-list-panel{
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:8px;
    padding:10px;
    border:1px solid rgba(92,106,255,.20);
    border-radius:var(--radius-md);
    background:linear-gradient(180deg, rgba(92,103,242,.08) 0%, rgba(92,103,242,.04) 100%);
}

.ai-key-list-head{
    color:var(--text-sub);
    font-size:12px;
    font-weight:800;
}

.ai-key-list{
    min-height:0;
    max-height:190px;
    display:grid;
    gap:6px;
    overflow:auto;
    padding-right:2px;
}

.ai-key-list-item{
    width:100%;
    min-height:42px;
    display:flex;
    flex-direction:column;
    align-items:flex-start;
    justify-content:center;
    gap:2px;
    padding:7px 8px;
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    color:var(--text-main);
    background:var(--surface);
    text-align:left;
}

.ai-key-list-item:hover{
    border-color:rgba(92,103,242,.28);
    background:var(--surface-soft);
}

.ai-key-list-item.selected{
    border-color:rgba(92,103,242,.58);
    color:var(--accent-strong);
    background:rgba(92,103,242,.12);
}

.ai-key-list-item span{
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    font-size:12px;
    font-weight:800;
}

.ai-key-list-item small{
    max-width:100%;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    color:var(--text-sub);
    font-size:12px;
    font-family:ui-monospace,SFMono-Regular,Consolas,"Liberation Mono",monospace;
}

.ai-key-empty{
    min-height:74px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px dashed var(--border-strong);
    border-radius:var(--radius-sm);
    color:var(--text-sub);
    background:rgba(255,255,255,.52);
    font-size:12px;
    font-weight:700;
}

.ai-form-grid,
.service-form-grid{
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:12px;
    padding:14px;
}

.ai-provider-card .ai-form-grid{
    padding:0;
}

.ai-models-field{
    grid-column:1 / -1;
}

.switch-field,
.check-field{
    min-height:42px;
    display:flex;
    align-items:center;
    gap:8px;
    color:var(--text-sub);
    font-size:13px;
    font-weight:700;
}

.switch-field input,
.check-field input{
    width:16px;
    height:16px;
    accent-color:var(--accent);
}

.credential-list{
    display:grid;
    gap:10px;
    padding:0 14px 14px;
}

.credential-row{
    display:grid;
    grid-template-columns:minmax(160px,.8fr) minmax(220px,1.4fr) minmax(120px,.45fr) minmax(110px,.45fr);
    gap:10px;
    align-items:end;
    padding:12px;
    border:1px solid var(--border);
    border-radius:var(--radius-md);
    background:var(--surface-soft);
}

.new-credential-row{
    border-style:dashed;
    background:var(--surface);
}

.compact-field{
    min-width:0;
}

.ai-save-btn{
    margin:0 0 18px 0;
}

.btn.danger{
    color:#b91c1c;
    border-color:rgba(239,68,68,.24);
    background:rgba(239,68,68,.08);
}

.btn.danger:hover{
    color:#991b1b;
    border-color:rgba(239,68,68,.38);
    background:rgba(239,68,68,.12);
}

.notice{
    margin-bottom:16px;
    padding:12px 14px;
    border:1px solid rgba(180,83,9,.24);
    border-radius:var(--radius-md);
    color:#8a4b08;
    background:rgba(245,158,11,.10);
    line-height:1.6;
}

.feedback-layer{
    position:fixed;
    top:18px;
    right:18px;
    z-index:70;
    display:grid;
    gap:10px;
    pointer-events:none;
}

.toast{
    min-width:240px;
    max-width:360px;
    display:flex;
    align-items:flex-start;
    gap:10px;
    padding:12px 14px;
    border:1px solid rgba(92,103,242,.18);
    border-radius:var(--radius-md);
    background:rgba(255,255,255,.98);
    box-shadow:0 8px 22px rgba(15,23,42,.12);
    color:var(--text-main);
    font-size:13px;
    font-weight:800;
    line-height:1.5;
    animation:toast-in .18s ease-out;
}

.toast.leaving{
    opacity:0;
    transform:translateY(-4px);
}

.toast-icon{
    width:20px;
    height:20px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    flex:0 0 auto;
    border-radius:50%;
    color:#fff;
    background:var(--success);
    font-size:12px;
    font-weight:900;
}

.toast-error{
    border-color:rgba(239,68,68,.24);
}

.toast-error .toast-icon{
    background:var(--danger);
}

.confirm-overlay{
    position:fixed;
    inset:0;
    z-index:60;
    display:grid;
    place-items:center;
    padding:24px;
    overflow:auto;
    background:rgba(15,23,42,.42);
    backdrop-filter:blur(3px);
    animation:confirm-fade .16s ease-out;
}

.confirm-overlay.leaving{
    opacity:0;
}

.confirm-dialog{
    width:min(420px,100%);
    max-height:calc(100vh - 48px);
    max-height:calc(100dvh - 48px);
    display:grid;
    grid-template-columns:auto minmax(0,1fr);
    gap:14px;
    padding:18px;
    border:1px solid rgba(226,232,240,.95);
    border-radius:var(--radius-lg);
    background:var(--surface);
    box-shadow:0 18px 46px rgba(15,23,42,.22);
    overflow:auto;
    animation:confirm-pop .18s ease-out;
}

.confirm-icon{
    width:42px;
    height:42px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border-radius:14px;
    color:#fff;
    background:var(--accent);
    font-size:18px;
    font-weight:900;
}

.confirm-icon.danger{
    background:var(--danger);
}

.confirm-body h3{
    margin:0 0 6px;
    color:var(--text-main);
    font-size:18px;
    line-height:1.25;
}

.confirm-body p{
    margin:0;
    color:var(--text-sub);
    font-size:13px;
    line-height:1.7;
}

.confirm-actions{
    grid-column:1 / -1;
    display:flex;
    justify-content:flex-end;
    gap:10px;
    padding-top:4px;
}

@keyframes toast-in{
    from{
        opacity:0;
        transform:translateY(-6px);
    }
    to{
        opacity:1;
        transform:translateY(0);
    }
}

@keyframes confirm-fade{
    from{ opacity:0; }
    to{ opacity:1; }
}

@keyframes confirm-pop{
    from{
        opacity:0;
        transform:translateY(8px) scale(.98);
    }
    to{
        opacity:1;
        transform:translateY(0) scale(1);
    }
}

code{
    padding:2px 6px;
    border-radius:6px;
    color:var(--accent-strong);
    background:var(--accent-soft);
}

@media (max-width:980px){
    body{
        overflow:auto;
    }

    .layout{
        grid-template-columns:1fr;
    }

    .sidebar{
        height:auto;
        min-height:auto;
    }

    .main{
        height:auto;
        overflow:visible;
    }

    .main.main-fixed{
        height:100vh;
        overflow:hidden;
    }

    .confirm-overlay{
        padding:12px;
    }

    .link-route-modal{
        width:100%;
        height:calc(100vh - 24px);
        max-height:calc(100vh - 24px);
    }

    .topbar,
    .user-badge{
        align-items:flex-start;
        flex-direction:column;
    }

    .grid-stats,
    .metric-grid,
    .split,
    .customer-record-filter,
    .customer-record-board,
    .repeat-fan-filter-bar,
    .web-mr-toolbar,
    .web-mr-board,
    .subaccount-layout,
    .knowledge-summary-grid,
    .knowledge-upload-body,
    .knowledge-simple-form,
    .knowledge-category-row,
    .knowledge-assignment-row,
    .knowledge-recall-body,
    .knowledge-recall-actions,
    .script-summary-row,
    .script-filter-bar,
    .script-row,
    .form-row,
    .form-grid.three,
    .script-form,
    .lead-form,
    .lead-import-form,
    .link-route-modal-grid,
    .proxy-filter-bar,
    .proxy-modal-grid,
    .ai-simple-grid,
    .ai-form-grid,
    .service-form-grid,
    .credential-row{
        grid-template-columns:1fr;
    }

    .form-grid .span-two,
    .link-route-targets,
    .link-route-target-preview-field{
        grid-column:auto;
    }

    .manager-scope-list{
        max-height:260px;
    }

    .account-log-filter{
        align-items:stretch;
        flex-direction:column;
    }

    .log-filter-field,
    .log-time-trigger{
        width:100%;
        min-width:0;
    }

    .log-time-popover{
        grid-template-columns:1fr;
    }

    .log-time-shortcuts{
        flex-direction:row;
        flex-wrap:wrap;
        border-right:0;
        border-bottom:1px solid var(--border);
    }

    .log-time-shortcuts button{
        flex:1 1 120px;
    }

    .log-time-custom{
        grid-template-columns:1fr;
    }

    .desktop-group-panel{
        height:380px;
    }

    .script-group-inline{
        width:100%;
        min-width:0;
        grid-template-columns:1fr;
    }

    .script-editor-panel .toolbar{
        width:100%;
        justify-content:flex-start;
    }

    .knowledge-search-input{
        width:100%;
    }

    .ai-key-card{
        grid-template-columns:1fr;
    }

    .script-actions{
        justify-content:flex-start;
        min-width:0;
    }

    .ai-key-list{
        max-height:132px;
    }

    .ai-provider-grid,
    .tts-provider-grid{
        grid-template-columns:1fr;
    }

    .link-route-targets,
    .link-route-block-countries,
    .link-route-block-devices{
        grid-column:auto;
    }

    .link-route-click-head,
    .link-route-click-row{
        grid-template-columns:1fr;
    }

    .chat{
        max-height:none;
    }

    .web-mr-board.is-account-collapsed,
    .web-mr-board.is-friend-collapsed{
        --mr-account-col:minmax(0,1fr);
        --mr-friend-col:minmax(0,1fr);
    }

    .web-mr-board.is-account-collapsed .mr-account-body,
    .web-mr-board.is-friend-collapsed .mr-friend-body{
        display:flex;
    }
}

@media (max-width:1400px){
    .web-mr-board{
        --mr-info-drawer-w:300px;
    }

    .mr-detail-grid{
        grid-template-columns:1fr;
    }
}

@media (max-width:1180px){
    .web-mr-board{
        --mr-info-drawer-w:280px;
    }

    .mr-info-drawer{
        top:58px;
        width:min(280px,42vw);
    }
}

@media (max-width:1280px){
    .main{
        padding:12px;
    }

    .topbar{
        gap:10px;
        padding:10px 12px;
    }

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

    .web-mr-toolbar{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .web-mr-search-field{
        grid-column:1 / -1;
    }

    .web-mr-board{
        --mr-account-col:minmax(180px,.7fr);
        --mr-friend-col:minmax(190px,.8fr);
        --mr-info-drawer-w:280px;
    }

    .mr-toolbar{
        gap:10px;
        padding:12px;
    }

    .mr-account-card,
    .mr-friend-card,
    .mr-chat-body,
    .mr-info-body{
        padding:12px;
    }

    .mr-bubble{
        max-width:min(86%,520px);
    }

    .proxy-filter-bar{
        grid-template-columns:repeat(3,minmax(0,1fr)) auto auto;
    }

    .proxy-search-field{
        grid-column:1 / -1;
    }

    .translation-cache-toolbar{
        align-items:stretch;
        flex-wrap:wrap;
    }

    .translation-cache-filter-fields{
        flex:1 1 100%;
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .translation-cache-toolbar-actions{
        flex-wrap:wrap;
        white-space:normal;
    }

    .ai-simple-grid{
        grid-template-columns:1fr;
    }
}

@media (max-width:1120px){
    .web-mr-board{
        grid-template-columns:minmax(170px,.8fr) minmax(210px,1fr);
        grid-template-rows:minmax(210px,40%) minmax(0,1fr);
    }

    .web-mr-board.is-info-open{
        grid-template-columns:minmax(170px,.8fr) minmax(210px,1fr);
    }

    .mr-friend-col{
        border-right:none;
    }

    .mr-chat-col{
        grid-column:1 / -1;
        border-top:1px solid var(--border);
        border-right:none;
    }

    .mr-info-drawer{
        top:0;
        width:min(320px,calc(100% - 20px));
    }

    .mr-detail-grid{
        grid-template-columns:1fr;
    }

    .proxy-list-head .toolbar{
        flex:1 1 100%;
        justify-content:flex-start;
    }

    .proxy-filter-bar{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .proxy-filter-bar .btn{
        width:100%;
    }

    .ai-provider-grid,
    .tts-provider-grid{
        grid-template-columns:1fr;
    }
}

@media (max-width:980px){
    .web-mr-board,
    .web-mr-board.is-info-open{
        grid-template-columns:1fr;
        grid-template-rows:auto auto minmax(420px,1fr);
        overflow:auto;
    }

    .mr-col{
        min-height:220px;
        border-right:none;
        border-bottom:1px solid var(--border);
    }

    .mr-chat-col{
        min-height:420px;
        border-bottom:none;
    }

    .mr-info-drawer{
        top:0;
        width:min(340px,calc(100% - 20px));
    }

    .proxy-modal{
        width:100%;
        max-height:calc(100vh - 24px);
        max-height:calc(100dvh - 24px);
        padding:14px;
    }
}

@media (max-width:640px){
    .main{
        padding:10px;
    }

    .grid-stats,
    .metric-grid,
    .translation-cache-filter-fields{
        grid-template-columns:1fr;
    }

    .topbar,
    .panel-head,
    .proxy-list-head{
        align-items:stretch;
    }

    .panel-actions,
    .toolbar,
    .translation-cache-toolbar-actions,
    .proxy-modal-actions{
        width:100%;
    }

    .toolbar .btn,
    .translation-cache-toolbar-actions .btn,
    .proxy-modal-actions .btn{
        flex:1 1 120px;
    }

    .mr-field{
        align-items:stretch;
        flex-direction:column;
        gap:6px;
    }

    .mr-filter-btn{
        width:100%;
    }

    .mr-bubble{
        max-width:96%;
    }
}

@media (max-height:760px){
    .main{
        padding:10px;
    }

    .grid-stats,
    .metric-grid{
        gap:10px;
        margin-bottom:10px;
    }

    .stat{
        min-height:88px;
        padding:10px 12px;
    }

    .stat-value{
        font-size:22px;
    }

    .mr-shell{
        gap:8px;
    }

    .mr-toolbar{
        gap:8px;
        padding:10px 12px;
    }

    .mr-col-head,
    .mr-chat-head,
    .mr-info-head{
        min-height:50px;
        padding:0 12px;
    }

    .mr-chat-body,
    .mr-info-body{
        padding:10px;
    }

    .manager-scope-list{
        max-height:260px;
    }

    .proxy-modal{
        max-height:calc(100vh - 24px);
        max-height:calc(100dvh - 24px);
    }

    .proxy-batch-textarea{
        min-height:132px;
        max-height:32vh;
    }

    .translation-cache-modal-textarea{
        max-height:92px;
    }
}

@media (prefers-reduced-motion: reduce){
    *,
    *::before,
    *::after{
        transition:none !important;
        scroll-behavior:auto !important;
    }
}
