:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --text: #182742;
  --muted: #60708c;
  --line: #d7e0ee;
  --blue: #143d8d;
  --blue-2: #1f5bd6;
  --orange: #ff7a00;
  --orange-soft: #fff2e6;
  --green: #22a559;
  --green-soft: #edf9f1;
  --red-soft: #fff0ef;
  --shadow: 0 12px 40px rgba(20, 61, 141, 0.10);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; background: var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 16px; background: linear-gradient(135deg, var(--blue), var(--blue-2)); color: white; padding: 16px 22px; min-height: 56px; font-weight: 700; font-size: 16px; box-shadow: 0 10px 24px rgba(20,61,141,0.18); }
button:hover { transform: translateY(-1px); }
button.ghost { background: #edf2ff; color: var(--blue); box-shadow: none; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; background: white; min-height: 54px; }
textarea { resize: vertical; }
.card { background: var(--card); border: 1px solid #e7edf6; border-radius: 18px; box-shadow: var(--shadow); }
.muted { color: var(--muted); }
.brand-mark { display: inline-flex; align-items: center; justify-content: center; width: 84px; height: 84px; border-radius: 22px; background: linear-gradient(135deg, var(--blue), #0d2d6f); color: white; font-size: 30px; font-weight: 800; letter-spacing: 0.08em; margin-bottom: 18px; }
.brand-mark.small { width: 58px; height: 58px; border-radius: 16px; font-size: 22px; margin-bottom: 10px; }
.brand-row { display: flex; align-items: center; gap: 18px; margin-bottom: 8px; }
.brand-logo { width: 72px; height: 72px; border-radius: 18px; background: white; box-shadow: 0 10px 30px rgba(20,61,141,0.12); object-fit: contain; padding: 8px; }
.brand-copy h1 { margin: 4px 0 0; }
.brand-kicker { color: var(--blue); font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-note { font-size: 16px; max-width: 880px; }
.login-logo { width: 96px; height: 96px; object-fit: contain; background: white; border-radius: 24px; box-shadow: 0 16px 40px rgba(20,61,141,0.18); padding: 10px; margin-bottom: 16px; }
.login-body { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0f2b67, #19489f 55%, #ff7a00 180%); }
.login-shell { width: min(92vw, 460px); background: rgba(255,255,255,0.98); border-radius: 28px; padding: 36px; box-shadow: 0 20px 60px rgba(0,0,0,0.18); text-align: center; }
.login-card { display: grid; gap: 12px; margin-top: 24px; text-align: left; }
.error { color: #c53232; min-height: 24px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding: 32px; background: linear-gradient(135deg, #fff 0%, #f7faff 55%, #fff4ea 130%); border-bottom: 1px solid #e7edf6; }
.topbar h1 { margin: 0 0 10px; font-size: 36px; line-height: 1.06; }
.hero-meta { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-box { min-width: 210px; background: white; border: 1px solid var(--line); border-radius: 18px; padding: 18px 18px; box-shadow: 0 8px 24px rgba(20,61,141,0.08); }
.hero-box span { display: block; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.layout { display: grid; grid-template-columns: 320px 1fr; gap: 22px; padding: 22px; }
.sidebar { padding: 18px; max-height: calc(100vh - 140px); overflow: auto; position: sticky; top: 18px; }
.content { display: grid; gap: 18px; }
.filters, .stats-card { padding: 18px; }
.section-title { font-size: 20px; font-weight: 700; margin-bottom: 14px; }
.filters-grid { display: grid; grid-template-columns: 1fr 220px; gap: 12px; }
.summary-line { margin-top: 12px; color: var(--muted); }
.tree-help { margin: -2px 0 14px; color: var(--muted); font-size: 14px; line-height: 1.45; }
.tree { display: grid; gap: 8px; }
.tree-node { border: 1px solid #edf2fb; border-radius: 16px; padding: 12px 14px; background: #fbfdff; cursor: pointer; transition: 0.18s ease; }
.tree-node:hover { border-color: #c9d8f2; background: #f4f8ff; transform: translateY(-1px); }
.tree-node.active { border-color: var(--orange); background: linear-gradient(135deg, #fff8f2, var(--orange-soft)); box-shadow: 0 10px 24px rgba(255,122,0,0.12); }
.tree-node-header { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.tree-node-title { font-weight: 700; font-size: 15px; }
.tree-node small { color: var(--muted); }
.tree-children { margin-top: 8px; padding-left: 14px; border-left: 2px solid #edf2fb; display: grid; gap: 8px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-chip { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: #fbfdff; }
.stat-chip span { display: block; color: var(--muted); font-size: 13px; }
.stat-chip strong { display: block; font-size: 28px; margin-top: 6px; }
.stats-table-wrap { overflow: auto; }
.stats-table { width: 100%; border-collapse: collapse; min-width: 680px; }
.stats-table th, .stats-table td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #edf2fb; vertical-align: top; }
.stats-table th { color: var(--muted); font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 16px; }
.person-card { padding: 18px; border: 1px solid #e7edf6; }
.person-card.online { border: 2px solid var(--green); background: linear-gradient(180deg, #fff, var(--green-soft)); }
.card-top { display: flex; justify-content: space-between; gap: 12px; }
.card-index { color: var(--orange); font-weight: 800; margin-bottom: 8px; }
.card-role { margin: 0 0 8px; font-size: 19px; }
.card-unit { font-size: 14px; line-height: 1.45; }
.status-badges { display: flex; gap: 8px; flex-wrap: wrap; align-content: flex-start; }
.badge { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 7px 11px; font-size: 12px; font-weight: 700; }
.badge.present { background: #edf9f1; color: #1f7a45; }
.badge.absent { background: #f2f5f9; color: #6f7f9d; }
.badge.online { background: #e8fff0; color: #138c47; }
.checkin-grid { display: grid; grid-template-columns: 1.4fr 170px 1fr 170px; gap: 12px; margin: 18px 0; align-items: center; }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input { width: auto; }
.pains-block { border-top: 1px solid #edf2fb; padding-top: 14px; }
.pains-title { font-weight: 700; margin-bottom: 10px; }
.pain-form-row { display: grid; grid-template-columns: 1fr 170px; gap: 12px; margin-bottom: 14px; }
.pain-item { border: 1px solid #edf2fb; border-radius: 14px; padding: 12px; background: #fbfdff; margin-bottom: 10px; }
.pain-item-header { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pain-actions { display: flex; gap: 8px; }
.pain-actions button { padding: 8px 10px; border-radius: 10px; }
.pain-actions .edit-btn { background: #edf2ff; color: var(--blue); }
.pain-actions .delete-btn { background: var(--red-soft); color: #b14545; }
.empty-note { color: var(--muted); font-size: 14px; }
@media (max-width: 1180px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
}
.hero-link { text-decoration: none; color: inherit; display: block; }
.painmap-layout { padding: 22px; }
.painmap-content { display: grid; gap: 18px; }
.timeline-card { padding: 18px; }
.pain-feed { display: grid; gap: 10px; max-height: 360px; overflow: auto; }
.feed-item { border: 1px solid #edf2fb; border-radius: 14px; padding: 12px; background: #fbfdff; }
.feed-meta { display: flex; gap: 10px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.feed-text { line-height: 1.45; }
.insight-text { color: var(--text); line-height: 1.6; }
.pain-clusters { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 16px; }
.cluster-card { padding: 18px; }
.cluster-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.cluster-head h3 { margin: 6px 0 0; font-size: 22px; }
.cluster-rank { color: var(--orange); font-weight: 800; }
.cluster-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.cluster-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-title { font-weight: 700; margin-bottom: 10px; }
.mini-list { margin: 0; padding-left: 18px; color: var(--text); }
.mini-list li { margin-bottom: 8px; line-height: 1.45; }
@media (max-width: 860px) {
  .topbar { flex-direction: column; }
  .filters-grid, .checkin-grid, .pain-form-row, .stats-grid, .cluster-columns { grid-template-columns: 1fr; }
  .cards, .pain-clusters { grid-template-columns: 1fr; }
}
