:root {
  color-scheme: light;
  --ink: #17221d;
  --muted: #64706a;
  --line: #dfe5e1;
  --soft: #f4f7f5;
  --paper: #ffffff;
  --green: #176b45;
  --green-soft: #e8f4ed;
  --amber: #9a5a00;
  --amber-soft: #fff4d8;
  --red: #a93636;
  --red-soft: #fff0ee;
  --shadow: 0 12px 35px rgba(24, 48, 36, .08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: #edf2ef;
  font: 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, textarea, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .52; }

.topbar {
  min-height: 86px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  color: white;
  background: #153d2d;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 26px; letter-spacing: -.02em; }
h2 { margin-bottom: 4px; font-size: 21px; }
h3 { margin-bottom: 12px; font-size: 15px; }
.eyebrow { margin-bottom: 2px; font-size: 11px; font-weight: 750; letter-spacing: .1em; text-transform: uppercase; opacity: .72; }
.muted { color: var(--muted); }

.service-state { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.dot { width: 9px; height: 9px; border-radius: 99px; background: #c9d0cc; }
.dot.ok { background: #55d38c; box-shadow: 0 0 0 4px rgba(85, 211, 140, .15); }
.dot.bad { background: #ff8585; }

.pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 5px 9px;
  border-radius: 99px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 700;
}
.topbar .pill { color: white; background: rgba(255,255,255,.13); }
.pill.blocked { color: var(--red); background: var(--red-soft); }
.pill.cold { color: var(--amber); background: var(--amber-soft); }

.layout {
  width: min(1480px, 100%);
  height: calc(100vh - 86px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  background: var(--paper);
}

.queue-panel { overflow: hidden; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 22px 20px 12px; }
.panel-head p { margin-bottom: 0; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: white; font-size: 20px; }
.limit-line { margin: 0 20px 14px; padding: 9px 12px; border-radius: 9px; background: var(--soft); color: var(--muted); font-size: 13px; }
.queue { overflow: auto; padding: 0 10px 24px; }
.queue-empty { padding: 28px 12px; text-align: center; color: var(--muted); }

.queue-item {
  width: 100%;
  margin-bottom: 7px;
  padding: 14px 12px;
  text-align: left;
  color: inherit;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
}
.queue-item:hover { background: var(--soft); }
.queue-item.active { border-color: #b9d8c8; background: var(--green-soft); }
.queue-title { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 4px; font-weight: 740; }
.queue-sub { margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.flags { display: flex; flex-wrap: wrap; gap: 5px; }
.flag { padding: 3px 7px; border-radius: 99px; background: #e8ece9; color: #58635d; font-size: 11px; }
.queue-item.active .flag { background: rgba(255,255,255,.7); }

.deal-panel { overflow: auto; padding: 28px clamp(22px, 4vw, 54px) 70px; }
.empty-state { max-width: 490px; margin: 17vh auto 0; text-align: center; color: var(--muted); }
.empty-mark { width: 56px; height: 56px; margin: 0 auto 18px; display: grid; place-items: center; border-radius: 99px; color: var(--green); background: var(--green-soft); font-size: 25px; }
.hidden { display: none !important; }
.deal-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 18px; }

.alerts { display: grid; gap: 8px; margin-bottom: 18px; }
.alert { padding: 11px 13px; border-radius: 9px; color: var(--amber); background: var(--amber-soft); }
.alert.blocker { color: var(--red); background: var(--red-soft); font-weight: 650; }

.fact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card, .compose-card { margin-bottom: 14px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: white; box-shadow: var(--shadow); }
dl { margin: 0; }
.fact { display: grid; grid-template-columns: 125px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px solid #eef1ef; }
.fact:last-child { border-bottom: 0; }
dt { color: var(--muted); }
dd { margin: 0; font-weight: 620; overflow-wrap: anywhere; }
.card-title-row { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; }

.messages { display: grid; gap: 8px; max-height: 310px; overflow: auto; }
.message { max-width: 78%; padding: 9px 11px; border-radius: 11px 11px 11px 3px; background: var(--soft); }
.message.out { justify-self: end; border-radius: 11px 11px 3px 11px; background: var(--green-soft); }
.message-date { display: block; margin-top: 4px; color: var(--muted); font-size: 10px; }

textarea, input {
  width: 100%;
  color: var(--ink);
  border: 1px solid #cad3ce;
  border-radius: 10px;
  background: white;
  outline: none;
}
textarea { min-height: 205px; padding: 14px; resize: vertical; }
input { padding: 10px 12px; }
textarea:focus, input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23,107,69,.1); }
.comment-label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 650; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.button { padding: 11px 16px; border-radius: 9px; border: 1px solid transparent; font-weight: 720; }
.button.primary { color: white; background: var(--green); }
.button.secondary { color: var(--ink); border-color: var(--line); background: white; }
.result { min-height: 22px; margin: 12px 0 0; text-align: right; font-weight: 650; }
.result.ok { color: var(--green); }
.result.bad { color: var(--red); }

@media (max-width: 860px) {
  .topbar { align-items: flex-start; padding: 16px; }
  .service-state { font-size: 12px; }
  .layout { height: auto; min-height: calc(100vh - 86px); grid-template-columns: 1fr; }
  .queue-panel { max-height: 43vh; border-right: 0; border-bottom: 1px solid var(--line); }
  .deal-panel { padding: 22px 14px 50px; }
  .fact-grid { grid-template-columns: 1fr; }
  .actions { flex-direction: column-reverse; }
  .button { width: 100%; }
}
