 :root {
  --bg:#1f1f1f; --bg2:#131314; --surface:#282a2c; --surface2:#303134; --surface3:#3c4043;
  --text:#e3e3e3; --muted:#c4c7c5; --dim:#8e918f; --line:#444746; --accent:#a8c7fa; --accent-bg:#394457;
  --ok:#81c995; --warn:#fdd663; --danger:#f28b82; --blue:#8ab4f8;
  --radius:16px; --radius-sm:10px;
  font-family: "Google Sans", Roboto, Inter, system-ui, -apple-system, sans-serif;
}
body[data-theme="light"]{
  --bg:#fff; --bg2:#f8fafd; --surface:#fff; --surface2:#f1f3f4; --surface3:#e9eef6;
  --text:#1f1f1f; --muted:#444746; --dim:#5f6368; --line:#dadce0; --accent:#0b57d0; --accent-bg:#d3e3fd;
  --ok:#146c2e; --warn:#b06000; --danger:#b3261e; --blue:#0b57d0;
}
*{box-sizing:border-box} html,body{margin:0;background:var(--bg);color:var(--text)}
body{min-height:100vh} a{color:var(--accent);text-decoration:none} a:hover{text-decoration:underline}
[hidden]{display:none !important}
.topbar{position:sticky;top:0;z-index:50;display:flex;align-items:center;gap:16px;padding:12px 24px;background:var(--bg);min-height:64px}
.brand{font-size:22px;font-weight:500;color:var(--text);white-space:nowrap;display:flex;align-items:center;gap:8px;text-decoration:none}
.brand:hover{text-decoration:none;color:var(--text)}
.brand-dot{width:10px;height:10px;border-radius:50%;background:#f6821f;display:inline-block}
.searchbar{flex:1;max-width:720px;margin:0 auto;display:flex;align-items:center;gap:12px;background:var(--surface);border:1px solid transparent;border-radius:24px;padding:10px 16px;color:var(--muted)}
.searchbar:focus-within{background:var(--surface2);border-color:var(--line)}
.searchbar input{flex:1;background:transparent;border:0;outline:0;color:var(--text);font:inherit;font-size:16px}
.searchbar input::placeholder{color:var(--dim)}
.topbar-actions{display:flex;align-items:center;gap:4px;margin-left:auto}
.icon-btn{width:40px;height:40px;border-radius:50%;border:0;background:transparent;color:var(--muted);display:grid;place-items:center;cursor:pointer;font-size:20px}
.icon-btn:hover{background:rgba(255,255,255,.08)}
body[data-theme="light"] .icon-btn:hover{background:rgba(0,0,0,.06)}
.apps-grid{display:grid;grid-template-columns:repeat(3,4px);gap:2px}.apps-grid i{width:4px;height:4px;border-radius:50%;background:currentColor}
.user-badge{display:flex;align-items:center;gap:8px;border:0;background:transparent;padding:4px;cursor:pointer;border-radius:999px;color:var(--text)}
.user-badge:hover{background:rgba(255,255,255,.08)}
.avatar{width:32px;height:32px;border-radius:50%;background:#5f6368;color:#fff;display:grid;place-items:center;font-weight:500;font-size:14px;flex:0 0 32px;overflow:hidden}
.avatar-lg{width:96px;height:96px;font-size:40px;position:relative}
.avatar img{width:100%;height:100%;object-fit:cover}
.pencil{position:absolute;right:0;bottom:0;width:28px;height:28px;border-radius:50%;background:var(--surface2);border:2px solid var(--bg);display:grid;place-items:center;font-size:12px;color:var(--text)}
.account-menu{position:absolute;right:0;top:52px;width:300px;background:var(--surface2);border:1px solid var(--line);border-radius:20px;box-shadow:0 8px 24px rgba(0,0,0,.35);padding:16px;z-index:60}
.account-menu-head{margin-bottom:12px}.account-menu-head strong{display:block;font-size:14px}.event-meta{font-size:12px;color:var(--muted);line-height:1.4}
.layout{display:grid;grid-template-columns:280px minmax(0,1fr);max-width:1600px;margin:0 auto}
.sidebar{padding:8px 12px 24px;position:sticky;top:64px;align-self:start;max-height:calc(100vh - 64px);overflow:auto}
.nav-item{display:flex;align-items:center;gap:16px;padding:10px 16px 10px 20px;border-radius:0 24px 24px 0;color:var(--text);font-size:14px;font-weight:500;margin:0 0 2px -12px;text-decoration:none}
.nav-item:hover{background:rgba(255,255,255,.06);text-decoration:none}
.nav-item.active{background:var(--accent-bg);color:var(--accent)}
.nav-ic{width:24px;height:24px;border-radius:50%;display:grid;place-items:center;font-size:12px;flex:0 0 24px;color:#fff}
.c-blue{background:#4285f4}.c-green{background:#34a853}.c-yellow{background:#fbbc04;color:#202124}.c-red{background:#ea4335}.c-teal{background:#24a3b5}.c-purple{background:#a142f4}.c-orange{background:#fa7b17}.c-grey{background:#5f6368}.c-indigo{background:#5c6bc0}
.sidebar-footer{padding:24px 8px;color:var(--dim);font-size:12px;display:flex;flex-wrap:wrap;gap:8px 16px}
.sidebar-footer a{color:var(--dim)}
.content{padding:24px 48px 64px;max-width:1120px;width:100%}
.page-title{font-size:28px;font-weight:400;margin:0 0 8px;color:var(--text)}
.page-sub{color:var(--muted);font-size:14px;line-height:1.5;margin:0 0 24px;max-width:720px}
.profile-hero{display:flex;flex-direction:column;align-items:center;text-align:center;padding:16px 0 32px}
.profile-hero h1{margin:16px 0 4px;font-size:36px;font-weight:400}
.profile-hero p{margin:0;color:var(--muted);font-size:16px}
.quick-actions{display:flex;flex-wrap:wrap;gap:12px;justify-content:center;margin:8px 0 32px}
.chip-btn{display:inline-flex;align-items:center;gap:8px;padding:10px 20px;border-radius:999px;background:var(--surface2);color:var(--text);font-size:14px;font-weight:500;border:0;cursor:pointer;text-decoration:none}
.chip-btn:hover{background:#3c4043;text-decoration:none}
body[data-theme="light"] .chip-btn:hover{background:#dfe3e7}
.section-title{font-size:16px;font-weight:500;color:var(--text);margin:32px 0 12px}
.section-title-lg{font-size:22px;font-weight:400;margin:32px 0 8px}
.section-desc{color:var(--muted);font-size:14px;margin:0 0 16px;line-height:1.5}
.card{background:var(--surface);border-radius:var(--radius);overflow:hidden}
.card-padded{padding:20px 24px}
.card+.card{margin-top:12px}
.card-row{display:flex;touch-action:manipulation;align-items:center;justify-content:space-between;gap:16px;padding:16px 24px;border-top:1px solid var(--line)}
.card-row:first-child{border-top:0}
.card-row:hover{background:rgba(255,255,255,.03)}
.card-row[data-edit]{cursor:pointer}
.card-row[data-edit]:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
.card-row[data-edit]{cursor:pointer}
.card-row[data-edit]:focus-visible{outline:2px solid var(--accent);outline-offset:-2px}
body[data-theme="light"] .card-row:hover{background:rgba(0,0,0,.02)}
.row-main{flex:1;min-width:0}.row-title{font-size:14px;font-weight:500;color:var(--text);line-height:1.4}
.row-value{font-size:14px;color:var(--muted);line-height:1.5;margin-top:2px;word-break:break-word}
.row-right{display:flex;align-items:center;gap:12px;color:var(--muted);flex-shrink:0}
.chevron{color:var(--dim);font-size:20px;line-height:1}
.badge{display:inline-flex;align-items:center;padding:2px 10px;border-radius:999px;font-size:12px;font-weight:500;background:var(--surface3);color:var(--muted);white-space:nowrap}
.badge.ok{background:rgba(129,201,149,.15);color:var(--ok)} .badge.info{background:rgba(138,180,248,.15);color:var(--blue)} .badge.off{background:var(--surface3);color:var(--muted)}
.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.grid-3{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.mini-card{background:var(--surface);border-radius:var(--radius);padding:20px;display:flex;flex-direction:column;gap:8px;color:var(--text);text-decoration:none}
.mini-card:hover{background:var(--surface2);text-decoration:none}
.mini-card .mc-icon{width:40px;height:40px;border-radius:12px;display:grid;place-items:center;margin-bottom:4px;color:#fff}.mini-card .mc-icon svg{width:20px;height:20px}.mini-card .mc-icon.c-blue{background:#4285f4}.mini-card .mc-icon.c-green{background:#34a853}.mini-card .mc-icon.c-purple{background:#a142f4}.mini-card .mc-icon.c-orange{background:#fa7b17}.mini-card .mc-icon.c-red{background:#ea4335}.mini-card .mc-icon.c-teal{background:#24a3b5}
.mini-card h3{margin:0;font-size:14px;font-weight:500}.mini-card p{margin:0;font-size:13px;color:var(--muted);line-height:1.5}
.empty{padding:24px;color:var(--muted);font-size:14px;text-align:center}
.muted{color:var(--muted)} .dim{color:var(--dim)}
.footer-actions{display:flex;gap:12px;justify-content:center;margin-top:32px;flex-wrap:wrap}
.btn{display:inline-flex;touch-action:manipulation;align-items:center;justify-content:center;gap:8px;padding:10px 24px;border-radius:999px;border:1px solid var(--line);background:transparent;color:var(--accent);font:inherit;font-size:14px;font-weight:500;cursor:pointer;text-decoration:none}
.btn:hover{background:rgba(138,180,248,.08);text-decoration:none}
.btn-primary{background:var(--accent);color:#202124;border-color:var(--accent)}
body[data-theme="light"] .btn-primary{color:#fff}
.btn-primary:hover{filter:brightness(1.05)}
.btn-danger{color:var(--danger)} .btn-danger:hover{background:rgba(242,139,130,.08)}
.field{display:grid;gap:6px;margin-bottom:16px}.field-label{font-size:14px;font-weight:500}
.input{width:100%;padding:12px 14px;border-radius:4px;border:1px solid var(--line);background:transparent;color:var(--text);font:inherit;font-size:14px}
.input:focus{outline:2px solid var(--accent);border-color:var(--accent)}
.dialog-backdrop{position:fixed;inset:0;background:rgba(0,0,0,.6);display:grid;place-items:center;padding:24px;z-index:100}
.dialog{width:min(100%,560px);background:var(--surface2);border-radius:28px;padding:24px}
.dialog-head{display:flex;justify-content:space-between;gap:16px;margin-bottom:16px}.dialog-head h2{margin:0;font-size:24px;font-weight:400}
.dialog-close{width:40px;height:40px;border:0;background:transparent;color:var(--muted);font-size:24px;border-radius:50%;cursor:pointer}
.dialog-close:hover{background:rgba(255,255,255,.08)}
.dialog-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:24px}
.toast-host{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);display:grid;gap:8px;z-index:200;width:min(560px,calc(100vw - 32px))}
.toast{background:#f1f3f4;color:#1f1f1f;padding:14px 16px;border-radius:4px;font-size:14px;box-shadow:0 2px 8px rgba(0,0,0,.3)}
.toast-error{background:#f28b82;color:#202124}.toast-out{opacity:0;transition:.2s}
.switch{position:relative;display:inline-flex;width:52px;height:32px;flex:0 0 52px}
.switch input{opacity:0;width:0;height:0;position:absolute}
.switch span{position:absolute;inset:0;background:#5f6368;border:2px solid #8e918f;border-radius:999px;transition:.2s;cursor:pointer}
.switch span:before{content:"";position:absolute;width:16px;height:16px;left:6px;top:6px;background:#c4c7c5;border-radius:50%;transition:.2s}
.switch input:checked+span{background:var(--accent);border-color:var(--accent)}
.switch input:checked+span:before{transform:translateX(20px);width:24px;height:24px;left:2px;top:2px;background:#1f1f1f}
body[data-theme="light"] .switch span:before{background:#747775}
body[data-theme="light"] .switch input:checked+span:before{background:#fff}
.code-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(120px,1fr));gap:8px;margin-top:12px}
.code-list code{display:block;padding:10px;background:var(--surface);border-radius:8px;text-align:center;font-size:14px}
.notice{padding:16px 24px;background:rgba(129,201,149,.12);color:var(--text);border-radius:var(--radius);display:flex;gap:12px;align-items:flex-start;margin-bottom:16px}
.notice p{margin:0;font-size:14px;line-height:1.5;color:var(--muted)} .notice strong{display:block;color:var(--text);margin-bottom:2px}
.back-bar{display:flex;align-items:center;gap:16px;padding:12px 24px;background:var(--bg);position:sticky;top:0;z-index:50}
.back-bar h1{font-size:22px;font-weight:400;margin:0}
.storage-wrap{max-width:1040px;margin:0 auto;padding:24px}
.storage-box{background:var(--surface);border:1px solid var(--line);border-radius:16px;padding:24px;margin-bottom:24px}
body[data-theme="light"] .storage-box{background:#fff}
.bar{height:8px;background:#e3e3e3;border-radius:999px;overflow:hidden;margin:12px 0}
.bar > span{display:block;height:100%;background:#fbbc04;width:0}
.mobile-nav-btn{display:none}
.sidebar-overlay{display:none}
.sidebar-drawer-head{display:none}
@media (max-width:1100px){
  .layout{grid-template-columns:1fr}
  .mobile-nav-btn{display:inline-grid;place-items:center;width:40px;height:40px;border:0;background:transparent;color:var(--text);border-radius:50%;cursor:pointer;font-size:22px;flex:0 0 40px}
  .mobile-nav-btn:hover{background:rgba(255,255,255,.08)}
  body[data-theme="light"] .mobile-nav-btn:hover{background:rgba(0,0,0,.06)}
  .sidebar{position:fixed;left:0;top:0;bottom:0;width:min(320px,86vw);max-height:none;background:var(--bg);z-index:80;padding:12px 12px 24px;transform:translateX(-100%);transition:transform .2s ease;overflow:auto;border-right:1px solid var(--line);box-shadow:none}
  .sidebar.open{transform:translateX(0);box-shadow:8px 0 24px rgba(0,0,0,.35)}
  .sidebar-drawer-head{display:flex;align-items:center;gap:8px;padding:12px 12px 20px;font-size:22px;font-weight:500;color:var(--text);border-bottom:1px solid var(--line);margin:0 -12px 12px}
  .sidebar-drawer-head .brand-dot{margin-left:12px}
  .sidebar-overlay{display:block;position:fixed;inset:0;background:rgba(0,0,0,.45);z-index:70;opacity:0;pointer-events:none;transition:opacity .2s}
  .sidebar-overlay.open{opacity:1;pointer-events:auto}
  .nav-item{margin:0 0 2px;border-radius:0 24px 24px 0}
  .sidebar-footer{display:flex}
  .content{padding:24px 20px 48px;max-width:none}
}
@media (max-width:720px){
  .topbar{padding:10px 16px;gap:8px;min-height:56px}
  .brand{font-size:20px}
  .searchbar{display:none}
  .grid-2,.grid-3{grid-template-columns:1fr}
  .profile-hero{padding:8px 0 24px}
  .profile-hero h1{font-size:28px;word-break:break-word}
  .profile-hero p{font-size:14px;word-break:break-word}
  .quick-actions{gap:8px}
  .chip-btn{padding:10px 14px;font-size:13px}
  .content{padding:16px 16px 48px}
  .card-row{padding:14px 16px;gap:8px}
  .row-right{gap:8px}
  .row-right .btn{padding:8px 14px;font-size:13px}
  .card-padded{padding:16px}
  .page-title{font-size:24px}
  .dialog-backdrop{padding:12px;align-items:end}
  .dialog{border-radius:20px 20px 0 0;width:100%;max-height:90vh;overflow:auto;padding:20px}
  .dialog-head h2{font-size:20px}
  .toast-host{bottom:16px;width:calc(100vw - 24px)}
  .footer-actions{flex-direction:column}.footer-actions .btn{width:100%}
}
@media (max-width:420px){
  .topbar-actions .icon-btn[title="Applications Kwarkle"]{display:none}
  .avatar-lg{width:80px;height:80px;font-size:32px}
  .card-row{flex-direction:column;align-items:flex-start}
  .card-row .row-right{width:100%;justify-content:space-between}
  .card-row .row-right .chevron{margin-left:auto}
}
