/* =============================================
   Simplengat Manager — Dark Dashboard CSS
   ============================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #222535;
  --surface3: #2a2d3e;
  --border: #2e3248;
  --accent: #6c63ff;
  --accent2: #4ecdc4;
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;
  --blue: #3b82f6;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --sidebar-w: 240px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  display: flex;
  min-height: 100vh;
  line-height: 1.5;
}

/* ── Sidebar ─────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform .3s ease;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 18px;
  color: white;
}

.logo-title {
  font-weight: 700;
  font-size: 15px;
  display: block;
}

.logo-sub {
  font-size: 11px;
  color: var(--text3);
}

.nav {
  padding: 12px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  text-decoration: none;
  font-weight: 500;
  transition: all .2s;
}

.nav-item:hover {
  background: var(--surface2);
  color: var(--text);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(108, 99, 255, .2), transparent);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

.nav-icon {
  font-size: 16px;
}

.bot-status-indicator {
  margin: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text3);
  flex-shrink: 0;
  transition: background .3s;
}

.status-dot.ready {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
  animation: pulse 2s infinite;
}

.status-dot.qr_ready {
  background: var(--yellow);
}

.status-dot.disconnected {
  background: var(--red);
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .5;
  }
}

/* ── Main ────────────────────────────────── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

.topbar-title {
  font-weight: 600;
  font-size: 16px;
}

.topbar-right {
  margin-left: auto;
}

.topbar-date {
  color: var(--text3);
  font-size: 13px;
}

.content {
  padding: 24px;
  flex: 1;
}

/* ── Cards ───────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.card-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 16px;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stat-label {
  color: var(--text3);
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
}

.stat-sub {
  font-size: 12px;
  color: var(--text3);
}

.stat-card.green .stat-value {
  color: var(--green);
}

.stat-card.yellow .stat-value {
  color: var(--yellow);
}

.stat-card.blue .stat-value {
  color: var(--blue);
}

.stat-card.purple .stat-value {
  color: var(--accent);
}

/* ── Page grid ───────────────────────────── */
.page-grid {
  display: grid;
  gap: 20px;
}

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

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

@media (max-width: 900px) {

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

/* ── Table ───────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 10px 14px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text3);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background: var(--surface2);
}

/* ── Badges ──────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green {
  background: rgba(34, 197, 94, .15);
  color: var(--green);
}

.badge-yellow {
  background: rgba(245, 158, 11, .15);
  color: var(--yellow);
}

.badge-red {
  background: rgba(239, 68, 68, .15);
  color: var(--red);
}

.badge-blue {
  background: rgba(59, 130, 246, .15);
  color: var(--blue);
}

.badge-gray {
  background: rgba(100, 116, 139, .15);
  color: var(--text3);
}

/* ── Progress bar ────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .5s ease;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.progress-fill.done {
  background: linear-gradient(90deg, var(--green), var(--accent2));
}

/* ── Buttons ─────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all .2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
}

.btn-primary:hover {
  background: #5a52d5;
  transform: translateY(-1px);
}

.btn-success {
  background: var(--green);
  color: white;
}

.btn-success:hover {
  opacity: .85;
}

.btn-danger {
  background: var(--red);
  color: white;
}

.btn-danger:hover {
  opacity: .85;
}

.btn-ghost {
  background: var(--surface2);
  color: var(--text2);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--surface3);
  color: var(--text);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* ── Forms ───────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  transition: border-color .2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.form-group select option {
  background: var(--surface2);
}

.form-row {
  display: flex;
  gap: 12px;
}

.form-row .form-group {
  flex: 1;
}

/* ── Schedule checkboxes ─────────────────── */
.day-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.day-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text3);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.day-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── Task type list ──────────────────────── */
.task-type-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 8px;
}

.task-type-item {
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 10px;
}

.task-type-item input {
  margin: 0;
}

.task-type-item .remove-btn {
  background: none;
  border: none;
  color: var(--red);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

/* ── Modal ───────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  z-index: 200;
  display: none;
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.95);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(600px, 90vw);
  max-height: 85vh;
  overflow-y: auto;
  z-index: 201;
  display: none;
  transition: transform .2s, opacity .2s;
}

.modal.open,
.modal-overlay.open {
  display: block;
}

.modal.open {
  transform: translate(-50%, -50%) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text3);
  font-size: 18px;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  padding: 24px;
}

/* ── Toast ───────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
}

.toast {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
  animation: slideIn .3s ease;
  max-width: 320px;
}

.toast.success {
  border-left: 3px solid var(--green);
}

.toast.error {
  border-left: 3px solid var(--red);
}

.toast.info {
  border-left: 3px solid var(--blue);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

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

/* ── Member Split‑Panel Layout ───────────── */
.members-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  align-items: start;
}

.members-list-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: sticky;
  top: 80px;
}

.member-form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  overflow-y: auto;
}

.member-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background .15s;
  border: 1px solid transparent;
}

.member-list-item:hover {
  background: var(--surface2);
}

.member-list-item.active {
  background: rgba(108, 99, 255, .1);
  border-color: var(--accent);
}

.member-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: white;
  margin-bottom: 12px;
}

.member-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 4px;
}

.member-phone {
  color: var(--text3);
  font-size: 12px;
  margin-bottom: 12px;
}

.member-days {
  font-size: 12px;
  color: var(--text2);
  margin-bottom: 12px;
}

.member-actions {
  display: flex;
  gap: 8px;
}

/* ── Friendly Form Inputs (fi-*) ─────────── */
.fi-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.fi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  letter-spacing: .3px;
}

.fi-hint {
  font-size: 11px;
  color: var(--text3);
}

.fi-input,
textarea.fi-input {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  width: 100%;
  transition: border-color .2s, box-shadow .2s;
  line-height: 1.5;
}

.fi-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(108, 99, 255, .15);
}

.fi-row {
  display: flex;
  gap: 12px;
}

.fi-section {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}

.fi-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

.fi-toggle-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color .2s;
}

.fi-toggle-card:hover {
  border-color: var(--accent);
}

.fi-toggle-card input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

/* ── Task Type Card ───────────────────────── */
.task-type-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  transition: border-color .2s;
}

.task-type-card:hover {
  border-color: var(--accent);
}

@media (max-width: 900px) {
  .members-layout {
    grid-template-columns: 1fr;
  }

  .members-list-panel {
    position: static;
  }
}


/* ── Attendance list ─────────────────────── */
.att-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.att-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.att-name {
  flex: 1;
  font-weight: 500;
}

/* ── Finance ─────────────────────────────── */
.finance-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.fin-stat {
  background: var(--surface2);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}

.fin-stat-label {
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 6px;
  text-transform: uppercase;
}

.fin-stat-value {
  font-size: 20px;
  font-weight: 700;
}

/* ── Report ──────────────────────────────── */
.report-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 20px;
  font-family: monospace;
  font-size: 13px;
  white-space: pre-wrap;
  line-height: 1.7;
  color: var(--text);
}

@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .sidebar-toggle {
    display: block;
  }

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

  .finance-summary {
    grid-template-columns: 1fr;
  }
}