/* ================================================================
   WP Staff Webmail v3 — Full-Screen Outlook-style UI
   ================================================================ */

/* Normal page-flow layout — fits inside the WordPress content area */
#wpsw-app {
  position: relative;
  width: 100%;
  height: clamp(600px, 82vh, 940px);
  margin: 0;
  padding: 0;
  border: 1px solid #d0cece;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
}

/* ---- CSS Variables ---- */
:root {
  --ms-blue:         #0078d4;
  --ms-blue-hover:   #106ebe;
  --ms-blue-light:   #deecf9;
  --ms-sidebar:      #1b1b1f;
  --ms-sidebar-text: #d4d4d8;
  --ms-topbar:       #0078d4;
  --ms-list-bg:      #f3f2f1;
  --ms-list-hover:   #eae9e8;
  --ms-list-sel:     #deecf9;
  --ms-border:       #e1dfdd;
  --ms-white:        #ffffff;
  --ms-text:         #201f1e;
  --ms-text-2:       #605e5c;
  --ms-text-3:       #a19f9d;
  --ms-danger:       #c50f1f;
  --ms-success:      #107c10;
  --ms-topbar-h:     48px;
  --ms-sidebar-w:    220px;
  --ms-list-w:       300px;
}

/* ---- Global Reset within plugin ---- */
#wpsw-app, #wpsw-app * {
  box-sizing: border-box;
  margin: 0; padding: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.4;
}
#wpsw-app button { cursor: pointer; border: none; background: none; }
#wpsw-app input   { outline: none; border: none; background: transparent; }
#wpsw-app svg     { display: inline-block; vertical-align: middle; }


/* ================================================================
   LOGIN SCREEN
   ================================================================ */
.wpsw-login-screen {
  width: 100%; height: 100%;
  background: #f3f2f1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wpsw-login-card {
  width: 440px;
  max-width: calc(100vw - 32px);
  background: var(--ms-white);
  border: 1px solid #d0cece;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
}

/* Brand bar at top of card */
.wpsw-login-brand {
  background: var(--ms-sidebar);
  padding: 22px 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.wpsw-ms-logo  { width: 36px; height: 36px; flex-shrink: 0; }
.wpsw-ms-logo-sm { width: 22px; height: 22px; flex-shrink: 0; }
.wpsw-brand-name {
  color: #fff;
  font-size: 26px;
  font-weight: 300;
  letter-spacing: -0.5px;
}

/* Form inside the card */
.wpsw-login-form {
  padding: 32px 28px 28px;
}
.wpsw-login-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--ms-text);
  margin-bottom: 6px;
}
.wpsw-login-sub {
  font-size: 13px;
  color: var(--ms-text-2);
  margin-bottom: 24px;
}

/* Input groups */
.wpsw-input-group {
  margin-bottom: 16px;
}
.wpsw-input-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ms-text);
  margin-bottom: 5px;
}
.wpsw-input-group input {
  display: block;
  width: 100%;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--ms-text);
  background: var(--ms-white) !important;
  border: 1px solid #8a8886 !important;
  border-radius: 3px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wpsw-input-group input:focus {
  border-color: var(--ms-blue) !important;
  box-shadow: 0 0 0 1px var(--ms-blue);
}
.wpsw-input-group input[readonly] {
  background: #f8f7f6 !important;
  color: var(--ms-text-2);
  cursor: default;
}

/* Password wrapper */
.wpsw-pw-wrap { position: relative; }
.wpsw-pw-wrap input { padding-right: 40px !important; }
.wpsw-pw-eye {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--ms-text-3);
  padding: 4px;
  border-radius: 3px;
}
.wpsw-pw-eye svg { width: 18px; height: 18px; }
.wpsw-pw-eye:hover { color: var(--ms-text); background: #f3f2f1; }

/* Login error */
.wpsw-login-error {
  background: #fde7e9;
  border: 1px solid #f1707b;
  border-radius: 3px;
  color: var(--ms-danger);
  padding: 9px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* Sign in button */
.wpsw-sign-in-btn {
  width: 100%;
  background: var(--ms-blue);
  color: #fff;
  border-radius: 3px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s;
  border: none;
  cursor: pointer;
}
.wpsw-sign-in-btn:hover { background: var(--ms-blue-hover); }
.wpsw-sign-in-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Spinner */
.wpsw-btn-spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wpsw-spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes wpsw-spin { to { transform: rotate(360deg); } }


/* ================================================================
   MAIN APP LAYOUT
   ================================================================ */
.wpsw-main {
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---- TOP BAR ---- */
.wpsw-topbar {
  height: var(--ms-topbar-h);
  background: var(--ms-topbar);
  display: flex;
  align-items: center;
  padding: 0 10px 0 0;
  gap: 0;
  flex-shrink: 0;
}

.wpsw-topbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  min-width: var(--ms-sidebar-w);
  flex-shrink: 0;
}
.wpsw-topbar-title {
  color: #fff;
  font-size: 18px;
  font-weight: 300;
  letter-spacing: -0.3px;
}

.wpsw-topbar-search {
  flex: 1;
  max-width: 500px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 3px;
  padding: 0 12px;
  margin: 0 16px;
  height: 32px;
}
.wpsw-search-icon { width: 16px; height: 16px; color: rgba(255,255,255,0.7); flex-shrink: 0; }
.wpsw-topbar-search input {
  flex: 1;
  background: transparent !important;
  border: none !important;
  color: #fff;
  font-size: 14px;
  box-shadow: none !important;
}
.wpsw-topbar-search input::placeholder { color: rgba(255,255,255,0.6); }

.wpsw-topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 6px;
}

.wpsw-logged-email {
  color: rgba(255,255,255,0.82);
  font-size: 13px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wpsw-topbar-icon-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255,255,255,0.85);
  border-radius: 3px;
  transition: background 0.12s;
}
.wpsw-topbar-icon-btn svg { width: 18px; height: 18px; }
.wpsw-topbar-icon-btn:hover { background: rgba(255,255,255,0.16); color: #fff; }

/* Sign out button — pill style */
.wpsw-signout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.9);
  font-size: 13px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 3px;
  border: 1px solid rgba(255,255,255,0.28);
  background: rgba(255,255,255,0.08);
  transition: all 0.12s;
}
.wpsw-signout-btn svg { width: 16px; height: 16px; }
.wpsw-signout-btn:hover {
  background: rgba(255,255,255,0.18);
  border-color: rgba(255,255,255,0.5);
  color: #fff;
}

/* ---- BODY ---- */
.wpsw-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ---- SIDEBAR ---- */
.wpsw-sidebar {
  width: var(--ms-sidebar-w);
  background: var(--ms-sidebar);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 8px 0 16px;
}

.wpsw-new-msg-btn {
  margin: 8px 12px 12px;
  background: var(--ms-blue);
  color: #fff;
  border-radius: 4px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.12s;
}
.wpsw-new-msg-btn svg { width: 16px; height: 16px; }
.wpsw-new-msg-btn:hover { background: var(--ms-blue-hover); }

.wpsw-folder-list { flex: 1; }

.wpsw-folder-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  color: var(--ms-sidebar-text);
  font-size: 13px;
  cursor: pointer;
  border-radius: 3px;
  margin: 1px 6px;
  transition: background 0.1s;
}
.wpsw-folder-item:hover { background: rgba(255,255,255,0.07); }
.wpsw-folder-item.active {
  background: rgba(0,120,212,0.25);
  color: #fff;
}
.wpsw-folder-icon { font-size: 14px; width: 18px; text-align: center; flex-shrink: 0; }
.wpsw-folder-name { flex: 1; }
.wpsw-folder-badge {
  background: var(--ms-blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

/* ---- MESSAGE LIST PANEL ---- */
.wpsw-list-panel {
  width: var(--ms-list-w);
  background: var(--ms-list-bg);
  border-right: 1px solid var(--ms-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.wpsw-list-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--ms-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #faf9f8;
  flex-shrink: 0;
}
.wpsw-list-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: var(--ms-text);
}
.wpsw-refresh-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ms-text-2);
  border-radius: 3px;
  transition: all 0.12s;
}
.wpsw-refresh-btn svg { width: 15px; height: 15px; }
.wpsw-refresh-btn:hover { background: var(--ms-list-hover); color: var(--ms-text); }

.wpsw-msglist { flex: 1; overflow-y: auto; }

/* Individual message row */
.wpsw-msg-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--ms-border);
  cursor: pointer;
  background: var(--ms-white);
  transition: background 0.1s;
  position: relative;
}
.wpsw-msg-item:hover   { background: var(--ms-list-hover); }
.wpsw-msg-item.selected { background: var(--ms-list-sel); }

/* Blue unread stripe */
.wpsw-msg-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: transparent;
  border-radius: 0 2px 2px 0;
}
.wpsw-msg-item.unread::before  { background: var(--ms-blue); }
.wpsw-msg-item.selected::before { background: var(--ms-blue); }
.wpsw-msg-item.unread .wpsw-msg-from    { font-weight: 700; color: var(--ms-text); }
.wpsw-msg-item.unread .wpsw-msg-subject { font-weight: 700; color: var(--ms-text); }

.wpsw-msg-row1 { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; }
.wpsw-msg-from {
  font-size: 13px;
  color: var(--ms-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 175px;
  font-weight: 400;
}
.wpsw-msg-time {
  font-size: 11px;
  color: var(--ms-text-3);
  flex-shrink: 0;
  margin-left: 4px;
}
.wpsw-msg-subject {
  font-size: 13px;
  color: var(--ms-text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Empty / loading states */
.wpsw-placeholder, .wpsw-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 200px;
  color: var(--ms-text-3);
  gap: 10px;
  text-align: center;
  padding: 20px;
}
.wpsw-placeholder svg, .wpsw-loading svg { width: 44px; height: 44px; }
.wpsw-placeholder p, .wpsw-loading p { font-size: 13px; }

/* Pagination */
.wpsw-pagination {
  padding: 8px 12px;
  border-top: 1px solid var(--ms-border);
  display: flex;
  justify-content: center;
  gap: 4px;
  background: #faf9f8;
  flex-shrink: 0;
}
.wpsw-pg-btn {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--ms-border);
  border-radius: 3px;
  background: var(--ms-white);
  color: var(--ms-text-2);
  cursor: pointer;
  transition: all 0.1s;
}
.wpsw-pg-btn:hover  { background: var(--ms-blue-light); color: var(--ms-blue); }
.wpsw-pg-btn.active { background: var(--ms-blue); color: #fff; border-color: var(--ms-blue); }

/* ---- READING PANE ---- */
.wpsw-reading-pane {
  flex: 1;
  overflow-y: auto;
  background: var(--ms-white);
}
.wpsw-reading-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--ms-text-3);
  gap: 12px;
}
.wpsw-reading-placeholder svg { width: 64px; height: 64px; opacity: 0.4; }
.wpsw-reading-placeholder p   { font-size: 14px; }

/* Email view inside reading pane */
.wpsw-email-view { padding: 24px 28px; }

.wpsw-email-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ms-border);
}
.wpsw-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 13px;
  border: 1px solid var(--ms-border);
  border-radius: 3px;
  color: var(--ms-text-2);
  background: var(--ms-white);
  cursor: pointer;
  transition: all 0.12s;
}
.wpsw-action-btn svg { width: 14px; height: 14px; }
.wpsw-action-btn:hover { background: var(--ms-blue-light); color: var(--ms-blue); border-color: var(--ms-blue); }
.wpsw-action-btn.danger:hover { background: #fde7e9; color: var(--ms-danger); border-color: var(--ms-danger); }

.wpsw-email-subject {
  font-size: 22px;
  font-weight: 600;
  color: var(--ms-text);
  margin-bottom: 14px;
  line-height: 1.3;
}
.wpsw-email-meta { margin-bottom: 20px; }
.wpsw-meta-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}
.wpsw-meta-label { color: var(--ms-text-3); min-width: 46px; font-weight: 600; }
.wpsw-meta-value { color: var(--ms-text-2); }

.wpsw-email-body {
  border: 1px solid var(--ms-border);
  border-radius: 4px;
  overflow: hidden;
}
.wpsw-email-body iframe {
  width: 100%;
  min-height: 300px;
  border: none;
  display: block;
}

.wpsw-attachments { margin-top: 14px; }
.wpsw-attachments-label { font-size: 12px; color: var(--ms-text-3); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 8px; }
.wpsw-attach-list { display: flex; flex-wrap: wrap; gap: 8px; }
.wpsw-attach-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border: 1px solid var(--ms-border);
  border-radius: 4px;
  font-size: 12px;
  color: var(--ms-text-2);
  background: #faf9f8;
}


/* ================================================================
   COMPOSE WINDOW
   ================================================================ */
.wpsw-compose-modal {
  position: absolute;
  bottom: 0; right: 20px;
  z-index: 500;
  width: 580px;
  max-width: calc(100% - 40px);
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  border-radius: 8px 8px 0 0;
  overflow: hidden;
}
.wpsw-compose-win {
  background: var(--ms-white);
  display: flex;
  flex-direction: column;
  height: 500px;
}
.wpsw-compose-bar {
  background: var(--ms-sidebar);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}
.wpsw-compose-bar span { color: #fff; font-size: 14px; font-weight: 600; }
.wpsw-compose-bar button {
  color: rgba(255,255,255,0.7);
  padding: 4px;
  border-radius: 3px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
}
.wpsw-compose-bar button svg { width: 16px; height: 16px; }
.wpsw-compose-bar button:hover { background: rgba(255,255,255,0.15); color: #fff; }

.wpsw-compose-fields { flex-shrink: 0; border-bottom: 1px solid var(--ms-border); }

.wpsw-cf {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--ms-border);
  padding: 0 14px;
}
.wpsw-cf:last-child { border-bottom: none; }
.wpsw-cf label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ms-text-3);
  min-width: 52px;
  flex-shrink: 0;
}
.wpsw-cf input {
  flex: 1;
  padding: 8px 0;
  font-size: 13px;
  color: var(--ms-text);
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}
.wpsw-ccbcc {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.wpsw-ccbcc button {
  font-size: 12px;
  color: var(--ms-text-2);
  padding: 3px 8px;
  border: 1px solid var(--ms-border) !important;
  border-radius: 3px;
  background: #f3f2f1;
}
.wpsw-ccbcc button:hover { color: var(--ms-blue); border-color: var(--ms-blue) !important; }

/* Quill compose editor */
.wpsw-compose-editor { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.wpsw-compose-editor .ql-toolbar {
  border: none !important;
  border-bottom: 1px solid var(--ms-border) !important;
  background: #faf9f8;
  flex-shrink: 0;
}
.wpsw-compose-editor .ql-container {
  border: none !important;
  flex: 1;
  overflow-y: auto;
}
.wpsw-compose-editor .ql-editor {
  min-height: 140px;
  font-size: 14px;
  font-family: 'Segoe UI', system-ui, sans-serif;
}

.wpsw-compose-footer {
  padding: 8px 14px;
  border-top: 1px solid var(--ms-border);
  display: flex;
  align-items: center;
  gap: 8px;
  background: #faf9f8;
  flex-shrink: 0;
}
.wpsw-send-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--ms-blue);
  color: #fff;
  border-radius: 3px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.12s;
}
.wpsw-send-btn svg { width: 15px; height: 15px; }
.wpsw-send-btn:hover { background: var(--ms-blue-hover); }
.wpsw-send-btn:disabled { opacity: 0.6; }

.wpsw-discard-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ms-text-2);
  padding: 7px 12px;
  border: 1px solid var(--ms-border) !important;
  border-radius: 3px;
  background: var(--ms-white);
  transition: all 0.12s;
}
.wpsw-discard-btn svg { width: 14px; height: 14px; }
.wpsw-discard-btn:hover { color: var(--ms-danger); border-color: var(--ms-danger) !important; background: #fde7e9; }

.wpsw-send-status {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 3px;
}
.wpsw-send-status.success { background: #dff6dd; color: var(--ms-success); }
.wpsw-send-status.error   { background: #fde7e9; color: var(--ms-danger); }


/* ================================================================
   SETTINGS / GENERIC MODAL OVERLAY
   ================================================================ */
.wpsw-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wpsw-dialog {
  background: var(--ms-white);
  border-radius: 6px;
  width: 540px;
  max-width: calc(100% - 32px);
  max-height: 82vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,0.22);
}
.wpsw-dialog-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--ms-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #faf9f8;
  flex-shrink: 0;
}
.wpsw-dialog-header h3 { font-size: 16px; font-weight: 600; }
.wpsw-dialog-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  color: var(--ms-text-3);
  border-radius: 3px;
}
.wpsw-dialog-close svg { width: 16px; height: 16px; }
.wpsw-dialog-close:hover { background: var(--ms-list-hover); color: var(--ms-text); }
.wpsw-dialog-body { padding: 18px; overflow-y: auto; }
.wpsw-dialog-actions { margin-top: 16px; display: flex; align-items: center; gap: 10px; }
.wpsw-hint { font-size: 12px; color: var(--ms-text-3); margin-bottom: 12px; }

/* Tabs */
.wpsw-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--ms-border);
  margin-bottom: 18px;
}
.wpsw-tab {
  padding: 8px 16px;
  font-size: 13px;
  color: var(--ms-text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.12s;
  font-weight: 400;
}
.wpsw-tab:hover { color: var(--ms-blue); }
.wpsw-tab.active {
  color: var(--ms-blue);
  border-bottom-color: var(--ms-blue);
  font-weight: 600;
}
.wpsw-tab-pane { display: none; }
.wpsw-tab-pane.active { display: block; }

/* Signature editor */
.wpsw-sig-editor .ql-toolbar   { border-radius: 4px 4px 0 0; border-color: var(--ms-border) !important; background: #f8f7f6; }
.wpsw-sig-editor .ql-container { border-radius: 0 0 4px 4px; border-color: var(--ms-border) !important; }
.wpsw-sig-editor .ql-editor    { min-height: 110px; font-size: 13px; }

/* Server info grid */
.wpsw-server-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.wpsw-server-block h4 { font-size: 13px; color: var(--ms-text-2); margin-bottom: 10px; }


/* ================================================================
   SCROLLBARS
   ================================================================ */
#wpsw-app ::-webkit-scrollbar       { width: 6px; height: 6px; }
#wpsw-app ::-webkit-scrollbar-track { background: transparent; }
#wpsw-app ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.18); border-radius: 3px; }
#wpsw-app ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.3); }


/* ================================================================
   RESPONSIVE — narrow screens
   ================================================================ */
@media (max-width: 700px) {
  :root {
    --ms-sidebar-w: 0px;
    --ms-list-w: 100%;
  }
  .wpsw-sidebar { display: none; }
  .wpsw-reading-pane { display: none; }
  .wpsw-list-panel { width: 100%; border-right: none; }
  .wpsw-reading-pane.mobile-open {
    display: flex;
    position: absolute;
    inset: var(--ms-topbar-h) 0 0 0;
    z-index: 100;
  }
  .wpsw-compose-modal { right: 0; width: 100%; border-radius: 0; }
  .wpsw-logged-email  { display: none; }
}

/* ================================================================
   ATTACHMENTS — COMPOSE WINDOW
   ================================================================ */
.wpsw-attach-bar {
  padding: 6px 14px;
  border-top: 1px solid var(--ms-border);
  background: #faf9f8;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 36px;
}
.wpsw-attach-bar:empty { display: none; }

.wpsw-attach-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--ms-blue-light);
  border: 1px solid #c7dff7;
  border-radius: 12px;
  padding: 3px 10px 3px 8px;
  font-size: 12px;
  color: var(--ms-blue);
  max-width: 200px;
}
.wpsw-attach-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.wpsw-attach-chip-remove {
  color: var(--ms-blue);
  font-size: 14px;
  line-height: 1;
  padding: 0 0 0 2px;
  cursor: pointer;
  opacity: 0.7;
  flex-shrink: 0;
}
.wpsw-attach-chip-remove:hover { opacity: 1; }

.wpsw-attach-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ms-text-2);
  padding: 6px 10px;
  border: 1px solid var(--ms-border) !important;
  border-radius: 3px;
  background: var(--ms-white);
  transition: all 0.12s;
  cursor: pointer;
}
.wpsw-attach-btn svg { width: 15px; height: 15px; }
.wpsw-attach-btn:hover {
  background: var(--ms-blue-light);
  color: var(--ms-blue);
  border-color: var(--ms-blue) !important;
}
#wpsw-file-input { display: none; }

/* ================================================================
   SIGNATURE SETTINGS — make editor more prominent
   ================================================================ */
#wpsw-tab-signature { padding-top: 4px; }

.wpsw-sig-preview {
  margin-top: 14px;
  padding: 12px 14px;
  background: #f8f7f6;
  border: 1px solid var(--ms-border);
  border-radius: 4px;
  font-size: 13px;
  color: var(--ms-text-2);
}
.wpsw-sig-preview-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--ms-text-3);
  margin-bottom: 6px;
}

/* ================================================================
   PASSCODE GATE SCREEN
   ================================================================ */
.wpsw-passcode-screen {
  position: absolute;
  inset: 0;
  z-index: 800;
  background: #f3f2f1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.wpsw-passcode-card {
  background: var(--ms-white);
  border: 1px solid #d0cece;
  border-radius: 8px;
  width: 380px;
  max-width: calc(100% - 32px);
  padding: 40px 36px 36px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.13);
  text-align: center;
}

.wpsw-passcode-icon {
  font-size: 44px;
  margin-bottom: 12px;
  line-height: 1;
}

.wpsw-passcode-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--ms-text);
  margin-bottom: 6px;
  letter-spacing: -0.3px;
}

.wpsw-passcode-sub {
  font-size: 13px;
  color: var(--ms-text-2);
  margin-bottom: 24px;
}

.wpsw-passcode-input-wrap {
  position: relative;
  margin-bottom: 14px;
}

.wpsw-passcode-input-wrap input {
  display: block;
  width: 100%;
  padding: 12px 42px 12px 16px;
  font-size: 18px;
  letter-spacing: 3px;
  text-align: center;
  color: var(--ms-text);
  background: var(--ms-white) !important;
  border: 2px solid #8a8886 !important;
  border-radius: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.wpsw-passcode-input-wrap input:focus {
  border-color: var(--ms-blue) !important;
  box-shadow: 0 0 0 2px var(--ms-blue-light);
  letter-spacing: 3px;
}
.wpsw-passcode-input-wrap input::placeholder {
  font-size: 14px;
  letter-spacing: normal;
  color: var(--ms-text-3);
}

.wpsw-pc-eye {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ms-text-3);
  padding: 4px;
}
.wpsw-pc-eye svg  { width: 18px; height: 18px; }
.wpsw-pc-eye:hover { color: var(--ms-text); }

.wpsw-passcode-error {
  background: #fde7e9;
  border: 1px solid #f1707b;
  border-radius: 4px;
  color: var(--ms-danger);
  padding: 8px 12px;
  font-size: 13px;
  margin-bottom: 14px;
  text-align: left;
}

/* shake animation on wrong passcode */
@keyframes wpsw-shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-8px); }
  40%      { transform: translateX(8px); }
  60%      { transform: translateX(-5px); }
  80%      { transform: translateX(5px); }
}
.wpsw-shake { animation: wpsw-shake 0.4s ease; }
