/* NoelOS — layout, taskbar, start menu, app styling. Window chrome comes from 7.css. */
:root {
  --w7-font: 9pt "Noto Sans", "Open Sans", "DejaVu Sans", system-ui, sans-serif;
  --taskbar-h: 40px;
  --glass: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,.04) 45%, rgba(0,0,0,.12) 50%, rgba(255,255,255,.1));
  --glass-bg: rgba(24, 58, 110, .62);
  --focus: 2px solid #ffd54a;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; background: #0a2c66; }
body { font: var(--w7-font); font-size: 13px; color: #111; -webkit-tap-highlight-color: transparent; }
button, a, input, textarea { font-family: inherit; }
:focus-visible { outline: var(--focus); outline-offset: 1px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.noscript { position: fixed; inset: 0; z-index: 99999; background: #0a2c66; color: #fff; display: grid; place-content: center; text-align: center; padding: 24px; }
.noscript a { color: #9fe3ff; }

#desktop { position: fixed; inset: 0 0 var(--taskbar-h) 0; overflow: hidden; user-select: none; -webkit-user-select: none; }
#wallpaper { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#desktop.refreshing #icons { animation: refresh .25s steps(2) 1; }
@keyframes refresh { 50% { opacity: 0; } }

/* Flat buttons: neutralize 7.css button chrome; states are driven by --bg / --bd / --ring / --ts */
:is(button.dicon, button.orb-btn, button.task-btn, button.show-desktop, .start-list button, .start-links button, button.shutdown, .ctx button, .ex-nav button, button.ex-item, button.btn-link) { min-width: 0; min-height: 0; }
:is(button.dicon, button.orb-btn, button.task-btn, button.show-desktop, .start-list button, .start-links button, button.shutdown, .ctx button, .ex-nav button, button.ex-item, button.btn-link):is(:not(:disabled):not(:hover), :not(:disabled):hover, :not(:disabled):active, :focus, :focus-visible) {
  box-shadow: var(--ring, none); animation: none; transition: none; text-shadow: var(--ts, none); outline: none;
  border: 1px solid var(--bd, transparent); background: var(--bg, none);
}
:is(button.dicon, button.orb-btn, button.task-btn, button.show-desktop, .start-list button, .start-links button, button.shutdown, .ctx button, .ex-nav button, button.ex-item, button.btn-link)::before,
:is(button.dicon, button.orb-btn, button.task-btn, button.show-desktop, .start-list button, .start-links button, button.shutdown, .ctx button, .ex-nav button, button.ex-item, button.btn-link)::after { display: none; }
:is(button.dicon, button.task-btn, .start-list button, .start-links button, button.shutdown, .ctx button, .ex-nav button, button.ex-item):focus-visible { --ring: 0 0 0 2px #ffd54a; }
.orb-btn { border-color: transparent; }

/* Desktop icons */
#icons { position: absolute; inset: 0; padding: 10px; display: flex; flex-flow: column wrap; align-content: flex-start; gap: 4px; pointer-events: none; }
.dicon { pointer-events: auto; width: 84px; padding: 6px 4px 4px; border-radius: 4px; color: #fff; text-align: center; cursor: default; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; line-height: 1.2; --ts: 0 1px 2px #000, 0 0 4px rgba(0,0,0,.8); }
.dicon svg { width: 48px; height: 48px; filter: drop-shadow(0 2px 2px rgba(0,0,0,.45)); }
.dicon:hover { --bg: rgba(255,255,255,.15); --bd: rgba(255,255,255,.3); }
.dicon.selected, .dicon:focus-visible { --bg: rgba(120,190,255,.35); --bd: rgba(190,225,255,.7); }

/* Windows */
#windows { position: absolute; inset: 0; pointer-events: none; }
.win { position: absolute; pointer-events: auto; display: flex; flex-direction: column; min-width: 0; max-width: 100%; }
.win.opening { animation: win-in .16s ease-out; }
.win.minimizing { animation: win-out .16s ease-in forwards; }
@keyframes win-in { from { opacity: 0; transform: scale(.96) translateY(8px); } }
@keyframes win-out { to { opacity: 0; transform: scale(.9) translateY(40px); } }
.win.maximized { inset: 0 !important; width: auto !important; height: auto !important; }
.win.maximized > .title-bar, .win.maximized { border-radius: 0; }
.win > .title-bar { cursor: default; touch-action: none; user-select: none; -webkit-user-select: none; flex: none; }
.win .title-bar-text { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-top: 2px; }
.win .title-bar-text svg { width: 16px; height: 16px; flex: none; }
.win > .window-body { flex: 1; min-height: 0; overflow: auto; margin-bottom: var(--w7-w-space); position: relative; }
.win:focus { outline: none; }
.win-body-flush { padding: 0; margin: 0; }
@media (max-width: 699px) {
  .win .is-maximize, .win .is-restore { display: none; }
}

/* Taskbar */
.taskbar { position: fixed; left: 0; right: 0; bottom: 0; height: var(--taskbar-h); z-index: 100000; display: flex; align-items: stretch; gap: 6px; padding: 0 0 0 4px; background: var(--glass), var(--glass-bg); -webkit-backdrop-filter: blur(10px) saturate(1.4); backdrop-filter: blur(10px) saturate(1.4); border-top: 1px solid rgba(255,255,255,.55); box-shadow: 0 -1px 0 rgba(0,0,0,.5), inset 0 1px 0 rgba(255,255,255,.25); }
.orb-btn { width: 52px; flex: none; padding: 0; display: grid; place-items: center; cursor: pointer; margin-top: -6px; }
.orb { position: relative; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 50% 120%, #7fe3ff 0, rgba(127,227,255,0) 55%), radial-gradient(circle at 50% 35%, #4ea7ee 0, #1c5cb4 55%, #0a2b6b 100%); border: 2px solid rgba(220,242,255,.9); box-shadow: 0 0 10px 1px rgba(90,190,255,.8), inset 0 -4px 8px rgba(120,230,255,.6), 0 2px 4px rgba(0,0,0,.6); transition: box-shadow .15s, filter .15s; }
.orb::before { content: ""; position: absolute; left: 12%; right: 12%; top: 3%; height: 46%; border-radius: 50%; background: linear-gradient(rgba(255,255,255,.85), rgba(255,255,255,.05)); }
.orb-n { position: relative; font: 700 21px/1 "Noto Sans", system-ui, sans-serif; color: #fff; text-shadow: 0 0 6px rgba(160,230,255,.95), 0 1px 1px rgba(0,30,80,.8); margin-top: 1px; }
.orb-btn:hover .orb, .orb-btn[aria-expanded="true"] .orb { filter: brightness(1.18); box-shadow: 0 0 16px 4px rgba(120,215,255,.95), inset 0 -4px 8px rgba(140,240,255,.8), 0 2px 4px rgba(0,0,0,.6); }
.orb-btn:focus-visible { outline: none; }
.orb-btn:focus-visible .orb { box-shadow: 0 0 0 3px #ffd54a, 0 0 12px 3px rgba(120,215,255,.9); }

.tasks { flex: 1; min-width: 0; display: flex; gap: 3px; padding: 4px 0; overflow: hidden; }
.task-btn { flex: 0 1 160px; min-width: 38px; display: flex; align-items: center; gap: 6px; padding: 0 8px; color: #fff; font-size: 12px; --ts: 0 1px 2px rgba(0,0,0,.7); --bg: linear-gradient(rgba(255,255,255,.22), rgba(255,255,255,.05) 50%, rgba(0,0,0,.1) 50%, rgba(255,255,255,.08)); --bd: rgba(255,255,255,.35); --ring: inset 0 0 0 1px rgba(255,255,255,.12); border-radius: 4px; cursor: pointer; overflow: hidden; }
.task-btn svg { width: 20px; height: 20px; flex: none; }
.task-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-btn:hover { --bg: linear-gradient(rgba(255,255,255,.4), rgba(160,215,255,.2) 50%, rgba(80,160,230,.25) 50%, rgba(200,240,255,.3)); --bd: rgba(255,255,255,.7); }
.task-btn.active { --bg: linear-gradient(rgba(255,255,255,.45), rgba(150,210,255,.25) 50%, rgba(60,140,220,.35) 50%, rgba(160,225,255,.4)); --bd: rgba(255,255,255,.85); --ring: inset 0 0 8px rgba(160,225,255,.7); }
.task-btn.minimized { opacity: .75; }
.tray { display: flex; align-items: center; gap: 8px; padding: 0 0 0 10px; color: #fff; }
.tray-ico { display: grid; place-items: center; }
.clock { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; line-height: 1.25; text-align: center; min-width: 64px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.7); }
.show-desktop { width: 14px; height: 100%; --bg: linear-gradient(90deg, rgba(255,255,255,.6) 1px, rgba(255,255,255,.15) 1px, rgba(255,255,255,.04)); padding: 0; cursor: pointer; }
.show-desktop:hover { --bg: linear-gradient(90deg, rgba(255,255,255,.8) 1px, rgba(255,255,255,.4) 1px); }

/* Start menu */
.glass-panel { background: var(--glass), rgba(26, 62, 118, .78); -webkit-backdrop-filter: blur(14px) saturate(1.5); backdrop-filter: blur(14px) saturate(1.5); border: 1px solid rgba(255,255,255,.6); box-shadow: 0 0 0 1px rgba(0,0,0,.55), 0 6px 24px rgba(0,0,0,.6), inset 0 0 0 1px rgba(255,255,255,.2); }
.start { position: fixed; left: 4px; bottom: calc(var(--taskbar-h) + 2px); z-index: 99999; width: min(440px, calc(100vw - 8px)); height: min(460px, calc(100vh - var(--taskbar-h) - 10px)); border-radius: 8px 8px 4px 4px; display: flex; padding: 6px; gap: 6px; color: #fff; }
.start[hidden], .ctx[hidden], .shutdown-overlay[hidden] { display: none; }
.start-left { flex: 1.25; background: rgba(255,255,255,.94); border-radius: 4px; color: #1a1a1a; display: flex; flex-direction: column; border: 1px solid rgba(0,0,0,.35); min-width: 0; }
.start-list, .start-links { list-style: none; margin: 0; padding: 4px; }
.start-list { flex: 1; overflow: auto; }
.start-list button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 3px; color: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.start-list button svg { width: 28px; height: 28px; flex: none; }
.start-list button:hover, .start-list button:focus-visible { --bg: linear-gradient(#e8f4ff, #bfdcf8); --bd: #7fb4e6; }
.start-search { margin: 4px; padding: 5px 8px; border: 1px solid #9ab; border-radius: 3px; color: #789; font-size: 12px; background: #fff; }
.start-right { flex: 1; display: flex; flex-direction: column; min-width: 0; padding: 4px 2px 2px; }
.user-tile { display: flex; align-items: center; gap: 10px; padding: 4px 6px 10px; font-size: 18px; text-shadow: 0 1px 3px rgba(0,0,0,.8); }
.user-tile img { border: 2px solid rgba(255,255,255,.85); border-radius: 6px; box-shadow: 0 0 8px rgba(130,210,255,.8); }
.start-links { flex: 1; overflow: auto; }
.start-links a, .start-links button { display: block; width: 100%; padding: 6px 8px; color: #fff; border-radius: 3px; text-decoration: none; text-align: left; font-size: 13px; cursor: pointer; --ts: 0 1px 2px rgba(0,0,0,.6); border: 1px solid transparent; text-shadow: var(--ts); }
.start-links a:hover, .start-links a:focus-visible { background: rgba(255,255,255,.22); border-color: rgba(255,255,255,.5); outline: none; }
.start-links button:hover, .start-links button:focus-visible { --bg: rgba(255,255,255,.22); --bd: rgba(255,255,255,.5); }
.start-bottom { padding: 6px 2px 2px; display: flex; justify-content: flex-start; }
.shutdown { padding: 5px 16px; color: #fff; font-size: 13px; cursor: pointer; border-radius: 4px; --bd: rgba(255,255,255,.55); --bg: linear-gradient(rgba(255,255,255,.3), rgba(255,255,255,.05) 50%, rgba(0,0,0,.2) 50%, rgba(255,255,255,.1)); --ts: 0 1px 2px rgba(0,0,0,.7); }
.shutdown:hover, .shutdown:focus-visible { --bg: linear-gradient(#f9a090, #d9503a 50%, #b3301c 50%, #e56d58); }

.shutdown-overlay { position: fixed; inset: 0; z-index: 200000; background: #02060f; color: #cfe8ff; display: grid; place-items: center; text-align: center; cursor: pointer; }
.shutdown-overlay p { margin: 6px 0; font-size: 20px; }
.shutdown-hint { font-size: 13px !important; opacity: .6; }
.spinner { width: 36px; height: 36px; margin: 0 auto 18px; border: 4px solid rgba(120,190,255,.25); border-top-color: #7fd0ff; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Context menu */
.ctx { position: fixed; z-index: 150000; min-width: 190px; background: #f2f2f2; border: 1px solid #868686; border-radius: 3px; box-shadow: 2px 3px 8px rgba(0,0,0,.45), inset 0 0 0 1px #fff; padding: 2px; }
.ctx button { display: block; width: 100%; text-align: left; padding: 5px 24px 5px 26px; border-radius: 2px; font-size: 12px; color: #111; cursor: pointer; }
.ctx button:hover, .ctx button:focus-visible { --bg: linear-gradient(#f2f9ff, #cfe5fa); --bd: #8fbbe6; }
.ctx hr { margin: 2px 4px; border: 0; border-top: 1px solid #ccc; }

/* ---------- Apps ---------- */
.app-pad { padding: 12px 16px; }
.app-body { height: 100%; display: flex; flex-direction: column; min-height: 0; }
.app-body h2 { margin: 0 0 8px; font-size: 17px; font-weight: 600; color: #1a3a6b; }
.app-body h3 { margin: 14px 0 4px; font-size: 13px; color: #1a3a6b; }
.app-body p { margin: 0 0 8px; line-height: 1.5; }
.app-body ul { margin: 0 0 8px; padding-left: 20px; line-height: 1.5; }
.app-body a { color: #0b57b0; }
.about-tabs { display: flex; flex-direction: column; height: 100%; padding: 8px 8px 0; min-height: 0; }
.about-tabs [role=tabpanel] { flex: 1; overflow: auto; min-height: 0; }
.about-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 8px; }
.about-hero img { width: 72px; height: 72px; border-radius: 8px; flex: none; }
.about-hero h2 { margin: 0; font-size: 22px; }
.about-hero p { margin: 2px 0 0; color: #456; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; padding: 0 !important; list-style: none; }
.chips li { padding: 2px 8px; border: 1px solid #9bb8d8; border-radius: 10px; background: linear-gradient(#fff, #dbe9f7); font-size: 12px; }
.btn-link, a.btn-link { display: inline-block; padding: 4px 14px; --bd: #707070; --bg: linear-gradient(#f2f2f2 45%, #dcdcdc 50%, #cfcfcf); border: 1px solid var(--bd); background: var(--bg); border-radius: 3px; color: #111 !important; text-decoration: none; font-size: 12px; cursor: pointer; }
.btn-link:hover { --bd: #3c7fb1; --bg: linear-gradient(#eaf6fd 45%, #bee6fd 50%, #a7d9f5); }

.toolbar { display: flex; align-items: center; gap: 6px; padding: 5px 8px; background: linear-gradient(#fff, #e4ecf6); border-bottom: 1px solid #b4c3d6; flex: none; flex-wrap: wrap; }
.toolbar .title { font-weight: 600; color: #1a3a6b; margin-right: auto; }
.paper-wrap { flex: 1; overflow: auto; background: #7f8fa6; padding: 14px; min-height: 0; }
.paper { max-width: 760px; margin: 0 auto; background: #fff; padding: 28px 34px; box-shadow: 0 2px 10px rgba(0,0,0,.4); font: 14px/1.5 "Noto Serif", Georgia, serif; color: #222; }
.paper h1 { font: 700 26px/1.2 "Noto Sans", sans-serif; margin: 0; color: #12305e; }
.paper .sub { color: #555; margin: 2px 0 12px; font: 13px "Noto Sans", sans-serif; }
.paper h2 { font: 700 13px "Noto Sans", sans-serif; letter-spacing: .08em; text-transform: uppercase; color: #12305e; border-bottom: 2px solid #2f6db5; margin: 18px 0 8px; padding-bottom: 2px; }
.paper .role { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-weight: 700; margin-top: 10px; }
.paper .role small { font-weight: 400; color: #555; }
.paper .org { color: #444; font-style: italic; margin: 0; }
.paper ul { margin: 4px 0 6px; padding-left: 20px; }
.paper li { margin: 2px 0; }
.paper p { margin: 4px 0; }
@media (max-width: 699px) { .paper { padding: 18px 16px; } .paper-wrap { padding: 8px; } }

/* Explorer */
.explorer { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.addr-row { display: flex; gap: 6px; align-items: center; padding: 5px 8px; background: linear-gradient(#fff, #e4ecf6); border-bottom: 1px solid #b4c3d6; flex: none; }
.addr-row input { flex: 1; min-width: 0; height: 24px; }
.addr-row button { min-width: 28px; padding: 0 6px; }
.ex-main { flex: 1; display: flex; min-height: 0; }
.ex-nav { width: 160px; flex: none; padding: 8px 4px; background: linear-gradient(#f6f9fd, #e6eef8); border-right: 1px solid #b4c3d6; overflow: auto; }
.ex-nav h4 { margin: 8px 6px 4px; font-size: 12px; color: #1a3a6b; }
.ex-nav button { display: flex; align-items: center; gap: 6px; width: 100%; background: none; border: 1px solid transparent; border-radius: 3px; padding: 3px 6px; font-size: 12px; text-align: left; cursor: pointer; }
.ex-nav button svg { width: 18px; height: 18px; flex: none; }
.ex-nav button:hover { --bg: #dbeaf9; --bd: #9fc4ea; }
.ex-nav button.sel { --bg: #cde4fa; --bd: #7fb0e3; }
.ex-content { flex: 1; min-width: 0; display: flex; flex-direction: column; background: #fff; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 6px; padding: 10px; align-content: start; overflow: auto; flex: 1; }
.ex-item { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 3px; text-align: center; font-size: 12px; cursor: pointer; color: #111; }
.ex-item svg { width: 48px; height: 48px; }
.ex-item:hover { --bg: #e8f2fc; --bd: #c4dbf3; }
.ex-item.sel { --bg: #cde4fa; --bd: #7fb0e3; }
.ex-detail { flex: none; max-height: 48%; overflow: auto; border-top: 1px solid #b4c3d6; padding: 10px 14px; background: linear-gradient(#f9fbfe, #eaf1f9); }
.ex-detail h3 { margin: 0 0 4px; font-size: 15px; color: #12305e; }
.ex-detail p { margin: 0 0 6px; line-height: 1.45; }
.ex-detail .meta { color: #456; font-size: 12px; }
.ex-detail pre { background: #fff; border: 1px solid #b4c3d6; padding: 8px; white-space: pre-wrap; margin: 6px 0; font: 12px/1.45 "DejaVu Sans Mono", Consolas, monospace; }
.status { display: flex; gap: 12px; padding: 3px 10px; font-size: 12px; color: #345; background: #eef3f9; border-top: 1px solid #b4c3d6; flex: none; }
@media (max-width: 699px) { .ex-nav { display: none; } .ex-detail { max-height: 55%; } }

/* Mail */
.mail { display: flex; height: 100%; min-height: 0; }
.mail-nav { width: 150px; flex: none; background: linear-gradient(#f6f9fd, #e6eef8); border-right: 1px solid #b4c3d6; padding: 8px 4px; font-size: 12px; overflow: auto; }
.mail-nav div { padding: 4px 8px; border-radius: 3px; }
.mail-nav div.sel { background: #cde4fa; border: 1px solid #7fb0e3; padding: 3px 7px; }
.mail-main { flex: 1; overflow: auto; padding: 12px 14px; min-width: 0; }
.mail-card { border: 1px solid #b4c3d6; border-radius: 4px; padding: 8px 12px; margin-bottom: 12px; background: linear-gradient(#fff, #f1f6fb); }
.mail-card p { margin: 3px 0; }
.mail-form { display: grid; grid-template-columns: 64px 1fr; gap: 6px 8px; align-items: center; }
.mail-form label { text-align: right; font-size: 12px; color: #345; }
.mail-form input, .mail-form textarea { width: 100%; font-size: 13px; }
.mail-form textarea { resize: vertical; min-height: 110px; }
.mail-form .actions { grid-column: 2; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.note { font-size: 12px; color: #456; margin: 6px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 699px) { .mail-nav { display: none; } .mail-form { grid-template-columns: 1fr; } .mail-form label { text-align: left; } .mail-form .actions { grid-column: 1; } }

/* Terminal */
.term { height: 100%; background: #0c0c0c; color: #cfcfcf; font: 14px/1.35 "DejaVu Sans Mono", "Cascadia Mono", Consolas, "Liberation Mono", monospace; padding: 6px 8px; overflow: auto; cursor: text; }
.term-out { white-space: pre-wrap; word-break: break-word; }
.term-out div { min-height: 1.35em; }
.term-out a { color: #6cf; }
.term .ok { color: #5f5; } .term .warn { color: #fd5; } .term .err { color: #f66; } .term .dim { color: #8a8a8a; }
.term-line { display: flex; align-items: baseline; }
.term-prompt { white-space: pre; flex: none; }
.term input.term-input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: #fff; font: inherit; padding: 0 0 0 2px; caret-color: #fff; caret-shape: block; box-shadow: none; height: auto; border-radius: 0; }
.term input.term-input:focus { outline: 0; background: transparent; box-shadow: none; }
.term-busy .term-line { visibility: hidden; }

.bin-file { text-align: left; }
.dialog-body { display: flex; gap: 14px; align-items: flex-start; padding: 16px; }
.dialog-body svg { width: 48px; height: 48px; flex: none; }

@media (prefers-reduced-motion: reduce) {
  .win.opening, .win.minimizing, #desktop.refreshing #icons { animation: none !important; }
  .spinner { animation-duration: 3s; }
  * { transition: none !important; }
}
@media (max-width: 699px) {
  .dicon { width: 76px; }
  .task-btn { flex-basis: 40px; }
  .task-btn span { display: none; }
  .tray .tray-ico { display: none; }
  .clock { min-width: 58px; }
}
