:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f8;
  --line: #d9e0e8;
  --line-strong: #b8c2cc;
  --text: #17212b;
  --muted: #687583;
  --blue: #1a73e8;
  --blue-weak: #e8f0fe;
  --red: #d93025;
  --red-weak: #fce8e6;
  --green: #188038;
  --green-weak: #e6f4ea;
  --amber: #f9ab00;
  --amber-weak: #fff4d8;
  --teal: #0f766e;
  --teal-weak: #def7f3;
  --shadow: 0 14px 40px rgba(24, 32, 43, 0.12);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  letter-spacing: 0;
}

button,
input,
select,
textarea,
[contenteditable] {
  font: inherit;
}

button {
  border: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    linear-gradient(rgba(246, 248, 251, 0.9), rgba(246, 248, 251, 0.9)),
    radial-gradient(circle at 20% 20%, rgba(26, 115, 232, 0.15), transparent 26%),
    radial-gradient(circle at 80% 70%, rgba(15, 118, 110, 0.12), transparent 28%);
}

.auth-card {
  width: min(420px, 100%);
  padding: 28px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-brand {
  padding: 0;
  margin-bottom: 24px;
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-title {
  margin: 0 0 6px;
  font-size: 24px;
}

.auth-subtitle {
  margin: 0 0 20px;
  color: var(--muted);
  line-height: 1.55;
  font-size: 14px;
}

.auth-submit {
  width: 100%;
  min-height: 42px;
}

.auth-error {
  padding: 10px 12px;
  color: var(--red);
  background: var(--red-weak);
  border-radius: 8px;
  font-size: 13px;
}

.login-hints {
  display: grid;
  gap: 5px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  background: #edf2f7;
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  min-height: 42px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: white;
  background: var(--red);
  border-radius: 8px;
}

.brand-mark svg,
.lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.brand-name {
  font-weight: 800;
  font-size: 18px;
}

.brand-domain {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.compose-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 18px;
  color: #fff;
  background: var(--blue);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(26, 115, 232, 0.22);
  cursor: pointer;
}

.compose-button:hover {
  background: #0b57d0;
}

.nav-group {
  display: grid;
  gap: 4px;
}

.nav-title {
  padding: 8px 12px 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-button,
.folder-button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  color: var(--text);
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.nav-button:hover,
.folder-button:hover {
  background: #dfe8f2;
}

.nav-button.active,
.folder-button.active {
  color: #0b57d0;
  background: var(--blue-weak);
  font-weight: 700;
}

.count-pill {
  min-width: 24px;
  padding: 2px 7px;
  color: var(--muted);
  background: var(--surface);
  border-radius: 999px;
  font-size: 12px;
  text-align: center;
}

.nav-button.active .count-pill,
.folder-button.active .count-pill {
  color: #0b57d0;
}

.mailbox-switcher {
  margin-top: auto;
  padding: 12px;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mailbox-switcher label {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

.mailbox-switcher select {
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  color: var(--text);
  background: white;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 66px;
  padding: 10px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 720px;
  min-height: 42px;
  padding: 0 13px;
  background: #eef3f8;
  border: 1px solid transparent;
  border-radius: 8px;
}

.search-box:focus-within {
  border-color: #9ab9f4;
  background: #fff;
}

.search-box input {
  width: 100%;
  min-width: 80px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

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

.identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.avatar {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  color: #fff;
  background: var(--teal);
  border-radius: 50%;
  font-weight: 800;
}

.identity-text {
  min-width: 0;
}

.identity-name {
  font-weight: 800;
  white-space: nowrap;
}

.identity-mail {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.content {
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.mail-layout {
  display: grid;
  grid-template-columns: minmax(330px, 38%) minmax(0, 1fr);
  height: calc(100vh - 66px);
  min-height: 0;
}

.mail-list-pane,
.mail-detail-pane,
.workspace-pane {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.mail-list-pane {
  background: #fbfcfe;
  border-right: 1px solid var(--line);
}

.mail-toolbar,
.workspace-toolbar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 10px 16px;
  background: rgba(251, 252, 254, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.toolbar-title {
  min-width: 0;
}

.toolbar-title h1,
.workspace-toolbar h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.toolbar-title p,
.workspace-toolbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.icon-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-button,
.text-button,
.ghost-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 11px;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
}

.icon-button {
  width: 34px;
  padding: 0;
  color: var(--muted);
  background: transparent;
}

.icon-button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.text-button {
  color: #fff;
  background: var(--blue);
}

.text-button:hover {
  background: #0b57d0;
}

.ghost-button {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.ghost-button:hover {
  border-color: var(--line-strong);
}

.danger-button {
  color: var(--red);
  background: var(--red-weak);
}

.mail-list {
  display: grid;
}

.mail-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 94px;
  padding: 14px 16px;
  background: transparent;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.mail-row:hover {
  background: #f2f6fb;
}

.mail-row.active {
  background: #eaf2ff;
  box-shadow: inset 3px 0 0 var(--blue);
}

.mail-row.unread .sender,
.mail-row.unread .subject {
  font-weight: 800;
}

.star-button {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--muted);
  background: transparent;
  border-radius: 50%;
  cursor: pointer;
}

.star-button.active {
  color: var(--amber);
}

.mail-summary {
  min-width: 0;
}

.mail-meta-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sender,
.subject,
.snippet {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sender {
  min-width: 0;
}

.subject {
  margin-top: 6px;
}

.snippet {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.label {
  flex: 0 0 auto;
  padding: 2px 7px;
  border-radius: 999px;
  color: #0b57d0;
  background: var(--blue-weak);
  font-size: 12px;
  font-weight: 700;
}

.priority {
  color: var(--red);
  background: var(--red-weak);
}

.mail-time {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.mail-detail-pane {
  background: var(--surface);
}

.mail-detail {
  padding: 24px;
  max-width: 980px;
}

.mail-detail h2 {
  margin: 0 0 14px;
  font-size: 26px;
  line-height: 1.28;
}

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.sender-card {
  display: flex;
  gap: 12px;
  min-width: 0;
}

.sender-info {
  min-width: 0;
}

.sender-info strong,
.sender-info span {
  display: block;
  overflow-wrap: anywhere;
}

.sender-info span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.body-copy {
  margin-top: 24px;
  color: #283544;
  line-height: 1.76;
}

.rich-content p {
  margin: 0 0 14px;
}

.rich-content ul,
.rich-content ol {
  margin: 0 0 14px 22px;
  padding: 0;
}

.rich-content a {
  color: var(--blue);
}

.rich-content img,
.editor-surface img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.rich-content table,
.editor-surface table {
  width: 100%;
  margin: 12px 0;
  border-collapse: collapse;
}

.rich-content th,
.rich-content td,
.editor-surface th,
.editor-surface td {
  padding: 8px 10px;
  border: 1px solid var(--line);
}

.rich-content th,
.editor-surface th {
  background: #f6f8fb;
  font-weight: 800;
}

.rich-content blockquote,
.editor-surface blockquote {
  margin: 12px 0;
  padding: 8px 12px;
  color: var(--muted);
  background: #f6f8fb;
  border-left: 4px solid var(--line-strong);
}

.rich-content pre,
.editor-surface pre {
  overflow: auto;
  padding: 12px;
  color: #15202b;
  background: #eef3f8;
  border-radius: 8px;
}

.attachment-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.attachment {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 10px;
  background: #f5f7fa;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--text);
}

.attachment.drive {
  color: var(--teal);
  background: var(--teal-weak);
  border-color: rgba(15, 118, 110, 0.22);
}

.attachment small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.quick-reply {
  margin-top: 30px;
  display: grid;
  gap: 10px;
}

.workspace-pane {
  height: calc(100vh - 66px);
  background: var(--surface);
}

.workspace-body {
  padding: 22px;
  display: grid;
  gap: 18px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}

.metric {
  min-height: 92px;
  padding: 15px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.metric strong {
  display: block;
  font-size: 28px;
  line-height: 1.1;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(128px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.day-column {
  min-height: 420px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

.day-column:last-child {
  border-right: 0;
}

.day-head {
  min-height: 54px;
  padding: 10px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}

.day-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  margin-top: 3px;
}

.event-list {
  display: grid;
  gap: 8px;
  padding: 10px;
}

.event-card {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 7px;
}

.event-card.interview {
  border-left-color: var(--green);
}

.event-card.deadline {
  border-left-color: var(--red);
}

.event-card.shift {
  border-left-color: var(--amber);
}

.event-time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.event-title {
  margin-top: 5px;
  font-weight: 800;
  line-height: 1.25;
}

.event-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.panel {
  padding: 16px;
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.panel h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

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

.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: #8ab4f8;
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.number-setting {
  display: inline-grid;
  grid-template-columns: 112px auto;
  align-items: center;
  gap: 6px;
  justify-self: end;
}

.number-setting input {
  width: 112px;
  min-height: 34px;
  padding: 6px 8px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.number-setting span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.readonly-field {
  display: flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--muted);
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.checkbox-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  color: var(--text);
  font-weight: 700;
}

.checkbox-line input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

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

.delegate-option {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.delegate-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}

.delegate-option strong,
.delegate-option small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.delegate-option small {
  color: var(--muted);
  font-size: 12px;
}

.form-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.rich-editor {
  display: grid;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.editor-label {
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 40px;
  padding: 6px 8px;
  background: #f6f8fb;
  border-bottom: 1px solid var(--line);
}

.toolbar-separator {
  width: 1px;
  height: 20px;
  margin: 0 4px;
  background: var(--line);
}

.editor-select {
  min-height: 30px;
  padding: 0 8px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.editor-color {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--muted);
  border-radius: 7px;
  cursor: pointer;
}

.editor-color:hover {
  color: var(--text);
  background: var(--surface-2);
}

.editor-color input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.editor-surface {
  width: 100%;
  padding: 13px 14px;
  color: var(--text);
  background: #fff;
  outline: 0;
  overflow: auto;
  line-height: 1.7;
}

.editor-surface:focus {
  box-shadow: inset 0 0 0 3px rgba(26, 115, 232, 0.12);
}

.editor-surface:empty::before {
  content: attr(data-placeholder);
  color: #8a96a3;
}

.editor-surface p {
  margin: 0 0 12px;
}

.editor-surface ul,
.editor-surface ol {
  margin: 0 0 12px 22px;
  padding: 0;
}

.rich-editor.compact .editor-toolbar {
  min-height: 34px;
  padding: 4px 6px;
}

.rich-editor.compact .editor-surface {
  padding: 10px 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

.table th {
  color: var(--muted);
  background: #f6f8fb;
  font-size: 12px;
  font-weight: 800;
}

.table tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status.good {
  color: var(--green);
  background: var(--green-weak);
}

.status.warn {
  color: #946200;
  background: var(--amber-weak);
}

.status.bad {
  color: var(--red);
  background: var(--red-weak);
}

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

.user-item {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.user-item span {
  color: var(--muted);
  font-size: 12px;
}

.health-grid {
  display: grid;
  gap: 10px;
}

.health-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.health-item strong,
.health-item span {
  display: block;
}

.health-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

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

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row strong {
  display: block;
}

.setting-row span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 44px;
  height: 26px;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #c7d0db;
  cursor: pointer;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition:
    transform 0.16s ease,
    background 0.16s ease;
}

.switch input:checked + span {
  background: var(--blue);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.compose-modal {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  width: min(760px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 0 14px;
  color: #fff;
  background: #26323f;
}

.compose-head strong {
  font-size: 14px;
}

.compose-body {
  display: grid;
  gap: 0;
}

.compose-body input,
.compose-body textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: 0;
  padding: 12px 14px;
}

.compose-body textarea {
  min-height: 220px;
  resize: vertical;
  border-bottom: 0;
}

.compose-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(23, 33, 43, 0.36);
}

.dialog-panel {
  width: min(760px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 58px;
  padding: 12px 16px;
  color: #fff;
  background: #26323f;
}

.dialog-head strong,
.dialog-head span {
  display: block;
}

.dialog-head span {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.dialog-body {
  padding: 16px;
}

.dialog-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}

.recipient-hints {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
}

.recipient-chip {
  display: grid;
  gap: 2px;
  min-width: 126px;
  max-width: 180px;
  padding: 7px 9px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.recipient-chip:hover {
  border-color: #8ab4f8;
  background: var(--blue-weak);
}

.recipient-chip span,
.recipient-chip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recipient-chip span {
  font-weight: 800;
}

.recipient-chip small {
  color: var(--muted);
}

.compose-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 38px;
  padding: 0 14px;
  color: var(--muted);
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.compose-options label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.compose-body .rich-editor {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}

.drive-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #f7fbfb;
  border-bottom: 1px solid var(--line);
}

.drive-tools strong,
.drive-tools span {
  display: block;
}

.drive-tools span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.upload-zone {
  padding: 12px;
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
}

.upload-zone.loading .upload-box {
  border-color: #8ab4f8;
  background: var(--blue-weak);
}

.upload-box {
  display: grid;
  place-items: center;
  gap: 4px;
  min-height: 96px;
  padding: 14px;
  color: var(--muted);
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
}

.upload-box span {
  color: var(--text);
  font-weight: 800;
}

.upload-box small {
  font-size: 12px;
}

.upload-list,
.upload-history {
  display: grid;
  gap: 8px;
}

.upload-list {
  margin-top: 10px;
}

.upload-empty {
  color: var(--muted);
  font-size: 12px;
}

.upload-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 9px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.upload-item strong {
  font-size: 13px;
}

.upload-item span {
  color: var(--muted);
  font-size: 12px;
}

.upload-item a {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.upload-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.upload-actions a,
.upload-actions button {
  width: 30px;
  height: 30px;
}

progress {
  width: 120px;
  height: 8px;
  accent-color: var(--blue);
}

.nav-link {
  text-decoration: none;
}

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

.admin-nav {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: #20282f;
  color: #d9e1e8;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 12px 18px;
  background: #151b20;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  color: #fff;
  background: #1db5c9;
  border-radius: 7px;
  font-weight: 900;
  letter-spacing: 0;
}

.admin-brand-mark.image {
  overflow: hidden;
  background: #fff;
}

.admin-brand-mark.image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-brand strong,
.admin-brand span {
  display: block;
}

.admin-brand strong {
  color: #fff;
  font-size: 15px;
}

.admin-brand span {
  margin-top: 2px;
  color: #90a0ad;
  font-size: 12px;
}

.admin-nav-groups {
  display: grid;
  gap: 8px;
  padding: 12px 0;
}

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

.admin-nav-title {
  padding: 10px 18px 4px;
  color: #93a0aa;
  font-size: 12px;
  font-weight: 800;
}

.admin-nav-button {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 16px;
  color: #d9e1e8;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.admin-nav-button:hover {
  background: rgba(255, 255, 255, 0.06);
}

.admin-nav-button.active {
  color: #fff;
  background: #1db5c9;
  box-shadow: inset 3px 0 0 #fff;
}

.admin-nav-button .lucide:last-child {
  width: 14px;
  height: 14px;
  color: #798894;
}

.admin-nav-button.active .lucide:last-child {
  color: rgba(255, 255, 255, 0.85);
}

.admin-nav-foot {
  display: grid;
  gap: 10px;
  margin-top: auto;
  padding: 14px 16px;
  background: #12171c;
}

.admin-nav-foot span {
  color: #ff7a45;
  font-size: 12px;
  font-weight: 800;
}

.admin-mail-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #d9e1e8;
  text-decoration: none;
  font-size: 13px;
}

.admin-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
}

.admin-topbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 68px;
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.admin-topbar-title h1 {
  margin: 0;
  font-size: 20px;
}

.admin-topbar-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.admin-topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

.admin-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 280px;
  min-height: 36px;
  padding: 0 10px;
  background: #f3f5f8;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.admin-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.identity.compact .avatar {
  width: 32px;
  height: 32px;
}

.identity.compact .identity-name {
  font-size: 13px;
}

.admin-content {
  min-width: 0;
  min-height: 0;
  overflow: auto;
}

.admin-section {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 420px);
  gap: 24px;
  align-items: center;
  min-height: 150px;
  padding: 24px;
  color: #fff;
  background: #2388e8;
  border-radius: 8px;
}

.admin-hero h2 {
  margin: 0 0 8px;
  font-size: 25px;
}

.admin-hero p {
  margin: 0;
  color: rgba(255, 255, 255, 0.86);
}

.admin-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.admin-hero .text-button {
  color: #1b425f;
  background: #fff;
}

.admin-hero .ghost-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
}

.admin-hero-status {
  display: grid;
  gap: 9px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 8px;
}

.admin-hero-status strong {
  font-size: 20px;
}

.admin-hero-status span {
  color: rgba(255, 255, 255, 0.86);
}

.admin-hero-status progress {
  width: 100%;
  accent-color: #fff;
}

.admin-metrics .metric {
  background: #fff;
}

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

.admin-panel-wide {
  min-width: 0;
}

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

.admin-action {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 86px;
  color: #3b4650;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}

.admin-action:hover {
  color: #0b57d0;
  border-color: #9ab9f4;
}

.license-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  padding: 14px;
  background: #eef6ff;
  border: 1px solid #c8ddfb;
  border-radius: 8px;
}

.license-summary strong,
.license-summary span {
  display: block;
}

.license-summary strong {
  font-size: 24px;
}

.license-summary span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.license-summary progress {
  width: 100%;
}

.org-tree {
  display: grid;
  gap: 8px;
}

.org-node {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 8px 10px;
  padding-left: calc(10px + var(--depth, 0) * 18px);
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.org-node.active,
.org-node:hover {
  border-color: #8ab4f8;
  background: #eef6ff;
}

.org-node strong,
.org-node small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.org-node small,
.muted-text {
  color: var(--muted);
  font-size: 12px;
}

.admin-two-column {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.42fr);
  gap: 16px;
  align-items: start;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 20;
  transform: translate(-50%, 12px);
  min-height: 38px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 9px 14px;
  color: #fff;
  background: rgba(23, 33, 43, 0.92);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1120px) {
  .app-shell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .brand-name,
  .brand-domain,
  .nav-title,
  .nav-button span:not(.count-pill),
  .folder-button span:not(.count-pill),
  .mailbox-switcher {
    display: none;
  }

  .side-nav {
    align-items: center;
    padding: 16px 10px;
  }

  .brand {
    padding: 0;
  }

  .compose-button {
    width: 54px;
    padding: 0;
  }

  .compose-button span {
    display: none;
  }

  .nav-button,
  .folder-button {
    grid-template-columns: 1fr;
    place-items: center;
    width: 48px;
    padding: 0;
  }

  .count-pill {
    display: none;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

  .calendar-grid {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .admin-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .admin-brand div:not(.admin-brand-mark),
  .admin-nav-title,
  .admin-nav-button span,
  .admin-nav-button .lucide:last-child,
  .admin-nav-foot span,
  .admin-mail-link span {
    display: none;
  }

  .admin-brand {
    justify-content: center;
    padding: 12px;
  }

  .admin-nav-button {
    grid-template-columns: 1fr;
    place-items: center;
    padding: 0;
  }

  .admin-dashboard-grid,
  .admin-two-column,
  .admin-hero {
    grid-template-columns: 1fr;
  }

  .day-column {
    min-height: 300px;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: sticky;
    top: 0;
    z-index: 5;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px;
    padding: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    min-height: 38px;
  }

  .compose-button {
    width: auto;
    min-height: 38px;
    padding: 0 12px;
  }

  .compose-button span {
    display: inline;
  }

  .nav-group {
    grid-column: 1 / -1;
    display: flex;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-button,
  .folder-button {
    width: 42px;
    flex: 0 0 42px;
  }

  .topbar {
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .mail-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .mail-list-pane,
  .mail-detail-pane,
  .workspace-pane {
    height: auto;
    max-height: none;
  }

  .mail-detail {
    padding: 18px;
  }

  .metric-grid,
  .calendar-grid,
  .form-grid,
  .delegate-grid {
    grid-template-columns: 1fr;
  }

  .workspace-body {
    padding: 14px;
  }

  .table {
    display: block;
    overflow-x: auto;
  }

  .compose-modal {
    right: 8px;
    bottom: 8px;
    width: calc(100vw - 16px);
  }

  .dialog-overlay {
    align-items: start;
    padding: 8px;
  }

  .dialog-panel {
    max-height: calc(100vh - 16px);
  }

  .dialog-foot {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .dialog-foot .icon-row,
  .dialog-foot button {
    width: 100%;
  }

  .drive-tools {
    grid-template-columns: 1fr;
  }

  .drive-tools .icon-row,
  .drive-tools button {
    width: 100%;
  }

  .admin-shell {
    grid-template-columns: minmax(0, 1fr);
    overflow-x: hidden;
  }

  .admin-nav {
    min-height: auto;
    min-width: 0;
    width: 100%;
    overflow: hidden;
  }

  .admin-nav-groups {
    display: flex;
    width: 100%;
    min-width: 0;
    max-width: 100vw;
    overflow-x: auto;
    padding: 8px;
  }

  .admin-nav-group {
    display: flex;
    flex: 0 0 auto;
  }

  .admin-main,
  .admin-topbar,
  .admin-content,
  .admin-section {
    min-width: 0;
    width: 100%;
    max-width: 100vw;
  }

  .admin-nav-button {
    width: 42px;
    flex: 0 0 42px;
    border-radius: 8px;
  }

  .admin-nav-foot {
    display: none;
  }

  .admin-topbar {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .admin-topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .admin-search {
    width: 100%;
    min-width: 0;
  }

  .admin-section {
    padding: 12px;
  }

  .admin-action-grid,
  .admin-metrics {
    grid-template-columns: 1fr;
  }
}
