:root { --ink: #1b211e; --muted: #5c6762; --line: #dbe2de; --bg: #f4f6f5; --card: #fff; --accent: #1a6b3a; --danger: #a32116; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
h1 { margin: 0 0 12px; font-size: 24px; }
h2 { margin: 24px 0 8px; font-size: 17px; }
.card h2 { margin-top: 0; }
code { font: 13px/1.5 ui-monospace, Menlo, monospace; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
main { max-width: 980px; margin: 0 auto; padding: 24px 16px 60px; }
.full main { max-width: 1500px; }
.narrow main { max-width: 400px; padding-top: 12vh; }

.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 10px 16px; background: #0e1411; color: #fff; }
.topbar a, .topbar .link { color: #e4ebe7; text-decoration: none; }
.topbar .brand { font-weight: 700; color: #fff; }
.topbar nav { display: flex; flex-wrap: wrap; gap: 4px 16px; flex: 1; }
.topbar .active { color: #fff; box-shadow: 0 2px 0 #4ade80; }
.topbar-end { display: flex; gap: 14px; align-items: center; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px; margin-bottom: 18px; }
.stack { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.stack > label { display: flex; flex-direction: column; gap: 4px; width: 100%; max-width: 520px; font-weight: 600; }
.stack > .check { flex-direction: row; gap: 8px; font-weight: 400; }
.stack small { font-weight: 400; }
fieldset { width: 100%; border: 1px solid var(--line); border-radius: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 400; padding: 3px 0; }
input:not([type=checkbox], [type=color], [type=file]), select, textarea { padding: 8px 10px; border: 1px solid #aab6b0; border-radius: 7px; font: inherit; font-weight: 400; color: inherit; background: #fff; width: 100%; }
input:disabled, select:disabled, textarea:disabled { background: #eef1f0 !important; color: var(--muted); }
button, .button { display: inline-block; padding: 7px 13px; border: 1px solid #aab6b0; border-radius: 7px; background: #fff; color: var(--ink); font: inherit; text-decoration: none; cursor: pointer; white-space: nowrap; }
button:hover, .button:hover { background: #eef1f0; }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: #12552c; }
.link { border: 0; background: none; padding: 0; }
.link:hover { background: none; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.notice { padding: 10px 14px; border-radius: 8px; background: #e2f3e8; list-style: none; margin: 0 0 14px; }
.notice.error { background: #fbe6e3; color: var(--danger); }
.title-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.title-row h1 { margin: 0; }
.table-wrap { overflow-x: auto; padding: 0; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
.snippet { display: flex; gap: 10px; align-items: center; width: 100%; padding: 10px 12px; background: #0e1411; color: #d9f2e2; border-radius: 8px; }
.snippet code { flex: 1; min-width: 0; }

.setting { padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; font-weight: 600; }
.setting-input { display: flex; gap: 10px; align-items: flex-start; }
.setting-input > :first-child { flex: 1; min-width: 0; }
.setting-input > [type=color] { flex: none; width: 60px; height: 38px; }
.effective { margin: 4px 0 0; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.effective strong { color: var(--ink); }
.badge { font-size: 12px; font-weight: 400; padding: 1px 8px; border-radius: 9px; background: #e8ecea; color: #414a46; }
.badge.site { background: #d9eefc; color: #0b4a75; }
.badge.global { background: #e2f3e8; color: #12552c; }
.logo { max-height: 40px; max-width: 140px; vertical-align: middle; }
.form-end { padding-top: 16px; }

.previews { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.previews figure { margin: 0; max-width: 100%; }
.previews iframe { border: 1px solid #aab6b0; border-radius: 8px; background: #fff; max-width: 100%; }
.previews .desktop { width: 960px; height: 680px; }
.previews .mobile { width: 375px; height: 680px; }
.sample { padding: 24px; background: #fff; }
.sample-float { position: fixed; right: 16px; bottom: 16px; width: 52px; height: 52px; padding: 0; border-radius: 50%; }

.inbox-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }
.inbox-page main { flex: 1; min-height: 0; width: 100%; max-width: none; padding: 0; }
#inbox { display: grid; grid-template-columns: 370px 1fr; height: 100%; }
.list-pane, .chat-pane { min-height: 0; min-width: 0; overflow-y: auto; }
.list-pane { border-right: 1px solid var(--line); background: #fff; }
.toolbar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.toolbar .check, #filter-site { grid-column: 1 / -1; }
.not-counted { padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fdf6e3; font-size: 13.5px; }
.not-counted p { margin: 0 0 6px; }
.not-counted form { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 0; }
.not-counted button { padding: 2px 10px; font-size: 13px; }
.inbox-page main > .notice { margin: 10px 16px; }
.inbox-page main { display: flex; flex-direction: column; }
.inbox-page #inbox { flex: 1; min-height: 0; }
.avatar { flex: none; display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; object-fit: cover; background: var(--accent); color: #fff; font-size: 13px; font-weight: 600; }
.avatar.large { width: 72px; height: 72px; font-size: 28px; }
.person { display: flex; align-items: center; gap: 8px; }
.tag.person { display: inline-flex; gap: 4px; }
.tag .avatar { width: 16px; height: 16px; font-size: 9px; }
.avatar-field { display: flex; gap: 16px; align-items: center; }
.avatar-field label { display: block; font-weight: 600; }
.avatar-field .check { display: flex; font-weight: 400; }
.avatar-field small { display: block; }
#messages .operator { position: relative; padding-right: 38px; }
#messages .operator > .avatar { position: absolute; right: 0; top: 4px; }
#conversations { list-style: none; margin: 0; padding: 0; }
#conversations .none { padding: 20px; }
#more { margin: 12px; }
.conversation { display: flex; gap: 10px; width: 100%; padding: 11px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; white-space: normal; }
.conversation.selected { background: #e2f3e8; }
.conversation .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conversation .top { display: flex; justify-content: space-between; gap: 8px; }
.conversation .excerpt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.needs-reply .excerpt { color: var(--ink); font-weight: 600; }
.mark { flex: none; width: 36px; height: 36px; border-radius: 8px; object-fit: contain; color: #fff; font-weight: 700; display: grid; place-items: center; }
img.mark { background: #fff; border: 1px solid var(--line); }
.tags { display: flex; flex-wrap: wrap; gap: 4px; }
.tag { font-size: 12px; padding: 0 7px; border-radius: 8px; background: #e8ecea; color: #414a46; }
.tag.hot { background: #fbe6e3; color: var(--danger); }
.tag.live { background: #e2f3e8; color: #12552c; }
#empty { padding: 40px; text-align: center; }
#chat { display: flex; flex-direction: column; height: 100%; }
#chat-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 16px 6px; }
#chat-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 10px; border-bottom: 1px solid var(--line); }
#chat-actions select { width: auto; }
#chat-actions .danger { margin-left: auto; border-color: var(--danger); color: var(--danger); }
#back { display: none; }
#chat-error { margin: 10px 16px 0; }
#messages { flex: 1; min-height: 0; overflow-y: auto; list-style: none; margin: 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
#messages > li { max-width: 75%; align-self: flex-start; }
#messages .text { margin: 0; padding: 9px 13px; border-radius: 12px; overflow-wrap: anywhere; }
.text div, .text li { white-space: pre-wrap; overflow-wrap: anywhere; }
.text a { color: inherit; text-decoration: underline; overflow-wrap: anywhere; }
.text ul { list-style: disc; }
.text ul, .text ol { margin: 4px 0; padding-left: 22px; }
.text code, .text pre { font: 13px/1.45 ui-monospace, Menlo, monospace; background: rgba(128, 128, 128, .18); border-radius: 4px; }
.text code { padding: 1px 4px; }
.text pre { margin: 4px 0; padding: 7px 9px; overflow-x: auto; }
#messages small { color: var(--muted); padding: 0 4px; }
#messages .visitor .text { background: #fff; border: 1px solid var(--line); }
#messages .operator { align-self: flex-end; text-align: right; }
#messages .operator .text { background: var(--accent); color: #fff; text-align: left; }
#messages .pending .text { opacity: .6; }
#messages .email-state { display: block; }
#messages .email-state small.bad { color: var(--danger); font-weight: 600; }
#messages .email-state button { font-size: 12px; padding: 0 4px; text-decoration: underline; }
#reply-email { padding: 8px 16px 0; background: #fff; border-top: 1px solid var(--line); font-size: 14px; }
#reply-email p { margin: 2px 0 0; font-size: 13px; }
#reply-email + #reply { border-top: 0; }
#reply-email[hidden] + #reply { border-top: 1px solid var(--line); }
#reply { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: #fff; }
@media (max-width: 760px) {
  #inbox { grid-template-columns: 1fr; }
  #inbox.chatting .list-pane, #inbox:not(.chatting) .chat-pane { display: none; }
  #back { display: inline-block; }
}
