:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #eef2f6;
  --ink: #151b24;
  --ink-2: #2f3a47;
  --muted: #687485;
  --line: #d9e1eb;
  --line-strong: #c2ccd9;
  --sidebar: #111923;
  --sidebar-2: #172331;
  --sidebar-3: #223142;
  --sidebar-text: #f3f7fb;
  --sidebar-muted: #9dadbf;
  --blue: #275fca;
  --blue-dark: #1d4da8;
  --green: #16754f;
  --red: #b83d3b;
  --amber: #a56716;
  --shadow: 0 16px 42px rgba(21, 27, 36, .08);
  --shadow-soft: 0 1px 2px rgba(21, 27, 36, .08);
  --radius: 8px;
  --shell-max: 1680px;
  --workspace-h: 840px;
  --topbar-h: 68px;
  font-family: Avenir Next, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: auto;
  background: var(--bg);
  color: var(--ink);
  text-rendering: geometricPrecision;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

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

button, .file-button {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink-2);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, transform .16s ease;
}

button:hover, .file-button:hover {
  border-color: var(--line-strong);
  background: #ffffff;
}

button:active, .file-button:active { transform: translateY(1px); }
button:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}

button.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #f8fbff;
}

button.primary:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(21, 27, 36, .03);
}

input, select {
  height: 36px;
  padding: 0 11px;
}

textarea {
  min-height: 0;
  padding: 12px;
  resize: none;
  line-height: 1.48;
}

input::placeholder, textarea::placeholder { color: #8793a3; }

input:focus, select:focus, textarea:focus, button:focus-visible {
  border-color: color-mix(in srgb, var(--blue) 72%, white);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 14%, transparent);
}

.app {
  width: min(100vw, var(--shell-max));
  min-height: 0;
  display: grid;
  grid-template-rows: var(--topbar-h) auto;
  gap: 12px;
  padding: 12px;
  overflow: visible;
}

.topbar {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(210px, 360px);
  align-items: center;
  gap: 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .96);
  box-shadow: var(--shadow);
}

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

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--ink);
  color: #f7fafc;
  font-weight: 800;
}

h1, h2, p { margin: 0; }
h1 {
  font-size: 17px;
  line-height: 1.15;
  font-weight: 760;
}

.brand p {
  max-width: 260px;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.legacy-access,
.auth-box {
  min-width: 0;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.auth-box {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.auth-box[hidden],
.legacy-access[hidden] {
  display: none;
}

#authUserLabel {
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-id {
  min-width: 0;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 8px;
  background: #eff6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.auth-id[hidden] {
  display: none;
}

.workspace {
  min-width: 0;
  min-height: 0;
  height: min(var(--workspace-h), calc(100dvh - var(--topbar-h) - 36px));
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.sidebar {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 18px;
  padding: 14px;
  overflow: auto;
  background: var(--sidebar);
  color: var(--sidebar-text);
}

.side-section {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
}

.side-section.grow {
  min-height: 0;
}

.side-label {
  display: block;
  margin: 2px 2px 4px;
  color: var(--sidebar-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
}

.nav-item {
  width: 100%;
  height: auto;
  min-height: 72px;
  display: grid;
  justify-content: stretch;
  justify-items: start;
  gap: 6px;
  padding: 12px 12px;
  border-color: rgba(255, 255, 255, .10);
  background: transparent;
  color: var(--sidebar-text);
  box-shadow: none;
  text-align: left;
}

.nav-item:hover {
  border-color: rgba(255, 255, 255, .16);
  background: rgba(255, 255, 255, .06);
}

.nav-item.is-active {
  border-color: rgba(255, 255, 255, .18);
  background: #ffffff;
  color: var(--ink);
}

.nav-item strong {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 760;
}

.nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--sidebar-muted);
  font-size: 12px;
}

.nav-item.is-active span {
  color: var(--muted);
}

.content, .view {
  min-width: 0;
  min-height: 0;
}

.content {
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
}

.view {
  height: 100%;
  display: none;
}

.view.is-active {
  display: block;
}

.screen-grid {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
}

.session-grid {
  grid-template-columns: minmax(420px, 500px) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background: #f4f7fb;
}

.session-input-panel,
.session-output-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.input-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
}

.input-panel.session-input-panel {
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--line);
}

.session-input-panel .panel-head {
  padding-bottom: 2px;
}

.session-input-panel .button-row {
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.session-input-panel .check {
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-2);
}

#sessionSourceInput {
  height: 100%;
  border-color: #cfd8e5;
  background: #fbfdff;
}

#sessionSourceInput,
#sessionOutput {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.58;
}

.session-output-panel {
  grid-template-rows: auto minmax(0, 1fr);
}

.session-output-panel .command-bar {
  padding: 0 0 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.session-output-panel .output {
  padding: 12px 2px 2px;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.totp-work {
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(360px, 520px) minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background: #f4f7fb;
}

.totp-input-panel,
.totp-output-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

#totpSecretInput {
  height: 168px;
  border-color: #cfd8e5;
  background: #fbfdff;
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
}

.totp-code-box {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff 0%, #f7fafc 100%);
}

#totpCodeValue {
  color: var(--ink);
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: clamp(34px, 7vw, 72px);
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0;
}

.totp-progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.totp-progress span {
  width: 0%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--blue);
  transition: width .22s ease;
}

.totp-meta {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.totp-meta span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.work-surface {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
}

.mail-layout {
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.mail-work {
  height: 100%;
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.mail-work:has(.lookup-panel:not([hidden])) {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.codex-sms-work {
  height: 100%;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.mail-import-strip {
  min-width: 0;
  display: block;
  gap: 12px;
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.import-copy {
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
}

.mail-import-strip textarea {
  display: block;
  height: 100px;
  padding: 9px 210px 48px 10px;
  line-height: 1.38;
}

.mail-input-wrap {
  position: relative;
  min-width: 0;
}

.mail-input-actions {
  position: absolute;
  right: 10px;
  bottom: 10px;
  display: flex;
  gap: 8px;
}

.mail-input-actions button,
.mail-input-actions .file-button {
  width: 94px;
  height: 34px;
  box-shadow: var(--shadow-soft);
}

.import-actions {
  min-width: 104px;
  display: grid;
  align-content: end;
  gap: 8px;
}

.import-actions button,
.import-actions .file-button {
  width: 100%;
}

.panel-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.panel-head h2,
.compact-title {
  display: block;
  font-size: 13px;
  line-height: 1.25;
  font-weight: 760;
}

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

.field span, .note {
  color: var(--muted);
  font-size: 12px;
}

.button-row {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.button-row.wrap {
  flex-wrap: wrap;
}

.wide {
  width: 100%;
}

.file-button {
  position: relative;
  overflow: hidden;
  font-size: 12px;
}

.file-button input {
  position: absolute;
  inset: 0;
  cursor: pointer;
  opacity: 0;
}

.lookup-panel {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.lookup-panel[hidden] {
  display: none;
}

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

.lookup-copy strong {
  color: var(--ink);
  font-size: 18px;
  line-height: 1.2;
  font-weight: 800;
  letter-spacing: 0;
}

.lookup-actions {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(130px, .7fr) minmax(220px, 1fr) auto auto auto auto;
  gap: 8px;
}

.lookup-result {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 8px;
  background: #eff6ff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}

.lookup-result[hidden] {
  display: none;
}

.lookup-result.is-error {
  border-color: rgba(220, 38, 38, .22);
  background: #fef2f2;
}

.lookup-result strong {
  font-weight: 800;
}

.lookup-result .code-value {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 800;
}

.check {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 13px;
}

.check input {
  width: auto;
  height: auto;
}

.command-bar {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.filters {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(138px, 172px) minmax(138px, 172px);
  gap: 10px;
}

.table-box {
  max-width: 100%;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.mail-progress {
  min-width: 0;
  min-height: 50px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 280px);
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

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

.progress-copy strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  font-weight: 760;
}

.progress-copy span,
.progress-meter span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-meter {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(110px, 1fr);
  align-items: center;
  gap: 9px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-3);
}

.progress-track span {
  width: 0%;
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--blue);
  transition: width .22s ease;
}

.mail-progress.is-running .progress-track span {
  background: linear-gradient(90deg, var(--blue), #4f83dc);
}

.mail-progress.is-success .progress-track span {
  background: var(--green);
}

.mail-progress.is-error .progress-track span {
  background: var(--red);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  font-size: 13px;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f3f6fa;
  color: #536171;
  font-size: 12px;
  font-weight: 700;
}

.th-filter {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.th-filter span {
  line-height: 1.2;
}

.th-filter input,
.th-filter select {
  height: 30px;
  padding: 0 8px;
  border-color: #cfd8e5;
  background: #ffffff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  box-shadow: none;
}

.th-filter input::placeholder {
  color: #8a96a5;
  font-weight: 500;
}

.mail-table th:nth-child(2) {
  min-width: 220px;
}

.mail-table th:nth-child(3),
.mail-table th:nth-child(4),
.mail-table th:nth-child(5),
.mail-table th:nth-child(7) {
  min-width: 118px;
}

.mail-table th:nth-child(8) {
  min-width: 176px;
}

.operation-head {
  min-width: 0;
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

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

.bulk-actions[hidden] {
  display: none;
}

.bulk-actions button {
  height: 30px;
  padding: 0 8px;
  font-size: 12px;
  box-shadow: none;
}

tbody tr {
  transition: background-color .14s ease;
}

tbody tr:hover {
  background: #f8fafc;
}

td { max-width: 260px; }

.mail-email, .truncate {
  line-height: 1.28;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-table {
  min-width: 980px;
}

.codex-sms-table {
  min-width: 720px;
}

.masked-url {
  max-width: 360px;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.code-cell {
  color: var(--ink);
  font-weight: 700;
}

.mail-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-width: 18px;
  padding: 0;
  margin: 0;
  border: 1.5px solid #9aa3af;
  border-radius: 50%;
  appearance: none;
  background: #ffffff;
  box-shadow: none;
  cursor: pointer;
}

.mail-table input[type="checkbox"]:checked {
  border-color: var(--blue);
  background:
    radial-gradient(circle at center, #ffffff 0 3px, transparent 3.5px),
    var(--blue);
}

.mail-table input[type="checkbox"]:indeterminate {
  border-color: var(--blue);
  background:
    linear-gradient(#ffffff, #ffffff) center / 9px 2px no-repeat,
    var(--blue);
}

.row-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
}

.row-actions button {
  height: 28px;
  padding: 0 8px;
  font-size: 12px;
  box-shadow: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: #5c6877;
  font-size: 12px;
  white-space: nowrap;
}

.pill.ok {
  background: color-mix(in srgb, var(--green) 12%, white);
  color: var(--green);
}

.pill.warn {
  background: color-mix(in srgb, var(--amber) 13%, white);
  color: var(--amber);
}

.pill.bad {
  background: color-mix(in srgb, var(--red) 10%, white);
  color: var(--red);
}

.output {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.output {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

.empty {
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  max-width: min(560px, calc(100vw - 24px));
  padding: 10px 13px;
  border-radius: 8px;
  background: #101820;
  color: #f8fbff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity .18s ease, transform .18s ease;
}

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

.toast.error {
  background: var(--red);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

@media (max-height: 760px) {
  :root { --topbar-h: 58px; }
  .app { gap: 8px; padding: 8px; }
  .topbar { padding: 7px 8px; }
  .brand-mark { width: 34px; height: 34px; }
  .brand p { display: none; }
  .sidebar, .input-panel, .work-surface { padding: 10px; gap: 9px; }
  .mail-import-strip { gap: 9px; padding: 8px; }
  .mail-import-strip textarea { height: 76px; }
  .mail-progress {
    min-height: 44px;
    padding: 8px 10px;
  }
  .nav-item {
    min-height: 62px;
    padding: 9px 10px;
  }
  th, td { padding: 8px 10px; }
}

@media (max-width: 1100px) {
  .workspace {
    grid-template-columns: 228px minmax(0, 1fr);
  }
  .screen-grid,
  .session-grid {
    grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  }
  .session-grid {
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  }
  .nav-item {
    min-height: 52px;
    padding: 9px 10px;
  }
}

@media (max-width: 820px) {
  :root { --topbar-h: 96px; }
  .topbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "access";
    gap: 7px;
    padding: 8px;
  }
  .brand { grid-area: brand; }
  .access {
    grid-area: access;
    grid-template-columns: minmax(0, 1fr);
  }
  #saveAccessTokenBtn { display: none; }
  .workspace {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .sidebar {
    grid-template-columns: minmax(180px, .85fr) minmax(0, 1.15fr);
    grid-template-rows: auto;
    gap: 10px;
    padding: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, .12);
  }
  .side-section.grow {
    overflow-x: auto;
    grid-auto-flow: column;
    grid-auto-columns: minmax(150px, 1fr);
  }
  .side-section.grow .side-label {
    grid-column: 1 / -1;
  }
  .screen-grid,
  .session-grid {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(210px, 36dvh) minmax(0, 1fr);
  }
  .session-grid {
    grid-template-rows: minmax(260px, 42dvh) minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }
  .totp-work {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, auto) minmax(0, 1fr);
    gap: 10px;
    padding: 10px;
  }
  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 560px) {
  :root { --topbar-h: 96px; }
  .app {
    gap: 7px;
    padding: 7px;
  }
  .brand-mark {
    width: 32px;
    height: 32px;
  }
  h1 { font-size: 15px; }
  .brand p { display: none; }
  button, .file-button, input, select { height: 32px; }
  .sidebar {
    grid-template-columns: 1fr;
    gap: 8px;
    max-height: 210px;
  }
  .side-section.grow {
    grid-auto-columns: minmax(132px, 1fr);
  }
  .nav-item {
    min-height: 48px;
    padding: 8px 9px;
  }
  .nav-item span { display: none; }
  .screen-grid,
  .session-grid {
    grid-template-rows: minmax(205px, 38dvh) minmax(0, 1fr);
  }
  .session-grid {
    grid-template-rows: minmax(245px, 38dvh) minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }
  .totp-work {
    gap: 8px;
    padding: 8px;
  }
  .totp-input-panel,
  .totp-output-panel {
    padding: 10px;
    gap: 9px;
  }
  #totpSecretInput {
    height: 132px;
    font-size: 12px;
  }
  .totp-code-box {
    padding: 12px;
    gap: 10px;
  }
  .totp-meta {
    display: grid;
    gap: 5px;
  }
  .mail-import-strip {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 8px;
  }
  .mail-import-strip textarea {
    height: 58px;
    padding-right: 210px;
    padding-bottom: 48px;
  }
  .lookup-panel,
  .lookup-actions {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .mail-import-strip .panel-head .note {
    display: none;
  }
  .input-panel, .work-surface {
    padding: 8px;
    gap: 7px;
  }
  .command-bar {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 8px;
  }
  .mail-progress {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .progress-meter {
    grid-template-columns: auto minmax(80px, 1fr);
  }
  .filters {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .command-bar .button-row {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .command-bar .button-row::-webkit-scrollbar { display: none; }
  th, td { padding: 7px 8px; }
  .mail-table:not(.codex-sms-table) { min-width: 980px; }
  .codex-sms-table { min-width: 460px; }
  .codex-sms-table th:nth-child(3), .codex-sms-table td:nth-child(3),
  .codex-sms-table th:nth-child(4), .codex-sms-table td:nth-child(4) {
    display: none;
  }
  .row-actions { width: max-content; }
  textarea {
    padding: 9px;
    font-size: 12px;
  }
}
