/* Host page of the DASAPT web app: the desktop frame (menu bar, windows, dialogs) around the original pages. */
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font: 13px "Segoe UI", system-ui, -apple-system, "Microsoft YaHei", sans-serif; background: #1e1f24; color: #1f2937; }
body { display: flex; flex-direction: column; }
#menubar { flex: none; display: flex; background: #f3f4f6; border-bottom: 1px solid #d1d5db; user-select: none; overflow-x: auto; scrollbar-width: none; position: relative; z-index: 30000; }
#menubar::-webkit-scrollbar { display: none; }
#menubar > .top { padding: 4px 10px; cursor: default; white-space: nowrap; }
#menubar > .top:hover, #menubar > .top.open { background: #dbeafe; }
.drop { position: fixed; z-index: 30001; min-width: 220px; background: #fff; border: 1px solid #c7ccd4; box-shadow: 0 6px 18px rgba(0,0,0,.18); padding: 3px 0; max-height: calc(100vh - 40px); overflow-y: auto; }
.drop .it { display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 26px; white-space: nowrap; position: relative; cursor: default; }
.drop .it:hover:not(.off) { background: #dbeafe; }
.drop .it.off { color: #9ca3af; }
.drop .it .acc { margin-left: auto; color: #6b7280; font-size: 12px; padding-left: 24px; }
.drop .it .chk { position: absolute; left: 9px; }
.drop .it.sub::after { content: '▸'; margin-left: auto; padding-left: 16px; color: #6b7280; }
.drop .sep { height: 1px; background: #e5e7eb; margin: 3px 0; }
#desk { flex: 1; position: relative; overflow: hidden; }
.win { position: absolute; display: flex; flex-direction: column; background: #f8fafc; border: 1px solid #9ca3af; box-shadow: 0 10px 30px rgba(0,0,0,.35); min-width: 160px; min-height: 90px; }
.win.main { inset: 0; border: 0; box-shadow: none; }
.win.main > .bar { display: none; }
.win.focused { border-color: #2563eb; }
.win > .bar { flex: none; display: flex; align-items: center; height: 30px; background: #e5e7eb; border-bottom: 1px solid #cbd5e1; user-select: none; touch-action: none; }
.win.focused > .bar { background: #dbeafe; }
.win > .bar .title { flex: 1; padding: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: move; line-height: 30px; }
.win > .bar button { border: 0; background: transparent; width: 40px; height: 30px; font-size: 14px; cursor: pointer; color: #374151; }
.win > .bar button:hover { background: #cbd5e1; }
.win > .bar button.x:hover { background: #e81123; color: #fff; }
.win > iframe { flex: 1; width: 100%; border: 0; background: #fff; display: block; }
.win > .grip { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 50%, #9ca3af 50%, #9ca3af 60%, transparent 60%, transparent 70%, #9ca3af 70%, #9ca3af 80%, transparent 80%); }
.win.max { inset: 0 !important; width: auto !important; height: auto !important; }
.win.max > .grip { display: none; }
.win.hidden, .win.min { display: none; }
#desk.dragging iframe { pointer-events: none; }
.backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.25); }
#taskbar { flex: none; display: none; gap: 4px; padding: 3px 6px; background: #e5e7eb; border-top: 1px solid #cbd5e1; overflow-x: auto; }
#taskbar.on { display: flex; }
#taskbar button { border: 1px solid #cbd5e1; background: #fff; border-radius: 4px; padding: 2px 10px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
#modals { position: fixed; inset: 0; pointer-events: none; z-index: 40000; }
#modals > .mask { position: absolute; inset: 0; background: rgba(15,23,42,.35); pointer-events: auto; display: flex; align-items: center; justify-content: center; padding: 12px; }
.dlg { background: #fff; color: #111827; min-width: 300px; max-width: min(620px, 100%); max-height: 100%; overflow: auto; border: 1px solid #9ca3af; box-shadow: 0 16px 40px rgba(0,0,0,.35); }
.dlg .dt { padding: 8px 12px; background: #e5e7eb; border-bottom: 1px solid #cbd5e1; font-weight: 600; }
.dlg .db { padding: 14px 16px; white-space: pre-wrap; line-height: 1.45; }
.dlg .db .msg { font-weight: 600; margin-bottom: 6px; }
.dlg .db .det { color: #374151; }
.dlg .db input[type=text] { width: 100%; padding: 5px 7px; border: 1px solid #9ca3af; font: inherit; margin-top: 6px; }
.dlg .df { display: flex; gap: 8px; justify-content: flex-end; padding: 10px 14px; background: #f9fafb; border-top: 1px solid #e5e7eb; flex-wrap: wrap; }
.dlg .df label { margin-right: auto; display: flex; align-items: center; gap: 6px; }
.dlg button { min-width: 84px; padding: 5px 12px; border: 1px solid #9ca3af; background: #fff; font: inherit; cursor: pointer; }
.dlg button.def { background: #2563eb; border-color: #2563eb; color: #fff; }
#boot { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; color: #cbd5e1; font-size: 18px; background: #1e1f24; z-index: 50000; }
#boot.gone { display: none; }
#boot.err { color: #fecaca; white-space: pre-wrap; padding: 30px; font-size: 14px; }
.toast { position: fixed; right: 12px; bottom: 12px; z-index: 45000; background: #111827; color: #f9fafb; padding: 8px 12px; border-radius: 6px; max-width: 360px; box-shadow: 0 6px 18px rgba(0,0,0,.3); }
@media (max-width: 760px) {
  #menubar > .top { padding: 8px 10px; }
  .drop .it { padding: 9px 14px 9px 26px; }
  .win:not(.main) { inset: 0 !important; width: auto !important; height: auto !important; }
  .win > .grip { display: none; }
  /* keep the desktop layout: windows keep a desktop width and pan sideways */
  .win { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; }
  .win.main > iframe { min-width: 1024px; }
  .win:not(.main) > iframe { min-width: 820px; }
  .win > .bar { position: sticky; left: 0; min-width: 0; }
  .win > .bar { height: 36px; }
  .win > .bar .title { line-height: 36px; }
  .win > .bar button { height: 36px; width: 44px; }
}
