:root{font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;color:#232825;background:#f6f7f4;font-size:15px;line-height:1.55;--ink:#202a25;--muted:#6d756f;--line:#e0e5de;--green:#345b46;--surface:#fff;--tint:#edf2ec;--red:#a22f3c;--radius:18px}
*{box-sizing:border-box}html,body{margin:0;min-width:280px}button,input,select,textarea{font:inherit;min-width:0}button,a,input,select,textarea{touch-action:manipulation}button,.button{cursor:pointer}button:disabled{opacity:.45;cursor:not-allowed}button:focus,a:focus,summary:focus{outline:3px solid #729980;outline-offset:3px}input:focus,select:focus,textarea:focus{outline:2px solid #b8cebd;outline-offset:1px;border-color:var(--green)}a{color:var(--green)}button,.button{border:0;border-radius:10px;padding:11px 17px;font-weight:600;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;line-height:1.4;min-height:44px}.primary{background:var(--ink);color:#fff}.primary:hover{background:#3c5547}.secondary{background:var(--tint);color:var(--ink);border:1px solid var(--line)}.quiet{background:transparent;color:var(--muted);padding:8px}.danger{color:var(--red);background:#fff2f2;border:1px solid #f1d6d7}.icon-button{background:transparent;color:var(--muted);padding:5px 10px;font-size:26px;line-height:1}.muted,small,.footnote{color:var(--muted)}small{font-size:12px}.footnote{font-size:12px;line-height:1.65;margin-top:16px}h1,h2,h3,p{margin:0}h1{font-size:30px;font-weight:650;letter-spacing:-.8px;line-height:1.25}h2{font-size:21px;font-weight:630;letter-spacing:-.3px}h3{font-size:17px;font-weight:620}label{font-size:13px;font-weight:550;display:block;margin:15px 0 6px}input,select,textarea{width:100%;border:1px solid #d6ddd4;border-radius:10px;padding:11px 12px;min-height:46px;background:#fff;color:var(--ink);font-size:16px}input::placeholder,textarea::placeholder{color:#9aa098}textarea{resize:vertical}input[readonly]{background:#f6f8f4}.brand{display:inline-flex;align-items:center;gap:9px;color:var(--ink);text-decoration:none;font-size:20px;font-weight:750;letter-spacing:1px;white-space:nowrap}.brand img{object-fit:contain;width:38px;height:38px;margin-right:2px}.brand>span{font-weight:450;font-size:12px;letter-spacing:2px;margin-top:2px}
.signed-out{background:radial-gradient(ellipse at 50% 30%,#fff 0%,#f6f7f4 65%)}.signed-out #app{width:100%;max-width:none;min-height:100vh;min-height:100svh;min-height:100dvh;padding:20px;display:flex;align-items:center;justify-content:center}.auth-shell{width:100%;max-width:366px;margin:auto}.auth-shell>.brand{display:flex;justify-content:center;margin:0 0 32px}.auth-shell>.brand img{width:42px;height:42px}.auth-card{background:#ffffffcc;border:1px solid #e1e6dd;border-radius:22px;padding:28px;box-shadow:0 12px 50px #243e2e05}.auth-tabs{display:flex;background:#f0f3ed;padding:4px;border-radius:10px;margin-bottom:22px}.auth-tabs button{width:50%;background:none;color:var(--muted);font-size:13px;min-height:35px;padding:8px}.auth-tabs button.active{background:#fff;color:var(--ink);box-shadow:0 1px 4px #162a1810}.auth-card form>label:first-child{margin-top:0}.auth-card .primary{width:100%;margin-top:22px}.auth-card .auth-bottom{display:flex;justify-content:center;margin-top:13px}.auth-card .auth-bottom button{font-size:12px;min-height:32px}.auth-card h1{font-size:20px;margin-bottom:18px}.auth-card .muted{font-size:13px;margin-bottom:18px}.code-row{display:flex;gap:8px}.code-row input{width:0;flex:1;letter-spacing:3px}.code-row button{font-size:12px;white-space:nowrap;padding:9px 12px}.field-note{display:block;font-size:12px;margin-top:5px;color:var(--muted)}
.topbar{height:80px;display:flex;align-items:center;justify-content:space-between;gap:16px;border-bottom:1px solid var(--line);background:#fff;padding:0 max(24px,calc((100vw - 1120px)/2))}.topbar[hidden]{display:none}.header-actions{display:flex;gap:10px;align-items:center}.identity{font-size:12px;color:var(--muted);max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}main{max-width:1120px;margin:0 auto;padding:34px 24px 60px}.page-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:26px}.page-heading p{font-size:13px;color:var(--muted);margin-top:8px}.tabs{display:flex;gap:23px;border-bottom:1px solid var(--line);margin-bottom:26px;overflow-x:auto}.tab{border-radius:0;background:none;color:var(--muted);padding:12px 1px;border-bottom:2px solid transparent;white-space:nowrap;font-size:14px}.tab.active{color:var(--ink);border-color:var(--ink)}.badge{display:inline-block;border-radius:5px;background:#e6ecdf;padding:1px 6px;font-size:11px}.section-heading{display:flex;align-items:center;justify-content:space-between;gap:14px;margin:25px 0 15px}.section-heading p{font-size:13px;color:var(--muted);margin-top:4px}.card{padding:24px;background:#fff;border:1px solid var(--line);border-radius:var(--radius)}.generate-card{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,2fr);gap:40px;align-items:start;padding:30px}.generate-card h2{font-size:24px}.generate-card p{font-size:13px;line-height:1.8;margin-top:9px;color:var(--muted)}.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:0 15px}.form-grid>label{margin-top:0}.form-grid>label input,.form-grid>label select{margin-top:7px}.form-wide{grid-column:1/-1}.generate-card .primary{margin-top:18px;min-width:160px}.device-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}.card-top{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:20px}.slot-number{font-size:12px;color:var(--muted);letter-spacing:1px}.status{display:inline-flex;align-items:center;gap:6px;border-radius:30px;padding:4px 9px;font-size:11px;font-weight:550;background:#eff1ec;color:#71776e;white-space:nowrap}.status.good{color:#366044;background:#e8f0e4}.status.bad{color:#a4444c;background:#fff0ef}.status.warning{color:#947526;background:#fcf3d8}.status-dot{width:5px;height:5px;background:currentColor;border-radius:50%}.device-card h3{word-wrap:break-word;overflow-wrap:anywhere}.device-platform{color:var(--muted);font-size:12px;margin:5px 0 18px}.facts{display:grid;gap:8px;margin:14px 0 0;font-size:12px}.facts div{display:flex;justify-content:space-between;gap:12px}.facts dt{color:var(--muted)}.facts dd{margin:0;text-align:right;word-wrap:break-word;overflow-wrap:anywhere}.device-actions{display:flex;gap:8px;margin-top:20px}.device-actions button{font-size:12px;padding:8px 11px;min-height:36px}.empty-card{background:transparent;border-style:dashed;display:flex;flex-direction:column;justify-content:center;min-height:220px}.empty-card p{font-size:13px;color:var(--muted);margin-top:6px}.replace-device{margin-top:13px}.replace-device summary{cursor:pointer;color:var(--muted);font-size:12px}.replace-device button{margin-top:15px;font-size:12px}.empty{padding:30px 0;color:var(--muted);font-size:13px}.invite-card{display:flex;align-items:center;justify-content:space-between;gap:30px;margin-bottom:22px}.invite-card p{font-size:13px;color:var(--muted);margin-top:6px}.invite-form{display:flex;gap:10px;flex:1;max-width:490px}.invite-form label{margin:0;flex:1}.invite-form button{white-space:nowrap}.sr-only{position:absolute;width:1px;height:1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.table-wrap{overflow:auto;background:#fff;border:1px solid var(--line);border-radius:14px}table{border-collapse:collapse;width:100%;font-size:12px;text-align:left}th{color:var(--muted);font-weight:550;background:#fafbf8;white-space:nowrap}th,td{padding:15px 18px;border-bottom:1px solid #e9ede5;vertical-align:top}tr:last-child td{border:0}td p{word-wrap:break-word;overflow-wrap:anywhere;max-width:300px}td small{font-size:11px}td .actions{margin-top:0}.actions{display:flex;gap:7px;flex-wrap:wrap}.actions button{font-size:12px;min-height:33px;padding:6px 9px}.pagination{display:flex;justify-content:space-between;align-items:center;gap:12px;flex-wrap:wrap;margin-top:15px;color:var(--muted);font-size:12px}.detail-panel{margin-top:28px;scroll-margin-top:20px}.detail-panel .device-grid{margin-bottom:20px}.location{display:block;font-size:11px;color:var(--muted);margin-top:3px;max-width:240px}.mono{font-family:ui-monospace,SFMono-Regular,monospace;font-size:11px;word-break:break-all}.nowrap{white-space:nowrap}.risk-card{margin-bottom:14px}.risk-card .reason{margin-top:12px;font-size:13px}.risk-meta{display:flex;gap:12px;flex-wrap:wrap;color:var(--muted);font-size:12px;margin-top:6px}.risk-card .actions{margin-top:20px}.risk-note{max-width:450px;margin-top:14px}.event-list{list-style:none;margin:0;padding:0}.event-list li{display:flex;gap:20px;padding:11px 0;border-bottom:1px solid var(--line);font-size:12px}.event-list li:last-child{border:0}.event-list time{color:var(--muted);min-width:148px}.account-card{max-width:480px}.account-card button{margin-top:20px}.account-card p{color:var(--muted);font-size:13px;margin-top:8px}.notice{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);z-index:20;background:var(--ink);color:#fff;border-radius:12px;padding:12px 18px;max-width:min(92vw,650px);font-size:13px;box-shadow:0 8px 24px #1d33201c}.notice.error{background:#92343f}.notice[hidden]{display:none}dialog{border:1px solid var(--line);border-radius:21px;padding:27px;max-width:510px;width:calc(100% - 32px);max-height:calc(100vh - 32px);max-height:calc(100dvh - 32px);overflow:auto;background:#fff;color:var(--ink);box-shadow:0 20px 80px #16332125}dialog::backdrop{background:#1a2d2370;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}dialog .section-heading{margin:0 0 18px}dialog .muted{font-size:13px}dialog textarea{font-family:ui-monospace,SFMono-Regular,monospace;font-size:13px}.dialog-actions{display:flex;gap:10px;margin-top:18px}.dialog-actions>*{flex:1}dialog small{display:block;margin-top:9px}
@media(max-width:850px){.generate-card{grid-template-columns:1fr;gap:22px}.device-grid{grid-template-columns:1fr}.device-card .facts{max-width:440px}.empty-card{min-height:130px}.invite-card{align-items:stretch;flex-direction:column;gap:20px}.invite-form{max-width:none}.identity{max-width:160px}}
@media(max-width:540px){.topbar{height:65px;padding:0 18px}.topbar .brand{font-size:17px;gap:6px}.topbar .brand img{width:30px;height:30px}.topbar .brand>span{font-size:10px;letter-spacing:1.5px}.identity{display:none}main{padding:25px 18px 40px}.page-heading{margin-bottom:19px}h1{font-size:26px}.page-heading>.status{font-size:10px}.tabs{gap:20px}.tab{font-size:13px}.card{padding:21px}.generate-card{padding:24px 21px}.form-grid{grid-template-columns:1fr;gap:0}.form-grid>label+label{margin-top:14px}.generate-card .primary{width:100%}.invite-form{flex-direction:column}.invite-form button{width:100%}.auth-card{padding:25px}.auth-shell>.brand{margin-bottom:26px}.signed-out #app{padding:max(18px,env(safe-area-inset-top)) 20px max(18px,env(safe-area-inset-bottom))}.event-list li{flex-direction:column;gap:3px}.section-heading h2{font-size:19px}.risk-card .card-top{align-items:flex-start}.dialog-actions{flex-direction:column}.header-actions{gap:4px}.header-actions button{font-size:12px}}
@media(max-height:650px){.signed-out #app{padding-top:15px;padding-bottom:15px}.auth-shell>.brand{margin-bottom:18px}.auth-card{padding:20px}.auth-tabs{margin-bottom:17px}.auth-card label{margin-top:12px}.auth-card .primary{margin-top:17px}.auth-card .auth-bottom{margin-top:8px}}
/* Safari 15.0–15.3 has no native dialog behavior; closed dialogs must stay out of layout. */
[hidden]{display:none!important}
dialog[hidden],dialog:not([open]),.dialog-backdrop[hidden]{display:none!important}
dialog[open]{display:block}
.generate-card>*,.form-grid>*{min-width:0}
body.dialog-open{overflow:hidden}
.dialog-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:200;background:#1a2d2370;-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);touch-action:none}
dialog.legacy-dialog[open]{position:fixed;top:calc(var(--dialog-viewport-top,0px) + var(--dialog-viewport-height,100vh)/2);right:auto;bottom:auto;left:50%;z-index:201;margin:0;transform:translate(-50%,-50%);max-height:calc(var(--dialog-viewport-height,100vh) - 32px);overflow:auto;-webkit-overflow-scrolling:touch}
@supports selector(:focus-visible){button:focus:not(:focus-visible),a:focus:not(:focus-visible),summary:focus:not(:focus-visible){outline:none}}
#risk-filter{max-width:140px;font-size:13px}
#code{text-transform:uppercase}
.compatibility-options{margin-top:16px;font-size:12px;color:var(--muted)}
.compatibility-options summary{cursor:pointer;padding:5px 0}
.security-actions{margin:12px 0 20px}
#initial-password{font-family:ui-monospace,SFMono-Regular,monospace;letter-spacing:1px}
.form-error{color:var(--red);font-size:13px;margin-top:12px}
.topbar>a{text-decoration:none}
.device-name{display:inline;text-align:left;min-height:0;border-radius:4px;padding:0;background:transparent;color:inherit;font:inherit;line-height:inherit;word-wrap:break-word;overflow-wrap:anywhere}
.device-name:hover{text-decoration:underline;text-decoration-color:#b8cebd;text-underline-offset:5px}
.device-name-form{display:grid;grid-template-columns:minmax(0,1fr) 32px 32px;gap:5px;align-items:center}
.device-name-input{min-width:0;min-height:38px;padding:7px 9px;font-size:16px}
.name-edit-action{min-height:36px;padding:4px;background:var(--tint);color:var(--green);font-size:18px}
.name-error{grid-column:1/-1;margin-top:2px}
.site-footer{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:12px;margin-top:26px;font-size:10px;color:#818980}
.site-footer a{color:inherit;text-underline-offset:2px}
.source-page{max-width:680px}.source-page h1{margin-bottom:24px}.source-page p{margin-top:14px}
body{min-height:100vh;min-height:100dvh;isolation:isolate;background:#f4f6f2}
body::before{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;background:radial-gradient(ellipse at 4% 12%,#c6dfce99 0,transparent 46%),radial-gradient(ellipse at 96% 8%,#e9dfc37a 0,transparent 44%),radial-gradient(ellipse at 78% 96%,#cbded866 0,transparent 49%),linear-gradient(135deg,#f7f8f2,#edf3ed 55%,#f5f4ec)}
body::after{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;background-image:linear-gradient(#6f92750a 1px,transparent 1px),linear-gradient(90deg,#6f92750a 1px,transparent 1px);background-size:72px 72px;-webkit-mask-image:linear-gradient(135deg,#0009,transparent 55%,#0005);mask-image:linear-gradient(135deg,#0009,transparent 55%,#0005)}
.signed-out{background:#f4f6f2}.signed-out::before{background:radial-gradient(ellipse at 12% 24%,#bcd9c7b0 0,transparent 44%),radial-gradient(ellipse at 86% 10%,#ede0b78a 0,transparent 44%),radial-gradient(ellipse at 84% 84%,#c0d9d099 0,transparent 47%),linear-gradient(135deg,#f8f7ef,#edf3ed 58%,#f3f5ef)}
.auth-card{background:#ffffffd9;border-color:#ffffffdb;box-shadow:0 20px 70px #345b4612;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}
.topbar{background:#ffffffc9;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}.card{box-shadow:0 8px 30px #345b4605}
.device-card .card-top{align-items:flex-start}.device-card .slot-number{flex-shrink:0;padding-top:4px}.device-status{white-space:normal;text-align:right;justify-content:flex-end;word-wrap:break-word;overflow-wrap:anywhere;max-width:78%}
.delete-dialog{max-width:420px;background:#fff}.delete-dialog .section-heading{margin-bottom:14px}.delete-target{font-size:17px;font-weight:600;word-wrap:break-word;overflow-wrap:anywhere;margin-bottom:10px}.delete-dialog .muted{line-height:1.8}.delete-dialog .dialog-actions{margin-top:25px}.danger-solid{background:#a4434e;color:#fff}.danger-solid:hover{background:#8c3440}
.link-device-name{font-size:16px;font-weight:600;word-wrap:break-word;overflow-wrap:anywhere;margin-bottom:10px}
.devices-layout{display:flex;flex-direction:column;min-width:0}
#generator-panel,.devices-section{min-width:0}
#generator-panel{order:0;scroll-margin-top:20px}
.devices-section{order:1}
.devices-policy{order:2;margin:16px 0 0}
#generator-panel form{min-width:0}
#generator-panel #new-device-fields>label{margin-top:0}
#generator-panel input:disabled,#generator-panel select:disabled{color:#87917f;-webkit-text-fill-color:#87917f;background:#f0f3ed;border-color:#dbe2d6;opacity:1;cursor:not-allowed}
.mobile-add-device,.mobile-device-empty,.nav-icon{display:none}

/* Keep the desktop arrangement intact; phones put device actions first. */
@media(max-width:640px){
  html{scroll-padding-top:84px;scroll-padding-bottom:24px}
  body:not(.signed-out) main{width:100%;padding:20px max(14px,env(safe-area-inset-right)) calc(36px + env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left))}
  .topbar{position:sticky;top:0;z-index:15;height:auto;min-height:60px;gap:8px;padding:8px max(14px,env(safe-area-inset-right)) 8px max(14px,env(safe-area-inset-left));padding-top:calc(8px + env(safe-area-inset-top));border-color:#dce5d9;background:#f8faf5ed}
  .topbar .brand{font-size:18px;gap:6px;letter-spacing:.7px}
  .topbar .brand img{width:30px;height:30px;margin-right:0}
  .topbar .brand>span{font-size:9px;letter-spacing:1.2px}
  .header-actions{gap:2px;flex:none}
  .header-actions button{min-width:44px;min-height:44px;padding:8px 9px;font-size:12px}
  .identity{display:none}
  .page-heading{gap:12px;margin-bottom:18px;align-items:center}
  .page-heading>div{min-width:0}
  h1{font-size:25px;letter-spacing:-.6px;line-height:1.3}
  .page-heading>.status{font-size:10px;padding:5px 8px;flex:none}
  .tabs{position:static;display:flex;align-items:stretch;gap:14px;margin:0 0 20px;padding:0;border:0;border-bottom:1px solid #dce5d9;background:transparent;overflow-x:auto;overscroll-behavior-x:contain}
  .tab{display:inline-flex;flex:0 0 auto;justify-content:center;gap:0;min-width:0;min-height:44px;padding:10px 0;border:0;border-bottom:2px solid transparent;border-radius:0;font-size:13px;line-height:1.4;text-align:center;color:#768174;white-space:nowrap}
  .tab.active{background:transparent;color:#2f543f;border-bottom-color:#345b46}
  .nav-icon{display:none}
  .nav-label{display:block;font-size:13px;line-height:1.4;white-space:nowrap}
  .tab.active .nav-label{font-weight:650}
  .devices-layout{gap:18px}
  .devices-section{order:0}
  .devices-section>.section-heading{margin:0 0 13px;align-items:center;gap:10px}
  .section-heading{margin:23px 0 12px;gap:12px}
  .section-heading>div{min-width:0}
  .section-heading h2{font-size:18px;line-height:1.4;word-wrap:break-word;overflow-wrap:anywhere}
  .section-heading p{font-size:12px;line-height:1.5;margin-top:3px}
  .mobile-add-device{display:inline-flex;flex:none;min-height:44px;padding:10px 12px;border:1px solid #cfdec9;border-radius:12px;background:#eef4e9;color:#345b46;font-size:13px;white-space:nowrap}
  .card{padding:17px;border-radius:18px}
  .device-grid{grid-template-columns:minmax(0,1fr);gap:12px}
  .device-grid>.empty-card{display:none}
  .device-card{padding:16px;background:#ffffffed;box-shadow:0 5px 20px #345b4605}
  .device-card .card-top{align-items:flex-start;gap:8px;margin-bottom:3px}
  .device-card .slot-number{font-size:10px;letter-spacing:.8px;line-height:1.5;padding-top:5px}
  .device-card .device-status{max-width:calc(100% - 68px);font-size:10px;line-height:1.45;padding:5px 8px;text-align:right;white-space:normal;word-wrap:break-word;overflow-wrap:anywhere}
  .device-card h3{font-size:20px;line-height:1.35}
  .device-card .device-name{display:flex;align-items:center;justify-content:flex-start;width:100%;min-height:44px;padding:7px 0;text-align:left;font-size:20px;line-height:1.35}
  .device-name-form{grid-template-columns:minmax(0,1fr) 44px 44px;gap:6px;margin:7px 0 10px}
  .device-name-input,.name-edit-action{min-height:44px}
  .name-edit-action{padding:8px;border-radius:11px}
  .device-card .facts{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;max-width:none;margin-top:9px}
  .device-card .facts>div{display:block;min-width:0;padding:10px 11px;border:1px solid #e8eee3;border-radius:12px;background:#f4f7f0}
  .device-card .facts dt{font-size:10px;line-height:1.4;color:#7b8476}
  .device-card .facts dd{margin-top:4px;text-align:left;font-size:12px;font-weight:550;line-height:1.5;word-wrap:break-word;overflow-wrap:anywhere}
  .device-card .facts [data-active-streams]{font-size:14px;line-height:1.3}
  .device-actions{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:9px;margin-top:14px}
  .device-actions button{min-height:48px;padding:11px 14px;border-radius:12px;font-size:13px}
  .device-actions [data-action="select-device"]{width:100%;border-color:#345b46;background:#345b46;color:#fff;font-size:14px}
  .device-actions [data-action="select-device"]:hover{background:#294936}
  .device-actions [data-action="delete-device"]{min-width:84px;border-color:#e9dedb;background:#fff;color:#935761;font-weight:550}
  .devices-policy{margin:0 2px;font-size:11px;line-height:1.75;color:#75806f}
  .mobile-device-empty{display:flex;flex-direction:column;align-items:flex-start;gap:10px;padding:25px 21px;border:1px dashed #c8d9c2;border-radius:18px;background:linear-gradient(135deg,#f9fbf4ed,#edf5e7c9)}
  .mobile-device-empty h3{font-size:20px;line-height:1.4}
  .mobile-device-empty p{max-width:28em;font-size:13px;line-height:1.7;color:#728069}
  .mobile-device-empty .primary{width:100%;min-height:48px;margin-top:7px;border-radius:12px;background:#345b46;font-size:14px}
  #generator-panel{display:block;order:1;padding:21px 18px;border:1px solid #d9e3d4;border-radius:18px;background:#ffffffed;scroll-margin-top:calc(84px + env(safe-area-inset-top))}
  #generator-panel>div:first-child{margin-bottom:17px}
  #generator-panel h2{font-size:20px;line-height:1.4}
  #generator-panel label{font-size:12px;margin-top:14px}
  #generator-panel .primary{width:100%;min-height:48px;margin-top:18px;border-radius:12px;font-size:14px}
  input,select,textarea{min-height:48px;font-size:16px}
  .account-card{width:100%;max-width:none;padding:21px 18px}
  .account-card h2{font-size:20px}
  .account-card .primary{width:100%;min-height:48px}
  .invite-card{gap:16px;padding:18px;margin-bottom:16px}
  .invite-card p{font-size:12px;line-height:1.7}
  .invite-form{width:100%;max-width:none;flex-direction:column;gap:10px}
  .invite-form .primary{width:100%;min-height:48px}
  .table-wrap{width:100%;max-width:100%;border-radius:14px;overflow-x:auto;overscroll-behavior-x:contain;-webkit-overflow-scrolling:touch}
  .table-wrap table{min-width:580px;font-size:12px}
  th,td{padding:13px 14px}
  td .actions{min-width:170px;gap:6px}
  .actions button{min-height:44px;padding:9px 11px}
  .pagination{gap:12px;margin-top:13px;font-size:11px}
  .pagination>.actions{gap:8px}
  .pagination .actions button{min-width:76px;min-height:44px}
  .event-list li{flex-direction:column;gap:4px;padding:12px 0;font-size:13px;line-height:1.65}
  .event-list time{min-width:0;font-size:11px}
  .detail-panel{margin-top:23px;scroll-margin-top:84px}
  .detail-panel>.section-heading{align-items:flex-start}
  .detail-panel>.section-heading h2{min-width:0;font-size:17px;word-wrap:break-word;overflow-wrap:anywhere}
  .detail-panel>.section-heading button{flex:none;min-height:44px}
  .detail-panel .device-grid{gap:12px}
  .detail-panel .device-grid>.card{min-width:0;padding:16px}
  .detail-panel .card-top{align-items:flex-start;flex-wrap:wrap;gap:8px;margin-bottom:12px}
  .detail-panel .card-top .status{white-space:normal;word-wrap:break-word;overflow-wrap:anywhere}
  .risk-card{padding:17px;margin-bottom:12px}
  .risk-card .card-top{margin-bottom:12px;gap:10px}
  .risk-card h3{font-size:17px;word-wrap:break-word;overflow-wrap:anywhere}
  .risk-card .reason{font-size:13px;line-height:1.7}
  .risk-card .facts{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .risk-card .facts>div{display:block;min-width:0;padding:9px 10px;border-radius:10px;background:#f3f6ef}
  .risk-card .facts dd{margin-top:3px;text-align:left}
  .risk-card .actions{gap:8px;margin-top:15px}
  .risk-meta{gap:5px 10px;font-size:11px}
  #risk-filter{max-width:120px;min-height:44px;font-size:16px}
  .site-footer{justify-content:center;gap:10px;margin-top:21px;font-size:10px}
  .notice{z-index:40;bottom:calc(20px + env(safe-area-inset-bottom));width:max-content;max-width:calc(100vw - 28px);padding:12px 15px;font-size:12px;line-height:1.6;word-wrap:break-word;overflow-wrap:anywhere}
  .signed-out .notice{bottom:calc(18px + env(safe-area-inset-bottom))}
  body.signed-out #app{padding:max(22px,env(safe-area-inset-top)) max(20px,env(safe-area-inset-right)) max(22px,env(safe-area-inset-bottom)) max(20px,env(safe-area-inset-left))}
  .auth-shell{max-width:380px}
  .auth-card{padding:25px 22px;border-radius:22px}
  .auth-tabs button,.auth-card .auth-bottom button{min-height:44px}
  .auth-shell>.brand{margin-bottom:25px}
}

/* Short phone windows, including landscape, keep modal controls reachable. */
@media(max-width:640px),(max-width:932px) and (max-height:500px){
  dialog{width:calc(100% - 24px);max-width:510px;max-height:calc(100vh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));max-height:calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));padding:0 18px 18px;border-radius:21px;background:#fff;overscroll-behavior:contain;scroll-padding-block:74px 86px}
  dialog.legacy-dialog[open]{max-height:calc(var(--dialog-viewport-height,100vh) - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
  dialog>.section-heading{position:sticky;top:0;z-index:3;min-height:65px;margin:0 -18px 14px;padding:12px 18px 9px;border-bottom:1px solid #edf1e8;background:#fffffff5;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);gap:10px}
  dialog .section-heading h2{min-width:0;font-size:20px;line-height:1.35;word-wrap:break-word;overflow-wrap:anywhere}
  dialog .section-heading .icon-button{width:44px;min-width:44px;min-height:44px;padding:5px;margin-right:-5px;flex:none;border-radius:12px;background:#f2f6ed;font-size:26px}
  dialog .muted{font-size:13px;line-height:1.65}
  dialog label{font-size:12px;margin-top:14px}
  dialog textarea{min-height:88px;max-height:160px;padding:11px 12px;font-size:16px;line-height:1.5;resize:vertical;overflow:auto}
  dialog .dialog-actions{position:sticky;bottom:-18px;z-index:2;display:grid;grid-template-columns:minmax(0,1.25fr) minmax(0,1fr);gap:8px;margin:16px -18px 0;padding:12px 18px 17px;border-top:1px solid #edf1e8;background:#fffffff5;-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px)}
  dialog .dialog-actions>*{min-width:0;min-height:48px;padding:11px 10px;border-radius:12px;font-size:13px}
  dialog .dialog-actions>:only-child{grid-column:1/-1}
  #copy-link{background:#294d38;font-size:15px;box-shadow:0 4px 12px #345b4624}
  #copy-link:hover{background:#203f2d}
  #download-link{background:#eef4e8;border-color:#dce7d5;color:#52694c;font-size:12px}
  .link-device-name{font-size:17px;margin-bottom:8px}
  #link-copy-status{font-size:12px;font-weight:550;line-height:1.6;color:#345b46;word-wrap:break-word;overflow-wrap:anywhere}
  #link-dialog .footnote{margin-top:13px;font-size:11px;line-height:1.75}
  #link-expiry{font-size:10px;line-height:1.6;margin-top:7px;color:#839079}
  .delete-dialog{max-width:420px}
  .delete-dialog>.section-heading{margin-bottom:14px}
  .delete-dialog .dialog-actions{grid-template-columns:repeat(2,minmax(0,1fr));margin-top:20px}
  .delete-target{font-size:18px;line-height:1.4}
  #initial-password-email{word-wrap:break-word;overflow-wrap:anywhere}
  #link-dialog[open]{display:flex;flex-direction:column;overflow:hidden;padding:0}
  #link-dialog>.section-heading{flex:none;position:static;margin:0;padding:13px 18px 10px}
  #link-dialog>.link-dialog-body{min-height:0;overflow:auto;overscroll-behavior:contain;flex:1 1 auto;padding:14px 18px 16px;scroll-padding-block:12px}
  #link-dialog>.dialog-actions{position:static;flex:none;margin:0;padding:12px 18px 16px}
  #link-dialog>#link-copy-status{flex:none;margin:0;padding:0 18px 12px;background:#fff}
  #link-dialog>#link-copy-status:empty{display:none}
}
@media(max-width:359px){
  .topbar .brand>span{display:none}
  .device-card{padding:14px}
  .device-card .device-name{font-size:19px}
  .device-card .facts>div{padding:9px 10px}
  .device-actions{gap:7px}
  .device-actions button{padding-inline:11px}
  .mobile-add-device{font-size:12px;padding-inline:10px}
  .mobile-device-empty{padding:22px 17px}
  .auth-card{padding:22px 18px}
}
@media(max-width:932px) and (max-height:500px){
  dialog{max-height:calc(100vh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));max-height:calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom));border-radius:17px}
  dialog.legacy-dialog[open]{max-height:calc(var(--dialog-viewport-height,100vh) - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom))}
  dialog>.section-heading{min-height:54px;padding-top:6px;padding-bottom:6px}
  #link-dialog>.section-heading{min-height:54px;padding-top:6px;padding-bottom:6px}
  #link-dialog>.dialog-actions{padding-top:9px;padding-bottom:10px}
  dialog .section-heading h2{font-size:18px}
  dialog textarea{min-height:70px;max-height:100px}
  dialog .dialog-actions>*{min-height:44px}
}
@media(prefers-reduced-motion:reduce){*{scroll-behavior:auto!important}}

/* Capability classes are set by the ES5 entry, never by a user-agent string.
   Grid and CSS variables are enhancements; old engines keep a readable form.
   HTML5 structural elements also need block layout in early WebKit. */
main,header,footer,nav,section,article,aside,dialog{display:block}

/* Flex gap arrived later than grid gap. Only flex containers need margins. */
html.legacy-gap .brand img{margin-right:9px}
html.legacy-gap .brand>span{margin-left:9px}
html.legacy-gap .header-actions>*+*{margin-left:10px}
html.legacy-gap .tabs>.tab+.tab{margin-left:23px}
html.legacy-gap .code-row>button{margin-left:8px}
html.legacy-gap .section-heading>*+*,html.legacy-gap .card-top>*+*{margin-left:10px}
html.legacy-gap .facts>div>dd{margin-left:12px}
html.legacy-gap .actions>button{margin-right:7px;margin-bottom:7px}
html.legacy-gap .risk-meta>*+*,html.legacy-gap .site-footer>*+*{margin-left:12px}
html.legacy-gap .event-list time{margin-right:20px}
@media(min-width:641px){
  html.legacy-gap .device-actions>*+*{margin-left:8px}
  html.legacy-gap .invite-form>*+*{margin-left:10px}
}
@media(min-width:851px){html.legacy-gap .invite-card>*+*{margin-left:30px}}
@media(max-width:850px){html.legacy-gap .invite-card>*+*{margin-top:20px}}
@media(max-width:640px){
  html.legacy-gap .header-actions>*+*{margin-left:2px}
  html.legacy-gap .tabs>.tab+.tab{margin-left:14px}
  html.legacy-gap .devices-layout>*+*{margin-top:18px}
  html.legacy-gap .facts>div>dd{margin-left:0}
  html.legacy-gap .invite-form>*+*{margin-top:10px}
  html.legacy-gap .mobile-device-empty>*+*{margin-top:10px}
  html.legacy-gap .event-list time{margin-right:0;margin-bottom:4px}
}

/* Literal colors/spacing must not depend on custom properties, hex-alpha,
   min/max/env, backdrop masks, flexbox or grid on the basic layout path. */
html.legacy-layout{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Microsoft YaHei",sans-serif;font-size:15px;line-height:1.55;color:#202a25;background:#f4f6f2}
html.legacy-layout body{color:#202a25;background:#f4f6f2}
html.legacy-layout body::before,html.legacy-layout body::after{display:none}
html.legacy-layout a{color:#345b46}
html.legacy-layout button,html.legacy-layout .button{display:inline-block;vertical-align:middle;white-space:normal;text-align:center}
html.legacy-layout input,html.legacy-layout select,html.legacy-layout textarea{color:#202a25;width:100%;max-width:100%}
html.legacy-layout input:focus,html.legacy-layout select:focus,html.legacy-layout textarea:focus{border-color:#345b46}
html.legacy-layout .primary{color:#fff;background:#202a25}
html.legacy-layout .secondary{color:#202a25;background:#edf2ec;border-color:#e0e5de}
html.legacy-layout .quiet,html.legacy-layout .icon-button{color:#6d756f}
html.legacy-layout .danger{color:#a22f3c;background:#fff2f2}
html.legacy-layout .danger-solid{color:#fff;background:#a4434e}
html.legacy-layout .muted,html.legacy-layout small,html.legacy-layout .footnote,html.legacy-layout .field-note,html.legacy-layout .identity,html.legacy-layout .device-platform,html.legacy-layout .slot-number,html.legacy-layout .location,html.legacy-layout .empty,html.legacy-layout .risk-meta,html.legacy-layout .pagination,html.legacy-layout .facts dt,html.legacy-layout th{color:#6d756f}
html.legacy-layout .form-error{color:#a22f3c}
html.legacy-layout .brand{display:inline-block;vertical-align:middle;color:#202a25}
html.legacy-layout .brand img{display:inline-block;vertical-align:middle}
html.legacy-layout .brand>span{display:inline-block;vertical-align:middle}
html.legacy-layout .signed-out #app{display:block;min-height:0;padding:28px 18px}
html.legacy-layout .auth-shell{margin:0 auto;max-width:380px}
html.legacy-layout .auth-shell>.brand{display:block;text-align:center;margin-bottom:26px}
html.legacy-layout .auth-card{background:#fff;border-color:#e1e6dd;padding:24px 20px}
html.legacy-layout .auth-tabs{display:block;font-size:0}
html.legacy-layout .auth-tabs button{display:inline-block;width:50%;font-size:13px;color:#6d756f;margin:0}
html.legacy-layout .auth-tabs button.active{color:#202a25;background:#fff}
html.legacy-layout .auth-card .auth-bottom{display:block;text-align:center}
html.legacy-layout .code-row{display:block}
html.legacy-layout .code-row input{width:100%}
html.legacy-layout .code-row button{width:100%;margin:8px 0 0}
html.legacy-layout .topbar{position:static;height:auto;min-height:65px;padding:12px 18px;border-color:#e0e5de;background:#fff}
html.legacy-layout .topbar:after{content:"";display:table;clear:both}
html.legacy-layout .header-actions{display:block;float:right;max-width:52%;text-align:right}
html.legacy-layout .header-actions .identity{display:block;max-width:100%}
html.legacy-layout main{width:100%;padding:24px 18px 40px}
html.legacy-layout .page-heading,html.legacy-layout .section-heading,html.legacy-layout .card-top{display:block}
html.legacy-layout .page-heading>*+*,html.legacy-layout .section-heading>*+*{margin:10px 0 0}
html.legacy-layout .page-heading p,html.legacy-layout .section-heading p,html.legacy-layout .generate-card p,html.legacy-layout .empty-card p,html.legacy-layout .account-card p,html.legacy-layout .invite-card p{color:#6d756f}
html.legacy-layout .tabs{display:block;white-space:nowrap;overflow-x:auto;border-color:#e0e5de}
html.legacy-layout .tabs>.tab{display:inline-block;vertical-align:top;color:#6d756f}
html.legacy-layout .tab.active{color:#202a25;border-bottom-color:#345b46}
html.legacy-layout .card{border-color:#e0e5de;border-radius:18px;background:#fff}
html.legacy-layout .devices-layout,html.legacy-layout .generate-card,html.legacy-layout .form-grid,html.legacy-layout .device-grid{display:block}
html.legacy-layout .devices-layout>*+*{margin-top:22px}
html.legacy-layout .device-grid>.card+.card{margin-top:16px}
html.legacy-layout .generate-card{padding:24px 20px}
html.legacy-layout .generate-card>div:first-child{margin-bottom:20px}
html.legacy-layout .form-grid>label+label{margin-top:14px}
html.legacy-layout .device-card .card-top .status{display:inline-block;vertical-align:top;margin:0 0 0 8px;max-width:74%}
html.legacy-layout .status{display:inline-block}
html.legacy-layout .status-dot{display:inline-block;vertical-align:middle;margin-right:6px}
html.legacy-layout .device-card .device-name{display:block;min-height:44px;width:100%;text-align:left;padding:7px 0}
html.legacy-layout .device-name-form{display:block}
html.legacy-layout .device-name-form input{display:block;width:100%}
html.legacy-layout .device-name-form .name-edit-action{display:inline-block;width:44px;min-height:44px;margin:6px 6px 0 0;background:#edf2ec;color:#345b46}
html.legacy-layout .facts{display:block}
html.legacy-layout .facts>div{display:block;margin-top:8px}
html.legacy-layout .facts dt,html.legacy-layout .facts dd{display:block;margin:0;text-align:left;word-wrap:break-word}
html.legacy-layout .facts>div>dd{margin:3px 0 0}
html.legacy-layout .device-actions{display:block}
html.legacy-layout .device-actions>*{display:block;width:100%;margin:8px 0 0;min-height:44px}
html.legacy-layout .empty-card{display:block;min-height:130px;background:transparent}
html.legacy-layout .mobile-device-empty{background:#f4f7ef}
html.legacy-layout .invite-card,html.legacy-layout .invite-form{display:block}
html.legacy-layout .invite-card>*+*,html.legacy-layout .invite-form>*+*{margin:16px 0 0}
html.legacy-layout .invite-form{max-width:none}
html.legacy-layout .invite-form button{width:100%}
html.legacy-layout .actions,html.legacy-layout .pagination,html.legacy-layout .risk-meta,html.legacy-layout .site-footer{display:block}
html.legacy-layout .event-list li{display:block;border-color:#e0e5de}
html.legacy-layout .event-list time{display:block;margin:0 0 4px}
html.legacy-layout .table-wrap{border-color:#e0e5de}
html.legacy-layout .notice{left:50%;bottom:20px;width:auto;max-width:92%;background:#202a25;-webkit-transform:translateX(-50%);transform:translateX(-50%);word-wrap:break-word}
html.legacy-layout .notice.error{background:#92343f}
html.legacy-layout .dialog-backdrop{background:#6e7d73;background:rgba(26,45,35,.44)}
html.legacy-layout dialog.legacy-dialog[open]{display:block;position:fixed;top:50%;left:50%;right:auto;bottom:auto;width:92%;max-width:510px;max-height:90%;margin:0;padding:18px;overflow:auto;border-color:#e0e5de;color:#202a25;background:#fff;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%)}
html.legacy-layout #link-dialog[open]{display:block;padding:18px;overflow:auto}
html.legacy-layout dialog>.section-heading{display:block;position:relative;top:auto;min-height:44px;margin:0 0 14px;padding:4px 45px 8px 0;background:#fff;border-bottom:1px solid #edf1e8}
html.legacy-layout dialog .section-heading .icon-button{position:absolute;right:0;top:0;margin:0;width:44px;min-width:44px;min-height:44px;background:#f2f6ed;color:#6d756f}
html.legacy-layout #link-dialog>.link-dialog-body{display:block;overflow:visible;padding:0;max-height:none}
html.legacy-layout dialog .dialog-actions{display:block;position:static;bottom:auto;margin:16px 0 0;padding:0;background:#fff;border:0}
html.legacy-layout dialog .dialog-actions>*{display:block;width:100%;min-height:48px;margin:8px 0 0}
html.legacy-layout dialog textarea{max-width:100%;min-height:88px;max-height:140px;font-size:16px}
html.legacy-layout #link-dialog>#link-copy-status{margin:9px 0 0;padding:0}
html.legacy-layout #copy-link{color:#fff;background:#294d38}
html.legacy-layout #download-link{color:#52694c;background:#eef4e8}
.device-actions{flex-wrap:wrap}
.device-actions .device-client-select{flex:1 1 100%;grid-column:1/-1;width:100%;min-height:40px;margin:0;padding:8px 10px;font-size:14px}
#download-link[aria-disabled="true"]{opacity:.5;cursor:not-allowed}
@media(max-width:640px){
  html.legacy-layout .topbar{padding:10px 14px}
  html.legacy-layout .topbar .brand>span,html.legacy-layout .header-actions .identity{display:none}
  html.legacy-layout body:not(.signed-out) main{padding:20px 14px 36px}
  html.legacy-layout .device-grid>.empty-card{display:none}
  html.legacy-layout .mobile-device-empty{display:block}
  html.legacy-layout .mobile-add-device{display:inline-block}
  html.legacy-layout .device-actions>*+*{margin-left:0}
  html.legacy-layout #generator-panel{padding:21px 18px;background:#fff}
  html.legacy-layout .device-card .facts>div{padding:9px 10px;background:#f4f7f0}
}
