:root {
  --ink: #1a1814;
  --muted: #6d655c;
  --paper: #f3ecdf;
  --paper-glow: rgba(245, 196, 0, 0.35);
  --card: #fffdf8;
  --line: #e4d8c4;
  --black: #12110e;
  --strong: #12110e;
  --on-strong: #ffffff;
  --on-accent: #12110e;
  --yellow: #f5c400;
  --red: #c62828;
  --green: #1b7f4a;
  --blue: #1d4e89;
  --top: #12110e;
  --top-ink: #ffffff;
  --top-muted: #c8c2b6;
  --tab-bg: #12110e;
  --tab-ink: #b9b3a6;
  --tab-on: #f5c400;
  --field: #ffffff;
  --field-soft: #f6f1e6;
  --thread: #f6f0e4;
  --tint: #fff4cc;
  --meter: #12110e;
  --meter-ink: #ffffff;
  --meter-muted: #b9b3a6;
  --meter-2: #9ec1ff;
  --meter-3: #f5c400;
  --mention: #9a6b00;
  --shadow: 0 10px 30px rgba(18, 17, 14, 0.08);
  --radius: 18px;
  --chrome: 132px;
  --font: "Segoe UI", "Avenir Next", "Trebuchet MS", sans-serif;
  font-family: var(--font);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1200px 400px at 10% -10%, var(--paper-glow), transparent 50%),
    var(--paper);
  color: var(--ink);
  min-height: 100vh;
}
body.bare { display: grid; place-items: center; min-height: 100vh; padding: 24px; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.auth-card, .wrap { width: min(880px, 100%); }
.auth-card {
  background: var(--card);
  border-radius: 28px;
  padding: 28px 22px 32px;
  box-shadow: var(--shadow);
}
.wrap { margin: 0 auto; padding: 18px 16px 108px; }

.brand { display: flex; gap: 10px; align-items: center; text-decoration: none; color: inherit; }
.brand-mark {
  background: var(--strong);
  color: var(--yellow);
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 6px 10px 5px;
  border-radius: 10px;
}
h1 { font-size: 1.7rem; line-height: 1.1; margin: 0 0 8px; }
h2 { font-size: 1.15rem; margin: 22px 0 10px; }
.lead { color: var(--muted); margin-top: 0; }
.fine, .kicker { color: var(--muted); font-size: 0.92rem; }
.kicker { text-transform: uppercase; letter-spacing: 0.06em; font-size: 0.75rem; margin-bottom: 4px; }
.note {
  background: var(--tint);
  border-radius: 12px;
  padding: 10px 12px;
}

.top {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--top);
  color: var(--top-ink);
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 5;
}
.top .who { display: flex; flex-direction: column; min-width: 0; }
.top .who b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .who span, .rail-user span { color: var(--top-muted); font-size: 0.8rem; }
.logout { margin-left: auto; }
.linkish, .inline button {
  background: none;
  border: 0;
  color: var(--tab-on);
  padding: 0;
  cursor: pointer;
}
.wrap .linkish, .inline button { color: var(--blue); }

.panel, .tickets li {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin: 12px 0;
}
.stack { display: grid; gap: 12px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-between { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.field { display: grid; gap: 6px; font-size: 0.92rem; }
.field span { color: var(--muted); }
input, select, textarea {
  width: 100%;
  background: var(--field);
  border: 1.5px solid var(--line);
  border-radius: 12px;
  padding: 12px 12px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--yellow); }
input::placeholder, textarea::placeholder { color: var(--muted); }
.check { display: flex; gap: 8px; align-items: center; }
.check input { width: auto; }

.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  background: var(--yellow);
  color: var(--on-accent);
  border: 0;
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }
.btn.danger { background: var(--red); color: white; }
.btn.slim { padding: 10px 12px; border-radius: 12px; }
.btn { scroll-margin-bottom: 96px; }

.bot-box { margin-top: 4px; }
.topic-row { display: grid; grid-template-columns: 1.1fr 1fr; gap: 8px; align-items: center; margin-top: 8px; }
.crew { display: grid; gap: 10px; }
.crew-card { display: grid; grid-template-columns: 72px 1fr; gap: 12px; align-items: start; }
.crew-card img, .crew-card .ph { width: 72px; height: 72px; border-radius: 14px; object-fit: cover; background: var(--line); display: block; }
.metrics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.metrics span { background: var(--tint); border-radius: 999px; padding: 4px 8px; font-size: 0.85rem; }

.meters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.meters div {
  background: var(--meter);
  color: var(--meter-ink);
  border-radius: 16px;
  padding: 12px 10px;
}
.meters span { display: block; color: var(--meter-muted); font-size: 0.75rem; }
.meters b { display: block; font-size: 1.35rem; letter-spacing: -0.04em; margin-top: 4px; }
.meters div:nth-child(2) b { color: var(--meter-2); }
.meters div:nth-child(3) b { color: var(--meter-3); }
.sum { font-size: 1.6rem; letter-spacing: -0.04em; }

.wx {
  display: grid;
  grid-template-columns: minmax(168px, 46%) 1fr;
  gap: 16px;
  align-items: stretch;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0 0 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.wx-read { padding: 8px 8px 8px 4px; min-width: 0; }
.wx-temp { display: block; font-size: 3rem; letter-spacing: -0.06em; line-height: 0.9; }
.wx-text, .wx-place { display: block; }
.wx-text { margin-top: 6px; font-size: 1.05rem; text-transform: capitalize; }
.wx-place { color: var(--muted); font-size: 0.82rem; margin-top: 8px; }
.wx-stats {
  display: flex; gap: 14px; list-style: none; margin: 12px 0 0; padding: 0;
}
.wx-stats li { display: grid; gap: 2px; }
.wx-stats span { color: var(--muted); font-size: 0.72rem; }
.wx-stats b { font-size: 0.95rem; font-weight: 700; }
.wx-scene {
  position: relative;
  min-height: 168px;
  border-radius: 16px;
  overflow: hidden;
  background: linear-gradient(#7fa6c9, #d5e4f0 70%, #eef3f7);
}
.wx[data-kind="clear"] .wx-scene { background: linear-gradient(#4aa3e8, #ffd36a 78%); }
.wx[data-kind="fog"] .wx-scene { background: linear-gradient(#b7c3cc, #e7ecef); }
.wx[data-kind="rain"] .wx-scene { background: linear-gradient(#3d4c5c, #8ea0b0 80%); }
.wx[data-kind="snow"] .wx-scene { background: linear-gradient(#8eacc4, #f4f8fb); }
.wx[data-kind="storm"] .wx-scene { background: linear-gradient(#1b1833, #4c4a68); }
.wx[data-night="1"] .wx-scene { filter: saturate(0.7) brightness(0.62); }
.wx-sun, .wx-rays, .wx-cloud, .wx-drops, .wx-flakes, .wx-bolt { position: absolute; opacity: 0; pointer-events: none; }
.wx-sun {
  width: 42px; height: 42px; border-radius: 50%;
  background: #ffe566; top: 22px; right: 22px;
  box-shadow: 0 0 24px 8px rgba(255, 214, 80, 0.55);
}
.wx-rays {
  width: 90px; height: 90px; border-radius: 50%;
  top: 0; right: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255,230,120,.0) 0 12deg, rgba(255,230,120,.45) 12deg 16deg);
  mask: radial-gradient(circle, transparent 28px, #000 30px);
}
.wx-cloud {
  height: 22px; border-radius: 22px; background: #fff;
  box-shadow: 18px -12px 0 -2px #fff, -16px -8px 0 -3px #fff;
}
.wx-cloud.c1 { width: 64px; top: 36px; }
.wx-cloud.c2 { width: 86px; top: 78px; }
.wx-cloud.c3 { width: 48px; top: 18px; }
.wx-drops, .wx-flakes { inset: 0; }
.wx-drops i, .wx-flakes i { position: absolute; top: -16px; }
.wx-drops i {
  width: 2px; height: 16px; border-radius: 2px;
  background: linear-gradient(transparent, rgba(255,255,255,.95));
}
.wx-flakes i {
  width: 6px; height: 6px; border-radius: 50%; background: #fff;
  box-shadow: 0 0 4px rgba(255,255,255,.8);
}
.wx-bolt {
  left: 46%; top: 18px; width: 8px; height: 36px;
  background: #f4f1c8; clip-path: polygon(40% 0, 100% 0, 55% 46%, 100% 46%, 20% 100%, 48% 54%, 10% 54%);
  filter: drop-shadow(0 0 8px #fff3a0);
}
.wx[data-kind="clear"] .wx-sun,
.wx[data-kind="clear"] .wx-rays,
.wx[data-kind="cloud"] .wx-cloud,
.wx[data-kind="cloud"] .wx-sun,
.wx[data-kind="fog"] .wx-cloud,
.wx[data-kind="rain"] .wx-cloud,
.wx[data-kind="rain"] .wx-drops,
.wx[data-kind="snow"] .wx-cloud,
.wx[data-kind="snow"] .wx-flakes,
.wx[data-kind="storm"] .wx-cloud,
.wx[data-kind="storm"] .wx-drops,
.wx[data-kind="storm"] .wx-bolt { opacity: 1; }
.wx.is-wait .wx-text { color: var(--muted); }

@media (max-width: 520px) {
  .wx { grid-template-columns: 1fr; }
  .wx-scene { min-height: 132px; }
  .wx-temp { font-size: 2.6rem; }
}

@media (prefers-reduced-motion: no-preference) {
  body, .panel, .top, .rail, .tabbar, .btn, .auth-card, .chat-layout, .bubble, .meters div, .wx, .sheet, .skin, input, select, textarea {
    transition: background-color .4s ease, color .3s ease, border-color .4s ease, box-shadow .4s ease;
  }
  .wx { animation: wx-in .5s ease both; }
  .wx-sun { animation: wx-glow 4.5s ease-in-out infinite; }
  .wx-rays { animation: wx-spin 28s linear infinite; }
  .wx-cloud.c1 { animation: wx-pass 15s linear infinite; }
  .wx-cloud.c2 { animation: wx-pass 22s linear infinite; animation-delay: -8s; }
  .wx-cloud.c3 { animation: wx-pass 28s linear infinite; animation-delay: -16s; }
  .wx-drops i { animation: wx-fall 0.95s linear infinite; }
  .wx-flakes i { animation: wx-snow 3.2s linear infinite; }
  .wx-bolt { animation: wx-flash 2.8s steps(1) infinite; }
}
.wx-drops i:nth-child(3n) { left: 8%; }
.wx-drops i:nth-child(3n+1) { left: 28%; }
.wx-drops i:nth-child(3n+2) { left: 52%; }
.wx-drops i:nth-child(4n) { left: 74%; }
.wx-drops i:nth-child(5n) { left: 90%; }
.wx-flakes i:nth-child(4n) { left: 12%; }
.wx-flakes i:nth-child(4n+1) { left: 36%; }
.wx-flakes i:nth-child(4n+2) { left: 58%; }
.wx-flakes i:nth-child(4n+3) { left: 80%; }
.wx-drops i:nth-child(2), .wx-flakes i:nth-child(2) { animation-delay: .15s; }
.wx-drops i:nth-child(3), .wx-flakes i:nth-child(3) { animation-delay: .3s; }
.wx-drops i:nth-child(4), .wx-flakes i:nth-child(4) { animation-delay: .45s; }
.wx-drops i:nth-child(5), .wx-flakes i:nth-child(5) { animation-delay: .6s; }
.wx-drops i:nth-child(6), .wx-flakes i:nth-child(6) { animation-delay: .75s; }
.wx-drops i:nth-child(7), .wx-flakes i:nth-child(7) { animation-delay: .9s; }
.wx-drops i:nth-child(8), .wx-flakes i:nth-child(8) { animation-delay: 1.05s; }
.wx-drops i:nth-child(9), .wx-flakes i:nth-child(9) { animation-delay: .2s; }
.wx-drops i:nth-child(10), .wx-flakes i:nth-child(10) { animation-delay: .5s; }
.wx-drops i:nth-child(11), .wx-flakes i:nth-child(11) { animation-delay: .8s; }
.wx-drops i:nth-child(12), .wx-flakes i:nth-child(12) { animation-delay: 1.1s; }
@keyframes wx-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes wx-spin { to { transform: rotate(360deg); } }
@keyframes wx-glow { 50% { transform: scale(1.08); box-shadow: 0 0 32px 12px rgba(255, 214, 80, 0.7); } }
@keyframes wx-pass { from { transform: translateX(-120%); } to { transform: translateX(280%); } }
@keyframes wx-fall { to { transform: translateY(190px); opacity: 0; } }
@keyframes wx-snow { to { transform: translateY(190px) translateX(16px); opacity: 0.2; } }
@keyframes wx-flash { 0%, 86%, 100% { opacity: 0; } 88%, 92% { opacity: 1; } }

.install-offer {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 30;
  background: var(--strong);
  color: var(--on-strong);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
}
body.bare .install-offer { bottom: calc(16px + env(safe-area-inset-bottom)); }
.install-offer p { margin: 0 0 12px; line-height: 1.35; }
.install-actions { display: flex; gap: 8px; }
.install-actions .btn { flex: 1; }
.install-later { background: transparent; color: var(--on-strong); border: 1.5px solid color-mix(in srgb, var(--on-strong) 40%, transparent); }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.filters a, .filters button.slim {
  border-radius: 999px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--line);
  text-decoration: none;
  color: var(--ink);
}
.filters a.on { background: var(--strong); color: var(--tab-on); border-color: var(--strong); }
.filters input, .filters select { width: auto; padding: 8px 10px; }

.tickets { list-style: none; padding: 0; margin: 0; }
.tickets li div { display: flex; justify-content: space-between; gap: 8px; }
.tickets li p { margin: 6px 0; }
.tickets a { margin-right: 12px; }
.people { list-style: none; padding: 0; }
.people li { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.selfie, .avatar { width: 96px; height: 96px; object-fit: cover; border-radius: 16px; }
.report { margin-top: 8px; }

.flash { border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.flash.ok { background: #e5f6ec; color: var(--green); }
.flash.err { background: #fde8e6; color: var(--red); }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 16px; overflow: hidden; display: block; }
table tr { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table th { text-align: left; color: var(--muted); font-weight: 600; font-size: 0.8rem; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal span {
  min-height: 64px;
  background: var(--card);
  border-radius: 12px;
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.cal .dow { min-height: 0; background: transparent; color: var(--muted); font-size: 0.75rem; }
.cal .hit { background: var(--strong); color: var(--on-strong); }
.cal small { font-size: 0.68rem; color: var(--meter-muted); }

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--tab-bg);
  padding: 8px 6px calc(8px + env(safe-area-inset-bottom));
  z-index: 6;
}
.tab {
  color: var(--tab-ink);
  text-decoration: none;
  text-align: center;
  font-size: 0.78rem;
  padding: 8px 0;
}
.tab.on { color: var(--tab-on); }
.more-toggle { position: absolute; opacity: 0; pointer-events: none; }
.sheet, .sheet-bg { display: none; }
.more-toggle:checked ~ .sheet,
.more-toggle:checked ~ .sheet-bg { display: block; }
.sheet-bg { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 7; }
.sheet {
  position: fixed;
  left: 12px; right: 12px; bottom: 74px;
  background: var(--card);
  border-radius: 20px;
  padding: 8px;
  z-index: 8;
  box-shadow: var(--shadow);
}
.sheet a, .sheet-title { display: block; padding: 12px; text-decoration: none; color: var(--ink); }
.sheet a + a { border-top: 1px solid var(--line); }
.sheet-title { margin: 0; color: var(--muted); }

.tab { position: relative; }
.tab-badge {
  display: inline-block;
  min-width: 1.1rem;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--on-accent);
  font-size: 0.68rem;
  line-height: 1.3;
}
.gear-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px 6px;
  margin: 0 0 12px;
}
.gear-box .gear-title {
  display: block;
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
}
.gear-list { max-height: 240px; overflow: auto; }
.gear-box label.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 10px 2px;
  border-top: 1px solid var(--line);
}
.gear-box label.check input[type="checkbox"] {
  width: 20px;
  min-width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 1px 0 0;
  padding: 0;
}
.gear-box label.check span {
  flex: 1;
  min-width: 0;
  color: var(--ink);
  line-height: 1.35;
}

.brand-logo { height: 52px; width: auto; display: block; border-radius: 6px; }
.my-gear {
  background: var(--tint);
  border-radius: 14px;
  padding: 10px 12px;
  margin: 8px 0 12px;
}
.my-gear span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.my-gear p { margin: 4px 0 0; }
.end-shift { margin-top: 16px; }
.end-shift summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }

.chat-layout {
  display: grid;
  height: calc(100dvh - 132px);
  min-height: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.chat-side, .chat-main { min-height: 0; display: flex; flex-direction: column; }
.chat-side { border-right: 1px solid var(--line); }
.chat-side-head { display: flex; gap: 6px; align-items: center; padding: 8px; }
.chat-side-head form { flex: 1; }
.chat-side-foot { display: flex; gap: 4px; align-items: center; padding: 8px; border-top: 1px solid var(--line); }
.chat-side-foot select { width: auto; flex: 1; padding: 8px; }
#chat-rooms, #thread { overflow: auto; flex: 1; }
#chat-new-box { padding: 0 8px 8px; }
.chat-row, .chat-person button {
  display: block;
  width: 100%;
  text-align: left;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
}
.chat-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.chat-head-title { flex: 1; min-width: 0; }
.chat-head-title b, .chat-head-title span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-title span { color: var(--muted); font-size: 0.78rem; }
.chat-letter, .chat-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: 0 0 36px; object-fit: cover;
}
.chat-letter {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--strong); color: var(--on-strong); font-weight: 700;
}
.chat-empty { margin: auto; color: var(--muted); }
#thread { padding: 8px 12px; background: var(--thread); }
#chat-people { max-height: 42%; overflow: auto; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--card); }
.chat-member { display: flex; justify-content: space-between; gap: 8px; padding: 6px 0; }
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 10px;
  background: transparent; color: inherit; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem; text-decoration: none; flex: 0 0 auto; padding: 0;
}
.icon-btn.send { background: var(--yellow); color: var(--on-accent); border-radius: 50%; font-weight: 800; }
.composer {
  display: flex; align-items: flex-end; gap: 6px;
  padding: 8px; border-top: 1px solid var(--line); background: var(--card);
}
.composer textarea {
  flex: 1; border: 0; resize: none; max-height: 120px;
  padding: 10px 12px; background: var(--field-soft); border-radius: 18px; width: auto;
}
.composer input[type="file"] {
  position: absolute; width: 1px; height: 1px; opacity: 0; padding: 0;
}
#emoji-box { border-top: 1px solid var(--line); background: var(--card); padding: 8px; }
.emoji-grid, .sticker-grid {
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px;
  max-height: 190px; overflow: auto;
}
.emoji-grid button, .sticker-grid button {
  border: 0; background: transparent; cursor: pointer; font-size: 1.35rem; padding: 4px;
}
.sticker-grid { grid-template-columns: repeat(6, 1fr); }
.sticker-grid button { font-size: 2rem; }
#people-grid { display: flex; flex-wrap: wrap; gap: 6px; max-height: 160px; overflow: auto; }
.bubble.sticker { background: transparent; box-shadow: none; }
.sticker-face { font-size: 4rem; line-height: 1; }
.chat-back { display: none; }
.bubble-tools { opacity: 0; }
.bubble:hover .bubble-tools, .bubble:focus-within .bubble-tools { opacity: 1; }

@media (min-width: 860px) {
  .chat-layout { grid-template-columns: 300px 1fr; }
}
@media (max-width: 859px) {
  .chat-layout.has-room .chat-side { display: none; }
  .chat-layout:not(.has-room) .chat-main { display: none; }
  .chat-back { display: inline-flex; }
  .chat-layout { height: calc(100dvh - 118px); border-radius: 0; }
}
@media (hover: none) {
  .bubble-tools { opacity: 1; }
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: inherit;
  border-radius: 999px;
  padding: 6px 10px;
  text-decoration: none;
  font: inherit;
}
.chip.on { background: var(--strong); color: var(--on-strong); }
.bubble {
  background: var(--card);
  border-radius: 16px;
  padding: 10px 12px;
  margin: 8px 0;
}
.bubble.mine { background: var(--strong); color: var(--on-strong); }
.bubble.mine .fine, .bubble.mine time { color: var(--meter-muted); }
.bubble blockquote {
  margin: 6px 0;
  padding-left: 8px;
  border-left: 3px solid var(--yellow);
}
.bubble mark { background: var(--yellow); color: var(--on-accent); border-radius: 4px; padding: 0 2px; }
.chat-preview { display: block; max-width: 100%; border-radius: 12px; margin-top: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: #2f9e44; }
.dot.away { background: #f5c400; }
.dot.dnd { background: #d94848; }
.dot.offline { background: #b9b3a6; }
.mention-mark { color: var(--mention); margin-right: 4px; }
.reacts span { margin-right: 8px; }
.bubble-tools { display: flex; flex-wrap: wrap; gap: 8px; }

details summary { cursor: pointer; margin: 8px 0; }
.inline { display: inline; }

@media (max-width: 640px) {
  table tr { grid-template-columns: 1fr 1fr; }
  .meters b { font-size: 1.15rem; }
  .topic-row { grid-template-columns: 1fr; }
}

.rail { display: none; }
.skins { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.skin {
  position: relative;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  cursor: pointer;
}
.skin input { position: absolute; opacity: 0; pointer-events: none; }
.skin i { display: block; height: 42px; border-radius: 10px; }
.skin b { font-size: 0.92rem; }
.skin:has(input:checked) { outline: 2px solid var(--yellow); outline-offset: 2px; }
.skin[data-skin="yellow"] i { background: linear-gradient(145deg, #f3ecdf 40%, #f5c400); }
.skin[data-skin="street"] i { background: linear-gradient(180deg, #111 55%, #f5c400); }
.skin[data-skin="ink"] i { background: linear-gradient(145deg, #fff, #1c1917); }
.skin[data-skin="sand"] i { background: linear-gradient(145deg, #f6f1e8, #c46b3a); }
.skin[data-skin="cyber"] i { background: linear-gradient(135deg, #07060f, #3dfff3 55%, #ff2d95); }

html[data-theme="street"],
html[data-theme="cyber"] { color-scheme: dark; }

html[data-theme="street"] {
  --ink: #f4f1ea;
  --muted: #a39e94;
  --paper: #090909;
  --paper-glow: rgba(245, 196, 0, 0.22);
  --card: #141414;
  --line: rgba(255, 255, 255, 0.12);
  --strong: #050505;
  --on-strong: #f4f1ea;
  --on-accent: #111111;
  --yellow: #f5c400;
  --blue: #f5c400;
  --top: #050505;
  --top-ink: #f4f1ea;
  --top-muted: #a39e94;
  --tab-bg: #050505;
  --tab-ink: #a39e94;
  --tab-on: #f5c400;
  --field: #101010;
  --field-soft: #1b1b1b;
  --thread: #101010;
  --tint: #2a2308;
  --meter: #000000;
  --meter-ink: #f4f1ea;
  --meter-muted: #a39e94;
  --meter-2: #f5c400;
  --meter-3: #ffffff;
  --mention: #f5c400;
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  --radius: 10px;
}
html[data-theme="street"] .panel,
html[data-theme="street"] .auth-card,
html[data-theme="street"] .chat-layout { border: 1px solid rgba(245, 196, 0, 0.28); }
html[data-theme="street"] .kicker { letter-spacing: 0.14em; }
html[data-theme="street"] .brand-logo {
  height: 48px;
  padding: 3px;
  background: #070707;
  border-radius: 3px;
  box-shadow: 0 0 0 1px #f5c400, 0 8px 18px rgba(0, 0, 0, 0.35);
}

html[data-theme="ink"] {
  --ink: #1c1917;
  --muted: #78716c;
  --paper: #fafaf9;
  --paper-glow: transparent;
  --card: #ffffff;
  --line: #e7e5e4;
  --strong: #1c1917;
  --on-strong: #fafaf9;
  --on-accent: #fafaf9;
  --yellow: #1c1917;
  --blue: #1d4ed8;
  --green: #166534;
  --top: #ffffff;
  --top-ink: #1c1917;
  --top-muted: #78716c;
  --tab-bg: #ffffff;
  --tab-ink: #78716c;
  --tab-on: #1c1917;
  --field: #ffffff;
  --field-soft: #f5f5f4;
  --thread: #f5f5f4;
  --tint: #f5f5f4;
  --meter: #1c1917;
  --meter-ink: #fafaf9;
  --meter-muted: #d6d3d1;
  --meter-2: #d6d3d1;
  --meter-3: #ffffff;
  --mention: #1d4ed8;
  --shadow: 0 1px 2px rgba(28, 25, 23, 0.06);
  --radius: 12px;
}
html[data-theme="ink"] .top,
html[data-theme="ink"] .rail { border-bottom: 1px solid var(--line); }
html[data-theme="ink"] .tabbar { border-top: 1px solid var(--line); }

html[data-theme="sand"] {
  --ink: #3f2e22;
  --muted: #8a7362;
  --paper: #f6f1e8;
  --paper-glow: rgba(196, 107, 58, 0.22);
  --card: #fffaf3;
  --line: #e6d9c8;
  --strong: #3f2e22;
  --on-strong: #fffaf3;
  --on-accent: #fffaf3;
  --yellow: #c46b3a;
  --blue: #9a4e28;
  --green: #3f6b4a;
  --top: #3f2e22;
  --top-ink: #fffaf3;
  --top-muted: #e6d3c4;
  --tab-bg: #3f2e22;
  --tab-ink: #e6d3c4;
  --tab-on: #f0c2a4;
  --field: #fffaf3;
  --field-soft: #f3e6d6;
  --thread: #f3e6d6;
  --tint: #f3e4d4;
  --meter: #3f2e22;
  --meter-ink: #fffaf3;
  --meter-muted: #e6d3c4;
  --meter-2: #f0c2a4;
  --meter-3: #ffffff;
  --mention: #9a4e28;
  --shadow: 0 12px 28px rgba(63, 46, 34, 0.08);
  --radius: 22px;
}

html[data-theme="cyber"] {
  --ink: #e7fff8;
  --muted: #8ea0ff;
  --paper: #07060f;
  --paper-glow: rgba(61, 255, 243, 0.18);
  --card: #101226;
  --line: #2a315c;
  --strong: #05040c;
  --on-strong: #e7fff8;
  --on-accent: #07060f;
  --yellow: #e8ff47;
  --red: #ff2d95;
  --green: #3dfff3;
  --blue: #3dfff3;
  --top: #07060f;
  --top-ink: #e7fff8;
  --top-muted: #8ea0ff;
  --tab-bg: #07060f;
  --tab-ink: #8ea0ff;
  --tab-on: #3dfff3;
  --field: #0c1022;
  --field-soft: #141833;
  --thread: #0a0c18;
  --tint: rgba(61, 255, 243, 0.12);
  --meter: #05040c;
  --meter-ink: #e7fff8;
  --meter-muted: #8ea0ff;
  --meter-2: #3dfff3;
  --meter-3: #e8ff47;
  --mention: #ff2d95;
  --shadow: 0 0 0 1px rgba(61, 255, 243, 0.2), 0 16px 40px rgba(255, 45, 149, 0.12);
  --radius: 6px;
}
html[data-theme="cyber"] .panel,
html[data-theme="cyber"] .auth-card,
html[data-theme="cyber"] .chat-layout {
  border: 1px solid rgba(61, 255, 243, 0.35);
}
html[data-theme="cyber"] .btn,
html[data-theme="cyber"] .icon-btn.send {
  box-shadow: 0 0 16px rgba(232, 255, 71, 0.35);
}
html[data-theme="cyber"] .top,
html[data-theme="cyber"] .tabbar { box-shadow: inset 0 -1px 0 #3dfff3; }
html[data-theme="cyber"] .rail { box-shadow: inset -1px 0 0 #3dfff3; }
html[data-theme="cyber"] .brand-logo { box-shadow: 0 0 0 1px #3dfff3; }
html[data-theme="cyber"] .kicker,
html[data-theme="cyber"] .tab { letter-spacing: 0.08em; text-transform: uppercase; }

html[data-theme="street"] .flash.ok,
html[data-theme="cyber"] .flash.ok { background: rgba(61, 255, 180, 0.12); color: #b6ffd9; }
html[data-theme="street"] .flash.err,
html[data-theme="cyber"] .flash.err { background: rgba(255, 45, 80, 0.14); color: #ffb4c0; }

@media (max-width: 719px) {
  .wrap { padding: 12px 12px calc(96px + env(safe-area-inset-bottom)); }
  .top { padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
  .brand-logo { height: 44px; }
  html[data-theme="street"] .top .brand-logo { height: 46px; }
  .skins { grid-template-columns: 1fr 1fr; }
  .emoji-grid { grid-template-columns: repeat(7, 1fr); }
  .icon-btn { width: 44px; height: 44px; }
  .panel, .tickets li { padding: 14px; }
  .stack { gap: 10px; }
  h1 { font-size: 1.45rem; }
  .stack > .btn { width: 100%; min-height: 48px; }
  .tab { min-height: 44px; display: flex; align-items: center; justify-content: center; gap: 4px; }
  .crew-card { grid-template-columns: 56px 1fr; gap: 10px; }
  .crew-card img, .crew-card .ph { width: 56px; height: 56px; }
  .sheet {
    left: 8px;
    right: 8px;
    bottom: calc(70px + env(safe-area-inset-bottom));
    max-height: min(70dvh, 480px);
    overflow: auto;
  }
}

@media (max-width: 420px) {
  .split { grid-template-columns: 1fr; }
  .meters { gap: 6px; }
}

@media (min-width: 720px) and (max-width: 1099px) {
  .wrap { width: min(920px, 100%); padding: 24px 24px 120px; }
  .panel, .tickets li { padding: 20px; }
  .stack { gap: 14px; }
  .meters { gap: 12px; }
  .top { padding: 14px 24px; }
  .auth-card { width: min(460px, 100%); padding: 36px 32px 40px; }
  h1 { font-size: 2rem; }
}

@media (min-width: 1100px) {
  :root { --chrome: 48px; }
  .top, .tabbar, .sheet, .sheet-bg, .more-toggle { display: none !important; }
  .rail {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0 auto 0 0;
    width: 248px;
    padding: 20px 14px 16px;
    background: var(--top);
    color: var(--top-ink);
    z-index: 5;
    border-right: 1px solid transparent;
  }
  html[data-theme="ink"] .rail { border-right-color: var(--line); }
  .rail .brand { margin-bottom: 18px; }
  .rail nav { display: grid; gap: 4px; overflow: auto; padding-right: 2px; }
  .rail nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--top-muted);
    text-decoration: none;
    border-radius: 12px;
    padding: 10px 12px;
  }
  .rail nav a:hover { background: color-mix(in srgb, var(--top-ink) 10%, transparent); }
  .rail nav a.on, .rail nav a.on:hover { background: var(--yellow); color: var(--on-accent); }
  html[data-theme="street"] .rail .brand-logo { height: 84px; }
  .rail-user { margin-top: auto; display: flex; flex-direction: column; padding: 12px 4px 8px; }
  .rail-user b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .wrap {
    width: min(1120px, 100%);
    margin: 0 auto;
    padding: 28px 32px 40px;
  }
  body:not(.bare) { padding-left: 248px; }
  .install-offer { left: 268px; right: 24px; bottom: 16px; }
  .chat-layout { height: calc(100dvh - 56px); border-radius: 20px; }
  body.page-chat .wrap { width: auto; max-width: none; margin: 0; padding: 16px 20px; }
  body.page-chat .chat-layout { height: calc(100dvh - 32px); }
  table { display: table; }
  table tr { display: table-row; }
  table th, table td { display: table-cell; padding: 10px 12px; vertical-align: top; }
}

@media (max-width: 1099px) {
  body.page-chat .wrap {
    width: 100%;
    padding: 0 0 calc(62px + env(safe-area-inset-bottom));
  }
  body.page-chat .chat-layout {
    height: calc(100dvh - 120px - env(safe-area-inset-bottom));
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }
}

.meters b { overflow-wrap: anywhere; }
.sheet a { min-height: 44px; display: flex; align-items: center; }

.kanban {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  align-items: flex-start;
  padding: 4px 2px 28px;
}
.kanban-col {
  flex: 0 0 250px;
  background: var(--field-soft, var(--paper));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  min-height: 220px;
}
.kanban-col header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.kanban-col header span {
  color: var(--muted);
  font-size: 0.85rem;
}
.kanban-col.drop { outline: 2px solid var(--yellow); }
.hire-card {
  display: grid;
  gap: 4px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  margin-top: 8px;
  cursor: grab;
}
.hire-card b { font-size: 1rem; }
.hire-card a, .hire-card span, .hire-card small { font-size: 0.86rem; }
.hire-card small { color: var(--muted); }
.hire-card select { margin-top: 6px; padding: 8px 10px; }
.hire-card.dragging { opacity: 0.45; }
.muted { color: var(--muted); }

.meters.wide { grid-template-columns: repeat(auto-fit, minmax(108px, 1fr)); }
.plan-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.plan-card span { color: var(--muted); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; }
.plan-card b { display: block; font-size: 1.8rem; letter-spacing: -0.05em; margin: 2px 0 8px; }
.plan-card small, .meters small { display: block; margin-top: 4px; }
.plan-track { height: 8px; border-radius: 99px; background: var(--field-soft); overflow: hidden; }
.plan-track i { display: block; height: 100%; width: 0; background: var(--yellow); border-radius: 99px; }
.plan-track i.done { background: var(--green); }
.bars { display: grid; gap: 4px; margin-top: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(96px, 150px) 1fr auto; gap: 8px; align-items: center; }
.bar-row span { font-weight: 800; min-width: 3.2rem; text-align: right; }
.live-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.live-row .fine { display: block; }
.daybars { display: flex; gap: 6px; align-items: flex-end; overflow-x: auto; margin-top: 12px; }
.daybar { flex: 1 0 26px; text-align: center; }
.daybar-plot { height: 96px; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.daybar-plot i { display: block; width: 8px; border-radius: 4px 4px 0 0; }
.daybar-plot i.plan { background: var(--line); }
.daybar-plot i.fact { background: var(--yellow); }
.daybar span { display: block; margin-top: 4px; font-size: 0.72rem; color: var(--muted); }
@media (max-width: 640px) {
  .plan-pair { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr auto; }
  .bar-row .plan-track { grid-column: 1 / -1; }
}

.bi-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 8px 0 4px;
}
.bi-filter label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bi-filter input,
.bi-filter select { width: auto; min-width: 148px; padding: 8px 10px; }
.bi-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0;
}
.bi-kpi {
  background: var(--meter);
  color: var(--meter-ink);
  border-radius: 16px;
  padding: 12px;
  min-width: 0;
}
.bi-kpi span { display: block; color: var(--meter-muted); font-size: 0.75rem; }
.bi-kpi b {
  display: block;
  font-size: 1.35rem;
  letter-spacing: -0.04em;
  margin-top: 4px;
  overflow-wrap: anywhere;
}
.bi-delta { display: block; margin-top: 4px; font-size: 0.75rem; color: var(--muted); }
.bi-delta.up { color: var(--green); }
.bi-delta.down { color: var(--red); }
.bi-split {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 12px;
  align-items: start;
  margin: 12px 0;
}
.bi-split .panel { margin: 0; }
@media (max-width: 719px) {
  .bi-kpis { grid-template-columns: 1fr 1fr; }
  .bi-split { grid-template-columns: 1fr; }
  .bi-filter input,
  .bi-filter select,
  .bi-filter .btn { width: 100%; }
}


