/* ============ VARIABLES ============ */
:root {
  --navy: #003B5C;
  --blue: #00587C;
  --turquoise: #0092BC;
  --teal: #6AD1E3;
  --teal-light: #E8F8FB;
  --navy-dark: #002A42;
  --white: #FFFFFF;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-400: #9CA3AF;
  --gray-500: #6B7280;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --green: #10B981;
  --green-light: #D1FAE5;
  --red: #EF4444;
  --red-light: #FEE2E2;
  --orange: #F59E0B;
  --orange-light: #FEF3C7;
  --purple: #8B5CF6;
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,.1), 0 10px 10px rgba(0,0,0,.04);
  --transition: all .2s ease;
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body { font-family: 'Barlow', -apple-system, sans-serif; background: var(--gray-50); color: var(--gray-800); line-height: 1.6; overflow-x: hidden; }
a { color: var(--turquoise); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

/* ============ LOGIN ============ */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 50%, var(--turquoise) 100%); padding: 20px; }
.login-card { background: var(--white); border-radius: var(--radius); padding: 48px 40px; max-width: 440px; width: 100%; box-shadow: var(--shadow-xl); }
.login-logo { text-align: center; margin-bottom: 32px; }
.logo-icon { width: 64px; height: 64px; background: var(--navy); border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--teal); font-size: 28px; margin-bottom: 16px; }
.login-logo h1 { font-size: 28px; font-weight: 700; color: var(--navy); }
.login-subtitle { color: var(--gray-500); font-size: 15px; margin-top: 4px; }
.login-tabs { display: flex; gap: 0; margin-bottom: 24px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm); overflow: hidden; }
.login-tab { flex: 1; padding: 10px; font-size: 14px; font-weight: 600; color: var(--gray-500); background: var(--white); transition: var(--transition); }
.login-tab.active { background: var(--navy); color: var(--white); }
.login-hint { font-size: 14px; color: var(--gray-500); margin-bottom: 16px; line-height: 1.5; }
.input { width: 100%; padding: 12px 16px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 15px; transition: var(--transition); margin-bottom: 16px; outline: none; }
.input:focus { border-color: var(--turquoise); box-shadow: 0 0 0 3px rgba(0,146,188,.15); }
select.input { appearance: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 16px center var(--white); }
textarea.input { min-height: 100px; resize: vertical; }
.error-msg { color: var(--red); font-size: 14px; text-align: center; margin-top: 12px; }

/* ============ BUTTONS ============ */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 20px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; transition: var(--transition); white-space: nowrap; }
.btn-primary { background: var(--turquoise); color: var(--white); }
.btn-primary:hover { background: var(--blue); text-decoration: none; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-success { background: var(--green); color: var(--white); }
.btn-danger { background: var(--red); color: var(--white); }
.btn-small { padding: 6px 12px; font-size: 13px; }
.btn-full { width: 100%; justify-content: center; padding: 14px; font-size: 16px; }
.btn-outline { border: 2px solid var(--turquoise); color: var(--turquoise); background: transparent; }
.btn-outline:hover { background: var(--turquoise); color: var(--white); }

/* ============ LAYOUT ============ */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar-width); background: var(--navy-dark); color: var(--white); display: flex; flex-direction: column; z-index: 1000; transition: transform .3s ease; }
.sidebar-header { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; }
.sidebar-logo { width: 36px; height: 36px; background: var(--turquoise); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 16px; color: var(--white); flex-shrink: 0; }
.sidebar-brand { font-size: 18px; font-weight: 700; }
.sidebar-close { display: none; color: var(--gray-400); font-size: 18px; margin-left: auto; }
.sidebar-user { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--turquoise); display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 14px; color: var(--white); flex-shrink: 0; }
.avatar-sm { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.sidebar-user-name { font-size: 14px; font-weight: 600; }
.sidebar-user-title { font-size: 12px; color: var(--gray-400); }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; list-style: none; }
.sidebar-nav li { padding: 0 12px; }
.sidebar-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); color: var(--gray-300); font-size: 14px; font-weight: 500; transition: var(--transition); text-decoration: none; }
.sidebar-nav a:hover { background: rgba(255,255,255,.08); color: var(--white); }
.sidebar-nav a.active { background: var(--turquoise); color: var(--white); }
.sidebar-nav a i { width: 20px; text-align: center; font-size: 15px; }
.sidebar-nav .nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--gray-400); padding: 20px 12px 8px; font-weight: 600; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.btn-logout { color: var(--gray-400); font-size: 14px; display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 0; }
.btn-logout:hover { color: var(--white); }

.content { margin-left: var(--sidebar-width); min-height: 100vh; }
.topbar { height: var(--topbar-height); display: flex; align-items: center; gap: 16px; padding: 0 32px; background: var(--white); border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 100; }
.topbar-title { font-size: 20px; font-weight: 600; color: var(--navy); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.hamburger { display: none; font-size: 20px; color: var(--gray-600); }
.page-content { padding: 32px; max-width: 1200px; }

/* ============ CARDS ============ */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 16px; font-weight: 600; color: var(--navy); }
.card-subtitle { font-size: 13px; color: var(--gray-500); }

/* ============ WELCOME BANNER ============ */
.welcome-banner { background: linear-gradient(135deg, var(--navy) 0%, var(--blue) 60%, var(--turquoise) 100%); border-radius: var(--radius); padding: 32px; color: var(--white); margin-bottom: 24px; position: relative; overflow: hidden; }
.welcome-banner::after { content: ''; position: absolute; right: -40px; top: -40px; width: 200px; height: 200px; background: rgba(255,255,255,.06); border-radius: 50%; }
.welcome-banner h2 { font-size: 24px; margin-bottom: 8px; }
.welcome-banner p { color: var(--teal); font-size: 15px; }
.welcome-banner .welcome-meta { display: flex; gap: 24px; margin-top: 16px; flex-wrap: wrap; }
.welcome-banner .welcome-meta span { display: flex; align-items: center; gap: 6px; font-size: 14px; color: rgba(255,255,255,.8); }

/* ============ PROGRESS RING ============ */
.progress-ring-container { display: flex; align-items: center; gap: 24px; }
.progress-ring { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.progress-ring svg { transform: rotate(-90deg); }
.progress-ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.progress-ring .bg { stroke: var(--gray-200); }
.progress-ring .fg { stroke: var(--turquoise); transition: stroke-dashoffset .8s ease; }
.progress-ring .percent { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: 700; color: var(--navy); }

/* ============ PHASE TRACKER ============ */
.phase-tracker { display: flex; gap: 4px; margin: 24px 0; overflow-x: auto; padding-bottom: 8px; }
.phase-step { flex: 1; min-width: 120px; text-align: center; position: relative; }
.phase-step .phase-dot { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; font-size: 18px; transition: var(--transition); }
.phase-step .phase-dot.completed { background: var(--green); color: var(--white); }
.phase-step .phase-dot.current { background: var(--turquoise); color: var(--white); box-shadow: 0 0 0 4px var(--teal-light); }
.phase-step .phase-dot.upcoming { background: var(--gray-200); color: var(--gray-400); }
.phase-step .phase-label { font-size: 12px; font-weight: 600; color: var(--gray-600); }
.phase-step .phase-sublabel { font-size: 11px; color: var(--gray-400); }
.phase-connector { width: 100%; height: 3px; background: var(--gray-200); position: absolute; top: 20px; left: 50%; z-index: -1; }
.phase-connector.done { background: var(--green); }

/* ============ TASK LIST ============ */
.task-phase { margin-bottom: 32px; }
.task-phase-header { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; cursor: pointer; }
.task-phase-header .phase-icon { font-size: 24px; }
.task-phase-header h3 { font-size: 18px; font-weight: 600; color: var(--navy); }
.task-phase-header .phase-count { font-size: 13px; color: var(--gray-500); margin-left: auto; }
.task-phase-header .phase-progress { width: 120px; height: 6px; background: var(--gray-200); border-radius: 3px; overflow: hidden; }
.task-phase-header .phase-progress-bar { height: 100%; background: var(--turquoise); border-radius: 3px; transition: width .5s ease; }

.task-item { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-radius: var(--radius-sm); border: 1px solid var(--gray-200); margin-bottom: 8px; transition: var(--transition); cursor: pointer; }
.task-item:hover { border-color: var(--turquoise); box-shadow: var(--shadow); }
.task-item.completed { opacity: .7; }
.task-item.completed .task-title { text-decoration: line-through; color: var(--gray-400); }
.task-check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--gray-300); display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px; transition: var(--transition); }
.task-item.completed .task-check { background: var(--green); border-color: var(--green); color: var(--white); }
.task-info { flex: 1; }
.task-title { font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.task-desc { font-size: 13px; color: var(--gray-500); }
.task-badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; text-transform: uppercase; }
.task-badge.required { background: var(--orange-light); color: #B45309; }
.task-badge.optional { background: var(--gray-100); color: var(--gray-500); }
.task-type-icon { color: var(--gray-400); font-size: 14px; }

/* ============ STATS GRID ============ */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-icon.blue { background: #E0F2FE; color: var(--turquoise); }
.stat-icon.green { background: var(--green-light); color: var(--green); }
.stat-icon.orange { background: var(--orange-light); color: var(--orange); }
.stat-icon.purple { background: #EDE9FE; color: var(--purple); }
.stat-value { font-size: 28px; font-weight: 700; color: var(--navy); line-height: 1; }
.stat-label { font-size: 13px; color: var(--gray-500); }

/* ============ TABLE ============ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { text-align: left; padding: 12px 16px; border-bottom: 2px solid var(--gray-200); color: var(--gray-500); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
tbody td { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); }
tbody tr:hover { background: var(--gray-50); }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.status-badge.active { background: var(--green-light); color: #065F46; }
.status-badge.paused { background: var(--orange-light); color: #92400E; }
.status-badge.completed { background: #DBEAFE; color: #1E40AF; }
.progress-bar { height: 8px; background: var(--gray-200); border-radius: 4px; overflow: hidden; min-width: 100px; }
.progress-bar-fill { height: 100%; border-radius: 4px; transition: width .5s ease; }
.progress-bar-fill.low { background: var(--red); }
.progress-bar-fill.mid { background: var(--orange); }
.progress-bar-fill.high { background: var(--turquoise); }
.progress-bar-fill.done { background: var(--green); }
.overdue-badge { background: var(--red-light); color: var(--red); padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }

/* ============ RESOURCE CARDS ============ */
.resource-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.resource-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; cursor: pointer; transition: var(--transition); border: 2px solid transparent; }
.resource-card:hover { border-color: var(--turquoise); transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.resource-card .resource-cat { font-size: 11px; font-weight: 600; text-transform: uppercase; color: var(--turquoise); letter-spacing: .5px; margin-bottom: 8px; }
.resource-card h3 { font-size: 16px; color: var(--navy); margin-bottom: 8px; }
.resource-card p { font-size: 13px; color: var(--gray-500); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.resource-filter { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn { padding: 6px 16px; border-radius: 20px; font-size: 13px; font-weight: 500; background: var(--gray-100); color: var(--gray-600); transition: var(--transition); }
.filter-btn.active { background: var(--navy); color: var(--white); }

/* ============ SEARCH ============ */
.search-bar { position: relative; margin-bottom: 20px; }
.search-bar input { width: 100%; padding: 12px 16px 12px 44px; border: 2px solid var(--gray-200); border-radius: var(--radius-sm); font-size: 15px; outline: none; }
.search-bar input:focus { border-color: var(--turquoise); }
.search-bar i { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--gray-400); }

/* ============ CHAT BOT ============ */
.chat-container { max-width: 700px; }
.chat-messages { min-height: 300px; max-height: 500px; overflow-y: auto; padding: 20px; background: var(--gray-50); border-radius: var(--radius); margin-bottom: 16px; }
.chat-msg { display: flex; gap: 12px; margin-bottom: 16px; }
.chat-msg .avatar { flex-shrink: 0; }
.chat-msg .msg-bubble { background: var(--white); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow); font-size: 14px; line-height: 1.6; max-width: 80%; }
.chat-msg.user { flex-direction: row-reverse; }
.chat-msg.user .msg-bubble { background: var(--turquoise); color: var(--white); }
.chat-input-row { display: flex; gap: 8px; }
.chat-input-row input { flex: 1; }
.chat-sources { margin-top: 8px; font-size: 12px; color: var(--gray-500); }
.chat-sources a { color: var(--turquoise); }

/* ============ MODAL ============ */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--white); border-radius: var(--radius); max-width: 600px; width: 100%; max-height: 80vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px; border-bottom: 1px solid var(--gray-200); }
.modal-header h3 { font-size: 18px; color: var(--navy); }
.modal-close { font-size: 18px; color: var(--gray-400); }
.modal-body { padding: 24px; }
.modal-body .form-group { margin-bottom: 16px; }
.modal-body label { display: block; font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.modal-body .resource-content { font-size: 14px; line-height: 1.8; color: var(--gray-700); white-space: pre-wrap; }

/* ============ CONFETTI ============ */
.confetti-container { position: fixed; inset: 0; pointer-events: none; z-index: 9999; }
.confetti-piece { position: absolute; width: 10px; height: 10px; top: -10px; opacity: 1; animation: confetti-fall 3s ease-out forwards; }
@keyframes confetti-fall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ============ DUE TODAY ============ */
.due-today { background: var(--orange-light); border-radius: var(--radius); padding: 20px; margin-bottom: 24px; }
.due-today h3 { color: #92400E; font-size: 15px; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.due-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; font-size: 14px; }
.due-item i { color: var(--orange); }

/* ============ QUICK LINKS ============ */
.quick-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.quick-link { background: var(--white); border: 2px solid var(--gray-200); border-radius: var(--radius); padding: 20px 16px; text-align: center; transition: var(--transition); cursor: pointer; text-decoration: none; }
.quick-link:hover { border-color: var(--turquoise); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.quick-link i { font-size: 24px; color: var(--turquoise); margin-bottom: 8px; display: block; }
.quick-link span { font-size: 13px; font-weight: 600; color: var(--gray-700); }

/* ============ TEAM CARDS ============ */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.team-card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; text-align: center; }
.team-card .avatar { margin: 0 auto 12px; width: 56px; height: 56px; font-size: 20px; }
.team-card h4 { font-size: 15px; color: var(--navy); margin-bottom: 4px; }
.team-card .team-title { font-size: 13px; color: var(--gray-500); margin-bottom: 8px; }
.team-card .team-fact { font-size: 12px; color: var(--turquoise); font-style: italic; }

/* ============ MANAGER PLAYBOOK ============ */
.playbook-item { border-left: 3px solid var(--turquoise); padding: 16px 20px; background: var(--white); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin-bottom: 12px; }
.playbook-item h4 { font-size: 15px; color: var(--navy); margin-bottom: 4px; }
.playbook-item p { font-size: 13px; color: var(--gray-600); }
.playbook-item ul { font-size: 13px; color: var(--gray-600); padding-left: 20px; margin-top: 8px; }

/* ============ CREATE FORM ============ */
.create-form { max-width: 600px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.magic-link-result { background: var(--green-light); border-radius: var(--radius-sm); padding: 16px; margin-top: 16px; }
.magic-link-result a { word-break: break-all; font-weight: 600; }

/* ============ TABS ============ */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; }
.tab { padding: 12px 20px; font-size: 14px; font-weight: 600; color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.tab.active { color: var(--turquoise); border-bottom-color: var(--turquoise); }
.tab:hover { color: var(--navy); }

/* ============ EMPTY STATE ============ */
.empty-state { text-align: center; padding: 60px 20px; }
.empty-state i { font-size: 48px; color: var(--gray-300); margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; color: var(--gray-600); margin-bottom: 8px; }
.empty-state p { font-size: 14px; color: var(--gray-400); }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close { display: block; }
  .hamburger { display: block; }
  .content { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
  .welcome-banner { padding: 24px; }
  .welcome-banner h2 { font-size: 20px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .form-row { grid-template-columns: 1fr; }
  .phase-tracker { gap: 2px; }
  .resource-grid { grid-template-columns: 1fr; }
  .team-grid { grid-template-columns: repeat(2, 1fr); }
  .quick-links { grid-template-columns: repeat(2, 1fr); }
  .table-wrap { font-size: 13px; }
  .modal { margin: 10px; }
}
