/* ===== Windows ===== */
.window {
  position: absolute; display: flex; flex-direction: column; overflow: hidden;
  border-radius: 12px;
  background: var(--win-bg);
  backdrop-filter: blur(30px) saturate(180%);
  -webkit-backdrop-filter: blur(30px) saturate(180%);
  box-shadow: var(--shadow-win), inset 0 0 0 0.5px var(--glass-stroke);
  color: var(--win-text);
  min-width: 320px; min-height: 200px;
  animation: winOpen .26s var(--ease-out);
  will-change: transform, width, height;
}
.window.closing { animation: winClose .18s var(--ease-out) forwards; }
.window.minimizing { transition: transform .38s var(--ease-out), opacity .38s; }
.window.inactive { box-shadow: 0 20px 60px rgba(0,0,0,.28), inset 0 0 0 .5px var(--glass-stroke-dark); }
.window.inactive .titlebar { opacity: .96; }
.window.max { border-radius: 0; }

/* Title bar */
.titlebar {
  height: 38px; flex: none; display: flex; align-items: center; gap: 8px;
  padding: 0 12px; position: relative; cursor: default;
  border-bottom: 0.5px solid var(--hairline);
}
.titlebar.solid { background: transparent; }
.traffic { display: flex; align-items: center; gap: 8px; }
.tl { width: 12px; height: 12px; border-radius: 50%; position: relative; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.16); }
.tl.close { background: #ff5f57; }
.tl.min { background: #febc2e; }
.tl.zoom { background: #28c840; }
.window.inactive .tl { background: #c9c9ce; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.12); }
:root[data-theme="dark"] .window.inactive .tl { background: #4b4b50; }
.tl svg { position: absolute; inset: 0; margin: auto; opacity: 0; transition: opacity .1s; }
.traffic:hover .tl svg { opacity: .55; }
.title-text { position: absolute; left: 0; right: 0; text-align: center; font-size: 13.5px; font-weight: 600; pointer-events: none; color: var(--win-text); opacity: .9; padding: 0 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.titlebar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; z-index: 1; }

/* Body */
.window-body { flex: 1; display: flex; overflow: hidden; position: relative; }
.window-content { flex: 1; overflow: auto; position: relative; }

/* Sidebar (Finder / Settings / Mail…) */
.sidebar {
  width: 210px; flex: none; overflow-y: auto; padding: 8px;
  background: var(--win-sidebar);
  border-right: 0.5px solid var(--hairline);
  font-size: 13px;
}
.sidebar .sb-head { font-size: 11px; font-weight: 600; color: var(--win-text-dim); padding: 10px 8px 4px; text-transform: none; letter-spacing: .2px; }
.sidebar .sb-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 7px; color: var(--win-text); margin-bottom: 1px; }
.sidebar .sb-item .sb-ico { width: 18px; height: 18px; display: grid; place-items: center; color: var(--accent); flex: none; }
.sidebar .sb-item:hover { background: var(--control-bg); }
.sidebar .sb-item.sel { background: rgba(var(--accent-rgb), .16); }
:root[data-theme="dark"] .sidebar .sb-item.sel { background: rgba(255,255,255,.12); }

/* Toolbar under titlebar */
.toolbar { height: 44px; flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-bottom: .5px solid var(--hairline); }
.tb-btn { width: 30px; height: 26px; border-radius: 7px; display: inline-grid; place-items: center; color: var(--win-text); opacity: .8; }
.tb-btn:hover { background: var(--control-bg); opacity: 1; }
.tb-btn.disabled { opacity: .3; pointer-events: none; }
.tb-spacer { flex: 1; }
.tb-search { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 8px; background: var(--control-bg); color: var(--win-text-dim); font-size: 13px; min-width: 160px; }
.tb-search input { background: none; border: none; outline: none; color: var(--win-text); font-size: 13px; width: 100%; }

/* Resize handles */
.resize { position: absolute; z-index: 5; }
.resize.n { top: -3px; left: 8px; right: 8px; height: 7px; cursor: ns-resize; }
.resize.s { bottom: -3px; left: 8px; right: 8px; height: 7px; cursor: ns-resize; }
.resize.e { right: -3px; top: 8px; bottom: 8px; width: 7px; cursor: ew-resize; }
.resize.w { left: -3px; top: 8px; bottom: 8px; width: 7px; cursor: ew-resize; }
.resize.ne { top: -4px; right: -4px; width: 12px; height: 12px; cursor: nesw-resize; }
.resize.nw { top: -4px; left: -4px; width: 12px; height: 12px; cursor: nwse-resize; }
.resize.se { bottom: -4px; right: -4px; width: 12px; height: 12px; cursor: nwse-resize; }
.resize.sw { bottom: -4px; left: -4px; width: 12px; height: 12px; cursor: nesw-resize; }

/* Empty / placeholder */
.empty-state { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: var(--win-text-dim); text-align: center; padding: 30px; }
.empty-state svg { opacity: .4; }
