:root {
  --ops-bg: #0a0d13;
  --ops-panel: #10151d;
  --ops-panel-2: #151b25;
  --ops-panel-3: #0d1219;
  --ops-line: rgba(255,255,255,.08);
  --ops-line-strong: rgba(255,255,255,.14);
  --ops-text: #f4f7fb;
  --ops-muted: #8f9bad;
  --ops-blue: #5b8cff;
  --ops-green: #2bd477;
  --ops-yellow: #f5c451;
  --ops-red: #ff6472;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ops-bg); color: var(--ops-text); }
button, input, textarea { font: inherit; }

.ops-app {
  min-height: 100vh;
  background:
    radial-gradient(circle at 72% -10%, rgba(91,140,255,.12), transparent 34%),
    var(--ops-bg);
  color: var(--ops-text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.ops-topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--ops-line);
  background: rgba(10,13,19,.94);
  backdrop-filter: blur(18px);
}

.ops-brand, .ops-top-actions { display: flex; align-items: center; gap: 12px; }
.ops-brand-mark {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 12px; background: linear-gradient(145deg, #6a96ff, #466fe8);
  color: white; font-weight: 900; font-size: 19px;
  box-shadow: 0 10px 26px rgba(70,111,232,.24);
}
.ops-brand p, .ops-inbox-heading p, .ops-center-header p {
  margin: 0 0 3px; color: var(--ops-muted); font-size: 10px;
  font-weight: 850; letter-spacing: .13em;
}
.ops-brand h1 { margin: 0; font-size: 20px; }
.ops-icon-button, .ops-logout {
  min-width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--ops-line); border-radius: 10px;
  background: var(--ops-panel); color: var(--ops-text); text-decoration: none; cursor: pointer;
}
.ops-icon-button:hover, .ops-logout:hover { border-color: rgba(91,140,255,.45); }
.ops-status {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px;
  border: 1px solid var(--ops-line); border-radius: 999px;
  color: var(--ops-muted); font-size: 12px; font-weight: 750;
}
.ops-status span, .ops-channel-state {
  width: 8px; height: 8px; border-radius: 50%; background: var(--ops-yellow);
  box-shadow: 0 0 0 4px rgba(245,196,81,.08);
}
.ops-status.online { color: #baffd3; border-color: rgba(43,212,119,.25); }
.ops-status.online span, .ops-channel-state.online { background: var(--ops-green); }
.ops-status.error { color: #ffc7cc; border-color: rgba(255,100,114,.25); }
.ops-status.error span, .ops-channel-state.error { background: var(--ops-red); }

.ops-workspace {
  height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(300px, 350px) minmax(520px, 1fr) minmax(300px, 360px);
  overflow: hidden;
}

.ops-inbox-panel, .ops-context-panel, .ops-center-panel { min-width: 0; min-height: 0; }
.ops-inbox-panel {
  display: flex; flex-direction: column;
  border-right: 1px solid var(--ops-line); background: var(--ops-panel-3);
}
.ops-context-panel {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--ops-line); background: var(--ops-panel-3);
}
.ops-center-panel { display: flex; flex-direction: column; background: #0c1118; }

.ops-inbox-heading {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 16px 12px;
}
.ops-inbox-heading h2 { margin: 0; font-size: 20px; }
.ops-count {
  min-width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 9px; background: rgba(91,140,255,.13); color: #cbd9ff;
  font-size: 12px; font-weight: 850;
}

.ops-view-nav {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px;
  padding: 0 12px 12px; border-bottom: 1px solid var(--ops-line);
}
.ops-view-nav button, .ops-filters button, .ops-context-tabs button {
  border: 0; background: transparent; color: var(--ops-muted); cursor: pointer;
  font-size: 11px; font-weight: 800;
}
.ops-view-nav button { padding: 9px 4px; border-radius: 8px; }
.ops-view-nav button.active { background: rgba(91,140,255,.14); color: #dce6ff; }

.ops-channels { display: grid; gap: 7px; padding: 12px; }
.ops-channel {
  width: 100%; display: grid; grid-template-columns: 36px 1fr 12px;
  align-items: center; gap: 10px; padding: 10px;
  border: 1px solid var(--ops-line); border-radius: 12px;
  background: var(--ops-panel); color: var(--ops-text); text-align: left; cursor: pointer;
}
.ops-channel:hover, .ops-channel.active {
  border-color: rgba(91,140,255,.42); background: rgba(91,140,255,.08);
}
.ops-channel-icon {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; background: #1b2431; color: #d8e3ff; font-size: 11px; font-weight: 900;
}
.ops-channel-copy { min-width: 0; }
.ops-channel-copy strong, .ops-channel-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-channel-copy strong { font-size: 13px; }
.ops-channel-copy small { margin-top: 3px; color: var(--ops-muted); font-size: 11px; }

.ops-search {
  display: flex; align-items: center; gap: 8px; margin: 0 12px 10px; padding: 0 11px;
  border: 1px solid var(--ops-line); border-radius: 10px; background: var(--ops-panel);
}
.ops-search span { color: var(--ops-muted); font-size: 18px; }
.ops-search input {
  width: 100%; height: 38px; border: 0; outline: none; background: transparent; color: var(--ops-text);
  font-size: 12px;
}
.ops-search input::placeholder { color: #687385; }

.ops-filters {
  display: flex; gap: 6px; padding: 0 12px 10px; overflow-x: auto;
}
.ops-filters button {
  flex: 0 0 auto; padding: 7px 9px; border: 1px solid var(--ops-line);
  border-radius: 999px; background: var(--ops-panel);
}
.ops-filters button.active { color: #dce6ff; border-color: rgba(91,140,255,.42); background: rgba(91,140,255,.1); }

.ops-list { flex: 1; overflow: auto; padding: 0 8px 12px; }
.ops-list-item {
  width: 100%; display: grid; grid-template-columns: 42px 1fr auto; gap: 10px;
  padding: 12px 9px; border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--ops-text); text-align: left; cursor: pointer;
}
.ops-list-item:hover, .ops-list-item.active { background: var(--ops-panel); border-color: var(--ops-line); }
.ops-avatar {
  width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(145deg, #263247, #182131); color: #d9e4ff; font-size: 12px; font-weight: 900;
}
.ops-list-copy { min-width: 0; }
.ops-list-top { display: flex; justify-content: space-between; gap: 10px; }
.ops-list-name { font-size: 13px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-list-preview { margin-top: 5px; color: var(--ops-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ops-list-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 7px; color: var(--ops-muted); font-size: 10px; }
.ops-waiting {
  padding: 3px 6px; border-radius: 999px; color: #ffe2a5; background: rgba(245,196,81,.1);
  font-size: 9px; font-weight: 850;
}

.ops-center-header {
  min-height: 78px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--ops-line); background: rgba(16,21,29,.7);
}
.ops-center-header h2 { margin: 0; font-size: 18px; }
.ops-center-header span { display: block; margin-top: 4px; color: var(--ops-muted); font-size: 12px; }
.ops-center-badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.ops-pill {
  padding: 6px 8px; border: 1px solid var(--ops-line); border-radius: 999px;
  color: var(--ops-muted); font-size: 10px; font-weight: 850;
}
.ops-pill.online { color: #baffd3; border-color: rgba(43,212,119,.25); background: rgba(43,212,119,.07); }
.ops-pill.warning { color: #ffe2a5; border-color: rgba(245,196,81,.25); background: rgba(245,196,81,.07); }

.ops-center-body { flex: 1; min-height: 0; overflow: auto; padding: 20px; }
.ops-empty {
  min-height: 100%; display: grid; place-content: center; justify-items: center; text-align: center; color: var(--ops-muted);
}
.ops-empty.compact { min-height: 240px; padding: 24px; }
.ops-empty span { font-size: 32px; }
.ops-empty h3 { margin: 12px 0 5px; color: var(--ops-text); font-size: 16px; }
.ops-empty p { max-width: 390px; margin: 0; line-height: 1.55; font-size: 12px; }

.ops-message-day { margin: 16px 0; text-align: center; color: var(--ops-muted); font-size: 10px; }
.ops-message {
  width: fit-content; max-width: min(74%, 660px); margin: 7px 0; padding: 10px 12px;
  border: 1px solid var(--ops-line); border-radius: 14px; background: var(--ops-panel-2);
}
.ops-message.outbound { margin-left: auto; background: rgba(91,140,255,.14); border-color: rgba(91,140,255,.22); }
.ops-message-text { white-space: pre-wrap; word-break: break-word; font-size: 13px; line-height: 1.5; }
.ops-message-meta { margin-top: 6px; color: var(--ops-muted); font-size: 9px; text-align: right; }

.ops-composer {
  display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: end;
  padding: 12px 16px; border-top: 1px solid var(--ops-line); background: var(--ops-panel);
}
.ops-compose-tools { display: flex; gap: 5px; }
.ops-compose-tools button, .ops-composer > button {
  height: 38px; border: 1px solid var(--ops-line); border-radius: 10px; background: #171e29; color: #667184;
}
.ops-compose-tools button { width: 38px; }
.ops-composer > button { min-width: 82px; }
.ops-composer textarea {
  width: 100%; resize: none; border: 1px solid var(--ops-line); border-radius: 11px;
  padding: 10px 12px; background: #0d1219; color: var(--ops-muted); outline: none;
}

.ops-context-tabs {
  display: grid; grid-template-columns: repeat(3, 1fr); height: 54px; border-bottom: 1px solid var(--ops-line);
}
.ops-context-tabs button { position: relative; }
.ops-context-tabs button.active { color: var(--ops-text); }
.ops-context-tabs button.active::after {
  content: ""; position: absolute; left: 22%; right: 22%; bottom: 0; height: 2px; background: var(--ops-blue); border-radius: 2px;
}
.ops-context-body { flex: 1; overflow: auto; padding: 14px; }
.ops-context-section {
  margin-bottom: 12px; padding: 13px; border: 1px solid var(--ops-line); border-radius: 12px; background: var(--ops-panel);
}
.ops-context-section h3 { margin: 0 0 10px; font-size: 12px; letter-spacing: .04em; }
.ops-context-row {
  display: grid; grid-template-columns: minmax(90px, .8fr) minmax(0, 1.2fr); gap: 10px;
  padding: 6px 0; border-top: 1px solid rgba(255,255,255,.045); font-size: 11px;
}
.ops-context-row:first-of-type { border-top: 0; }
.ops-context-row span:first-child { color: var(--ops-muted); }
.ops-context-row span:last-child { text-align: right; word-break: break-word; }
.ops-context-row .good { color: #baffd3; }
.ops-context-row .warning { color: #ffe2a5; }
.ops-context-row .danger { color: #ffc7cc; }
.ops-missing {
  margin: 10px 0 0; padding: 9px; border-radius: 9px; background: rgba(255,100,114,.07);
  color: #ffc7cc; white-space: pre-wrap; word-break: break-word; font-size: 10px;
}

.ops-card-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px;
}
.ops-data-card {
  padding: 14px; border: 1px solid var(--ops-line); border-radius: 14px; background: var(--ops-panel);
}
.ops-data-card h3 { margin: 0 0 4px; font-size: 14px; }
.ops-data-card > p { margin: 0 0 12px; color: var(--ops-muted); font-size: 11px; }
.ops-data-card .ops-context-row { grid-template-columns: 1fr 1.25fr; }
.ops-template-body {
  margin-top: 10px; padding: 11px; border-radius: 9px; background: #090d13;
  color: #d5e0f7; white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
}

.ops-toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 30; transform: translate(-50%, 20px);
  padding: 10px 14px; border: 1px solid var(--ops-line-strong); border-radius: 10px;
  background: #17202c; color: var(--ops-text); opacity: 0; pointer-events: none; transition: .2s;
  font-size: 12px;
}
.ops-toast.show { opacity: 1; transform: translate(-50%, 0); }

.ops-loading {
  padding: 22px; color: var(--ops-muted); text-align: center; font-size: 12px;
}

@media (max-width: 1180px) {
  .ops-workspace { grid-template-columns: 310px minmax(480px, 1fr); }
  .ops-context-panel { position: fixed; top: 72px; right: 0; bottom: 0; width: 340px; z-index: 20; box-shadow: -18px 0 48px rgba(0,0,0,.35); }
}
@media (max-width: 760px) {
  .ops-topbar { height: 64px; padding: 0 12px; }
  .ops-brand p, .ops-status { display: none; }
  .ops-workspace { height: calc(100vh - 64px); grid-template-columns: 1fr; }
  .ops-inbox-panel { width: 100%; }
  .ops-center-panel { position: fixed; inset: 64px 0 0; z-index: 15; transform: translateX(100%); transition: .2s; }
  .ops-app.chat-open .ops-center-panel { transform: translateX(0); }
  .ops-context-panel { display: none; }
}
