/* ============================================================
   MAXXR CRM — internal dashboard styles
   Same brand tokens as the marketing site, dashboard layout.
   ============================================================ */
:root {
  --black: #010104;
  --white: #ffffff;
  --accent: #c2c7cf;
  --accent-light: #e8eaee;
  --grey: rgba(210, 210, 210, 0.8);
  --stroke: rgba(255, 255, 255, 0.1);
  --bg-alt: #0c0c0f;
  --card-bg: #0d0d10;
  --font: "Inter", Arial, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: var(--black);
  color: var(--white);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; background: none; border: none; color: inherit; }
a { color: var(--accent-light); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Auth ---------- */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 24px;
  overflow: hidden;
}
.auth-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% -10%, rgba(220,224,230,0.10), transparent 55%),
    radial-gradient(ellipse at 90% 90%, rgba(150,156,168,0.07), transparent 50%);
}
.auth-card {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.5);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}
.auth-brand em { font-style: normal; color: var(--grey); font-weight: 400; }
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-alt);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 9px;
  border-radius: 7px;
  font-size: 14px;
  color: var(--grey);
  transition: background 0.3s, color 0.3s;
}
.auth-tab.active { background: var(--white); color: var(--black); font-weight: 500; }
.auth-form .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.auth-form label, .modal-body label { font-size: 13px; color: rgba(255,255,255,0.7); }
.auth-form input, .auth-form select,
.modal-body input, .modal-body select, .modal-body textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--white);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 11px 13px;
  outline: none;
  width: 100%;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.auth-form select, .modal-body select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M6 9l6 6 6-6' stroke='%23ffffff' stroke-opacity='.55' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.auth-form select option, .modal-body select option { background: #101015; }
.auth-form input:focus, .auth-form select:focus,
.modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(200,205,214,0.15);
}
.auth-error { display: none; color: #ff8585; font-size: 13px; margin: 4px 0 10px; }
.auth-error.show { display: block; }
.auth-note { display: none; color: var(--accent-light); font-size: 13px; margin: 4px 0 10px; }
.auth-note.show { display: block; }
.btn-solid {
  width: 100%;
  background: var(--accent);
  color: var(--black);
  font-size: 15px;
  font-weight: 500;
  border-radius: 8px;
  padding: 12px;
  transition: filter 0.25s, transform 0.2s;
}
.btn-solid:hover { filter: brightness(1.08); }
.btn-solid:active { transform: scale(0.98); }
.btn-solid:disabled { opacity: 0.6; cursor: wait; }
.auth-foot { margin-top: 20px; font-size: 12.5px; color: rgba(255,255,255,0.45); text-align: center; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px;
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--bg-alt);
  border-right: 1px solid var(--stroke);
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.03em;
  padding: 4px 10px 20px;
}
.sidebar-brand em { font-style: normal; color: var(--grey); font-weight: 400; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--grey);
  font-size: 14.5px;
  text-decoration: none;
  transition: background 0.25s, color 0.25s;
}
.side-link:hover { background: rgba(255,255,255,0.05); color: var(--white); text-decoration: none; }
.side-link.active { background: rgba(255,255,255,0.08); color: var(--white); font-weight: 500; }
.side-link svg { flex: none; opacity: 0.85; }
.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--stroke);
  padding-top: 14px;
}
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.user-avatar {
  width: 34px; height: 34px;
  flex: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a2a31, #131317);
  border: 1px solid var(--stroke);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; color: var(--accent-light);
}
.user-meta { min-width: 0; }
.user-meta b { display: block; font-size: 13.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11.5px; color: var(--grey); }
.logout-btn { color: var(--grey); padding: 8px; border-radius: 8px; transition: background 0.25s, color 0.25s; }
.logout-btn:hover { background: rgba(255,255,255,0.06); color: var(--white); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--stroke);
  position: sticky;
  top: 0;
  background: rgba(1,1,4,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 20;
}
.menu-toggle { display: none; flex-direction: column; gap: 5px; padding: 8px; }
.menu-toggle span { width: 20px; height: 2px; background: var(--white); display: block; }
.page-title { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; flex: 1; }
.topbar-right .btn-solid { width: auto; padding: 9px 18px; font-size: 14px; border-radius: 8px; }

.content { padding: 28px; max-width: 1200px; width: 100%; }
.loading-state { color: var(--grey); padding: 60px 0; text-align: center; }

/* ---------- Cards / stats ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 18px 20px;
}
.stat-card b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -0.03em; }
.stat-card span { font-size: 13px; color: var(--grey); }

.panel {
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 24px;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--stroke);
}
.panel-head h3 { font-size: 15px; font-weight: 600; }
.panel-head .muted { font-size: 13px; color: var(--grey); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 20px; white-space: nowrap; }
th {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255,255,255,0.45);
  border-bottom: 1px solid var(--stroke);
}
tbody tr { border-bottom: 1px solid rgba(255,255,255,0.05); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,0.02); }
td .sub { display: block; font-size: 12px; color: var(--grey); }

.pill {
  display: inline-block;
  border-radius: 100px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--stroke);
  color: var(--grey);
  background: rgba(255,255,255,0.03);
}
.pill.hi { color: var(--black); background: var(--accent); border-color: var(--accent); }
.pill.mid { color: var(--accent-light); border-color: rgba(232,234,238,0.4); }
.pill.ok { color: #9ad8a2; border-color: rgba(154,216,162,0.35); }
.pill.bad { color: #ff8585; border-color: rgba(255,133,133,0.3); }

.row-actions { display: flex; gap: 6px; }
.icon-btn {
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--stroke);
  color: var(--grey);
  font-size: 12.5px;
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: rgba(255,255,255,0.06); color: var(--white); }
.icon-btn.danger:hover { color: #ff8585; border-color: rgba(255,133,133,0.4); }

select.inline-select {
  font-family: inherit;
  font-size: 12.5px;
  color: var(--white);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
  border-radius: 7px;
  padding: 5px 8px;
  outline: none;
}
select.inline-select option { background: #101015; }

/* ---------- Activity ---------- */
.activity-list { list-style: none; }
.activity-list li {
  display: flex;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13.5px;
}
.activity-list li:last-child { border-bottom: none; }
.activity-list .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.activity-list time { color: rgba(255,255,255,0.4); font-size: 12px; margin-left: auto; flex: none; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
}
.modal {
  width: 100%;
  max-width: 440px;
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  border-radius: 14px;
  box-shadow: 0 30px 60px rgba(0,0,0,0.6);
  animation: modal-in 0.35s var(--ease-out);
}
@keyframes modal-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--stroke);
}
.modal-head h3 { font-size: 16px; font-weight: 600; }
.modal-close { font-size: 22px; color: var(--grey); padding: 0 6px; }
.modal-close:hover { color: var(--white); }
.modal-body { padding: 20px; }
.modal-body .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.modal-body textarea { min-height: 80px; resize: vertical; }
.modal-body .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 12px 20px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 200;
  box-shadow: 0 12px 30px rgba(0,0,0,0.5);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Role sections ---------- */
.section-intro { color: var(--grey); font-size: 14px; margin-bottom: 18px; max-width: 720px; }
.notice {
  border: 1px solid rgba(232,234,238,0.35);
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13.5px;
  margin-bottom: 20px;
}
.role-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 28px;
  flex-wrap: wrap;
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 22px;
}
.role-banner h2 { font-size: 22px; font-weight: 600; letter-spacing: -0.03em; margin-top: 10px; }
.role-banner p { color: var(--grey); font-size: 14px; margin-top: 4px; max-width: 460px; }
.role-duties { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.role-duties li {
  position: relative;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--grey);
}
.role-duties li::before {
  content: "";
  position: absolute;
  left: 0; top: 8px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.role-section {
  background: var(--card-bg);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 16px;
}
.role-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.role-head h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.role-blurb { color: var(--grey); font-size: 13.5px; margin-top: 3px; max-width: 520px; }
.role-members { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--stroke);
  border-radius: 100px;
  padding: 4px 14px 4px 4px;
  font-size: 13px;
}
.member-chip i {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a2a31, #131317);
  display: flex; align-items: center; justify-content: center;
  font-style: normal; font-size: 10px; font-weight: 600;
  color: var(--accent-light);
}
.muted-note { color: rgba(255,255,255,0.4); font-size: 13px; }
.role-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 18px;
}
.role-stat {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 12px 14px;
}
.role-stat b { display: block; font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.role-stat span { font-size: 12px; color: var(--grey); }
.role-progress { margin-top: 18px; }
.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--grey);
  margin-bottom: 7px;
}
.progress {
  height: 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.progress i {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width 0.6s var(--ease-out);
}
.role-activity { margin-top: 18px; border-top: 1px solid var(--stroke); padding-top: 14px; }
.role-activity-title {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.4);
  margin-bottom: 9px;
}
.role-activity ul { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.role-activity li { display: flex; gap: 8px; font-size: 13px; color: var(--grey); }
.role-activity li b { color: var(--white); font-weight: 500; }
.role-activity time { margin-left: auto; font-size: 12px; color: rgba(255,255,255,0.35); flex: none; }

/* ---------- Empty state ---------- */
.empty { padding: 40px 20px; text-align: center; color: var(--grey); font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.35s var(--ease-out);
    box-shadow: 20px 0 40px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: flex; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .content { padding: 20px 16px; }
  .modal-body .form-row { grid-template-columns: 1fr; }
}
