:root {
  --white: #fff;
  --canvas: #f6f9ff;
  --canvas-2: #eef5ff;
  --ink: #112447;
  --text: #304568;
  --muted: #7182a1;
  --line: #dce6f4;
  --blue: #4f7df3;
  --blue-dark: #315ed4;
  --blue-soft: #eaf1ff;
  --mint: #63cdb2;
  --violet: #8877e9;
  --danger: #e94d69;
  --danger-soft: #fff0f3;
  --warning: #e9a23b;
  --success: #43a67c;
  --shadow: 0 18px 54px rgba(49, 81, 140, .10);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-width: 320px; min-height: 100%; }
body { margin: 0; color: var(--text); background: var(--canvas); }
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea { color: var(--text); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); font-size: 22px; font-weight: 800; letter-spacing: -.04em; }
.brand img { width: 44px; height: 44px; object-fit: contain; }
.brand small { display: block; margin-top: 2px; color: #91a2bd; font-size: 10px; font-weight: 600; letter-spacing: .05em; }
.brand-large { font-size: 30px; }.brand-large img { width: 58px; height: 58px; }

.auth-screen { min-height: 100vh; display: grid; grid-template-columns: 56% 44%; background: var(--white); }
.auth-visual { position: relative; min-height: 720px; overflow: hidden; padding: 48px 64px; background: radial-gradient(circle at 45% 44%, #fff 0 13%, transparent 42%), linear-gradient(145deg, #edf5ff, #dfeaff); }
.auth-visual::after { content: ""; position: absolute; width: 600px; height: 600px; left: 10%; top: 14%; border: 1px solid rgba(93,132,221,.16); border-radius: 48% 52% 46% 54%; transform: rotate(9deg); }
.auth-avatar-orbit { position: absolute; z-index: 2; left: 50%; top: 46%; width: 430px; height: 530px; transform: translate(-50%,-42%); display: grid; place-items: center; }
.auth-avatar-orbit span { position: absolute; inset: 0; border-radius: 48% 52% 45% 55%; background: rgba(255,255,255,.48); box-shadow: inset 0 0 0 1px rgba(255,255,255,.8); backdrop-filter: blur(12px); }
.auth-avatar-orbit img { position: relative; width: 174px; height: 174px; }
.auth-visual blockquote { position: absolute; z-index: 3; left: 64px; bottom: 62px; margin: 0; color: var(--ink); font-size: clamp(24px,2.3vw,34px); font-weight: 650; line-height: 1.55; letter-spacing: -.035em; }
.auth-form-wrap { position: relative; display: grid; place-items: center; padding: 48px; background: rgba(255,255,255,.96); }
.auth-card { width: min(420px,100%); }
.auth-card h1 { margin: 0; color: var(--ink); font-size: 42px; line-height: 1.2; letter-spacing: -.055em; }
.auth-card > p { margin: 14px 0 30px; color: var(--muted); }
.auth-tabs { display: flex; gap: 28px; margin-bottom: 30px; border-bottom: 1px solid var(--line); }
.auth-tab { position: relative; min-width: 76px; padding: 12px 0 15px; border: 0; color: var(--muted); background: transparent; font-size: 15px; font-weight: 700; }
.auth-tab.active { color: var(--blue-dark); }
.auth-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 3px; border-radius: 3px; background: var(--blue); }
.auth-card label, .preference-form label, .article-publisher label { display: grid; gap: 9px; margin-bottom: 20px; color: #526684; font-size: 13px; font-weight: 700; }
.auth-card input, .preference-form input, .preference-form textarea, .article-publisher input, .article-publisher textarea { width: 100%; border: 1px solid #d7e1ef; border-radius: 14px; outline: 0; background: var(--white); }
.auth-card input, .preference-form input, .article-publisher input { height: 52px; padding: 0 17px; }
input:focus, textarea:focus { border-color: #7ea1f7 !important; box-shadow: 0 0 0 4px rgba(79,125,243,.11); }
.primary-button { min-height: 52px; display: inline-grid; place-items: center; border: 0; border-radius: 15px; color: var(--white); background: var(--blue); font-size: 15px; font-weight: 750; box-shadow: 0 12px 28px rgba(79,125,243,.24); }
.auth-card .primary-button { width: 100%; }
.primary-button:hover { background: var(--blue-dark); }.primary-button:disabled { cursor: wait; opacity: .6; }
.primary-button.compact { width: auto; min-width: 150px; padding: 0 26px; }
.auth-card .auth-hint { margin: 18px 0 0; text-align: center; font-size: 12px; line-height: 1.6; }
.form-error { min-height: 20px; color: var(--danger) !important; font-size: 13px; }
.boundary-copy { max-width: 430px; margin: -18px auto 0; color: #92a0b5; text-align: center; font-size: 12px; line-height: 1.6; }
.admin-login-entry { position: absolute; right: 32px; bottom: 28px; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 13px; color: #617392; background: #f8fbff; box-shadow: 0 8px 24px rgba(49,81,140,.08); font-size: 12px; font-weight: 750; }
.admin-login-entry span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; color: var(--blue-dark); background: var(--blue-soft); }
.back-user-login { width: 100%; margin-top: 8px; padding: 10px; border: 0; color: var(--blue-dark); background: transparent; font-size: 13px; font-weight: 700; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 224px minmax(0,1fr); background: var(--canvas); }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 6; width: 224px; display: flex; flex-direction: column; padding: 27px 19px; border-right: 1px solid rgba(215,228,244,.9); background: rgba(245,249,255,.91); backdrop-filter: blur(24px); }
.main-nav { display: grid; gap: 7px; margin-top: 36px; }
.nav-button { display: flex; align-items: center; gap: 13px; width: 100%; min-height: 47px; padding: 0 15px; border: 0; border-radius: 14px; color: #5f7291; background: transparent; text-align: left; font-size: 14px; font-weight: 680; }
.nav-button span { width: 19px; color: #7386a6; text-align: center; font-size: 19px; }
.nav-button:hover { color: var(--blue-dark); background: #edf3ff; }
.nav-button.active { color: var(--blue-dark); background: #dfeaff; box-shadow: inset 3px 0 var(--blue); }
.crisis-link { display: grid; gap: 5px; margin-top: auto; padding: 14px 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.9); font-size: 12px; }
.crisis-link strong { color: #617392; }.crisis-link span { color: var(--blue-dark); font-weight: 750; }
.logout-button { margin-top: 11px; padding: 10px 15px; border: 0; color: var(--muted); background: transparent; text-align: left; font-size: 13px; }
.admin-mode .user-nav { display: none !important; }
.admin-mode .admin-nav { display: flex !important; }
.admin-mode .main-nav { margin-top: 42px; }
.admin-mode .sidebar { background: linear-gradient(180deg,#202d45,#162238); border-color: #2b3b57; }
.admin-mode .brand { color: #f2f6ff; }
.admin-mode .brand small, .admin-mode .logout-button { color: #a4b5d3; }
.admin-mode .nav-button.active { color: #fff; background: #3958ac; box-shadow: inset 3px 0 #87a8ff; }
.admin-mode .nav-button span { color: #d1deff; }
.nav-button svg { width:21px; height:21px; flex:0 0 21px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
.user-chip { min-width:0; white-space:nowrap; }
#usernameLabel { max-width:140px; overflow:hidden; text-overflow:ellipsis; }
.diary-main, .diary-aside { display:grid; gap:20px; align-content:start; min-width:0; }
.diary-editor > .primary-button { display:grid; width:min(100%,360px); margin:0 auto; }
.diary-aside small, .diary-aside p { color:var(--muted); font-size:12px; line-height:1.7; }
#diaryFactors .factor-results { grid-template-columns:1fr; gap:10px; margin:0 0 16px; }
#diaryFactors .factor-result { padding:12px; }
#diaryArticlePreview { display:grid; gap:16px; }
#diaryArticlePreview .article-card { grid-template-columns:70px minmax(0,1fr); padding:0; gap:12px; border:0; border-radius:0; min-height:110px; }
#diaryArticlePreview .article-cover { width:70px; height:86px; }
#diaryArticlePreview h2 { font-size:14px; margin:0; }
#diaryArticlePreview p { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin:6px 0; }
#diaryArticlePreview time { display:none; }
#diaryArticlePreview .read-button { grid-column:2; justify-self:start; padding:0; }
table { min-width:900px !important; }
th, td { padding-left:10px !important; padding-right:10px !important; }
@media (max-width:860px) { .nav-button svg { display:none; } .topbar { gap:10px; } .mobile-logout { flex-shrink:0; white-space:nowrap; } #usernameLabel { max-width:100px; } }
@media (max-width:1400px) and (min-width:861px) { .risk-workbench { grid-template-columns:1fr !important; } }
.workspace { grid-column: 2; min-width: 0; min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 5; height: 72px; display: flex; align-items: center; gap: 20px; padding: 0 30px; border-bottom: 1px solid rgba(217,229,244,.9); background: rgba(250,252,255,.84); backdrop-filter: blur(24px); }
.page-context { color: var(--muted); font-size: 13px; font-weight: 650; }
.local-status { display: flex; align-items: center; gap: 8px; margin-left: auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: #5e7293; background: rgba(255,255,255,.84); font-size: 12px; }
.local-status i, .avatar-status i { width: 8px; height: 8px; border-radius: 50%; background: var(--mint); box-shadow: 0 0 0 3px rgba(99,205,178,.14); }
.local-status.offline i { background: var(--warning); box-shadow: none; }
.user-chip { display: flex; align-items: center; gap: 9px; color: var(--ink); font-size: 13px; }
.user-chip span, .user-chip img { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; }
.user-chip span { display: grid; place-items: center; color: var(--blue-dark); background: #dce8ff; font-weight: 800; }
.mobile-logout { display: none; padding: 8px; border: 0; color: var(--muted); background: transparent; font-size: 12px; font-weight: 700; }
.view { display: none; }.view.active { display: block; }
#view-chat.view.active { display: flex; flex-direction: column; height: calc(100vh - 72px); min-height: 0; overflow: hidden; }

.chat-layout { flex: 1; min-height: 0; height: 100%; display: grid; grid-template-columns: minmax(330px,.72fr) minmax(520px,1.4fr); gap: 18px; padding: 18px 24px 24px; overflow: hidden; }
.conversation { min-width: 0; min-height: 0; height: 100%; overflow: hidden; display: grid; grid-template-rows: auto minmax(0,1fr) auto auto auto auto; padding: 25px 13px 14px; border: 1px solid var(--line); border-radius: 26px; background: rgba(255,255,255,.96); box-shadow: var(--shadow); }
.conversation-heading { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding: 0 12px 16px; }
.conversation-heading h1, .section-header h1, .admin-heading h1 { margin: 0; color: var(--ink); font-size: clamp(28px,2.4vw,38px); line-height: 1.25; letter-spacing: -.045em; }
.conversation-heading p, .section-header p, .admin-heading p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.quiet-button, .secondary-button { min-height: 41px; padding: 0 16px; border: 1px solid var(--line); border-radius: 12px; color: #5c7090; background: var(--white); font-size: 13px; font-weight: 700; }
.quiet-button:hover, .secondary-button:hover { border-color: #9bb6f6; color: var(--blue-dark); }
.messages { min-height: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; padding: 20px 12px 10px; scrollbar-width: thin; scrollbar-color: #cfdcf0 transparent; }
.message { max-width: 74%; margin-bottom: 26px; animation: rise .24s ease both; }.message.user { margin-left: auto; }
.message-meta { display: flex; gap: 9px; margin-bottom: 8px; color: #8a9ab4; font-size: 11px; }.message.user .message-meta { justify-content: flex-end; }
.bubble { padding: 15px 20px; border-radius: 7px 20px 20px; color: #273b60; background: #eaf2ff; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 1.72; }
.message.user .bubble { border-radius: 20px 7px 20px 20px; background: #eef0ff; }
.message.pending .bubble::after { content: "▋"; margin-left: 2px; color: var(--blue); animation: blink 1s infinite; }
.crisis-message .bubble { border: 1px solid #f0a7b4; background: var(--danger-soft); }
.source-strip { margin: 0 12px 10px; padding: 10px 13px; max-height: 4.6em; overflow: auto; border-radius: 12px; color: #677b9a; background: #f5f8fd; font-size: 11px; line-height: 1.6; }
.suggestion-list { display: flex; gap: 8px; overflow-x: auto; padding: 0 12px 12px; }
.suggestion-chip { flex: 0 0 auto; padding: 8px 12px; border: 1px solid var(--line); border-radius: 999px; color: #5d7190; background: var(--white); font-size: 12px; }
.suggestion-chip:hover { border-color: #9bb6f6; color: var(--blue-dark); }
.composer { display: flex; align-items: end; gap: 10px; margin: 0 12px; padding: 10px 11px 10px 18px; border: 1px solid #d7e2f2; border-radius: 22px; background: var(--white); box-shadow: 0 12px 30px rgba(49,81,140,.06); }
.composer:focus-within { border-color: #8eabf5; box-shadow: 0 0 0 4px rgba(79,125,243,.09); }
.composer textarea { flex: 1; max-height: 120px; min-height: 42px; resize: none; border: 0; outline: 0; padding: 10px 0; background: transparent; font-size: 15px; line-height: 1.5; }
.round-button { flex: 0 0 46px; width: 46px; height: 46px; border: 0; border-radius: 50%; color: #657997; background: #edf3fc; font-size: 20px; font-weight: 750; }.round-button.send { color: var(--white); background: var(--blue); }
.round-button:disabled { cursor: wait; opacity: .55; }
.avatar-panel { position: relative; min-height: 0; height: 100%; overflow: hidden; display: grid; grid-template-rows: auto minmax(260px,1fr) auto auto; padding: 18px; border: 1px solid #d9e5f6; border-radius: 28px; background: linear-gradient(165deg,#edf5ff 0%,#e8efff 58%,#f3efff 100%); box-shadow: var(--shadow); }
.avatar-panel::before { content: ""; position: absolute; width: 84%; height: 72%; left: 8%; top: 12%; border-radius: 48%; background: rgba(255,255,255,.48); }
.avatar-status { position: relative; z-index: 2; justify-self: start; display: flex; align-items: center; gap: 8px; padding: 8px 13px; border: 1px solid var(--line); border-radius: 999px; color: #5e7293; background: rgba(255,255,255,.9); font-size: 12px; }
model-viewer { position: relative; z-index: 1; width: 100%; height: 100%; min-height: 0; cursor: pointer; user-select: none; --poster-color: transparent; background: transparent; }
.avatar-caption { position: relative; z-index: 2; text-align: center; }.avatar-caption h2 { margin: 0; color: var(--ink); font-size: 24px; }.avatar-caption p { margin: 6px 0 14px; color: var(--muted); font-size: 13px; }
.action-grid { position: relative; z-index: 2; display: grid; grid-template-columns: repeat(3,1fr); gap: 9px; }
.voice-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 5px 0; }
.voice-controls small { color: var(--muted); font-size: 11px; }
.detail-analysis h3 { color: var(--ink); font-size: 14px; margin: 20px 0 10px; }
.detail-analysis p { color: #526987; font-size: 12px; margin: 12px 0 5px; }
.detail-analysis progress { width: 100%; height: 7px; accent-color: var(--blue); }
.detail-analysis small { display: block; margin: 12px 0; color: var(--muted); line-height: 1.6; }
.risk-person details { color: #526987; font-size: 12px; line-height: 1.7; }
.risk-person details p { white-space: pre-wrap; overflow-wrap: anywhere; }
.action-grid button { min-height: 57px; border: 1px solid #d5e2f4; border-radius: 15px; color: #51698c; background: rgba(255,255,255,.92); font-size: 13px; font-weight: 750; }
.action-grid button:hover, .action-grid button.active { border-color: var(--blue); color: var(--blue-dark); background: #eaf1ff; }

.content-view { width: min(1080px,calc(100% - 64px)); margin: 0 auto; padding: 46px 0 72px; }
.section-header { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.factor-explainer { display: grid; grid-template-columns: repeat(3,1fr); gap: 1px; margin-bottom: 22px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--line); }
.factor-explainer div { display: grid; gap: 5px; padding: 17px 20px; background: rgba(255,255,255,.92); }.factor-explainer b { color: var(--ink); font-size: 14px; }.factor-explainer span { color: var(--muted); font-size: 12px; }
.assessment-form { display: grid; gap: 13px; }
.question-row { display: grid; grid-template-columns: minmax(280px,1fr) minmax(380px,.95fr); align-items: center; gap: 24px; padding: 19px 21px; border: 1px solid var(--line); border-radius: 17px; background: rgba(255,255,255,.94); }
.question-row h3 { margin: 0; color: #334a70; font-size: 14px; line-height: 1.65; }
.option-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; }
.option-row.options-5 { grid-template-columns: repeat(5,1fr); }
.option-row.options-2 { grid-template-columns: repeat(2,1fr); }
.option-row label { position: relative; cursor: pointer; }.option-row input { position: absolute; opacity: 0; }
.option-row span { display: grid; place-items: center; min-height: 40px; border: 1px solid var(--line); border-radius: 11px; color: var(--muted); background: var(--white); font-size: 12px; }
.option-row input:checked + span { border-color: var(--blue); color: var(--blue-dark); background: var(--blue-soft); font-weight: 750; }
.assessment-form > .primary-button { margin-top: 8px; justify-self: start; }
.result-panel, .report-panel { margin-top: 24px; padding: 24px; border: 1px solid var(--line); border-radius: 19px; background: rgba(255,255,255,.92); line-height: 1.75; }
.result-panel h2, .report-panel h2 { margin: 0 0 12px; color: var(--ink); font-size: 21px; }.report-content { white-space: pre-wrap; }
.factor-results { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; margin: 18px 0; }
.factor-result.positive { outline: 1px solid #f0a7b4; background: #fff7f8; }
.elevated-list { display: grid; gap: 14px; margin: 18px 0; }
.elevated-item { padding: 16px 18px; border: 1px solid var(--line); border-radius: 16px; background: #f8fbff; }
.elevated-item h3 { margin: 0 0 8px; color: var(--ink); font-size: 15px; }
.elevated-item p, .elevated-item li { color: #526987; font-size: 13px; line-height: 1.7; }
.elevated-item ol { margin: 8px 0 0; padding-left: 18px; }
.cluster-chip { display: inline-block; margin: 8px 0 0; padding: 6px 10px; border-radius: 999px; background: var(--blue-soft); color: var(--blue-dark); font-size: 12px; font-weight: 750; }
.factor-result { padding: 16px; border-radius: 15px; background: #f5f8ff; }.factor-result header { display: flex; justify-content: space-between; color: var(--ink); font-size: 13px; }.factor-result strong { color: var(--blue-dark); font-size: 22px; }
.factor-result i, .factor-mini i { display: block; height: 6px; overflow: hidden; margin-top: 11px; border-radius: 9px; background: #dde7f6; }.factor-result i b, .factor-mini i b { display: block; height: 100%; border-radius: inherit; background: var(--blue); }
.risk-high { color: var(--danger) !important; }.risk-medium { color: var(--warning) !important; }.risk-low { color: var(--success) !important; }

.diary-view { width: min(1160px,calc(100% - 64px)); }
.diary-layout { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(280px,.72fr); gap: 22px; }
.diary-editor, .diary-history-panel { border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.94); box-shadow: 0 12px 36px rgba(49,81,140,.06); }
.diary-editor { padding: 28px; }.diary-editor fieldset { margin: 0; padding: 0; border: 0; }.diary-editor legend { margin-bottom: 17px; color: var(--ink); font-size: 17px; font-weight: 750; }
.mood-picker { display: grid; grid-template-columns: repeat(5,1fr); gap: 12px; }.mood-picker label { position: relative; cursor: pointer; }.mood-picker input { position: absolute; opacity: 0; }
.mood-picker span { min-height: 100px; display: grid; place-items: center; align-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 16px; color: #647796; background: #fbfdff; font-size: 13px; font-weight: 650; }
.mood-picker i { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--blue-dark); background: var(--blue-soft); font-style: normal; font-size: 19px; }
.mood-picker input:checked + span { border-color: var(--blue); color: var(--blue-dark); background: #edf3ff; box-shadow: 0 8px 22px rgba(79,125,243,.12); }
.journal-label { display: block; margin: 26px 0 10px; color: var(--ink); font-size: 16px; font-weight: 750; }
.diary-editor textarea { width: 100%; min-height: 230px; margin-bottom: 18px; padding: 18px; resize: vertical; border: 1px solid var(--line); border-radius: 16px; outline: 0; line-height: 1.8; }
.diary-history-panel { padding: 24px; }.diary-history-panel h2 { margin: 0 0 20px; color: var(--ink); font-size: 20px; }
.mood-timeline { min-height: 142px; display: flex; align-items: end; justify-content: space-between; gap: 8px; padding: 14px 6px 22px; border-bottom: 1px solid var(--line); }
.mood-day { flex: 1; display: grid; justify-items: center; gap: 8px; color: var(--muted); font-size: 10px; }.mood-day i { width: 14px; height: 14px; border: 3px solid var(--white); border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 1px #a8bdf0; transform: translateY(calc((5 - var(--mood)) * -13px)); }
.diary-history { display: grid; margin-top: 10px; }.diary-entry { padding: 13px 2px; border-bottom: 1px solid var(--line); }.diary-entry header { display: flex; justify-content: space-between; gap: 10px; color: var(--ink); font-size: 12px; }.diary-entry p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.55; }

.article-list { display: grid; gap: 16px; }
.article-card { display: grid; grid-template-columns: 190px minmax(0,1fr) auto; align-items: center; gap: 24px; min-height: 150px; padding: 18px; border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.94); transition: transform .2s ease, box-shadow .2s ease; }
.article-card:hover { transform: translateY(-2px); box-shadow: 0 16px 36px rgba(49,81,140,.09); }
.article-cover { width: 190px; height: 114px; overflow: hidden; display: grid; place-items: center; border-radius: 14px; color: var(--blue-dark); background: linear-gradient(140deg,#dceaff,#eeeaff); font-size: 34px; }.article-cover img { width: 100%; height: 100%; object-fit: cover; }
.article-card h2 { margin: 0 0 9px; color: var(--ink); font-size: 19px; }.article-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }.article-card time { display: block; margin-top: 12px; color: #9aabc0; font-size: 11px; }
.read-button { padding: 10px 14px; border: 0; color: var(--blue-dark); background: transparent; font-size: 13px; font-weight: 750; }

.upload-zone { min-height: 210px; display: grid; place-items: center; align-content: center; gap: 10px; border: 1px dashed #b9cae2; border-radius: 22px; color: var(--muted); background: rgba(255,255,255,.72); cursor: pointer; }
.upload-zone:hover { border-color: var(--blue); background: #f2f6ff; }.upload-zone input { display: none; }.upload-zone strong { color: var(--blue-dark); font-size: 17px; }.upload-zone span { font-size: 12px; }
.file-list { margin-top: 24px; border-top: 1px solid var(--line); }.file-item { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 4px; border-bottom: 1px solid var(--line); }.file-item strong { color: var(--ink); font-size: 14px; }.file-item span { color: var(--muted); font-size: 12px; }
.preference-form { display: grid; padding: 28px; border: 1px solid var(--line); border-radius: 22px; background: rgba(255,255,255,.94); }
.preference-form textarea, .article-publisher textarea { min-height: 128px; padding: 16px; resize: vertical; font-weight: 400; line-height: 1.7; }
.profile-identity { display: grid; grid-template-columns: auto minmax(240px,360px); align-items: center; gap: 24px; margin-bottom: 26px; padding-bottom: 26px; border-bottom: 1px solid var(--line); }
.profile-identity > label:last-child { margin: 0; }
.avatar-uploader { position: relative; width: 92px; height: 92px; margin: 0 !important; cursor: pointer; }.avatar-uploader input { display: none; }.avatar-uploader span, .avatar-uploader img { width: 92px; height: 92px; display: grid; place-items: center; border-radius: 50%; object-fit: cover; color: var(--blue-dark); background: var(--blue-soft); font-size: 28px; font-weight: 800; }.avatar-uploader em { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); width: max-content; padding: 5px 8px; border-radius: 9px; color: var(--white); background: rgba(17,36,71,.78); font-size: 10px; font-style: normal; }
.contact-fields { margin: 0 0 28px; padding: 0 0 26px; border: 0; border-bottom: 1px solid var(--line); }.contact-fields legend { padding: 0; color: var(--ink); font-size: 18px; font-weight: 760; }.contact-fields > p { margin: 7px 0 20px; color: var(--muted); font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0 16px; }.form-grid .wide { grid-column: 1/-1; }
.notice { margin: -2px 0 22px; padding: 13px 15px; border-left: 3px solid #8fa8eb; color: #657998; background: #f0f5ff; font-size: 12px; line-height: 1.7; }

.admin-view.active { padding: 30px; }
.admin-heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; }
.metrics-band { display: grid; grid-template-columns: repeat(4,1fr); gap: 14px; margin: 24px 0 18px; }
.metrics-band div { min-height: 100px; display: grid; align-content: center; padding: 18px 22px; border: 1px solid var(--line); border-radius: 18px; background: rgba(255,255,255,.94); box-shadow: 0 10px 28px rgba(49,81,140,.05); }
.metrics-band span { color: var(--muted); font-size: 12px; }.metrics-band strong { margin-top: 7px; color: var(--blue-dark); font-size: 30px; }.metrics-band strong.danger { color: var(--danger); }
.risk-workbench { display: grid; grid-template-columns: minmax(0,1fr) 330px; gap: 16px; }
.risk-table-panel, .risk-detail-panel, .admin-upload-card, .article-publisher { border: 1px solid var(--line); border-radius: 20px; background: rgba(255,255,255,.96); box-shadow: 0 12px 36px rgba(49,81,140,.055); }
.risk-table-panel { min-width: 0; overflow: hidden; }.panel-heading { padding: 20px 22px 14px; }.panel-heading h2, .admin-upload-card h2, .article-publisher h2 { margin: 0; color: var(--ink); font-size: 18px; }.panel-heading p, .admin-upload-card p, .article-publisher > div > p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.table-wrap { overflow: auto; border-top: 1px solid var(--line); } table { width: 100%; min-width: 1020px; border-collapse: collapse; text-align: left; font-size: 12px; } .risk-table-panel table { min-width: 1680px !important; } th { height: 47px; padding: 0 13px; color: #7083a0; background: #f7faff; font-weight: 700; white-space: nowrap; } td { padding: 14px 13px; border-top: 1px solid var(--line); color: #506786; vertical-align: middle; } tbody tr:hover, tbody tr.selected { background: #f5f8ff; }
.student-cell { display: grid; grid-template-columns: 38px auto; align-items: center; gap: 9px; min-width: 110px; }.student-cell img, .student-avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; object-fit: cover; color: var(--blue-dark); background: var(--blue-soft); font-weight: 800; }.student-cell b { display: block; color: var(--ink); font-size: 13px; }.student-cell small { color: var(--muted); }
.risk-tag { display: inline-block; padding: 5px 8px; border-radius: 8px; font-weight: 750; }.risk-tag.high { color: var(--danger); background: var(--danger-soft); }.risk-tag.medium { color: #a96a0c; background: #fff4dc; }.risk-tag.low { color: var(--success); background: #e9f8f2; }
.keyword-list { max-width: 110px; overflow: hidden; color: var(--danger); text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }.factor-mini { min-width: 54px; }.factor-mini span { color: var(--ink); font-weight: 750; }.factor-mini i { width: 52px; margin-top: 5px; }.factor-mini.high i b, .factor-mini.positive i b { background: var(--danger); }.factor-mini.medium i b { background: var(--warning); }.factor-mini.positive span { color: var(--danger); }
.table-action { padding: 7px 10px; border: 1px solid #b9cbed; border-radius: 9px; color: var(--blue-dark); background: var(--white); font-size: 11px; font-weight: 750; white-space: nowrap; }
.risk-detail-panel { min-height: 480px; display: grid; grid-template-rows: auto minmax(0,1fr) auto; overflow: hidden; padding: 22px; }
.risk-detail-panel .risk-person { min-height: 0; overflow-y: auto; padding-right: 4px; }
.risk-detail-empty h2, .risk-person h2 { margin: 0 0 8px; color: var(--ink); font-size: 20px; }.risk-detail-empty p, .risk-person p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.65; }
.risk-person-header { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 12px; }.risk-person-header img, .risk-person-header .student-avatar { width: 46px; height: 46px; }.contact-stack { display: grid; gap: 8px; margin: 17px 0; padding: 14px; border-radius: 14px; background: #f5f8ff; }.contact-stack div { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; }.contact-stack span { color: var(--muted); }.contact-stack b { color: var(--ink); text-align: right; }
.detail-keywords { display: flex; flex-wrap: wrap; gap: 7px; }.detail-keywords span { padding: 6px 9px; border-radius: 8px; color: var(--danger); background: var(--danger-soft); font-size: 11px; font-weight: 750; }
.verify-button { width: 100%; min-height: 46px; margin-top: 16px; border: 0; border-radius: 13px; color: var(--white); background: var(--blue); font-size: 14px; font-weight: 750; }
.alert-stream { min-height: 0; overflow: hidden; margin-top: 20px; border-top: 1px solid var(--line); }.alert-stream h3 { margin: 18px 0 14px; color: var(--ink); font-size: 15px; }.alert-list { max-height: 250px; overflow-y: auto; }
.alert-item { position: relative; padding: 0 0 18px 20px; border-left: 2px solid #d9e4f5; }.alert-item::before { content: ""; position: absolute; left: -6px; top: 3px; width: 10px; height: 10px; border-radius: 50%; background: var(--blue); }.alert-item.pending::before { background: var(--danger); }.alert-item time { color: #93a3ba; font-size: 10px; }.alert-item h3 { margin: 5px 0 4px; color: var(--ink); font-size: 12px; }.alert-item p { margin: 0 0 8px; color: var(--muted); font-size: 11px; line-height: 1.5; }.alert-item button { padding: 6px 9px; border: 1px solid #bdcbed; border-radius: 8px; color: var(--blue-dark); background: var(--white); font-size: 10px; font-weight: 700; }
.admin-boundary { margin: 14px 0 0; color: #8b9bb2; text-align: center; font-size: 10px; line-height: 1.55; }
.admin-utilities { display: grid; grid-template-columns: minmax(280px,.7fr) minmax(0,1.5fr); gap: 16px; margin-top: 16px; }
.admin-upload-card { display: grid; align-content: start; gap: 18px; padding: 22px; }.compact-upload { min-height: 110px; display: grid; place-items: center; padding: 14px; border: 1px dashed #b8c9e3; border-radius: 15px; color: var(--blue-dark); background: #f7faff; cursor: pointer; font-size: 13px; font-weight: 700; }.compact-upload input, .cover-input input { display: none; }
.article-publisher { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0 12px; padding: 22px; }.article-publisher > div { grid-column: 1/-1; margin-bottom: 18px; }.article-publisher .publisher-content { grid-column: 1/3; }.article-publisher textarea { min-height: 110px; }.cover-input { align-self: start; min-height: 52px; display: grid !important; place-items: center; padding: 0 12px; border: 1px dashed #b8c9e3; border-radius: 14px; color: var(--blue-dark) !important; background: #f7faff; cursor: pointer; text-align: center; }.article-publisher .primary-button { align-self: end; margin-bottom: 20px; }

.reader-dialog { width: min(760px,calc(100% - 32px)); max-height: 86vh; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: rgba(255,255,255,.98); box-shadow: 0 30px 90px rgba(21,47,92,.22); }.reader-dialog::backdrop { background: rgba(17,36,71,.28); backdrop-filter: blur(6px); }.dialog-close { position: absolute; z-index: 2; right: 18px; top: 16px; width: 36px; height: 36px; border: 0; border-radius: 50%; color: var(--muted); background: rgba(238,244,252,.9); font-size: 22px; }.reader-cover { width: 100%; max-height: 300px; object-fit: cover; }.reader-body { padding: 34px 38px 42px; }.reader-body h1 { margin: 0 0 12px; color: var(--ink); font-size: 30px; }.reader-body time { color: #94a4bb; font-size: 11px; }.reader-body p { white-space: pre-wrap; color: #506584; line-height: 1.9; }
.empty-state { padding: 34px 12px; color: var(--muted); text-align: center; font-size: 13px; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translate(-50%,18px); padding: 11px 16px; border-radius: 12px; color: var(--white); background: var(--ink); opacity: 0; pointer-events: none; transition: .22s ease; box-shadow: var(--shadow); font-size: 13px; }.toast.visible { transform: translate(-50%,0); opacity: 1; }

@keyframes rise { from { transform: translateY(7px); opacity: 0; } }
@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 1180px) {
  .chat-layout { grid-template-columns: 320px minmax(440px,1fr); padding-inline: 16px; }
  .risk-workbench { grid-template-columns: 1fr; }.risk-detail-panel { min-height: 420px; }.admin-utilities { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  .auth-screen { grid-template-columns: 1fr; }.auth-visual { display: none; }.auth-form-wrap { min-height: 100vh; padding: 28px; }
  .app-shell { display: block; padding-bottom: 72px; }.sidebar { inset: auto 0 0; width: auto; height: 68px; display: block; padding: 8px 10px; border: 0; border-top: 1px solid var(--line); }.sidebar .brand, .crisis-link, .logout-button { display: none; }
  .main-nav { grid-template-columns: repeat(6,1fr); gap: 2px; margin: 0; overflow-x: auto; }.nav-button { min-width: 78px; min-height: 52px; justify-content: center; padding: 0 4px; font-size: 10px; text-align: center; }.nav-button span { display: none; }.admin-mode .main-nav { grid-template-columns: 1fr; margin: 0; }
  .workspace { min-height: calc(100vh - 68px); }.topbar { height: 64px; padding: 0 15px; }.page-context { display: none; }.local-status { margin-left: 0; max-width: 190px; overflow: hidden; }.user-chip { margin-left: auto; }.mobile-logout { display: block; }
  #view-chat.view.active { height: auto; min-height: calc(100vh - 132px); overflow: visible; }
  .chat-layout { height: auto; min-height: 0; display: flex; flex-direction: column; padding: 14px 14px 24px; overflow: visible; }.conversation { height: calc(100vh - 160px); min-height: 0; overflow: hidden; order: 2; }.avatar-panel { height: 340px; flex: none; order: 1; grid-template-rows: minmax(0,1fr) auto auto; padding: 14px; }.avatar-status { display: none; }.avatar-caption h2 { font-size: 18px; }.avatar-caption p { margin: 3px 0 8px; font-size: 11px; }.action-grid button { min-height: 40px; }.message { max-width: 90%; }.conversation-heading { flex-wrap: wrap; }.conversation-heading h1 { font-size: 25px; }
  .content-view { width: calc(100% - 28px); padding: 30px 0 46px; }.section-header, .admin-heading { align-items: stretch; flex-direction: column; }.section-header .secondary-button { align-self: start; }.factor-explainer { grid-template-columns: 1fr; }
  .question-row { grid-template-columns: 1fr; gap: 14px; }.option-row { grid-template-columns: repeat(2,1fr); }.factor-results { grid-template-columns: 1fr; }
  .diary-layout { grid-template-columns: 1fr; }.mood-picker { grid-template-columns: repeat(5,minmax(74px,1fr)); overflow-x: auto; }.diary-editor { padding: 20px; }
  .article-card { grid-template-columns: 100px minmax(0,1fr); gap: 14px; }.article-cover { width: 100px; height: 86px; }.article-card .read-button { grid-column: 2; justify-self: start; padding-left: 0; }
  .profile-identity { grid-template-columns: 1fr; }.form-grid { grid-template-columns: 1fr; }.form-grid .wide { grid-column: auto; }
  .admin-view.active { padding: 22px 14px; }.metrics-band { grid-template-columns: repeat(2,1fr); }.article-publisher { grid-template-columns: 1fr; }.article-publisher > div, .article-publisher .publisher-content { grid-column: auto; }
  .admin-login-entry { right: 18px; bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
