@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&family=Outfit:wght@500;600;700;800&display=swap');

:root{
  --font-body:'DM Sans',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  --font-display:'Outfit',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,Helvetica,Arial,sans-serif;
  --p-bg:#f4f7fb;--p-ink:#0a1628;--p-side:#0b1f44;--p-accent:#0b5fff;--p-card:#fff;--side-w:260px;
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body.portal-body, body{margin:0;font-family:var(--font-body);background:var(--p-bg);color:var(--p-ink);overflow-x:hidden}
.portal-shell{display:flex;min-height:100vh}
.portal-sidebar{width:var(--side-w);background:linear-gradient(180deg,#0b1f44,#0a1628);color:#e2e8f0;padding:1.25rem 1rem;position:sticky;top:0;height:100vh;overflow:auto;z-index:40}
.portal-brand{font-weight:800;letter-spacing:.04em;margin-bottom:1.25rem}
.portal-brand small{display:block;opacity:.65;font-weight:600;font-size:.72rem}
.portal-sidebar a{display:flex;align-items:center;gap:.65rem;color:#cbd5e1;text-decoration:none;padding:.7rem .8rem;border-radius:12px;margin-bottom:.25rem;font-weight:600;min-height:48px}
.portal-sidebar a:hover,.portal-sidebar a.active{background:rgba(11,95,255,.22);color:#fff}
.portal-main{flex:1;min-width:0}
.portal-top{background:var(--p-card);border-bottom:1px solid rgba(15,23,42,.08);padding:.85rem 1.25rem;display:flex;justify-content:space-between;align-items:center;gap:.75rem;position:sticky;top:0;z-index:30;flex-wrap:wrap}
.portal-top-left{display:flex;align-items:center;gap:.65rem;min-width:0}
.portal-top strong{font-size:clamp(1rem,2.5vw,1.15rem)}
.portal-menu-btn{display:none;align-items:center;justify-content:center;width:48px;height:48px;border-radius:12px;border:1px solid rgba(15,23,42,.12);background:#fff;color:var(--p-ink)}
.portal-backdrop{display:none;position:fixed;inset:0;background:rgba(10,22,40,.45);z-index:35}
.portal-backdrop.show{display:block}
.portal-content{padding:1.25rem 1.5rem 2rem}
.panel{background:var(--p-card);border:1px solid rgba(15,23,42,.08);border-radius:18px;padding:1.1rem 1.2rem;box-shadow:0 10px 30px rgba(11,31,68,.05);overflow:auto}
.stat-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:1rem}
.stat-card{background:var(--p-card);border-radius:16px;padding:1rem 1.1rem;border:1px solid rgba(15,23,42,.08)}
.stat-card .label{color:#64748b;font-size:.82rem;font-weight:600}
.stat-card .value{font-size:clamp(1.35rem,3vw,1.7rem);font-weight:800;letter-spacing:-.03em}
.btn-p,.btn-p-outline{min-height:48px;display:inline-flex;align-items:center;justify-content:center;gap:.4rem;border-radius:999px;padding:.65rem 1.1rem;font-weight:700;text-decoration:none;touch-action:manipulation}
.btn-p{background:linear-gradient(135deg,#0b5fff,#1a7cff);color:#fff!important;border:0}
.btn-p-outline{border:1px solid rgba(11,95,255,.35);color:#0b5fff;background:#fff}
/* ==========================================================================
   AUTHENTICATION STYLES (Self-contained, bulletproof & ultra-premium)
   ========================================================================== */
.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse 80% 60% at 50% 20%, rgba(26, 124, 255, 0.22), transparent 60%),
              radial-gradient(ellipse 60% 50% at 80% 80%, rgba(124, 58, 237, 0.15), transparent 50%),
              #070d18;
  padding: 1.5rem 1rem;
  font-family: var(--font-body, "DM Sans", system-ui, sans-serif);
  color: #f8fafc;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: rgba(13, 22, 41, 0.94);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: clamp(1.75rem, 5vw, 2.35rem);
  box-shadow: 0 30px 80px -10px rgba(0, 0, 0, 0.75), 0 0 50px -10px rgba(37, 99, 235, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  position: relative;
  overflow: hidden;
}

.auth-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20%;
  right: 20%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #38bdf8, #818cf8, transparent);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  text-decoration: none;
}
.auth-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a7cff 0%, #7c3aed 100%);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.25rem;
  box-shadow: 0 8px 20px rgba(26, 124, 255, 0.35);
}
.auth-brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}
.auth-brand-text strong {
  font-family: var(--font-display, "Outfit", sans-serif);
  font-size: 1.15rem;
  color: #ffffff;
  letter-spacing: -0.02em;
}
.auth-brand-text small {
  font-size: 0.68rem;
  font-weight: 700;
  color: #38bdf8;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.auth-badge-role {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #7dd3fc;
  margin-bottom: 0.85rem;
}

.auth-title {
  font-family: var(--font-display, "Outfit", sans-serif);
  font-size: 1.65rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.auth-subtitle {
  font-size: 0.88rem;
  color: #94a3b8;
  line-height: 1.45;
  margin: 0 0 1.35rem;
}

.auth-field {
  margin-bottom: 1.15rem;
}
.auth-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.86rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 0.45rem;
}
.auth-input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.auth-input-icon {
  position: absolute;
  left: 1rem;
  color: #64748b;
  font-size: 1.05rem;
  pointer-events: none;
  z-index: 2;
  transition: color 0.2s ease;
}
.auth-input {
  width: 100%;
  display: block;
  min-height: 48px;
  padding: 0.75rem 1rem 0.75rem 2.75rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #ffffff;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}
.auth-input::placeholder {
  color: #64748b;
}
.auth-input:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: #38bdf8;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18), 0 0 16px rgba(56, 189, 248, 0.2);
}
.auth-input-group:focus-within .auth-input-icon {
  color: #38bdf8;
}
.auth-input-toggle {
  position: absolute;
  right: 0.65rem;
  background: transparent;
  border: 0;
  color: #64748b;
  font-size: 1.1rem;
  padding: 0.4rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  z-index: 2;
  transition: color 0.2s ease;
}
.auth-input-toggle:hover {
  color: #38bdf8;
}

.btn-auth-submit {
  width: 100%;
  min-height: 50px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 0.85rem 1.5rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: linear-gradient(135deg, #1a7cff 0%, #4f46e5 50%, #7c3aed 100%);
  color: #ffffff !important;
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(26, 124, 255, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  margin-top: 0.5rem;
}
.btn-auth-submit:hover {
  transform: translateY(-2px);
  background: linear-gradient(135deg, #0a4ad1 0%, #1a7cff 50%, #6366f1 100%);
  box-shadow: 0 14px 34px rgba(26, 124, 255, 0.55), 0 0 20px rgba(56, 189, 248, 0.35);
}
.btn-auth-submit:active {
  transform: translateY(0);
}

.auth-alert {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.86rem;
  margin-bottom: 1.15rem;
  line-height: 1.35;
}
.auth-alert-danger {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
}
.auth-alert-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #86efac;
}

.auth-links {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.84rem;
}
.auth-link {
  color: #94a3b8;
  text-decoration: none;
  transition: color 0.2s ease;
}
.auth-link:hover {
  color: #38bdf8;
  text-decoration: underline;
}
.auth-link-primary {
  color: #38bdf8;
  font-weight: 600;
  text-decoration: none;
}
.auth-link-primary:hover {
  color: #7dd3fc;
  text-decoration: underline;
}

.auth-back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: #64748b;
  font-size: 0.82rem;
  text-decoration: none;
  margin-top: 1rem;
  transition: color 0.2s ease;
}
.auth-back-link:hover {
  color: #cbd5e1;
}

/* Fallbacks for Bootstrap markup */
.auth-card .form-control {
  width: 100%;
  display: block;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #ffffff;
  min-height: 48px;
  font-size: 16px;
  padding: 0.75rem 1rem;
  outline: none;
}
.auth-card .form-control:focus {
  background: rgba(255, 255, 255, 0.08);
  border-color: #38bdf8;
  box-shadow: 0 0 0 4px rgba(56, 189, 248, 0.18);
}
.auth-card .form-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: #e2e8f0;
}
.auth-card .btn-primary {
  background: linear-gradient(135deg, #1a7cff 0%, #4f46e5 50%, #7c3aed 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 999px !important;
  min-height: 48px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(26, 124, 255, 0.4);
}
.auth-card .btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%) !important;
  color: #ffffff !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  border-radius: 999px !important;
  min-height: 48px;
  font-weight: 700;
  box-shadow: 0 10px 28px rgba(16, 185, 129, 0.4);
}
.auth-card .link-light {
  color: #94a3b8 !important;
  text-decoration: none !important;
}
.auth-card .link-light:hover {
  color: #38bdf8 !important;
  text-decoration: underline !important;
}
.auth-card .mb-1 { margin-bottom: 0.25rem; }
.auth-card .mb-2 { margin-bottom: 0.65rem; }
.auth-card .mb-3 { margin-bottom: 1.15rem; }
.auth-card .mt-3 { margin-top: 1.15rem; }
.auth-card .w-100 { width: 100% !important; }
.auth-card .text-secondary { color: #94a3b8 !important; }
.auth-card .d-flex { display: flex !important; }
.auth-card .justify-content-between { justify-content: space-between !important; }
.auth-card .small { font-size: 0.84rem !important; }
.auth-card a { color: #38bdf8; text-decoration: none; transition: color 0.2s ease; }
.auth-card a:hover { color: #7dd3fc; text-decoration: underline; }
.auth-card label { display: block; font-size: 0.86rem; font-weight: 600; color: #e2e8f0; margin-bottom: 0.45rem; }
.auth-card input:not([type="checkbox"]):not([type="radio"]) {
  width: 100%;
  display: block;
  box-sizing: border-box;
}
.auth-card button:not(.auth-input-toggle) {
  font-family: inherit;
}
.chat-box{height:min(420px,55vh);overflow:auto;background:#f8fafc;border-radius:14px;padding:1rem;border:1px solid rgba(15,23,42,.08)}
.chat-bubble{max-width:min(78%,100%);padding:.7rem .9rem;border-radius:14px;margin-bottom:.6rem;word-break:break-word}
.chat-bubble.me{background:#0b5fff;color:#fff;margin-left:auto}
.chat-bubble.them{background:#e2e8f0}
.kanban{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:.75rem}
.kanban-col{background:#eef2f7;border-radius:14px;padding:.75rem;min-height:220px;min-width:0}
.kanban-card{background:#fff;border-radius:12px;padding:.7rem;margin-bottom:.55rem;border:1px solid rgba(15,23,42,.08);font-size:.92rem}
.table-responsive,.dataTables_wrapper{width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch}
.form-control,.form-select,.btn{min-height:44px}
.form-control,.form-select{font-size:16px}

@media(max-width:1199.98px){.stat-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:991.98px){
  .portal-menu-btn{display:inline-flex}
  .portal-sidebar{position:fixed;left:0;top:0;bottom:0;width:min(280px,86vw);height:100vh;transform:translateX(-105%);transition:transform .28s ease;display:block}
  .portal-sidebar.open{transform:translateX(0);box-shadow:0 20px 50px rgba(0,0,0,.35)}
  .portal-content{padding:1rem}
  .stat-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .kanban{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media(max-width:575.98px){
  .stat-grid,.kanban{grid-template-columns:1fr}
  .portal-top .small{display:none}
  .portal-content{padding:.85rem}
  .panel{padding:.9rem;border-radius:14px}
  .chat-bubble{max-width:92%}
}
