body { padding-top: var(--header-h); }

.sidebar-w { --sidebar-w: 300px; }

.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); padding: 44px 40px; width: 100%; max-width: 380px; }
.login-logo-row { display: flex; align-items: center; gap: 9px; margin-bottom: 24px; }
.login-title { font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.login-title span { color: var(--accent); }
.login-submit { width: 100%; margin-top: 6px; padding: 12px; font-size: 14px; }

#appLayout { display: none; padding-top: var(--header-h); min-height: 100vh; }
.user-pill-hdr { display: none; }

.sidebar {
  position: fixed; top: var(--header-h); left: 0; bottom: 0; width: 300px;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden; z-index: 100;
}
.sidebar-head { padding: 16px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sidebar-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--text-muted); margin-bottom: 10px; }
.sidebar-search { position: relative; margin-bottom: 10px; }
.sidebar-search input { width: 100%; background: var(--bg); border: 1px solid var(--border); font-family: 'Inter', sans-serif; font-size: 13px; color: var(--text); padding: 8px 10px 8px 32px; border-radius: var(--r-sm); }
.sidebar-search input:focus { outline: none; border-color: var(--accent); background: #fff; }
.sidebar-search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; stroke: var(--text-muted); fill: none; stroke-width: 2; }
.manager-select { width: 100%; background: var(--bg); border: 1px solid var(--border); font-family: 'Inter', sans-serif; font-size: 13px; color: var(--text); padding: 8px 10px; border-radius: var(--r-sm); cursor: pointer; }
.manager-select:focus { outline: none; border-color: var(--accent); background: #fff; }
.filter-chips { display: flex; gap: 5px; margin-top: 10px; flex-wrap: wrap; }
.chip { font-family: 'Inter', sans-serif; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 20px; border: 1px solid var(--border); background: var(--bg); color: var(--text-muted); cursor: pointer; transition: all .15s; white-space: nowrap; }
.chip:hover, .chip.active { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.sidebar-count { font-size: 11px; color: var(--text-muted); margin-top: 8px; font-weight: 500; }

.sidebar-list { flex: 1; overflow-y: auto; padding: 8px; }
.sidebar-item { padding: 10px 12px; border-radius: var(--r-sm); cursor: pointer; transition: background .1s; border: 1px solid transparent; margin-bottom: 2px; }
.sidebar-item:hover { background: var(--bg); }
.sidebar-item.active { background: var(--accent-light); border-color: #c7d2fe; }
.si-subject { font-size: 13px; font-weight: 500; color: var(--text-sec); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-item.active .si-subject { color: var(--accent); font-weight: 600; }
.si-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.si-date { font-size: 11px; color: var(--text-muted); }
.si-id { font-size: 10px; font-weight: 700; color: var(--text-muted); background: var(--bg); border: 1px solid var(--border); padding: 1px 6px; border-radius: 4px; }
.sidebar-item.active .si-id { background: #c7d2fe; border-color: #a5b4fc; color: var(--accent); }
.sidebar-empty { text-align: center; padding: 40px 16px; color: var(--text-muted); font-size: 13px; line-height: 1.6; }

.content-area { margin-left: 300px; min-height: calc(100vh - var(--header-h)); padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }

.back-btn { display: none; margin-bottom: 12px; padding: 8px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-sec); transition: all .15s; align-items: center; gap: 6px; width: fit-content; }
.back-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.section-title { font-size: 14px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--text-muted); margin-bottom: 12px; }

.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 18px; box-shadow: var(--shadow-xs); }
.stat-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.03em; color: var(--text); }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

.charts-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow-xs); }
.chart-title { font-size: 14px; font-weight: 700; margin-bottom: 16px; color: var(--text); }
canvas { max-height: 280px; }

.record-detail { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 24px; box-shadow: var(--shadow-xs); }
.detail-subject { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.detail-meta { display: flex; align-items: center; gap: 12px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.detail-id { background: var(--accent-light); border: 1px solid #c7d2fe; color: var(--accent); padding: 3px 10px; border-radius: 16px; font-weight: 700; }
.star-btn { background: none; border: none; cursor: pointer; font-size: 18px; padding: 0; line-height: 1; transition: transform .15s; }
.star-btn:hover { transform: scale(1.2); }
.star-btn.starred { color: #fbbf24; }
.star-btn:not(.starred) { color: #d1d5db; }

.detail-body { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.detail-card { background: var(--surface2); border: 1px solid var(--border-light); border-radius: var(--r); padding: 16px; }
.detail-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.det-sec { display: flex; flex-direction: column; gap: 8px; }
.sec-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 4px 10px; display: inline-block; border-radius: 16px; width: fit-content; }
.lbl-info { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.lbl-warn { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.lbl-ok { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.lbl-gray { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }
.sec-text { font-size: 13px; color: var(--text-sec); line-height: 1.7; white-space: pre-wrap; }
.warn-box { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e; padding: 12px; border-radius: var(--r-sm); font-size: 13px; line-height: 1.7; }
.extra-val { font-size: 14px; font-weight: 600; color: var(--text); }

.ai-scores-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ai-score-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 14px; }
.ai-score-label { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.ai-score-label strong { color: var(--text); font-size: 13px; }
.ai-score-bar { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.ai-score-fill { height: 100%; border-radius: 3px; transition: width .4s; }
.ai-score-fill.green { background: var(--success); }
.ai-score-fill.yellow { background: var(--warning); }
.ai-score-fill.red { background: var(--danger); }

.overall-score-bar { height: 10px; background: var(--border); border-radius: 5px; overflow: hidden; margin: 12px 0; }
.overall-score-fill { height: 100%; border-radius: 5px; background: linear-gradient(90deg, #6366f1, #8b5cf6); transition: width .4s; }

.comments-box { background: var(--surface2); border-radius: var(--r); padding: 20px; border: 1px solid var(--border); }
.comments-list { margin-bottom: 16px; max-height: 400px; overflow-y: auto; }
.comment-item { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 10px; }
.comment-header { display: flex; justify-content: space-between; margin-bottom: 6px; }
.comment-author { font-size: 12px; font-weight: 600; color: var(--accent); }
.comment-date { font-size: 11px; color: var(--text-muted); }
.comment-text { font-size: 13px; color: var(--text-sec); line-height: 1.6; }
.comment-form { display: flex; gap: 8px; }
#commentInput { flex: 1; background: var(--surface); border: 1px solid var(--border); font-family: 'Inter', sans-serif; font-size: 13px; padding: 10px; border-radius: 8px; resize: vertical; min-height: 60px; }
#commentInput:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(99,102,241,.1); }

.welcome-state { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 400px; text-align: center; color: var(--text-muted); }
.welcome-icon { font-size: 64px; opacity: .2; margin-bottom: 16px; }
.welcome-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 8px; }

.stats-extra-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.circular-stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.circular-stat canvas { max-height: 100px !important; max-width: 100px !important; }
.circular-label { font-size: 12px; font-weight: 600; color: var(--text-sec); }
.circular-value { font-size: 18px; font-weight: 800; color: var(--accent); }

@media(max-width:1200px){ .stats-grid{ grid-template-columns: repeat(2,1fr); } .charts-row{ grid-template-columns: 1fr 1fr; } }
@media(max-width:900px){ .stats-grid{ grid-template-columns: 1fr; } .charts-row{ grid-template-columns: 1fr; } .detail-2col{ grid-template-columns: 1fr; } .ai-scores-grid{ grid-template-columns: 1fr 1fr; } }
