:root {
  --bg: #f4f6fb;
  --card: #ffffff;
  --border: #e6e8f0;
  --text: #111827;
  --muted: #6b7280;
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --sidebar: #0f1229;
  --sidebar-text: #a5abc9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 16px rgba(16, 24, 40, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; }
h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
code { background: var(--primary-soft); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.icon { width: 18px; height: 18px; flex-shrink: 0; vertical-align: middle; }

/* ---------- layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 248px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 30; transition: transform .25s; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 26px; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, #6366f1, #4338ca); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(79, 70, 229, .4); }
.brand-logo .icon { width: 20px; height: 20px; stroke-width: 3; }
.brand-logo.big { width: 54px; height: 54px; border-radius: 15px; }
.brand-logo.big .icon { width: 28px; height: 28px; }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 12px; }
.sidebar nav { flex: 1; padding: 0 12px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; color: var(--sidebar-text); font-weight: 500; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: rgba(99, 102, 241, .18); color: #fff; }
.sidebar nav a.active .icon { color: #818cf8; }
.sidebar-foot { display: flex; align-items: center; justify-content: space-between; padding: 16px; border-top: 1px solid rgba(255, 255, 255, .07); }
.me { display: flex; align-items: center; gap: 10px; min-width: 0; }
.me-text { min-width: 0; }
.me-name { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-role { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout { color: var(--sidebar-text); padding: 6px; border-radius: 8px; }
.logout:hover { background: rgba(255, 255, 255, .08); color: #fff; }

.main { flex: 1; margin-left: 248px; min-width: 0; }
.topbar { display: flex; align-items: center; gap: 16px; padding: 22px 32px; background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar h1 { font-size: 20px; font-weight: 700; letter-spacing: -.2px; }
.topbar .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.topbar-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.menu-btn { display: none; background: none; border: 1px solid var(--border); border-radius: 9px; padding: 7px; cursor: pointer; color: var(--text); }
.content { padding: 26px 32px 48px; max-width: 1400px; }

/* ---------- cards / grids ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; overflow-x: auto; min-width: 0; }
.card.no-pad { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h3 { margin: 0; }
.card-note { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-note .icon { width: 15px; height: 15px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.grid-2 > * { min-width: 0; }
.grid-2.wide-left { grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr); }
.grid-2 > .card, .grid-2 > div > .card { margin-bottom: 20px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--primary); }
.stat.c2::before { background: #0891b2; }
.stat.c3::before { background: #059669; }
.stat.c4::before { background: #d97706; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin-top: 4px; }
.stat-value small { font-size: 16px; color: var(--muted); font-weight: 500; }
.stat-foot { font-size: 12px; color: var(--muted); }
.progress, .mini-progress { height: 6px; background: var(--primary-soft); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.progress span, .mini-progress span { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.mini-progress { display: inline-block; width: 60px; vertical-align: middle; margin: 0 6px 0 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fafbfe; white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid #f0f2f7; vertical-align: middle; }
.table tbody tr:hover { background: #fafbff; }
.table tfoot td { border-bottom: 0; padding-top: 14px; }
.table.compact td { padding: 9px 4px; }
.table tr.dim td { opacity: .55; }
.task-cell { min-width: 220px; }
.table td[title] { min-width: 160px; }
.task-title { font-weight: 600; color: var(--text); }
.actions { white-space: nowrap; text-align: right; }
.actions form { display: inline; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); text-decoration: none; }
.icon-btn.danger:hover { background: #fef2f2; color: #dc2626; }
.icon-btn .icon { width: 16px; height: 16px; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px !important; }
.empty.good { color: #059669; display: flex; align-items: center; justify-content: center; gap: 8px; }
.who { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.who > span:not(.avatar) { display: flex; flex-direction: column; white-space: nowrap; }
.who small { font-weight: 400; color: var(--muted); font-size: 12px; }
.who.big { margin-bottom: 18px; font-size: 16px; }

/* ---------- avatar / badges ---------- */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; color: #fff; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge-gray { background: #f1f5f9; color: #475569; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ---------- people list ---------- */
.people { list-style: none; padding: 0; margin: 0; max-height: 320px; overflow: auto; }
.people li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f0f2f7; }
.people li div { display: flex; flex-direction: column; }
.people li div span { font-size: 12px; color: var(--muted); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--border); background: #fff; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { background: #f8f9fc; text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 8px rgba(79, 70, 229, .25); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 11px; }
.link { font-weight: 600; font-size: 13px; }
.inline-form { display: inline-flex; margin: 0; }

/* ---------- forms ---------- */
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: #374151; }
input, select, textarea { font: inherit; font-weight: 400; padding: 9px 12px; border: 1px solid #d5d9e4; border-radius: 9px; background: #fff; color: var(--text); width: 100%; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
textarea { resize: vertical; }
label.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
label.check input { width: auto; }
.form-card { max-width: 860px; }
.form-card.narrow { max-width: 620px; }
.form-card > label { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.span-2 { grid-column: span 2; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.duration { display: flex; align-items: center; gap: 6px; }
.duration input { width: 72px; }
.duration span { font-weight: 400; color: var(--muted); }
.mt { margin-top: 22px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters label { min-width: 140px; }
.filters .grow { flex: 1; min-width: 200px; }
.filter-btns { display: flex; gap: 8px; }
.quick { width: 100%; display: flex; gap: 14px; font-size: 13px; }

/* ---------- alerts ---------- */
.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 18px; font-weight: 500; display: flex; gap: 10px; align-items: center; }
.alert-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; display: block; }
.alert-info { background: var(--primary-soft); color: #3730a3; border: 1px solid #c7d2fe; }

/* ---------- details ---------- */
.details { display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; margin: 0; }
.details dt { color: var(--muted); font-size: 13px; }
.details dd { margin: 0; font-weight: 500; word-break: break-word; }
.detail-badges { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.section-label { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .6px; margin: 14px 0 6px; }
.prose { margin: 0 0 6px; line-height: 1.65; }
.report-frame { width: 100%; height: 78vh; border: 0; display: block; background: #eef2f7; }
.big-time { font-size: 26px; font-weight: 700; display: flex; align-items: center; gap: 10px; margin: 4px 0; }
.big-time .icon { width: 24px; height: 24px; color: var(--primary); }
.big-time small { font-size: 13px; color: var(--muted); font-weight: 500; }
pre.code { background: #0f1229; color: #c7d2fe; padding: 12px 14px; border-radius: 9px; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.err { color: #b91c1c; }

/* ---------- utils ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }

/* ---------- auth ---------- */
.auth-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% -10%, #c7d2fe 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #ddd6fe 0%, transparent 60%), var(--bg); padding: 20px; }
.auth-wrap { display: grid; grid-template-columns: 1fr 1fr; max-width: 900px; width: 100%; background: #fff; border-radius: 22px; overflow: hidden; box-shadow: 0 30px 80px rgba(30, 27, 75, .18); }
.auth-side { background: linear-gradient(150deg, #4338ca, #1e1b4b); color: #e0e7ff; padding: 48px 40px; }
.auth-side h2 { color: #fff; font-size: 26px; margin: 22px 0 10px; }
.auth-side p { line-height: 1.6; }
.auth-side ul { list-style: none; padding: 0; margin: 26px 0 0; display: grid; gap: 12px; }
.auth-side li { display: flex; gap: 10px; align-items: center; }
.auth-side li .icon { color: #a5b4fc; }
.auth-card { padding: 48px 40px; display: flex; flex-direction: column; gap: 16px; }
.auth-card h1 { font-size: 24px; }
.auth-card .muted { margin: -10px 0 6px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-2 > * { min-width: 0; }
.grid-2.wide-left { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 60px rgba(0, 0, 0, .4); }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 14px 16px; flex-wrap: wrap; }
  .topbar-actions { width: 100%; justify-content: flex-start; margin-left: 0; }
  .content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-card { padding: 32px 24px; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 22px; }
}
