*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: Arial, Verdana, Geneva, sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: #333333;
  background-color: #ffffff;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

.app-shell {
  min-height: 100vh;
}

/* ---------- Login View (1:1 steamwebmail.com glass card over blurred collage) ---------- */

.login-screen {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  overflow: hidden;
  background-color: #1f2530;
}

.login-bg-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.login-bg-collage {
  position: absolute;
  top: -22%;
  left: -18%;
  width: 136%;
  height: 144%;
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  align-content: center;
  gap: 8px;
  transform: rotate(-14deg);
  filter: blur(1.5px) brightness(0.68) saturate(1.05);
}

.login-bg-tile {
  display: block;
  width: 100%;
  aspect-ratio: 460 / 215;
  object-fit: cover;
  background-color: #262e3b;
  border-radius: 3px;
}

.login-bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(12, 16, 24, 0.25) 0%, rgba(8, 11, 16, 0.72) 100%);
}

.login-wrapper {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 385px;
}

.login-card {
  width: 100%;
  padding: 36px 40px 24px 40px;
  margin: 0;
  background-color: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
  color: rgba(255, 255, 255, 0.8);
}

.login-heading {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  color: #ffffff;
}

.login-subtitle {
  margin: 0 0 18px;
  font-size: 13px;
  line-height: 18px;
  color: rgba(255, 255, 255, 0.8);
}

.login-control {
  margin-bottom: 12px;
}

.input-append {
  position: relative;
  width: 100%;
}

.input-append input {
  width: 100%;
  height: 40px;
  min-height: 30px;
  padding: 4px 36px 4px 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 3px;
  box-shadow: none;
  outline: none;
  color: #ffffff;
  font-size: 16px;
  line-height: 20px;
  transition: border-color 140ms ease;
}

.input-append input::placeholder {
  color: rgba(255, 255, 255, 0.72);
}

.input-append input:hover,
.input-append input:focus {
  border-color: #ffffff;
}

.input-append .add-on {
  position: absolute;
  top: 0;
  right: 0;
  width: 36px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  color: rgba(255, 255, 255, 0.8);
}

.login-control.error .input-append input,
.login-control.error .input-append .add-on {
  color: #f76260;
  border-color: #f76260;
}

.login-error {
  margin: 0 0 12px;
  font-size: 13px;
  line-height: 18px;
  color: #f76260;
}

.login-submit-btn {
  width: 100%;
  height: 36px;
  padding: 8px 13px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 3px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 140ms ease, background-color 140ms ease, transform 100ms ease;
}

.login-submit-btn:hover:not(:disabled) {
  border-color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.login-submit-btn:active:not(:disabled) {
  transform: scale(0.985);
}

.login-submit-btn:disabled {
  opacity: 0.6;
  cursor: wait;
}

.login-note {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 16px;
  color: rgba(255, 255, 255, 0.65);
}

/* ---------- Inbox Shell (Clean White RainLoop Layout) ---------- */

.inbox-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  background-color: #f3f4f6;
  color: #333333;
}

.rl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  padding: 4px 12px;
  background-color: #f5f5f5;
  background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 3px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
  color: #333333;
  font-size: 13px;
  line-height: 20px;
  text-shadow: 0 1px 0 #ffffff;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 120ms ease, transform 90ms ease;
}

.rl-btn:hover:not(:disabled) {
  border-color: rgba(0, 0, 0, 0.4);
  background-image: linear-gradient(to bottom, #ffffff, #ededed);
}

.rl-btn:active:not(:disabled) {
  transform: scale(0.97);
}

.rl-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.rl-btn-block {
  width: 100%;
  height: 32px;
  font-weight: 600;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  padding: 6px 14px;
  background-color: #f6f7f9;
  border-bottom: 1px solid #d5d8dc;
}

.topbar-brand {
  min-width: 214px;
  display: flex;
  align-items: center;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: #222222;
  letter-spacing: -0.01em;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.topbar-hint {
  font-size: 12px;
  color: #777777;
}

.topbar-account {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.account-place {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 8px;
  font-size: 14px;
  font-weight: 700;
  color: #222222;
}

.account-dropdown-wrap {
  position: relative;
}

.account-trigger {
  min-width: 48px;
  padding: 4px 10px;
}

.caret {
  display: inline-block;
  width: 0;
  height: 0;
  border-top: 4px solid #333333;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  vertical-align: middle;
}

.g-ui-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 40;
  min-width: 240px;
  max-width: 320px;
  max-height: 400px;
  overflow-y: auto;
  margin: 0;
  padding: 5px 0;
  list-style: none;
  background-color: #ffffff;
  color: #333333;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.menu-section-label {
  padding: 4px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #888888;
}

.g-ui-menu .divider {
  height: 1px;
  margin: 5px 0;
  background-color: #e5e5e5;
}

.g-ui-menu .e-item {
  display: flex;
  align-items: center;
}

.g-ui-menu .e-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border: 0;
  background-color: #ffffff;
  color: #333333;
  font-size: 13px;
  line-height: 20px;
  text-align: left;
  cursor: pointer;
}

.g-ui-menu .e-link:hover,
.g-ui-menu .e-link:focus-visible {
  background-color: #48525c;
  color: #eeeeee;
  outline: none;
}

.g-ui-menu .account-row {
  display: flex;
  align-items: center;
  background-color: #ffffff;
}

.g-ui-menu .account-row:hover {
  background-color: #48525c;
}

.g-ui-menu .account-row:hover .account-switch-btn,
.g-ui-menu .account-row:hover .account-remove-btn {
  color: #eeeeee;
}

.account-switch-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px 5px 14px;
  border: 0;
  background: transparent;
  color: #333333;
  font-size: 13px;
  line-height: 20px;
  text-align: left;
  cursor: pointer;
}

.account-switch-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-switch-btn.current {
  font-weight: 700;
}

.account-remove-btn {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #888888;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}

.account-remove-btn:hover {
  color: #ef4444;
}

.inbox-banner {
  padding: 8px 16px;
  background-color: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 13px;
}

/* ---------- 3-Column Workspace ---------- */

.workspace {
  flex: 1;
  display: flex;
  min-height: 0;
  background-color: #ffffff;
}

.sidebar {
  width: 228px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 10px 12px;
  background-color: #f6f7f9;
  border-right: 1px solid #d5d8dc;
  overflow-y: auto;
}

.sidebar-top {
  margin-bottom: 12px;
}

.sidebar-label {
  padding: 0 8px 5px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a828e;
}

.folder-list,
.sidebar-accounts-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.folder-link {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #333333;
  font-size: 13px;
  line-height: 20px;
  text-align: left;
  cursor: pointer;
}

.folder-link:hover {
  background-color: #e9ecf0;
}

.folder-link.selected {
  background-color: #48525c;
  color: #ffffff;
  font-weight: 700;
}

.folder-count {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.sidebar-divider {
  height: 1px;
  margin: 12px 4px;
  background-color: #dde1e6;
}

.sidebar-account-row {
  display: flex;
  align-items: center;
  border-radius: 3px;
}

.sidebar-account-row:hover {
  background-color: #e9ecf0;
}

.sidebar-account-row.active {
  background-color: #e3e7ed;
}

.sidebar-account-btn {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 6px 6px 10px;
  border: 0;
  background: transparent;
  color: #333333;
  font-size: 13px;
  line-height: 18px;
  text-align: left;
  cursor: pointer;
}

.sidebar-account-row.active .sidebar-account-btn {
  font-weight: 700;
  color: #111111;
}

.sidebar-account-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-account-remove {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin-right: 2px;
  border: 0;
  background: transparent;
  color: #888888;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.6;
}

.sidebar-account-row:hover .sidebar-account-remove {
  opacity: 1;
}

.sidebar-account-remove:hover {
  color: #dc2626;
}

/* ---------- Message List Column (White + RainLoop Toolbars) ---------- */

.list-pane {
  width: 410px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background-color: #ffffff;
  border-right: 1px solid #d5d8dc;
}

.list-toolbar-top {
  padding: 6px 8px;
  background-color: #ececec;
  background-image: linear-gradient(to bottom, #f4f4f4, #dfdfdf);
  border-bottom: 1px solid #cfcfcf;
}

.search-box {
  position: relative;
}

.input-search {
  width: 100%;
  height: 30px;
  padding: 4px 28px 4px 8px;
  background-color: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 3px;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  color: #444444;
  font-size: 13px;
  line-height: 20px;
  outline: none;
}

.input-search:focus {
  border-color: #7c8b99;
}

.search-icon {
  position: absolute;
  top: 0;
  right: 0;
  width: 28px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #888888;
  pointer-events: none;
}

.message-list {
  flex: 1;
  overflow-y: auto;
  background-color: #ffffff;
}

.list-empty {
  padding: 48px 20px;
  text-align: center;
  color: #999999;
  font-size: 20px;
  line-height: 28px;
}

.message-item {
  width: 100%;
  display: block;
  padding: 11px 14px;
  border: 0;
  border-bottom: 1px solid #eaecef;
  background-color: #ffffff;
  text-align: left;
  cursor: pointer;
}

.message-item:hover {
  background-color: #f6f8fa;
}

.message-item.active {
  background-color: #eef3f9;
  box-shadow: inset 3px 0 0 #48525c;
}

.msg-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 3px;
  font-size: 12px;
  line-height: 16px;
  color: #667085;
}

.msg-sender {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.msg-date {
  flex-shrink: 0;
  color: #888888;
  font-variant-numeric: tabular-nums;
}

.msg-subject {
  font-size: 14px;
  font-weight: 600;
  line-height: 19px;
  color: #1f2328;
  word-break: break-word;
}

.msg-preview {
  margin-top: 3px;
  font-size: 12px;
  line-height: 16px;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-preview-code {
  color: #374151;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-weight: 600;
}

.list-toolbar-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 12px;
  background-color: #ececec;
  background-image: linear-gradient(to bottom, #f4f4f4, #dfdfdf);
  border-top: 1px solid #cfcfcf;
  font-size: 12px;
  color: #555555;
  font-variant-numeric: tabular-nums;
}

/* ---------- Reader Pane (Pure White #ffffff) ---------- */

.reader-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background-color: #ffffff;
}

.reader-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  text-align: center;
  color: #999999;
  font-size: 22px;
  line-height: 30px;
}

.reader-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.reader-header {
  padding: 18px 24px 14px;
  border-bottom: 1px solid #e5e7eb;
}

.reader-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.reader-subject {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  line-height: 24px;
  color: #111111;
}

.reader-date {
  flex-shrink: 0;
  font-size: 12px;
  color: #777777;
  font-variant-numeric: tabular-nums;
}

.reader-meta {
  display: grid;
  gap: 3px;
  font-size: 13px;
  color: #333333;
}

.meta-key {
  display: inline-block;
  min-width: 82px;
  color: #777777;
}

.steam-actions {
  margin: 14px 24px 0;
  padding: 12px 16px;
  background-color: #f8f9fb;
  border: 1px solid #dcdfe4;
  border-radius: 3px;
  display: grid;
  gap: 10px;
}

.steam-action-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.action-label {
  font-size: 12px;
  font-weight: 700;
  color: #555555;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.codes-list,
.links-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.code-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.code-value {
  padding: 4px 10px;
  background-color: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #111111;
}

.reader-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 24px 0;
  border-bottom: 1px solid #e5e7eb;
}

.tab-btn {
  padding: 6px 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: #666666;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.tab-btn:hover {
  color: #222222;
}

.tab-btn.active {
  color: #222222;
  border-bottom-color: #48525c;
}

.reader-body {
  flex: 1;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  padding: 16px 24px 24px;
}

.body-html-frame {
  flex: 1;
  width: 100%;
  min-height: 360px;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  background-color: #ffffff;
}

.body-text {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 3px;
  background-color: #ffffff;
  color: #222222;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-y: auto;
}

/* ---------- Modal: Add Account (1:1 steamwebmail.com) ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background-color: rgba(0, 0, 0, 0.38);
}

.rl-modal {
  width: 420px;
  max-width: 100%;
  background-color: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.rl-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e5e5;
}

.rl-modal-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: #333333;
}

.rl-modal-close {
  border: 0;
  background: transparent;
  color: #888888;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.rl-modal-close:hover {
  color: #333333;
}

.rl-modal-body {
  padding: 18px 20px;
  display: grid;
  gap: 12px;
}

.modal-field-row {
  display: grid;
  grid-template-columns: 82px 1fr;
  align-items: center;
  gap: 10px;
}

.modal-field-row label {
  font-size: 13px;
  color: #333333;
  text-align: right;
}

.modal-field-row input {
  width: 100%;
  height: 30px;
  padding: 4px 8px;
  background-color: #ffffff;
  border: 1px solid #cccccc;
  border-radius: 3px;
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
  color: #333333;
  font-size: 13px;
  outline: none;
}

.modal-field-row input:focus {
  border-color: #48525c;
}

.modal-error {
  padding-left: 92px;
  font-size: 12px;
  color: #b91c1c;
}

.rl-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 16px;
  background-color: #f5f5f5;
  border-top: 1px solid #dddddd;
}

/* ---------- Responsive Breakpoints ---------- */

@media (max-width: 1100px) {
  .sidebar {
    width: 196px;
  }
  .topbar-brand {
    min-width: 182px;
  }
  .list-pane {
    width: 340px;
  }
}

@media (max-width: 860px) {
  .inbox-shell {
    height: auto;
    min-height: 100vh;
  }
  .topbar {
    flex-wrap: wrap;
  }
  .topbar-brand {
    min-width: 0;
  }
  .topbar-hint {
    display: none;
  }
  .workspace {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #d5d8dc;
  }
  .list-pane {
    width: 100%;
    max-height: 320px;
    border-right: 0;
    border-bottom: 1px solid #d5d8dc;
  }
  .modal-field-row {
    grid-template-columns: 1fr;
  }
  .modal-field-row label {
    text-align: left;
  }
  .modal-error {
    padding-left: 0;
  }
}
