* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ─── Fallback (garante visibilidade mesmo sem tema) ─── */
:root {
  --accent:         #F2FF33;
  --accent-dim:     rgba(242, 255, 51, 0.10);
  --accent-border:  rgba(242, 255, 51, 0.25);
  --accent-text:    #000000;
  --bg-app:         #0c0c0c;
  --bg-sidebar:     #0f0f0f;
  --bg-main:        #111111;
  --bg-card:        #181818;
  --bg-input:       #1c1c1c;
  --bg-hover:       #222222;
  --border:         rgba(255, 255, 255, 0.07);
  --text-primary:   #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.55);
  --text-hint:      rgba(255, 255, 255, 0.25);
  --font-main:      'Barlow', sans-serif;
  --sidebar-width:  230px;
  --green:          #22c55e;
  --green-dim:      rgba(34, 197, 94, 0.12);
  --yellow:         #eab308;
  --yellow-dim:     rgba(234, 179, 8, 0.12);
  --red:            #ef4444;
  --red-dim:        rgba(239, 68, 68, 0.12);
  --radius:         12px;
  --radius-sm:      8px;
}

/* ─── Theme: Mata-Mata ─── */
:root[data-theme="matamata"] {
  --accent: #F2FF33;
  --accent-dim: rgba(242, 255, 51, 0.10);
  --accent-border: rgba(242, 255, 51, 0.25);
  --accent-text: #000000;
  --bg-app: #0c0c0c;
  --bg-sidebar: #0f0f0f;
  --bg-main: #111111;
  --bg-card: #181818;
  --bg-input: #1c1c1c;
  --bg-hover: #222222;
  --border: rgba(255, 255, 255, 0.07);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.50);
  --text-hint: rgba(255, 255, 255, 0.22);
  --font-main: 'Barlow', sans-serif;
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.12);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

/* ─── Theme: Grafeno ─── */
:root[data-theme="grafeno"] {
  --accent: #ffffff;
  --accent-dim: rgba(255, 255, 255, 0.07);
  --accent-border: rgba(255, 255, 255, 0.20);
  --accent-text: #000000;
  --bg-app: #080808;
  --bg-sidebar: #0a0a0a;
  --bg-main: #0e0e0e;
  --bg-card: #131313;
  --bg-input: #181818;
  --bg-hover: #1c1c1c;
  --border: rgba(255, 255, 255, 0.06);
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.50);
  --text-hint: rgba(255, 255, 255, 0.22);
  --font-main: 'Syne', sans-serif;
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.12);
  --yellow: #eab308;
  --yellow-dim: rgba(234, 179, 8, 0.12);
  --red: #ef4444;
  --red-dim: rgba(239, 68, 68, 0.12);
  --radius: 12px;
  --radius-sm: 8px;
}

html, body {
  width: 100%;
  height: 100%;
  background: var(--bg-app);
  color: var(--text-primary);
  font-family: var(--font-main);
  line-height: 1.5;
}

/* ─── Theme transition ─── */
body, .sidebar, .card, .connection-box, .queue-item,
input, select, textarea, button,
.nav-item, .refresh-btn, .pagination button {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* ─── Layout ─── */
.layout {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-app);
}

/* ─── Sidebar ─── */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  max-width: var(--sidebar-width);
  height: 100vh;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px 10px;
}

.sidebar-header {
  padding: 0 0 8px;
}

/* ─── Logo Toggle ─── */
.logo-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: none;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  position: relative;
}

.logo-toggle:hover {
  background: var(--accent-dim);
  border-color: var(--border);
}

.logo-img {
  height: 28px;
  width: auto;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.logo-tenant {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

.logo-switch-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-hint);
  opacity: 0;
  transition: opacity 0.2s;
}

.logo-toggle:hover .logo-switch-icon {
  opacity: 1;
}

.connection-box {
  margin: 0 0 12px;
  padding: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.connection-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.phone-number {
  margin-top: 6px;
  padding: 5px 10px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.3px;
}

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

.status-dot.connected {
  background: var(--green);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 6px rgba(34, 197, 94, 0.6); }
  50% { box-shadow: 0 0 12px rgba(34, 197, 94, 0.9), 0 0 4px rgba(34, 197, 94, 0.4); }
}

.status-dot.initializing,
.status-dot.qr,
.status-dot.authenticated {
  background: var(--yellow);
  animation: blink 1.4s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.qr-area {
  margin-top: 14px;
  text-align: center;
}

.qr-area p {
  font-size: 0.75rem;
  color: var(--text-hint);
  margin-bottom: 10px;
}

.qr-frame {
  background: #fff;
  border-radius: var(--radius-sm);
  padding: 8px;
  display: inline-block;
}

.qr-frame img {
  width: 180px;
  height: 180px;
  display: block;
}

/* ─── Nav ─── */
.sidebar-nav {
  flex: 1;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 10px;
  background: none;
  border: none;
  border-left: 3px solid transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}

.nav-item + .nav-item {
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

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

.nav-item.active {
  border-left-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.nav-icon {
  display: flex;
  align-items: center;
  opacity: 0.7;
}

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

/* ─── Sidebar Footer ─── */
.sidebar-footer {
  padding: 8px 0 0;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-hint);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.refresh-btn:hover {
  color: var(--accent);
  border-color: var(--accent-border);
  background: var(--accent-dim);
}

.version-text {
  font-size: 10px;
  color: var(--text-hint);
  opacity: 0.5;
  letter-spacing: 0.5px;
}

/* ─── Main ─── */
.main {
  flex: 1;
  min-width: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--bg-main);
  position: relative;
}

.page-header {
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.page-header-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: var(--accent-dim);
  border-radius: var(--radius);
  color: var(--accent);
  flex-shrink: 0;
}

.page-header h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.3px;
  margin-bottom: 2px;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-hint);
}

.tab-content {
  display: none;
  width: 100%;
  padding: 36px 48px;
}

.tab-content.active {
  display: block;
}

/* ─── Card ─── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

/* ─── QR Overlay ─── */
.qr-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 999;
}

.qr-overlay-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 48px;
  width: 380px;
  max-width: 90vw;
}

.qr-overlay-card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 16px 0 6px;
}

.qr-overlay-card p {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

.qr-overlay-frame {
  background: #fff;
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  width: 220px;
  height: 220px;
}

.qr-overlay-frame img {
  width: 200px;
  height: 200px;
  display: block;
  object-fit: contain;
}

.qr-hint {
  font-size: 0.75rem;
  color: var(--text-hint);
}

/* ─── Form ─── */
.schedule-form {
  width: 100%;
  max-width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
  align-items: start;
}

.schedule-form > .form-group {
  grid-column: 1 / -1;
}

.schedule-form > .form-row {
  grid-column: 1 / -1;
}

.schedule-form > .btn-primary {
  grid-column: 1 / -1;
  max-width: 100%;
}

.form-group {
  margin-bottom: 22px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.label-hint {
  font-weight: 400;
  text-transform: none;
  color: var(--text-hint);
  letter-spacing: 0;
}

.form-group select,
.form-group input[type="text"],
.form-group textarea {
  width: 100%;
  padding: 0 14px;
  height: 40px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group select:focus,
.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-group textarea {
  resize: vertical;
  min-height: 110px;
  height: auto;
  padding: 12px 14px;
}

.form-group select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%239ca3b4' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
}

/* Input icon wrapper */
.input-icon-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-hint);
  z-index: 1;
}

.form-group .input-icon-wrapper input[type="text"] {
  padding-left: 40px;
}

.file-input-wrapper {
  position: relative;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
}

.file-input-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  background: var(--bg-input);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  color: var(--text-hint);
  font-size: 0.85rem;
  transition: border-color 0.2s;
}

.file-input-wrapper:hover .file-input-display {
  border-color: var(--accent);
  color: var(--text-secondary);
}

.image-preview {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.image-preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.btn-remove {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--red-dim);
  color: var(--red);
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-remove:hover {
  background: rgba(239, 68, 68, 0.2);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 42px;
  padding: 0 24px;
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s, transform 0.15s, box-shadow 0.3s, filter 0.3s;
}

.btn-primary:hover {
  filter: brightness(0.9);
  box-shadow: 0 4px 16px var(--accent-dim);
}

.btn-primary:active {
  transform: scale(0.98);
}

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

/* Button spinner */
.btn-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  border-top-color: var(--accent-text);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ─── Animations ─── */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ─── Queue Filters ─── */
.queue-filters {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--accent-border);
  color: var(--accent);
  background: var(--accent-dim);
}

.filter-btn.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}

/* ─── Queue List ─── */
.queue-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.queue-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
  animation: fadeInUp 0.4s ease both;
}

.queue-item.status-pendente { border-left-color: var(--yellow); }
.queue-item.status-enviado { border-left-color: var(--green); }
.queue-item.status-falhou { border-left-color: var(--red); }

.queue-item:hover {
  border-color: rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.02);
  transform: translateY(-1px);
}

.queue-item.status-pendente:hover { border-left-color: var(--yellow); }
.queue-item.status-enviado:hover { border-left-color: var(--green); }
.queue-item.status-falhou:hover { border-left-color: var(--red); }

.queue-time {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-hint);
  white-space: nowrap;
  min-width: 100px;
}

.queue-time .queue-date {
  display: block;
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-hint);
  margin-top: 2px;
}

.queue-body {
  flex: 1;
  min-width: 0;
}

.queue-msg {
  display: flex;
  align-items: center;
  gap: 8px;
}

.queue-msg-text {
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.queue-group {
  font-size: 0.78rem;
  color: var(--text-hint);
  margin-top: 2px;
}

.queue-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.status-text {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: capitalize;
}

.status-text.pendente { color: var(--yellow); }
.status-text.enviado { color: var(--green); }
.status-text.falhou { color: var(--red); }

.queue-actions {
  flex-shrink: 0;
}

.btn-cancel {
  background: none;
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--red);
  padding: 5px 14px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-cancel:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* Eye icon button */
.btn-eye {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-hint);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.btn-eye:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.empty-state {
  text-align: center;
  padding: 80px 24px;
  color: var(--text-hint);
  animation: fadeInUp 0.5s ease both;
}

.empty-state svg {
  margin-bottom: 20px;
  opacity: 0.2;
}

.empty-state p {
  font-size: 0.92rem;
  line-height: 1.6;
  max-width: 300px;
  margin: 0 auto;
}

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

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

th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-hint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
  vertical-align: middle;
  transition: background 0.15s;
}

.empty-cell {
  text-align: center;
  color: var(--text-hint);
  padding: 64px 14px;
  font-size: 0.9rem;
}

tbody tr {
  animation: fadeInUp 0.35s ease both;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.msg-preview {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arquivo-cell {
  text-align: center;
  width: 70px;
}

.text-muted {
  color: var(--text-secondary);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: capitalize;
}

.badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.badge.pendente {
  background: var(--yellow-dim);
  color: var(--yellow);
}
.badge.pendente::before { background: var(--yellow); }

.badge.enviado {
  background: var(--green-dim);
  color: var(--green);
}
.badge.enviado::before { background: var(--green); }

.badge.falhou {
  background: var(--red-dim);
  color: var(--red);
}
.badge.falhou::before { background: var(--red); }

/* ─── Pagination ─── */
.pagination {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.pagination button {
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 7px 13px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s;
}

.pagination button:hover {
  border-color: var(--accent);
  color: var(--text-primary);
}

.pagination button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* ─── Image Modal ─── */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
}

.image-modal-body {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  z-index: 1;
  animation: fadeInUp 0.3s ease;
}

.image-modal-body img {
  max-width: 100%;
  max-height: 85vh;
  border-radius: var(--radius);
  object-fit: contain;
  display: block;
}

.image-modal-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s;
  z-index: 2;
}

.image-modal-close:hover {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

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

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 500;
  color: #fff;
  animation: toastIn 0.3s ease;
  min-width: 280px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

@keyframes toastIn {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .layout {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  .sidebar {
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    height: auto;
    padding: 10px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .sidebar-nav {
    flex-direction: row;
    padding: 8px 12px;
    overflow-x: auto;
  }

  .nav-item {
    white-space: nowrap;
    padding: 8px 12px;
    font-size: 0.82rem;
    border-left: none;
    border-bottom: 3px solid transparent;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  }

  .nav-item + .nav-item {
    border-top: none;
  }

  .nav-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--accent);
  }

  .main {
    height: auto;
    overflow-y: visible;
  }

  .tab-content {
    padding: 24px 16px;
  }

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

  .card {
    padding: 20px;
  }

  .qr-overlay-card {
    margin: 16px;
    padding: 28px 24px;
  }

  .page-header-icon {
    width: 36px;
    height: 36px;
  }

  .page-header-icon svg {
    width: 18px;
    height: 18px;
  }
}

/* ─── Login Screen ─── */
.login-screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-app, #0c0c0c);
  z-index: 9999;
  animation: fadeInUp 0.3s ease;
}

.login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 380px;
  background: var(--bg-card, #181818);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 16px;
  padding: 40px;
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 600;
  color: #fff;
  margin-top: 4px;
}

.login-logo p {
  font-size: 14px;
  color: rgba(255,255,255,0.5);
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form input {
  width: 100%;
  padding: 12px 14px;
  background: var(--bg-input, #1c1c1c);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-radius: 9px;
  color: #fff;
  font-family: var(--font-main, 'Barlow', sans-serif);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login-form input:focus {
  border-color: rgba(242, 255, 51, 0.4);
  box-shadow: 0 0 0 3px rgba(242, 255, 51, 0.1);
}

.login-form input::placeholder {
  color: rgba(255,255,255,0.25);
}

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

#loginBtn {
  width: 100%;
  height: 44px;
  background: #F2FF33;
  color: #000;
  font-family: var(--font-main, 'Barlow', sans-serif);
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 9px;
  cursor: pointer;
  transition: filter 0.15s;
}

#loginBtn:hover {
  filter: brightness(0.9);
}

#loginBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.login-version {
  margin-top: 24px;
  font-size: 11px;
  color: rgba(255,255,255,0.2);
}

/* ─── Logout Button ─── */
.logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 6px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-hint);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.logout-btn:hover {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

/* ─── Flatpickr Theme ─── */
.flatpickr-calendar {
  background: var(--bg-card) !important;
  border: 1px solid var(--border) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4) !important;
  font-family: var(--font-main) !important;
}
.flatpickr-day {
  color: var(--text-secondary) !important;
  border-radius: 6px !important;
}
.flatpickr-day:hover {
  background: var(--accent-dim) !important;
  color: var(--accent) !important;
  border-color: transparent !important;
}
.flatpickr-day.selected, .flatpickr-day.selected:hover {
  background: var(--accent) !important;
  color: var(--accent-text) !important;
  border-color: var(--accent) !important;
}
.flatpickr-day.today {
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}
.flatpickr-day.flatpickr-disabled {
  color: var(--text-hint) !important;
}
.flatpickr-months .flatpickr-month,
.flatpickr-current-month,
.flatpickr-monthDropdown-months {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
  fill: var(--text-primary) !important;
}
.flatpickr-weekday {
  color: var(--text-hint) !important;
  background: var(--bg-card) !important;
}
.flatpickr-prev-month, .flatpickr-next-month {
  fill: var(--text-secondary) !important;
}
.flatpickr-time input {
  color: var(--text-primary) !important;
  background: var(--bg-card) !important;
}
.flatpickr-time .flatpickr-time-separator {
  color: var(--text-secondary) !important;
}
