:root{--bg:#f4f6f9;--panel:#fff;--ink:#172334;--muted:#667385;--line:#dce3eb;--blue:#1769dc;--blue2:#eaf2ff;--green:#14804a;--amber:#a96000;--red:#c53535;--sidebar:#fbfcfe;--shadow:0 9px 30px rgba(28,45,70,.065)}
*{box-sizing:border-box}[hidden]{display:none!important}html,body{margin:0;min-height:100%;background:var(--bg);color:var(--ink);font:14px/1.5 Inter,"Segoe UI","Microsoft YaHei",sans-serif}button,input,textarea,select{font:inherit}button{border:1px solid var(--line);background:#fff;color:var(--ink);border-radius:9px;padding:9px 14px;cursor:pointer}button:hover{border-color:#a9b8c8}button:disabled{opacity:.5;cursor:not-allowed}.primary{background:var(--blue);border-color:var(--blue);color:#fff}.ghost{background:transparent}.muted{color:var(--muted)}
.app-frame{display:flex;min-height:100vh}.sidebar{position:fixed;z-index:30;inset:0 auto 0 0;width:242px;padding:18px 14px;background:var(--sidebar);border-right:1px solid var(--line);display:flex;flex-direction:column}.sidebar-brand{display:flex;align-items:center;gap:11px;padding:0 8px 20px}.sidebar-brand>div{display:flex;flex-direction:column;min-width:0}.sidebar-brand strong{white-space:nowrap;font-size:15px}.sidebar-brand small{color:var(--muted);font-size:11px}.brand-mark{display:grid;place-items:center;width:44px;height:44px;border-radius:13px;background:linear-gradient(145deg,#1677ff,#0b4fa9);color:#fff;font-weight:800;font-size:22px;box-shadow:0 8px 20px rgba(18,101,214,.24)}.brand-mark.small{width:34px;height:34px;border-radius:9px;font-size:16px;flex:0 0 auto}.side-nav{display:flex;flex-direction:column;gap:3px}.nav-label{margin:17px 11px 6px;color:#8a96a5;font-size:10px;font-weight:700;letter-spacing:.12em;text-transform:uppercase}.nav-item{width:100%;display:grid;grid-template-columns:26px 1fr auto;align-items:center;text-align:left;border:0;background:transparent;padding:10px 11px;color:#46566b}.nav-item:hover{background:#f0f4f9;border:0}.nav-item.active{background:var(--blue2);color:var(--blue);font-weight:650}.nav-item b{min-width:25px;padding:1px 6px;border-radius:10px;background:#edf1f6;color:#68778b;text-align:center;font-size:10px}.nav-item.active b{background:#d7e7ff;color:var(--blue)}.nav-icon{font-size:18px;text-align:center}.sidebar-foot{margin-top:auto;padding:14px 11px 2px;border-top:1px solid var(--line);display:flex;flex-direction:column;gap:3px;color:var(--muted)}.sidebar-foot small{font-size:10px}.health-line{font-size:11px;color:var(--green)}.health-line i{display:inline-block;width:7px;height:7px;margin-right:6px;border-radius:50%;background:currentColor}
.content-frame{width:calc(100% - 242px);margin-left:242px;min-width:0}.topbar{height:70px;padding:0 25px;background:#fff;border-bottom:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;position:sticky;top:0;z-index:20}.top-title{display:flex;align-items:center;gap:12px}.top-title h1{margin:0;font-size:18px}.top-title p{margin:1px 0 0;color:var(--muted);font-size:11px}.top-actions{display:flex;align-items:center;gap:9px;font-size:12px}.icon-button{display:none;width:38px;padding:8px}.shell{max-width:1540px;margin:0 auto;padding:22px}.view{display:none}.view.active{display:block}.section-note{margin:3px 0 0;color:var(--muted);font-size:12px}
.stats-grid{display:grid;grid-template-columns:repeat(6,minmax(120px,1fr));gap:13px;margin-bottom:17px}.small-stats{grid-template-columns:repeat(5,minmax(130px,1fr))}.stat{background:var(--panel);border:1px solid var(--line);border-radius:13px;padding:16px;box-shadow:var(--shadow)}.stat .value{font-size:26px;font-weight:760;margin-top:3px;transition:opacity 0.15s ease}.stat .value.updating{opacity:0.35}.stat .label{color:var(--muted);font-size:11px}.stat .hint{margin-top:3px;color:#8a96a5;font-size:10px}.two-col{display:grid;grid-template-columns:1fr 1fr;gap:17px}.panel{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:19px;margin-bottom:17px;box-shadow:var(--shadow)}.panel-head{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:15px}.panel h2{margin:0;font-size:18px}.panel h3{margin:0 0 10px;font-size:15px}.eyebrow{margin:0 0 2px;color:var(--blue);letter-spacing:.12em;font-size:9px;font-weight:750}.status-dot{font-size:11px;color:var(--green)}
.overview-lines{display:grid;gap:9px;margin-bottom:15px}.overview-line{display:flex;justify-content:space-between;gap:15px;padding:9px 11px;border-radius:9px;background:#f7f9fc}.overview-line span{color:var(--muted);font-size:11px}.overview-line strong{text-align:right;font-size:11px}.compact-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:9px}.compact-stat{padding:12px;border:1px solid var(--line);border-radius:10px}.compact-stat b{display:block;font-size:21px}.compact-stat span{color:var(--muted);font-size:10px}.summary-strip{display:flex;gap:8px;flex-wrap:wrap;margin:-2px 0 13px}.summary-item{padding:6px 9px;background:#f5f7fa;border-radius:8px;color:var(--muted);font-size:11px}.summary-item b{margin-left:4px;color:var(--ink)}
.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px}.span-2{grid-column:1/-1}label{display:flex;flex-direction:column;gap:6px;color:#465466;font-size:11px}input,textarea,select{border:1px solid var(--line);border-radius:9px;padding:9px 10px;background:#fff;color:var(--ink);outline:none}input:focus,textarea:focus,select:focus{border-color:var(--blue);box-shadow:0 0 0 3px rgba(18,101,214,.1)}textarea{resize:vertical;font-family:ui-monospace,SFMono-Regular,Consolas,monospace}.switch-row{flex-direction:row;align-items:center;justify-content:space-between;border:1px solid var(--line);border-radius:9px;padding:10px 11px}.switch-row input{width:18px;height:18px}.button-row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.mini-log{min-height:40px;margin:13px 0 0;background:#f7f9fb;border:1px solid #e6ebf0;border-radius:9px;padding:10px;white-space:pre-wrap;color:#566477;font-size:10px}
.tabs{display:flex;gap:6px;margin-bottom:13px}.tab{padding:7px 12px}.tab.active{background:var(--blue2);border-color:#b8d4fb;color:var(--blue)}.account-actions,.resource-tools{display:flex;gap:8px;align-items:center;flex-wrap:wrap}.account-actions select{min-width:205px}.search-input{width:205px}.profile-list{display:grid;gap:13px}.profile-row{display:block;padding:15px;border:1px solid var(--line);border-radius:12px;background:#fafbfd}.profile-card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}.profile-card-head>div{display:flex;flex-direction:column;min-width:0}.profile-card-head strong{font-size:14px}.profile-card-head span{color:var(--muted);font:10px ui-monospace,SFMono-Regular,Consolas,monospace;word-break:break-all}.profile-card-head .danger-link{padding:4px 8px;color:var(--red);background:transparent}.profile-grid{display:grid;grid-template-columns:1fr 2fr .7fr .65fr .65fr .65fr;gap:10px}.profile-grid>*{min-width:0}.profile-grid .profile-id{grid-column:span 2}.profile-grid .profile-mother{grid-column:span 2}.profile-grid .profile-token{grid-column:span 3}.profile-grid .profile-note{grid-column:1/-1}.profile-grid input,.profile-grid select{width:100%;min-width:0}.profile-switches{display:grid;grid-template-columns:repeat(6,minmax(125px,1fr));gap:8px;margin-top:11px}.profile-switches .switch-row{background:#fff}.profile-switches .clear-token{color:var(--red)}.profile-status{display:flex;align-items:center;gap:11px;flex-wrap:wrap;margin-top:11px;padding-top:10px;border-top:1px solid #e8edf3;color:var(--muted);font-size:10px}.profile-status-actions{display:flex;gap:7px;margin-left:auto}.profile-status button{margin-left:0;padding:6px 10px}.ok-text{color:var(--green)!important}.warn-text{color:var(--amber)!important}.bad-text,.runtime-error{color:var(--red)!important}.info-panel{background:#f9fbff}.info-panel ol{margin:0;padding-left:20px;color:var(--muted)}
.table-wrap{overflow:auto;border:1px solid var(--line);border-radius:10px}table{width:100%;border-collapse:collapse;white-space:nowrap}th,td{text-align:left;padding:9px 11px;border-bottom:1px solid #edf1f4;font-size:11px}th{position:sticky;top:0;background:#f7f9fb;color:#607084;font-weight:650;z-index:1}tr:last-child td{border-bottom:0}.pill{display:inline-flex;padding:2px 7px;border-radius:10px;background:#edf1f5;color:#536174;font-size:10px}.pill.ok{background:#e4f6ec;color:var(--green)}.pill.warn{background:#fff1dc;color:var(--amber)}.pill.bad{background:#fde8e8;color:var(--red)}.row-buttons{display:flex;gap:5px}.row-buttons button{padding:5px 8px;font-size:10px}.empty{text-align:center;color:var(--muted);padding:24px}.table-caption{display:flex;align-items:center;justify-content:space-between;margin-bottom:9px}.table-caption span{color:var(--muted);font-size:10px}
.view[data-view-panel="accounts"] .table-wrap{max-height:calc(100vh - 300px)}
.resource-layout{display:grid;grid-template-columns:340px minmax(0,1fr);gap:16px}.import-card{padding:16px;border:1px solid var(--line);border-radius:11px;background:#f9fbfd;display:flex;flex-direction:column;gap:12px;align-self:start}.import-card h3{margin:0}.import-card p{margin:2px 0 0;color:var(--muted);font-size:10px}.resource-table-card{min-width:0}.resource-table-card .table-wrap{max-height:500px}.resource-head{align-items:flex-end}.automation-panel{max-width:1100px}.form-divider{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-top:7px;padding:10px 0 5px;border-top:1px solid var(--line)}.form-divider span{color:var(--muted);font-size:10px}.automation-runtime{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;margin-bottom:13px}.runtime-card{padding:12px;border:1px solid var(--line);border-radius:10px;background:#fafbfd}.runtime-card>div:first-child{display:flex;align-items:center;justify-content:space-between;gap:10px}.runtime-card code{color:var(--muted);font-size:9px;word-break:break-all}.runtime-tags{display:flex;gap:5px;flex-wrap:wrap;margin:8px 0}.runtime-card dl{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;margin:0}.runtime-card dl div{padding:6px;background:#fff;border-radius:7px}.runtime-card dt{color:var(--muted);font-size:9px}.runtime-card dd{margin:1px 0 0;font-size:10px;word-break:break-word}.runtime-error{margin:8px 0 0;font-size:10px}.toast{position:fixed;right:22px;top:82px;z-index:60;max-width:440px;background:#17212b;color:#fff;border-radius:10px;padding:11px 15px;box-shadow:0 12px 35px rgba(0,0,0,.2)}.sidebar-mask{position:fixed;z-index:25;inset:0;background:rgba(17,29,45,.38)}
.login-body{min-height:100vh;display:grid;place-items:center;background:radial-gradient(circle at 20% 10%,#e2efff,transparent 35%),var(--bg)}.login-card{width:min(410px,calc(100% - 32px));background:#fff;border:1px solid var(--line);border-radius:18px;padding:34px;box-shadow:0 22px 60px rgba(26,53,85,.15)}.login-card h1{margin:16px 0 4px}.login-card label{margin:24px 0 10px}.full{width:100%;margin-top:8px}.error{min-height:22px;color:var(--red)}
.pill.used{background:#eee9ff;color:#6542b5}.pill.throttle{background:#fff3cd;color:#b45309;animation:pill-shake 1.2s ease-in-out infinite}@keyframes pill-shake{0%,100%{transform:translateX(0)}15%{transform:translateX(-2px)}30%{transform:translateX(2px)}45%{transform:translateX(-1px)}60%{transform:translateX(1px)}75%{transform:translateX(0)}}.space-detail{display:block;margin-top:2px;color:var(--muted);font-size:9px}
.history-dialog{width:min(700px,calc(100% - 28px));max-height:calc(100vh - 40px);padding:0;border:0;border-radius:15px;background:transparent;color:var(--ink);box-shadow:0 24px 70px rgba(13,29,50,.28)}.history-dialog::backdrop{background:rgba(17,29,45,.48)}.dialog-card{padding:20px;background:#fff;border:1px solid var(--line);border-radius:15px}.dialog-head{display:flex;align-items:flex-start;justify-content:space-between;gap:18px}.dialog-head h2{margin:0;font-size:18px}.history-summary{display:flex;gap:8px;flex-wrap:wrap;margin:17px 0}.history-summary span{display:flex;align-items:center;gap:8px;padding:8px 11px;border-radius:9px;background:#f5f7fa;color:var(--muted);font-size:11px}.history-summary b{color:var(--ink);font-size:13px}.history-timeline{display:grid;gap:0;max-height:55vh;overflow:auto;padding:2px 3px 2px 0}.history-item{position:relative;display:grid;grid-template-columns:22px 1fr;gap:10px;padding:0 0 18px}.history-item:not(:last-child)::before{content:"";position:absolute;left:7px;top:15px;bottom:0;width:1px;background:var(--line)}.history-marker{position:relative;z-index:1;width:15px;height:15px;margin-top:3px;border:4px solid #c8d8ec;border-radius:50%;background:#fff}.history-item.joined .history-marker{border-color:var(--green)}.history-item.left .history-marker{border-color:#7759bd}.history-item-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.history-item code{display:block;margin-top:3px;color:#667385;font-size:10px;word-break:break-all;white-space:normal}.history-item p{margin:6px 0 0;color:var(--muted);font-size:10px}
@media(max-width:1180px){.stats-grid{grid-template-columns:repeat(3,1fr)}.small-stats{grid-template-columns:repeat(3,1fr)}.resource-layout{grid-template-columns:1fr}.import-card{display:grid;grid-template-columns:1fr 1fr;align-items:end}.import-card>div,.import-card textarea{grid-column:1/-1}.account-head{align-items:flex-start;flex-direction:column}.account-actions{width:100%}.profile-grid{grid-template-columns:repeat(3,1fr)}.profile-grid .profile-id,.profile-grid .profile-mother,.profile-grid .profile-token{grid-column:span 2}.profile-grid .profile-note{grid-column:1/-1}.profile-switches{grid-template-columns:repeat(3,1fr)}}
@media(max-width:820px){.sidebar{transform:translateX(-100%);transition:transform .2s}.sidebar.open{transform:translateX(0)}.content-frame{width:100%;margin-left:0}.icon-button{display:block}.topbar{height:66px;padding:0 14px}.shell{padding:13px}.two-col{grid-template-columns:1fr}.top-actions .muted{display:none}.resource-head{align-items:flex-start;flex-direction:column}.resource-tools{width:100%}.resource-tools .search-input{flex:1}.profile-grid{grid-template-columns:1fr 1fr}.profile-grid .profile-id,.profile-grid .profile-mother,.profile-grid .profile-token,.profile-grid .profile-note{grid-column:1/-1}.profile-switches{grid-template-columns:1fr 1fr}.automation-runtime{grid-template-columns:1fr}.runtime-card dl{grid-template-columns:1fr 1fr}}
@media(max-width:560px){.stats-grid,.small-stats{grid-template-columns:repeat(2,1fr)}.form-grid{grid-template-columns:1fr}.span-2{grid-column:auto}.account-actions{align-items:stretch;flex-direction:column}.account-actions .search-input,.account-actions select{width:100%;min-width:0}.compact-stats{grid-template-columns:repeat(2,1fr)}.import-card{display:flex}.panel{padding:15px}.top-title p{display:none}.profile-grid,.profile-switches{grid-template-columns:1fr}.profile-grid .profile-id,.profile-grid .profile-mother,.profile-grid .profile-token,.profile-grid .profile-note{grid-column:auto}.profile-status-actions{width:100%;margin-left:0}.profile-status-actions button{flex:1}.runtime-card>div:first-child{align-items:flex-start;flex-direction:column}}


/* pagination (added for accounts tab) */
.pagination{display:flex;justify-content:center;align-items:center;gap:1rem;margin:1rem 0;padding:0.5rem 0;}
.pagination button{padding:.5rem 1rem;border:1px solid var(--border,#374151);background:var(--bg-card,#1f2937);color:var(--text,#e5e7eb);border-radius:6px;cursor:pointer;font-size:.9rem;}
.pagination button:hover:not(:disabled){background:var(--bg-hover,#374151);}
.pagination button:disabled{opacity:.4;cursor:not-allowed;}
.pagination span{color:var(--text-dim,#9ca3af);font-size:.9rem;}
