:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #667085;
  --line: #d9dee7;
  --accent: #1663d9;
  --accent-strong: #0f4fb3;
  --danger: #b42318;
  --success: #087443;
  --shadow: 0 10px 24px rgba(22, 34, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", Arial, sans-serif;
}

.shell {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 700;
}

h2 {
  font-size: 17px;
  font-weight: 700;
}

.topbar p,
.muted {
  color: var(--muted);
}

.actions,
.filters,
.row-actions,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary,
button {
  height: 38px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.primary {
  background: var(--accent);
  color: white;
}

.primary:hover,
button:hover {
  filter: brightness(0.97);
}

.secondary {
  background: #eef4ff;
  border-color: #c8d8f6;
  color: var(--accent-strong);
}

.danger {
  background: #fff1f0;
  border-color: #ffd1cc;
  color: var(--danger);
}

.small {
  height: 30px;
  padding: 0 10px;
  font-size: 13px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  background: #f3f5f8;
  border-color: var(--line);
  color: var(--text);
}

.notice {
  border: 1px solid #fedf89;
  background: #fffaeb;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
}

.import-panel {
  min-height: auto;
  margin-bottom: 16px;
}

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

textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  font: 14px Consolas, "Courier New", monospace;
}

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

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-height: 320px;
}

.panel-head,
.toolbar {
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.account-list,
.message-list {
  padding: 12px;
}

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

.account {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  display: grid;
  gap: 12px;
  margin-bottom: 10px;
}

.account strong,
.account span,
.account small {
  display: block;
  overflow-wrap: anywhere;
}

.account small {
  color: var(--muted);
  margin-top: 5px;
}

.content {
  min-width: 0;
}

input[type="search"] {
  width: min(320px, 32vw);
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 12px;
  font: inherit;
}

select {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  padding: 0 10px;
  font: inherit;
}

.token-box {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.token-box label {
  color: var(--muted);
  font-size: 12px;
}

.token-box input {
  width: 100%;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 8px;
  color: var(--muted);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  white-space: nowrap;
}

.message {
  border-bottom: 1px solid var(--line);
  padding: 14px 6px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 128px;
  gap: 16px;
}

.message:last-child {
  border-bottom: 0;
}

.message-title,
.message-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.message-title strong {
  overflow-wrap: anywhere;
}

.message-title span,
.message-meta,
.message p,
.otp-box span {
  color: var(--muted);
  font-size: 13px;
}

.message p {
  margin-top: 8px;
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  border: 1px solid #ccd5e3;
  border-radius: 999px;
  padding: 2px 8px;
  color: var(--muted);
  font-size: 12px;
}

.otp-box {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 4px;
}

.otp {
  min-width: 102px;
  height: 42px;
  background: #ecfdf3;
  border-color: #abefc6;
  color: var(--success);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.hidden {
  display: none;
}

@media (max-width: 860px) {
  .topbar,
  .toolbar,
  .filters {
    align-items: stretch;
    flex-direction: column;
  }

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

  input[type="search"] {
    width: 100%;
  }

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

  .otp-box {
    align-items: flex-start;
  }
}
