@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=IBM+Plex+Mono:wght@400;500&display=swap");

:root {
  --bg: #f3f7f4;
  --bg-strong: #edf3ef;
  --panel: rgba(255, 255, 255, 0.9);
  --panel-strong: #ffffff;
  --ink: #15231b;
  --muted: #5c6b61;
  --line: #d8e1db;
  --brand: #1d8f62;
  --brand-strong: #126e4a;
  --danger: #cb5d47;
  --warning: #d49a2f;
  --shadow: 0 18px 55px rgba(27, 59, 42, 0.09);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(29, 143, 98, 0.14), transparent 32%),
    radial-gradient(circle at bottom right, rgba(161, 193, 173, 0.2), transparent 28%),
    linear-gradient(180deg, #f7fbf8 0%, var(--bg) 100%);
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

code,
pre,
.code-block {
  font-family: "IBM Plex Mono", monospace;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.ghost-link {
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

button:hover,
.ghost-link:hover {
  transform: translateY(-1px);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 28px 20px;
  background: rgba(19, 33, 25, 0.96);
  color: #eff9f2;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: linear-gradient(135deg, #1dd189, #0d6f4b);
  display: inline-grid;
  place-items: center;
  color: white;
  font-weight: 800;
}

.brand-icon {
  width: 26px;
  height: 26px;
  display: block;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: rgba(239, 249, 242, 0.66);
  font-size: 14px;
}

.nav {
  display: grid;
  gap: 10px;
}

.nav a {
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(239, 249, 242, 0.86);
}

.nav a.active,
.nav a:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-foot {
  margin-top: auto;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(239, 249, 242, 0.76);
}

.sidebar-foot p {
  margin: 0 0 10px;
  font-size: 14px;
}

.main-shell {
  padding: 26px;
}

.topbar,
.hero-panel,
.panel,
.stat-card,
.device-card,
.auth-panel,
.auth-aside,
.metric-card {
  background: var(--panel);
  border: 1px solid rgba(216, 225, 219, 0.9);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar {
  border-radius: var(--radius-xl);
  padding: 22px 26px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 12px;
  color: var(--brand-strong);
}

h1,
h2 {
  margin: 0;
  line-height: 1.05;
}

h1 {
  font-size: clamp(28px, 4vw, 48px);
}

h2 {
  font-size: 24px;
}

.topbar-actions {
  display: flex;
  gap: 14px;
  align-items: center;
}

.user-pill {
  padding: 12px 14px;
  border-radius: 16px;
  background: var(--bg-strong);
  display: grid;
}

.user-pill span {
  font-size: 13px;
  color: var(--muted);
}

.flash {
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
}

.flash-stack {
  position: fixed;
  top: 22px;
  right: 22px;
  z-index: 1200;
  display: grid;
  gap: 12px;
  width: min(380px, calc(100vw - 32px));
}

.flash-toast {
  margin: 0;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  box-shadow: 0 18px 45px rgba(21, 35, 27, 0.16);
  backdrop-filter: blur(18px);
  animation: flash-slide-in 180ms ease;
}

.flash-close {
  padding: 0;
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: inherit;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: none;
  font-size: 18px;
  line-height: 1;
}

.flash-hide {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.flash.success {
  background: rgba(29, 143, 98, 0.11);
  border-color: rgba(29, 143, 98, 0.18);
  color: var(--brand-strong);
}

.flash.error {
  background: rgba(203, 93, 71, 0.1);
  border-color: rgba(203, 93, 71, 0.18);
  color: #9d3e2f;
}

.stats-grid,
.panel-grid,
.device-grid {
  display: grid;
  gap: 18px;
}

.stats-grid {
  margin-top: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card,
.panel,
.hero-panel {
  border-radius: var(--radius-xl);
  padding: 22px;
}

.stat-card strong {
  display: block;
  margin: 8px 0;
  font-size: 40px;
}

.stat-card p,
.muted,
.panel p,
.feed-item span,
.device-meta span,
.list-row span,
.empty-state,
.auth-copy {
  color: var(--muted);
}

.panel-grid {
  margin-top: 18px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.panel {
  grid-column: span 4;
}

.panel.wide {
  grid-column: span 8;
}

.panel.full {
  grid-column: span 12;
}

.panel.half {
  grid-column: span 6;
}

.panel.compact {
  grid-column: span 4;
}

.hero-panel {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.hero-actions,
.chip-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}

.stack {
  display: grid;
  gap: 12px;
}

.stack.large {
  gap: 16px;
}

.two-col,
.three-col,
.toggle-grid {
  display: grid;
  gap: 12px;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.three-col {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toggle-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

label {
  display: grid;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

label span {
  color: var(--ink);
  font-weight: 600;
}

input,
select,
textarea,
button,
.ghost-link,
.ghost-button,
.danger-button {
  border-radius: 16px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
  padding: 13px 14px;
  color: var(--ink);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

button,
.ghost-link,
.ghost-button,
.danger-button {
  border: none;
  padding: 13px 16px;
  cursor: pointer;
  font-weight: 700;
}

button {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: white;
}

.ghost-link,
.ghost-button {
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
}

.danger-button {
  background: rgba(203, 93, 71, 0.1);
  color: #8d382a;
  border: 1px solid rgba(203, 93, 71, 0.18);
}

.device-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.device-card {
  border-radius: 22px;
  padding: 18px;
  display: grid;
  gap: 14px;
}

.device-card-top,
.copy-row,
.list-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.device-card-top span,
.device-meta span,
.list-row small,
.feed-item span,
.credential-hint span,
.field-note {
  font-size: 13px;
}

.field-note {
  color: var(--muted);
  line-height: 1.45;
}

.device-meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(29, 143, 98, 0.1);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.status-offline,
.status-disconnected,
.status-error {
  background: rgba(203, 93, 71, 0.12);
  color: #933c2d;
}

.status-qr,
.status-pairing,
.status-loading,
.status-starting,
.status-authenticated,
.status-opening {
  background: rgba(212, 154, 47, 0.16);
  color: #8a6418;
}

.feed,
.table-list,
.message-thread {
  display: grid;
  gap: 12px;
}

.feed-item,
.list-row,
.message-bubble,
.code-panel {
  background: rgba(247, 250, 248, 0.94);
  border: 1px solid rgba(216, 225, 219, 0.9);
  border-radius: 18px;
  padding: 14px;
}

.schedule-card {
  width: 100%;
  text-align: left;
  box-shadow: none;
  color: inherit;
}

.feed-item p,
.message-bubble p {
  margin: 8px 0;
}

.scroll-box,
.message-thread {
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.message-thread-chat {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 68vh;
  min-height: 520px;
  padding: 18px 12px 4px 4px;
  background:
    radial-gradient(circle at top left, rgba(29, 143, 98, 0.07), transparent 28%),
    linear-gradient(180deg, rgba(247, 250, 248, 0.96), rgba(241, 247, 243, 0.92));
  border-radius: 24px;
  border: 1px solid rgba(216, 225, 219, 0.9);
}

.message-row {
  display: flex;
}

.message-row.in {
  justify-content: flex-start;
}

.message-row.out {
  justify-content: flex-end;
}

.message-bubble-chat {
  width: min(100%, 560px);
  display: grid;
  gap: 10px;
  padding: 16px;
}

.message-bubble-chat.in {
  border-top-left-radius: 10px;
}

.message-bubble-chat.out {
  border-top-right-radius: 10px;
}

.message-sender {
  font-size: 13px;
}

.message-attachment {
  display: grid;
  gap: 10px;
}

.media-thumb-link {
  display: inline-block;
}

.media-thumb,
.media-video {
  display: block;
  max-width: min(100%, 320px);
  max-height: 280px;
  border-radius: 18px;
  border: 1px solid rgba(216, 225, 219, 0.9);
  background: rgba(255, 255, 255, 0.74);
  object-fit: cover;
}

.media-audio {
  width: min(100%, 320px);
}

.file-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: center;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid rgba(216, 225, 219, 0.9);
  background: rgba(255, 255, 255, 0.84);
}

.file-card-icon {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  height: 54px;
  border-radius: 16px;
  background: rgba(29, 143, 98, 0.11);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.file-card-meta {
  display: grid;
  gap: 4px;
}

.file-card-meta span {
  color: var(--muted);
  font-size: 13px;
}

.compact-scroll {
  max-height: 320px;
}

.message-bubble.out {
  background: rgba(29, 143, 98, 0.1);
}

.message-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--muted);
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.target-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: start;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 52px;
  padding-inline: 0;
}

.button-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.picker-row {
  width: 100%;
  text-align: left;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  background: white;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: none;
}

.picker-row span,
.picker-row strong {
  display: block;
}

.picker-row span {
  color: var(--muted);
  font-size: 13px;
}

.modal-open {
  overflow: hidden;
}

.modal-shell {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-shell[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(21, 35, 27, 0.45);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  max-height: min(82vh, 920px);
  overflow: auto;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid rgba(216, 225, 219, 0.9);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 65px rgba(21, 35, 27, 0.18);
}

.qr-preview {
  width: min(100%, 260px);
  border-radius: 22px;
  border: 1px solid var(--line);
}

.code-panel span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.code-panel code,
.code-block {
  word-break: break-all;
}

pre {
  margin: 0;
  overflow: auto;
  padding: 14px;
  border-radius: 18px;
  background: #15231b;
  color: #f1fff6;
}

.toggle {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.85);
}

.toggle input {
  width: auto;
}

.compact-feed .feed-item {
  padding: 10px 12px;
}

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 22px;
}

.auth-shell {
  width: min(1120px, 100%);
  display: grid;
  grid-template-columns: 1fr 1.08fr;
  gap: 20px;
}

.auth-panel,
.auth-aside {
  border-radius: 34px;
  padding: 32px;
}

.auth-panel h1 {
  max-width: 12ch;
  margin-bottom: 16px;
}

.auth-aside {
  display: grid;
  align-content: stretch;
  gap: 16px;
  background:
    linear-gradient(160deg, rgba(29, 143, 98, 0.14), rgba(255, 255, 255, 0.72)),
    var(--panel);
}

.auth-aside-head {
  display: grid;
  gap: 10px;
}

.auth-aside-head h2 {
  font-size: clamp(24px, 2.5vw, 34px);
  line-height: 1.08;
}

.auth-feature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.metric-card {
  border-radius: 24px;
  padding: 20px;
}

.monitor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.monitor-card {
  display: grid;
  gap: 10px;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 248, 0.94));
}

.monitor-card strong {
  font-size: clamp(28px, 4vw, 40px);
}

.monitor-card span,
.monitor-card small {
  color: var(--muted);
}

.monitor-error {
  color: #9d3e2f;
}

.monitor-meter {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(21, 35, 27, 0.08);
  overflow: hidden;
}

.monitor-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
}

.feature-card {
  display: grid;
  gap: 10px;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 250, 248, 0.94));
}

.feature-card-primary {
  background:
    linear-gradient(160deg, rgba(29, 143, 98, 0.18), rgba(255, 255, 255, 0.98));
}

.feature-kicker {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand-strong);
}

.feature-card p,
.feature-step p,
.feature-strip-head span {
  margin: 0;
  color: var(--muted);
}

.feature-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
  display: grid;
  gap: 6px;
}

.feature-strip {
  display: grid;
  gap: 16px;
  background:
    linear-gradient(135deg, rgba(21, 35, 27, 0.92), rgba(18, 110, 74, 0.9));
  color: #f3fff7;
}

.auth-flow-card {
  margin-top: 16px;
}

.feature-strip-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.feature-strip-head strong,
.feature-strip-head span {
  color: inherit;
}

.feature-strip p,
.feature-strip .feature-step p,
.feature-strip .feature-step span,
.feature-strip .feature-strip-head span,
.feature-strip .feature-strip-head strong {
  color: #f3fff7;
}

.feature-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.feature-step {
  display: grid;
  gap: 10px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.feature-step span {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.16);
  font-weight: 800;
}

.metric-card strong,
.credential-hint span {
  display: block;
}

.credential-hint {
  margin-top: 12px;
  padding: 16px;
  border-radius: 18px;
  background: rgba(19, 33, 25, 0.04);
}

.credential-hint a {
  display: block;
  margin-top: 8px;
  color: var(--brand-strong);
  font-weight: 700;
}

.integration-shell {
  width: min(1320px, 100%);
}

.integration-panel {
  width: 100%;
}

.integration-grid {
  margin-top: 24px;
}

.integration-actions {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  align-items: center;
}

@keyframes flash-slide-in {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1180px) {
  .panel,
  .panel.wide,
  .panel.full,
  .panel.half,
  .panel.compact {
    grid-column: span 12;
  }

  .device-grid,
  .stats-grid,
  .two-col,
  .three-col,
  .toggle-grid,
  .auth-feature-grid,
  .feature-steps,
  .monitor-grid,
  .auth-shell {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .topbar,
  .hero-panel,
  .topbar-actions,
  .device-card-top,
  .device-meta,
  .copy-row,
  .list-row {
    flex-direction: column;
    align-items: stretch;
  }

  .main-shell {
    padding: 18px;
  }

  .flash-stack {
    top: 14px;
    right: 14px;
    left: 14px;
    width: auto;
  }
}
