* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "MS Sans Serif", "Microsoft Sans Serif", Arial, sans-serif;
  font-size: 11px;
  background: #008080;
  height: 100vh;
  overflow: hidden;
}

/* ── WIN95 WINDOW ── */
.win95-window {
  background: #c0c0c0;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
}
.win95-titlebar {
  background: linear-gradient(to right, #000080, #1084d0);
  color: #fff;
  font-weight: bold;
  font-size: 11px;
  padding: 2px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}
.win95-controls button {
  background: #c0c0c0;
  border-top: 1px solid #fff;
  border-left: 1px solid #fff;
  border-right: 1px solid #404040;
  border-bottom: 1px solid #404040;
  font-size: 9px;
  width: 16px; height: 14px;
  cursor: pointer;
  margin-left: 2px;
  padding: 0;
}
.win95-body { padding: 8px; }
.win95-input {
  background: #fff;
  border-top: 1px solid #404040;
  border-left: 1px solid #404040;
  border-right: 1px solid #fff;
  border-bottom: 1px solid #fff;
  font-family: inherit;
  font-size: 11px;
  padding: 2px 4px;
  outline: none;
}
.win95-btn {
  background: #c0c0c0;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
  font-family: inherit;
  font-size: 11px;
  padding: 3px 12px;
  cursor: pointer;
  min-width: 60px;
}
.win95-btn:active {
  border-top: 2px solid #404040;
  border-left: 2px solid #404040;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
}
.win95-btn:disabled { color: #808080; cursor: default; }

/* ── LOGIN ── */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  height: 100vh;
}
.login-box { width: 260px; }

/* ── APP ── */
#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
  background: #c0c0c0;
}

/* ── MENUBAR ── */
.menubar {
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  padding: 2px 4px;
  display: flex; gap: 4px;
  flex-shrink: 0;
}
.menu-item {
  padding: 2px 6px;
  cursor: pointer;
}
.menu-item:hover { background: #000080; color: #fff; }

/* ── TOOLBAR ── */
.toolbar {
  background: #c0c0c0;
  border-bottom: 2px solid #808080;
  padding: 2px 4px;
  display: flex; align-items: center; gap: 2px;
  flex-shrink: 0;
}
.tool-btn {
  background: #c0c0c0;
  border: 1px solid transparent;
  display: flex; flex-direction: column;
  align-items: center;
  padding: 2px 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 9px;
  min-width: 44px;
  gap: 2px;
}
.tool-btn:hover:not(:disabled) { border: 1px solid #808080; }
.tool-btn:active:not(:disabled) {
  border-top: 1px solid #404040;
  border-left: 1px solid #404040;
}
.tool-btn:disabled { color: #808080; cursor: default; }
.tool-btn:disabled:hover { border: 1px solid transparent; }
.tool-label { font-size: 9px; }
.toolbar-sep {
  width: 1px; height: 36px;
  background: #808080;
  margin: 0 4px;
  border-right: 1px solid #fff;
}

/* ── ICONE TOOLBAR CSS ── */
.tb-icon {
  width: 22px; height: 20px;
  position: relative;
  display: block;
}
.tb-icon::before {
  content: '';
  position: absolute;
  top: 3px; left: 1px;
  width: 18px; height: 13px;
  background: #fff;
  border: 1px solid #404040;
}
.icon-compose::after {
  content: '';
  position: absolute;
  top: 3px; left: 1px;
  border-left: 9px solid transparent;
  border-right: 9px solid transparent;
  border-top: 6px solid #000080;
}
.icon-reply::before { background: none; border: none; }
.icon-reply::after {
  content: '';
  position: absolute;
  top: 6px; left: 2px;
  width: 0; height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-right: 10px solid #000080;
}
.icon-forward::before { background: none; border: none; }
.icon-forward::after {
  content: '';
  position: absolute;
  top: 6px; left: 8px;
  width: 0; height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 10px solid #808080;
}
.icon-next::before { background: none; border: none; }
.icon-next::after {
  content: '';
  position: absolute;
  top: 3px; left: 7px;
  width: 0; height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 10px solid #000080;
}
.icon-move::before {
  background: #ffff80;
  border: 1px solid #808000;
  top: 5px; left: 2px;
  width: 14px; height: 10px;
}
.icon-move::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 5px; height: 3px;
  background: #ffff80;
  border: 1px solid #808000;
  border-bottom: none;
}
.icon-delete::before { background: none; border: none; }
.icon-delete::after {
  content: '✕';
  position: absolute;
  top: 1px; left: 4px;
  font-size: 14px;
  color: #808080;
  font-weight: bold;
}
.icon-disabled::before { border-color: #808080; background: #e0e0e0; }
.icon-disabled::after  {
  border-top-color: #808080 !important;
  border-right-color: #808080 !important;
  border-left-color: #808080 !important;
  color: #808080 !important;
}

/* ── MAIN LAYOUT ── */
.main-layout {
  display: flex;
  flex: 1 1 0;
  overflow: hidden;
  min-height: 0;
}

/* ── RESIZE HANDLES ── */
.resize-h {
  width: 5px;
  cursor: col-resize;
  background: #c0c0c0;
  border-left: 1px solid #808080;
  border-right: 1px solid #fff;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}
.resize-v {
  height: 5px;
  min-height: 5px;
  cursor: row-resize;
  background: #c0c0c0;
  border-top: 1px solid #808080;
  border-bottom: 1px solid #fff;
  flex-shrink: 0;
  z-index: 10;
  position: relative;
}

/* ── FOLDERS ── */
.folders-panel {
  width: 148px;
  min-width: 80px;
  max-width: 280px;
  border-right: 2px solid #808080;
  background: #c0c0c0;
  padding: 4px;
  display: flex; flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}
.folders-title {
  font-weight: bold;
  font-size: 11px;
  margin-bottom: 6px;
  padding: 2px;
  border-bottom: 1px solid #808080;
}
.folder-item {
  padding: 2px 4px;
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
}
.folder-item:hover, .folder-item.active {
  background: #000080; color: #fff;
}
.folder-item .f-icon {
  width: 16px; height: 13px;
  background: #ffff80;
  border: 1px solid #808000;
  position: relative;
  flex-shrink: 0;
  display: inline-block;
}
.folder-item .f-icon::before {
  content: '';
  position: absolute;
  top: -3px; left: 0;
  width: 5px; height: 3px;
  background: #ffff80;
  border: 1px solid #808000;
  border-bottom: none;
}
.folder-item.active .f-icon,
.folder-item:hover .f-icon { border-color: #aaa; background: #ffff60; }
.folder-spacer { flex: 1; }
.folder-icon-bottom {
  margin-top: auto;
  text-align: center;
  padding: 8px 0;
  font-size: 10px;
}
.outbox-css-icon {
  width: 32px; height: 26px;
  background: #c0c0c0;
  border: 2px solid #808000;
  position: relative;
  margin: 0 auto 4px;
  display: block;
}
.outbox-css-icon::after {
  content: '';
  position: absolute;
  bottom: -9px; left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #000080;
}

/* ── RIGHT PANEL ── */
.right-panel {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 4px;
  min-height: 0;
  gap: 0;
}

/* ── MAIL LIST ── */
.mail-list-window {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.mail-list-header {
  display: flex;
  background: #c0c0c0;
  border-bottom: 1px solid #808080;
  flex-shrink: 0;
}
.mail-list-header span {
  font-size: 11px;
  padding: 2px 4px;
  border-top: 2px solid #fff;
  border-left: 2px solid #fff;
  border-right: 2px solid #404040;
  border-bottom: 2px solid #404040;
}
.col-icon    { width: 22px; }
.col-from    { width: 160px; }
.col-subject { flex: 1; }
.col-date    { width: 130px; text-align: right; }

.mail-list-body {
  flex: 1 1 0;
  overflow-y: auto;
  background: #fff;
  border-top: 1px solid #404040;
  border-left: 1px solid #404040;
  min-height: 0;
}
.mail-row {
  display: flex;
  padding: 1px 0;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  align-items: center;
  min-height: 18px;
}
.mail-row:hover   { background: #000080; color: #fff; }
.mail-row.selected { background: #000080; color: #fff; }
.mail-row.unread  { font-weight: bold; }
.mail-cell { padding: 0 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mc-icon   { width: 22px; text-align: center; flex-shrink: 0; }
.mc-from   { width: 160px; flex-shrink: 0; }
.mc-subj   { flex: 1; min-width: 0; }
.mc-date   { width: 130px; flex-shrink: 0; font-size: 10px; }

.mail-list-icon {
  width: 14px; height: 11px;
  background: #fff;
  border: 1px solid #404040;
  display: inline-block;
  position: relative;
}
.mail-list-icon::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 5px solid #000080;
}
.mail-row:hover .mail-list-icon,
.mail-row.selected .mail-list-icon { border-color: #fff; }
.mail-row:hover .mail-list-icon::after,
.mail-row.selected .mail-list-icon::after { border-top-color: #fff; }

/* ── PREVIEW ── */
.mail-preview-window {
  flex: 0 0 180px;
  display: flex;
  flex-direction: column;
  min-height: 40px;
  overflow: hidden;
}
.mail-preview-body {
  flex: 1 1 0;
  overflow-y: auto;
  background: #fff;
  padding: 8px;
  border-top: 1px solid #404040;
  border-left: 1px solid #404040;
  font-size: 11px;
  word-break: break-word;
  user-select: text;
  min-height: 0;
}
.preview-header { margin-bottom: 8px; border-bottom: 1px solid #c0c0c0; padding-bottom: 6px; }
.preview-header div { margin-bottom: 2px; }
.preview-header b { display: inline-block; width: 60px; }

/* ── STATUSBAR ── */
.statusbar {
  background: #c0c0c0;
  border-top: 1px solid #808080;
  padding: 2px 8px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  flex-shrink: 0;
}

/* ── COMPOSE ── */
.compose-win {
  position: fixed;
  top: 60px; left: 120px;
  width: 500px;
  z-index: 100;
  box-shadow: 4px 4px 0 #000;
}
.compose-body {
  display: flex; flex-direction: column;
  gap: 4px; padding: 8px;
}
.compose-field {
  display: flex; align-items: center; gap: 4px;
}
.compose-field label { width: 50px; text-align: right; }
.compose-input { flex: 1; }
.compose-sep {
  height: 1px; background: #808080;
  margin: 4px 0;
}
.compose-textarea {
  width: 100%; height: 180px;
  resize: none;
  font-family: inherit;
  font-size: 11px;
}
.compose-actions {
  display: flex; align-items: center;
  gap: 4px; margin-top: 4px;
}
