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

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #050505;
  color: #f5f5f5;
}

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

/* LOGIN LAYOUT */

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at top, #1f2937 0, #020617 50%, #000 100%);
  padding: 24px 16px;
}

.login-card {
  max-width: 460px;
  width: 100%;
  background: rgba(9, 9, 11, 0.98);
  border-radius: 18px;
  border: 1px solid #1f2937;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  padding: 24px 22px 20px;
}

.login-logo {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fbbf24;
  margin-bottom: 4px;
}

.login-title {
  font-size: 18px;
  font-weight: 500;
  margin-bottom: 8px;
}

.login-subtitle {
  font-size: 13px;
  color: #d1d5db;
  margin-bottom: 18px;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.btn-login-primary,
.btn-login-secondary {
  border-radius: 999px;
  border: none;
  cursor: pointer;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-login-primary {
  background: linear-gradient(to right, #fbbf24, #f97316);
  color: #111827;
}

.btn-login-secondary {
  background: #111827;
  color: #e5e7eb;
  border: 1px solid #1f2937;
}

.btn-login-primary:hover,
.btn-login-secondary:hover {
  opacity: 0.95;
}

.login-note {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 6px;
}

/* APP SHELLS */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.staff-shell {
  min-height: 100vh;
  background: #050505;
  color: #f5f5f5;
  display: flex;
  flex-direction: column;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: #101010;
  border-right: 1px solid #262626;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  font-size: 20px;
  font-weight: 600;
  color: #f5d242;
}

.menu {
  list-style: none;
}

.menu-item {
  padding: 10px 12px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #dddddd;
  margin-bottom: 4px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}

.menu-item span.icon {
  width: 18px;
  text-align: center;
  opacity: 0.8;
}

.menu-item:hover {
  background: #1f1f1f;
  transform: translateX(1px);
}

.menu-item.active {
  background: #f4c842;
  color: #101010;
  font-weight: 600;
}

.menu-item.active span.icon {
  opacity: 0.9;
}

.sidebar-footer {
  margin-top: auto;
  font-size: 11px;
  color: #777;
  border-top: 1px solid #262626;
  padding-top: 10px;
}

/* Main layout */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  background: #080808;
  border-bottom: 1px solid #262626;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.topbar-title {
  font-size: 18px;
  font-weight: 500;
}

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

.tag-demo {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #1b2933;
  color: #cde4ff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn {
  border-radius: 6px;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-refresh {
  background: #1c293a;
  color: #e1ecff;
}

.btn-logout {
  background: #3d2322;
  color: #ffd6d0;
}

.btn:hover { opacity: 0.9; }

.content {
  padding: 16px 20px 24px;
  overflow: auto;
}

/* Screens */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

.screen-title {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.screen-subtitle {
  font-size: 13px;
  color: #b3b3b3;
  margin-bottom: 16px;
}

/* Cards */
.cards-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.card {
  background: #101010;
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid #262626;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  color: #c5c5c5;
}

.card-title {
  font-weight: 500;
}

.card-value {
  font-size: 26px;
  font-weight: 600;
  margin-top: 6px;
}

.card-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #a0a0a0;
}

/* Staff view tweaks */
.staff-content {
  max-width: 720px;
  margin: 0 auto;
}

.staff-card {
  margin-top: 8px;
}

.staff-divider {
  margin-top: 12px;
  margin-bottom: 10px;
  border-top: 1px dashed #27272a;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: #141414;
}

th, td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid #202020;
}

th {
  font-weight: 500;
  color: #bdbdbd;
}

tr:hover td {
  background: #151515;
  cursor: pointer;
}

/* Badges & Chips */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-status {
  background: #0d2c1b;
  color: #63f2a3;
}

.badge-tag {
  background: #33220f;
  color: #ffd78a;
}

.pill {
  font-size: 11px;
  border-radius: 999px;
  padding: 4px 9px;
  background: #111827;
  color: #c7d2fe;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Layout helpers */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1.3fr);
  gap: 16px;
}

.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mb-8 { margin-bottom: 8px; }

.section-heading {
  font-size: 14px;
  margin-bottom: 8px;
}

/* Inputs */
input, select, textarea {
  width: 100%;
  background: #080808;
  border-radius: 8px;
  border: 1px solid #262626;
  padding: 8px 10px;
  color: #f5f5f5;
  font-size: 13px;
}

label {
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
  color: #c5c5c5;
}

.field {
  margin-bottom: 10px;
}

.hint {
  font-size: 11px;
  color: #8d8d8d;
  margin-top: 4px;
}

/* Template cards */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.template-card {
  background: #101010;
  border-radius: 10px;
  border: 1px solid #262626;
  padding: 10px 11px;
  cursor: pointer;
  font-size: 13px;
  min-height: 76px;
}

.template-card.active {
  border-color: #f5d242;
  box-shadow: 0 0 0 1px rgba(245, 210, 66, 0.25);
}

.template-title {
  font-weight: 500;
  margin-bottom: 2px;
}

.template-desc {
  font-size: 12px;
  color: #b0b0b0;
}

/* Placeholder chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 1000px;
  background: #111827;
  color: #d1e2ff;
  font-size: 11px;
  margin-right: 6px;
  margin-bottom: 4px;
  cursor: pointer;
}

.chip span.key {
  background: #1f2937;
  padding: 1px 5px;
  border-radius: 999px;
  font-family: "SF Mono", Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
}

/* Message items & modal */
.msg-item {
  background: #050505;
  border-radius: 10px;
  border: 1px solid #262626;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 13px;
}

.msg-meta {
  font-size: 11px;
  color: #b3b3b3;
  margin-bottom: 3px;
  display: flex;
  justify-content: space-between;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal {
  background: #101010;
  border-radius: 12px;
  border: 1px solid #262626;
  padding: 16px 18px 14px;
  max-width: 640px;
  width: 100%;
  max-height: 80vh;
  overflow: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.modal-title {
  font-size: 16px;
  font-weight: 500;
}

.modal-close {
  border-radius: 999px;
  border: none;
  width: 26px;
  height: 26px;
  cursor: pointer;
  background: #1f2933;
  color: #e5e7eb;
  font-size: 14px;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  background: #111827;
  color: #e5e7eb;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid #1f2937;
  display: none;
  z-index: 30;
}

.usage-summary {
  font-size: 13px;
  margin-top: 4px;
}

/* Mobile menu toggle */
.mobile-menu-toggle {
  display: none;
  background: none;
  border: none;
  color: #f5f5f5;
  font-size: 20px;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
}

.mobile-menu-toggle:hover {
  background: #1f1f1f;
}

.mobile-close {
  display: none;
  background: none;
  border: none;
  color: #f5f5f5;
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
}

.mobile-close:hover {
  background: #1f1f1f;
}

/* Mobile sidebar overlay - moved to media query for proper cascade */

.mobile-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  display: none;
}

.mobile-backdrop.show {
  display: block;
}

/* Responsiveness */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
  }
  
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  
  .main {
    width: 100%;
  }
  
  .mobile-menu-toggle {
    display: block;
  }
  
  .mobile-close {
    display: flex;
  }
  
  .topbar {
    padding: 0 16px;
  }
  
  .topbar-title { 
    font-size: 16px;
    margin-left: 8px;
  }
  
  .topbar-actions {
    gap: 8px;
  }
  
  .two-col {
    grid-template-columns: minmax(0, 1fr);
  }
  
  .login-card {
    max-width: 100%;
  }
  
  .content {
    padding: 12px 16px 20px;
  }
  
  .cards-row {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
  }
}
