/* FOREVORsmesh — dark dev portal */

:root {
  --sm-bg: #0d0f14;
  --sm-bg-elevated: #13161d;
  --sm-sidebar: #101218;
  --sm-surface: #181c25;
  --sm-surface-hover: #1f2430;
  --sm-border: #2a3140;
  --sm-text: #eef0f4;
  --sm-text-muted: #8b95a8;
  --sm-accent: #ff5a1f;
  --sm-accent-soft: rgba(255, 90, 31, 0.14);
  --sm-green: #3ecf8e;
  --sm-yellow: #f5b942;
  --sm-sidebar-w: 268px;
  --sm-sidebar-collapsed: 72px;
  --sm-topbar-h: 56px;
  --sm-radius: 12px;
  --sm-font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --sm-mono: ui-monospace, Consolas, "Cascadia Code", monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.smesh-app {
  margin: 0;
  font: 15px/1.55 var(--sm-font);
  color: var(--sm-text);
  background: var(--sm-bg);
  min-height: 100vh;
}

a {
  color: inherit;
}

button {
  font: inherit;
}

.smesh-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, 0.55);
  border: none;
  padding: 0;
  cursor: pointer;
}

.smesh-backdrop.is-visible {
  display: block;
}

/* sidebar */
.smesh-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 40;
  width: var(--sm-sidebar-w);
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--sm-sidebar);
  border-right: 1px solid var(--sm-border);
  transition: width 0.22s ease, transform 0.22s ease;
  overflow: hidden;
}

.smesh-app.is-collapsed .smesh-sidebar {
  width: var(--sm-sidebar-collapsed);
}

.smesh-sidebar-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--sm-topbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--sm-border);
  flex-shrink: 0;
}

.smesh-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  text-decoration: none;
  color: var(--sm-text);
}

.smesh-logo-mark {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff5a1f, #ff8347);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.smesh-logo-text {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.smesh-logo-text strong {
  display: block;
  font-size: 0.95rem;
  letter-spacing: -0.03em;
}

.smesh-logo-text small {
  display: block;
  font-size: 0.72rem;
  color: var(--sm-text-muted);
}

.smesh-app.is-collapsed .smesh-logo-text {
  opacity: 0;
  width: 0;
}

.smesh-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px;
}

.smesh-nav-group {
  margin-bottom: 18px;
}

.smesh-nav-label {
  padding: 0 10px 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sm-text-muted);
  white-space: nowrap;
  overflow: hidden;
}

.smesh-app.is-collapsed .smesh-nav-label {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
}

.smesh-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--sm-text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}

.smesh-nav-item:hover {
  background: var(--sm-surface-hover);
  color: var(--sm-text);
}

.smesh-nav-item.is-active {
  background: var(--sm-accent-soft);
  color: var(--sm-accent);
}

.smesh-nav-item.is-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.smesh-nav-icon {
  flex-shrink: 0;
  width: 22px;
  text-align: center;
  font-size: 1rem;
  line-height: 1;
}

.smesh-nav-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  transition: opacity 0.15s;
}

.smesh-nav-tag {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sm-text-muted);
}

.smesh-nav-tag.live {
  background: rgba(62, 207, 142, 0.15);
  color: var(--sm-green);
}

.smesh-nav-tag.dev {
  background: rgba(245, 185, 66, 0.15);
  color: var(--sm-yellow);
}

.smesh-app.is-collapsed .smesh-nav-text,
.smesh-app.is-collapsed .smesh-nav-tag {
  opacity: 0;
  width: 0;
  padding: 0;
  overflow: hidden;
}

.smesh-app.is-collapsed .smesh-nav-item {
  justify-content: center;
  padding: 10px;
}

.smesh-sidebar-foot {
  padding: 12px 10px 16px;
  border-top: 1px solid var(--sm-border);
  flex-shrink: 0;
}

.smesh-sidebar-foot a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  text-decoration: none;
  color: var(--sm-text-muted);
  font-size: 0.88rem;
}

.smesh-sidebar-foot a:hover {
  background: var(--sm-surface-hover);
  color: var(--sm-text);
}

.smesh-app.is-collapsed .smesh-sidebar-foot span {
  display: none;
}

/* shell */
.smesh-shell {
  min-height: 100vh;
  margin-left: var(--sm-sidebar-w);
  transition: margin-left 0.22s ease;
}

.smesh-app.is-collapsed .smesh-shell {
  margin-left: var(--sm-sidebar-collapsed);
}

.smesh-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  height: var(--sm-topbar-h);
  padding: 0 20px;
  background: rgba(13, 15, 20, 0.88);
  border-bottom: 1px solid var(--sm-border);
  backdrop-filter: blur(12px);
}

.smesh-menu-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--sm-border);
  border-radius: 10px;
  background: var(--sm-surface);
  color: var(--sm-text);
  cursor: pointer;
}

.smesh-menu-btn:hover {
  background: var(--sm-surface-hover);
}

.smesh-topbar-title {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--sm-text-muted);
}

.smesh-topbar-title strong {
  color: var(--sm-text);
}

.smesh-topbar-link {
  padding: 8px 14px;
  border: 1px solid var(--sm-border);
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--sm-text-muted);
  white-space: nowrap;
}

.smesh-topbar-link:hover {
  border-color: #3d4658;
  color: var(--sm-text);
}

/* content */
.smesh-content {
  padding: 28px 24px 48px;
  max-width: 1100px;
}

.smesh-card-linkbox {
  display: block;
  text-decoration: none;
  color: inherit;
}

.smesh-card-linkbox:hover {
  border-color: #3d4658;
  background: var(--sm-surface-hover);
}

.smesh-card-linkbox.is-disabled {
  pointer-events: none;
}

.smesh-hero-block {
  margin-bottom: 32px;
}

.smesh-kicker {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sm-accent);
}

.smesh-hero-block h1 {
  margin: 0 0 10px;
  font-size: clamp(1.75rem, 3.5vw, 2.35rem);
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.smesh-lead {
  margin: 0;
  max-width: 36rem;
  color: var(--sm-text-muted);
  font-size: 1.02rem;
  line-height: 1.6;
}

.smesh-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.smesh-stat {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--sm-border);
  background: var(--sm-surface);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--sm-text-muted);
}

.smesh-stat.live {
  border-color: rgba(62, 207, 142, 0.35);
  color: var(--sm-green);
}

.smesh-section {
  scroll-margin-top: calc(var(--sm-topbar-h) + 16px);
  margin-bottom: 36px;
}

.smesh-section-head {
  margin-bottom: 16px;
}

.smesh-section-head h2 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}

.smesh-section-head p {
  margin: 0;
  color: var(--sm-text-muted);
  max-width: 38rem;
}

.smesh-panel {
  padding: 22px;
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius);
}

.smesh-panel + .smesh-panel {
  margin-top: 12px;
}

.smesh-panel h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.smesh-panel p {
  margin: 0 0 16px;
  color: var(--sm-text-muted);
  font-size: 0.92rem;
}

.smesh-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.smesh-card {
  padding: 20px;
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius);
  transition: border-color 0.15s, background 0.15s;
}

.smesh-card:not(.is-disabled):hover {
  border-color: #3d4658;
  background: var(--sm-surface-hover);
}

.smesh-card.is-disabled {
  opacity: 0.55;
}

.smesh-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.smesh-card h3 {
  margin: 0;
  font-size: 1rem;
}

.smesh-badge {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--sm-text-muted);
}

.smesh-badge.live {
  background: rgba(62, 207, 142, 0.15);
  color: var(--sm-green);
}

.smesh-badge.dev {
  background: rgba(245, 185, 66, 0.15);
  color: var(--sm-yellow);
}

.smesh-card p {
  margin: 0 0 14px;
  font-size: 0.88rem;
  color: var(--sm-text-muted);
  line-height: 1.55;
}

.smesh-card a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sm-accent);
  text-decoration: none;
}

.smesh-card a:hover {
  text-decoration: underline;
}

.smesh-btn-active {
  opacity: 1;
  cursor: pointer;
}

.smesh-btn-active:hover {
  filter: brightness(1.05);
}

.smesh-topbar-btn {
  padding: 8px 12px;
  border: 1px solid var(--sm-border);
  border-radius: 999px;
  background: var(--sm-surface);
  color: var(--sm-text-muted);
  cursor: pointer;
  font-size: 0.85rem;
}

.smesh-user-label {
  font-size: 0.85rem;
  color: var(--sm-text-muted);
  margin-right: 8px;
}

.smesh-content-narrow {
  max-width: 480px;
}

.smesh-form label {
  display: block;
  margin-bottom: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--sm-text-muted);
}

.smesh-form input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--sm-border);
  border-radius: 8px;
  background: var(--sm-bg);
  color: var(--sm-text);
  font: inherit;
}

.smesh-toast {
  margin: 12px 0 0;
  font-size: 0.85rem;
}

.smesh-toast.ok {
  color: var(--sm-green);
}

.smesh-toast.err {
  color: #ff6b6b;
}

.smesh-table-wrap {
  overflow: auto;
}

.smesh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.smesh-table th,
.smesh-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--sm-border);
  text-align: left;
}

.smesh-table th {
  color: var(--sm-text-muted);
  font-weight: 600;
}

.smesh-table code {
  font-family: var(--sm-mono);
  font-size: 0.82em;
}

.smesh-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.smesh-secret-box {
  margin-top: 12px;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(62, 207, 142, 0.35);
  background: rgba(62, 207, 142, 0.08);
  word-break: break-all;
  font-family: var(--sm-mono);
  font-size: 0.85rem;
}

.smesh-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.smesh-inline-form label {
  flex: 1;
  min-width: 160px;
  margin: 0;
}

.smesh-inline-form input {
  margin-top: 6px;
}

.smesh-btn-sm {
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: var(--sm-accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

.smesh-btn-sm.ghost {
  background: transparent;
  border: 1px solid var(--sm-border);
  color: var(--sm-text-muted);
}

.smesh-btn-sm.danger {
  background: #c0392b;
}

.smesh-btn.ghost {
  background: transparent;
  border: 1px solid var(--sm-border);
  color: var(--sm-text-muted);
}

.smesh-key-row {
  display: flex;
  gap: 8px;
}

.smesh-key-row input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--sm-border);
  border-radius: 8px;
  background: var(--sm-bg);
  color: var(--sm-text-muted);
  font: inherit;
  font-size: 0.85rem;
}

.smesh-key-row button {
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  background: var(--sm-accent);
  color: #fff;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.55;
}

.smesh-code {
  margin: 0;
  padding: 14px 16px;
  background: var(--sm-bg);
  border: 1px solid var(--sm-border);
  border-radius: 10px;
  overflow: auto;
  font-family: var(--sm-mono);
  font-size: 12px;
  line-height: 1.55;
  color: #c5cad4;
}

.smesh-code code {
  font-family: inherit;
}

.smesh-list {
  margin: 0 0 14px;
  padding-left: 1.15rem;
  color: var(--sm-text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.smesh-list code {
  font-family: var(--sm-mono);
  font-size: 0.85em;
  color: #d4dae4;
}

.smesh-overlay-hint {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(245, 185, 66, 0.1);
  border: 1px solid rgba(245, 185, 66, 0.25);
  color: var(--sm-yellow);
  font-size: 0.82rem;
}

/* mobile */
@media (max-width: 900px) {
  .smesh-sidebar {
    transform: translateX(-100%);
    width: var(--sm-sidebar-w);
  }

  .smesh-app.is-sidebar-open .smesh-sidebar {
    transform: translateX(0);
  }

  .smesh-app.is-sidebar-open .smesh-backdrop {
    display: block;
  }

  .smesh-shell {
    margin-left: 0 !important;
  }

  .smesh-app.is-collapsed .smesh-sidebar {
    width: var(--sm-sidebar-w);
  }

  .smesh-grid {
    grid-template-columns: 1fr;
  }

  .smesh-topbar-link span {
    display: none;
  }
}

@media (min-width: 901px) {
  .smesh-backdrop {
    display: none !important;
  }
}

/* chat console */
.smesh-console-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 12px;
}

.smesh-console-toolbar label {
  flex: 1 1 220px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--sm-text-muted);
}

.smesh-console-toolbar input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--sm-border);
  background: var(--sm-bg);
  color: var(--sm-text);
}

.smesh-console-layout {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 12px;
  min-height: 520px;
}

.smesh-console-sidebar,
.smesh-console-main {
  background: var(--sm-surface);
  border: 1px solid var(--sm-border);
  border-radius: var(--sm-radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.smesh-console-sidebar-head,
.smesh-console-main-head {
  padding: 12px 14px;
  border-bottom: 1px solid var(--sm-border);
  font-weight: 600;
}

.smesh-console-new {
  padding: 10px 12px;
  border-bottom: 1px solid var(--sm-border);
  display: flex;
  gap: 8px;
}

.smesh-console-new input {
  flex: 1;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--sm-border);
  background: var(--sm-bg);
  color: var(--sm-text);
}

.smesh-chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.smesh-chat-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--sm-border);
  cursor: pointer;
  transition: background 0.15s;
}

.smesh-chat-item:hover,
.smesh-chat-item.is-active {
  background: var(--sm-surface-hover);
}

.smesh-chat-item-title {
  font-weight: 600;
  font-size: 0.92rem;
}

.smesh-chat-item-preview {
  font-size: 0.8rem;
  color: var(--sm-text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.smesh-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.smesh-msg {
  max-width: 85%;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--sm-bg-elevated);
  border: 1px solid var(--sm-border);
  font-size: 0.92rem;
}

.smesh-msg.is-me {
  align-self: flex-end;
  background: var(--sm-accent-soft);
  border-color: rgba(255, 90, 31, 0.35);
}

.smesh-msg-meta {
  font-size: 0.72rem;
  color: var(--sm-text-muted);
  margin-bottom: 3px;
}

.smesh-console-compose {
  padding: 10px 12px;
  border-top: 1px solid var(--sm-border);
  display: flex;
  gap: 8px;
}

.smesh-console-compose input {
  flex: 1;
  padding: 9px 11px;
  border-radius: 8px;
  border: 1px solid var(--sm-border);
  background: var(--sm-bg);
  color: var(--sm-text);
}

.smesh-console-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--sm-text-muted);
  padding: 24px;
  text-align: center;
}

@media (max-width: 900px) {
  .smesh-console-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .smesh-console-main {
    min-height: 360px;
  }
}
