* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; color: #22303c; background: #f6f7f9; }
a { color: #1a6b8f; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef1f4; padding: 0 4px; border-radius: 4px; font-size: 0.88em; }
code.wrap { word-break: break-all; white-space: normal; }
pre { white-space: pre-wrap; font: 0.9rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f9fafb; border: 1px solid #eef1f4; border-radius: 8px; padding: 0.7rem 0.9rem; margin: 0.4rem 0 0; }

.layout { display: flex; min-height: 100vh; }
.sidebar { width: 230px; flex-shrink: 0; background: #1b2833; color: #d8e0e7; padding: 1.2rem 1rem; }
.sidebar h1 { font-size: 1.05rem; margin: 0 0 0.6rem; }
.sidebar h1 a { color: #fff; }
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a { color: #d8e0e7; display: block; padding: 0.35rem 0.5rem; border-radius: 6px; }
.sidebar li a:hover { background: #2b3d4d; text-decoration: none; }
.ws-name { color: #8fa3b3; font-size: 0.85rem; margin: 0 0.5rem 1rem; }
.ws-switch select { width: 100%; margin: 0 0 1rem; padding: 0.3rem; border-radius: 6px; border: 1px solid #2b3d4d; background: #24343f; color: #fff; }
.linklike { background: none; border: none; color: #1a6b8f; cursor: pointer; padding: 0.2rem 0.4rem; font-size: 0.9rem; }
.sidebar .linklike { color: #8fa3b3; }
.sidebar .linklike:hover { color: #fff; }
.inline { display: inline; }
.who { margin-top: 1.2rem; }

main { flex: 1; padding: 1.6rem 2rem; max-width: 1200px; min-width: 0; }
h2 { margin-top: 0; }
h3 { margin: 0 0 0.6rem; font-size: 1rem; }
h4 { margin: 1rem 0 0.4rem; font-size: 0.9rem; }
.muted { color: #7b8a97; }
.small { font-size: 0.8rem; }
.hint { color: #62717e; font-size: 0.85rem; }
.bad-text { color: #93312d; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.title-row h2, .title-row h3 { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }

.card { background: #fff; border: 1px solid #e3e8ed; border-radius: 12px; padding: 1rem 1.2rem; margin: 0 0 1rem; }
.card.danger { border-color: #e5b4b1; background: #fdf5f4; }
.row-item { padding: 0.35rem 0; border-bottom: 1px solid #eef1f4; display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.row-item:last-child { border-bottom: none; }
.pill { border-radius: 999px; padding: 0.12rem 0.65rem; font-size: 0.75rem; white-space: nowrap; background: #eef1f4; color: #33465a; display: inline-block; }
.pill.ok, .st-running, .st-active, .st-replied, .st-verified { background: #e2f3e8; color: #1e6b3a; }
.pill.bad, .st-error, .st-bounced, .st-critical, .st-bounce { background: #fdeaea; color: #93312d; }
.pill.warn, .st-paused, .st-warming, .st-watch, .st-failed, .st-auto_reply { background: #fdf3df; color: #8a5b13; }
.st-draft, .st-pending, .st-completed, .st-suppressed, .st-unsubscribed, .st-other { background: #eef1f4; color: #62717e; }
.st-reply { background: #e1e9fb; color: #1d47a3; }
.banner { border-radius: 8px; padding: 0.55rem 0.9rem; font-size: 0.85rem; margin: 0 0 1.1rem; }
.banner.info { background: #e8f1f6; border: 1px solid #c6dbe6; color: #1a4a63; }
.banner.warn { background: #fdf6e6; border: 1px solid #ecd9a8; color: #6f4a0e; }
.banner.danger { background: #fdeaea; border: 1px solid #f2c4c4; color: #93312d; }

.stat-row { display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.stat { background: #fff; border: 1px solid #e3e8ed; border-radius: 12px; padding: 0.6rem 1rem; display: flex; flex-direction: column; color: inherit; min-width: 96px; }
.stat-num { font-size: 1.3rem; font-weight: 700; }
.stat-sm .stat-num { font-size: 1.05rem; }
a.stat:hover { text-decoration: none; border-color: #1a6b8f; }

.entry-form { display: flex; gap: 0.5rem; flex-wrap: wrap; margin: 0.6rem 0; align-items: center; }
.entry-form input, .entry-form select, .stack-form input, .stack-form select, .stack-form textarea, .filter-row input, .filter-row select {
  padding: 0.4rem 0.55rem; border: 1px solid #ccd5dd; border-radius: 6px; background: #fff; font: inherit; }
.entry-form input { flex: 1; min-width: 120px; }
.stack-form { display: flex; flex-direction: column; gap: 0.6rem; }
.stack-form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; color: #62717e; }
.stack-form label input, .stack-form label select, .stack-form label textarea { color: #22303c; font-size: 0.95rem; }
.stack-form textarea { width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem 1rem; }
label.check { flex-direction: row; align-items: center; gap: 0.4rem; }
.inline-pair { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
fieldset { border: 1px solid #e3e8ed; border-radius: 8px; padding: 0.6rem 0.9rem; }
legend { font-size: 0.8rem; color: #62717e; }
details summary { cursor: pointer; font-size: 0.85rem; color: #1a6b8f; margin: 0.3rem 0; }
button { font: inherit; }
button.primary { background: #1a6b8f; color: #fff; border: none; border-radius: 6px; padding: 0.45rem 1rem; cursor: pointer; }
button.primary:hover { background: #15597a; }
.task-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; align-items: center; }
.task-actions button:not(.primary):not(.linklike):not(.icon-btn), .entry-form button:not(.primary), .stack-form button:not(.primary), form > button:not(.primary) {
  background: #f2f5f7; border: 1px solid #dbe2e8; border-radius: 6px; cursor: pointer; font-size: 0.85rem; padding: 0.35rem 0.7rem; color: #33465a; }
.icon-btn { background: none; border: none; color: #a5b2bd; cursor: pointer; font-size: 1.1rem; }
.icon-btn:hover { color: #a33; }

.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e3e8ed; border-radius: 10px; overflow: hidden; margin-bottom: 1rem; }
.table th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: #7b8a97; padding: 0.55rem 0.7rem; border-bottom: 1px solid #e3e8ed; }
.table td { padding: 0.45rem 0.7rem; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.table tr.unread td { background: #fbfcfe; font-weight: 600; }
.table tr.unread td .muted { font-weight: 400; }
.scroll-x { overflow-x: auto; }
.filter-row { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; margin: 0 0 0.8rem; }
.filter-row a { display: inline-block; padding: 0.25rem 0.8rem; border-radius: 999px; background: #fff; border: 1px solid #e3e8ed; font-size: 0.85rem; }
.filter-row a.active { background: #1a6b8f; color: #fff; border-color: #1a6b8f; }

.step { border: 1px solid #e3e8ed; border-radius: 10px; padding: 0.7rem 0.9rem; margin: 0 0 0.7rem; display: flex; flex-direction: column; gap: 0.4rem; }
.step-head { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; font-size: 0.85rem; }
.step input, .step textarea { padding: 0.4rem 0.55rem; border: 1px solid #ccd5dd; border-radius: 6px; font: inherit; width: 100%; }
.preview { border-left: 3px solid #cfd8df; padding: 0.3rem 0.8rem; margin: 0 0 0.8rem; }
.thread { display: flex; flex-direction: column; gap: 0.6rem; margin: 0 0 1rem; }
.msg { background: #fff; border: 1px solid #e3e8ed; border-radius: 10px; padding: 0.7rem 0.9rem; }
.msg.out { border-left: 4px solid #1a6b8f; }
.msg.in { border-left: 4px solid #1e6b3a; }
.mailbox { border-top: 1px solid #eef1f4; padding: 0.6rem 0; }

.bars { display: flex; gap: 6px; align-items: flex-end; height: 90px; }
.bar-col { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; height: 100%; gap: 2px; }
.bar { width: 100%; border-radius: 3px 3px 0 0; min-height: 1px; }
.bar.sent { background: #1a6b8f; }
.bar.reply { background: #1e6b3a; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; vertical-align: middle; }
.swatch.sent { background: #1a6b8f; }
.swatch.reply { background: #1e6b3a; }
.spark { display: flex; gap: 3px; align-items: flex-end; height: 44px; margin-top: 0.4rem; }
.spark-bar { width: 12px; border-radius: 2px 2px 0 0; background: #cfd8df; }
.spark-bar.ok { background: #1e6b3a; }
.spark-bar.warn { background: #c78a1a; }
.spark-bar.bad { background: #93312d; }

.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: #1b2833; }
.login-box { background: #fff; border-radius: 12px; padding: 2rem 2.2rem; width: 340px; display: flex; flex-direction: column; gap: 0.8rem; }
.login-box.wide { width: 420px; }
.login-box h1 { margin: 0 0 0.4rem; font-size: 1.2rem; text-align: center; }
.login-box input { padding: 0.55rem 0.7rem; border: 1px solid #ccd5dd; border-radius: 8px; font-size: 1rem; }
.login-box input:focus { outline: 2px solid #1a6b8f; outline-offset: 1px; border-color: #1a6b8f; }
.error-box { background: #fdeaea; border: 1px solid #f2c4c4; color: #93312d; border-radius: 8px; padding: 0.5rem 0.9rem; }

@media (max-width: 900px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .two-col, .grid2 { grid-template-columns: 1fr; }
  main { padding: 1rem 0.8rem; }
}

.doc { max-width: 780px; }
.doc h1 { font-size: 1.5rem; margin: 0 0 0.3rem; }
.doc h2 { font-size: 1.15rem; margin: 1.8rem 0 0.5rem; padding-top: 0.6rem; border-top: 1px solid #e3e8ed; }
.doc h3 { font-size: 1rem; margin: 1.2rem 0 0.4rem; }
.doc p, .doc li { line-height: 1.6; }
.doc table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e3e8ed; border-radius: 10px; margin: 0.6rem 0 1rem; font-size: 0.9rem; }
.doc th { text-align: left; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: #7b8a97; padding: 0.5rem 0.7rem; border-bottom: 1px solid #e3e8ed; }
.doc td { padding: 0.45rem 0.7rem; border-bottom: 1px solid #eef1f4; vertical-align: top; }
.doc hr { border: none; border-top: 1px solid #e3e8ed; margin: 1.5rem 0; }
.doc em:first-child { color: #62717e; }
