:root {
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #4f46e5;
  --brand-2: #312e81;
  --ok: #059669;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
  background: #0f172a;
  color: #e2e8f0;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
}
.brand, .brand-lg { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, #6366f1, #7c3aed);
  display: grid; place-items: center; font-weight: 800;
}
.brand strong, .brand-lg strong { display: block; font-size: 15px; }
.brand small, .brand-lg small { color: #94a3b8; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.side-nav { margin-top: 28px; display: grid; gap: 6px; }
.side-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; color: #cbd5e1; text-decoration: none;
}
.side-nav a svg { width: 18px; height: 18px; }
.side-nav a:hover, .side-nav a.active { background: rgba(255,255,255,.08); color: #fff; }
.nav-count { margin-left: auto; min-width: 20px; text-align: center; padding: 2px 6px; border-radius: 999px; background: #4f46e5; color: #fff; font-size: 10px; }
.sidebar-foot { margin-top: auto; }
.user-chip { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }
.user-chip strong { display: block; font-size: 13px; color: #fff; }
.user-chip small { color: #94a3b8; font-size: 11px; }
.logout { color: #94a3b8; font-size: 12px; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-size: 12px; font-weight: 700;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; }

.main { min-width: 0; }
.topbar {
  display: flex; justify-content: space-between; align-items: flex-end;
  padding: 28px 32px 8px;
}
.eyebrow { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.topbar h1 { margin: 4px 0 0; font-size: 28px; letter-spacing: -.03em; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }
.page { padding: 18px 32px 40px; }

.btn, .btn:visited {
  display: inline-flex; align-items: center; justify-content: center;
  border: 0; border-radius: 12px; padding: 10px 14px; cursor: pointer;
  background: #fff; color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-block { width: 100%; }
.btn-danger { background: #fff; color: var(--danger); }

.input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 10px 12px;
  outline: none;
}
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79,70,229,.12); }
.area { min-height: 140px; resize: vertical; }
label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 600; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi, .card {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.kpi { padding: 18px 18px 16px; }
.kpi span, .kpi small { color: var(--muted); }
.kpi strong { display: block; font-size: 32px; margin: 8px 0 4px; }
.kpi.warn strong { color: var(--danger); }

.split { display: grid; grid-template-columns: 1.2fr .8fr; gap: 14px; margin-bottom: 14px; }
.card { padding: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.card-head h2, .help-card h2 { margin: 0; font-size: 16px; }
.card-head a { color: var(--brand); font-size: 13px; text-decoration: none; }

.work-list { list-style: none; margin: 0; padding: 0; }
.work-list a { display: grid; gap: 4px; padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.work-list .title { font-weight: 600; }
.work-list .meta { color: var(--muted); font-size: 12px; }

.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 28px; gap: 10px; align-items: center; font-size: 13px; }
.bar-row div { height: 8px; background: #eef2ff; border-radius: 99px; overflow: hidden; }
.bar-row i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 8px; border-bottom: 1px solid var(--line); font-size: 14px; }
.table a { text-decoration: none; font-weight: 600; }
.table tr.overdue td { background: #fff7f7; }
.empty { color: var(--muted); padding: 18px 0; }

.project {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted);
}
.project:before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c, #64748b); }

.prio { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; }
.prio.Low { background: #f1f5f9; color: #475569; }
.prio.Medium { background: #eef2ff; color: #4338ca; }
.prio.High { background: #fff7ed; color: #c2410c; }
.prio.Urgent { background: #fef2f2; color: #b91c1c; }

.status { font-size: 12px; font-weight: 600; }
.status.s0 { color: #64748b; }
.status.s1 { color: #4f46e5; }
.status.s2 { color: #d97706; }
.status.s3 { color: #059669; }

.filters { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr) auto; gap: 10px; margin-bottom: 16px; }
.filter-shortcuts { display: flex; gap: 8px; align-items: center; margin: -4px 0 16px; color: var(--muted); font-size: 12px; }
.filter-shortcuts a { padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; background: #fff; text-decoration: none; }
.filter-shortcuts a:hover { border-color: #c7d2fe; color: var(--brand); }
.seg { display: flex; background: #fff; border-radius: 12px; padding: 4px; box-shadow: var(--shadow); }
.seg a { padding: 8px 12px; border-radius: 9px; text-decoration: none; font-size: 13px; }
.seg a.on { background: #eef2ff; color: var(--brand); font-weight: 600; }

.board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; align-items: start; }
.column { background: #eef2f7; border-radius: 18px; padding: 12px; min-height: 60vh; }
.column header { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 12px; }
.column h2 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; }
.column header span { background: #fff; border-radius: 999px; padding: 2px 8px; font-size: 12px; }
.cards { display: grid; gap: 10px; min-height: 120px; }
.task-card {
  background: #fff; border-radius: 14px; padding: 12px; box-shadow: var(--shadow); cursor: grab;
}
.task-card.dragging { opacity: .45; }
.column.over { outline: 2px dashed var(--brand); }
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.task-title { display: block; font-weight: 650; text-decoration: none; margin-bottom: 6px; }
.task-desc { margin: 0 0 10px; color: var(--muted); font-size: 12px; line-height: 1.45; max-height: 38px; overflow: hidden; }
.card-foot { display: flex; justify-content: space-between; align-items: center; }
.due { font-size: 12px; color: var(--muted); }
.due.late { color: var(--danger); font-weight: 700; }

.form-layout { display: grid; grid-template-columns: 1.5fr .7fr; gap: 16px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.detail-grid h3 { margin: 22px 0 8px; font-size: 14px; }
.inline-form { display: grid; grid-template-columns: 1fr minmax(140px,.5fr) auto; gap: 8px; align-items: end; margin-top: 12px; }
.check-row { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.check-row.done > span { text-decoration: line-through; color: var(--muted); }
.check-row span small { display: block; color: var(--muted); font-size: 10px; }
.check-toggle,.inline-delete { border: 0; background: none; color: var(--brand); cursor: pointer; text-decoration: none; }
.inline-delete { color: var(--danger); font-size: 11px; }
.dependency-row,.file-row { display: flex; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.file-row { display: grid; }.file-row small { color: var(--muted); }
.comment { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.comment strong { font-size: 13px; }.comment time { margin-left: 8px; color: var(--muted); font-size: 10px; }.comment p { margin: 5px 0; line-height: 1.5; font-size: 13px; }
.area.compact { min-height: 82px; }
.history-row { display: grid; grid-template-columns: 12px 1fr; gap: 9px; }.history-row>span { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: var(--brand); }.history-row p { margin: 0 0 14px; font-size: 12px; }.history-row small { display: block; color: var(--muted); margin-top: 3px; }
.notification { display: grid; grid-template-columns: 8px 1fr; gap: 12px; padding: 14px 4px; border-bottom: 1px solid var(--line); text-decoration: none; }.notification>span { width: 8px; height: 8px; margin-top: 5px; border-radius: 50%; background: var(--brand); }.notification.read { opacity: .58; }.notification.read>span { background: #cbd5e1; }.notification p { margin: 4px 0; color: var(--muted); font-size: 13px; }.notification small { color: var(--muted); font-size: 10px; }
.sprint-card { display: grid; grid-template-columns: 1fr 220px; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); }.sprint-card p { margin: 5px 0; color: var(--muted); }.sprint-card small { color: var(--muted); }.sprint-progress { display: grid; gap: 5px; text-align: right; }.sprint-progress span { color: var(--muted); font-size: 11px; }.backlog-row { display: grid; grid-template-columns: 1fr auto 130px; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); text-decoration: none; }.backlog-row small { color: var(--muted); }
.workload-row { display: grid; grid-template-columns: auto 140px 1fr 70px 130px; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 12px; }.meter { height: 8px; background: #eef2f7; border-radius: 99px; overflow: hidden; }.meter i { display: block; height: 100%; background: linear-gradient(90deg,#4f46e5,#8b5cf6); }.workload-row small { color: var(--muted); }.insight-list { color: var(--muted); line-height: 1.7; }
.rule-card { display: grid; grid-template-columns: auto 1fr auto; gap: 13px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--line); }.rule-card p { margin: 4px 0; color: var(--muted); font-size: 12px; }.rule-icon { display:grid;place-items:center;width:38px;height:38px;border-radius:11px;background:#f1f5f9;color:#94a3b8;font-size:20px}.rule-icon.active{background:#eef2ff;color:var(--brand)}
.urgent-check { display: flex; align-items: flex-start; gap: 10px; margin-top: 18px; padding: 13px; border: 1px solid #fecaca; background: #fff7f7; border-radius: 12px; cursor: pointer; }
.urgent-check input { margin-top: 4px; accent-color: var(--danger); }
.urgent-check span { display: grid; gap: 3px; }
.urgent-check small { color: var(--muted); font-weight: 400; }
.help-card ol { padding-left: 18px; color: var(--muted); }
.muted { color: var(--muted); }
.alert { background: #fef2f2; color: #991b1b; padding: 10px 12px; border-radius: 12px; margin: 12px 0; }
.alert.success { background: #ecfdf5; color: #065f46; }

.management-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.section-note { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.count-pill, .role-badge { padding: 4px 9px; border-radius: 999px; background: #eef2ff; color: var(--brand); font-size: 11px; font-weight: 700; }
.people-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.person-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.person-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.person-head div { min-width: 0; display: grid; gap: 3px; }
.person-head div span { overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 11px; }
.avatar.avatar-lg { width: 42px; height: 42px; }
.person-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.person-stats > * { display: grid; gap: 2px; padding: 8px 4px; border-radius: 9px; background: #f8fafc; text-align: center; text-decoration: none; }
.person-stats b { font-size: 15px; }
.person-stats span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.person-stats .danger b { color: var(--danger); }
.create-panel { position: sticky; top: 16px; }
.create-panel h2 { margin: 12px 0 4px; font-size: 18px; }
.panel-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: #eef2ff; color: var(--brand); font-size: 22px; font-weight: 600; }
.panel-icon.folder { font-size: 13px; }
.panel-action { margin-top: 18px; }
.project-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.project-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 16px; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; transition: transform .15s, box-shadow .15s; }
.project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.project-symbol { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: white; font-weight: 800; }
.project-card-title { display: grid; gap: 4px; }
.project-card-title span { color: var(--muted); font-size: 11px; }
.project-card > b { font-size: 13px; color: var(--muted); }
.progress { grid-column: 2 / 4; height: 6px; background: #eef2f7; overflow: hidden; border-radius: 999px; }
.progress i { display: block; height: 100%; border-radius: inherit; }

.auth-body { background: #0b1220; }
.auth-layout { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.auth-hero {
  padding: 64px;
  color: #e2e8f0;
  background:
    radial-gradient(800px 400px at 20% 20%, rgba(99,102,241,.35), transparent 60%),
    linear-gradient(180deg, #0b1220, #111827);
}
.auth-hero h2 { font-size: 46px; line-height: 1.1; letter-spacing: -.04em; margin: 48px 0 12px; color: #fff; }
.auth-hero p { max-width: 460px; color: #94a3b8; }
.hero-points { padding: 0; list-style: none; margin-top: 32px; }
.hero-points li { margin: 10px 0; color: #cbd5e1; }
.hero-points li:before { content: "▸ "; color: #818cf8; }
.auth-panel { display: grid; place-items: center; background: #f8fafc; }
.auth-card { width: min(420px, 92vw); background: #fff; padding: 32px; border-radius: 24px; box-shadow: var(--shadow); }
.auth-card h1 { margin: 0 0 8px; }
.remember { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.demo-box { margin-top: 22px; background: #f8fafc; border-radius: 14px; padding: 12px; display: grid; gap: 6px; }
.demo-box code { font-size: 12px; color: #334155; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; flex-wrap: wrap; gap: 12px; }
  .side-nav { margin: 0; grid-auto-flow: column; }
  .sidebar-foot { margin: 0 0 0 auto; display: flex; gap: 12px; align-items: center; }
  .kpi-grid, .split, .board, .form-layout, .auth-layout, .filters, .management-layout, .detail-grid { grid-template-columns: 1fr; }
  .board { overflow: auto; }
  .create-panel { position: static; }
}

@media (max-width: 700px) {
  .sidebar { display: block; padding: 14px; }
  .side-nav { display: flex; overflow-x: auto; margin-top: 14px; padding-bottom: 4px; }
  .side-nav a { flex: 0 0 auto; }
  .sidebar-foot { display: none; }
  .topbar { padding: 20px 16px 6px; align-items: center; }
  .topbar h1 { font-size: 22px; }
  .page { padding: 14px 16px 28px; }
  .topbar-actions .seg { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .people-grid, .project-grid { grid-template-columns: 1fr; }
  .filter-shortcuts { overflow-x: auto; padding-bottom: 5px; }
  .filter-shortcuts > * { flex: 0 0 auto; }
  .card { overflow-x: auto; }
  .auth-hero { display: none; }
}
