:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #172033;
  background: #f4f6f9;
  --ink: #172033;
  --muted: #667085;
  --line: #e4e8ef;
  --blue: #315de6;
}
* { box-sizing: border-box; }
body { margin: 0; background: #f4f6f9; }

.topbar {
  height: 64px; display: flex; align-items: center; gap: 22px; padding: 0 max(24px, 4vw);
  background: rgba(255,255,255,.94); border-bottom: 1px solid #e7eaf0; position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(16px);
}
.topbar > a { color: #3e4960; text-decoration: none; font-size: 14px; font-weight: 650; }
.topbar > a:first-child { margin-right: auto; color: #151d2d; font-size: 16px; letter-spacing: -.01em; }
.topbar span { color: #7a8498; font-size: 14px; }
.topbar form { margin: 0; }
.topbar button, .user-row button { border: 0; background: #edf1fb; color: #2f55c7; padding: 8px 13px; border-radius: 9px; cursor: pointer; }

.auth-shell { max-width: 1240px; margin: 0 auto; padding: 42px 24px 28px; }
.brand { font-size: 12px; font-weight: 800; letter-spacing: .16em; color: var(--blue); }
.login-card, .admin-card { background: #fff; border: 1px solid #e6eaf1; border-radius: 20px; box-shadow: 0 16px 50px rgba(30,48,88,.08); }
.login-card { max-width: 440px; margin: 8vh auto; padding: 38px; }
.login-card h1, .admin-head h1 { font-size: 36px; margin: 10px 0 8px; }
.login-card p, .admin-head p { color: var(--muted); margin: 0 0 26px; }
.stack { display: grid; gap: 18px; }
label { display: grid; gap: 8px; color: #475467; font-size: 14px; }
input { width: 100%; border: 1px solid #d7dce6; border-radius: 10px; padding: 11px 12px; font: inherit; outline: none; }
input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #315de61a; }
.primary { border: 0; border-radius: 11px; padding: 12px 18px; background: var(--blue); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.linkbtn { display: inline-block; text-decoration: none; }
.alert, .notice { padding: 11px 13px; border-radius: 10px; background: #fff2f0; color: #b42318; margin: 0 0 18px; }
.notice { background: #eef4ff; color: #2546a8; }

.portal-page { background: #07101e; color: #f7f9fd; }
.portal-page::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 16% 8%, rgba(55,98,214,.18), transparent 34%), radial-gradient(circle at 88% 34%, rgba(114,69,205,.12), transparent 28%); }
.portal-page .topbar { height: 72px; color: #d5deed; background: rgba(7,16,30,.84); border-bottom-color: rgba(255,255,255,.08); }
.portal-page .topbar > a { color: #b7c2d5; }
.portal-page .topbar > a:first-child { color: #f7f9fd; font-size: 17px; }
.portal-page .topbar span { color: #7f8ba0; }
.portal-page .topbar button { color: #cdd9f3; background: rgba(255,255,255,.07); }
.portal-page .auth-shell { position: relative; max-width: 1440px; padding: 34px 34px 28px; }
.portal-home { width: 100%; }
.portal-hero {
  display: grid; grid-template-columns: minmax(0, .9fr) minmax(500px, 1.1fr); min-height: 540px;
  position: relative; overflow: hidden; border: 1px solid rgba(255,255,255,.1); border-radius: 32px;
  background: linear-gradient(145deg, rgba(16,30,52,.98), rgba(8,18,34,.98));
  box-shadow: 0 36px 100px rgba(0,0,0,.34), inset 0 1px rgba(255,255,255,.06);
}
.portal-hero::before { content: ""; position: absolute; width: 420px; height: 420px; left: -160px; top: -220px; border-radius: 50%; background: rgba(80,124,255,.16); filter: blur(10px); }
.portal-hero::after { content: ""; position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px); background-size: 44px 44px; mask-image: linear-gradient(90deg,#000,transparent 62%); }
.hero-copy { position: relative; z-index: 3; display: flex; flex-direction: column; justify-content: center; padding: 58px 24px 48px 64px; }
.hero-kicker { display: flex; align-items: center; gap: 12px; color: #8fa1bd; font-style: normal; font-size: 11px; font-weight: 750; letter-spacing: .16em; }
.hero-kicker span { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid rgba(137,169,255,.42); border-radius: 10px; color: #dfe8ff; background: rgba(91,126,224,.12); letter-spacing: 0; }
.hero-kicker em { font-style: normal; }
.hero-copy h1 { margin: 28px 0 22px; font-size: clamp(42px, 4.4vw, 64px); line-height: 1.08; letter-spacing: -.055em; font-weight: 650; }
.hero-copy h1 strong { color: #8eafff; font-weight: 650; }
.hero-copy p { max-width: 580px; margin: 0; color: #aab6c9; font-size: 16px; line-height: 1.8; }
.hero-actions { display: flex; align-items: center; gap: 20px; margin-top: 30px; }
.hero-actions a { padding: 12px 18px; border-radius: 12px; background: linear-gradient(135deg,#4e72df,#7157d8); color: #fff; font-size: 14px; font-weight: 750; text-decoration: none; box-shadow: 0 12px 30px rgba(71,94,197,.3); }
.hero-actions span { display: inline-flex; align-items: center; gap: 9px; color: #aebbd0; font-size: 13px; }
.hero-actions i, .stage-label i { width: 7px; height: 7px; border-radius: 50%; background: #54d7a9; box-shadow: 0 0 0 5px rgba(84,215,169,.1); }
.hero-metrics { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-top: 42px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.09); }
.hero-metrics div { display: grid; gap: 5px; }
.hero-metrics b { color: #f6f8fd; font-size: 18px; }
.hero-metrics span { color: #77849a; font-size: 12px; }
.hero-stage { position: relative; z-index: 2; margin: 18px 18px 18px 0; overflow: hidden; border: 1px solid rgba(255,255,255,.12); border-radius: 24px; background: #091428; box-shadow: inset 0 1px rgba(255,255,255,.08); }
.hero-stage::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(5,13,28,.08), rgba(5,13,28,.18) 50%, rgba(5,13,28,.75)); pointer-events: none; }
.hero-visual { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 64% center; transform: scale(1.03); }
.stage-label { position: absolute; z-index: 3; top: 22px; left: 22px; display: flex; align-items: center; gap: 10px; padding: 10px 13px; border: 1px solid rgba(255,255,255,.13); border-radius: 999px; color: #dbe5f8; background: rgba(5,14,31,.68); backdrop-filter: blur(14px); font-size: 12px; }
.stage-info { position: absolute; z-index: 3; left: 22px; right: 22px; bottom: 20px; display: grid; grid-template-columns: 1fr auto; gap: 5px 18px; padding: 18px 20px; border: 1px solid rgba(255,255,255,.13); border-radius: 16px; background: rgba(8,18,37,.72); backdrop-filter: blur(18px); }
.stage-info small { grid-column: 1/-1; color: #7f91af; font-size: 10px; font-weight: 800; letter-spacing: .16em; }
.stage-info b { color: #f7f9ff; font-size: 15px; }
.stage-info span { color: #9aabc5; font-size: 12px; text-align: right; }
.workspace { margin-top: 56px; }
.workspace-head { display: flex; align-items: end; justify-content: space-between; margin: 0 2px 20px; }
.workspace-head span { color: #6e7f9d; font-size: 11px; font-weight: 800; letter-spacing: .18em; }
.workspace-head h2 { margin: 8px 0 0; color: #f2f5fb; font-size: 30px; letter-spacing: -.03em; }
.workspace-head p { margin: 0 0 4px; color: #75839a; font-size: 14px; }
.portal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.portal-card {
  min-height: 280px; padding: 26px; border: 1px solid rgba(255,255,255,.09); border-radius: 22px;
  background: linear-gradient(145deg, rgba(18,32,55,.92), rgba(11,22,40,.92));
  color: #f5f7fc; text-decoration: none; box-shadow: 0 16px 44px rgba(0,0,0,.16);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}
.portal-card:hover { transform: translateY(-4px); border-color: rgba(126,158,235,.4); box-shadow: 0 24px 60px rgba(0,0,0,.28); }
.card-head { display: flex; align-items: center; gap: 11px; }
.card-icon { width: 38px; height: 38px; border-radius: 12px; background: rgba(77,113,222,.14); position: relative; }
.card-icon::before, .card-icon::after { content: ""; position: absolute; border-radius: 2px; background: #3e6ee8; }
.card-icon::before { width: 14px; height: 3px; left: 11px; top: 11px; box-shadow: 0 6px 0 #79a0ff, 0 12px 0 #b2c8ff; }
.card-icon::after { width: 3px; height: 16px; left: 16px; top: 10px; opacity: .2; }
.sanjiantao .card-icon { background: rgba(118,87,223,.14); }
.sanjiantao .card-icon::before { background: #7657df; box-shadow: 0 6px 0 #9f8ae8, 0 12px 0 #cbbef4; }
.editing .card-icon { background: rgba(31,156,121,.14); }
.editing .card-icon::before { background: #1f9c79; box-shadow: 0 6px 0 #64bca4, 0 12px 0 #a9ddcf; }
.card-type { color: #8d9bb3; font-size: 13px; font-weight: 650; }
.card-status { margin-left: auto; padding: 5px 9px; border: 1px solid rgba(98,218,176,.15); border-radius: 999px; color: #7ed9b8; background: rgba(55,176,133,.08); font-size: 11px; }
.portal-card h2 { margin: 28px 0 12px; font-size: 27px; letter-spacing: -.03em; }
.portal-card p { min-height: 58px; margin: 0; color: #98a6bb; font-size: 15px; line-height: 1.75; }
.portal-card small { display: block; margin-top: 19px; color: #718099; font-size: 12px; line-height: 1.6; }
.portal-card b { display: inline-flex; margin-top: 26px; color: #92adf4; font-size: 14px; font-weight: 750; }
.empty { grid-column: 1/-1; background: rgba(255,255,255,.04); border: 1px dashed rgba(255,255,255,.14); padding: 42px; border-radius: 16px; text-align: center; color: #8d99ad; }
.portal-footer { display: flex; justify-content: space-between; margin: 34px 2px 0; padding: 24px 0 4px; border-top: 1px solid rgba(255,255,255,.08); color: #5e6c82; font-size: 12px; }

.admin-head { margin-bottom: 28px; }
.admin-card { padding: 26px; margin-bottom: 22px; }
.admin-card h2 { margin-top: 0; }
.narrow { max-width: 520px; margin: auto; }
.create-form { display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: 16px; align-items: end; }
.permissions { display: flex; gap: 14px; flex-wrap: wrap; }
.check { display: flex; grid: unset; align-items: center; gap: 7px; white-space: nowrap; }
.check input { width: auto; }
.user-list { display: grid; gap: 10px; }
.user-row { display: grid; grid-template-columns: 150px 1fr 76px minmax(210px, .8fr) auto; gap: 16px; align-items: center; padding: 14px; border: 1px solid #e8ebf1; border-radius: 13px; }
.user-row strong { display: block; }
.user-row small { color: #98a2b3; }
.user-row button:disabled { opacity: .5; }
.user-row input:disabled { background: #f5f6f8; }
.user-row .check input:disabled { opacity: .5; }
.password-reset { gap: 5px; }
.password-reset span { color: #7c8799; font-size: 11px; }
.row-actions { display: flex; gap: 7px; }
.row-actions .danger { color: #b42318; background: #fff0ee; }
.row-actions button:disabled { opacity: .42; cursor: not-allowed; }

@media (max-width: 900px) {
  .portal-grid { grid-template-columns: 1fr; }
  .create-form, .user-row { grid-template-columns: 1fr; }
  .auth-shell { padding: 28px 16px; }
  .portal-page .auth-shell { padding: 26px 20px; }
  .portal-hero { grid-template-columns: 1fr; }
  .hero-copy { padding: 48px 38px; }
  .hero-stage { min-height: 420px; margin: 0 18px 18px; }
  .portal-card { min-height: 240px; }
}
@media (max-width: 620px) {
  .topbar { height: auto; min-height: 60px; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
  .topbar > a:first-child { width: 100%; }
  .auth-shell { padding: 18px 12px 24px; }
  .portal-page .auth-shell { padding: 16px 12px 24px; }
  .portal-hero { min-height: 0; border-radius: 24px; }
  .hero-copy { padding: 36px 24px 30px; }
  .hero-copy h1 { font-size: 42px; }
  .hero-metrics { grid-template-columns: 1fr; gap: 12px; }
  .hero-metrics div { display: flex; align-items: baseline; justify-content: space-between; }
  .hero-stage { min-height: 350px; margin: 0 10px 10px; border-radius: 18px; }
  .stage-info { grid-template-columns: 1fr; }
  .stage-info span { text-align: left; }
  .workspace-head { margin-top: 34px; align-items: flex-start; }
  .workspace-head p { display: none; }
  .portal-footer { display: grid; gap: 7px; }
}

/* Compact AI workspace home */
.portal-page { background: #f5f7fb; color: #101828; }
.portal-page::before { content: ""; position: fixed; inset: 64px 0 auto; height: 420px; pointer-events: none; background: radial-gradient(circle at 12% 16%, rgba(76,111,238,.12), transparent 31%), radial-gradient(circle at 88% 10%, rgba(137,92,246,.1), transparent 30%); }
.portal-page .topbar { height: 64px; background: rgba(255,255,255,.88); border-bottom-color: rgba(23,35,61,.07); color: #475467; }
.portal-page .topbar > a { color: #475467; }
.portal-page .topbar > a:first-child { color: #101828; }
.portal-page .topbar span { color: #7b8495; }
.portal-page .topbar button { color: #365fcf; background: #edf2ff; }
.portal-page .auth-shell { position: relative; max-width: 1480px; min-height: calc(100vh - 64px); padding: 58px 34px 28px; }
.portal-home { width: 100%; }
.portal-intro { display: grid; grid-template-columns: 1fr auto; align-items: center; margin: 0 4px 34px; }
.intro-brand { display: flex; align-items: center; gap: 12px; }
.intro-brand > span { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; color: #fff; background: linear-gradient(135deg,#315de6,#7a5ee7); box-shadow: 0 12px 28px rgba(70,91,207,.24); font-size: 13px; font-weight: 850; }
.intro-brand div { display: grid; gap: 3px; }
.intro-brand b { font-size: 16px; }
.intro-brand small { color: #98a2b3; font-size: 10px; font-weight: 750; letter-spacing: .13em; }
.intro-state { display: inline-flex; align-items: center; gap: 9px; padding: 9px 13px; border: 1px solid #e7eaf0; border-radius: 999px; color: #667085; background: rgba(255,255,255,.72); font-size: 12px; }
.intro-state i { width: 7px; height: 7px; border-radius: 50%; background: #28b982; box-shadow: 0 0 0 5px rgba(40,185,130,.1); }
.portal-intro h1 { grid-column: 1/-1; margin: 42px 0 9px; color: #101828; font-size: clamp(40px,4vw,58px); line-height: 1.05; letter-spacing: -.055em; font-weight: 680; }
.portal-intro p { grid-column: 1/-1; margin: 0; color: #7b8495; font-size: 16px; }
.portal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.portal-card { position: relative; min-height: 390px; overflow: hidden; padding: 30px; border: 1px solid rgba(25,38,69,.08); border-radius: 28px; background: rgba(255,255,255,.88); color: #111827; text-decoration: none; box-shadow: 0 18px 50px rgba(27,39,74,.08); transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.portal-card::before { content: ""; position: absolute; width: 270px; height: 270px; right: -105px; bottom: -120px; border-radius: 50%; background: radial-gradient(circle, rgba(73,105,225,.17), rgba(73,105,225,0) 70%); }
.portal-card.sanjiantao::before { background: radial-gradient(circle, rgba(129,80,229,.15), rgba(129,80,229,0) 70%); }
.portal-card.editing::before { background: radial-gradient(circle, rgba(28,172,132,.16), rgba(28,172,132,0) 70%); }
.portal-card:hover { transform: translateY(-6px); border-color: rgba(76,111,238,.25); box-shadow: 0 28px 70px rgba(27,39,74,.14); }
.card-head { display: flex; align-items: center; gap: 11px; }
.card-icon { width: 42px; height: 42px; border-radius: 13px; background: #eef2ff; position: relative; }
.sanjiantao .card-icon { background: #f3efff; }
.editing .card-icon { background: #e9f8f3; }
.card-type { color: #6f7b91; font-size: 13px; font-weight: 700; }
.card-status { display: none; }
.portal-card h2 { position: relative; margin: 40px 0 13px; color: #101828; font-size: 32px; letter-spacing: -.035em; }
.portal-card p { position: relative; max-width: 360px; min-height: 78px; margin: 0; color: #667085; font-size: 15px; line-height: 1.75; }
.portal-card small { position: relative; display: block; margin-top: 20px; color: #98a2b3; font-size: 12px; line-height: 1.6; }
.portal-card > b { position: absolute; z-index: 2; left: 30px; bottom: 30px; color: #365fcf; font-size: 14px; font-weight: 800; }
.card-art { position: absolute; right: 28px; bottom: 27px; display: flex; align-items: end; gap: 6px; height: 62px; opacity: .72; }
.card-art i { display: block; width: 11px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg,#7393ef,#dbe4ff); }
.card-art i:nth-child(1){height:24px}.card-art i:nth-child(2){height:40px}.card-art i:nth-child(3){height:31px}.card-art i:nth-child(4){height:56px}
.sanjiantao .card-art i { background: linear-gradient(180deg,#9a78e6,#e6def8); }
.editing .card-art i { background: linear-gradient(180deg,#48b995,#d5f0e8); }
.portal-footer { display: flex; justify-content: space-between; margin: 38px 4px 0; padding: 22px 0 4px; border-top: 1px solid rgba(25,38,69,.08); color: #98a2b3; font-size: 12px; }
@media (max-width: 900px) {
  .portal-page .auth-shell { padding: 40px 20px 24px; }
  .portal-grid { grid-template-columns: 1fr; }
  .portal-card { min-height: 330px; }
}
@media (max-width: 620px) {
  .portal-page .auth-shell { padding: 28px 12px 24px; }
  .portal-intro { grid-template-columns: 1fr; }
  .intro-state { display: none; }
  .portal-intro h1 { margin-top: 34px; font-size: 40px; }
  .portal-footer { display: grid; gap: 7px; }
}
