.app > section { display: none; min-height: 100vh; }
.app[data-view="employee-login"] #employeeLogin,
.app[data-view="admin-login"] #adminLogin,
.app[data-view="mailbox"] #mailbox,
.app[data-view="admin"] #adminShell,
.app[data-view="client-help"] #clientHelp,
.app[data-view="forgot-password"] #forgotPage,
.app[data-view="forgot-admin"] #forgotPage,
.app[data-view="help"] #generalHelp { display: block; }

.brand-logo { width: 182px; height: auto; object-fit: contain; }
.brand-logo.compact { width: 156px; }

/* Login */
.login-screen {
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(246, 249, 252, .99), rgba(246, 249, 252, .94) 46%, rgba(246, 249, 252, .82)),
    url("./assets/huaying-aircraft.png") right center / cover no-repeat;
}

.login-top,
.simple-head {
  height: 72px;
  padding: 0 clamp(20px, 5vw, 64px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(221, 230, 239, .9);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
}

.top-links,
.actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.top-links button {
  border: 0;
  background: transparent;
  color: var(--hy-text-secondary);
  min-height: 34px;
  padding: 0 10px;
  font-weight: 600;
}

.top-links button:hover { color: var(--hy-primary); }

.login-main {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 384px;
  gap: clamp(36px, 7vw, 86px);
  align-items: center;
  padding: clamp(32px, 7vw, 76px) clamp(20px, 6vw, 84px);
}

.login-brand {
  max-width: 560px;
  display: grid;
  gap: 18px;
}

.brand-mark {
  width: max-content;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(14, 93, 143, .18);
  color: var(--hy-primary);
  background: rgba(255, 255, 255, .66);
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
}

.login-brand h1 {
  font-size: 40px;
  line-height: 1.12;
  font-weight: 650;
  color: #111b2d;
}

.login-brand p {
  max-width: 480px;
  color: var(--hy-text-secondary);
  font-size: 16px;
  line-height: 1.75;
}

.brand-points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.brand-points span {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid rgba(221, 230, 239, .9);
  background: rgba(255, 255, 255, .7);
  border-radius: 999px;
  color: var(--hy-text-secondary);
  font-size: 13px;
}

.login-card,
.admin-login-card {
  background: var(--hy-surface);
  border: 1px solid var(--hy-border);
  border-radius: var(--hy-radius-lg);
  box-shadow: 0 12px 34px rgba(16, 42, 67, .1);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.login-card-head strong {
  display: block;
  margin-bottom: 4px;
  font-size: 24px;
  line-height: 32px;
  font-weight: 650;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--hy-border);
  background: var(--hy-surface-soft);
  border-radius: var(--hy-radius);
}

.tab {
  min-height: 34px;
  border: 0;
  border-radius: var(--hy-radius-sm);
  background: transparent;
  color: var(--hy-text-secondary);
  font-size: 14px;
  font-weight: 600;
}

.tab.active {
  background: #fff;
  color: var(--hy-primary);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
}

.login-tab-panel { display: none; gap: 13px; }
.login-tab-panel.active { display: grid; }

.inline-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px;
  border: 1px solid var(--hy-border);
  border-radius: var(--hy-radius);
  overflow: hidden;
}

.inline-input input { border: 0; border-radius: 0; }
.inline-input button {
  border: 0;
  border-left: 1px solid var(--hy-border);
  background: var(--hy-surface-soft);
  color: var(--hy-primary);
  font-weight: 600;
}

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.login-note {
  padding: 10px 12px;
  border-radius: var(--hy-radius);
  background: #f2f7fb;
  color: var(--hy-text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.qr-box {
  min-height: 198px;
  padding: 18px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 10px;
  text-align: center;
  border: 1px dashed var(--hy-border-strong);
  border-radius: var(--hy-radius);
  background: var(--hy-surface-soft);
}

.qr-grid {
  width: 96px;
  height: 96px;
  background:
    linear-gradient(90deg, #102a43 8px, transparent 8px) 0 0 / 16px 16px,
    linear-gradient(#102a43 8px, transparent 8px) 0 0 / 16px 16px,
    #fff;
  border: 9px solid #fff;
  box-shadow: inset 0 0 0 1px var(--hy-border);
}

.admin-login-screen {
  background: var(--hy-bg-strong);
  padding: 44px 18px;
}

.admin-login-card {
  max-width: 408px;
  margin: 7vh auto 0;
}

.admin-login-card h1 {
  font-size: 24px;
  line-height: 32px;
  font-weight: 650;
}

/* Mailbox */
.mail-shell,
.admin-shell {
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  display: grid !important;
  grid-template-columns: var(--hy-sidebar) minmax(0, 1fr);
}

.app[data-view]:not([data-view="mailbox"]) .mail-shell,
.app[data-view]:not([data-view="admin"]) .admin-shell { display: none !important; }

.mail-side,
.admin-side {
  min-width: 0;
  background: var(--hy-navy);
  color: #fff;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.compose-btn { min-height: 38px; width: 100%; }

.mail-folders,
.admin-nav { display: grid; gap: 2px; }

.mail-folders button,
.admin-nav button {
  min-height: 38px;
  width: 100%;
  border: 0;
  border-radius: var(--hy-radius);
  background: transparent;
  color: #d7e3ee;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
}

.mail-folders button.active,
.admin-nav button.active,
.mail-folders button:hover,
.admin-nav button:hover {
  background: rgba(255, 255, 255, .11);
  color: #fff;
}

.side-card {
  margin-top: auto;
  padding: 12px;
  display: grid;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: var(--hy-radius);
  background: rgba(255, 255, 255, .06);
}

.progress {
  height: 7px;
  background: rgba(255, 255, 255, .18);
  border-radius: 999px;
  overflow: hidden;
}

.progress span {
  display: block;
  height: 100%;
  background: #63d4ac;
}

.mail-main,
.admin-main {
  min-width: 0;
  overflow: hidden;
  background: var(--hy-bg);
}

.mail-top,
.admin-top {
  min-height: 72px;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 420px) auto;
  align-items: center;
  gap: 16px;
  background: #fff;
  border-bottom: 1px solid var(--hy-border);
}

.admin-top { grid-template-columns: minmax(220px, 1fr) auto; }

.mail-top h2,
.admin-top h2 {
  margin-bottom: 2px;
  font-size: 21px;
  line-height: 29px;
  font-weight: 650;
}

.mail-top p,
.admin-top p {
  color: var(--hy-text-secondary);
  font-size: 13px;
}

.mail-search {
  height: 38px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border: 1px solid var(--hy-border);
  border-radius: var(--hy-radius);
  background: var(--hy-surface-soft);
  color: var(--hy-text-muted);
  font-size: 13px;
}

.mail-search input {
  border: 0;
  background: transparent;
  outline: none;
  min-width: 0;
  color: var(--hy-text);
}

.mail-content {
  height: calc(100vh - 72px);
  min-height: 0;
  display: grid;
  grid-template-columns: var(--hy-mail-list) minmax(0, 1fr);
  gap: 0;
  padding: 0;
}

.message-list {
  min-height: 0;
  overflow: auto;
  border-right: 1px solid var(--hy-border);
  background: #fff;
}

.message-item {
  width: 100%;
  min-height: 86px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--hy-border);
  background: #fff;
  display: grid;
  gap: 6px;
  text-align: left;
}

.message-item.active {
  background: #edf6fc;
  box-shadow: inset 3px 0 0 var(--hy-primary);
}

.message-item strong { font-size: 14px; line-height: 20px; }
.message-item span { color: var(--hy-text-secondary); font-size: 12px; }

.message-reader {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 28px 34px;
  background: #fff;
  display: grid;
  align-content: start;
  gap: 18px;
}

.message-reader h3 {
  font-size: 22px;
  line-height: 30px;
  font-weight: 650;
}

.reader-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--hy-text-secondary);
  font-size: 13px;
}

/* Compose as floating email window */
.compose-panel {
  position: fixed;
  right: 28px;
  bottom: 24px;
  z-index: 30;
  width: min(780px, calc(100vw - 56px));
  max-height: min(860px, calc(100vh - 56px));
  display: none;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--hy-border);
  border-radius: var(--hy-radius-lg);
  background: #fff;
  box-shadow: var(--hy-shadow-pop);
  overflow: hidden;
}

.compose-panel.active { display: grid; }

.compose-head {
  min-height: 58px;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #f9fbfd;
  border-bottom: 1px solid var(--hy-border);
}

.compose-head h3 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 650;
}

.compose-head p {
  color: var(--hy-text-muted);
  font-size: 12px;
}

.icon-btn {
  width: 36px;
  padding: 0;
  font-size: 18px;
  color: var(--hy-text-secondary);
}

.compose-form {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 0;
  display: grid;
  gap: 10px;
}

.compose-form > .actions.end {
  position: sticky;
  bottom: 0;
  margin: 0 -16px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, .96);
  border-top: 1px solid var(--hy-border);
  backdrop-filter: blur(8px);
}

.two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.recipient-box {
  min-height: 38px;
  padding: 3px;
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--hy-border);
  border-radius: var(--hy-radius);
  background: #fff;
}

.recipient-box input {
  min-width: 160px;
  flex: 1;
  border: 0;
  box-shadow: none;
}

.recipient-token {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 7px 0 9px;
  border-radius: 999px;
  background: #edf6fc;
  color: var(--hy-primary);
  font-size: 13px;
  font-weight: 600;
}

.recipient-token button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  line-height: 1;
}

.editor-toolbar {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--hy-border);
  border-radius: var(--hy-radius);
  background: var(--hy-surface-soft);
}

.editor-toolbar button {
  min-width: 30px;
  min-height: 28px;
  border: 0;
  border-radius: var(--hy-radius-sm);
  background: transparent;
  color: var(--hy-text-secondary);
  font-weight: 650;
}

.editor-toolbar button:hover { background: #fff; color: var(--hy-primary); }

.editor {
  min-height: 170px;
  padding: 14px;
  border: 1px solid var(--hy-border);
  border-radius: var(--hy-radius);
  background: #fff;
  line-height: 1.75;
  outline: none;
  font-size: 14px;
}

.attachment-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment-chip {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #cfe4d8;
  border-radius: 999px;
  background: #eefaf3;
  color: #0f6844;
  font-size: 13px;
}

.compose-options {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.field.small { width: 220px; }

.compose-status,
.status-box {
  padding: 10px 12px;
  border-radius: var(--hy-radius);
  border: 1px solid #efd9a6;
  background: #fff8e7;
  color: #7a5311;
  font-size: 13px;
  line-height: 1.45;
}

/* Tencent-style employee mailbox */
.mail-shell {
  grid-template-columns: 204px minmax(0, 1fr);
  background: #edf4fb;
}

.mail-side {
  background: #e8f2fb;
  color: #1d3553;
  border-right: 1px solid #bfd2e4;
  padding: 12px 10px;
  gap: 10px;
}

.mail-side-brand {
  height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.mail-side-brand .brand-logo { width: 116px; }
.mail-side-brand span { color: #47708f; font-size: 12px; font-weight: 700; }

.mail-user-card {
  padding: 8px 10px 10px;
  border-bottom: 1px solid #cbddec;
  display: grid;
  gap: 2px;
}

.mail-user-card strong { font-size: 14px; }
.mail-user-card span { color: #57718a; font-size: 12px; word-break: break-all; }

.mail-entry-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  border: 1px solid rgba(203, 216, 229, .86);
  border-radius: 8px;
  background: rgba(255, 255, 255, .58);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

.mail-entry-actions button {
  height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: #42627d;
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  padding: 0 8px;
  justify-content: center;
}

.mail-entry-actions button.active,
.mail-entry-actions button:hover {
  border-color: rgba(159, 196, 223, .86);
  background: rgba(255, 255, 255, .92);
  color: #0e5d8f;
  box-shadow: 0 6px 16px rgba(15, 23, 42, .07);
  transform: translateY(-1px);
}

.mail-folders,
.mail-side-group {
  padding: 6px 0;
  border-bottom: 1px solid #cbddec;
}

.mail-folders button,
.mail-side-group button {
  min-height: 28px;
  width: 100%;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #244560;
  padding: 0 8px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
}

.mail-folders button::before,
.mail-side-group button::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 8px;
  border-radius: 50%;
  background: #7e9ab3;
}

.mail-folders button,
.mail-side-group button { justify-content: flex-start; }
.mail-folders button span { margin-left: auto; color: #8b4a1d; font-weight: 700; }

.mail-folders button.active,
.mail-folders button:hover,
.mail-side-group button:hover {
  background: #d7eaf8;
  color: #0e5d8f;
}

.mail-side-group > span {
  display: block;
  padding: 8px 12px 4px;
  color: #72899d;
  font-size: 12px;
  font-weight: 700;
}

.mail-side .side-card {
  margin-top: auto;
  color: #244560;
  border-color: #c5d7e7;
  background: rgba(255, 255, 255, .46);
}

.mail-side .progress { background: #d2e0ec; }
.mail-side .ghost { color: #0e5d8f; border-color: #b9ccdd; background: #f7fbff; }

.mail-main {
  display: grid;
  grid-template-rows: 31px 49px minmax(0, 1fr);
  background: #fff;
}

.mail-account-bar {
  height: 31px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  overflow: hidden;
  background: linear-gradient(#fafdff, #edf6fd);
  border-bottom: 1px solid #cdddec;
  color: #476781;
  font-size: 12px;
}

.account-links,
.account-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.account-links::-webkit-scrollbar,
.account-actions::-webkit-scrollbar { display: none; }

.account-links button,
.account-actions button {
  min-height: 24px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #476781;
  padding: 0 7px;
  font-size: 12px;
  font-weight: 600;
}

.account-links button:hover,
.account-actions button:hover,
.account-links button.active,
.account-actions button.active {
  background: #dff0fb;
  color: #0e5d8f;
}

.mail-top {
  min-height: 49px;
  padding: 8px 14px;
  min-width: 0;
  grid-template-columns: minmax(260px, 560px) minmax(0, auto);
  justify-content: space-between;
  background: #f6fbff;
  border-bottom: 1px solid #cdddec;
}

.mail-search {
  min-width: 0;
  height: 32px;
  border-color: #bfd5e6;
  border-radius: 3px;
  background: #fff;
}

.mail-search span { color: #56738e; }

.mail-content {
  height: auto;
  min-height: 0;
  grid-template-columns: minmax(0, 1fr);
  border-top: 0;
  background: #f7f9fb;
  animation: pageFade .2s ease both;
}

.mail-list-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.mail-list-pane.full-list {
  margin: 16px 18px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
  overflow: hidden;
}

.mail-list-title {
  min-height: 54px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #d8e4ee;
  color: #17314d;
}

.mail-list-title strong { font-size: 15px; }
.mail-list-title span { color: #6d8193; font-size: 12px; }

.mail-list-toolbar,
.reader-toolbar {
  min-height: 38px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid #d8e4ee;
  background: #f7fbff;
  overflow-x: auto;
  scrollbar-width: none;
}

.mail-list-toolbar::-webkit-scrollbar,
.reader-toolbar::-webkit-scrollbar { display: none; }

.mail-list-toolbar button,
.reader-toolbar button,
.compose-recipient-tools button,
.editor-toolbar button {
  min-height: 28px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #2f5878;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.mail-list-toolbar button:hover,
.reader-toolbar button:hover,
.compose-recipient-tools button:hover,
.editor-toolbar button:hover {
  border-color: #b9cfe2;
  background: #fff;
}

.editor-toolbar .color-swatches button {
  width: 20px;
  min-width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  background: var(--swatch);
}

.message-list {
  border-right: 0;
  flex: 1;
  min-height: 0;
  background: #fff;
}

.message-group {
  min-height: 34px;
  padding: 0 14px;
  color: #6b7f91;
  background: #fbfdff;
  border-bottom: 1px solid #edf2f7;
  font-size: 12px;
  font-weight: 700;
}

.message-header {
  display: grid;
  grid-template-columns: 26px 26px minmax(112px, 170px) minmax(0, 1fr) minmax(76px, 104px) 68px;
  align-items: center;
  gap: 10px;
}

.message-item {
  min-height: 68px;
  padding: 0 14px;
  display: grid;
  grid-template-columns: 26px 26px minmax(112px, 170px) minmax(0, 1fr) minmax(76px, 104px) 68px;
  align-items: center;
  gap: 10px;
  color: #1b2d42;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  background: #fff;
  width: 100%;
}

.message-item input { margin: 0; }
.message-star { color: #b5c0ca; font-size: 16px; }
.message-sender { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 700; }
.message-subject {
  min-width: 0;
  display: grid;
  gap: 3px;
  overflow: hidden;
}
.message-subject strong,
.message-subject small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.message-subject strong { color: #18263a; font-size: 14px; font-weight: 650; }
.message-subject small { color: #7b8b9a; font-size: 12px; }
.message-status {
  width: max-content;
  max-width: 100%;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef6fb;
  color: #2f5878;
  font-size: 12px;
  font-weight: 650;
}
.message-time { color: #7d8b98; font-size: 12px; text-align: right; }

.message-item strong,
.message-item span { font-size: inherit; }

.message-item.active {
  background: #f7fbff;
  box-shadow: inset 3px 0 0 #2f8ec5;
}

.message-item:hover {
  background: #f8fbfe;
  transform: translateY(-1px);
}

.mail-list-footer {
  padding: 9px 12px 0;
  border-top: 1px solid #d8e4ee;
  color: #6b7f91;
  font-size: 12px;
  background: #f7fbff;
}

.message-reader {
  padding: 0;
  gap: 0;
  background: #fff;
}

.message-reader.detail-page {
  margin: 16px 18px 18px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .06);
  overflow: auto;
  animation: pageFade .2s ease both;
}

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

.reader-head h3 {
  margin-bottom: 9px;
  font-size: 20px;
  line-height: 28px;
}

.reader-meta {
  gap: 8px 18px;
  font-size: 12px;
}

.reader-security {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.reader-security span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 8px;
  border: 1px solid #cfe4d8;
  border-radius: 999px;
  background: #f2fbf6;
  color: #0f6844;
  font-size: 12px;
  font-weight: 650;
}

.reader-body {
  padding: 24px;
  min-height: 260px;
  line-height: 1.8;
}

.quick-reply {
  margin: 0 24px 24px;
  display: grid;
  gap: 8px;
}

.quick-reply textarea {
  min-height: 72px;
  padding: 9px 10px;
  resize: vertical;
}

.mail-main.compose-open {
  grid-template-rows: 31px 49px minmax(0, 1fr);
}

.mail-main.compose-open .mail-content { display: none; }

.compose-page {
  min-height: 0;
  display: none;
  grid-template-rows: 39px minmax(0, 1fr);
  background: #fff;
}

.compose-page.active { display: grid; }

@keyframes pageFade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.compose-tabs {
  padding: 7px 14px 0;
  display: flex;
  align-items: end;
  gap: 3px;
  border-bottom: 1px solid #cdddec;
  background: #edf6fd;
}

.compose-tabs button {
  min-height: 32px;
  border: 1px solid #c2d4e4;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  background: #e1eef8;
  color: #2b5b7c;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 700;
}

.compose-tabs button.active {
  background: #fff;
  color: #0e5d8f;
}

.compose-form {
  padding: 0;
  gap: 0;
  display: flex;
  flex-direction: column;
}

.compose-command-bar {
  min-height: 42px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #d8e4ee;
  background: #f7fbff;
}

.compose-command-bar span {
  margin-left: auto;
  color: #7a8b9c;
  font-size: 12px;
}

.compose-context {
  min-height: 32px;
  padding: 7px 14px 7px 80px;
  border-bottom: 1px solid #e5eef6;
  background: #fbfdff;
  color: #51677b;
  font-size: 12px;
}

.compose-line {
  min-height: 41px;
  padding: 5px 14px;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  align-items: center;
  border-bottom: 1px solid #edf2f7;
  color: #4c6277;
  font-size: 13px;
  font-weight: 600;
}

.compose-line > input {
  min-height: 30px;
  border: 0;
  outline: none;
  padding: 0 6px;
}

.compose-line.optional {
  display: none;
}

.compose-line.optional.show {
  display: grid;
}

.compose-recipient-tools {
  min-height: 32px;
  padding: 0 14px 0 80px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #edf2f7;
}

.compose-page .recipient-box {
  min-height: 30px;
  border: 0;
  padding: 0;
}

.compose-page .recipient-token {
  min-height: 25px;
  border-radius: 3px;
}

.compose-page .editor-toolbar {
  min-height: 36px;
  padding: 4px 14px;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  border-width: 0 0 1px;
  border-radius: 0;
  background: #fbfdff;
}

.compose-page .editor-toolbar select {
  height: 28px;
  border: 1px solid #d6e2ee;
  border-radius: 6px;
  background: #fff;
  color: #334b62;
  font-size: 12px;
}

.color-swatches {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 0 4px;
}

.color-swatches button {
  width: 20px;
  min-width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(16, 37, 58, .16);
  border-radius: 50%;
  background: var(--swatch);
}

.compose-page .editor {
  min-height: 260px;
  padding: 18px 24px;
  border: 0;
  border-radius: 0;
  line-height: 1.85;
  outline: none;
  overflow: auto;
}

.compose-page .editor:focus {
  box-shadow: inset 0 0 0 2px rgba(29, 127, 184, .14);
}

.compose-page .editor blockquote.mail-quote {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-left: 3px solid #b8c9d8;
  background: #f6f9fc;
  color: #52687a;
}

.compose-page .editor .mail-signature {
  color: #42586d;
}

.compose-page .editor .mail-signature span {
  color: #6e8395;
}

.compose-page .editor .forward-attachment-note {
  margin: 12px 0;
  padding: 10px 12px;
  border: 1px solid #f0d49a;
  border-radius: 6px;
  background: #fff8e7;
  color: #8a5a09;
}

.compose-page .editor .mail-inline-image {
  max-width: 360px;
  margin: 14px 0;
  border: 1px dashed #aac0d3;
  border-radius: 8px;
  background: #f7fbff;
  overflow: hidden;
}

.compose-page .editor .mail-inline-image div {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: #4a6f8e;
  background: linear-gradient(135deg, #eaf5ff, #f8fbff);
}

.compose-page .editor .mail-inline-image figcaption {
  padding: 8px 10px;
  color: #687b8d;
  font-size: 12px;
}

.compose-page .attachment-row {
  min-height: 38px;
  padding: 6px 14px;
  border-top: 1px solid #edf2f7;
  border-bottom: 1px solid #edf2f7;
}

.attachment-chip.amber {
  border-color: #efd9a6;
  background: #fff8e7;
  color: #7a5311;
}

.attachment-chip.muted {
  border-color: #d8e4ee;
  background: #f7fbff;
  color: #7a8b9c;
}

.attachment-chip button {
  margin-left: 8px;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 104, 68, .1);
  color: inherit;
  line-height: 1;
}

.compose-bottom-options {
  min-height: 42px;
  padding: 6px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid #edf2f7;
  color: #5b7083;
  font-size: 12px;
}

.compose-bottom-options select {
  min-height: 28px;
  border: 1px solid #cbd8e5;
  border-radius: 3px;
  background: #fff;
}

.compose-page .compose-status {
  margin: 8px 14px;
  border-radius: 4px;
}

.compose-command-bar.bottom {
  border-top: 1px solid #d8e4ee;
  border-bottom: 0;
}

.employee-page {
  grid-column: 1 / -1;
  min-width: 0;
  overflow: auto;
  padding: 22px 26px;
  background: #f8fbfe;
}

.employee-page-head {
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.employee-page-head h2 {
  margin-bottom: 5px;
  color: #122942;
  font-size: 22px;
  line-height: 30px;
  font-weight: 650;
}

.employee-page-head p {
  color: #64788b;
  line-height: 1.6;
}

.employee-grid {
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.empty-state {
  min-height: 220px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 28px;
  color: #64788b;
  text-align: center;
  background: #fff;
}

.empty-state strong {
  color: #17314d;
  font-size: 16px;
}

.reader-attachments {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.message-item.unread .message-sender,
.message-item.unread .message-subject {
  color: #122942;
  font-weight: 800;
}

.message-star {
  border-radius: 3px;
  cursor: pointer;
}

.message-star:hover {
  color: #b7791f;
  background: #fff4db;
}

.search-filters {
  min-height: 36px;
  padding: 5px 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  border-bottom: 1px solid #d8e4ee;
  background: #fbfdff;
}

.search-filters button {
  min-height: 26px;
  border: 1px solid #d8e4ee;
  border-radius: 999px;
  background: #fff;
  color: #42627d;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 650;
}

.search-filters button.active,
.search-filters button:hover {
  border-color: #9fc4df;
  background: #e7f4fc;
  color: #0e5d8f;
}

.settings-layout {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 14px;
}

.settings-tabs {
  display: grid;
  align-content: start;
  gap: 6px;
}

.settings-tabs button {
  min-height: 36px;
  border: 1px solid #d8e4ee;
  border-radius: 6px;
  background: #fff;
  color: #42627d;
  text-align: left;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 650;
}

.settings-tabs button.active,
.settings-tabs button:hover {
  border-color: #9fc4df;
  background: #e7f4fc;
  color: #0e5d8f;
}

.help-list {
  display: grid;
  gap: 10px;
}

.help-item {
  padding: 16px 18px;
  border: 1px solid #d8e4ee;
  border-radius: 8px;
  background: #fff;
}

.help-item strong {
  color: #17314d;
  font-size: 15px;
}

.help-item p {
  margin-top: 6px;
  color: #64788b;
  line-height: 1.65;
}

.notice-list {
  display: grid;
  gap: 0;
  background: #fff;
}

.notice-item {
  width: 100%;
  min-height: 96px;
  padding: 16px 18px;
  border: 0;
  border-bottom: 1px solid #edf2f7;
  background: #fff;
  display: grid;
  gap: 6px;
  text-align: left;
}

.notice-item:hover {
  background: #f8fbfe;
}

.notice-item strong {
  color: #18263a;
  font-size: 15px;
}

.notice-item span,
.notice-item p {
  color: #64788b;
  font-size: 13px;
  line-height: 1.6;
}

/* Admin */
.side-title {
  color: #c8d9e8;
  font-size: 12px;
  font-weight: 600;
}

.admin-nav-group {
  display: grid;
  gap: 2px;
  margin-top: 8px;
}

.admin-nav-title {
  padding: 10px 10px 4px;
  color: #8aa6bd;
  font-size: 12px;
  font-weight: 700;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-page {
  padding: 20px 24px;
  display: grid;
  gap: 16px;
}

.admin-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.org-tree {
  padding: 14px;
  display: grid;
  align-content: start;
  gap: 6px;
  border: 1px solid var(--hy-border);
  border-radius: var(--hy-radius-lg);
  background: #fff;
}

.org-tree strong {
  margin-bottom: 6px;
  color: var(--hy-navy);
}

.org-tree button {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #42627d;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 650;
}

.org-tree button.active,
.org-tree button:hover {
  background: #e7f4fc;
  color: var(--hy-primary);
}

.admin-workarea {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.panel-head {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cards {
  display: grid;
  gap: 14px;
}

.cards.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.metric-value {
  color: var(--hy-navy);
  font-size: 26px;
  line-height: 34px;
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.risk-board {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 14px;
}

.launch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.launch-stage {
  display: grid;
  gap: 12px;
}

.launch-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef4;
}

.launch-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #1d7fb8, #44c19a);
}

.launch-items {
  display: grid;
  gap: 8px;
}

.launch-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--hy-border);
  border-radius: var(--hy-radius);
  background: var(--hy-surface-soft);
}

.launch-item strong {
  display: block;
  margin-bottom: 4px;
}

.launch-item p {
  margin: 0 0 4px;
  color: var(--hy-text-secondary);
  line-height: 1.5;
}

.launch-item small {
  color: var(--hy-text-muted);
}

.plain-list {
  margin: 12px 0 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.plain-list li {
  padding: 10px 12px;
  border: 1px solid var(--hy-border);
  border-radius: 8px;
  background: var(--hy-surface-soft);
  color: var(--hy-text-secondary);
  line-height: 1.5;
}

.plain-list strong {
  color: var(--hy-text-primary);
}

.task-row {
  min-height: 52px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--hy-border);
  padding: 10px 0;
}

.task-row:last-child { border-bottom: 0; }
.task-row strong { display: block; font-size: 14px; margin-bottom: 4px; }

.toolbar-filter {
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
  background: var(--hy-surface-soft);
  border: 1px solid var(--hy-border);
  border-radius: var(--hy-radius-lg);
}

.toolbar-filter.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
}

.secondary.mini {
  min-height: 28px;
  margin: 2px;
  padding: 0 8px;
  font-size: 12px;
}

.quota-cell {
  min-width: 128px;
  display: grid;
  gap: 5px;
}

.quota-track {
  height: 7px;
  border-radius: 999px;
  overflow: hidden;
  background: #e4edf5;
}

.quota-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #4bbf9a, #2f8ec5);
}

.protocol-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.protocol-tags span {
  min-height: 22px;
  display: inline-flex;
  align-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef6fb;
  color: #2f5878;
  font-size: 12px;
  font-weight: 650;
}

.admin-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
}

.admin-modal.show {
  display: block;
}

.admin-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 42, 67, .28);
  backdrop-filter: blur(3px);
}

.admin-modal-card {
  position: absolute;
  right: 28px;
  top: 80px;
  width: min(560px, calc(100vw - 40px));
  border: 1px solid var(--hy-border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--hy-shadow-pop);
  overflow: hidden;
}

.admin-modal-card header,
.admin-modal-card footer {
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #f8fbfe;
  border-bottom: 1px solid var(--hy-border);
}

.admin-modal-card footer {
  justify-content: flex-end;
  border-top: 1px solid var(--hy-border);
  border-bottom: 0;
}

.admin-modal-card h3 {
  margin-bottom: 4px;
  color: var(--hy-navy);
  font-size: 18px;
}

.admin-modal-card p {
  color: var(--hy-text-secondary);
  line-height: 1.55;
}

.admin-modal-body {
  padding: 16px;
  display: grid;
  gap: 12px;
}

.modal-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.import-preview,
.audit-detail {
  padding: 14px;
  border: 1px solid var(--hy-border);
  border-radius: 8px;
  background: #fbfdff;
  display: grid;
  gap: 6px;
}

/* Simple pages */
.simple-page { background: var(--hy-bg); }

.simple-main {
  max-width: 1120px;
  margin: 0 auto;
  padding: 38px 18px;
  display: grid;
  gap: 18px;
}

.simple-main.narrow { max-width: 560px; }

.simple-main h1 {
  font-size: 28px;
  line-height: 38px;
  font-weight: 650;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

@media (max-width: 1180px) {
  .mail-top { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .mail-top .actions {
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .mail-top .actions::-webkit-scrollbar { display: none; }
  .risk-board, .cards.four, .launch-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .login-main { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .mail-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .mail-side, .admin-side { min-height: auto; }
  .mail-side {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .mail-side-brand,
  .mail-user-card {
    border-bottom: 0;
  }
  .mail-entry-actions { padding: 6px; }
  .mail-folders {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 0 8px;
    scrollbar-width: none;
  }
  .mail-folders::-webkit-scrollbar { display: none; }
  .mail-folders button {
    width: auto;
    min-width: max-content;
    min-height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .5);
  }
  .mail-folders button::before { display: none; }
  .mail-side-group,
  .mail-side .side-card,
  .mail-side > .ghost { display: none; }
  .mail-account-bar,
  .mail-top { padding-left: 10px; padding-right: 10px; }
  .mail-content { height: auto; grid-template-columns: 1fr; }
  .message-list { max-height: 360px; border-right: 0; border-bottom: 1px solid var(--hy-border); }
  .message-reader { min-height: 360px; }
  .message-header,
  .message-item {
    grid-template-columns: 24px 24px minmax(92px, 124px) minmax(0, 1fr) minmax(66px, 88px);
    gap: 8px;
    padding-left: 10px;
    padding-right: 10px;
  }
  .message-header span:nth-child(6),
  .message-time { display: none; }
  .cards.two, .cards.three, .cards.four, .risk-board, .launch-grid, .form-grid, .toolbar-filter, .steps { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .login-top, .simple-head, .mail-top, .admin-top {
    height: auto;
    min-height: 66px;
    align-items: stretch;
    flex-direction: column;
    padding: 12px 14px;
  }
  .login-main { padding: 24px 14px; gap: 24px; }
  .login-brand h1 { font-size: 30px; line-height: 38px; }
  .login-card, .admin-login-card { padding: 18px; }
  .top-links { justify-content: space-between; }
  .brand-logo { width: 156px; }
  .two { grid-template-columns: 1fr; }
  .compose-panel {
    inset: 0;
    width: 100vw;
    max-height: none;
    border-radius: 0;
  }
  .compose-options, .attachment-row { align-items: stretch; }
  .compose-options > *, .attachment-row > *, .actions > * { width: 100%; }
  .field.small { width: 100%; }
  .mail-entry-actions button { padding: 0 4px; }
  .message-header,
  .message-item {
    grid-template-columns: 22px 22px minmax(76px, 94px) minmax(0, 1fr);
  }
  .message-header span:nth-child(5),
  .message-status { display: none; }
  .mail-list-pane.full-list,
  .message-reader.detail-page {
    margin: 10px;
    border-radius: 8px;
  }
  .employee-page { padding: 16px 12px; }
  .settings-layout,
  .employee-grid { grid-template-columns: 1fr; }
}
