:root {
  --win-blue: #0b65c2;
  --win-blue-dark: #074d96;
  --cq-navy: #111142;
  --cq-mint: #42dfc2;
  --surface: rgba(249, 250, 252, 0.96);
  --surface-solid: #f6f7f9;
  --line: #d9dce2;
  --text: #1d1d25;
  --muted: #6d7180;
  --danger: #c42b3d;
  --taskbar-height: 48px;
  --shadow: 0 22px 80px rgba(3, 14, 37, 0.38), 0 3px 12px rgba(3, 14, 37, 0.18);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { color: var(--text); font-family: "Segoe UI Variable", "Segoe UI", Arial, sans-serif; font-size: 14px; user-select: none; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid #2889e9; outline-offset: 2px; }
input, textarea, select { user-select: text; }
.is-hidden { display: none !important; }
.status-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #1aaa73; box-shadow: 0 0 0 3px rgba(26, 170, 115, .13); }

/* Login */
.login-screen { position: fixed; inset: 0; display: grid; place-items: center; overflow: hidden; color: white; }
.login-wallpaper, .desktop-wallpaper { position: absolute; inset: 0; background: radial-gradient(circle at 76% 26%, rgba(27, 125, 218, .95), transparent 27%), radial-gradient(circle at 28% 72%, rgba(32, 91, 174, .7), transparent 33%), linear-gradient(140deg, #06152e, #092b59 55%, #0a447e); }
.login-wallpaper::before, .desktop-wallpaper::before { content: ""; position: absolute; inset: -30%; transform: rotate(-12deg); opacity: .34; background: repeating-linear-gradient(90deg, transparent 0 65px, rgba(255,255,255,.06) 66px 67px), repeating-linear-gradient(0deg, transparent 0 65px, rgba(255,255,255,.04) 66px 67px); mask-image: radial-gradient(circle at center, black, transparent 68%); }
.login-wallpaper::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,.06), rgba(0,0,0,.32)); backdrop-filter: blur(4px); }
.login-clock { position: absolute; z-index: 1; left: clamp(30px, 6vw, 90px); top: clamp(28px, 7vh, 80px); display: grid; }
.login-clock strong { font-size: clamp(54px, 8vw, 96px); font-weight: 300; line-height: 1; letter-spacing: -.05em; text-shadow: 0 3px 20px rgba(0,0,0,.22); }
.login-clock span { margin-top: 8px; font-size: 17px; font-weight: 500; }
.login-card { position: relative; z-index: 2; width: min(92vw, 380px); display: grid; justify-items: stretch; gap: 13px; padding: 30px; border: 1px solid rgba(255,255,255,.25); border-radius: 18px; background: rgba(10, 28, 58, .68); box-shadow: 0 35px 110px rgba(0,0,0,.38); backdrop-filter: blur(28px) saturate(130%); }
.login-card > img { width: 180px; max-height: 95px; margin: 0 auto 2px; object-fit: contain; border-radius: 9px; background: white; }
.login-avatar { width: 68px; height: 68px; display: grid; place-items: center; margin: 3px auto 0; border: 2px solid rgba(255,255,255,.55); border-radius: 50%; background: linear-gradient(145deg, #48e4c6, #159ec1); color: var(--cq-navy); font-size: 21px; font-weight: 800; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-card h1 { margin: 0; font-size: 26px; font-weight: 600; text-align: center; }
.login-card > p { margin: -8px 0 5px; color: rgba(255,255,255,.7); text-align: center; }
.login-card label { display: grid; gap: 6px; color: rgba(255,255,255,.83); font-size: 12px; }
.login-card input { height: 43px; border: 1px solid rgba(255,255,255,.25); border-bottom: 2px solid rgba(255,255,255,.55); border-radius: 5px; padding: 0 12px; background: rgba(255,255,255,.13); color: white; outline: none; }
.login-card input::placeholder { color: rgba(255,255,255,.48); }
.login-card input:focus { border-bottom-color: var(--cq-mint); background: rgba(255,255,255,.18); }
.login-button { height: 43px; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 5px; padding: 0 14px; background: #f3f5f8; color: #101b2c; font-weight: 600; cursor: pointer; }
.login-button:hover { background: white; }
.login-button span { color: var(--win-blue); font-size: 20px; }
.login-hint { display: flex; align-items: center; justify-content: center; gap: 8px; color: rgba(255,255,255,.6); font-size: 11px; }
.login-footer { position: absolute; z-index: 2; right: 24px; bottom: 22px; display: flex; align-items: center; gap: 18px; color: rgba(255,255,255,.84); font-size: 12px; }
.form-message { min-height: 17px; margin: 0 !important; color: #ffb7c1 !important; font-size: 12px; text-align: left !important; }

/* Desktop */
.desktop { position: fixed; inset: 0; overflow: hidden; background: #0a3465; }
.desktop-wallpaper { z-index: 0; bottom: var(--taskbar-height); }
.desktop-wallpaper::after { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at center, transparent, rgba(0,12,32,.28)); }
.desktop-wallpaper img { position: absolute; z-index: 1; left: 50%; top: 47%; width: min(44vw, 620px); transform: translate(-50%, -50%); border-radius: 26px; opacity: .94; box-shadow: 0 35px 100px rgba(0,0,0,.34); }
.wallpaper-glow { position: absolute; z-index: 1; left: 50%; top: 47%; width: min(60vw, 850px); aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(43, 154, 236, .2); filter: blur(70px); }
.desktop-icons { position: absolute; z-index: 2; left: 12px; top: 14px; display: grid; gap: 7px; }
.desktop-icon { width: 88px; min-height: 94px; display: grid; justify-items: center; align-content: center; gap: 5px; border: 1px solid transparent; border-radius: 3px; padding: 6px 4px; background: transparent; color: white; cursor: default; text-align: center; text-shadow: 0 1px 3px rgba(0,0,0,.9); }
.desktop-icon:hover, .desktop-icon.selected { border-color: rgba(255,255,255,.35); background: rgba(100, 178, 238, .23); }
.desktop-icon .app-tile { width: 48px; height: 48px; font-size: 24px; box-shadow: 0 5px 12px rgba(0,0,0,.26); }
.desktop-icon > span:last-child { font-size: 12px; line-height: 1.18; }
.app-tile { display: grid; place-items: center; border-radius: 11px; color: white; font-weight: 700; }
.app-tile--todo, .mini-app-icon--todo { background: linear-gradient(145deg, #2aa3ee, #0867bb); }
.app-tile--library, .mini-app-icon--library { background: linear-gradient(145deg, #37dfc1, #0b9da3); color: var(--cq-navy) !important; }

/* Taskbar and menus */
.taskbar { position: fixed; z-index: 9000; inset: auto 0 0; height: var(--taskbar-height); display: flex; align-items: center; justify-content: center; border-top: 1px solid rgba(255,255,255,.55); background: rgba(239, 246, 252, .88); box-shadow: 0 -2px 10px rgba(6, 28, 52, .12); backdrop-filter: blur(22px) saturate(130%); }
.taskbar-center { height: 100%; display: flex; align-items: center; gap: 3px; }
.taskbar-button, .taskbar-search, .system-tray button { border: 0; background: transparent; cursor: default; }
.taskbar-button { position: relative; width: 42px; height: 40px; display: grid; place-items: center; border-radius: 4px; }
.taskbar-button:hover, .taskbar-button.active, .taskbar-search:hover { background: rgba(255,255,255,.66); }
.windows-mark { width: 21px; height: 21px; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2px; }
.windows-mark i { background: linear-gradient(145deg, #1686e2, #075ab5); }
.taskbar-search { width: 155px; height: 32px; display: flex; align-items: center; gap: 9px; margin: 0 4px; border: 1px solid rgba(32, 75, 120, .15); border-radius: 18px; padding: 0 12px; background: rgba(255,255,255,.5); color: #394858; text-align: left; }
.taskbar-search span:first-child { font-size: 20px; }
.taskbar-search span:last-child { font-size: 12px; }
.mini-app-icon { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 7px; color: white; font-size: 14px; font-weight: 700; }
.app-task > i { position: absolute; left: 12px; right: 12px; bottom: 1px; height: 2px; border-radius: 2px; background: #2e7bbd; opacity: 0; }
.app-task.open > i { opacity: .6; }
.app-task.active > i { left: 8px; right: 8px; opacity: 1; }
.system-tray { position: absolute; right: 5px; height: 100%; display: flex; align-items: center; gap: 7px; color: #172435; font-size: 12px; }
.system-tray > button:not(.tray-clock) { min-width: 24px; height: 37px; border-radius: 4px; }
.system-tray > button:hover { background: rgba(255,255,255,.6); }
.tray-clock { width: 72px; height: 42px; display: grid; place-content: center; background: transparent; line-height: 1.15; text-align: right; }
.tray-clock strong, .tray-clock small { font-size: 11px; font-weight: 400; }
.notification-button { font-size: 16px; }
.start-menu { position: fixed; z-index: 8999; left: 50%; bottom: 58px; width: min(94vw, 590px); height: min(74vh, 650px); transform: translateX(-50%); overflow: hidden; border: 1px solid rgba(255,255,255,.75); border-radius: 9px; background: rgba(241, 247, 252, .94); box-shadow: var(--shadow); backdrop-filter: blur(30px) saturate(145%); animation: menuIn .14s ease-out; }
@keyframes menuIn { from { opacity: 0; transform: translate(-50%, 10px) scale(.98); } }
.start-search { height: 40px; display: flex; align-items: center; gap: 10px; margin: 28px 36px 20px; border: 1px solid #c8d2dc; border-bottom: 2px solid #247ccc; border-radius: 5px; padding: 0 13px; background: white; color: #566271; }
.start-search input { flex: 1; border: 0; background: transparent; outline: 0; font-size: 12px; }
.start-section-title { display: flex; align-items: center; justify-content: space-between; margin: 0 42px 12px; font-size: 12px; }
.start-section-title span { padding: 4px 9px; border: 1px solid #d7dde3; border-radius: 4px; background: rgba(255,255,255,.7); font-size: 10px; }
.pinned-apps { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0 30px 18px; }
.pinned-apps button { min-height: 88px; display: grid; justify-items: center; align-content: center; gap: 7px; border: 0; border-radius: 5px; background: transparent; cursor: default; }
.pinned-apps button:hover { background: rgba(255,255,255,.72); }
.pinned-apps .app-tile { width: 38px; height: 38px; font-size: 18px; }
.pinned-apps strong { font-size: 11px; font-weight: 500; }
.start-recommended { padding-top: 9px; border-top: 1px solid rgba(119,142,165,.17); }
.recommended-item { display: flex; align-items: center; gap: 12px; margin: 0 35px; padding: 9px; border-radius: 5px; }
.recommended-item:hover { background: rgba(255,255,255,.65); }
.recommended-item > span { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 5px; background: #fff; color: #1773c5; font-size: 19px; }
.recommended-item div { display: grid; gap: 3px; }
.recommended-item strong { font-size: 11px; }
.recommended-item small { color: var(--muted); font-size: 9px; }
.start-menu > footer { position: absolute; inset: auto 0 0; height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 48px; border-top: 1px solid rgba(119,142,165,.2); background: rgba(223, 234, 243, .55); }
.start-menu > footer strong { font-size: 11px; }
.start-menu > footer button { width: 34px; height: 34px; margin-left: auto; border: 0; border-radius: 4px; background: transparent; cursor: default; }
.start-menu > footer button:hover { background: rgba(255,255,255,.65); }
.user-avatar { width: 31px; height: 31px; display: grid; place-items: center; flex: none; border-radius: 50%; background: linear-gradient(145deg, var(--cq-mint), #198fbc); color: var(--cq-navy); font-size: 11px; font-weight: 800; }
.desktop-context { position: fixed; z-index: 8500; width: 235px; padding: 6px; border: 1px solid rgba(255,255,255,.65); border-radius: 7px; background: rgba(245,249,252,.93); box-shadow: 0 12px 35px rgba(0,0,0,.28); backdrop-filter: blur(20px); }
.desktop-context button { width: 100%; height: 35px; display: grid; grid-template-columns: 28px 1fr; align-items: center; border: 0; border-radius: 4px; padding: 0 9px; background: transparent; text-align: left; }
.desktop-context button:hover { background: rgba(255,255,255,.8); }
.desktop-context hr { height: 1px; border: 0; background: #dce1e7; }

/* Window chrome */
.app-window { position: fixed; z-index: 20; min-width: 450px; min-height: 340px; max-width: calc(100vw - 20px); max-height: calc(100vh - var(--taskbar-height) - 10px); display: grid; grid-template-rows: 38px 35px 1fr 24px; overflow: hidden; border: 1px solid rgba(255,255,255,.75); border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); backdrop-filter: blur(25px); resize: both; animation: windowIn .14s ease-out; }
@keyframes windowIn { from { opacity: 0; transform: scale(.975); } }
.app-window.active-window { border-color: rgba(255,255,255,.96); box-shadow: 0 30px 100px rgba(3,14,37,.47), 0 0 0 1px rgba(40,102,164,.16); }
.app-window.maximized { inset: 0 0 var(--taskbar-height) 0 !important; width: 100vw !important; height: calc(100vh - var(--taskbar-height)) !important; max-width: none; max-height: none; border-radius: 0; resize: none; }
.window-titlebar { display: flex; align-items: center; justify-content: space-between; background: rgba(247,249,251,.96); }
.active-window .window-titlebar { background: rgba(255,255,255,.98); }
.window-title { display: flex; align-items: center; gap: 9px; padding-left: 11px; font-size: 11px; }
.window-title .mini-app-icon { width: 22px; height: 22px; border-radius: 5px; font-size: 11px; }
.window-controls { align-self: stretch; display: flex; }
.window-controls button { width: 46px; border: 0; background: transparent; font-size: 13px; cursor: default; }
.window-controls button:hover { background: #e5e8eb; }
.window-controls .window-close:hover { background: #c42b1c; color: white; }
.window-menubar { display: flex; align-items: center; gap: 2px; padding: 0 7px; border-top: 1px solid #eef0f2; border-bottom: 1px solid var(--line); background: #f3f4f6; }
.window-menubar button { height: 27px; border: 0; border-radius: 4px; padding: 0 9px; background: transparent; color: #3d4350; font-size: 11px; cursor: default; }
.window-menubar button:hover { background: white; }
.window-menubar > span { flex: 1; }
.window-menubar .refresh-button { color: #215f99; }
.window-statusbar { display: flex; align-items: center; justify-content: space-between; padding: 0 9px; border-top: 1px solid var(--line); background: #f2f3f5; color: #6e7480; font-size: 9px; }
.window-statusbar span { display: flex; align-items: center; gap: 7px; }

/* Shared app controls */
.page-kicker { color: #1772bf; font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.app-page-header h2, .library-header h2 { margin: 5px 0 0; color: #161a23; font-size: 34px; font-weight: 600; letter-spacing: -.035em; }
.app-page-header p, .library-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.primary-action, .secondary-action, .danger-action { min-height: 36px; border: 0; border-radius: 5px; padding: 0 14px; font-size: 11px; font-weight: 600; cursor: pointer; }
.primary-action { background: var(--win-blue); color: white; box-shadow: inset 0 -1px rgba(0,0,0,.15); }
.primary-action:hover { background: var(--win-blue-dark); }
.secondary-action { border: 1px solid #ced3da; background: #f5f6f8; }
.secondary-action:hover { background: white; }
.danger-action { background: var(--danger); color: white; }
.icon-button { width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 4px; background: transparent; color: #5d6571; cursor: pointer; }
.icon-button:hover { background: #e8ebef; }
.icon-button.danger:hover { background: #fdecee; color: var(--danger); }
.empty-state { display: grid; justify-items: center; align-content: center; min-height: 260px; padding: 35px; color: #747c89; text-align: center; }
.empty-state > span { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 12px; background: #e6f1fb; color: #1674c4; font-size: 24px; }
.empty-state h3 { margin: 0; color: #2d333c; font-size: 16px; }
.empty-state p { margin: 7px 0 15px; font-size: 11px; }

/* Todo */
.todo-app { overflow: auto; padding: 28px clamp(22px, 5vw, 56px); background: radial-gradient(circle at 96% 0%, rgba(45,146,224,.1), transparent 25%), #fafbfc; }
.app-page-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; max-width: 820px; margin: 0 auto 20px; }
.open-count { min-width: 74px; display: grid; justify-items: center; padding: 10px 14px; border: 1px solid #d8e1e9; border-radius: 7px; background: white; box-shadow: 0 3px 10px rgba(20,49,77,.06); }
.open-count strong { color: var(--win-blue); font-size: 25px; font-weight: 600; line-height: 1; }
.open-count span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.todo-inputbar { max-width: 820px; height: 50px; display: flex; align-items: center; gap: 9px; margin: 0 auto 14px; padding: 6px; border: 1px solid #cfd6dd; border-radius: 7px; background: white; box-shadow: 0 5px 16px rgba(20,49,77,.07); }
.todo-inputbar > span { margin-left: 7px; color: #1776c7; font-size: 18px; }
.todo-inputbar input { min-width: 0; height: 36px; flex: 1; border: 0; padding: 0 6px; outline: 0; font-size: 12px; }
.todo-inputbar button { height: 36px; border: 0; border-radius: 5px; padding: 0 14px; background: var(--win-blue); color: white; font-size: 11px; font-weight: 600; cursor: pointer; }
.todo-filterbar { max-width: 820px; display: flex; align-items: center; justify-content: space-between; margin: 0 auto 10px; color: #7b828d; font-size: 9px; }
.segmented-control { display: flex; gap: 2px; padding: 2px; border: 1px solid #d9dde2; border-radius: 5px; background: #f2f3f5; }
.segmented-control button { height: 25px; border: 0; border-radius: 3px; padding: 0 10px; background: transparent; color: #626a75; font-size: 10px; cursor: pointer; }
.segmented-control button.active { background: white; color: #145d9b; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.todo-list { max-width: 820px; display: grid; gap: 7px; margin: auto; }
.todo-item { min-height: 65px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid #dfe3e7; border-radius: 6px; background: white; box-shadow: 0 2px 7px rgba(20,49,77,.045); }
.todo-item:hover { border-color: #c9d7e4; }
.todo-check { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid #9ba5af; border-radius: 4px; background: white; color: white; cursor: pointer; }
.todo-item.done .todo-check { border-color: #2189d1; background: #2189d1; }
.todo-copy { min-width: 0; }
.todo-copy p { margin: 0 0 6px; overflow-wrap: anywhere; color: #252a33; font-size: 12px; }
.todo-copy small { display: flex; align-items: center; gap: 4px; color: #858c96; font-size: 9px; }
.todo-copy strong { color: #5a626e; }
.todo-item.done { opacity: .64; }
.todo-item.done p { text-decoration: line-through; }
.tiny-avatar { width: 17px; height: 17px; display: inline-grid; place-items: center; border-radius: 50%; background: #e0edf8; color: #155f9c; font-size: 8px; font-weight: 700; }

/* Library */
.library-layout { min-height: 0; display: grid; grid-template-columns: 220px 1fr; overflow: hidden; }
.library-sidebar { min-height: 0; display: flex; flex-direction: column; overflow: auto; padding: 14px 9px 10px; border-right: 1px solid var(--line); background: #f0f2f5; }
.sidebar-heading { display: flex; align-items: center; justify-content: space-between; padding: 2px 8px 11px; color: #717987; font-size: 9px; font-weight: 700; letter-spacing: .12em; }
.sidebar-heading button { width: 25px; height: 25px; border: 0; border-radius: 4px; background: transparent; color: #176bad; font-size: 17px; cursor: pointer; }
.sidebar-heading button:hover { background: white; }
#categoryNav { display: grid; gap: 2px; }
.category-nav-item { position: relative; min-height: 39px; display: flex; align-items: center; border-radius: 5px; color: #505762; }
.category-nav-item.active { background: white; color: #15202e; box-shadow: 0 1px 5px rgba(20,49,77,.09); }
.category-main-button { min-width: 0; height: 39px; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 6px; flex: 1; border: 0; border-radius: 5px; padding: 0 7px; background: transparent; text-align: left; cursor: pointer; }
.category-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 5px; background: #dfe6ed; color: #175d96; font-size: 12px; font-weight: 700; }
.active .category-icon { background: #ddecf8; }
.category-name { min-width: 0; overflow: hidden; font-size: 10px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.category-count { min-width: 18px; padding: 2px 5px; border-radius: 8px; background: #e9edf1; color: #747b86; font-size: 8px; text-align: center; }
.category-actions { position: absolute; right: 3px; display: none; gap: 1px; padding: 2px; border-radius: 4px; background: white; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
.category-nav-item:hover .category-actions, .category-nav-item:focus-within .category-actions { display: flex; }
.category-actions button { width: 23px; height: 23px; border: 0; border-radius: 3px; background: transparent; color: #68717c; font-size: 10px; cursor: pointer; }
.category-actions button:hover { background: #edf0f3; }
.category-actions button:last-child:hover { background: #fdecee; color: var(--danger); }
.sidebar-user { display: flex; align-items: center; gap: 9px; margin-top: auto; padding: 11px 7px 2px; border-top: 1px solid #d9dee3; }
.sidebar-user div { display: grid; gap: 1px; }
.sidebar-user small { color: #858c96; font-size: 8px; }
.sidebar-user strong { font-size: 10px; }
.library-main { min-width: 0; min-height: 0; overflow: auto; padding: 27px clamp(20px, 3.4vw, 42px); background: #fafbfc; }
.library-header { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.library-actions { display: flex; align-items: center; gap: 8px; }
.search-box { height: 36px; display: flex; align-items: center; gap: 7px; border: 1px solid #ccd4dc; border-radius: 5px; padding: 0 9px; background: white; color: #747b86; }
.search-box > span { font-size: 18px; }
.search-box input { width: 180px; border: 0; outline: 0; font-size: 10px; }
.category-overview { display: grid; grid-template-columns: repeat(5, minmax(110px, 1fr)); gap: 7px; margin-top: 21px; }
.overview-card { min-width: 0; height: 63px; display: flex; align-items: center; gap: 8px; border: 1px solid #dfe3e7; border-radius: 6px; padding: 8px; background: white; cursor: pointer; text-align: left; }
.overview-card:hover { border-color: #b9cfe1; background: #fbfdff; }
.overview-card .category-icon { flex: none; }
.overview-card div { min-width: 0; display: grid; gap: 3px; }
.overview-card strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; }
.overview-card small { color: #858d98; font-size: 8px; }
.result-row { display: flex; justify-content: space-between; margin: 22px 1px 9px; color: #808793; font-size: 8px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.component-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.component-card { overflow: hidden; border: 1px solid #dce1e6; border-radius: 7px; background: white; box-shadow: 0 3px 12px rgba(18,47,75,.055); }
.component-card-header { min-height: 92px; display: flex; align-items: start; justify-content: space-between; gap: 12px; padding: 14px; }
.component-card-header > div:first-child { min-width: 0; }
.component-tag { display: block; margin-bottom: 6px; color: #1670b8; font-size: 8px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.component-card h3 { margin: 0; color: #222832; font-size: 14px; font-weight: 600; }
.component-card-header p { margin: 5px 0 0; color: #7b828e; font-size: 9px; line-height: 1.45; }
.card-actions { display: flex; }
.preview-shell { position: relative; height: 220px; margin: 0 9px 9px; overflow: hidden; border: 1px solid #e0e4e8; border-radius: 5px; background: #f7f8fa; }
.preview-shell iframe { width: 100%; height: 100%; border: 0; background: white; }
.live-badge { position: absolute; z-index: 2; left: 7px; top: 7px; display: flex; align-items: center; gap: 5px; padding: 4px 6px; border: 1px solid #dce2e7; border-radius: 4px; background: rgba(255,255,255,.92); color: #66707c; font-size: 7px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.live-badge i { width: 5px; height: 5px; border-radius: 50%; background: #1bb077; }
.code-sections { border-top: 1px solid #e6e9ec; }
.code-sections details { border-bottom: 1px solid #e8eaed; }
.code-sections summary { height: 35px; display: flex; align-items: center; justify-content: space-between; padding: 0 12px; list-style: none; color: #59616d; font-size: 8px; font-weight: 700; letter-spacing: .07em; cursor: pointer; }
.code-sections summary::-webkit-details-marker { display: none; }
.code-sections summary > span:first-child { display: flex; align-items: center; gap: 7px; }
.language-dot { width: 6px; height: 6px; display: inline-block; border-radius: 50%; background: #e3674d; }
.language-dot.css { background: #4976d1; }
.language-dot.js { background: #ddb72e; }
.code-body { position: relative; max-height: 220px; overflow: auto; background: #171821; color: #e4e8ee; user-select: text; }
.code-body pre { margin: 0; padding: 14px; white-space: pre-wrap; word-break: break-word; }
.code-body code { font: 9px/1.55 Consolas, "Courier New", monospace; }
.copy-button { position: sticky; z-index: 1; top: 6px; float: right; margin: 6px; border: 1px solid rgba(255,255,255,.18); border-radius: 4px; padding: 4px 6px; background: rgba(255,255,255,.08); color: #d7dce2; font-size: 7px; cursor: pointer; }
.component-card-footer { min-height: 40px; display: flex; align-items: center; gap: 5px; padding: 0 12px; color: #8a919c; font-size: 8px; }
.component-card-footer strong { color: #59616d; }
.component-card-footer time { margin-left: auto; }
.component-grid > .empty-state { grid-column: 1 / -1; border: 1px dashed #cfd7df; border-radius: 7px; background: white; }

/* Modal */
.modal-backdrop { position: fixed; z-index: 10000; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(4, 18, 38, .45); backdrop-filter: blur(5px); }
.modal-dialog { width: min(94vw, 560px); max-height: min(90vh, 760px); display: grid; grid-template-rows: auto 1fr auto auto; overflow: hidden; border: 1px solid rgba(255,255,255,.8); border-radius: 8px; background: #f8f9fb; box-shadow: var(--shadow); }
.modal-dialog.modal-large { width: min(96vw, 1000px); }
.modal-dialog > header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #dfe3e7; background: white; }
.modal-dialog > header h2 { margin: 3px 0 0; font-size: 19px; font-weight: 600; }
.modal-dialog > header button { width: 34px; height: 34px; border: 0; border-radius: 4px; background: transparent; font-size: 20px; cursor: pointer; }
.modal-dialog > header button:hover { background: #eceff2; }
.modal-content { overflow: auto; padding: 18px; }
.modal-dialog > .form-message { min-height: 20px; padding: 0 18px; color: var(--danger) !important; }
.modal-dialog > footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid #dfe3e7; background: #f1f3f5; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field-grid .wide { grid-column: 1 / -1; }
.form-field { display: grid; gap: 6px; color: #4d5560; font-size: 10px; font-weight: 600; }
.form-field input, .form-field select, .form-field textarea { width: 100%; border: 1px solid #cbd2da; border-radius: 5px; background: white; color: #1f2630; outline: 0; }
.form-field input, .form-field select { height: 39px; padding: 0 10px; }
.form-field textarea { min-height: 110px; padding: 9px 10px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: #3185ca; box-shadow: 0 0 0 2px rgba(49,133,202,.12); }
.code-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin-top: 13px; }
.code-fields .form-field > span { display: flex; align-items: center; gap: 6px; }
.code-fields textarea { height: 240px; border-color: #30333e; background: #171821; color: #edf0f4; font: 10px/1.5 Consolas, monospace; }
.icon-name-grid { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
.icon-name-grid input:first-of-type { font-size: 19px; text-align: center; }
.delete-warning { margin: 0 0 15px; padding: 11px; border: 1px solid #efc8cd; border-radius: 5px; background: #fff1f3; color: #85303b; font-size: 11px; line-height: 1.5; }
.reason-field textarea { min-height: 100px; }

.toast-container { position: fixed; z-index: 11000; right: 18px; bottom: 63px; display: grid; gap: 7px; pointer-events: none; }
.toast { min-width: 245px; display: flex; align-items: center; gap: 9px; padding: 11px 13px; border: 1px solid rgba(255,255,255,.7); border-radius: 6px; background: rgba(249,251,253,.96); color: #303741; box-shadow: 0 9px 30px rgba(0,0,0,.22); backdrop-filter: blur(15px); animation: toastIn .18s ease-out; font-size: 10px; }
.toast > span { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: #daf2e8; color: #13734f; }
@keyframes toastIn { from { opacity: 0; transform: translateX(15px); } }

@media (max-width: 980px) {
  .category-overview { grid-template-columns: repeat(3, 1fr); }
  .component-grid { grid-template-columns: 1fr; }
  .library-header { align-items: start; flex-direction: column; }
  .library-actions { width: 100%; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; }
}

@media (max-width: 720px) {
  :root { --taskbar-height: 52px; }
  .login-clock { display: none; }
  .login-footer { left: 0; right: 0; justify-content: center; }
  .login-footer span:nth-child(2), .login-footer span:nth-child(3) { display: none; }
  .desktop-wallpaper img { width: 76vw; }
  .taskbar { justify-content: flex-start; padding-left: 7px; }
  .taskbar-search { display: none; }
  .system-tray > span, .system-tray > button:first-child { display: none; }
  .app-window { inset: 0 0 var(--taskbar-height) 0 !important; width: 100vw !important; height: calc(100vh - var(--taskbar-height)) !important; min-width: 0; max-width: none; max-height: none; border-radius: 0; resize: none; }
  .library-layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .library-sidebar { display: block; overflow-x: auto; padding: 6px; border-right: 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
  .sidebar-heading, .sidebar-user { display: none; }
  #categoryNav { display: flex; }
  .category-nav-item { min-width: max-content; }
  .category-actions { display: none !important; }
  .library-main { padding: 19px 13px; }
  .category-overview { grid-template-columns: repeat(2, 1fr); }
  .code-fields { grid-template-columns: 1fr; }
  .code-fields textarea { height: 130px; }
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .wide { grid-column: auto; }
}

@media (max-width: 480px) {
  .login-card { padding: 24px 20px; }
  .desktop-icons { grid-template-columns: repeat(2, 84px); }
  .system-tray .notification-button { display: none; }
  .tray-clock { width: 62px; }
  .start-menu { left: 7px; right: 7px; width: auto; transform: none; }
  @keyframes menuIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }
  .start-search { margin-left: 20px; margin-right: 20px; }
  .pinned-apps { grid-template-columns: repeat(3, 1fr); }
  .app-page-header h2, .library-header h2 { font-size: 27px; }
  .todo-app { padding: 20px 11px; }
  .open-count { display: none; }
  .todo-inputbar { height: auto; flex-wrap: wrap; }
  .todo-inputbar input { width: calc(100% - 40px); }
  .todo-inputbar button { width: 100%; }
  .library-actions { align-items: stretch; flex-direction: column; }
  .category-overview { grid-template-columns: 1fr; }
  .component-card-header { flex-direction: column; }
  .card-actions { align-self: flex-end; }
  .preview-shell { height: 190px; }
  .modal-backdrop { padding: 5px; }
  .modal-dialog { max-height: calc(100vh - 10px); }
  .modal-dialog > footer { flex-direction: column-reverse; }
}
