:root {
  color-scheme: light;
  --paper: #f3f1e9;
  --paper-deep: #e5e1d5;
  --ink: #101713;
  --muted: #667069;
  --line: #c9cbc4;
  --green: #18704d;
  --green-bright: #b9f36a;
  --orange: #f0a25f;
  --terminal: #101713;
  --terminal-line: #2a362e;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--paper); scroll-behavior: smooth; }
body { min-width: 320px; margin: 0; color: var(--ink); background: var(--paper); }
button, input { font: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: 8px; left: 8px; z-index: 20; padding: 10px 14px; background: var(--ink); color: white; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.topbar, main, footer { width: min(1240px, calc(100% - 48px)); margin-inline: auto; }
.topbar { height: 82px; display: flex; align-items: center; justify-content: flex-start; gap: 24px; border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; width: fit-content; margin-right: auto; font-size: 19px; font-weight: 760; letter-spacing: -.03em; text-decoration: none; }
.brand-mark { display: inline-flex; align-items: end; gap: 2px; width: 25px; height: 25px; padding: 5px; background: var(--ink); }
.brand-mark i { display: block; width: 3px; background: var(--green-bright); }
.brand-mark i:nth-child(1) { height: 7px; }
.brand-mark i:nth-child(2) { height: 14px; }
.brand-mark i:nth-child(3) { height: 10px; }
nav { display: flex; gap: 26px; }
nav a { color: #3d463f; font-size: 13px; font-weight: 680; text-decoration: none; }
nav a:hover { color: var(--green); }
.locale-switch { display: inline-flex; align-items: center; flex: 0 0 auto; min-width: 67px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; background: #ebe8de; }
.locale-switch a { flex: 1; min-width: 28px; padding: 4px 6px; border-radius: 999px; color: var(--muted); font: 750 10px/1 ui-monospace, monospace; text-align: center; text-decoration: none; }
.locale-switch a[aria-current="true"] { color: white; background: var(--ink); }

.login-layout { min-height: calc(100vh - 164px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(420px, .82fr); gap: clamp(60px, 9vw, 140px); align-items: center; padding: 72px 0 88px; }
.eyebrow { margin: 0 0 22px; color: var(--green); font: 750 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; }
h1 { margin: 0; font-size: clamp(48px, 6vw, 82px); line-height: 1.01; letter-spacing: -.06em; text-wrap: balance; }
.keep-together { white-space: nowrap; }
html[lang="en"] h1 { max-width: 740px; font-size: clamp(46px, 5.4vw, 74px); letter-spacing: -.05em; line-break: auto; overflow-wrap: normal; word-break: normal; }
html[lang="en"] .keep-together { white-space: normal; }
.login-copy > p:last-of-type { max-width: 600px; margin: 30px 0 0; color: var(--muted); font-size: 17px; line-height: 1.75; text-wrap: pretty; }
.login-copy dl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 48px 0 0; padding-top: 21px; border-top: 1px solid var(--line); }
.login-copy dt { color: #7b827d; font: 700 9px ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.login-copy dd { margin: 7px 0 0; font-size: 12px; font-weight: 680; }

.login-form { padding: 28px; border: 1px solid #29332d; background: var(--terminal); color: white; box-shadow: 14px 16px 0 var(--paper-deep); }
.form-head { display: flex; justify-content: space-between; margin: -28px -28px 28px; padding: 17px 20px; border-bottom: 1px solid var(--terminal-line); color: #849087; font: 700 9px ui-monospace, monospace; letter-spacing: .1em; }
.form-head p { margin: 0; color: var(--green-bright); }
.login-form label { display: block; margin-bottom: 9px; color: #a7b2aa; font-size: 12px; font-weight: 680; }
.login-form input { width: 100%; min-height: 54px; border: 1px solid #3a493f; border-radius: 0; padding: 0 15px; outline: 0; background: #0b100d; color: white; font: 600 13px ui-monospace, monospace; }
.login-form input:focus { border-color: var(--green-bright); box-shadow: 0 0 0 3px #b9f36a20; }
.login-form > button { width: 100%; min-height: 50px; margin-top: 14px; border: 1px solid var(--green-bright); background: var(--green-bright); color: var(--ink); font-weight: 780; cursor: pointer; }
.login-form > button:hover { background: #cdfa8f; }
.login-form > button:disabled { cursor: wait; opacity: .62; }
.form-error { min-height: 22px; margin: 13px 0 0; color: #f3a28f; font-size: 12px; line-height: 1.6; }
.form-note { margin: 17px 0 0; color: #829087; font-size: 12px; line-height: 1.72; }
.form-actions { display: flex; justify-content: space-between; gap: 16px; margin: 25px -28px -28px; padding: 18px 28px; border-top: 1px solid var(--terminal-line); color: #849087; font-size: 12px; }
.form-actions a { color: var(--green-bright); font-weight: 700; text-decoration: none; }

.inbox-view { min-height: calc(100vh - 164px); padding: 64px 0 88px; }
.inbox-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.inbox-head h1 { font-size: clamp(46px, 6vw, 72px); }
.quiet-button { border: 0; border-bottom: 1px solid currentColor; padding: 7px 0; background: transparent; color: var(--green); font-size: 11px; font-weight: 720; cursor: pointer; }
.quiet-button:hover { color: var(--ink); }
.identity-strip { display: grid; grid-template-columns: 1.2fr 1fr .7fr .7fr 1.5fr; margin-top: 48px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--line); }
.identity-strip > div { min-width: 0; padding: 21px 22px 23px 0; }
.identity-strip > div + div { padding-left: 22px; border-left: 1px solid var(--line); }
.identity-strip span { display: block; color: #777f79; font: 700 9px ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.identity-strip strong { display: block; overflow: hidden; margin-top: 8px; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
#device-state { display: flex; align-items: center; gap: 8px; }
#device-state i { width: 7px; height: 7px; border-radius: 50%; background: #8a918c; }
#device-state.is-online { color: var(--green); }
#device-state.is-online i { background: var(--green); box-shadow: 0 0 0 4px #18704d18; }
#device-state.is-offline { color: #9a5545; }
#device-state.is-offline i { background: #c36a55; }
#last-online { font-size: 12px; }

.webhook-panel { margin-top: 42px; padding: 28px; border: 1px solid #29332d; background: var(--terminal); color: white; }
.webhook-head { display: flex; align-items: center; justify-content: space-between; gap: 24px; cursor: pointer; list-style: none; }
.webhook-head::-webkit-details-marker { display: none; }
.webhook-head::marker { content: ""; }
.webhook-head:hover .webhook-toggle-label { color: var(--green-bright); }
.webhook-head .eyebrow { margin-bottom: 9px; color: var(--green-bright); }
.webhook-head h2 { margin: 0; font-size: clamp(25px, 3vw, 36px); letter-spacing: -.045em; }
.webhook-summary-meta { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }
.webhook-state { flex: 0 0 auto; padding: 7px 9px; border: 1px solid #46534b; color: #9ba69e; font: 700 9px ui-monospace, monospace; letter-spacing: .08em; }
.webhook-state.is-enabled { border-color: #70994c; color: var(--green-bright); }
.webhook-toggle-label { color: #aeb8b1; font-size: 11px; font-weight: 700; white-space: nowrap; }
.webhook-summary-meta > i { width: 9px; height: 9px; border-right: 1px solid var(--green-bright); border-bottom: 1px solid var(--green-bright); transform: rotate(45deg) translateY(-2px); transition: transform .18s ease; }
.webhook-panel[open] .webhook-summary-meta > i { transform: rotate(225deg) translate(-2px, -2px); }
details.webhook-panel:not([open]) > .webhook-body { display: none; }
.webhook-body { padding-top: 22px; }
.webhook-intro { max-width: 72ch; margin: 17px 0 0; color: #a6b0a9; font-size: 13px; line-height: 1.72; }
.webhook-form { display: grid; grid-template-columns: 1fr 1fr; gap: 19px 22px; margin-top: 25px; }
.webhook-form > label { display: grid; gap: 8px; color: #d8ded9; font-size: 12px; font-weight: 680; }
.webhook-form label > span { color: #87948b; font-size: 10px; font-weight: 600; }
.webhook-form input[type="url"], .webhook-form textarea { width: 100%; border: 1px solid #3a493f; border-radius: 0; padding: 12px 13px; outline: 0; background: #0b100d; color: white; font: inherit; font-size: 13px; font-weight: 500; line-height: 1.6; resize: vertical; }
.webhook-form input[type="url"]:focus, .webhook-form textarea:focus { border-color: var(--green-bright); box-shadow: 0 0 0 3px #b9f36a20; }
.webhook-toggle { grid-column: 1 / -1; display: flex !important; align-items: center; justify-content: space-between; min-height: 58px; padding: 11px 14px; border: 1px solid #344139; }
.webhook-toggle span, .webhook-toggle strong, .webhook-toggle small { display: block; }
.webhook-toggle strong { color: white; font-size: 12px; }
.webhook-toggle small { margin-top: 5px; color: #87948b; font-size: 10px; font-weight: 500; }
.webhook-toggle input { width: 20px; height: 20px; accent-color: var(--green-bright); }
.webhook-privacy { grid-column: 1 / -1; margin: 0; color: #87948b; font-size: 11px; line-height: 1.65; }
.webhook-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 9px; }
.webhook-actions button { min-height: 42px; border: 1px solid var(--green-bright); padding: 9px 14px; background: var(--green-bright); color: var(--ink); font-size: 11px; font-weight: 760; cursor: pointer; }
.webhook-actions .secondary-button { border-color: #6d7a71; background: transparent; color: #dbe2dd; }
.webhook-actions .danger-button { margin-left: auto; border-color: #825c54; background: transparent; color: #eda996; }
.webhook-actions button:disabled { cursor: wait; opacity: .45; }
.webhook-feedback { grid-column: 1 / -1; min-height: 18px; margin: 0; color: var(--green-bright); font-size: 11px; line-height: 1.6; }
.webhook-feedback.is-error { color: #f3a28f; }
.delivery-log { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--terminal-line); }
.delivery-log > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.delivery-log h3 { margin: 0; color: #cbd3cd; font-size: 12px; }
.delivery-log .quiet-button { color: var(--green-bright); }
#webhook-deliveries { margin: 14px 0 0; padding: 0; list-style: none; }
.delivery-item { display: grid; grid-template-columns: 70px minmax(0, 1fr) 145px; gap: 14px; padding: 13px 0; border-top: 1px solid #29352d; color: #aab4ad; font-size: 11px; }
.delivery-item strong { color: #dce3de; }
.delivery-item time { text-align: right; }
.delivery-status { width: fit-content; color: var(--green-bright); font: 750 9px ui-monospace, monospace; letter-spacing: .08em; }
.delivery-status.failed { color: #f3a28f; }
.delivery-empty { padding: 20px 0 4px; color: #7f8b82; font-size: 11px; }

.inbox-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 28px; margin-top: 34px; }
.filters { display: flex; gap: 5px; }
.filter { min-width: 66px; min-height: 36px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 11px; font-weight: 720; cursor: pointer; }
.filter:hover, .filter.is-active { border-color: var(--ink); background: var(--ink); color: white; }
.refresh-state { display: flex; align-items: center; gap: 20px; color: #7b827d; font-size: 11px; }
.inbox-notice { margin-top: 26px; padding: 18px 20px; border-left: 3px solid var(--orange); background: #ebe6da; color: #525b54; font-size: 13px; line-height: 1.7; }
.event-list { margin: 26px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--ink); }
.event-item { display: grid; grid-template-columns: 90px minmax(140px, .45fr) minmax(0, 1fr) 150px; gap: 24px; padding: 24px 0 26px; border-bottom: 1px solid var(--line); }
.event-kind { align-self: start; width: fit-content; padding: 5px 8px; background: #dfe5df; color: #285740; font: 750 9px ui-monospace, monospace; letter-spacing: .08em; }
.event-kind.call { background: #efe0cf; color: #87542d; }
.event-kind.test { background: #e4e0ed; color: #594b75; }
.event-sender span, .event-message span { display: block; color: #7b827d; font: 700 9px ui-monospace, monospace; letter-spacing: .08em; text-transform: uppercase; }
.event-sender strong { display: block; overflow: hidden; margin-top: 8px; font: 650 13px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.event-message p { margin: 7px 0 0; color: #343d36; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; white-space: pre-wrap; }
.event-message mark { padding: 2px 4px; background: var(--green-bright); color: var(--ink); font-weight: 760; }
.event-time { color: #6e766f; font: 600 11px/1.7 ui-monospace, monospace; text-align: right; }
.event-empty { padding: 58px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 14px; text-align: center; }

footer { min-height: 82px; display: flex; align-items: center; gap: 24px; border-top: 1px solid var(--line); color: #6f7771; font-size: 10px; }
footer span { margin-right: auto; font: 700 9px ui-monospace, monospace; letter-spacing: .09em; }
footer a { text-underline-offset: 4px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }

@media (max-width: 900px) {
  .login-layout { grid-template-columns: 1fr; gap: 56px; }
  .login-form { width: min(620px, 100%); }
  .event-item { grid-template-columns: 78px minmax(120px, .4fr) minmax(0, 1fr); }
  .event-time { grid-column: 2 / -1; text-align: left; }
}

@media (max-width: 640px) {
  .topbar, main, footer { width: min(100% - 28px, 1240px); }
  .topbar { height: 70px; }
  nav { gap: 15px; }
  nav a:last-child { display: none; }
  .login-layout { min-height: auto; padding: 52px 0 70px; }
  h1 { font-size: clamp(41px, 12vw, 58px); }
  html[lang="en"] h1 { font-size: clamp(38px, 11vw, 52px); }
  .topbar { gap: 12px; }
  nav { margin-left: auto; }
  .login-form input { font-size: 16px; }
  .login-copy > p:last-of-type { font-size: 15px; }
  .login-copy dl { grid-template-columns: 1fr; gap: 14px; }
  .login-form { padding: 22px; box-shadow: 7px 8px 0 var(--paper-deep); }
  .form-head { margin: -22px -22px 24px; }
  .form-actions { margin: 22px -22px -22px; padding-inline: 22px; }
  .inbox-view { padding-top: 46px; }
  .inbox-head { align-items: start; flex-direction: column; }
  .identity-strip { grid-template-columns: 1fr 1fr; }
  .identity-strip > div { padding: 18px 14px 19px 0; }
  .identity-strip > div + div { padding-left: 14px; }
  .identity-strip > div:nth-child(3) { padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .identity-strip > div:nth-child(4) { border-top: 1px solid var(--line); }
  .identity-strip > div:nth-child(5) { grid-column: 1 / -1; padding-left: 0; border-left: 0; border-top: 1px solid var(--line); }
  .webhook-panel { padding: 21px 18px; }
  .webhook-head { align-items: flex-start; flex-direction: column; gap: 13px; }
  .webhook-summary-meta { width: 100%; }
  .webhook-toggle-label { margin-left: auto; }
  .webhook-form { grid-template-columns: 1fr; }
  .webhook-toggle, .webhook-privacy, .webhook-actions, .webhook-feedback { grid-column: 1; }
  .webhook-actions .danger-button { margin-left: 0; }
  .delivery-item { grid-template-columns: 62px minmax(0, 1fr); }
  .delivery-item time { grid-column: 2; text-align: left; }
  .inbox-toolbar { align-items: start; flex-direction: column; }
  .refresh-state { width: 100%; justify-content: space-between; }
  .event-item { grid-template-columns: 65px minmax(0, 1fr); gap: 16px; }
  .event-message { grid-column: 1 / -1; }
  .event-time { grid-column: 1 / -1; }
  footer { flex-wrap: wrap; padding: 28px 0; }
  footer span { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}
