/* ── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Page ───────────────────────────────────────────────────────────────── */
html, body {
  height: 100%;
  background: #008080;
  font-family: Verdana, Arial, sans-serif;
  font-size: 11px;
  color: #000000;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  min-height: 100vh;
}

/* Subtle embossed seal watermark tiled across the desktop (non-login pages only) */
body.desktop::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url('sabnock-seal.png');
  background-repeat: repeat;
  background-size: 180px 180px;
  opacity: 0.07;
  mix-blend-mode: luminosity;
  pointer-events: none;
  z-index: 0;
}

/* ── Taskbar ─────────────────────────────────────────────────────────────── */
.taskbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 28px;
  background: #D4D0C8;
  border-top: 2px solid #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 4px;
  z-index: 50;
  gap: 4px;
}

.start-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 1px 6px;
  font-weight: bold;
  font-size: 11px;
  min-width: auto;
}

.start-btn.pressed,
.start-btn:active {
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  box-shadow: none;
  padding: 2px 5px 0 7px;
}

.start-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  image-rendering: pixelated;
}

.taskbar-sep-v {
  width: 1px;
  height: 20px;
  background: #808080;
  border-right: 1px solid #FFFFFF;
  flex-shrink: 0;
}

.taskbar-tiles {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 4px;
  overflow: hidden;
  min-width: 0;
}

.taskbar-tile {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  min-width: 120px;
  max-width: 200px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: normal;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

/* Sunken + bold = window is the active/visible window */
.taskbar-tile.tile-active {
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  box-shadow: none;
  padding: 2px 5px 0 7px;
  background: #C0C0C0;
  font-weight: bold;
}

/* ── System tray (notification area) ────────────────────────────────────── */
/* One recessed box containing all tray widgets + clock, matching Win98 */
.tray-area {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 6px;
  gap: 8px;
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  flex-shrink: 0;
}

#taskbar-clock {
  font-size: 11px;
  white-space: nowrap;
  padding: 0 2px;
}

/* ── Tray widgets ────────────────────────────────────────────────────────── */
.tray-widget {
  position: relative;  /* anchor for tooltip ::after */
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  white-space: nowrap;
  cursor: default;
  flex-shrink: 0;
  user-select: none;
  letter-spacing: 1px;
}

.tray-clickable { cursor: pointer; }
.tray-clickable:hover { background: rgba(0,0,0,0.06); }
.tray-clickable:active { background: rgba(0,0,0,0.12); }

/* Jellyfin ping — icon on a status-colored square */
.ping-sq {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #555555; /* default: unconfigured */
  flex-shrink: 0;
}

.ping-icon {
  width: 11px;
  height: 11px;
  object-fit: contain;
  filter: brightness(0) invert(1); /* render white so it reads on any status color */
}

/* Win98-style yellow tooltip appearing above each widget */
.tray-widget[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: #FFFFE1;
  color: #000000;
  border: 1px solid #000000;
  padding: 2px 5px;
  font-size: 10px;
  font-family: Verdana, Arial, sans-serif;
  white-space: nowrap;
  pointer-events: none;
  z-index: 9999;
}

/* ── Inbox popup ─────────────────────────────────────────────────────────── */
.inbox-popup {
  display: none;
  position: fixed;
  bottom: 32px;
  width: 260px;
  background: #D4D0C8;
  border-top:   2px solid #FFFFFF;
  border-left:  2px solid #FFFFFF;
  border-right: 2px solid #808080;
  border-bottom: 2px solid #808080;
  box-shadow: 2px 2px 0 #000000;
  z-index: 9998;
  font-size: 11px;
}

.inbox-popup-body {
  padding: 4px 6px;
  max-height: 180px;
  overflow-y: auto;
}

.inbox-popup-item {
  padding: 2px 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-family: 'Courier New', monospace;
  font-size: 10px;
}

.inbox-popup-item:hover { background: #000080; color: #FFFFFF; }

/* ── Start Menu ──────────────────────────────────────────────────────────── */
.start-menu {
  display: none;
  position: fixed;
  bottom: 28px;
  left: 0;
  width: 210px;
  background: #D4D0C8;
  border-top:   2px solid #FFFFFF;
  border-right: 2px solid #808080;
  border-left:  2px solid #FFFFFF;
  box-shadow: 2px 2px 0 #000000;
  z-index: 60;
  flex-direction: row;
}

.start-sidebar {
  background: linear-gradient(to top, #000080, #1084D0);
  width: 22px;
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 6px;
}

.start-sidebar-text {
  color: #FFFFFF;
  font-size: 11px;
  font-weight: bold;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  letter-spacing: 1px;
  white-space: nowrap;
  user-select: none;
}

.start-items {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 2px 0;
}

.start-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 8px;
  text-decoration: none;
  color: #000000;
  font-size: 12px;
  font-family: Verdana, Arial, sans-serif;
  cursor: default;
  white-space: nowrap;
}

.start-item:hover { background: #000080; color: #FFFFFF; }

.start-item-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }

.start-sep {
  height: 1px;
  background: #808080;
  border-bottom: 1px solid #FFFFFF;
  margin: 3px 4px;
}

/* ── Window chrome ──────────────────────────────────────────────────────── */
.window {
  background: #D4D0C8;
  border-top:    2px solid #FFFFFF;
  border-left:   2px solid #FFFFFF;
  border-right:  2px solid #808080;
  border-bottom: 2px solid #808080;
  box-shadow: 2px 2px 0 #000000;
  width: 100%;
  max-width: 780px;
  margin-bottom: 8px;
}

.window-full {
  position: fixed;
  /* CSS pre-centers before JS runs — JS overrides immediately, no flash */
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  /* Fixed rectangle — no dynamic resizing, content scrolls inside */
  width: 860px;
  height: 580px;
  max-width:  96vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

/* Content area scrolls; title/menu/status bars stay pinned */
.window-full > .window-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.title-bar {
  background: linear-gradient(to right, #000080, #1084D0);
  color: #FFFFFF;
  font-weight: bold;
  font-size: 11px;
  padding: 3px 4px 3px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.title-bar-icon { margin-right: 4px; }

.title-bar-title { flex: 1; }

.title-bar-controls { display: flex; gap: 2px; }

.title-bar-controls button {
  width: 16px;
  height: 14px;
  background: #D4D0C8;
  border-top:    1px solid #FFFFFF;
  border-left:   1px solid #FFFFFF;
  border-right:  1px solid #808080;
  border-bottom: 1px solid #808080;
  font-size: 9px;
  font-family: Verdana, Arial, sans-serif;
  line-height: 1;
  padding: 0;
  cursor: default;
  color: #000000;
}

.window-body { padding: 8px; }

/* ── Menu bar ───────────────────────────────────────────────────────────── */
.menu-bar {
  background: #D4D0C8;
  border-bottom: 1px solid #808080;
  padding: 2px 4px;
  font-size: 11px;
  display: flex;
  gap: 0;
}

.menu-bar a {
  display: inline-block;
  padding: 2px 8px;
  text-decoration: none;
  color: #000000;
}

.menu-bar a:hover {
  background: #000080;
  color: #FFFFFF;
}

.menu-bar a.active {
  background: #000080;
  color: #FFFFFF;
}

/* ── Toolbar ────────────────────────────────────────────────────────────── */
.toolbar {
  background: #D4D0C8;
  border-bottom: 1px solid #808080;
  padding: 3px 6px;
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.toolbar-sep {
  width: 1px;
  height: 20px;
  background: #808080;
  border-right: 1px solid #FFFFFF;
  margin: 0 2px;
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
button, .btn, input[type="submit"], input[type="button"] {
  background: #D4D0C8;
  border-top:    1px solid #FFFFFF;
  border-left:   1px solid #FFFFFF;
  border-right:  1px solid #808080;
  border-bottom: 1px solid #808080;
  box-shadow: 1px 1px 0 #000000;
  padding: 4px 12px;
  font-family: Verdana, Arial, sans-serif;
  font-size: 11px;
  cursor: pointer;
  color: #000000;
  min-width: 75px;
}

button:active, .btn:active,
input[type="submit"]:active, input[type="button"]:active {
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  box-shadow: none;
  padding: 5px 11px 3px 13px;
}

button:disabled, .btn-disabled {
  color: #808080;
  text-shadow: 1px 1px 0 #FFFFFF;
  cursor: default;
}

.btn-primary {
  font-weight: bold;
}

/* ── Inputs ─────────────────────────────────────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="number"],
textarea,
select {
  background: #FFFFFF;
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  font-family: Verdana, Arial, sans-serif;
  font-size: 11px;
  padding: 3px 4px;
  color: #000000;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: 1px dotted #000000;
  outline-offset: -2px;
}

label {
  font-size: 11px;
  display: inline-block;
}

/* ── Fieldset / groupbox ────────────────────────────────────────────────── */
fieldset {
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  background: #D4D0C8;
  padding: 8px 10px 10px;
  margin: 6px 0;
}

legend {
  font-size: 11px;
  font-weight: bold;
  padding: 0 4px;
  background: #D4D0C8;
}

/* ── Panels ─────────────────────────────────────────────────────────────── */
.panel-raised {
  border-top:    1px solid #FFFFFF;
  border-left:   1px solid #FFFFFF;
  border-right:  1px solid #808080;
  border-bottom: 1px solid #808080;
  padding: 8px;
  background: #D4D0C8;
}

.panel-sunken {
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  padding: 6px;
  background: #FFFFFF;
}

/* ── Progress bar ───────────────────────────────────────────────────────── */
.progress-wrap {
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  background: #D4D0C8;
  height: 18px;
  width: 100%;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: repeating-linear-gradient(
    to right,
    #000080 0px, #000080 8px,
    #6666CC 8px, #6666CC 10px
  );
  width: 0%;
}

.progress-label {
  font-size: 11px;
  text-align: center;
  margin-top: 2px;
  color: #000000;
}

/* ── Status bar ─────────────────────────────────────────────────────────── */
.status-bar {
  background: #D4D0C8;
  border-top: 1px solid #808080;
  padding: 2px 4px;
  font-size: 11px;
  display: flex;
  gap: 4px;
}

.status-pane {
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  padding: 1px 6px;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pane-fixed {
  flex: 0 0 auto;
}

/* ── Issue table ────────────────────────────────────────────────────────── */
table.issue-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

table.issue-table th {
  background: #000080;
  color: #FFFFFF;
  padding: 3px 6px;
  text-align: left;
  font-weight: bold;
  border-right: 1px solid #6666CC;
}

table.issue-table tr:nth-child(even) td { background: #E8E4DC; }
table.issue-table tr:nth-child(odd)  td { background: #FFFFFF; }

table.issue-table td {
  padding: 2px 6px;
  border-bottom: 1px solid #D4D0C8;
  vertical-align: top;
}

table.issue-table tr:hover td { background: #000080; color: #FFFFFF; }

/* ── Severity glyphs ────────────────────────────────────────────────────── */
.sev-error   { color: #CC0000; font-weight: bold; font-family: "Courier New", monospace; }
.sev-warning { color: #804000; font-weight: bold; font-family: "Courier New", monospace; }
.sev-info    { color: #000080; font-family: "Courier New", monospace; }
.sev-ok      { color: #006400; font-family: "Courier New", monospace; }

/* ── File list (upload) ─────────────────────────────────────────────────── */
.file-list {
  width: 100%;
  font-size: 11px;
  font-family: "Courier New", monospace;
}

.file-list .file-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 2px 4px;
  border-bottom: 1px solid #D4D0C8;
}

.file-list .file-row:nth-child(even) { background: #E8E4DC; }

.file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-size { flex: 0 0 80px; text-align: right; color: #404040; }
.file-status { flex: 0 0 60px; text-align: center; }

/* ── Helpers ────────────────────────────────────────────────────────────── */
.row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.col { display: flex; flex-direction: column; gap: 4px; }

.mt4  { margin-top:    4px; }
.mt8  { margin-top:    8px; }
.mt12 { margin-top:   12px; }
.mb4  { margin-bottom: 4px; }
.mb8  { margin-bottom: 8px; }

.w100 { width: 100%; }
.w50  { width: 50%; }
.w200 { width: 200px; }
.w300 { width: 300px; }
.w400 { width: 400px; }

.bold { font-weight: bold; }
.mono { font-family: "Courier New", monospace; font-size: 11px; }

.flash-error {
  background: #FFCCCC;
  border: 1px solid #CC0000;
  padding: 4px 8px;
  margin-bottom: 6px;
  font-size: 11px;
}

.flash-ok {
  background: #CCFFCC;
  border: 1px solid #006400;
  padding: 4px 8px;
  margin-bottom: 6px;
  font-size: 11px;
}

.scroll-box {
  overflow-y: auto;
  max-height: 320px;
  background: #FFFFFF;
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
}

/* ── Login window centering ─────────────────────────────────────────────── */
.login-wrap {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 60px;
  width: 100%;
}

.login-window {
  width: 300px;
}

.login-body {
  padding: 16px;
}

.login-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.login-row label {
  width: 70px;
  text-align: right;
}

.login-row input {
  flex: 1;
}

.login-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 12px;
}

/* ── Browse For Folder — two-pane Explorer dialog ───────────────────────── */
#browse-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1000;
}

.browse-dialog {
  position: fixed;
  z-index: 1001;
  width: 560px;
  max-width: 96vw;
  box-shadow: 4px 4px 0 #000000;
}

.browse-dialog .title-bar,
.window-full   .title-bar { cursor: move; user-select: none; }

/* Address / path bar */
.browse-addr-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  background: #D4D0C8;
  border-bottom: 1px solid #808080;
}
.browse-addr-label { font-size: 11px; white-space: nowrap; }
.browse-addr-bar {
  flex: 1;
  background: #FFFFFF;
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  padding: 2px 4px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Two-pane area */
.browse-panes {
  display: flex;
  gap: 4px;
  padding: 6px;
  height: 260px;
  background: #D4D0C8;
}

.browse-tree-wrap,
.browse-contents-wrap {
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  background: #FFFFFF;
  overflow-y: auto;
  overflow-x: auto;
}
.browse-tree-wrap     { flex: 0 0 200px; }
.browse-contents-wrap { flex: 1; }

/* Tree nodes */
.tn-row {
  display: flex;
  align-items: center;
  gap: 2px;
  white-space: nowrap;
  cursor: default;
  user-select: none;
  font-size: 11px;
  font-family: Verdana, Arial, sans-serif;
  padding-top: 1px;
  padding-bottom: 1px;
  padding-right: 4px;
}
.tn-row:hover { background: #000080; color: #FFFFFF; }
.tn-row.sel   { background: #000080; color: #FFFFFF; }

.tn-exp {
  font-family: "Courier New", monospace;
  font-size: 10px;
  width: 22px;
  flex-shrink: 0;
  text-align: center;
  cursor: pointer;
}

.tn-label { white-space: nowrap; }

/* Dotted tree indent line on child groups */
.tn-kids {
  border-left: 1px dotted #808080;
  margin-left: 10px;
}

/* Contents pane items */
.ci {
  padding: 1px 6px;
  white-space: nowrap;
  cursor: default;
  user-select: none;
  font-size: 11px;
  font-family: Verdana, Arial, sans-serif;
}
.ci:hover { background: #000080; color: #FFFFFF; }
.ci.sel   { background: #000080; color: #FFFFFF; }

/* Status bar inside dialog */
.browse-status-bar {
  padding: 2px 6px 3px;
  background: #D4D0C8;
  border-top: 1px solid #808080;
}
.browse-status-pane {
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  padding: 1px 6px;
  font-size: 11px;
  white-space: nowrap;
}

/* OK / Cancel row */
.browse-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 4px 6px 6px;
  background: #D4D0C8;
}

/* Misc messages */
.browse-msg {
  padding: 6px 8px;
  color: #404040;
  font-size: 11px;
  font-style: italic;
}
.browse-err { color: #CC0000; font-style: normal; font-family: "Courier New", monospace; }

/* ── Stage plan output ──────────────────────────────────────────────────── */
.plan-output {
  font-family: "Courier New", monospace;
  font-size: 11px;
  white-space: pre-wrap;
  word-break: break-all;
  background: #FFFFFF;
  padding: 6px;
  border-top:    1px solid #808080;
  border-left:   1px solid #808080;
  border-right:  1px solid #FFFFFF;
  border-bottom: 1px solid #FFFFFF;
  max-height: 280px;
  overflow-y: auto;
}
