:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e6e9f0;
  --text: #1a2333;
  --muted: #6b7280;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #0ea5e9;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --shadow-lg: 0 10px 30px rgba(16,24,40,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.hidden { display: none !important; }

/* Login */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #3b82f6 100%);
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-brand { text-align: center; margin-bottom: 28px; }
.login-brand h1 { font-size: 24px; margin: 12px 0 4px; }
.login-brand p { color: var(--muted); font-size: 14px; }
.brand-mark {
  width: 52px; height: 52px; margin: 0 auto;
  border-radius: 14px;
  background: linear-gradient(135deg,#2563eb,#1d4ed8);
  color: #fff; font-weight: 800; font-size: 20px;
  display: flex; align-items: center; justify-content: center;
}
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card label { font-size: 13px; font-weight: 600; color: var(--text); }
.login-card input {
  padding: 11px 14px; border: 1px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit;
}
.login-card input:focus { outline: 2px solid var(--primary); border-color: transparent; }
.login-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 10px; border: none;
  font-size: 14px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-outline:hover { background: #f1f5f9; }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* App shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; background: #0f172a; color: #cbd5e1;
  display: flex; flex-direction: column;
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
  transition: transform .25s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand .brand-mark { width: 38px; height: 38px; font-size: 15px; margin: 0; }
.sidebar-brand span { color: #fff; font-weight: 700; font-size: 15px; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px; color: #cbd5e1;
  text-decoration: none; font-size: 14px; font-weight: 500;
  transition: .15s;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon { font-size: 16px; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg,#3b82f6,#2563eb);
  color: #fff; font-weight: 700; font-size: 13px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.avatar.small { width: 32px; height: 32px; font-size: 12px; }
.user-meta { flex: 1; min-width: 0; }
.user-meta span { display: block; color: #fff; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta small { color: #94a3b8; font-size: 11px; }
.logout-btn { background: none; border: none; color: #94a3b8; font-size: 16px; cursor: pointer; }
.logout-btn:hover { color: #fff; }

.main { flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  height: 66px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px; padding: 0 24px;
  position: sticky; top: 0; z-index: 40;
}
.hamburger { display: none; background: none; border: none; font-size: 22px; cursor: pointer; }
.topbar-title { font-size: 18px; font-weight: 700; flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.icon-btn { position: relative; background: none; border: none; font-size: 20px; cursor: pointer; }
.badge {
  position: absolute; top: -6px; right: -8px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.notification-wrap { position: relative; }
.notif-panel {
  position: absolute; right: 0; top: 40px; width: 340px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: var(--shadow-lg); overflow: hidden; z-index: 60;
}
.notif-header { padding: 14px 16px; font-weight: 700; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 380px; overflow-y: auto; }
.notif-item { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border); }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #eff6ff; }
.notif-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.notif-dot.success { background: var(--success); }
.notif-dot.danger { background: var(--danger); }
.notif-dot.warning { background: var(--warning); }
.notif-dot.info { background: var(--info); }
.notif-item h4 { font-size: 13px; font-weight: 600; }
.notif-item p { font-size: 12px; color: var(--muted); }
.notif-item time { font-size: 11px; color: var(--muted); }

.content { padding: 28px; }

/* Cards & grids */
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-size: 22px; font-weight: 800; }
.page-head p { color: var(--muted); font-size: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px;
}
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-bottom: 24px; }
.kpi-card { display: flex; align-items: center; gap: 16px; }
.kpi-icon { width: 52px; height: 52px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; }
.kpi-icon.blue { background: #eff6ff; }
.kpi-icon.green { background: #ecfdf5; }
.kpi-icon.amber { background: #fffbeb; }
.kpi-icon.red { background: #fef2f2; }
.kpi-value { font-size: 26px; font-weight: 800; line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: 13px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }

/* Projects */
.project-card { display: flex; flex-direction: column; gap: 14px; }
.project-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.project-top h3 { font-size: 17px; font-weight: 700; }
.project-client { color: var(--muted); font-size: 13px; }
.project-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 4px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.chip.blue { background: #eff6ff; color: #1d4ed8; }
.chip.green { background: #ecfdf5; color: #15803d; }
.chip.amber { background: #fffbeb; color: #b45309; }
.chip.red { background: #fef2f2; color: #b91c1c; }
.chip.gray { background: #f1f5f9; color: #475569; }
.progress { height: 8px; background: #eef2f7; border-radius: 10px; overflow: hidden; }
.progress-bar { height: 100%; background: linear-gradient(90deg,#2563eb,#3b82f6); border-radius: 10px; transition: width .5s; }
.progress-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* Project detail */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.detail-head h2 { font-size: 22px; font-weight: 800; }
.detail-head .desc { color: var(--muted); max-width: 600px; margin-top: 6px; }
.milestone-list { display: flex; flex-direction: column; gap: 12px; }
.milestone { display: flex; align-items: center; gap: 12px; }
.milestone-status { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.milestone-status.done { background: var(--success); color: #fff; }
.milestone-status.progress { background: var(--warning); color: #fff; }
.milestone-status.upcoming { background: #e5e7eb; color: #6b7280; }
.milestone-info { flex: 1; }
.milestone-info h4 { font-size: 14px; font-weight: 600; }
.milestone-info small { color: var(--muted); }

.team-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.team-member { display: flex; align-items: center; gap: 10px; }
.team-member .avatar { width: 36px; height: 36px; font-size: 12px; }
.team-member h4 { font-size: 13px; font-weight: 600; }
.team-member small { color: var(--muted); font-size: 12px; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.tl-item { position: relative; margin-bottom: 16px; }
.tl-item::before { content: ''; position: absolute; left: -20px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--primary); }
.tl-item h4 { font-size: 14px; font-weight: 600; }
.tl-item small { color: var(--muted); }

.activity-list { display: flex; flex-direction: column; gap: 14px; }
.activity-item { display: flex; gap: 12px; }
.activity-item .avatar { width: 32px; height: 32px; font-size: 11px; }
.activity-item p { font-size: 13px; }
.activity-item p strong { font-weight: 600; }
.activity-item small { color: var(--muted); font-size: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
tr:hover td { background: #f8fafc; }
.clickable { cursor: pointer; }
.clickable:hover { color: var(--primary); }

/* Forms */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-group label { font-size: 13px; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea {
  padding: 10px 13px; border: 1px solid var(--border); border-radius: 10px; font-size: 14px; font-family: inherit;
}
.form-group textarea { resize: vertical; min-height: 90px; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }

/* Empty / misc */
.empty { text-align: center; color: var(--muted); padding: 30px; }

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .content { padding: 18px; }
  .notif-panel { width: 300px; right: -40px; }
}
