:root {
  color-scheme: dark;
  --bg: #000;
  --surface: #101010;
  --border: #303030;
  --muted: #aaa;
  --green: #1c7a15;
  --green-hover: #238b1b;
  --focus: #64b65b;
  --error: #ffb4a9;
  font: 14px Arial, Helvetica, sans-serif;
  color: #fff;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
h1, h2, h3, p, dl, dd { margin: 0; }
h1 { display: flex; align-items: baseline; gap: 7px; font-size: 23px; font-weight: 600; letter-spacing: -.55px; }
h2 { font-size: 18px; font-weight: 600; letter-spacing: -.3px; }
h3 { font-size: 14px; font-weight: 600; }
p { line-height: 1.5; }
.dashboard { width: min(100% - 48px, 1120px); margin: 37px auto; }
.dashboard:not(.connected) { width: min(100% - 32px, 340px); margin-top: min(18vh, 120px); }
.header, .section-heading, .detail-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.header { min-height: 48px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.connection { display: inline-block; border-radius: 50%; background: #f28c28; width: 7px; height: 7px; }
.connected .connection { background: var(--green); }
#login, #history { margin-top: 24px; }
.connect { display: grid; gap: 9px; }
label { color: #ddd; font-size: 12px; }
button, input { font: inherit; }
button { cursor: pointer; color: #fff; border: 1px solid transparent; border-radius: 4px; min-height: 40px; background: var(--green); padding: 9px 13px; }
button:hover:not(:disabled) { background: var(--green-hover); }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button.primary { display: flex; justify-content: space-between; align-items: center; min-height: 48px; text-align: left; }
button.primary span { font-size: 20px; line-height: 1; }
button.secondary { background: var(--surface); border-color: var(--border); }
button.secondary:hover:not(:disabled) { background: #1b1b1b; border-color: #555; }
button.quiet { background: transparent; color: var(--muted); min-height: 32px; padding: 5px 1px; }
button.quiet:hover:not(:disabled) { color: #fff; background: transparent; }
input { min-width: 0; width: 100%; min-height: 40px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 4px; background: #0b0b0b; color: #fff; }
input::placeholder { color: #a0a0a0; }
.actions { display: flex; gap: 8px; align-items: center; }
.actions input { width: 220px; }
.section-heading { margin-bottom: 14px; }
.muted, .notice { font-size: 12px; color: var(--muted); }
.section-heading .muted { margin-top: 4px; }
.notice { margin: 10px 0; }
.notice:empty { display: none; }
.notice.error { color: var(--error); }
.records { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; overflow: hidden; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 14px; text-align: left; }
th { border-bottom: 1px solid var(--border); color: var(--muted); font-size: 12px; font-weight: 500; }
th:last-child, td:last-child { text-align: right; }
td { overflow-wrap: anywhere; border-bottom: 1px solid #252525; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover, tbody tr:focus-within { background: #161616; }
.subject { min-width: 0; }
button.subject-link { display: block; max-width: 100%; min-height: 0; padding: 2px 0; color: #fff; text-align: left; background: transparent; border: 0; font-weight: 600; }
button.subject-link:hover:not(:disabled) { background: transparent; text-decoration: underline; }
.subject .muted { display: block; margin-top: 3px; }
.status-value { text-transform: capitalize; }
.status-value[data-status="sent"] { color: #a4d39e; }
.date-cell { white-space: nowrap; }
.empty { padding: 18px 14px; color: var(--muted); }
dialog { width: min(100% - 32px, 520px); max-height: 85vh; padding: 20px; background: var(--surface); color: #fff; border: 1px solid var(--border); border-radius: 6px; }
dialog::backdrop { background: rgb(0 0 0 / .75); }
.detail-heading { align-items: start; margin-bottom: 18px; }
.detail-heading h2 { overflow-wrap: anywhere; padding-top: 5px; }
.close { width: 32px; font-size: 22px; }
.detail-fields { display: grid; grid-template-columns: minmax(95px, 1fr) minmax(0, 1.7fr); gap: 9px 14px; }
.detail-fields dt { color: var(--muted); }
.detail-fields dd { overflow-wrap: anywhere; }
.activity { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 16px; }
.activity h3 { margin-bottom: 12px; }
@media (max-width: 760px) {
  .dashboard { width: calc(100% - 30px); margin: 20px auto; }
  .section-heading { align-items: start; flex-direction: column; gap: 10px; }
  .actions { width: 100%; }
  .actions input { flex: 1; width: auto; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-bottom: 1px solid var(--border); padding: 11px 12px; gap: 9px 12px; }
  tbody tr:last-child { border-bottom: 0; }
  td, td:last-child { padding: 0; text-align: left; border-bottom: 0; }
  td::before { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; content: attr(data-label); }
  td.subject { grid-column: 1 / -1; }
  td.subject::before { content: none; }
  .date-cell { white-space: normal; }
}
