:root {
  color-scheme: light;
  --paper: #f4f1ea;
  --card: #fff;
  --ink: #1e232d;
  --mute: #5c6b7a;
  --line: #e2e0d8;
  --sage: #5f8470;
  --slate: #2d3748;
  --delete: #a64b55;
  --side: 248px;
  font-family: "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h1 { line-height: 1.2; }
h2 { line-height: 1.35; }
h3 { line-height: 1.4; }
a { color: inherit; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.card, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
}
.login .card { width: min(26rem, 100%); padding: 28px; }
h1 { font-size: 1.55rem; letter-spacing: -0.02em; }
h2 { font-size: 1.05rem; }
h3 { font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--mute); }
.sub, .meta { color: var(--mute); font-size: 0.9rem; line-height: 1.45; }
.sub { margin-top: 8px; }
label { display: block; margin-top: 14px; font-size: 0.78rem; font-weight: 700; line-height: 1.35; }
input, select, textarea {
  width: 100%;
  margin-top: 6px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--card);
}
textarea { height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.file input { height: auto; padding: 10px; background: var(--paper); }
.primary, .dark, .danger, .plain {
  height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 700;
  line-height: 1;
}
.primary { background: var(--sage); color: white; }
.dark { background: var(--slate); color: white; }
.danger { background: transparent; color: var(--delete); border: 1px solid #e7c5c8; }
.plain { background: var(--card); border: 1px solid var(--line); }
.plain.on { border-color: var(--sage); background: #f3f7f4; }
.primary:disabled, .dark:disabled { opacity: 0.45; }
.full { width: 100%; margin-top: 18px; }
.bad { min-height: 1.2em; margin: 10px 0 0; color: var(--delete); font-size: 0.9rem; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.billing { margin: 14px 0 4px; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px 36px; }
.split > * { min-width: 0; }
.fields { margin-top: 8px; }
.fields h2 { margin-top: 28px; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-weight: 600; line-height: 1.35; }
.check input { width: auto; height: auto; margin: 0; }
.check .meta { font-weight: 500; margin: 0; }
.modules { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 28px; margin-top: 8px; }
.block { margin-top: 28px; }
.qr { display: block; width: 180px; height: 180px; margin-top: 16px; background: white; border-radius: 8px; }
.key { margin: 8px 0 0; white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: 0.95rem; line-height: 1.4; }

.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--ink);
  color: #f8f6f0;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { padding: 4px 10px 16px; }
.brand strong { display: block; font-size: 1rem; }
.brand span { display: block; margin-top: 2px; color: #a8b0ba; font-size: 0.78rem; }
.side nav { display: grid; gap: 4px; }
.side nav button, .side .ghost {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #f8f6f0;
  text-align: left;
  padding: 0 12px;
  font-weight: 650;
}
.side nav button.on { background: #2d3748; }
.side .push { margin-top: auto; display: grid; gap: 4px; }
.who { padding: 8px 12px 4px; color: #a8b0ba; font-size: 0.78rem; word-break: break-all; }
.main { padding: 36px 40px 80px; width: min(1180px, 100%); }
.head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; margin-bottom: 22px; }
.head p { margin-top: 4px; }
.notice, .secret {
  margin-bottom: 14px;
  border-radius: 10px;
  padding: 12px 14px;
}
.notice { background: var(--slate); color: white; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.notice .plain { color: white; border-color: #4a5568; background: transparent; }
.secret { background: #eef4ef; border: 1px solid #c9d9ce; }
.secret strong { display: block; margin-bottom: 6px; }
.secret pre { margin: 0; white-space: pre-wrap; font-family: ui-monospace, monospace; font-size: 0.92rem; }

.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.plan {
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 18px 16px;
  background: var(--card);
  min-width: 0;
  height: auto;
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1.4;
}
.plan.on { border-color: var(--sage); background: #f3f7f4; }
.plan b { display: block; font-size: 1.05rem; line-height: 1.25; }
.plan-price { display: block; margin-top: 8px; color: var(--ink); font-weight: 650; font-size: 0.88rem; line-height: 1.4; }
.plan-summary { display: block; margin-top: 6px; color: var(--mute); font-weight: 500; font-size: 0.86rem; line-height: 1.45; }
.plan-points {
  list-style: none;
  margin: 14px 0 0;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 7px;
}
.plan-points li {
  position: relative;
  padding-left: 16px;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--ink);
  font-weight: 500;
}
.plan-points li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5em;
  width: 6px;
  height: 6px;
  border-radius: 99px;
  background: var(--sage);
}
.includes { display: none; }
.steps { display: flex; gap: 8px; margin-bottom: 14px; }
.steps span { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.steps span.on { color: var(--ink); }

.tills { display: grid; gap: 14px; }
.till {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(16rem, 1fr) minmax(16rem, auto);
  gap: 20px;
  align-items: start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px;
}
.till h2 { font-size: 1.08rem; margin-bottom: 6px; }
.till .meta { margin-top: 4px; }
.link {
  height: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--sage);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}
#add-person { margin-top: 16px; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 12px; }
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 999px;
  padding: 6px 14px;
  background: #e8eee9;
  color: #1e232d;
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: 0;
}
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag {
  display: inline-flex;
  align-items: center;
  height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: var(--paper);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1;
}
.tag.ok { background: #e7f0ea; color: #2f5d45; }
.tag.lock { background: #f4ece4; color: #8a5a2a; }
.tag.bad { background: #f8e8ea; color: #8d3a44; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; max-width: 36rem; }
.actions a, .actions button { height: 36px; display: inline-flex; align-items: center; text-decoration: none; }
.lower { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; margin-top: 28px; }
.audit { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.audit.log { max-height: 24rem; overflow: auto; padding-right: 4px; }
.audit li { font-size: 0.88rem; color: var(--mute); line-height: 1.45; }
.audit span { color: var(--ink); }
.staff-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); font-size: 0.92rem; }
.staff-list { display: grid; gap: 12px; }
.staff-card { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.staff-card h2 { font-size: 1rem; letter-spacing: 0; text-transform: none; color: var(--ink); overflow-wrap: anywhere; }
.activity { display: grid; gap: 0; }
.activity-head, .activity-row {
  display: grid;
  grid-template-columns: 13rem minmax(10rem, 16rem) minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
  align-items: start;
}
.activity-head {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  border-bottom: 1px solid var(--line);
}
.activity-row {
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.activity-row:last-child { border-bottom: 0; }
.spread { justify-content: space-between; }
.health { margin-bottom: 16px; }
.health table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.health th, .health td { text-align: left; padding: 8px 12px 8px 0; vertical-align: top; font-size: 0.9rem; line-height: 1.4; }
.health th { font-size: 0.75rem; color: var(--mute); font-weight: 700; }
.tiny { height: 30px; padding: 0 10px; }

.notes { display: grid; gap: 6px; margin: 0 0 14px; }
.notes p { background: #f7f3ea; border-radius: 8px; padding: 8px 10px; font-size: 0.86rem; }
.grid-3 { display: grid; grid-template-columns: 0.7fr 1.4fr 0.9fr; gap: 12px; align-items: start; }
.sheet table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.sheet th { text-align: left; font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase; color: var(--mute); font-weight: 700; padding: 0 4px 6px; }
.sheet td { padding: 3px 4px; vertical-align: top; }
.sheet td input, .sheet td select { height: 36px; margin: 0; }
.x {
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--mute);
  font-size: 1.1rem;
}

.crm { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); gap: 24px; align-items: start; }
.account, .ticket {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  line-height: 1.45;
  min-width: 0;
}
.account-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.account-top h2, .ticket h2 {
  margin: 0;
  min-width: 0;
  flex: 1;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.account-top .tag { flex-shrink: 0; margin-top: 2px; }
.account.on { border-color: var(--sage); background: #f3f7f4; }
.account h2, .ticket h2 { margin-bottom: 0; }
.flag {
  margin-top: 4px;
  color: var(--delete);
  font-size: 0.82rem;
  font-weight: 650;
  line-height: 1.35;
}
.hostline { margin-top: 4px; }
.diff {
  margin: 22px 0 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  overflow: hidden;
}
.diff-banner {
  padding: 16px 18px 14px;
  background: #eef4ef;
  border-bottom: 1px solid var(--line);
}
.diff-banner strong { display: block; font-size: 0.98rem; line-height: 1.35; }
.diff-banner p { margin-top: 6px; color: var(--mute); font-size: 0.86rem; line-height: 1.45; }
.diff-table { width: 100%; border-collapse: collapse; }
.diff-table th, .diff-table td {
  text-align: left;
  padding: 12px 16px;
  vertical-align: top;
  line-height: 1.45;
  font-size: 0.92rem;
  border-top: 1px solid var(--line);
}
.diff-table thead th {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  background: var(--card);
  border-top: 0;
}
.diff-table tbody th { width: 28%; font-weight: 650; color: var(--ink); }
.diff-table tbody td { word-break: break-word; }
.diff-actions { padding: 16px 18px 18px; }
.tickets-head { margin: 28px 0 12px; }
.thread { display: grid; gap: 10px; margin: 16px 0; max-height: 28rem; overflow: auto; }
.bubble { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--paper); line-height: 1.5; }
.bubble.out { background: var(--card); }
.bubble.note { background: #f7f3ea; }
.stamp { margin: 4px 0; text-align: center; color: var(--mute); font-size: 0.82rem; font-weight: 700; line-height: 1.4; }
.stack { display: grid; gap: 14px; }
.ship-log {
  margin-top: 14px;
  max-height: 16rem;
  overflow: auto;
  background: #1e232d;
  color: #e8ece8;
  border-radius: 10px;
  padding: 12px 14px;
  font-family: ui-monospace, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.release-stack { display: grid; gap: 22px; }
.release-stack > .panel > h2 { margin-bottom: 16px; }
.ship { display: grid; gap: 18px; }
.ship-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.ship-when { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.02em; }
.ship-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ship-box, .ship-notes {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
}
.ship-box h3, .ship-notes h3 { margin-bottom: 14px; }
.ship-box ul, .ship-notes ol, ol.pending {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}
.ship-box li, .ship-notes li, ol.pending li {
  display: grid;
  grid-template-columns: 1.6rem minmax(0, 1fr);
  column-gap: 10px;
  align-items: start;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.ship-box li:first-child, .ship-notes li:first-child, ol.pending li:first-child { border-top: 0; padding-top: 0; }
.ship-box li strong { font-size: 0.92rem; }
.ship-box li span, .ship-notes li, ol.pending li { color: var(--ink); font-size: 0.95rem; }
.ship-notes ol { counter-reset: notes; }
.ship-notes li { counter-increment: notes; }
.ship-notes li::before, ol.pending li::before {
  content: counter(notes);
  color: var(--mute);
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1.5;
  padding-top: 2px;
}
ol.pending { counter-reset: pending; margin-top: 4px; }
ol.pending li { counter-increment: pending; }
ol.pending li::before { content: counter(pending); }

.pipe {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px minmax(0, 1fr) 28px minmax(0, 1fr);
  align-items: stretch;
  gap: 0;
  margin: 0 0 28px;
}
.pipe-stage {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px 18px;
  min-width: 0;
}
.pipe-stage.on { border-color: #c5d4c8; background: #f6faf7; }
.pipe-stage.wait { border-color: #e2c48a; background: #fbf6ea; }
.pipe-stage.clear { border-color: var(--line); }
.pipe-stage.live { border-color: #c5d4c8; }
.pipe-stage.fail { border-color: #e7c5c8; background: #fbf4f5; }
.pipe-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  font-weight: 700;
  margin-bottom: 8px;
}
.pipe-stage h2 { font-size: 1.12rem; margin-bottom: 6px; }
.pipe-count { font-size: 1.35rem; font-weight: 750; letter-spacing: -0.03em; line-height: 1.2; margin: 4px 0 8px; }
.pipe-list { display: grid; gap: 8px; margin-top: 12px; }
.pipe-item { display: flex; justify-content: space-between; gap: 12px; font-size: 0.9rem; line-height: 1.35; }
.pipe-item strong { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.pipe-item span { color: var(--mute); flex-shrink: 0; }
.pipe-join {
  align-self: center;
  height: 4px;
  background: #d7d3c8;
  border-radius: 99px;
}
.pipe-join.hot { background: #c4a056; }
.pipe-join.bad { background: #c56b55; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters .plain { height: 36px; }
.flags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.flag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 700;
}
.flag.wait { background: #f4ece4; color: #8a5a2a; }
.flag.warn { background: #f8e8ea; color: #8d3a44; }

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav, .side .push { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .plans, .till, .lower, .grid-3, .crm, .split, .modules, .ship-grid, .pipe { grid-template-columns: 1fr; }
  .pipe-join { display: none; }
  .main { padding: 20px 16px 48px; }
  .head { flex-direction: column; align-items: stretch; }
  .actions { justify-content: flex-start; }
}
