:root {
  color-scheme: dark;
  --bg: #123650;
  --nav: #082237;
  --field: #0b2035;
  --field-border: #48647a;
  --line: #214b67;
  --line-soft: #173c56;
  --table-head: #143f58;
  --text: #ffffff;
  --muted: #c8d6e3;
  --muted-strong: #e8f2fb;
  --green: #00cf8a;
  --green-dark: #00af78;
  --cyan: #28bde3;
  --red: #ff5d6c;
  --amber: #ffd166;
  --wrap: min(960px, calc(100vw - 100px));
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

h1,
h2,
p {
  margin: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: var(--wrap);
  min-height: 46px;
  margin: 12px auto 0;
  padding: 6px 10px;
  border: 1px solid #1f4864;
  border-radius: 8px;
  background: var(--nav);
}

.main-menu,
.menu-button,
.panel-head h2,
.run-row,
.stats,
.cell-copy {
  display: flex;
  align-items: center;
}

.main-menu {
  min-width: 0;
  gap: 7px;
}

.menu-button {
  min-height: 30px;
  padding: 0 11px;
  border: 1px solid #184760;
  border-radius: 6px;
  background: #103653;
  color: #ffffff;
  font-size: 0.82rem;
  font-weight: 900;
  white-space: nowrap;
}

.menu-button.active {
  border-color: var(--green);
  background: var(--green);
  color: #062618;
}

.top-actions,
.account-preview,
.control-grid,
.result-head,
.quick-copy,
.panel-actions {
  display: none !important;
}

.workspace {
  display: block;
  width: var(--wrap);
  margin: 0 auto 34px;
}

.panel,
.dialog-box {
  min-width: 0;
}

.panel {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.input-panel {
  margin-bottom: 10px;
}

.panel-head {
  margin-bottom: 12px;
}

.panel-head h2 {
  gap: 8px;
  color: #ffffff;
  font-size: 1.22rem;
  line-height: 1.18;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}

.panel-head h2 svg {
  width: 22px;
  height: 22px;
  color: #d9f7ff;
}

#lineCount {
  display: none;
}

.field-label,
label span {
  display: block;
  margin-bottom: 8px;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 800;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--field-border);
  border-radius: 5px;
  background: var(--field);
  color: var(--text);
  outline: none;
}

textarea::placeholder,
input::placeholder {
  color: #7f96aa;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(0, 207, 138, 0.18);
}

textarea {
  display: block;
  height: clamp(144px, 19vh, 190px);
  min-height: 132px;
  padding: 10px;
  resize: vertical;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 0.77rem;
  line-height: 1.45;
}

input,
select {
  height: 34px;
  padding: 0 10px;
}

.access-box {
  margin-top: 10px;
}

.run-row {
  gap: 8px;
  margin-top: 11px;
}

.primary-button,
.danger-button,
.secondary-button,
.icon-button,
.ghost-button,
.ghost-icon,
.mini-button,
.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 0;
  font-size: 0.76rem;
  font-weight: 950;
  white-space: nowrap;
}

.primary-button,
.danger-button {
  min-height: 25px;
  padding: 0 11px;
}

.primary-button {
  background: var(--green);
  color: #ffffff;
}

.primary-button:hover {
  background: var(--green-dark);
}

.danger-button {
  background: var(--green);
  color: #ffffff;
}

.danger-button:hover {
  background: var(--green-dark);
}

.clear-mail-button {
  border-color: rgba(255, 93, 108, 0.54);
  background: rgba(255, 93, 108, 0.18);
  color: #ffd5dc;
}

.clear-mail-button:hover {
  background: rgba(255, 93, 108, 0.28);
}

.secondary-button,
.icon-button,
.ghost-button {
  min-height: 34px;
  padding: 0 11px;
  background: #123653;
  color: #ffffff;
  border-color: #315d78;
}

.ghost-icon {
  width: 36px;
  height: 36px;
  background: transparent;
  color: var(--muted);
}

button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
}

.progress {
  height: 10px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 5px;
  background: #092a45;
}

.progress > div {
  width: 0%;
  height: 100%;
  background: var(--green);
  transition: width 0.18s ease;
}

.totp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.totp-card,
.totp-empty {
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(9, 42, 69, 0.56);
}

.totp-card {
  padding: 10px;
}

.totp-empty {
  padding: 18px 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.totp-card-head,
.totp-code-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.totp-card-head {
  justify-content: space-between;
  margin-bottom: 8px;
}

.totp-title-row,
.totp-card-tools {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
}

.totp-title-row {
  flex: 1 1 auto;
}

.totp-card-tools {
  flex: 0 0 auto;
}

.totp-index {
  display: inline-grid;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  place-items: center;
  border: 1px solid var(--line);
  background: #123653;
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1;
}

.totp-label {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.totp-time {
  flex: 0 0 auto;
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 950;
}

.totp-code-row {
  justify-content: space-between;
}

.totp-code {
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  font-size: 1.42rem;
  font-weight: 950;
  letter-spacing: 2px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.totp-progress {
  height: 5px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #092a45;
}

.totp-progress > div {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
  transition: width 0.2s linear;
}

.split-copy-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.split-copy-row .secondary-button {
  min-height: 28px;
}

.split-column-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.split-column-actions:empty {
  display: none;
}

.split-table-wrap {
  overflow: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  background: transparent;
}

.split-table {
  min-width: 520px;
}

.split-table th,
.split-table td {
  width: auto;
  min-width: 170px;
}

.split-table th:first-child,
.split-table td:first-child {
  width: 54px;
  min-width: 54px;
}

.split-cell {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
}

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

.split-table .empty-state {
  color: var(--muted);
}

.merge-output-label {
  margin-top: 12px;
}

.merge-output {
  height: clamp(120px, 17vh, 170px);
  min-height: 110px;
}

.result-panel {
  display: flex;
  min-height: 0;
  flex-direction: column;
}

.table-wrap {
  flex: 1;
  overflow: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--table-head);
  color: #ffffff;
  font-size: 0.79rem;
  font-weight: 950;
}

td {
  color: var(--muted-strong);
  font-size: 0.78rem;
  line-height: 1.4;
}

th:nth-child(1),
td:nth-child(1) {
  width: 6%;
}

th:nth-child(2),
td:nth-child(2) {
  width: 21%;
}

th:nth-child(3),
td:nth-child(3) {
  width: 16%;
}

th:nth-child(4),
td:nth-child(4) {
  width: 14%;
}

th:nth-child(5),
td:nth-child(5) {
  width: 20%;
}

th:nth-child(6),
td:nth-child(6) {
  width: 14%;
}

th:nth-child(7),
td:nth-child(7) {
  width: 9%;
}

.email-cell,
.from-cell,
.date-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cell-copy {
  min-width: 0;
  gap: 6px;
}

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

.tiny-copy,
.link-button {
  min-height: 22px;
  padding: 0 6px;
  border: 0;
  background: transparent;
  color: #7be8ff;
  font-size: 0.7rem;
  font-weight: 900;
}

.tiny-icon-button {
  display: inline-grid;
  width: 24px;
  height: 22px;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.tiny-icon-button:hover {
  color: #ffffff;
}

.tiny-icon-button svg {
  width: 14px;
  height: 14px;
}

.totp-remove:hover {
  color: var(--red);
}

.copy-flash {
  animation: copy-fade 0.76s ease both;
}

.tiny-copy.copy-flash {
  border-radius: 4px;
  background: rgba(120, 255, 199, 0.16);
  color: #c8fff0;
}

.secondary-button.copy-flash,
.icon-button.copy-flash {
  border-color: rgba(120, 255, 199, 0.78);
  background: rgba(0, 207, 138, 0.22);
}

@keyframes copy-fade {
  0% {
    opacity: 1;
    transform: scale(1);
  }

  28% {
    opacity: 0.38;
    transform: scale(0.96);
  }

  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.otp-copy {
  justify-content: flex-start;
}

.otp-value {
  flex: 0 0 auto;
  letter-spacing: 0;
}

.content-cell {
  min-width: 0;
}

.preview {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.code-cell strong {
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: #1d4b68;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 950;
  white-space: nowrap;
}

.status.ok {
  background: rgba(0, 207, 138, 0.18);
  color: #78ffc7;
}

.status.wait {
  background: rgba(255, 209, 102, 0.16);
  color: var(--amber);
}

.status.fail {
  max-width: 100%;
  min-width: 70px;
  overflow: hidden;
  background: rgba(255, 93, 108, 0.16);
  color: #ffadbb;
  text-overflow: ellipsis;
}

.empty-state {
  height: 82px;
  color: transparent;
  text-align: center;
  vertical-align: middle;
}

[data-tone="ok"] {
  color: #78ffc7;
}

[data-tone="error"] {
  color: #ffadbb;
}

dialog {
  width: min(760px, calc(100vw - 28px));
  padding: 0;
  border: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(4, 17, 29, 0.72);
}

.dialog-box {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

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

pre {
  max-height: 62vh;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  color: var(--muted-strong);
  font-family: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
  line-height: 1.48;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  :root {
    --wrap: calc(100vw - 28px);
  }

  .topbar {
    margin-top: 10px;
  }

  .topbar {
    overflow-x: auto;
  }

  .main-menu {
    min-width: max-content;
  }

  textarea {
    min-height: 150px;
  }

  .run-row {
    align-items: stretch;
  }

  .primary-button,
  .danger-button {
    flex: 1;
  }

  .table-wrap {
    overflow-x: auto;
  }

  table {
    min-width: 820px;
  }
}

@media (max-width: 460px) {
  .panel-head h2 {
    font-size: 1.08rem;
  }
}
