/* NEXUS admin console — shares the storefront's dark palette. */

:root {
  color-scheme: dark;
  --bg: #000;
  --bg-soft: #08080a;
  --panel: #0c0c0e;
  --card: #111114;
  --card-2: #16161a;
  --fg: #f5f5f7;
  --muted: #86868b;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --accent: #76b900;
  --accent-dim: #3f6b00;
  --accent-soft: rgba(118, 185, 0, 0.14);
  --danger: #ff4d4f;
  --danger-soft: rgba(255, 77, 79, 0.13);
  --warn: #f0a020;
  --radius: 14px;
  --sidebar-w: 236px;
  --topbar-h: 64px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "SF Pro Display", "Inter", "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

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

button {
  background: none;
  border: 0;
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

::selection {
  background: var(--accent);
  color: #000;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #2a2a2e;
  border-radius: 99px;
}

::-webkit-scrollbar-thumb:hover {
  background: #3a3a3f;
}

/* ------------------------------------------------------------------ */
/* Buttons / form primitives                                           */
/* ------------------------------------------------------------------ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s, opacity 0.2s;
}

.btn:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.28);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #061000;
  font-weight: 600;
}

.btn-primary:hover {
  background: #86cf0a;
  border-color: #86cf0a;
}

.btn-danger {
  border-color: rgba(255, 77, 79, 0.5);
  color: #ff7a7c;
}

.btn-danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
}

.btn-ghost {
  border-color: transparent;
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.06);
}

.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 7px;
}

.icon-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: var(--fg);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1px solid var(--line-strong);
  background: #0a0a0c;
  color: var(--fg);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(118, 185, 0, 0.15);
}

.input::placeholder,
.textarea::placeholder {
  color: #5a5a60;
}

.textarea {
  resize: vertical;
  min-height: 84px;
}

.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #888 50%),
    linear-gradient(135deg, #888 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > label,
.field-label {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  color: var(--fg);
  cursor: pointer;
}

.check input {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
  margin: 0;
}

.hint {
  font-size: 11.5px;
  color: var(--muted);
}

.pub {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ------------------------------------------------------------------ */
/* Shell                                                               */
/* ------------------------------------------------------------------ */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: var(--topbar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  flex: none;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), #3f6b00);
  box-shadow: 0 0 18px rgba(118, 185, 0, 0.35);
  flex: none;
}

.brand-name {
  font-weight: 600;
  letter-spacing: 0.16em;
  font-size: 14px;
}

.brand-sub {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: -3px;
}

.nav {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  overflow-y: auto;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13.5px;
  text-align: left;
  transition: background 0.18s, color 0.18s;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex: none;
  opacity: 0.8;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--fg);
}

.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.nav-item.active svg {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--accent);
  color: #061000;
  font-size: 10.5px;
  font-weight: 700;
  text-align: center;
  line-height: 18px;
}

.sidebar-foot {
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: #5a5a60;
}

.topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  z-index: 35;
}

.topbar h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.topbar-spacer {
  flex: 1;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  color: var(--muted);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid rgba(118, 185, 0, 0.4);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

.menu-toggle {
  display: none;
}

.content {
  margin-left: var(--sidebar-w);
  padding: calc(var(--topbar-h) + 26px) 28px 60px;
  min-height: 100vh;
}

.section {
  display: none;
  animation: fade-in 0.3s var(--ease);
}

.section.active {
  display: block;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.page-head h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.page-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ */
/* Cards / stats                                                       */
/* ------------------------------------------------------------------ */

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

.stat-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(118, 185, 0, 0.5), transparent);
  opacity: 0.5;
}

.stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat-value {
  margin-top: 12px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-value small {
  font-size: 13px;
  color: var(--muted);
  margin-left: 4px;
  font-weight: 400;
}

/* ------------------------------------------------------------------ */
/* Tables                                                              */
/* ------------------------------------------------------------------ */

.table-wrap {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 620px;
}

thead th {
  text-align: left;
  padding: 11px 14px;
  font-size: 10.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  white-space: nowrap;
}

tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.025);
}

tbody tr.clickable {
  cursor: pointer;
}

.cell-main {
  color: var(--fg);
  font-weight: 500;
}

.cell-sub {
  color: var(--muted);
  font-size: 11.5px;
}

.cell-mono {
  font-family: "SFMono-Regular", "JetBrains Mono", Consolas, monospace;
  font-size: 12px;
}

.product-cell {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 210px;
}

.thumb {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: #1a1a1d;
  border: 1px solid var(--line);
  flex: none;
}

.thumb-empty {
  display: grid;
  place-items: center;
  color: #555;
  font-size: 10px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid transparent;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-ok {
  color: var(--accent);
  background: var(--accent-soft);
}

.badge-muted {
  color: #9a9aa0;
  background: rgba(255, 255, 255, 0.06);
}

.badge-warn {
  color: var(--warn);
  background: rgba(240, 160, 32, 0.12);
}

.badge-danger {
  color: #ff7a7c;
  background: var(--danger-soft);
}

.badge-info {
  color: #61a8ff;
  background: rgba(97, 168, 255, 0.12);
}

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.table-empty {
  padding: 34px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.toolbar .select,
.toolbar .input {
  width: auto;
  min-width: 150px;
}

/* ------------------------------------------------------------------ */
/* Modal                                                               */
/* ------------------------------------------------------------------ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(6px);
}

.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}

.modal-body {
  padding: 22px;
}

.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  position: sticky;
  bottom: 0;
  background: var(--panel);
}

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.form-grid .span-2 {
  grid-column: span 2;
}

.inline-fields {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.image-pick {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.image-dropzone {
  padding: 12px;
  border: 1px dashed var(--line, #8290a5);
  border-radius: 10px;
}

.image-dropzone.is-dragging {
  border-color: #60a5fa;
  background: rgba(96, 165, 250, .12);
}

.image-preview {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  color: var(--muted);
  font-size: 12px;
}

.image-preview-item {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 10px;
  border: 1px dashed var(--line-strong);
  background: #0a0a0c;
  overflow: hidden;
}

.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-preview-cover,
.image-preview-remove {
  position: absolute;
  border-radius: 5px;
  background: rgba(0, 0, 0, .8);
  color: #fff;
}

.image-preview-cover {
  bottom: 4px;
  left: 4px;
  padding: 2px 4px;
}

.image-preview-remove {
  top: 4px;
  right: 4px;
  width: 25px;
  height: 25px;
  border: 1px solid rgba(255, 255, 255, .45);
  cursor: pointer;
}

.image-preview-remove:disabled {
  opacity: .5;
  cursor: default;
}

.file-input {
  font-size: 12px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Drawer                                                              */
/* ------------------------------------------------------------------ */

.drawer {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: flex;
  justify-content: flex-end;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}

.drawer-panel {
  width: min(520px, 100%);
  height: 100%;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--line-strong);
  box-shadow: -24px 0 60px rgba(0, 0, 0, 0.5);
  animation: slide-in 0.28s var(--ease);
}

@keyframes slide-in {
  from {
    transform: translateX(28px);
    opacity: 0.4;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}

.drawer-head h2 {
  margin: 0;
  font-size: 18px;
}

.drawer-body {
  padding: 20px 22px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.drawer-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.detail-block h3 {
  margin: 0 0 10px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

.detail-list {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px 14px;
  font-size: 13px;
}

.detail-list dt {
  color: var(--muted);
}

.detail-list dd {
  margin: 0;
  word-break: break-word;
}

.items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.item-row .item-name {
  flex: 1;
  font-size: 13px;
}

.item-row .item-qty {
  color: var(--muted);
  font-size: 12px;
}

.item-row .item-price {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}

.total-line {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  color: var(--muted);
}

.total-line.grand {
  color: var(--fg);
  font-weight: 600;
  font-size: 15px;
  border-top: 1px solid var(--line);
  margin-top: 6px;
  padding-top: 12px;
}

/* ------------------------------------------------------------------ */
/* Chat / conversations                                                */
/* ------------------------------------------------------------------ */

.chat-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h) - 120px);
  min-height: 480px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  overflow: hidden;
}

.conv-list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
  background: var(--bg-soft);
}

.conv-toolbar {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg-soft);
  z-index: 2;
}

.conv-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s;
}

.conv-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.conv-item.active {
  background: var(--accent-soft);
  box-shadow: inset 2px 0 0 var(--accent);
}

.conv-item-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.conv-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-time {
  margin-left: auto;
  font-size: 10.5px;
  color: #6c6c72;
  flex: none;
}

.conv-last {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conv-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 10.5px;
  color: #6c6c72;
}

.unread {
  margin-left: auto;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--accent);
  color: #061000;
  font-size: 10px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
}

.chat-pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--panel);
}

.chat-back {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  text-align: left;
}

.chat-back:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.04);
}

.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.chat-head .who {
  min-width: 0;
}

.chat-head .who strong {
  font-size: 14px;
  display: block;
}

.chat-head .who span {
  font-size: 11.5px;
  color: var(--muted);
}

.chat-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-head-actions .select {
  width: 170px;
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 12px;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.msg {
  max-width: 76%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg .bubble {
  padding: 9px 13px;
  border-radius: 13px;
  background: var(--card-2);
  border: 1px solid var(--line);
  font-size: 13.5px;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg .meta {
  font-size: 10.5px;
  color: #6c6c72;
  padding: 0 4px;
}

.msg.visitor {
  align-self: flex-start;
}

.msg.staff,
.msg.agent,
.msg.admin {
  align-self: flex-end;
}

.msg.staff .bubble,
.msg.agent .bubble,
.msg.admin .bubble {
  background: rgba(118, 185, 0, 0.12);
  border-color: rgba(118, 185, 0, 0.3);
}

.msg.staff .meta,
.msg.agent .meta,
.msg.admin .meta {
  text-align: right;
}

.chat-empty {
  flex: 1;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  padding: 30px;
  text-align: center;
}

.composer {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  resize: none;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: #0a0a0c;
  outline: none;
  font-size: 13.5px;
}

.composer textarea:focus {
  border-color: var(--accent);
}

/* ------------------------------------------------------------------ */
/* Settings                                                            */
/* ------------------------------------------------------------------ */

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

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.panel h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.panel .panel-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}

.panel .form {
  gap: 14px;
}

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

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.mail-status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Toast                                                               */
/* ------------------------------------------------------------------ */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 340px;
}

.toast {
  padding: 11px 14px;
  border-radius: 10px;
  background: #141418;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--accent);
  font-size: 12.5px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.25s var(--ease);
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.success {
  border-left-color: var(--accent);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ------------------------------------------------------------------ */
/* Login                                                               */
/* ------------------------------------------------------------------ */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(900px 500px at 50% -10%, rgba(118, 185, 0, 0.13), transparent 60%), #000;
}

.login-card {
  width: min(390px, 100%);
  background: rgba(12, 12, 14, 0.92);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.65);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}

.login-brand h1 {
  margin: 0;
  font-size: 17px;
  letter-spacing: 0.12em;
  font-weight: 600;
}

.login-brand p {
  margin: 1px 0 0;
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-card .btn-primary {
  margin-top: 6px;
  padding: 11px 18px;
  font-size: 14px;
}

.login-error {
  min-height: 18px;
  font-size: 12px;
  color: #ff7a7c;
}

.login-foot {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-size: 11px;
  color: #5f5f65;
  text-align: center;
}

/* ------------------------------------------------------------------ */
/* Responsive                                                          */
/* ------------------------------------------------------------------ */

@media (max-width: 1100px) {
  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 920px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.28s var(--ease);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.6);
  }

  body.nav-open .sidebar {
    transform: none;
  }

  .topbar {
    left: 0;
    padding: 0 16px;
  }

  .content {
    margin-left: 0;
    padding: calc(var(--topbar-h) + 20px) 16px 50px;
  }

  .menu-toggle {
    display: grid;
  }

  .chat-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .span-2 {
    grid-column: span 1;
  }

  .chat-layout {
    grid-template-columns: 1fr;
    height: calc(100vh - var(--topbar-h) - 130px);
  }

  .conv-list {
    display: block;
  }

  .chat-pane {
    display: none;
  }

  .chat-layout.chat-open .conv-list {
    display: none;
  }

  .chat-layout.chat-open .chat-pane {
    display: flex;
  }

  .chat-back {
    display: flex;
  }

  .msg {
    max-width: 88%;
  }
}
