* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Segoe UI", sans-serif; color: #1d1d1f; background: #f5f5f7; }
[hidden] { display: none !important; }
a { color: #0a58ca; }
h1 { font-size: 20px; margin: 0 0 12px; }
h2 { font-size: 16px; margin: 20px 0 8px; }
.top { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 10px 16px; background: #1d1d1f; color: #fff; }
.top a, .top .link { color: #fff; }
.top nav { display: flex; gap: 14px; }
.top nav a { text-decoration: none; padding: 2px 0; }
.top nav a.on { border-bottom: 2px solid #fff; }
.brand { font-weight: 600; }
.who { margin-left: auto; font-size: 13px; opacity: .8; overflow-wrap: anywhere; }
.app { max-width: 1120px; margin: 0 auto; padding: 16px; }
.card { background: #fff; border-radius: 10px; padding: 14px 16px; margin: 0 0 14px; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 0; }
.kv dt { color: #6e6e73; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
label { display: block; margin: 0 0 10px; }
label > span { display: block; font-size: 13px; color: #6e6e73; margin-bottom: 3px; }
label.check { display: flex; align-items: center; gap: 8px; }
label.check > span { display: inline; margin: 0; color: inherit; font-size: 15px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; padding: 8px 10px; border: 1px solid #c7c7cc; border-radius: 8px; background: #fff; }
textarea { min-height: 120px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.row > button { flex: 0 0 auto; }
button { font: inherit; padding: 8px 16px; border-radius: 8px; border: 1px solid #0a58ca; background: #0a58ca; color: #fff; cursor: pointer; min-height: 38px; }
button.secondary { background: #fff; color: #0a58ca; }
button.danger { background: #c62828; border-color: #c62828; }
button.small { padding: 3px 10px; min-height: 28px; font-size: 13px; }
button.link { background: none; border: 0; padding: 0; min-height: 0; color: inherit; text-decoration: underline; }
button:disabled { opacity: .45; cursor: not-allowed; }
.msg { padding: 10px 12px; border-radius: 8px; margin: 0 0 12px; overflow-wrap: anywhere; }
.msg.error { background: #fdecea; color: #8e1b12; }
.msg.warn { background: #fff4e5; color: #7a4100; }
.msg.ok { background: #e8f5e9; color: #1b5e20; }
.muted { color: #6e6e73; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 12px; overflow-wrap: anywhere; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #e5e5ea; vertical-align: top; }
th { color: #6e6e73; font-weight: 500; white-space: nowrap; }
.badge { display: inline-block; padding: 0 8px; border-radius: 10px; font-size: 12px; background: #e5e5ea; }
.badge.applied, .badge.completed, .badge.yes { background: #e8f5e9; color: #1b5e20; }
.badge.failed, .badge.partial { background: #fdecea; color: #8e1b12; }
.badge.pending, .badge.running, .badge.previewed { background: #fff4e5; color: #7a4100; }
.badge.revoked { background: #ede7f6; color: #4527a0; }
.badge.open { background: #fff4e5; color: #7a4100; }
.badge.handled { background: #e8f5e9; color: #1b5e20; }
a.badge.code, span.badge.code { font-family: ui-monospace, Menlo, monospace; background: #fdecea; color: #8e1b12; text-decoration: none; margin: 0 4px 2px 0; }
.tags { display: inline-flex; flex-wrap: wrap; }
.stats { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; }
.stats .group { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.stats .label { color: #6e6e73; font-size: 13px; }
.stat { display: inline-flex; gap: 4px; align-items: baseline; padding: 2px 8px; border-radius: 8px; background: #f5f5f7; color: inherit; text-decoration: none; white-space: nowrap; }
.stat strong { font-size: 17px; color: #0a58ca; }
.stat.big strong { font-size: 22px; color: #8e1b12; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.chip { font-size: 13px; padding: 1px 8px; border-radius: 10px; background: #e5e5ea; color: inherit; text-decoration: none; }
.excerpt { max-width: 420px; overflow-wrap: anywhere; }
.desc { white-space: pre-wrap; overflow-wrap: anywhere; }
.summary { font-size: 15px; }
.summary li { margin: 2px 0; }
.qr { width: 200px; height: 200px; background: #fff; }
.pager { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; background: #f5f5f7; padding: 8px; border-radius: 6px; margin: 4px 0; }
@media (max-width: 600px) {
  .app { padding: 10px; }
  .card { padding: 12px; }
  .kv { grid-template-columns: 1fr; }
  .kv dt { margin-top: 6px; }
}
td .mono { white-space: nowrap; overflow-wrap: normal; }
/* Inbox list: keep its columns readable on a phone; it scrolls inside its card. */
[data-testid=inbox-list] { min-width: 760px; }
[data-testid=inbox-list] td:nth-child(1), [data-testid=inbox-list] td:nth-child(2), [data-testid=inbox-list] td:nth-child(6) { white-space: nowrap; }
.badge { white-space: nowrap; }
