/* ==== App shell ==== */

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Body row: sidebar + main */
.shell-body {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* Icon sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar);
  border-right: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0 calc(12px + env(safe-area-inset-bottom));
  gap: 6px;
  overflow-y: auto;
}

.sidebar-logo {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-lg);
  background: linear-gradient(155deg, var(--primary), #1a8fd1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(42, 171, 238, 0.25);
}
.sidebar-logo svg { width: 17px; height: 17px; stroke: #fff; fill: none; stroke-width: 2; }

.nav-icon {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav-icon svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-icon:active { background: rgba(255, 255, 255, 0.08); }
.nav-icon.active { background: rgba(42, 171, 238, 0.16); color: var(--primary); box-shadow: inset 0 0 0 1px rgba(42, 171, 238, 0.3); }

.nav-icon .nav-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  background: var(--destructive);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.sidebar-spacer { flex: 1; }

.sidebar-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  margin-top: 6px;
}

.sidebar-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(155deg, #4f8ef7, #2856b8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  overflow: hidden;
}
.sidebar-avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Business Connection status — replaces the old always-on topbar text banner
   with a small color-coded dot on the sidebar avatar (hover/long-press for the
   full label via the wrapper's title attribute). */
.sidebar-avatar-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid var(--sidebar);
  background: var(--dim);
}
.sidebar-avatar-dot.ok { background: var(--success); }
.sidebar-avatar-dot.warn { background: var(--warning); }

/* Main content area (per-page) */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.page-header {
  flex-shrink: 0;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.page-header h2 {
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.page-header h2 svg { width: 16px; height: 16px; stroke: var(--primary); fill: none; stroke-width: 2; }
.page-header p { font-size: 11px; color: var(--muted-fg); margin: 3px 0 0; }

.page-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 20px;
}

/* ==== Buttons ==== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-md);
  padding: 8px 14px;
  transition: background-color 0.15s ease, opacity 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.btn-primary { background: rgba(42, 171, 238, 0.12); color: var(--primary); }
.btn-primary:active { background: rgba(42, 171, 238, 0.2); }

.btn-solid { background: var(--primary); color: #fff; }
.btn-solid:active { background: #1fa3e6; }

.btn-ghost { background: rgba(255, 255, 255, 0.04); color: var(--secondary-fg); }
.btn-ghost:active { background: rgba(255, 255, 255, 0.08); }

.btn-danger { background: rgba(229, 62, 93, 0.08); color: var(--destructive); }

.btn:disabled { opacity: 0.4; pointer-events: none; }

/* ==== Cards / generic ==== */

.card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.grid-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.stat-tile .stat-l { font-size: 10px; color: var(--muted-fg); }
.stat-tile .stat-v { font-size: 19px; font-weight: 700; font-family: var(--font-mono); margin-top: 3px; }
.stat-tile .stat-d { font-size: 10px; font-family: var(--font-mono); color: var(--success); margin-top: 2px; }

/* ==== Avatars / badges ==== */

.avatar {
  position: relative;
  flex-shrink: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(155deg, #4f8ef7, #2856b8);
  user-select: none;
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.md { width: 46px; height: 46px; font-size: 15px; }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }

.avatar img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.avatar .online-dot {
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 9px;
  height: 9px;
  background: var(--success);
  border-radius: 50%;
  border: 2px solid var(--card);
}

.tg-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 9px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--primary);
  background: rgba(42, 171, 238, 0.14);
  line-height: 1.5;
}

.unread-badge {
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: var(--primary);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.chip {
  font-size: 9px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-fg);
  border-radius: 4px;
  font-family: var(--font-mono);
}

/* ==== Inbox layout ==== */

.inbox {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

/* Chat list panel */
.chatlist-panel {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border-soft);
  background: var(--card);
}

.chatlist-search {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border-soft);
  flex-shrink: 0;
}

.search-input-wrap { position: relative; }
.search-input-wrap svg {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  stroke: var(--dim);
  fill: none;
  stroke-width: 2;
}
.search-input-wrap input {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border-soft);
  color: var(--fg);
  font-size: 13px;
  border-radius: var(--radius-md);
  padding: 5px 8px 5px 26px;
  outline: none;
  transition: border-color 0.15s ease;
}
.search-input-wrap input:focus { border-color: rgba(42, 171, 238, 0.4); }
.search-input-wrap input::placeholder { color: var(--dim); }

.chatlist-count {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--dim);
  flex-shrink: 0;
}

.chatlist-scroll { flex: 1; overflow-y: auto; overscroll-behavior-y: contain; }

.chatlist-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 160px;
  color: var(--dim);
  gap: 8px;
}
.chatlist-empty svg { width: 30px; height: 30px; stroke: currentColor; fill: none; stroke-width: 1.5; opacity: 0.5; }
.chatlist-empty p { font-size: 12px; margin: 0; }

.chat-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-soft);
  text-align: left;
  transition: background-color 0.12s ease;
}
.chat-row:active, .chat-row.active { background: rgba(42, 171, 238, 0.07); }

.chat-row-body { flex: 1; min-width: 0; }
.chat-row-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.chat-row-name { font-size: 14.5px; font-weight: 500; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-row-time { font-size: 11px; font-family: var(--font-mono); color: var(--dim); flex-shrink: 0; }
.chat-row-bottom { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 4px; }
.chat-row-preview { font-size: 13px; color: var(--muted-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.chat-row-meta { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

/* Chat thread */
.thread-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.thread-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  text-align: center;
}
.thread-empty svg { width: 44px; height: 44px; stroke: currentColor; fill: none; stroke-width: 1.2; opacity: 0.25; margin-bottom: 10px; }

.thread-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(10, 14, 26, 0.7);
}

.thread-back {
  display: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}
.thread-back svg { width: 19px; height: 19px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.thread-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
  text-align: left;
  border-radius: var(--radius-md);
  padding: 4px 6px;
  margin: -4px -6px;
  transition: background-color 0.12s ease;
}
.thread-header-main:active { background: rgba(255, 255, 255, 0.06); }

.thread-header-info { min-width: 0; flex: 1; }
.thread-header-name { font-size: 13px; font-weight: 600; color: #fff; display: flex; align-items: center; gap: 6px; }
.thread-header-sub { font-size: 10px; color: var(--dim); margin-top: 1px; }

.thread-header-actions { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.icon-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-fg);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.icon-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:active { background: rgba(255, 255, 255, 0.06); }
.icon-btn.on { color: var(--primary); background: rgba(42, 171, 238, 0.1); }

.thread-messages {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.date-sep {
  align-self: center;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--dim);
  background: var(--card);
  border: 1px solid var(--border-soft);
  padding: 3px 10px;
  border-radius: 999px;
  margin: 10px 0 8px;
}

.msg-row { display: flex; margin-top: 8px; position: relative; touch-action: pan-y; }
.msg-row.out { justify-content: flex-end; }
.msg-row.in { justify-content: flex-start; }

/* Swipe-to-reply: the bubble slides right under the finger/pointer, a reply icon
   fades in behind it, and it springs back on release (see loadOlderMessages'
   sibling handlers in inbox.html for the pointer tracking). */
.msg-swipe-icon {
  position: absolute;
  left: 6px;
  top: 50%;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(0.6);
  transition: opacity 0.15s ease, transform 0.15s ease, background 0.15s ease;
}
.msg-swipe-icon svg { width: 14px; height: 14px; stroke: var(--primary); fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.msg-swipe-icon.ready { background: var(--primary); }
.msg-swipe-icon.ready svg { stroke: #fff; }
.msg-row .msg-bubble { transition: transform 0.2s ease; }
.msg-row.swiping .msg-bubble { transition: none; }

.msg-flash .bubble { animation: msg-flash-anim 0.9s ease; }
@keyframes msg-flash-anim {
  0% { box-shadow: 0 0 0 2px var(--primary); }
  100% { box-shadow: 0 0 0 2px transparent; }
}

.msg-quote {
  display: block;
  padding: 2px 6px;
  margin-bottom: 4px;
  border-radius: 4px;
  border-left: 2px solid currentColor;
  cursor: pointer;
  max-width: 100%;
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-row.in .msg-quote { background: rgba(127, 127, 127, 0.12); color: var(--primary); }
.msg-row.out .msg-quote { background: rgba(255, 255, 255, 0.18); color: #fff; }

.msg-bubble { max-width: 72%; min-width: 48px; }
.msg-bubble .bubble {
  padding: 8px 12px 7px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.45;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg-row.in .bubble { background: var(--secondary); color: var(--fg); border-bottom-left-radius: 4px; border: 1px solid var(--border-soft); }
.msg-row.out .bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.msg-deleted .bubble { opacity: 0.6; }
.msg-deleted .msg-text { text-decoration: line-through; text-decoration-color: rgba(255, 255, 255, 0.4); }

.msg-deleted-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--destructive);
}
.msg-deleted-badge svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.msg-text { white-space: pre-wrap; }

.msg-edit-history { margin-top: 4px; }
.msg-edit-history-body {
  margin-top: 6px;
  padding-left: 9px;
  border-left: 2px solid rgba(127, 127, 127, 0.35);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg-edit-old-label {
  font-size: 9px;
  opacity: 0.6;
  margin-bottom: 2px;
}
.msg-edit-old-text {
  font-size: 12px;
  opacity: 0.8;
  text-decoration: line-through;
  text-decoration-color: rgba(127, 127, 127, 0.5);
  white-space: pre-wrap;
}

.msg-media-img, .msg-media-video {
  display: block;
  max-width: 240px;
  max-height: 280px;
  width: 100%;
  border-radius: 10px;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.2);
}
.msg-media-note {
  display: block;
  width: 180px;
  height: 180px;
  max-width: 100%;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 4px;
}
.msg-media-sticker { display: block; max-width: 120px; max-height: 120px; margin-bottom: 4px; }
.msg-media-sticker-fallback { font-size: 12.5px; opacity: 0.85; }
.msg-media-audio { width: 230px; max-width: 100%; margin-bottom: 4px; }
.msg-media-filename { font-size: 11px; opacity: 0.75; margin: -2px 0 4px; }

.msg-media-doc {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  margin-bottom: 4px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
  color: inherit;
}
.msg-media-doc svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; flex-shrink: 0; }
.msg-media-doc-info { display: flex; flex-direction: column; min-width: 0; }
.msg-media-doc-name { font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.msg-media-doc-size { font-size: 10px; opacity: 0.7; }

.msg-meta { display: flex; align-items: center; gap: 4px; margin-top: 3px; }
.msg-row.out .msg-meta { justify-content: flex-end; }
.msg-time { font-size: 9px; font-family: var(--font-mono); color: var(--dim); }
.msg-edited {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  opacity: 0.8;
}
.msg-row.in .msg-edited { color: var(--muted-fg); }
.msg-row.out .msg-edited { color: rgba(255, 255, 255, 0.85); }
.msg-edited svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.chat-row-edited {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  color: var(--dim);
}
.chat-row-edited svg { width: 11px; height: 11px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.msg-status svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.msg-status.pending { color: var(--dim); }
.msg-status.sent { color: var(--primary); }
.msg-status.failed { color: var(--destructive); }

.thread-reply {
  flex-shrink: 0;
  padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border-soft);
  background: rgba(10, 14, 26, 0.7);
}
.thread-reply-row { display: flex; align-items: flex-end; gap: 8px; }
.thread-reply-input {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--secondary);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 3px 5px 3px 12px;
  transition: border-color 0.15s ease;
}
.thread-reply-input:focus-within { border-color: rgba(42, 171, 238, 0.35); }
.thread-reply-input input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--fg);
  padding: 5px 0;
}
.thread-reply-input input::placeholder { color: var(--dim); }

.thread-reply-quote {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: var(--secondary);
  border-left: 3px solid var(--primary);
}
.thread-reply-quote-body { flex: 1; min-width: 0; }
.thread-reply-quote-label { font-size: 9.5px; font-weight: 600; color: var(--primary); line-height: 1.3; }
.thread-reply-quote-text {
  font-size: 11px;
  line-height: 1.3;
  color: var(--secondary-fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.thread-reply-quote-close {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
}
.thread-reply-quote-close svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

.send-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.send-btn svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.2; margin-left: 1px; }
.send-btn:disabled { opacity: 0.35; }
.send-btn:not(:disabled):active { transform: scale(0.92); }

.thread-foot-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 9px;
  font-family: var(--font-mono);
  color: var(--dim);
}
.thread-foot-note .rec { display: flex; align-items: center; gap: 4px; }

/* Right info panel */
.right-panel {
  width: 250px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-soft);
  background: var(--card);
  display: flex;
  flex-direction: column;
}

.right-panel-body { flex: 1; overflow-y: auto; overscroll-behavior-y: contain; padding: 16px; }

.right-panel-profile { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 8px 0 16px; }
.right-panel-profile h3 { font-size: 13px; font-weight: 600; color: #fff; margin: 10px 0 0; }
.right-panel-profile p { font-size: 11px; color: var(--muted-fg); margin: 2px 0 0; }

.info-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border-soft);
}
.info-row svg { width: 14px; height: 14px; stroke: var(--dim); fill: none; stroke-width: 2; flex-shrink: 0; }
.info-row .info-l { font-size: 9px; color: var(--dim); }
.info-row .info-v { font-size: 12px; color: var(--secondary-fg); font-family: var(--font-mono); }

.right-panel-close {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
}

/* ==== Responsive: collapse to single pane on narrow (mobile) viewports ==== */

@media (max-width: 880px) {
  .right-panel { display: none; }
  .right-panel.open {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 40;
    width: 100%;
    border-left: none;
  }
  .right-panel-close { display: flex; }
}

@media (max-width: 700px) {
  .sidebar { width: 52px; }

  .inbox.show-thread .chatlist-panel { display: none; }
  .inbox:not(.show-thread) .thread-panel { display: none; }

  .chatlist-panel { width: 100%; border-right: none; }
  .thread-back { display: flex; }
}

/* ==== Forms shared ==== */

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; color: var(--muted-fg); margin-bottom: 6px; }
.field input[type="text"], .field select, .field textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--border-soft);
  color: var(--fg);
  border-radius: var(--radius-md);
  padding: 9px 12px;
  font-size: 16px;
  outline: none;
  resize: none;
  transition: border-color 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(42, 171, 238, 0.4); }

.toggle {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  position: relative;
  flex-shrink: 0;
  transition: background-color 0.15s ease;
}
.toggle.on { background: var(--primary); }
.toggle .knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.15s ease;
}
.toggle.on .knob { transform: translateX(16px); }

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

/* ==== Kanban (CRM) ==== */

.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 6px; }
.kanban-col { width: 220px; flex-shrink: 0; }
.kanban-col-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kanban-col-title { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; }
.kanban-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 11px;
  margin-bottom: 8px;
}
.kanban-card-name { font-size: 12px; font-weight: 500; color: var(--fg); }
.kanban-card-sub { font-size: 10px; color: var(--muted-fg); margin-top: 1px; }
.kanban-card-value { font-size: 11px; font-family: var(--font-mono); font-weight: 600; margin-top: 6px; }
.kanban-add {
  width: 100%;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  font-size: 10px;
  color: var(--dim);
  text-align: center;
}

/* ==== Progress / bars ==== */

.progress-track { height: 7px; background: rgba(255, 255, 255, 0.05); border-radius: 999px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; transition: width 0.2s ease; }

.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 110px; }
.bar-chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-chart-bar { width: 100%; border-radius: 3px 3px 0 0; background: linear-gradient(to top, rgba(42,171,238,0.4), rgba(42,171,238,0.85)); }

/* ==== Plan cards ==== */

.plans-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.plan-card {
  background: var(--card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 15px;
  transition: border-color 0.15s ease;
}
.plan-card.current { box-shadow: 0 0 0 1px var(--primary) inset; }
.plan-name { font-size: 13px; font-weight: 600; }
.plan-price { font-size: 18px; font-weight: 700; font-family: var(--font-mono); color: #fff; margin-top: 2px; }
.plan-price span { font-size: 11px; font-weight: 400; color: var(--muted-fg); }
.plan-features { margin-top: 10px; display: flex; flex-direction: column; gap: 6px; }
.plan-feature { display: flex; align-items: flex-start; gap: 6px; font-size: 10.5px; color: var(--secondary-fg); }
.plan-feature svg { width: 12px; height: 12px; margin-top: 2px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 2.5; }

/* ==== Empty state ==== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  color: var(--dim);
  text-align: center;
}
.empty-state svg { width: 40px; height: 40px; stroke: currentColor; fill: none; stroke-width: 1.3; opacity: 0.35; margin-bottom: 12px; }
.empty-state p { font-size: 12px; margin: 0; }
