:root{
  --bg:#0b0f16;
  --panel:#101827;
  --panel2:#0e1522;
  --text:#e6e9ef;
  --muted:#a2aab8;
  --accent:#6aa9ff;
  --danger:#ff5f6d;

  --radius:12px;
  --shadow: 0 12px 35px rgba(0,0,0,.35);
  --glass-border: rgba(255,255,255,.10);
  --glass-fill: rgba(0,0,0,.18);

  --font: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, "Noto Sans";
}

*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; font-family:var(--font); color:var(--text); }

a{ color:var(--accent); text-decoration:none; }
a:hover{ text-decoration:none; }

.muted{ color:var(--muted); }
.tiny{ font-size:12px; }
.msg{ margin-top:10px; color:var(--muted); min-height:18px; }

/* Auth */
.auth-page{
  background: radial-gradient(900px 500px at 20% 20%, rgba(106,169,255,.16), transparent),
              radial-gradient(900px 500px at 80% 80%, rgba(255,95,109,.12), transparent),
              #070a10;
  display:flex; align-items:center; justify-content:center;
}
.auth-card{
  width:min(420px, 92vw);
  padding:22px;
  border-radius:16px;
  background:rgba(16,24,39,.75);
  border:1px solid rgba(255,255,255,.08);
  box-shadow:var(--shadow);
}
.auth-card h1{ margin:0 0 8px 0; font-size:28px; }
.auth-actions{ display:flex; gap:10px; margin-top:12px; }
label{ display:block; margin-top:12px; font-size:13px; color:var(--muted); }
input, textarea, select{
  width:100%;
  margin-top:6px;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.10);
  background:rgba(0,0,0,.25);
  color:var(--text);
  outline:none;
}
input:focus, textarea:focus, select:focus{
  border-color: rgba(106,169,255,.55);
  box-shadow: 0 0 0 3px rgba(106,169,255,.15);
}

/* Buttons */
.btn{
  appearance:none; border:none; cursor:pointer;
  padding:10px 14px; border-radius:12px;
  background: linear-gradient(180deg, rgba(106,169,255,.95), rgba(106,169,255,.75));
  color:#06121f; font-weight:700;
}
.btn:hover{ filter:brightness(1.05); }
.btn.small{ padding:8px 12px; border-radius:10px; font-size:13px; }
.btn-outline{
  background: transparent;
  color: var(--text);
  border:1px solid rgba(255,255,255,.16);
}
.danger{ color: var(--danger); }
.btn.danger{
  background: linear-gradient(180deg, rgba(255,95,109,.95), rgba(255,95,109,.75));
  color:#fff;
}
.btn-outline.danger{
  color: var(--danger);
  border-color: rgba(255,95,109,.35);
}

/* MainOS base */
body.mainos{
  overflow:hidden;
  background: var(--bg);
}
.desktop{
  position:fixed; inset:0 0 44px 0; /* leave space for panel */
  background-position:center;
  background-size:cover;
}
.desktop-icons{
  position:absolute;
  inset:0;
}
.desktop-icon{
  position:absolute;
  width:72px;
  padding:6px;
  border-radius:8px;
  border:none;
  background: transparent;
  color:#fff;
  text-align:center;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  cursor:pointer;
  user-select:none;
  transition: background .15s;
}
.desktop-icon:hover{
  background: rgba(255,255,255,.12);
}
.desktop-icon-art{
  width:48px;
  height:48px;
  border-radius:8px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(40,50,65,.75);
  border: 1px solid rgba(255,255,255,.15);
}
.desktop-icon svg{
  width:28px;
  height:28px;
  stroke: #fff;
  fill: none;
  stroke-width:1.5;
}
.desktop-icon-label{
  font-size:11px;
  font-weight:500;
  text-shadow: 0 1px 3px rgba(0,0,0,.7), 0 0 8px rgba(0,0,0,.5);
  max-width:70px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.desktop-icon.dragging{
  opacity:.85;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.window-layer{ position:absolute; inset:0; pointer-events:none; }
.win{ pointer-events:auto; }

/* Wallpapers */
.wallpaper-aurora .desktop{ background-image:url("/assets/wallpapers/aurora.svg"); }
.wallpaper-gradient01 .desktop{ background-image:url("/assets/wallpapers/gradient01.svg"); }
.wallpaper-neon .desktop{ background-image:url("/assets/wallpapers/neon.svg"); }
.wallpaper-fedora .desktop{ background-image:url("/assets/wallpapers/fedora.svg"); }

/* Themes */
.theme-kde-dark{
  --bg:#0b0f16; --panel:#101827; --panel2:#0e1522; --text:#e6e9ef; --muted:#a2aab8; --accent:#6aa9ff;
}
.theme-kde-light{
  --bg:#eef3fb; --panel:#ffffff; --panel2:#f6f8fc; --text:#0c1220; --muted:#45506a; --accent:#2f6fed;
}
.theme-neon{
  --bg:#070814; --panel:#0b1022; --panel2:#090d1b; --text:#eaf0ff; --muted:#9aa7c6; --accent:#7df9ff;
}
.theme-fedora{
  --bg:#1c2126; --panel:#262c33; --panel2:#2e353d; --text:#f1f4f7; --muted:#b6c0cc; --accent:#6aa9ff; --danger:#ff6b6b;
  --shadow: 0 12px 30px rgba(13,16,20,.35);
  --glass-border: rgba(255,255,255,.14);
  --glass-fill: rgba(19,22,26,.55);
}

/* Panel / Taskbar */
.panel{
  position:fixed; left:0; right:0; bottom:0; height:44px;
  display:flex; align-items:center; gap:6px;
  padding:0 8px;
  background: rgba(20,24,30,.75);
  border-top:1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.theme-kde-light .panel{ background: rgba(255,255,255,.85); }
.theme-fedora .panel{
  background: rgba(18,22,28,.72);
  border-top:1px solid rgba(255,255,255,.06);
}

.panel-btn{
  height:32px; min-width:32px;
  border-radius:8px;
  border:none;
  background: transparent;
  color:var(--text);
  cursor:pointer;
  transition: background .15s;
}
.panel-btn:hover{
  background: rgba(255,255,255,.1);
}
.theme-kde-light .panel-btn{ background: rgba(0,0,0,.05); }
.theme-fedora .panel-btn{
  background: transparent;
}

.panel-btn-menu{
  font-size:27px;
  width:36px;
  height:36px;
  background: rgba(50,130,200,.2);
  border-radius:8px;
}
.panel-btn-menu:hover{
  background: rgba(50,130,200,.35);
}
.taskbar{
  flex:1;
  display:flex; align-items:center; gap:4px;
  overflow:auto;
  justify-content:flex-start;
  padding-left:4px;
}
.task-item{
  display:flex; align-items:center; justify-content:center;
  width:36px; height:36px;
  padding:0;
  border-radius:8px;
  border:none;
  background: rgba(255,255,255,.08);
  cursor:pointer;
  user-select:none;
  font-size:14px;
  transition: background .15s, box-shadow .15s;
}
.task-item:hover{
  background: rgba(255,255,255,.15);
}
.task-item.active{
  background: rgba(255,255,255,.18);
}
.panel-right{ display:flex; align-items:center; gap:6px; }
.clock{
  font-variant-numeric: tabular-nums;
  padding:4px 10px;
  border-radius:8px;
  border:none;
  background: transparent;
  font-size:12px;
  text-align:right;
  line-height:1.3;
}
.clock:hover{
  background: rgba(255,255,255,.1);
}
.system-tray{
  display:flex;
  align-items:center;
  gap:2px;
  padding:4px 8px;
  border-radius:8px;
  background: rgba(255,255,255,.06);
}
.tray-icon{
  font-size:14px;
  opacity:.8;
  cursor:pointer;
  padding:2px 4px;
  border-radius:4px;
  transition: background .15s;
}
.tray-icon:hover{
  background: rgba(255,255,255,.1);
  opacity:1;
}
.ws-btn{
  font-size:11px;
  font-weight:600;
  width:24px;
  height:24px;
  min-width:24px;
  border-radius:6px;
  background: rgba(255,255,255,.08);
}
.ws-btn.active{
  background: rgba(100,160,255,.3);
  color:#fff;
}
.ws-btn:hover{
  background: rgba(255,255,255,.15);
}
.panel-btn-user{
  font-size:32px;
  width:36px;
  height:36px;
  min-width:36px;
  line-height:36px;
  display:flex;
  align-items:center;
  justify-content:center;
  background: rgba(255,255,255,.08);
}

/* App menu */
.app-menu{
  position:fixed;
  left:10px; bottom:56px;
  width:560px;
  padding:12px;
  border-radius:18px;
  background: rgba(16,24,39,.94);
  border:1px solid var(--glass-border);
  box-shadow: var(--shadow);
}
.theme-kde-light .app-menu{ background: rgba(255,255,255,.92); }
.theme-fedora .app-menu{ background: rgba(28,32,38,.92); }
.app-menu.hidden{ display:none; }
.app-menu-title{ font-weight:800; margin:6px 6px 10px 6px; }
.app-menu-search{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.22);
  margin:6px;
}
.app-menu-search input{
  border:0;
  margin:0;
  padding:0;
  background: transparent;
  color: var(--text);
  flex:1;
}
.app-menu-search-icon{
  font-size:14px;
  opacity:.8;
}
.app-menu-search-filter{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  color: var(--text);
  border-radius:8px;
  padding:4px 8px;
  cursor:pointer;
}
.app-menu-body{
  display:grid;
  grid-template-columns: 170px 1fr;
  gap:10px;
  margin-top:8px;
}
.app-menu-sidebar{
  padding:4px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.2);
  display:flex;
  flex-direction:column;
  gap:6px;
  max-height:370px;
  overflow:auto;
}
.app-menu-nav{
  text-align:left;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor:pointer;
}
.app-menu-nav.active{
  border-color: rgba(106,169,255,.4);
  background: rgba(106,169,255,.12);
}
.app-menu-content{
  padding:2px 6px;
}
.app-menu-section-title{
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--muted);
  margin:6px 6px 8px 6px;
}
.app-menu-section-count{
  font-size:12px;
  letter-spacing:normal;
  text-transform:none;
  margin-left:6px;
  opacity:.8;
}
.app-menu-section{ margin-bottom:10px; }
.app-menu-grid{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:8px;
  padding:0 4px 6px;
}
.app-menu-empty{
  padding:12px 8px;
  color: var(--muted);
  font-size:12px;
  text-align:left;
}
.app-menu-item{
  width:100%;
  text-align:center;
  padding:12px 8px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.14);
  color: var(--text);
  cursor:pointer;
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:6px;
  min-height:78px;
}
.app-menu-icon{
  font-size:20px;
}
.app-menu-label{
  font-size:12px;
  font-weight:600;
}
.theme-kde-light .app-menu-item{ background: rgba(0,0,0,.04); }
.theme-fedora .app-menu-item{ background: rgba(16,20,24,.6); }
.app-menu-footer{
  display:flex;
  gap:8px;
  padding:6px 4px 4px;
  border-top:1px solid rgba(255,255,255,.08);
}
.app-menu-footer-btn{
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.2);
  color: var(--text);
  border-radius:10px;
  padding:8px 10px;
  cursor:pointer;
  flex:1;
}
@media (max-width: 720px){
  .app-menu{
    width:92vw;
    left:4vw;
  }
  .app-menu-body{
    grid-template-columns: 1fr;
  }
  .app-menu-sidebar{
    flex-direction:row;
    flex-wrap:wrap;
    max-height:none;
  }
  .app-menu-nav{
    flex:1 1 46%;
  }
  .app-menu-grid{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Windows */
.win{
  position:absolute;
  width:780px; height:520px;
  border-radius:16px;
  background: rgba(16,24,39,.92);
  border:1px solid var(--glass-border);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.win.maximized{
  border-radius:0;
}
.win.maximized .resize-handle{
  display:none;
}
.theme-kde-light .win{ background: rgba(255,255,255,.92); }
.theme-fedora .win{ background: rgba(26,30,35,.92); }

.win .titlebar{
  height:42px;
  display:flex; align-items:center; justify-content:space-between;
  padding:0 10px;
  background: rgba(0,0,0,.18);
  border-bottom:1px solid rgba(255,255,255,.08);
  cursor:move;
  user-select:none;
  -webkit-user-select:none;
}
.theme-kde-light .win .titlebar{ background: rgba(0,0,0,.03); }
.theme-fedora .win .titlebar{ background: rgba(16,20,24,.7); }

.win .title{
  font-weight:800;
  display:flex; align-items:center; gap:8px;
}
.win .controls{ display:flex; gap:8px; }
.win .ctrl{
  width:34px; height:28px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.14);
  color: var(--text);
  cursor:pointer;
  user-select:none;
  -webkit-user-select:none;
}
.win .ctrl.max{
  font-size:14px;
  line-height:1;
}
.win .ctrl.max.restore{
  font-size:13px;
}
.win .ctrl.close{ color: var(--danger); }

.win .content{
  height: calc(100% - 42px);
  background: transparent;
  overflow:auto;
  padding:12px;
}

.resize-handle{
  position:absolute;
  right:6px; bottom:6px;
  width:18px; height:18px;
  cursor:nwse-resize;
  opacity:.5;
}

/* Apps shared */
.app-header .app-title{ font-size:20px; font-weight:900; }
.app-header .app-sub{ font-size:12px; color:var(--muted); margin-top:4px; }

.settings-grid{ display:grid; grid-template-columns: 1fr 1fr; gap:12px; }
@media (max-width: 880px){ .settings-grid{ grid-template-columns: 1fr; } }
.settings-card{
  padding:12px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
}
.theme-kde-light .settings-card{ background: rgba(0,0,0,.03); }
.theme-fedora .settings-card{ background: rgba(16,20,24,.5); }
.settings-card h3{ margin: 8px 0 6px; }

/* MainGPT */
.chat-history-actions{
  margin-top:10px;
  display:flex;
  justify-content:center;
}
.chat-log{
  margin-top:10px;
  height:320px;
  overflow:auto;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
  padding:10px;
}
.chat-bubble{
  max-width: 88%;
  padding:10px 12px;
  border-radius:14px;
  margin:8px 0;
  border:1px solid rgba(255,255,255,.10);
}
.chat-bubble.user{ margin-left:auto; background: rgba(106,169,255,.12); }
.chat-bubble.bot{ margin-right:auto; background: rgba(0,0,0,.12); }
.chat-input{ margin-top:10px; display:flex; gap:10px; align-items:flex-end; }

/* MainBrowser */
.browser-bar{ display:flex; gap:10px; align-items:center; }
.browser-bookmarks{ margin:10px 0; display:flex; gap:8px; flex-wrap:wrap; }
.chip{
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.12);
  color: var(--text);
  padding:7px 10px;
  border-radius:999px;
  cursor:pointer;
}
.browser-frame-wrap{
  position:relative;
  height:360px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  overflow:hidden;
  background: rgba(0,0,0,.12);
}
.browser-frame-wrap iframe{ width:100%; height:100%; border:0; background:white; }
.browser-blocked{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:20px;
  text-align:center;
  background: rgba(20, 23, 30, 0.94);
}
.browser-blocked.hidden{ display:none; }
.browser-blocked-title{ font-size:22px; font-weight:800; }
.browser-blocked-text{ max-width:520px; color: var(--muted); }
.browser-hint{ margin-top:8px; }

/* MainCode (VS Code-ish) */
.code-topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 10px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
}
.code-title{ font-weight:900; }
.code-body{ margin-top:10px; display:flex; gap:10px; height:380px; }
.code-sidebar{
  width:220px;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
  overflow:auto;
}
.code-sidebar-title{ padding:10px; font-weight:800; border-bottom:1px solid rgba(255,255,255,.08); }
.code-files{ padding:8px; display:flex; flex-direction:column; gap:6px; }
.code-files-actions{ padding:8px; border-top:1px solid rgba(255,255,255,.08); }
.file-item{
  padding:8px 10px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.10);
  cursor:pointer;
}
.file-item.active{ border-color: rgba(106,169,255,.45); box-shadow: 0 0 0 3px rgba(106,169,255,.12); }

.code-editor{
  flex:1;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(0,0,0,.12);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.code-filename{
  border:0;
  border-bottom:1px solid rgba(255,255,255,.08);
  border-radius:0;
  background: rgba(0,0,0,.10);
}
.code-text{
  flex:1;
  border:0;
  border-radius:0;
  margin:0;
  padding:12px;
  background: rgba(0,0,0,.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size:13px;
  line-height:1.5;
  resize:none;
}
.code-status{
  padding:8px 10px;
  border-top:1px solid rgba(255,255,255,.08);
  background: rgba(0,0,0,.10);
}

/* Modal */
.modal-overlay{
  position:fixed;
  inset:0;
  background: rgba(0,0,0,.35);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index: 9999;
}
.modal{
  width: min(92vw, 420px);
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(20,24,28,.95);
  color: var(--text);
  box-shadow: 0 20px 50px rgba(0,0,0,.35);
  padding:14px;
}
.modal-title{ font-weight:800; margin-bottom:6px; }
.modal-body{ font-size:14px; color: var(--muted); }
.modal-actions{ margin-top:12px; display:flex; gap:8px; justify-content:flex-end; }
