:root {
  --ink: #11172a;
  --muted: #6d7484;
  --line: rgba(17, 23, 42, 0.1);
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --navy: #07008b;
  --navy-2: #0a0f37;
  --red: #d10000;
  --red-2: #a90000;
  --gold: #ffc845;
  --green: #11a36a;
  --bg: #f3f4f6;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* {
  box-sizing: border-box;
}

html {
  background: #f3f4f6;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  background: #f3f4f6;
  overscroll-behavior-y: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button,
a,
label,
input,
textarea {
  -webkit-tap-highlight-color: rgba(209, 0, 0, 0.12);
}

a {
  color: inherit;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #f3f4f6;
}

.auth-card {
  width: min(840px, 100%);
  display: grid;
  grid-template-columns: 0.92fr 1fr;
  overflow: hidden;
  border-radius: 30px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.36);
  box-shadow: 0 32px 90px rgba(0, 0, 0, 0.3);
}

.auth-hero {
  position: relative;
  overflow: hidden;
  min-height: 520px;
  padding: 42px;
  background: var(--navy);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-hero::after {
  display: none;
}

.logo-card {
  width: min(260px, 82%);
  max-width: 82%;
  border-radius: 24px;
  padding: 16px;
  background: white;
  box-shadow: 0 24px 58px rgba(0, 0, 0, 0.28);
}

.logo-card img,
.app-logo img {
  width: 100%;
  height: auto;
  display: block;
}

.auth-copy {
  position: relative;
  z-index: 2;
}

.eyebrow {
  color: var(--red);
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
}

.auth-hero .eyebrow {
  color: var(--gold);
}

.auth-copy h1 {
  margin: 14px 0 16px;
  max-width: 520px;
  font-size: clamp(40px, 7vw, 72px);
  line-height: 0.9;
  letter-spacing: -0.07em;
}

.auth-copy p {
  max-width: 480px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 17px;
}

.auth-panel {
  padding: 46px 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
  background: #f3f4f6;
}

.auth-panel h2,
.panel h2,
.panel h3,
.panel p,
.message h2,
.message p,
.topbar h1,
.topbar p {
  margin: 0;
}

.auth-panel h2 {
  font-size: 34px;
  letter-spacing: -0.04em;
}

.stack {
  display: grid;
  gap: 13px;
}

.auth-panel.stack,
.compact-auth {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.compact-auth .field + .field {
  margin-top: 0;
}

.compact-auth .btn {
  margin-top: 4px;
}

.field {
  display: grid;
  gap: 5px;
}

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  min-height: 48px;
  padding: 13px 14px;
  outline: none;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
}

textarea {
  resize: vertical;
  min-height: 132px;
}

.input:focus,
textarea:focus,
select:focus {
  border-color: rgba(7, 0, 139, 0.45);
  box-shadow: 0 0 0 4px rgba(7, 0, 139, 0.08);
}

.btn {
  border: 0;
  border-radius: 16px;
  min-height: 48px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 850;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: linear-gradient(135deg, var(--red), var(--red-2));
  color: white;
  box-shadow: 0 16px 32px rgba(209, 0, 0, 0.22);
}

.btn.navy {
  background: var(--navy);
  color: white;
}

.btn.ghost {
  background: rgba(7, 0, 139, 0.07);
  color: var(--navy);
}

.btn.light {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn.danger {
  background: rgba(209, 0, 0, 0.08);
  color: var(--red);
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
}

.status {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
  font-size: 14px;
}

.status.warn {
  background: #fff7e0;
  border-color: #ffe09a;
  color: #76530a;
}

.status.ok {
  background: #ecfff6;
  border-color: #afeacb;
  color: #09623e;
}

.status.error {
  background: #fff0f0;
  border-color: #ffb9b9;
  color: #8d1111;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 294px minmax(0, 1fr);
  background: #f3f4f6;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: linear-gradient(180deg, var(--navy-2), #050713);
  color: white;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.app-logo {
  display: grid;
  gap: 10px;
}

.app-logo .logo-wrap {
  width: 190px;
  background: white;
  border-radius: 16px;
  padding: 10px;
}

.app-logo strong {
  font-size: 18px;
}

.app-logo span {
  display: block;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.75);
  padding: 14px;
  font-weight: 800;
}

.nav button span {
  display: block;
  line-height: 1.08;
}

.nav button small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

.nav button.active {
  color: white;
  background: rgba(209, 0, 0, 0.78);
  border-color: rgba(255, 255, 255, 0.25);
}

.nav button.active small {
  color: rgba(255, 255, 255, 0.82);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 10px;
  color: rgba(255, 255, 255, 0.65);
  font-size: 13px;
}

.main {
  min-width: 0;
  padding: 24px;
  background: #f3f4f6;
}

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

.topbar h1 {
  font-size: clamp(28px, 4vw, 46px);
  letter-spacing: -0.06em;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.03em;
  background: rgba(17, 23, 42, 0.08);
}

.badge.ok {
  background: #ddfff0;
  color: #05633b;
}

.badge.warn {
  background: #fff0c7;
  color: #6b4700;
}

.folder-tabs {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 0 2px 12px;
  margin-bottom: 4px;
  scrollbar-width: thin;
}

.folder-tab {
  min-width: 118px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  padding: 11px 13px;
  display: grid;
  gap: 2px;
  text-align: left;
  box-shadow: 0 14px 36px rgba(10, 15, 55, 0.06);
}

.folder-tab span {
  font-weight: 900;
}

.folder-tab small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.folder-tab.active {
  background: var(--navy);
  border-color: rgba(255, 255, 255, 0.25);
  color: white;
}

.folder-tab.active small {
  color: rgba(255, 255, 255, 0.72);
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(320px, 0.9fr) minmax(0, 1.35fr);
}

.panel {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 28px;
  box-shadow: 0 22px 70px rgba(10, 15, 55, 0.1);
  padding: 18px;
}

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

.panel h2 {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.bulk-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.bulk-actions .btn {
  min-height: 40px;
  border-radius: 14px;
  padding: 0 12px;
  font-size: 13px;
}

.bulk-actions.all-folder-selected {
  border-color: rgba(209, 0, 0, 0.2);
}

.bulk-note {
  flex-basis: 100%;
  border-radius: 12px;
  padding: 8px 10px;
  background: rgba(209, 0, 0, 0.06);
  color: #8d1111;
  font-size: 12px;
  font-weight: 800;
}

.mail-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 220px);
  overflow: auto;
  padding-right: 4px;
}

.mail-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}

.mail-row.active .mail-item {
  border-color: rgba(209, 0, 0, 0.48);
  box-shadow: 0 12px 30px rgba(209, 0, 0, 0.1);
}

.mail-check {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.mail-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--red);
}

.mail-row.unread .mail-item {
  border-color: rgba(7, 0, 139, 0.28);
  background: rgba(255, 255, 255, 0.94);
}

.mail-row.unread .mail-item strong::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 999px;
  background: var(--red);
  vertical-align: 0.08em;
}

.mail-item {
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
}

.mail-avatar {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(7, 0, 139, 0.12), rgba(209, 0, 0, 0.1));
  color: var(--navy);
  font-size: 13px;
  font-weight: 950;
}

.mail-content {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.mail-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12.5px;
}

.mail-contact {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mail-topline time {
  flex: 0 0 auto;
  font-weight: 800;
  color: rgba(109, 116, 132, 0.82);
}

.mail-thread-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

.mail-thread-line > span:last-child {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.thread-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(7, 0, 139, 0.08);
  color: var(--navy);
  font-size: 11px;
  font-weight: 900;
}

.empty-message-state {
  opacity: 0.86;
}

.message-thread {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.72);
  display: grid;
  gap: 10px;
}

.thread-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.thread-heading strong {
  color: var(--navy);
  letter-spacing: 0;
  text-transform: none;
}

.thread-list {
  display: grid;
  gap: 7px;
}

.thread-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.76);
  padding: 9px 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  color: var(--ink);
  font-weight: 850;
}

.thread-item small {
  color: var(--muted);
  font-weight: 750;
}

.thread-item.active {
  border-color: rgba(209, 0, 0, 0.32);
  background: rgba(209, 0, 0, 0.07);
}

.message-copy {
  white-space: normal;
}

.inbox-signature-card {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid;
  grid-template-columns: minmax(110px, 170px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.signature-logo {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px;
  box-shadow: 0 10px 28px rgba(10, 15, 55, 0.08);
}

.signature-logo img {
  width: 100%;
  height: auto;
  display: block;
}

.signature-details {
  border-left: 4px solid var(--red);
  padding-left: 14px;
  display: grid;
  gap: 3px;
  line-height: 1.25;
}

.signature-details strong {
  color: var(--navy);
  font-size: 17px;
}

.signature-details span:nth-child(2) {
  color: var(--red);
  font-weight: 850;
}

.signature-details a {
  color: var(--navy);
  font-weight: 800;
  text-decoration: none;
}

.attachment-section {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 24px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 12px 28px rgba(10, 15, 55, 0.06);
}

.attachment-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.attachment-head strong {
  color: var(--navy);
  font-size: 16px;
}

.attachment-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

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

.attachment-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 20px;
  padding: 12px;
  background: #fff;
}

.attachment-card.compact {
  grid-template-columns: 40px minmax(0, 1fr);
  padding: 10px;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.76);
}

.attachment-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--navy), var(--red));
  font-size: 11px;
  font-weight: 1000;
  letter-spacing: 0.03em;
}

.attachment-card.compact .attachment-icon {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  font-size: 10px;
}

.attachment-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.attachment-copy strong {
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.attachment-copy small {
  color: var(--muted);
  font-weight: 750;
}

.attachment-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment-actions .btn {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 13px;
  font-size: 13px;
}

.signature-assets {
  border-top: 1px solid rgba(17, 24, 39, 0.08);
  padding-top: 10px;
}

.signature-assets summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.signature-grid {
  margin-top: 10px;
}

.attachment-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.attachment-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 10px;
  background: white;
  font-size: 13px;
  font-weight: 850;
}

.attachment-pill small {
  color: var(--muted);
  margin-left: 4px;
}

.mail-item {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  text-align: left;
  padding: 14px;
  display: grid;
  gap: 5px;
}

.mail-item strong {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mail-meta,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.message {
  min-height: 520px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
}

.message-header {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.message-body {
  white-space: pre-wrap;
  line-height: 1.55;
  overflow: auto;
  max-height: calc(100vh - 350px);
  padding-right: 4px;
}

.compose-card {
  display: grid;
  gap: 13px;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.doc-card {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.8);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.doc-card h3 {
  font-size: 18px;
}

.doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  border-radius: 999px;
  padding: 0 13px;
  font-weight: 800;
}

.doc-chip input {
  accent-color: var(--red);
}

.forward-picker {
  border: 1px solid rgba(12, 36, 97, 0.12);
  border-radius: 24px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(239, 246, 255, 0.92), rgba(255, 255, 255, 0.92));
  display: grid;
  gap: 12px;
}

.forward-picker-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.forward-picker-head div {
  display: grid;
  gap: 3px;
}

.forward-picker-head strong {
  color: var(--navy);
  font-size: 16px;
}

.forward-picker-head span,
.forward-picker-head small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.forward-picker-head small {
  white-space: nowrap;
  background: rgba(12, 36, 97, 0.08);
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 10px;
}

.forward-attachment-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.forward-attachment-option {
  display: grid;
  grid-template-columns: auto 40px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 18px;
  padding: 10px;
  background: #fff;
  cursor: pointer;
}

.forward-attachment-option input {
  width: 20px;
  height: 20px;
  accent-color: var(--red);
}

.forward-attachment-option.checked {
  border-color: rgba(213, 43, 30, 0.46);
  box-shadow: 0 12px 28px rgba(213, 43, 30, 0.08);
}

.forward-attachment-option .attachment-icon {
  width: 40px;
  height: 40px;
  border-radius: 13px;
  font-size: 10px;
}

.forward-attachment-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.forward-attachment-copy strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.forward-attachment-copy small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.doc-picker {
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 24px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(248, 250, 252, 0.92));
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
  display: grid;
  gap: 12px;
}

.doc-picker.attention {
  animation: pickerPulse 1.15s ease;
}

.doc-picker-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.doc-picker-head div {
  display: grid;
  gap: 3px;
}

.doc-picker-head strong {
  color: var(--navy);
  font-size: 16px;
}

.doc-picker-head span,
.doc-picker-head small,
.doc-option small {
  color: var(--muted);
  font-weight: 700;
  font-size: 12px;
}

.doc-picker-head small {
  white-space: nowrap;
  background: rgba(12, 36, 97, 0.08);
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 10px;
}

.doc-picker-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.doc-picker-presets button {
  border: 1px solid rgba(12, 36, 97, 0.14);
  background: #fff;
  color: var(--navy);
  border-radius: 999px;
  min-height: 38px;
  font-weight: 900;
  cursor: pointer;
}

.doc-picker-presets button:hover {
  border-color: rgba(213, 43, 30, 0.38);
  color: var(--red);
}

.doc-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.doc-option {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 72px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  border-radius: 20px;
  background: #fff;
  padding: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.doc-option:hover {
  transform: translateY(-1px);
  border-color: rgba(12, 36, 97, 0.26);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.doc-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.doc-option-check {
  width: 28px;
  height: 28px;
  border-radius: 10px;
  border: 2px solid rgba(12, 36, 97, 0.18);
  background: rgba(243, 244, 246, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.doc-option.checked,
.doc-option:has(input:checked) {
  border-color: rgba(213, 43, 30, 0.48);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(254, 242, 242, 0.92));
  box-shadow: 0 12px 30px rgba(213, 43, 30, 0.11);
}

.doc-option.checked .doc-option-check,
.doc-option:has(input:checked) .doc-option-check {
  border-color: var(--red);
  background: var(--red);
}

.doc-option.checked .doc-option-check::after,
.doc-option:has(input:checked) .doc-option-check::after {
  content: "\2713";
  color: #fff;
  font-weight: 1000;
  font-size: 16px;
  line-height: 1;
}

.doc-option-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.doc-option-copy strong {
  color: var(--ink);
  font-size: 16px;
}

.doc-option.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

@keyframes pickerPulse {
  0%, 100% { box-shadow: 0 14px 34px rgba(15, 23, 42, 0.08); }
  35% { box-shadow: 0 0 0 4px rgba(213, 43, 30, 0.16), 0 18px 40px rgba(213, 43, 30, 0.14); }
}

.chips {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.quick-replies {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.quick-replies button {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px;
  background: rgba(7, 0, 139, 0.07);
  color: var(--navy);
  font-weight: 850;
}

.signature-preview {
  border-left: 5px solid var(--red);
  background: white;
  border-radius: 18px;
  padding: 14px;
  line-height: 1.35;
}

.signature-preview strong {
  color: var(--navy);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: end center;
  background: rgba(5, 7, 19, 0.5);
  padding: 20px;
}

.modal {
  width: min(760px, 100%);
  max-height: min(900px, calc(100vh - 40px));
  overflow: auto;
  background: white;
  border-radius: 30px;
  padding: 20px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
}

.hidden {
  display: none !important;
}

.desktop-hidden {
  display: none;
}

@media (max-width: 980px) {
  body {
    min-height: 100dvh;
  }

  .auth-card {
    grid-template-columns: 1fr;
  }

  .auth-hero {
    min-height: 300px;
  }

  .app-shell {
    grid-template-columns: 1fr;
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    inset: auto 10px calc(10px + env(safe-area-inset-bottom)) 10px;
    z-index: 30;
    height: auto;
    border-radius: 26px;
    padding: 8px;
    flex-direction: row;
    align-items: center;
    background: rgba(5, 7, 19, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 22px 70px rgba(5, 7, 19, 0.34);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .app-logo,
  .sidebar-footer {
    display: none;
  }

  .nav {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }

  .nav button {
    min-height: 52px;
    padding: 7px 5px;
    text-align: center;
    border-radius: 18px;
    font-size: 11px;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 2px;
    white-space: nowrap;
  }

  .nav button small {
    margin-top: 0;
    font-size: 9.5px;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .main {
    padding: 0 14px calc(176px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin: 0 -14px 14px;
    padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
    background: rgba(243, 244, 246, 0.94);
    border-bottom: 1px solid rgba(17, 23, 42, 0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  .topbar h1 {
    font-size: clamp(27px, 8vw, 36px);
    line-height: 0.96;
    letter-spacing: -0.065em;
  }

  .topbar .muted {
    display: none;
  }

  .eyebrow {
    font-size: 10px;
    letter-spacing: 0.1em;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    justify-content: stretch;
  }

  .top-actions .badge {
    grid-column: 1 / -1;
    justify-content: center;
    min-height: 30px;
  }

  .top-actions .btn {
    width: 100%;
    min-height: 48px;
    border-radius: 16px;
  }

  .folder-tabs {
    display: none;
  }

  .grid {
    gap: 12px;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .panel {
    border-radius: 26px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 16px 46px rgba(10, 15, 55, 0.08);
  }

  .panel-header {
    align-items: flex-start;
    margin-bottom: 10px;
  }

  .panel h2 {
    font-size: 20px;
  }

  .doc-grid,
  .quick-replies {
    grid-template-columns: 1fr;
  }

  .bulk-actions {
    position: sticky;
    top: calc(98px + env(safe-area-inset-top));
    z-index: 15;
    display: grid;
    grid-template-columns: 1fr 0.74fr;
    gap: 8px;
    margin: 0 0 12px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 12px 28px rgba(10, 15, 55, 0.08);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }

  .bulk-actions #deleteSelectedBtn {
    grid-column: 1 / -1;
  }

  .bulk-actions .btn {
    min-height: 44px;
    border-radius: 14px;
    padding: 0 10px;
    font-size: 13px;
  }

  .mail-list {
    max-height: none;
    gap: 9px;
    overflow: visible;
    padding-right: 0;
  }

  .mail-row {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 8px;
  }

  .mail-check {
    min-height: 86px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.82);
  }

  .mail-check input {
    width: 22px;
    height: 22px;
  }

  .mail-item {
    min-height: 86px;
    padding: 14px 13px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.82);
  }

  .mail-item strong {
    white-space: normal;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.22;
  }

  .mail-meta,
  .muted {
    font-size: 12px;
  }

  .message {
    min-height: 300px;
    grid-template-rows: auto auto auto;
  }

  .message-body {
    max-height: none;
    font-size: 14px;
  }

  .doc-card {
    border-radius: 22px;
  }

  .attachment-section {
    border-radius: 22px;
    padding: 12px;
  }

  .attachment-head {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .attachment-grid {
    grid-template-columns: 1fr;
  }

  .attachment-card {
    grid-template-columns: 44px minmax(0, 1fr);
    border-radius: 18px;
  }

  .attachment-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .attachment-actions .btn {
    flex: 1;
    min-height: 44px;
    justify-content: center;
  }

  .doc-chip {
    min-height: 46px;
    justify-content: center;
  }

  .forward-picker {
    padding: 12px;
    border-radius: 22px;
  }

  .forward-picker-head {
    align-items: stretch;
    flex-direction: column;
    gap: 6px;
  }

  .forward-attachment-list {
    grid-template-columns: 1fr;
  }

  .forward-attachment-option {
    min-height: 64px;
    border-radius: 18px;
  }

  .doc-picker {
    padding: 12px;
    border-radius: 22px;
  }

  .doc-picker-head {
    align-items: stretch;
  }

  .doc-picker-presets {
    grid-template-columns: 1fr;
  }

  .doc-picker-presets button {
    min-height: 46px;
  }

  .doc-picker-grid {
    grid-template-columns: 1fr;
  }

  .doc-option {
    min-height: 64px;
    border-radius: 18px;
  }

  .chips {
    display: grid;
    grid-template-columns: 1fr;
  }

  .quick-replies button {
    min-height: 48px;
  }

  .modal-backdrop {
    align-items: end;
    padding: 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
  }

  .modal {
    max-height: calc(100dvh - 20px - env(safe-area-inset-bottom));
    border-radius: 28px 28px 0 0;
    padding: 18px;
  }

  textarea {
    min-height: 150px;
  }

  .desktop-hidden {
    display: inline-flex;
  }
}

@media (max-width: 620px) {
  .auth-shell {
    padding: 0;
  }

  .auth-card {
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    grid-template-rows: 270px 1fr;
  }

  .auth-hero {
    min-height: 0;
    height: 270px;
    padding: 24px 20px;
  }

  .logo-card {
    width: min(230px, 76%);
    border-radius: 22px;
  }

  .auth-panel {
    justify-content: flex-start;
    padding: 34px 20px max(32px, env(safe-area-inset-bottom));
  }

  .auth-panel.stack,
  .compact-auth {
    justify-content: flex-start;
  }

  .sidebar {
    inset: auto 8px calc(8px + env(safe-area-inset-bottom)) 8px;
    border-radius: 22px;
    padding: 7px;
  }

  .nav {
    gap: 5px;
  }

  .nav button {
    min-height: 50px;
    border-radius: 16px;
    padding: 6px 4px;
    font-size: 10.5px;
  }

  .nav button small {
    font-size: 9px;
  }

  .main {
    padding: 0 12px calc(166px + env(safe-area-inset-bottom));
  }

  .topbar {
    margin-left: -12px;
    margin-right: -12px;
    padding-left: 12px;
    padding-right: 12px;
  }

  .topbar h1 {
    font-size: 29px;
  }

  .panel {
    padding: 14px;
    border-radius: 22px;
  }

  .panel-header {
    flex-direction: column;
    gap: 3px;
  }

  .bulk-actions {
    top: calc(96px + env(safe-area-inset-top));
    grid-template-columns: 1fr 0.72fr;
  }

  .mail-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .mail-check {
    min-height: 88px;
  }

  .mail-item {
    min-height: 88px;
  }

  .modal-backdrop {
    padding: 8px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .modal {
    border-radius: 26px 26px 0 0;
  }

  .folder-tabs {
    display: none;
  }
}

/* thread-signature-v17-mobile */

@media (max-width: 620px) {
  .mail-item {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .mail-avatar {
    width: 38px;
    height: 38px;
    border-radius: 14px;
    font-size: 12px;
  }

  .mail-topline {
    align-items: flex-start;
    font-size: 11.5px;
  }

  .mail-topline time {
    max-width: 78px;
    text-align: right;
  }

  .mail-thread-line {
    flex-wrap: wrap;
    gap: 5px;
  }

  .thread-heading,
  .thread-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .inbox-signature-card {
    grid-template-columns: 1fr;
  }

  .signature-logo {
    width: min(190px, 100%);
  }
}
