/* Premium UI (SaaS style) */
:root{
  --bg:#000000;
  --panel:#05070d;
  --panel-2:#070b12;
  --text:#ffffff;
  --muted:#cfd6e6;
  --border:rgba(255,255,255,.12);
  --brand:#2b7cff;
  --brand-2:#6aa8ff;
  --success:#22c55e;
  --warning:#f59e0b;
  --danger:#ef4444;
  --shadow: 0 18px 45px rgba(0,0,0,.35);
  --radius: 18px;
  --radius-sm: 12px;
  --font: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color-scheme: light dark;
}

html[data-theme="light"]{
  --bg:#f6f8fc;
  --panel:#ffffff;
  --panel-2:#ffffff;
  --text:#0b1220;
  --muted:#526277;
  --border:rgba(12,18,32,.10);
  --shadow: 0 16px 40px rgba(10,20,40,.12);
}

*{ font-family: var(--font); }
body.app-shell, body.app-bg{
  margin:0;
  background: radial-gradient(1100px 600px at 20% -10%, rgba(43,124,255,.25), transparent 60%),
              radial-gradient(900px 500px at 110% 20%, rgba(106,168,255,.18), transparent 55%),
              var(--bg);
  color: var(--text);
}

/* Layout */
.app-sidebar{
  position: fixed;
  inset: 0 auto 0 0;
  width: 280px;
  background: linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.02));
  border-right: 1px solid var(--border);
  backdrop-filter: blur(10px);
  padding: 14px;
  z-index: 40;
  transform: translateX(0);
  transition: transform .25s ease;
}
.app-sidebar.is-hidden{ transform: translateX(-110%); }

.app-main{
  margin-left: 280px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

@media (max-width: 991.98px){
  .app-main{ margin-left: 0; }
  .app-sidebar{ transform: translateX(-110%); }
  .app-sidebar.is-open{ transform: translateX(0); box-shadow: var(--shadow); }
}

/* Brand */
.app-brand{
  display:flex;
  align-items:center;
  gap:12px;
  padding: 10px 10px 14px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.brand-mark{
  width: 42px; height: 42px;
  border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,.25), rgba(255,255,255,.05));
  border: 1px solid var(--border);
  box-shadow: 0 10px 25px rgba(43,124,255,.15);
}
.brand-mark i{ color: var(--brand-2); font-size: 18px; }
.brand-title{ font-weight: 700; letter-spacing: .2px; }
.brand-sub{ font-size: 12px; color: var(--muted); margin-top: -2px; }

/* Nav */
.app-nav{ padding: 10px 6px; display:flex; flex-direction:column; gap:6px; }
.nav-section{ margin-top: 10px; padding: 10px 10px 6px; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .12em; }
.nav-item{
  display:flex; align-items:center; gap:10px;
  padding: 10px 12px;
  border-radius: 14px;
  color: var(--text);
  text-decoration:none;
  border: 1px solid transparent;
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
}
.nav-item i{ color: var(--muted); }
.nav-item:hover{
  background: rgba(255,255,255,.05);
  border-color: var(--border);
  transform: translateY(-1px);
}
.nav-item:active{ transform: translateY(0); }

/* Sidebar footer */
.app-sidebar-footer{
  position:absolute;
  left:14px; right:14px; bottom:14px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.user-pill{
  display:flex; align-items:center; gap:10px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
}
.user-avatar{
  width: 38px; height: 38px;
  border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  background: rgba(43,124,255,.18);
  border: 1px solid rgba(43,124,255,.25);
  font-weight: 700;
  color: var(--brand-2);
}
.user-name{ font-weight: 600; line-height: 1.1; }
.user-role{ color: var(--muted); }

/* Topbar */
.app-topbar{
  position: sticky;
  top: 0;
  z-index: 30;
  display:flex;
  align-items:center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(12,18,32,.35);
  backdrop-filter: blur(10px);
}
html[data-theme="light"] .app-topbar{ background: rgba(255,255,255,.70); }
.topbar-search{
  display:flex; align-items:center; gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  min-width: 340px;
}
.topbar-search i{ color: var(--muted); }
.topbar-search input{
  border:0; outline:0; background:transparent;
  color: var(--text);
  width: 100%;
}

/* Content */
.app-content{
  padding: 18px 18px 28px;
}

/* Cards + tables */
.card, .modal-content{
  background: var(--panel);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow);
}
.table{ color: var(--text); }
.table-light{ --bs-table-bg: rgba(255,255,255,.04); --bs-table-color: var(--text); }
.text-secondary{ color: var(--muted) !important; }
.bg-body-tertiary{ background: transparent !important; }

/* Buttons */
.btn-premium{
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: 0 !important;
  color: #fff !important;
  border-radius: 14px !important;
  box-shadow: 0 12px 30px rgba(43,124,255,.25);
  transition: transform .12s ease, filter .2s ease;
}
.btn-premium:hover{ filter: brightness(1.05); transform: translateY(-1px); }
.btn-premium:active{ transform: translateY(0); }

.btn-premium-outline{
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.12) !important;
  color: var(--text) !important;
  border-radius: 14px !important;
  transition: transform .12s ease, background .2s ease, border-color .2s ease;
}
.btn-premium-outline:hover{
  background: rgba(255,255,255,.06);
  border-color: rgba(255,255,255,.18) !important;
  transform: translateY(-1px);
}
.btn-ghost{
  background: transparent !important;
  border: 1px solid transparent !important;
  color: var(--text) !important;
  border-radius: 14px !important;
}
.btn-ghost:hover{ background: rgba(255,255,255,.06) !important; border-color: var(--border) !important; }

/* Metrics */
.metric-card{ min-height: 120px; }
.metric-card .display-6{ letter-spacing: -0.02em; }

/* Toasts */
.toast-stack{
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
}
.toast-item{
  width: min(420px, calc(100vw - 32px));
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(15,26,46,.92);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
  display:flex;
  gap: 10px;
  align-items:flex-start;
  animation: toastIn .25s ease both;
}
html[data-theme="light"] .toast-item{ background: rgba(255,255,255,.92); }
.toast-icon{
  width: 34px; height: 34px;
  border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  flex: 0 0 auto;
}
.toast-title{ font-weight: 700; line-height: 1.1; }
.toast-msg{ color: var(--muted); font-size: 13px; }
.toast-close{ margin-left:auto; background:transparent; border:0; color: var(--muted); }
.toast-close:hover{ color: var(--text); }

@keyframes toastIn{
  from{ opacity:0; transform: translateY(8px) scale(.98); }
  to{ opacity:1; transform: translateY(0) scale(1); }
}
@keyframes toastOut{
  to{ opacity:0; transform: translateY(10px) scale(.98); }
}

.logo-text{font-weight:800; letter-spacing:-0.02em; color: var(--brand-2);} 

.nav-item.is-active{background: rgba(43,124,255,.14); border-color: rgba(43,124,255,.28);} .nav-item.is-active i{color: var(--brand-2);} 

/* Skeleton */
.skeleton{position:relative; overflow:hidden; background: rgba(255,255,255,.06); border: 1px solid var(--border);} 
.skeleton:after{content:''; position:absolute; inset:0; transform: translateX(-60%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.10), transparent); animation: shimmer 1.2s infinite;} 
@keyframes shimmer{to{transform: translateX(60%);}}


/* Contrast fixes */
.app-topbar{ background: rgba(7,13,24,.55); }
html[data-theme="light"] .app-topbar{ background: rgba(255,255,255,.78); }

.card, .modal-content{
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03)), var(--panel);
}

.table{
  --bs-table-bg: transparent;
  --bs-table-striped-bg: rgba(255,255,255,.03);
}
.table thead th{
  color: var(--text);
  opacity: .95;
}
.table td{ color: var(--text); }

.badge.bg-secondary{ background: rgba(255,255,255,.14) !important; color: var(--text) !important; border: 1px solid var(--border); }

.form-control, .form-select, .input-group-text{
  background: rgba(255,255,255,.04) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
}
.form-control::placeholder{ color: rgba(194,208,230,.75); }

a{ color: var(--brand-2); }
a:hover{ color: #9cc4ff; }

.metric-card .display-6{ color: var(--text); }


/* Kanban */
.kanban-board{
  display: grid;
  grid-template-columns: repeat(6, minmax(260px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 10px;
}
.kanban-col{
  min-width: 260px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
}
.kanban-col-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  padding: 8px 8px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.kanban-list{
  min-height: 80px;
  display:flex;
  flex-direction: column;
  gap: 10px;
}
.kanban-card{
  padding: 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
  box-shadow: 0 12px 26px rgba(0,0,0,.22);
  cursor: grab;
}
.kanban-card:active{ cursor: grabbing; }
.kanban-title{ font-weight: 700; letter-spacing: -0.01em; }
.kanban-meta{
  display:flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12.5px;
}
.kanban-meta i{ opacity: .9; }
.kanban-foot{
  margin-top: 10px;
  display:flex;
  justify-content: space-between;
  align-items:center;
  gap: 8px;
}

.kanban-ghost{opacity:.55;}


/* Brand stack (sidebar) */
.brand-stack{ display:flex; flex-direction:column; align-items:flex-start; gap:10px; padding: 10px 8px 14px; width:100%; }
.brand-logo{ width: 100%; display:flex; justify-content:flex-start; }
.brand-logo img{ max-width: 160px; max-height: 64px; width:auto; height:auto; object-fit: contain; filter: drop-shadow(0 10px 22px rgba(43,124,255,.18)); }
.brand-fallback{ width: 60px; height: 60px; border-radius: 16px; display:flex; align-items:center; justify-content:center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color:#fff; font-weight:800; font-size:18px; }
.brand-texts .brand-title{ font-weight:800; letter-spacing:-0.02em; font-size: 16px; }
.brand-texts .brand-sub{ font-size: 12px; color: var(--muted); margin-top:2px; }

/* Make dark areas truly black */
.app-sidebar{ background: #000000; }
.app-topbar{ background: rgba(0,0,0,.72); }
.card, .modal-content{ background: #05070d; }
html[data-theme="light"] .card, html[data-theme="light"] .modal-content{ background: var(--panel); }

/* Auth (login) */
.auth-wrap{
  min-height: calc(100vh - 48px);
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 18px;
  align-items: stretch;
}
@media (max-width: 991.98px){ .auth-wrap{ grid-template-columns: 1fr; } .auth-hero{ display:none; } }

.auth-hero{
  border-radius: 22px;
  border: 1px solid var(--border);
  background: radial-gradient(900px 520px at 20% 0%, rgba(43,124,255,.30), transparent 62%),
              radial-gradient(700px 420px at 100% 20%, rgba(106,168,255,.20), transparent 58%),
              #000000;
  overflow:hidden;
}
.auth-hero-inner{ padding: 28px; }
.auth-badge{
  display:inline-flex; align-items:center; gap:10px;
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--muted); font-size: 12px;
}
.auth-badge .dot{ width:8px; height:8px; border-radius:50%; background: var(--brand-2); box-shadow: 0 0 0 6px rgba(106,168,255,.12); }
.auth-title{ margin: 14px 0 6px; font-size: 34px; font-weight: 900; letter-spacing: -0.03em; color: var(--text); }
.auth-sub{ color: var(--muted); max-width: 520px; }
.auth-feats{ margin-top: 18px; display:grid; gap: 10px; max-width: 520px; }
.auth-feat{
  display:flex; align-items:center; gap:10px;
  padding: 10px 12px; border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
}
.auth-feat i{ color: var(--brand-2); }

.auth-card{
  border-radius: 22px;
  border: 1px solid var(--border);
  background: #05070d;
  box-shadow: var(--shadow);
  padding: 22px;
  align-self: center;
  max-width: 520px;
  margin-left: auto;
}
@media (max-width: 991.98px){ .auth-card{ margin: 0 auto; } }
.auth-card-head{ display:flex; align-items:center; gap:12px; margin-bottom: 12px; }
.auth-logo{
  width: 54px; height: 54px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  display:flex; align-items:center; justify-content:center;
}
.auth-logo img{ width: 36px; height: 36px; object-fit: contain; }


/* Nav badges */
.nav-badge{
  margin-left:auto;
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.badge-soft-warning{ background: rgba(245,158,11,.16); color:#fff; border-color: rgba(245,158,11,.28); }
.badge-soft-danger{ background: rgba(239,68,68,.16); color:#fff; border-color: rgba(239,68,68,.28); }
.badge-soft-info{ background: rgba(106,168,255,.16); color:#fff; border-color: rgba(106,168,255,.28); }

/* Premium dropdown */
.dropdown-premium{
  background: #05070d;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.dropdown-premium .dropdown-item{
  color: var(--text);
  padding: 10px 12px;
}
.dropdown-premium .dropdown-item:hover{
  background: rgba(255,255,255,.06);
}
.dropdown-premium .dropdown-header{
  color: var(--muted);
}

/* Notifications */
.notif-dot{
  position:absolute;
  right: 8px; top: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 0 0 0 6px rgba(239,68,68,.14);
}
.notif-head{
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,.02);
}
.notif-list{ max-height: 320px; overflow:auto; }
.notif-item{
  display:flex;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.notif-item:last-child{ border-bottom:0; }
.notif-ico{
  width: 34px; height: 34px;
  border-radius: 14px;
  display:flex; align-items:center; justify-content:center;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.notif-warning .notif-ico{ background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.26); }
.notif-info .notif-ico{ background: rgba(106,168,255,.14); border-color: rgba(106,168,255,.26); }
.notif-success .notif-ico{ background: rgba(34,197,94,.14); border-color: rgba(34,197,94,.26); }
.notif-title{ font-weight: 700; }
.notif-msg{ color: var(--muted); font-size: 12.5px; margin-top:2px; }
.notif-foot{
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  display:flex;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255,255,255,.02);
}


/* Auth v2 (robust layout) */
.auth-page{ width: 100%; }
.auth-shell{
  min-height: calc(100vh - 96px);
  display:grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 18px;
  align-items: stretch;
}
@media (max-width: 991.98px){ .auth-shell{ grid-template-columns: 1fr; min-height:auto; } }

.auth-left{
  border-radius: 22px;
  border: 1px solid var(--border);
  background: radial-gradient(900px 520px at 20% 0%, rgba(43,124,255,.30), transparent 62%),
              radial-gradient(700px 420px at 100% 20%, rgba(106,168,255,.20), transparent 58%),
              #000000;
  padding: 28px;
}
.auth-badge{
  display:inline-flex; align-items:center; gap:10px;
  padding: 8px 12px; border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--muted); font-size: 12px;
}
.auth-badge .dot{ width:8px; height:8px; border-radius:50%; background: var(--brand-2); box-shadow: 0 0 0 6px rgba(106,168,255,.12); }
.auth-h1{ margin: 14px 0 6px; font-size: 34px; font-weight: 900; letter-spacing: -0.03em; color: var(--text); }
.auth-p{ color: var(--muted); max-width: 520px; }

.auth-feats{ margin-top: 18px; display:grid; gap: 10px; max-width: 520px; }
.auth-feat{
  display:flex; align-items:center; gap:10px;
  padding: 10px 12px; border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.03);
  color: var(--text);
}
.auth-feat i{ color: var(--brand-2); }

.auth-right{ display:flex; justify-content:center; align-items:center; }
.auth-card{
  width: min(520px, 100%);
  border-radius: 22px;
  border: 1px solid var(--border);
  background: #05070d;
  box-shadow: var(--shadow);
  padding: 22px;
}
.auth-brand{
  display:flex;
  align-items:center;
  gap: 14px;
  margin-bottom: 12px;
}
.auth-brand-logo{
  width: 56px !important;
  height: 56px !important;
  max-width: 56px !important;
  max-height: 56px !important;
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid var(--border);
  padding: 10px;
  background: rgba(255,255,255,.03);
}
.auth-brand-title{ font-weight: 900; font-size: 18px; letter-spacing: -0.02em; color: var(--text); }
.auth-brand-sub{ font-size: 12px; color: var(--muted); margin-top: 2px; }


/* Auth stacked centered */
.auth-center{
  min-height: calc(100vh - 120px);
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap: 16px;
  max-width: 920px;
  margin: 0 auto;
}
.auth-info{
  width:100%;
  border-radius: 22px;
  border: 1px solid var(--border);
  background: radial-gradient(900px 520px at 20% 0%, rgba(43,124,255,.22), transparent 62%),
              radial-gradient(700px 420px at 100% 20%, rgba(106,168,255,.14), transparent 58%),
              #000;
  padding: 20px;
}
.auth-form{ width:100%; display:flex; justify-content:center; }
.auth-form .auth-card{ width:min(520px, 100%); }
