[hidden] { display: none !important; }
button, input, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: white; padding: 10px 16px; min-height: 44px; font-weight: 600; }
button:disabled { cursor: default; opacity: .55; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
input, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--ink); }
textarea { resize: vertical; min-height: 76px; }
.quiet { color: var(--accent); background: transparent; border-color: var(--line); }
.danger { color: #9a3029; border-color: #9a3029; background: transparent; }
.muted { color: var(--muted); font-size: 14px; }
.contact-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 12px 20px; }
.chat-launch { display: inline-flex; align-items: center; gap: 10px; color: var(--accent); background: transparent; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.chat-launch.is-online::before { content: ''; width: 8px; height: 8px; background: var(--accent); border-radius: 50%; }
.chat-panel { width: min(440px, calc(100% - 32px)); max-width: none; max-height: calc(100dvh - 32px); padding: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); color: var(--ink); overflow-y: auto; }
.chat-panel[open] { display: flex; flex-direction: column; }
.chat-panel::backdrop { background: #242e2c66; }
.chat-history { padding: 10px 16px; }
.chat-history label { display: block; margin-bottom: 6px; font-size: 13px; }
.chat-history select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: white; color: var(--ink); font: inherit; }
.chat-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 16px; }
.chat-actions button { font-size: 13px; }
.chat-confirmation { margin: 8px 16px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
.chat-confirmation p { margin: 0 0 8px; font-size: 14px; line-height: 1.6; }
.chat-confirmation .chat-actions { padding: 0; }
.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-bottom: 1px solid var(--line); }
.chat-header h2 { font-size: 18px; margin: 0; }
.chat-header button { padding: 4px 10px; background: none; color: var(--ink); border: 0; font-size: 24px; }
.chat-notice { margin: 0; padding: 12px 16px 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.chat-email { margin: 8px 16px; font-size: 13px; color: var(--accent); text-underline-offset: 3px; }
.message-list { overflow-y: auto; overscroll-behavior: contain; min-height: 100px; flex: 1; padding: 16px; }
.chat-panel .message-list { min-height: 80px; max-height: 260px; }
.message { max-width: 92%; padding: 10px 12px; margin: 0 auto 12px 0; border: 1px solid var(--line); border-radius: 10px; background: white; overflow-wrap: anywhere; }
.message-own { margin-right: 0; margin-left: auto; background: #e8eee8; }
.message-label { font-size: 11px; color: var(--muted); }
.message p { font-size: 14px; line-height: 1.6; white-space: pre-wrap; margin: 4px 0 0; }
.message-form { padding: 16px; border-top: 1px solid var(--line); }
.message-form label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.form-bottom { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 10px; }
.form-bottom span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.auth-card { width: min(440px, calc(100% - 40px)); margin: 10vh auto; padding: 28px; background: white; border: 1px solid var(--line); border-radius: 16px; }
.auth-card .brand { text-decoration: none; }
.auth-card h1 { font-size: 32px; margin: 32px 0 16px; letter-spacing: -.04em; }
.auth-card p { font-size: 15px; line-height: 1.6; color: var(--muted); }
.auth-card label { display: block; margin: 20px 0 8px; }
.auth-card button { width: 100%; margin-top: 16px; }
.admin-body { padding-bottom: env(safe-area-inset-bottom); }
.admin-header { max-width: 1200px; margin: auto; padding: 24px; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.admin-header .brand { text-decoration: none; }
.admin-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.admin-main { max-width: 1200px; margin: auto; padding: 0 24px 24px; }
.admin-settings { padding: 16px 0 24px; }
.admin-settings p { margin: 8px 0; font-size: 14px; line-height: 1.6; }
#admin-status { min-height: 22px; }
#presence[aria-pressed="false"] { background: transparent; color: var(--accent); }
.inbox-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); min-height: 500px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.inbox { padding: 20px; border-right: 1px solid var(--line); max-height: 70vh; overflow-y: auto; }
.inbox h1 { font-size: 22px; margin: 0 0 20px; letter-spacing: -.035em; }
#unread-count { color: var(--accent); }
.conversation-item { width: 100%; border: 1px solid transparent; background: transparent; color: var(--ink); text-align: left; padding: 12px; margin-bottom: 8px; }
.conversation-item.selected { border-color: var(--accent); background: #e8eee8; }
.conversation-item strong { display: block; font-size: 12px; font-weight: 600; line-height: 1.5; }
.conversation-preview { display: block; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 400; }
.unread-badge { display: block; margin-top: 6px; color: var(--accent); font-size: 11px; }
.conversation-pane { min-width: 0; display: flex; flex-direction: column; height: min(75vh, 760px); }
.conversation-header { padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.conversation-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
dialog { max-width: min(440px, calc(100% - 32px)); border: 1px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); padding: 24px; }
dialog::backdrop { background: #242e2c66; }
dialog h2 { font-size: 22px; margin-top: 0; }
dialog p { line-height: 1.6; }
@media (max-width: 700px) {
  .admin-header { padding: 16px; align-items: flex-start; flex-wrap: wrap; }
  .admin-header .brand { font-size: 22px; }
  .admin-header .admin-actions { justify-content: flex-end; }
  .admin-header button { font-size: 12px; }
  .admin-main { padding: 0 16px 16px; }
  .inbox-layout { grid-template-columns: 1fr; }
  .inbox { border-right: 0; border-bottom: 1px solid var(--line); max-height: 240px; padding: 16px; }
  .conversation-pane { height: 65dvh; min-height: 420px; }
  .conversation-header { flex-wrap: wrap; }
  .contact-actions { justify-content: flex-start; }
}

@media (max-width: 760px) {
  .contact-actions { flex-direction: column; align-items: flex-start; }
}
