/* ==============================
   VARIABLES + RESET
   ============================== */
:root {
  --bg:       #070c18;
  --panel:    #0d1624;
  --panel-2:  #121e30;
  --panel-3:  #192438;
  --sb-bg:    #050910;
  --text:     #dde5f4;
  --muted:    #6b7f9e;
  --accent:   #3d68f5;
  --accent-2: #2d55e0;
  --success:  #22c55e;
  --danger:   #ff5252;
  --warn:     #f59e0b;
  --border:   #18273d;
  --border-2: #1f3050;
  --radius:   10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

body {
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: linear-gradient(150deg, #070c18 0%, #091428 60%, #0c1835 100%) fixed;
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3,h4 { font-weight: 700; }

/* ==============================
   SHARED BUTTONS
   ============================== */
.btn {
  display: inline-block;
  padding: 10px 18px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
  line-height: 1;
}
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn.block { width: 100%; margin-top: 16px; display: block; }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text);
}
.btn.ghost:hover { background: var(--panel-2); }
.btn.small { padding: 7px 13px; font-size: 0.82rem; }
.btn.success { background: var(--success); }
.btn.success:hover { background: #16a34a; }

.linkbtn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 0.88rem; padding: 0; }
.linkbtn:hover { text-decoration: underline; }
.inline { display: inline; margin: 0; }

/* ==============================
   FORM FIELDS (shared)
   ============================== */
.field-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 14px 0 6px;
}
.field-input, .field-select, .field-textarea {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
.field-input:focus, .field-select:focus, .field-textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field-hint { font-size: 0.75rem; color: var(--muted); margin: 5px 0 0; }

select { appearance: auto; }

.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 540px) { .form-row-2 { grid-template-columns: 1fr; } }

/* ==============================
   SIDEBAR APP LAYOUT (logged in)
   ============================== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* --- Sidebar --- */
.sidebar {
  width: 230px;
  min-height: 100vh;
  background: var(--sb-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sb-brand {
  padding: 18px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 64px;
}
.sb-logo { height: 34px; width: auto; max-width: 100%; display: block; object-fit: contain; }
.sb-brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.sb-name { font-size: 1.05rem; font-weight: 800; color: var(--text); letter-spacing: -0.01em; }
.sb-sub  { font-size: 0.65rem; color: var(--muted); }

.sb-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }

.sb-section {
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 14px 10px 6px;
}

.sb-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 2px;
  transition: background 0.12s, color 0.12s;
}
.sb-link:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.sb-link.active { background: var(--panel); color: var(--text); }
.sb-link.active .sb-ico { color: var(--accent); }
.sb-ico { width: 16px; flex-shrink: 0; opacity: 0.7; }
.sb-link.active .sb-ico { opacity: 1; }

.sb-user {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.sb-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.sb-avatar-init {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 700; color: #fff;
  flex-shrink: 0;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-size: 0.82rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { font-size: 0.7rem; color: var(--muted); }

/* --- App body (right of sidebar) --- */
.app-body {
  margin-left: 230px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.app-bar {
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  background: rgba(5,9,16,0.8);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-shrink: 0;
}
.app-bar-left  { display: flex; align-items: center; gap: 12px; }
.app-bar-title { font-size: 0.9rem; font-weight: 600; color: var(--text); }
.app-bar-right  { display: flex; align-items: center; gap: 14px; }

/* hamburger — hidden on desktop, shown on mobile */
.app-bar-burger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 4px;
  margin-left: -4px;
}
.app-bar-burger svg { width: 22px; height: 22px; display: block; }

/* mobile drawer backdrop */
.sb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 90;
}
.sb-backdrop.show { display: block; }
.app-bar-user   { display: flex; align-items: center; gap: 8px; }
.app-bar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%; object-fit: cover;
}
.app-bar-init {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: #fff;
}
.app-bar-name { font-size: 0.82rem; color: var(--muted); }

.app-main { flex: 1; padding: 28px 28px 56px; }

/* ==============================
   SITE LAYOUT (logged out)
   ============================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: rgba(7,12,24,0.9);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand:hover { text-decoration: none; }
.brand-logo { height: 30px; width: auto; border-radius: 6px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-size: 0.95rem; font-weight: 800; color: var(--text); }
.brand-sub  { font-size: 0.65rem; color: var(--muted); }

.topbar nav { display: flex; align-items: center; gap: 18px; }
.topbar nav a { font-size: 0.86rem; color: var(--muted); }
.topbar nav a:hover { color: var(--text); text-decoration: none; }

.site-main { }
.page-wrap { max-width: 760px; margin: 0 auto; padding: 36px 22px; }

/* ==============================
   HOME PAGE
   ============================== */
.home-wrap {
  display: grid;
  grid-template-columns: 1fr 300px;
  min-height: calc(100vh - 56px);
}
.home-left { padding: 36px 40px 56px; }
.home-right {
  border-left: 1px solid var(--border);
  background: rgba(13,22,36,0.5);
  padding: 30px 24px 36px;
  display: flex;
  flex-direction: column;
}

.welcome-card {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 22px 24px;
  margin-bottom: 32px;
}
.welcome-icon { width: 52px; height: 52px; border-radius: 10px; flex-shrink: 0; }
.welcome-card h2 { font-size: 1.2rem; margin-bottom: 6px; }
.welcome-card p  { color: var(--muted); font-size: 0.88rem; margin-bottom: 14px; }

.section-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.feature-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  transition: border-color 0.15s;
}
.feature-card:hover { border-color: var(--border-2); }
.feature-icon { font-size: 1.5rem; margin-bottom: 10px; }
.feature-name { font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.feature-desc { font-size: 0.78rem; color: var(--muted); line-height: 1.4; margin-bottom: 14px; }
.feature-link { font-size: 0.78rem; color: var(--accent); }

/* Sign-in panel */
.sp-head { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.sp-logo { height: 28px; border-radius: 6px; }
.sp-brand-name { font-size: 0.9rem; font-weight: 800; color: var(--text); line-height: 1.2; }
.sp-brand-sub  { font-size: 0.65rem; color: var(--muted); }
.sp-title { font-size: 1.05rem; font-weight: 700; margin-bottom: 16px; }
.sp-foot  { margin-top: 12px; font-size: 0.8rem; color: var(--muted); }
.sp-notice {
  margin-top: auto;
  padding-top: 24px;
  font-size: 0.72rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
  line-height: 1.5;
}
.sp-errors {
  list-style: none;
  margin: 0 0 12px;
  padding: 10px 13px;
  background: rgba(255,82,82,0.08);
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  font-size: 0.82rem;
}

@media (max-width: 700px) {
  .home-wrap { grid-template-columns: 1fr; }
  .home-right { border-left: none; border-top: 1px solid var(--border); }
}

/* ==============================
   AUTH PAGES
   ============================== */
.auth-wrap { max-width: 420px; margin: 48px auto; padding: 0 16px; }
.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 30px 28px;
}
.auth-card h1 { font-size: 1.15rem; margin-bottom: 20px; }
.auth-alt { margin-top: 16px; font-size: 0.82rem; color: var(--muted); text-align: center; }
.auth-hint { font-size: 0.75rem; color: var(--muted); margin: 4px 0 0; }
.auth-errors {
  list-style: none;
  margin: 0 0 14px;
  padding: 10px 13px;
  background: rgba(255,82,82,0.08);
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  font-size: 0.84rem;
}

/* ==============================
   DASHBOARD
   ============================== */
.dash-page { max-width: 860px; }

.dash-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.dash-greeting { font-size: 1.35rem; font-weight: 700; margin-bottom: 4px; }
.dash-date     { font-size: 0.82rem; color: var(--muted); }

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.stat-val   { font-size: 1.9rem; font-weight: 800; color: var(--text); line-height: 1; margin-bottom: 6px; }
.stat-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.stat-icon  { font-size: 1.2rem; margin-bottom: 8px; }

.dash-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 24px; }
@media (max-width: 640px) { .dash-grid { grid-template-columns: 1fr; } }

.dash-section-title {
  font-size: 0.68rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 10px;
}

.info-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.info-card h3 {
  font-size: 0.82rem; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.07em; margin-bottom: 14px;
}

.profile-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(61,104,245,0.08);
  border: 1px solid rgba(61,104,245,0.3);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 20px;
}
.profile-banner-text { flex: 1; font-size: 0.88rem; }
.profile-banner-text strong { display: block; margin-bottom: 2px; }
.profile-banner-text span   { font-size: 0.8rem; color: var(--muted); }

.quick-actions { display: flex; flex-direction: column; gap: 8px; }
.quick-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.86rem;
  transition: border-color 0.12s;
}
.quick-action:hover { border-color: var(--border-2); text-decoration: none; color: var(--text); }
.qa-ico { font-size: 1rem; }

.kv-list { font-size: 0.86rem; }
.kv-row { display: flex; align-items: baseline; justify-content: space-between; padding: 7px 0; border-bottom: 1px solid var(--border); gap: 12px; }
.kv-row:last-child { border-bottom: none; }
.kv-key { color: var(--muted); font-size: 0.8rem; flex-shrink: 0; }
.kv-val { color: var(--text); text-align: right; word-break: break-word; }

/* ==============================
   PROFILE PAGE
   ============================== */
.profile-page { max-width: 720px; }

.profile-top {
  display: flex;
  align-items: center;
  gap: 22px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}
.profile-pic-wrap { position: relative; cursor: pointer; flex-shrink: 0; }
.profile-pic {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--border-2);
  display: block;
}
.profile-pic-init {
  width: 80px; height: 80px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; font-weight: 700; color: #fff;
  border: 3px solid var(--border-2);
  flex-shrink: 0;
}
.pic-edit-badge {
  position: absolute; bottom: 0; right: 0;
  width: 26px; height: 26px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--sb-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; color: #fff;
}
.profile-meta { flex: 1; }
.profile-full-name { font-size: 1.25rem; font-weight: 700; margin-bottom: 4px; }
.profile-email     { font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.badge-code {
  display: inline-block;
  padding: 3px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  border-radius: 99px;
  font-size: 0.75rem;
  color: var(--muted);
  font-family: monospace;
}

.profile-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 580px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
}
.profile-card h3 {
  font-size: 0.7rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 16px;
}

.success-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.3);
  border-radius: 8px;
  color: var(--success);
  font-size: 0.84rem;
  margin-bottom: 16px;
}
.error-bar {
  list-style: none;
  padding: 10px 14px;
  background: rgba(255,82,82,0.08);
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  font-size: 0.84rem;
  margin-bottom: 16px;
}

/* ==============================
   TEAM PAGE
   ============================== */
.team-page { max-width: 920px; }

.tm-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}
.tm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.tm-title { font-size: 0.92rem; font-weight: 600; }

.tm-tbl { width: 100%; border-collapse: collapse; }
.tm-tbl th {
  padding: 9px 16px;
  text-align: left;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.tm-tbl td {
  padding: 11px 16px;
  font-size: 0.87rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.tm-tbl tr:last-child td { border-bottom: none; }
.tm-tbl tr:hover td { background: rgba(255,255,255,0.018); }

.tm-member { display: flex; align-items: center; gap: 10px; }
.tm-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.66rem; font-weight: 700; color: #fff; flex-shrink: 0;
}
.tm-name  { font-weight: 500; line-height: 1.3; }
.tm-email { font-size: 0.76rem; color: var(--muted); }
.tm-code {
  display: inline-block;
  font-family: monospace;
  font-size: 0.68rem;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  border-radius: 5px;
  padding: 1px 6px;
  vertical-align: middle;
  margin-left: 4px;
}
.tm-actions { white-space: nowrap; text-align: right; width: 70px; }
.tm-btn-icon {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  padding: 5px 7px; border-radius: 6px;
  font-size: 0.9rem; line-height: 1;
}
.tm-btn-icon:hover { background: var(--panel-2); color: var(--text); }
.tm-del:hover { color: var(--danger) !important; }
.tm-empty { padding: 52px; text-align: center; color: var(--muted); }

/* ==============================
   MODAL
   ============================== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
}
.modal-box {
  background: #0b1424;
  border: 1px solid var(--border-2);
  border-radius: 14px;
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 0.9rem;
}
.modal-x {
  background: none; border: none;
  color: var(--muted); cursor: pointer;
  font-size: 1.3rem; line-height: 1;
  padding: 3px 7px; border-radius: 6px;
}
.modal-x:hover { background: var(--panel-2); color: var(--text); }
.modal-bd { padding: 20px; }
.modal-ft {
  display: flex; justify-content: flex-end; gap: 10px;
  margin-top: 20px; padding-top: 14px;
  border-top: 1px solid var(--border);
}

/* modal form fields */
.mf-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-bottom: 12px; }
@media (max-width: 480px) { .mf-grid2 { grid-template-columns: 1fr; } }
.mf-row   { margin-bottom: 12px; }
.mf-label {
  display: block; margin-bottom: 5px;
  font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted);
}
.mf-input, .mf-select {
  width: 100%; padding: 9px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border-2);
  border-radius: 8px; color: var(--text); font-size: 0.88rem;
  font-family: inherit;
}
.mf-input:focus, .mf-select:focus { outline: none; border-color: var(--accent); }
.mf-colors { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.mf-swatch-lbl { cursor: pointer; }
.mf-swatch-lbl input[type="radio"] { display: none; }
.mf-swatch { display: block; width: 26px; height: 26px; border-radius: 50%; }
.mf-swatch-lbl input[type="radio"]:checked + .mf-swatch { box-shadow: 0 0 0 2px #0b1424, 0 0 0 4px #fff; }
.m-errors {
  list-style: none; margin: 0 0 12px; padding: 9px 13px;
  background: rgba(255,82,82,0.08); border: 1px solid var(--danger);
  border-radius: 8px; color: var(--danger); font-size: 0.83rem;
}

/* ==============================
   FOOTER
   ============================== */
.foot {
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 0.78rem;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ==============================
   MOBILE / RESPONSIVE
   ============================== */
@media (max-width: 768px) {
  /* Sidebar becomes an off-canvas drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 250px;
    box-shadow: 2px 0 20px rgba(0,0,0,0.4);
  }
  .sidebar.open { transform: translateX(0); }

  .app-body { margin-left: 0; }
  .app-bar-burger { display: inline-flex; }

  .app-bar { padding: 0 16px; }
  .app-bar-name { display: none; }     /* keep avatar, drop long name */
  .app-main { padding: 18px 16px 48px; }

  /* Tables scroll horizontally instead of overflowing */
  .tm-panel { overflow-x: auto; }
  .tm-tbl { min-width: 560px; }

  /* Dashboard / profile grids stack */
  .dash-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .profile-grid { grid-template-columns: 1fr; }
  .profile-top { flex-direction: column; text-align: center; }
  .dash-welcome { flex-direction: column; align-items: flex-start; gap: 12px; }

  /* Modals fill more of the screen */
  .modal-box { width: 100%; border-radius: 12px; }
  .modal-bd { padding: 16px; }

  /* Home page padding */
  .home-left  { padding: 24px 18px 36px; }
  .home-right { padding: 24px 18px 32px; }
  .topbar { padding: 0 16px; }
  .topbar nav { gap: 12px; }
}

@media (max-width: 420px) {
  .stats-row { grid-template-columns: 1fr; }
  .mf-grid2 { grid-template-columns: 1fr; }
  .form-row-2 { grid-template-columns: 1fr; }
}

/* ==============================
   THEME TOGGLE + ADMIN BADGE
   ============================== */
.theme-toggle {
  background: none; border: 1px solid var(--border-2);
  border-radius: 8px; cursor: pointer;
  padding: 5px 9px; font-size: 0.85rem; line-height: 1;
  color: var(--text);
}
.theme-toggle:hover { background: var(--panel-2); }
.theme-ico-light { display: none; }
.theme-light .theme-ico-dark { display: none; }
.theme-light .theme-ico-light { display: inline; }

.admin-badge {
  font-size: 0.66rem; font-weight: 700;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: #f59e0b;
  border: 1px solid #f59e0b66;
  background: #f59e0b18;
  padding: 3px 9px; border-radius: 99px;
}

.shift-dot {
  width: 12px; height: 12px; border-radius: 3px;
  display: inline-block; flex-shrink: 0;
}
.drag-handle { cursor: grab; color: var(--muted); margin-right: 6px; user-select: none; }
.drag-handle:active { cursor: grabbing; }
#shift-tbody tr { cursor: default; }

/* ==============================
   ROSTER GRID
   ============================== */
.roster-page { max-width: 100%; }

.roster-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 14px;
}
.rtb-left  { display: flex; align-items: center; gap: 8px; }
.rtb-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.roster-month { font-size: 0.98rem; font-weight: 700; min-width: 160px; text-align: center; }

.seg { display: inline-flex; border: 1px solid var(--border-2); border-radius: 8px; overflow: hidden; }
.seg-btn { padding: 7px 12px; font-size: 0.82rem; color: var(--muted); border-right: 1px solid var(--border-2); }
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.seg-btn.on { background: var(--accent); color: #fff; }

.lg-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Summary stats */
.rstats {
  display: grid;
  grid-template-columns: repeat(4, 1fr) 2fr;
  gap: 10px; margin-bottom: 14px;
}
.rstat {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px 16px;
}
.rstat-val { font-size: 1.5rem; font-weight: 800; line-height: 1; }
.rstat-sub { font-size: 0.9rem; color: var(--muted); font-weight: 600; }
.rstat-lbl { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.rstat-live { display: flex; flex-direction: column; }
.live-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.live-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 99px; padding: 3px 9px; font-size: 0.76rem;
}
@media (max-width: 820px) { .rstats { grid-template-columns: repeat(2, 1fr); } .rstat-live { grid-column: span 2; } }

/* Filters */
.rfilters { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.rfilter-label { font-size: 0.74rem; color: var(--muted); font-weight: 600; margin-right: 2px; }
.chip-f {
  padding: 4px 11px; border-radius: 99px;
  border: 1px solid var(--border-2); background: var(--panel);
  font-size: 0.78rem; color: var(--muted);
}
.chip-f:hover { color: var(--text); text-decoration: none; border-color: var(--accent); }
.chip-f.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.roster-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
}
.roster-tbl { border-collapse: collapse; width: 100%; }
.roster-tbl th, .roster-tbl td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }

.rt-name-h, .rt-name {
  position: sticky; left: 0; z-index: 2;
  background: var(--panel-2);
  min-width: 168px; max-width: 168px;
  text-align: left; padding: 8px 12px;
}
.rt-name { background: var(--panel); display: flex; align-items: center; gap: 8px; }
.rt-name-h { font-size: 0.66rem; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.rt-mname { font-size: 0.8rem; font-weight: 600; white-space: nowrap; }
.rt-mmeta { font-size: 0.68rem; color: var(--muted); }

.rt-day {
  width: 46px; min-width: 46px; padding: 5px 2px; text-align: center;
  background: var(--panel-2);
}
.rt-day.weekend { background: var(--panel-3); }
.rt-day.today { background: var(--accent); }
.rt-day.today .rt-dow, .rt-day.today .rt-dnum { color: #fff; }
.rt-dow { font-size: 0.6rem; color: var(--muted); }
.rt-dnum { font-size: 0.82rem; font-weight: 700; }

.rt-cell {
  width: 46px; min-width: 46px; height: 38px;
  text-align: center; padding: 2px;
}
.rt-cell.weekend { background: rgba(255,255,255,0.02); }
.rt-cell.today { box-shadow: inset 0 0 0 1px var(--accent); }
.rt-cell.editable { cursor: pointer; }
.rt-cell.editable:hover { background: var(--panel-2); }
.rt-chip {
  display: block; font-size: 0.6rem; font-weight: 700;
  padding: 4px 2px; border-radius: 5px;
  border: 1px solid; line-height: 1.1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Totals columns */
.rt-tot-h {
  width: 28px; min-width: 28px; padding: 5px 2px; text-align: center;
  font-size: 0.66rem; font-weight: 700; color: var(--muted);
  background: var(--panel-2); border-left: 2px solid var(--border-2);
}
.rt-tot {
  width: 28px; min-width: 28px; text-align: center;
  font-size: 0.78rem; color: var(--muted); background: var(--panel-2);
}
.rt-tot.work { color: var(--text); font-weight: 700; border-left: 2px solid var(--border-2); }

/* Coverage footer */
.rt-coverage td { border-top: 2px solid var(--border-2); background: var(--panel-2); }
.rt-cov-cell {
  text-align: center; vertical-align: bottom;
  padding: 2px; height: 44px;
  position: relative;
}
.rt-cov-cell.today { box-shadow: inset 0 0 0 1px var(--accent); }
.cov-bar { width: 60%; margin: 0 auto; border-radius: 2px 2px 0 0; min-height: 3px; }
.cov-num { font-size: 0.62rem; color: var(--muted); margin-top: 2px; }

.roster-foot-note { font-size: 0.76rem; color: var(--muted); margin-top: 10px; }

/* Assign modal */
.assign-section-label {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.09em;
  color: var(--muted); margin-bottom: 8px;
}
.assign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.assign-opt {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 11px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--border-2);
  color: var(--text); cursor: pointer; font-size: 0.82rem; text-align: left;
}
.assign-opt:hover { background: var(--panel-3); }

/* ==============================
   LIGHT THEME
   ============================== */
.theme-light {
  --bg:       #eef1f7;
  --panel:    #ffffff;
  --panel-2:  #f4f7fb;
  --panel-3:  #e9eef6;
  --sb-bg:    #ffffff;
  --text:     #1a2333;
  --muted:    #5d6b85;
  --border:   #e4e9f2;
  --border-2: #d3dce8;
}
.theme-light body { background: linear-gradient(150deg, #eef1f7 0%, #e7edf6 60%, #e4ebf7 100%) fixed; }
.theme-light .app-bar { background: rgba(255,255,255,0.85); }
.theme-light .topbar  { background: rgba(255,255,255,0.9); }
.theme-light .sidebar { box-shadow: 1px 0 0 var(--border); }
.theme-light .modal-box { background: #ffffff; }
.theme-light .rt-day.today, .theme-light .rt-day.today .rt-dow, .theme-light .rt-day.today .rt-dnum { color: #fff; }
.theme-light .welcome-card,
.theme-light .feature-card,
.theme-light .stat-card,
.theme-light .info-card,
.theme-light .profile-card,
.theme-light .auth-card,
.theme-light .dash-card { box-shadow: 0 1px 3px rgba(20,30,50,0.06); }
