:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --panel: #ffffff;
  --panel-soft: #f8fafb;
  --panel-strong: #eef4f4;
  --text: #16202a;
  --muted: #697888;
  --line: #d8e0e8;
  --accent: #0f766e;
  --accent-strong: #0b5d57;
  --warning: #b45309;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #e9f3f1 0, rgba(233, 243, 241, 0) 320px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

button:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.12);
}

button:active {
  transform: translateY(1px);
}

input {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  outline: none;
}

input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.app {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  padding: 22px;
  backdrop-filter: blur(14px);
}

.brand,
.toolbar,
.message-head,
.actions,
.test-panel,
.custom-line,
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  justify-content: flex-start;
}

.toolbar,
.message-head {
  justify-content: space-between;
}

.brand h1,
.toolbar h2,
.message h3,
.brand p,
.eyebrow,
.message-meta,
.message-body,
.inbox-summary {
  margin: 0;
}

.brand-mark {
  display: grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: white;
  font-size: 14px;
  font-weight: 900;
}

.brand h1 {
  font-size: 22px;
}

.brand p,
.eyebrow,
.message-meta,
.inbox-summary {
  color: var(--muted);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 999px;
  background: #16a34a;
  box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.12);
}

.quota {
  display: grid;
  gap: 9px;
  margin-top: 20px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.quota div:first-child {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 13px;
}

.quota strong {
  color: var(--text);
}

.quota-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #dde7e6;
}

.quota-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease;
}

.create-panel {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.create-panel input,
.filters input,
.test-panel input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-strong);
}

.mode-switch button {
  min-height: 34px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.mode-switch button.active {
  background: var(--panel);
  color: var(--accent-strong);
  box-shadow: 0 5px 14px rgba(22, 32, 42, 0.08);
}

.custom-line {
  gap: 8px;
}

.custom-line span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 14px;
}

.primary-action,
.test-panel button {
  min-height: 40px;
  border-color: var(--accent);
  background: var(--accent);
  color: white;
  font-weight: 800;
}

.notice {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.notice[data-tone="success"] {
  color: var(--accent-strong);
}

.notice[data-tone="error"] {
  color: var(--danger);
}

.addresses {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.address-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  text-align: left;
  background: var(--panel-strong);
}

.address-row.active {
  border-color: var(--accent);
  box-shadow: inset 3px 0 0 var(--accent), 0 8px 20px rgba(15, 118, 110, 0.1);
}

.address-text {
  display: block;
  max-width: 276px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 800;
}

.address-date {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.address-count {
  display: grid;
  min-width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--panel);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 900;
}

.inbox {
  padding: 26px;
}

.toolbar {
  min-height: 82px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.toolbar h2 {
  font-size: 26px;
  overflow-wrap: anywhere;
}

.inbox-summary {
  margin-top: 6px;
  font-size: 14px;
}

.eyebrow {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.actions button,
.filters button {
  min-height: 38px;
  padding: 0 14px;
}

.danger-action {
  color: var(--danger);
}

.filters {
  margin: 18px 0 0;
}

.filters input {
  flex: 1;
}

.test-panel {
  align-items: stretch;
  margin: 12px 0 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.test-panel input {
  flex: 1;
}

.messages {
  display: grid;
  gap: 12px;
}

.message {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 16px;
  box-shadow: 0 8px 24px rgba(22, 32, 42, 0.05);
}

.message h3 {
  font-size: 17px;
}

.message-body {
  margin-top: 12px;
  color: #273442;
  line-height: 1.55;
  white-space: pre-wrap;
}

.otp {
  display: none;
  min-width: 96px;
  min-height: 38px;
  background: #fff7ed;
  border-color: #fed7aa;
  color: var(--warning);
  font-weight: 900;
}

.otp.visible {
  display: inline-block;
}

.empty {
  display: grid;
  min-height: 220px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.65);
}

.empty.compact {
  min-height: 108px;
}

.hidden {
  display: none;
}

@media (max-width: 920px) {
  .app {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  .inbox,
  .sidebar {
    padding: 16px;
  }

  .toolbar,
  .test-panel,
  .custom-line,
  .filters {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .actions button {
    flex: 1;
  }

  .toolbar h2 {
    font-size: 21px;
  }

  .address-text {
    max-width: 70vw;
  }
}
