:root{
  --bg:#f8f9fa; --surface:#ffffff; --surface2:#f1f3f4; --surface3:#e8eaed;
  --text:#1f1f1f; --text2:#5f6368; --faint:#80868b;
  --accent:#1a73e8; --accent-h:#1765cc; --accent-soft:#e8f0fe; --on-accent:#fff;
  --green:#188038; --green-soft:#e6f4ea; --red:#d93025; --red-soft:#fce8e6;
  --amber:#ea8600; --amber-soft:#fef7e0;
  --border:#dadce0; --border2:#ecedef;
  --shadow:0 1px 2px rgba(60,64,67,.16), 0 1px 3px 1px rgba(60,64,67,.08);
  --shadow-lg:0 4px 8px 3px rgba(60,64,67,.15), 0 1px 3px rgba(60,64,67,.3);
  --mono:'JetBrains Mono',ui-monospace,Menlo,monospace;
}
[data-theme="dark"]{
  --bg:#090a0f; --surface:#111318; --surface2:#171922; --surface3:#222634;
  --text:#f0f2f5; --text2:#949ba8; --faint:#5c6475;
  --accent:#3b82f6; --accent-h:#2563eb; --accent-soft:rgba(59,130,246,0.12); --on-accent:#ffffff;
  --green:#10b981; --green-soft:rgba(16,185,129,0.12); --red:#ef4444; --red-soft:rgba(239,68,68,0.12);
  --amber:#f59e0b; --amber-soft:rgba(245,158,11,0.12);
  --border:rgba(255,255,255,0.08); --border2:rgba(255,255,255,0.05);
  --shadow:0 1px 2px rgba(0,0,0,0.4), 0 4px 16px rgba(0,0,0,0.25);
  --shadow-lg:0 8px 30px rgba(0,0,0,0.5), 0 0 1px rgba(255,255,255,0.1);
}
* {
  box-sizing: border-box;
  margin: 0;
  -webkit-tap-highlight-color: transparent;
}
html {
  height: 100%;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-text-size-adjust: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14.5px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "DM Sans", system-ui, sans-serif;
  height: 100%;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}
#app.hidden{display:none !important}
button{font:inherit; color:inherit; background:none; border:none; cursor:pointer}
input,textarea,select{font:inherit; color:var(--text); background:var(--surface);
  border:1px solid var(--border); border-radius:10px; padding:9px 14px; outline:none; font-size:16px}
@media(min-width:769px){
  input,textarea,select{font-size:14px}
}
input:focus,textarea:focus{border-color:var(--accent); box-shadow:0 0 0 1px var(--accent)}
a{color:var(--accent); text-decoration:none}
::selection{background:var(--accent-soft)}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:var(--surface3); border-radius:8px; border:2px solid var(--bg)}
.hidden{display:none !important}

/* Media & code overflow guard */
img, svg, video, canvas, audio, iframe, embed, object { max-width: 100%; }
pre, code, kbd, samp { max-width: 100%; box-sizing: border-box; }

/* Tactile mobile touch feedback */
button:active:not(:disabled),
.btn:active:not(:disabled),
.nav-item:active,
.btn-action:active,
.chip:active,
.touch-key:active,
.theme-toggle:active,
.card.clickable:active,
.login-btn-primary:active,
.login-btn-passkey:active,
.sendbtn:active:not(:disabled) {
  transform: scale(0.96);
  transition: transform 0.08s ease;
}

/* buttons */
.btn{display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:7px 16px; border-radius:8px; font-weight:500; font-size:13.5px;
  background:var(--surface); border:1px solid var(--border); color:var(--text); white-space:nowrap;
  box-shadow:0 1px 2px rgba(0,0,0,0.04); transition:all 0.15s ease}
.btn:hover{background:var(--surface2); border-color:var(--border2)}
.btn.primary{background:var(--accent); border-color:transparent; color:var(--on-accent); box-shadow:0 1px 3px rgba(0,0,0,0.12)}
.btn.primary:hover{background:var(--accent-h)}
.btn.danger{color:var(--red); border-color:transparent; background:var(--red-soft)}
.btn.danger:hover{filter:brightness(.95)}
.btn.sm{padding:5px 12px; font-size:12.5px; border-radius:6px}
.btn.icon{padding:8px; border-radius:8px; width:36px; height:36px}
.btn:disabled{opacity:.5; cursor:default}
.btn svg{width:15px;height:15px;flex:none}

/* ================= auth ================= */
#login{display:flex; align-items:center; justify-content:center; min-height:100dvh; height:100%; padding:20px 16px;
  position:fixed; inset:0; z-index:9999; background:var(--bg); overflow-y:auto}
#login.hidden{display:none !important}

.login-card{width:min(360px,100%); background:var(--surface); border:1px solid var(--border);
  border-radius:16px; padding:32px 28px; display:flex; flex-direction:column; gap:20px;
  box-shadow:0 1px 3px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.04); position:relative}

.login-header{display:flex; flex-direction:column; align-items:flex-start; text-align:left; gap:10px}
.login-header .brand-row{display:flex; align-items:center; gap:12px}
.login-header .brand-row img{width:42px; height:42px; border-radius:10px}
.login-header h1{font-size:20px; font-weight:700; color:var(--text); letter-spacing:-0.3px; margin:0}
.login-header p.login-sub{font-size:13px; color:var(--text2); line-height:1.4; margin:0}

.login-inputs{display:flex; flex-direction:column; gap:12px}
.login-inputs label.field-label{font-size:12px; font-weight:600; color:var(--text2); text-transform:uppercase; letter-spacing:0.4px}
.login-inputs input[type="password"]{width:100%; height:42px; border-radius:8px; font-size:14px;
  background:var(--surface2); border:1px solid var(--border); padding:0 12px; font-family:var(--mono); transition:border-color 0.15s ease}
.login-inputs input[type="password"]:focus{background:var(--surface); border-color:var(--text); box-shadow:none}

.login-card .remember{display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--text2); cursor:pointer; user-select:none; margin-top:2px}
.login-card .remember input{width:15px; height:15px; border-radius:4px; accent-color:var(--text); cursor:pointer}

.login-actions{display:flex; flex-direction:column; gap:8px; margin-top:4px}
.login-btn-primary{height:42px; border-radius:8px; font-size:13.5px; font-weight:600;
  background:var(--text); color:var(--bg); border:none; display:flex; align-items:center; justify-content:center;
  cursor:pointer; transition:opacity 0.15s ease}
.login-btn-primary:hover{opacity:0.9}
.login-btn-primary:active{opacity:0.8}

.login-btn-passkey{height:38px; border-radius:8px; font-size:12.5px; font-weight:500;
  background:transparent; border:1px solid var(--border); color:var(--text); display:flex; align-items:center;
  justify-content:center; gap:6px; cursor:pointer}
.login-btn-passkey:hover{background:var(--surface2)}

.login-footer{display:flex; justify-content:space-between; align-items:center; border-top:1px solid var(--border2);
  padding-top:14px; margin-top:2px; font-size:11px; color:var(--faint); font-family:var(--mono)}

/* ================= shell ================= */
#burger-app{display:none}
header{display:flex; align-items:center; gap:14px; padding:0 16px;
  padding-top:calc(env(safe-area-inset-top) + 8px); height:calc(50px + env(safe-area-inset-top) + 8px);
  border-bottom:1px solid var(--border2); background:rgba(255,255,255,0.85);
  backdrop-filter:saturate(180%) blur(20px); -webkit-backdrop-filter:saturate(180%) blur(20px);
  flex:none; position:sticky; top:0; z-index:10}
[data-theme="dark"] header{background:rgba(19,19,20,0.8); border-bottom-color:rgba(255,255,255,0.08)}
.brand{font-weight:600; color:var(--text); font-size:16px; letter-spacing:-.2px;
  display:flex; align-items:center; gap:10px}
.brand .logo{width:28px;height:28px;border-radius:8px;background:var(--accent-soft);
  display:flex;align-items:center;justify-content:center;color:var(--accent);font-size:13px;font-weight:700}
header nav, .header-nav{display:flex; align-items:center; gap:4px; height:100%; overflow-x:auto; scrollbar-width:none}
header nav::-webkit-scrollbar, .header-nav::-webkit-scrollbar{display:none}
header nav button, header nav a.nav-item, .header-nav a.nav-item{padding:6px 14px; color:var(--text2); font-weight:500; font-size:13.5px;
  border-radius:12px; white-space:nowrap; text-decoration:none; display:inline-flex; align-items:center; transition:all 0.15s ease}
header nav button:hover, header nav a.nav-item:hover, .header-nav a.nav-item:hover{color:var(--text); background:var(--surface2)}
header nav button.on, header nav a.nav-item.on, .header-nav a.nav-item.on{color:var(--accent); background:var(--accent-soft); font-weight:600}
header .spacer{flex:1}
#hostlabel{font-size:12px; color:var(--faint); font-family:var(--mono)}
.theme-toggle{width:36px;height:36px;border-radius:50%;display:flex;align-items:center;justify-content:center;color:var(--text2)}
.theme-toggle:hover{background:var(--surface2)}
main{flex:1; overflow-y:auto; overflow-x:hidden; display:flex; flex-direction:column}
.wrap{max-width:1120px; margin:0 auto; padding:24px 20px calc(env(safe-area-inset-bottom) + 80px); width:100%; box-sizing:border-box}

/* Apple HIG Card Polish */
.card, .panel, .login-card, .modal, .tbl-card, .host-hero{
  border-radius:20px !important;
  backdrop-filter:saturate(180%) blur(16px);
  -webkit-backdrop-filter:saturate(180%) blur(16px);
}
[data-theme="dark"] .card, [data-theme="dark"] .panel, [data-theme="dark"] .tbl-card, [data-theme="dark"] .host-hero{
  border:1px solid rgba(255,255,255,0.08) !important;
}
.card, .panel, .tbl-card, .host-hero{
  border:1px solid rgba(0,0,0,0.06);
}

.drive-storage-pill{display:inline-flex; align-items:center; gap:8px; padding:4px 10px; background:var(--surface2); border:1px solid var(--border2); border-radius:9999px; font-size:11.5px; color:var(--text2); margin-left:auto; flex-shrink:0}
.dst-pill-bar{width:48px; height:4px; background:var(--surface3); border-radius:2px; overflow:hidden; display:inline-block}
.dst-pill-bar i{display:block; height:100%; background:var(--accent); border-radius:2px}
.dst-pill-text{font-family:var(--mono); font-weight:500; font-size:11px; white-space:nowrap}
@media(max-width:600px){
  .drive-storage-pill{order:4; margin-left:0; font-size:10.5px; padding:3px 8px}
  .dst-pill-bar{width:36px}
}
.card.clickable:hover{border-color:var(--accent); transform:translateY(-2px)}
.card.clickable:active{transform:translateY(0)}

/* cards & tables */
.grid{display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:16px; margin-bottom:24px}
.card{background:var(--surface); border:1px solid var(--border2);
  border-radius:18px; padding:18px 20px; box-shadow:var(--shadow); transition:transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease}
.card:hover{box-shadow:var(--shadow-lg); border-color:var(--border)}
.card .k{font-size:11.5px; color:var(--text2); font-weight:600; text-transform:uppercase; letter-spacing:0.6px}
.card .v{font-size:24px; font-weight:700; color:var(--text); letter-spacing:-.4px; margin-top:4px}
.card .s{font-size:12px; color:var(--faint); margin-top:4px; font-family:var(--mono)}
.bar{height:5px; background:var(--surface3); border-radius:9999px; margin-top:12px; overflow:hidden}
.bar i{display:block; height:100%; background:var(--accent); border-radius:9999px; transition:width .4s}
h2{font-size:14.5px; font-weight:600; color:var(--text); margin:26px 0 12px; letter-spacing:-0.2px; text-transform:uppercase; font-size:12px; color:var(--text2); letter-spacing:0.6px}

/* host hero - clean technical spec container */
.host-hero{background:var(--surface); border:1px solid var(--border2); border-radius:18px;
  padding:18px 22px; display:flex; gap:16px; justify-content:space-between; align-items:flex-start;
  flex-wrap:wrap; box-shadow:var(--shadow); margin-bottom:20px; position:relative;
  backdrop-filter:saturate(180%) blur(16px); -webkit-backdrop-filter:saturate(180%) blur(16px)}
.hh-title{display:flex; align-items:center; gap:10px; flex-wrap:wrap}
.hh-badge{font-size:10px; font-weight:700; letter-spacing:0.8px; color:var(--accent);
  background:var(--accent-soft); padding:3px 9px; border-radius:9999px; border:1px solid rgba(59,130,246,0.3)}
.hh-shape{font-family:var(--mono); font-size:13.5px; font-weight:600; color:var(--text)}
.hh-specs{margin-top:12px; width:100%}
.hh-accordion{background:var(--surface2); border:1px solid var(--border2); border-radius:10px; overflow:hidden}
.hh-summary{display:flex; align-items:center; justify-content:space-between; padding:8px 12px; font-size:12px; cursor:pointer; user-select:none; list-style:none}
.hh-summary::-webkit-details-marker{display:none}
.hh-summary::after{content:'▾'; font-size:11px; color:var(--text2); transition:transform 0.2s}
.hh-accordion[open] .hh-summary::after{transform:rotate(180deg)}
.hh-sum-main{font-weight:600; color:var(--text); font-family:var(--mono); font-size:11.5px}
.hh-sum-sub{color:var(--text2); font-size:11px; font-family:var(--mono)}
.hh-details-grid{display:grid; grid-template-columns:repeat(auto-fit, minmax(160px, 1fr)); gap:8px; padding:10px 12px; border-top:1px solid var(--border2)}
.hh-detail-cell{display:flex; flex-direction:column}
.hh-detail-k{font-size:9.5px; font-weight:600; color:var(--text2); text-transform:uppercase; letter-spacing:0.5px}
.hh-detail-v{font-size:11.5px; font-family:var(--mono); font-weight:500; color:var(--text); margin-top:2px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.hh-right{text-align:right}
.hh-region{font-size:13px; color:var(--text); font-weight:600}
.hh-ip{font-family:var(--mono); font-size:11.5px; color:var(--faint); margin-top:2px}
.duo{display:grid; grid-template-columns:1fr 1fr; gap:16px; align-items:start; margin-bottom:24px}
@media(max-width:860px){
  .host-hero{flex-direction:column; align-items:stretch; padding:14px; gap:10px; overflow:hidden}
  .hh-left{width:100%}
  .hh-right{text-align:left; margin-top:4px; padding-top:8px; border-top:1px solid var(--border2); display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:6px}
  .hh-specs{margin-top:8px; width:100%}
  .hh-summary{padding:8px 10px; gap:6px}
  .hh-sum-main{white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex:1; min-width:0}
  .hh-sum-sub{white-space:nowrap; overflow:hidden; text-overflow:ellipsis; flex-shrink:0}
  .hh-details-grid{grid-template-columns:1fr; gap:6px; padding:10px}
  .grid{grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; margin-bottom:20px}
  .card{padding:12px 14px; min-width:0; overflow:hidden; border-radius:14px}
  .card .v{font-size:18px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
  .card .s{white-space:nowrap; overflow:hidden; text-overflow:ellipsis; font-size:11px}
  .duo{grid-template-columns:1fr; gap:16px; min-width:0; margin-bottom:20px}
}
.tbl-mini td{padding:6px 12px; font-size:12px}
.tbl-card{background:var(--surface); border:1px solid var(--border2); border-radius:16px; overflow:auto; box-shadow:var(--shadow)}
table{width:100%; border-collapse:collapse; font-size:13px}
th{color:var(--faint); font-weight:600; text-align:left; padding:10px 14px; font-size:11px;
  border-bottom:1px solid var(--border2); text-transform:uppercase; letter-spacing:.6px; background:var(--surface2)}
td{padding:10px 14px; border-bottom:1px solid var(--border2); color:var(--text); transition:background 0.15s}
tr:last-child td{border-bottom:none}
tr:hover td{background:var(--surface2)}
.pill{display:inline-block; padding:2px 10px; border-radius:9999px; font-size:11.5px; font-weight:500}
.pill.ok{color:var(--green); background:var(--green-soft)}
.pill.warn{color:var(--amber); background:var(--amber-soft)}
.pill.off{color:var(--red); background:var(--red-soft)}

/* ================= drive ================= */
#view-drive{display:flex; flex-direction:column; height:calc(100dvh - 58px); min-height:0}
.drive-bar{display:flex; align-items:center; gap:10px; padding:12px 20px;
  border-bottom:1px solid var(--border2); background:var(--surface); flex:none; flex-wrap:wrap}
.crumbs{flex:1; font-size:13px; color:var(--text2); min-width:160px;
  overflow-x:auto; white-space:nowrap; scrollbar-width:none; display:flex; align-items:center; gap:4px}
.crumbs::-webkit-scrollbar{display:none}
.crumbs b{color:var(--text); font-weight:500; cursor:pointer; padding:4px 8px; border-radius:6px; transition:background 0.15s; font-size:13px}
.crumbs b:hover{background:var(--surface2)}
.crumbs b:last-child{color:var(--accent); font-weight:600}
.drive-main{flex:1; display:flex; min-height:0; background:var(--bg)}
#filelist{flex:1; overflow:auto; padding:12px 18px; min-width:0}
.row{display:flex; align-items:center; gap:14px; padding:10px 14px; border-radius:10px;
  cursor:pointer; font-size:13.5px; transition:all 0.15s ease}
.row:hover{background:var(--surface2)}
.row .ic{width:24px; height:24px; display:flex; align-items:center; justify-content:center; flex:none; font-size:16px}
.row .nm{flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--text); font-weight:500}
.row .sz{width:90px; text-align:right; color:var(--faint); font-size:12px; font-family:var(--mono); flex:none}
.row .mt{width:160px; text-align:right; color:var(--faint); font-size:12px; font-family:var(--mono); flex:none; display:none}
@media(min-width:900px){ .row .mt{display:block} }
.row .act{visibility:hidden; width:70px; justify-content:flex-end; flex:none; display:flex; gap:4px}
.row:hover .act{visibility:visible}
.row .act button{width:28px;height:28px;border-radius:6px;color:var(--text2);display:flex;align-items:center;justify-content:center;transition:background 0.15s}
.row .act button:hover{background:var(--surface3)}
.row .act button.danger:hover{color:var(--red);background:var(--red-soft)}
.row svg{width:15px;height:15px}
#preview{width:46%; border-left:1px solid var(--border2); display:flex; flex-direction:column; min-width:0; background:var(--surface); box-shadow:-2px 0 10px rgba(0,0,0,0.03)}
#preview .pv-head{padding:14px 20px; border-bottom:1px solid var(--border2); display:flex;
  align-items:center; gap:10px; font-size:13.5px; color:var(--text); font-weight:600}
#preview pre{flex:1; overflow:auto; padding:18px 20px; font:400 12.5px/1.65 var(--mono);
  white-space:pre-wrap; word-break:break-word; color:var(--text)}
.empty{padding:90px 20px; text-align:center; color:var(--faint)}
.empty .big{font-size:48px; margin-bottom:14px; opacity:.7}

/* ================= chat (Gemini-style) ================= */
#view-chat{display:flex; height:calc(100dvh - 58px); min-height:0; background:var(--bg)}
.chat-side{width:280px; flex:none; background:var(--surface); border-right:1px solid var(--border2);
  display:flex; flex-direction:column; transition:margin-left .25s ease}
.chat-side.closed{margin-left:-280px}
.cs-head{padding:14px 14px 8px}
.newchat{display:flex; align-items:center; gap:10px; width:100%; padding:11px 16px;
  border-radius:100px; background:var(--accent-soft); color:var(--accent); font-weight:500; font-size:14px}
.newchat:hover{filter:brightness(.97)}
.cs-list{flex:1; overflow:auto; padding:10px 8px}
.cs-group{font-size:11px; color:var(--faint); font-weight:500; text-transform:uppercase;
  letter-spacing:.5px; padding:10px 10px 6px}
.sess{display:flex; align-items:center; gap:8px; width:100%; text-align:left;
  padding:9px 10px 9px 12px; border-radius:12px; font-size:13.5px; color:var(--text2); position:relative}
.sess:hover{background:var(--surface2)}
.sess.on{background:var(--accent-soft); color:var(--text)}
.sess .t{flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.sess .pin-ic{color:var(--accent); flex:none; width:13px; height:13px}
.sess .acts{display:none; position:absolute; right:6px; background:var(--surface2); border-radius:8px; padding:2px}
.sess:hover .acts{display:flex}
.sess .acts button{width:26px;height:26px;border-radius:6px;color:var(--text2);display:flex;align-items:center;justify-content:center}
.sess .acts button:hover{background:var(--surface3)}
.sess .acts button.del:hover{color:var(--red)}
.sess .acts svg{width:14px;height:14px}
.chat-main{flex:1; display:flex; flex-direction:column; min-width:0}
.chat-top{display:flex; align-items:center; gap:10px; padding:10px 16px; flex:none}
#burger{display:none}
.chip{display:inline-flex; align-items:center; gap:6px; padding:6px 14px; border-radius:100px;
  border:1px solid var(--border); background:var(--surface); font-size:13px; font-weight:500; color:var(--text2)}
.chip:hover{background:var(--surface2)}
.chip b{color:var(--text); font-weight:500}
.chip svg{width:14px;height:14px}
.chip.active{border-color:var(--accent); color:var(--accent); background:var(--accent-soft)}
#chatlog{flex:1; overflow:auto; padding:10px 16px 20px}
.chatcol{max-width:780px; margin:0 auto; display:flex; flex-direction:column; gap:22px}
.msg{display:flex; gap:14px; align-items:flex-start}
.msg .av{width:30px; height:30px; border-radius:50%; flex:none; display:flex; align-items:center;
  justify-content:center; font-size:12px; font-weight:600; margin-top:2px}
.msg.me .av{background:var(--surface3); color:var(--text)}
.msg.bot .av{background:var(--accent-soft); color:var(--accent)}
.msg .body{flex:1; min-width:0}
.msg .who{font-size:12px; color:var(--text2); font-weight:500; margin-bottom:4px}
.msg .bubble{font-size:14.5px; white-space:pre-wrap; word-break:break-word; color:var(--text)}
.msg .bubble.err{color:var(--red)}
.msg.me .bubble{background:var(--surface2); padding:10px 16px; border-radius:16px; display:inline-block}
.msg .meta{font-size:11.5px; color:var(--faint); font-family:var(--mono); margin-top:8px}
.thinking{display:inline-flex; gap:5px; padding:6px 0}
.thinking i{width:7px; height:7px; border-radius:50%; background:var(--accent); opacity:.4;
  animation:th 1.2s infinite}
.thinking i:nth-child(2){animation-delay:.2s}
.thinking i:nth-child(3){animation-delay:.4s}
@keyframes th{0%,100%{opacity:.25; transform:translateY(0)} 50%{opacity:1; transform:translateY(-3px)}}
.welcome{max-width:640px; margin:8vh auto 0; text-align:center; padding:0 20px}
.welcome h1{font-size:30px; font-weight:600; color:var(--text); letter-spacing:-.6px; margin-bottom:10px}
.welcome h1 span{color:var(--accent)}
.welcome p{color:var(--text2); font-size:14.5px; margin-bottom:26px}
.sugg{display:flex; flex-wrap:wrap; gap:10px; justify-content:center}
.sugg button{padding:10px 18px; border-radius:100px; border:1px solid var(--border);
  background:var(--surface); font-size:13.5px; color:var(--text); text-align:left}
.sugg button:hover{background:var(--surface2); border-color:var(--accent)}
.chat-input{flex:none; padding:8px 16px calc(14px + env(safe-area-inset-bottom))}
.inputpill{max-width:780px; margin:0 auto; display:flex; align-items:flex-end; gap:8px;
  background:var(--surface); border:1px solid var(--border); border-radius:26px;
  padding:8px 8px 8px 20px; box-shadow:var(--shadow)}
.inputpill:focus-within{border-color:var(--accent)}
.inputpill textarea{flex:1; border:none; background:none; padding:8px 0; resize:none;
  height:24px; max-height:150px; border-radius:0}
.inputpill textarea:focus{box-shadow:none}
.sendbtn{width:38px; height:38px; border-radius:50%; background:var(--accent); color:var(--on-accent);
  display:flex; align-items:center; justify-content:center; flex:none}
.sendbtn:disabled{opacity:.4}
.sendbtn svg{width:18px;height:18px}
.side-backdrop{display:none}

/* ================= terminal mature cloud-pc polish ================= */
#view-term pre#term-out{
  background:#050608 !important; border:1px solid rgba(255,255,255,0.08) !important;
  border-radius:18px !important; box-shadow:inset 0 2px 10px rgba(0,0,0,0.6);
  color:#4ade80 !important; font-family:var(--mono); line-height:1.65;
}
#term-presets .chip{
  background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08);
  border-radius:10px; font-size:12px; font-family:var(--mono); padding:6px 12px;
  color:var(--text2); transition:all 0.15s ease;
}
#term-presets .chip:hover{background:rgba(255,255,255,0.08); color:var(--text); border-color:var(--accent)}
#term-presets .chip:active{transform:scale(0.96)}

#term-touch-bar .touch-key{
  background:rgba(255,255,255,0.05); border:1px solid rgba(255,255,255,0.08);
  border-radius:10px; padding:7px 13px; font-size:11.5px; font-weight:600;
  color:var(--text2); transition:all 0.12s ease;
}
#term-touch-bar .touch-key:active{
  background:var(--accent); color:#ffffff; transform:scale(0.94);
}

/* ================= system mature service cards polish ================= */
.sys-actions .btn{
  border-radius:12px; padding:10px 18px; font-weight:600; font-size:13px;
  background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08);
}
.sys-actions .btn:hover{background:rgba(255,255,255,0.08); border-color:var(--accent)}
.sys-actions .btn.danger{background:rgba(239,68,68,0.12); border-color:rgba(239,68,68,0.3); color:#fca5a5}
.sys-actions .btn.danger:hover{background:rgba(239,68,68,0.22); color:#ffffff}

/* ================= arkib notes view ================= */
.arkib-tag{
  font-size:10px; font-weight:600; font-family:var(--mono);
  padding:2px 8px; border-radius:6px; background:rgba(255,255,255,0.06);
  color:var(--text2); border:1px solid rgba(255,255,255,0.08);
}

/* ================= system ================= */
.sys-actions{display:flex; gap:12px; flex-wrap:wrap; margin-top:16px}
.confirm-box{margin-top:16px; padding:20px; border-radius:14px; background:var(--red-soft);
  display:none; max-width:560px; border:1px solid var(--red)}
.confirm-box.show{display:block}
.confirm-box p{font-size:13.5px; color:var(--text); margin-bottom:14px; font-weight:500}

/* ================= settings modal ================= */
.modal-bg{position:fixed; inset:0; background:rgba(0,0,0,.45); display:none;
  align-items:center; justify-content:center; z-index:60; padding:16px}
.modal-bg.show{display:flex}
.modal{background:var(--surface); border-radius:24px; width:min(680px,100%);
  max-height:86dvh; display:flex; flex-direction:column; box-shadow:var(--shadow-lg)}
.modal-head{display:flex; align-items:center; gap:12px; padding:20px 24px 14px}
.modal-head h3{font-size:18px; font-weight:600; flex:1}
.modal-body{overflow:auto; padding:0 24px 24px}
.tabs{display:flex; gap:6px; padding:0 24px 14px; border-bottom:1px solid var(--border2); flex-wrap:wrap}
.tabs button{padding:7px 14px; border-radius:100px; font-size:13px; font-weight:500; color:var(--text2)}
.tabs button.on{background:var(--accent-soft); color:var(--accent)}
.field{margin:14px 0}
.field label{display:block; font-size:12.5px; color:var(--text2); font-weight:500; margin-bottom:6px}
.field input,.field select{width:100%}
.frow{display:flex; gap:10px; flex-wrap:wrap}
.frow .field{flex:1; min-width:150px}
.prov-card{border:1px solid var(--border2); border-radius:14px; padding:14px 16px; margin:10px 0;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap}
.prov-card .pn{font-weight:600; color:var(--text)}
.prov-card .pu{font-size:12px; color:var(--faint); font-family:var(--mono); word-break:break-all; flex:1; min-width:180px}
.kv{display:flex; align-items:center; gap:10px; padding:9px 4px; border-bottom:1px solid var(--border2); font-size:13.5px}
.kv-key{font-family:var(--mono); font-size:12.5px; color:var(--text); flex:1; word-break:break-all}
.kv-badge{font-size:11px; padding:2px 9px; border-radius:9999px}
.kv-badge.set{color:var(--green); background:var(--green-soft)}
.kv-badge.empty{color:var(--faint); background:var(--surface2)}
/* remember checkbox */
.remember{display:flex; align-items:center; gap:8px; font-size:12.5px; color:var(--text2);
  cursor:pointer; user-select:none}
.remember input{width:16px; height:16px; accent-color:var(--accent); padding:0}

#toast{position:fixed; bottom:calc(22px + env(safe-area-inset-bottom)); left:50%; transform:translateX(-50%) translateY(90px);
  background:var(--text); color:var(--bg); padding:11px 22px; border-radius:100px;
  font-size:13.5px; opacity:0; transition:all .25s; z-index:9999; max-width:88vw; text-align:center;
  box-shadow:var(--shadow-lg); backdrop-filter:blur(16px); -webkit-backdrop-filter:blur(16px);
  pointer-events:none; word-break:break-word}
#toast.show{transform:translateX(-50%) translateY(0); opacity:1; pointer-events:auto}
#toast.toast-error{background:rgba(220,38,38,0.95); color:#ffffff; border:1px solid rgba(255,255,255,0.25)}
#toast.toast-success{background:rgba(16,185,129,0.95); color:#ffffff; border:1px solid rgba(255,255,255,0.25)}
#toast.toast-info{background:var(--text); color:var(--bg)}

/* FAB mini-chat */
#fab{position:fixed; right:18px; bottom:calc(18px + env(safe-area-inset-bottom)); width:54px; height:54px;
  border-radius:50%; background:var(--accent); color:var(--on-accent); box-shadow:var(--shadow-lg);
  display:flex; align-items:center; justify-content:center; z-index:70; transition:transform .15s}
#fab:active{transform:scale(.92)}
#fabSheet{position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:75; display:flex;
  align-items:flex-end; justify-content:center}
.fab-card{background:var(--bg); width:min(560px,100%); height:72dvh; border-radius:24px 24px 0 0;
  display:flex; flex-direction:column; padding:16px 18px calc(16px + env(safe-area-inset-bottom));
  box-shadow:var(--shadow-lg)}
.fab-head{display:flex; align-items:center; gap:8px; padding-bottom:10px}
#fab-log .msg{max-width:100%}

@media(max-width:768px){
  /* Float FAB well above mobile bottom dock to eliminate overlap */
  #fab{bottom:calc(env(safe-area-inset-bottom) + 82px) !important; right:16px !important; width:48px !important; height:48px !important;}
}

/* ================= Apple HIG Sticky Bottom Pill Dock ================= */
.mobile-dock {
  display: none;
}

/* ================= mobile ================= */
@media(max-width:768px){
  #nav-backdrop{display:none !important}
  #burger-app{display:none !important}
  header nav, header .header-nav{display:none !important}

  /* Apple HIG Sticky Bottom Pill Dock */
  .mobile-dock {
    display: flex;
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom) + 12px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 70;
    align-items: center;
    gap: 3px;
    padding: 5px 8px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 9999px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.04);
    max-width: calc(100vw - 20px);
    width: auto;
    touch-action: manipulation;
    -webkit-user-select: none;
    user-select: none;
    transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1), transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  }

  [data-theme="dark"] .mobile-dock {
    background: rgba(18, 20, 26, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.6), 0 2px 10px rgba(0, 0, 0, 0.35);
  }

  .dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 10px;
    min-width: 46px;
    min-height: 44px;
    border-radius: 9999px;
    color: var(--text2);
    text-decoration: none;
    font-size: 10px;
    font-weight: 500;
    letter-spacing: -0.1px;
    transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-tap-highlight-color: transparent;
  }

  .dock-item svg {
    width: 18px;
    height: 18px;
    transition: transform 0.15s ease;
  }

  .dock-item:active {
    transform: scale(0.92);
  }

  .dock-item.on {
    color: var(--accent);
    background: var(--accent-soft);
    font-weight: 600;
  }

  .dock-item.on svg {
    transform: translateY(-1px);
  }

  /* Auto-hide dock when typing on virtual keyboard */
  #app:has(input:focus, textarea:focus) .mobile-dock {
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 16px);
  }

  header{padding:0 12px; padding-top:calc(env(safe-area-inset-top) + 6px); height:calc(52px + env(safe-area-inset-top)); gap:8px; z-index:40}
  header .btn.sm{padding:4px 8px; font-size:12px}
  #hostlabel{display:none}
  .wrap{padding:16px 14px calc(env(safe-area-inset-bottom) + 84px) !important}
  .chat-side{position:fixed; z-index:40; top:calc(52px + env(safe-area-inset-top)); bottom:0; left:0; box-shadow:var(--shadow-lg)}
  .chat-side.closed{margin-left:-280px}
  .side-backdrop{display:none; position:fixed; inset:calc(52px + env(safe-area-inset-top)) 0 0 0; background:rgba(0,0,0,.4); z-index:35}
  .side-backdrop.show{display:block}
  #burger{display:flex}
  #preview{position:fixed; inset:calc(52px + env(safe-area-inset-top)) 0 0 0; width:100%; z-index:45}
  .login-card{padding:24px 20px; border-radius:20px}
  .drive-bar{padding:10px 14px; gap:8px}
  .drive-bar .btn.sm{padding:4px 8px; font-size:12px}
  .crumbs{font-size:12.5px; width:100%; order:3}
  #filelist{padding:8px 10px 90px}
  .row{padding:9px 10px; gap:10px; font-size:13px}
  .row .sz{width:70px}
  .row .act{width:60px}
  .host-hero{flex-direction:column; align-items:stretch; padding:16px 14px; gap:12px; overflow:hidden}
  .hh-specs{margin-top:10px}
  .hh-details-grid{grid-template-columns:1fr; gap:6px}
  .tbl-card{overflow-x:auto; -webkit-overflow-scrolling:touch}
  .tbl-card table{width:100%; min-width:0; table-layout:fixed}
  .tbl-card th, .tbl-card td{padding:8px 10px; font-size:12px; word-break:break-word}
  .sys-actions button{width:100%}
  .chat-input{padding:8px 12px calc(env(safe-area-inset-bottom) + 72px) !important}
  .inputpill{padding:6px 6px 6px 14px}
  #preview .pv-head{padding:10px 14px; gap:6px; flex-wrap:wrap}
  #preview .pv-head .btn{padding:4px 8px; font-size:11.5px}
  .chip{padding:4px 10px; font-size:12px}
  .welcome h1{font-size:22px}
  .msg{gap:10px}
}
