:root {
  --ink: #081721;
  --ink-2: #12313c;
  --teal: #12a99c;
  --teal-bright: #2fd0c0;
  --cyan: #63cbe8;
  --amber: #e6a24b;
  --paper: #f2f6f6;
  --white: #fff;
  --muted: #64747b;
  --line: #d8e3e3;
  --danger: #b94045;
  --success: #187f70;
  --radius: 16px;
  --shadow: 0 18px 50px rgba(8, 23, 33, .10);
  --shell: 1240px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
.shell { width: min(calc(100% - 40px), var(--shell)); margin: 0 auto; }
.inline-form { display: inline; margin: 0; }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  min-width: max-content;
}

.brand > span:last-child { display: grid; line-height: 1; gap: 4px; }
.brand strong { font-size: 17px; letter-spacing: -.02em; }
.brand small { color: #6f858c; font-size: 9px; font-weight: 800; letter-spacing: .21em; }
.brand-mark {
  width: 40px;
  height: 40px;
  position: relative;
  display: grid;
  place-items: center;
  border-radius: 12px;
  overflow: hidden;
  color: #fff;
  background: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.brand-mark i { position: absolute; left: 9px; top: 9px; width: 9px; height: 17px; border-left: 3px solid var(--teal-bright); border-bottom: 3px solid var(--teal-bright); border-radius: 0 0 0 5px; }
.brand-mark b { position: absolute; right: 6px; bottom: 4px; font-size: 13px; letter-spacing: -.08em; }

.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  color: #fff;
  background: rgba(8, 23, 33, .97);
  border-bottom: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(14px);
}
.header-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.app-header .brand small { color: #8fa6ad; }
.main-nav { display: flex; align-items: center; gap: 24px; color: #b7c7cb; font-size: 14px; }
.main-nav > a:hover { color: #fff; }
.user-pill { display: inline-flex; align-items: center; gap: 8px; color: #fff; }
.avatar { width: 28px; height: 28px; flex: 0 0 28px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--ink); background: var(--teal-bright); font-size: 12px; font-weight: 900; }
.nav-button { border: 0; padding: 7px 0; color: #9fb2b8; background: transparent; cursor: pointer; }
.nav-button:hover { color: #fff; }

.eyebrow { margin: 0 0 10px; color: var(--teal); font-size: 12px; font-weight: 850; letter-spacing: .13em; }
.button {
  min-height: 43px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 750;
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, border-color .16s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: #fff; background: var(--teal); box-shadow: 0 10px 25px rgba(18,169,156,.18); }
.button-primary:hover { background: #0d9489; }
.button-secondary { color: var(--ink); background: #fff; border-color: #bfd0d0; }
.button-secondary:hover { border-color: var(--teal); }
.button-quiet { color: #40575f; background: #edf3f2; }
.button-block { width: 100%; }

input, select, textarea {
  width: 100%;
  border: 1px solid #cbd9d9;
  border-radius: 10px;
  color: var(--ink);
  background: #fbfcfc;
  padding: 11px 12px;
  outline: none;
  transition: border-color .16s ease, box-shadow .16s ease;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(18,169,156,.13); }
textarea { min-height: 92px; resize: vertical; }
label { display: grid; gap: 7px; color: #263d45; font-size: 13px; font-weight: 750; }
.field-help { color: #7c8c91; font-size: 12px; font-weight: 500; }

.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.08fr) minmax(420px, .92fr); }
.auth-brand-panel {
  min-height: 100vh;
  position: relative;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 82% 17%, rgba(47,208,192,.24), transparent 26%),
    linear-gradient(145deg, #07151e 0%, #0b2530 62%, #10343d 100%);
}
.auth-brand-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .2;
  background-image: linear-gradient(rgba(255,255,255,.09) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.09) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(120deg, #000, transparent 82%);
}
.auth-brand-panel::after {
  content: "52";
  position: absolute;
  right: -18px;
  bottom: -108px;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255,255,255,.09);
  font-size: 360px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -.11em;
}
.auth-brand-content { position: relative; z-index: 1; width: min(78%, 660px); min-height: 100%; margin: auto; padding: 54px 0 38px; display: flex; flex-direction: column; }
.auth-brand-panel .brand small { color: #8ca9af; }
.auth-copy { margin: auto 0; padding: 72px 0; }
.auth-copy .eyebrow { color: var(--teal-bright); }
.auth-copy h1 { margin: 0; max-width: 690px; font-size: clamp(38px, 4.4vw, 64px); line-height: 1.15; letter-spacing: -.05em; }
.auth-points { list-style: none; margin: 46px 0 0; padding: 0; display: grid; gap: 14px; color: #c4d2d5; }
.auth-points li { display: flex; align-items: center; gap: 13px; }
.auth-points span { color: var(--teal-bright); font-size: 11px; font-weight: 800; letter-spacing: .11em; }
.auth-footnote { margin: 0; color: #78939a; font-size: 13px; }
.auth-form-panel { min-height: 100vh; display: grid; place-items: center; padding: 42px; background: #f3f7f6; }
.auth-card { width: min(100%, 450px); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0; font-size: 31px; line-height: 1.2; letter-spacing: -.035em; }
.auth-intro { margin: 12px 0 25px; color: var(--muted); }
.form-stack { display: grid; gap: 16px; }
.form-stack .button { margin-top: 4px; }
.auth-switch { margin-top: 22px; padding-top: 18px; border-top: 1px solid #e2e9e8; color: #6b7d83; text-align: center; font-size: 13px; }
.auth-switch a { color: var(--teal); font-weight: 800; }
.form-error { margin: 0 0 18px; padding: 11px 13px; border: 1px solid #efc7c9; border-radius: 10px; color: #8a2f34; background: #fff2f2; font-size: 13px; }

.dashboard-page { padding: 58px 0 76px; }
.dashboard-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 32px; margin-bottom: 35px; }
.dashboard-heading h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.16; letter-spacing: -.045em; }
.dashboard-heading p:last-child { max-width: 750px; margin: 15px 0 0; color: var(--muted); }
.mini-stats { display: flex; border: 1px solid var(--line); border-radius: 15px; background: #fff; overflow: hidden; }
.mini-stats div { min-width: 115px; padding: 14px 17px; }
.mini-stats div + div { border-left: 1px solid var(--line); }
.mini-stats strong, .mini-stats span { display: block; }
.mini-stats strong { font-size: 23px; line-height: 1.1; }
.mini-stats span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.module-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.module-card { min-height: 390px; display: flex; flex-direction: column; padding: 26px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 8px 24px rgba(8,23,33,.035); overflow: hidden; position: relative; }
.module-card::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--teal); }
.module-gray::before { background: var(--cyan); }
.module-ductile::before { background: var(--amber); }
.module-thermal::before { background: #7762ad; }
.module-card-top { display: flex; align-items: center; justify-content: space-between; }
.module-index { color: #8ba0a5; font-size: 11px; font-weight: 900; letter-spacing: .13em; }
.module-glyph { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; color: #087c72; background: #ddf6f2; font-size: 24px; font-weight: 900; }
.module-gray .module-glyph { color: #2b7892; background: #e3f4f9; }
.module-ductile .module-glyph { color: #9b6422; background: #fff2dd; border-radius: 50%; }
.module-thermal .module-glyph { color: #655196; background: #eee9fa; }
.module-subtitle { margin: 24px 0 5px; color: #6c7f85; font-size: 12px; font-weight: 750; letter-spacing: .04em; }
.module-card h2 { margin: 0; font-size: 26px; letter-spacing: -.035em; }
.module-description { margin: 14px 0 18px; color: var(--muted); font-size: 14px; }
.tag-row { display: flex; flex-wrap: wrap; gap: 7px; }
.tag-row span { padding: 5px 9px; border-radius: 999px; color: #51686f; background: #f0f5f4; font-size: 11px; }
.module-card-bottom { margin-top: auto; padding-top: 23px; border-top: 1px solid #e3eae9; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: #7a8b90; font-size: 12px; }
.module-link { color: var(--ink); font-size: 14px; font-weight: 850; }
.module-link b { color: var(--teal); font-size: 18px; }
.trial-notice { margin-top: 20px; padding: 22px 24px; display: grid; grid-template-columns: 1fr 1fr auto; gap: 28px; align-items: center; border-radius: 17px; color: #c5d4d7; background: var(--ink); }
.trial-notice strong { display: block; color: #fff; font-size: 14px; }
.trial-notice p { margin: 4px 0 0; color: #9fb2b7; font-size: 12px; }

.tool-page { min-height: 100vh; display: grid; grid-template-rows: auto auto 1fr; background: #dfe8e7; }
.tool-toolbar { min-height: 64px; padding: 9px 18px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 18px; color: #fff; background: var(--ink); }
.back-link { color: #a9bdc2; font-size: 13px; }
.back-link:hover { color: #fff; }
.tool-title { display: flex; align-items: center; gap: 10px; }
.tool-title strong { font-size: 15px; }
.tool-title small { color: #81999f; }
.tool-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--teal-bright); }
.tool-dot.module-gray { background: var(--cyan); }
.tool-dot.module-ductile { background: var(--amber); }
.tool-dot.module-thermal { background: #9a82d4; }
.tool-actions { display: flex; justify-content: flex-end; gap: 8px; }
.tool-toolbar .button { min-height: 38px; padding: 0 13px; font-size: 12px; }
.feedback-drawer { padding: 14px 18px; border-bottom: 1px solid #c2d1d0; background: #f7faf9; }
.feedback-form { width: min(100%, 1060px); margin: 0 auto; display: grid; grid-template-columns: 260px 1fr auto auto; align-items: end; gap: 12px; }
.feedback-form textarea { min-height: 44px; height: 44px; }
.saved-note { color: var(--success); font-size: 13px; font-weight: 800; }
.tool-frame { width: 100%; height: calc(100vh - 64px); border: 0; background: #fff; }

.admin-page { padding: 52px 0 78px; }
.admin-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.admin-heading h1 { margin: 0; font-size: 40px; letter-spacing: -.045em; }
.admin-heading p:last-child { margin: 9px 0 0; color: var(--muted); }
.admin-metrics { display: flex; border: 1px solid var(--line); border-radius: 15px; background: #fff; overflow: hidden; }
.admin-metrics div { min-width: 105px; padding: 13px 16px; }
.admin-metrics div + div { border-left: 1px solid var(--line); }
.admin-metrics strong, .admin-metrics span { display: block; }
.admin-metrics strong { font-size: 22px; line-height: 1; }
.admin-metrics span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.admin-card { margin-top: 18px; padding: 23px; border: 1px solid var(--line); border-radius: 17px; background: #fff; }
.invite-card { display: flex; align-items: center; justify-content: space-between; gap: 30px; }
.invite-card h2, .card-heading h2 { margin: 0; font-size: 18px; }
.invite-card p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.invite-form { display: flex; gap: 9px; width: min(100%, 430px); }
.card-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-heading span { color: var(--muted); font-size: 12px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 10px 12px; color: #73858b; background: #f3f7f6; text-align: left; white-space: nowrap; }
td { padding: 13px 12px; border-bottom: 1px solid #e5ebea; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.person-cell { min-width: 150px; display: flex; align-items: center; gap: 9px; }
.person-cell strong, .person-cell small { display: block; }
.person-cell small { color: var(--muted); }
.status-badge, .role-badge { display: inline-flex; margin-right: 5px; padding: 3px 7px; border-radius: 999px; font-size: 11px; font-weight: 800; }
.status-active { color: #126f62; background: #dcf5ef; }
.status-disabled { color: #8b3539; background: #fae5e6; }
.role-badge { color: #365e8d; background: #e4eefb; }
.table-action { padding: 5px 8px; border: 0; color: var(--teal); background: transparent; font-weight: 800; cursor: pointer; }
.feedback-note { min-width: 260px; max-width: 520px; white-space: normal; }
.empty-cell { padding: 34px; color: var(--muted); text-align: center; }
.inline-success { margin-bottom: 18px; padding: 11px 14px; border: 1px solid #b9dfd8; border-radius: 11px; color: #116b5f; background: #e8f8f4; }

.flash { position: fixed; top: 80px; left: 50%; z-index: 100; transform: translateX(-50%); padding: 11px 16px; border-radius: 11px; box-shadow: var(--shadow); font-size: 13px; }
.flash-success { color: #0f6b5d; background: #e4f7f2; border: 1px solid #b8e1d8; }
.flash-error { color: #8a2f34; background: #fff0f1; border: 1px solid #edc4c7; }
.error-page { min-height: 100vh; padding: 40px; display: grid; place-content: center; justify-items: center; text-align: center; background: #f3f7f6; }
.error-code { color: #c8d6d6; font-size: 100px; font-weight: 900; line-height: 1; }
.error-page h1 { margin: 14px 0 7px; font-size: 30px; }
.error-page p { max-width: 580px; margin: 0 0 23px; color: var(--muted); }

@media (max-width: 980px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-brand-panel { min-height: 420px; }
  .auth-brand-content { width: min(calc(100% - 48px), 720px); padding: 34px 0 28px; }
  .auth-copy { padding: 60px 0 36px; }
  .auth-copy h1 { font-size: 40px; }
  .auth-points { margin-top: 28px; grid-template-columns: repeat(2, 1fr); }
  .auth-points li { align-items: flex-start; }
  .auth-form-panel { min-height: auto; padding: 48px 24px 70px; }
  .module-grid { grid-template-columns: 1fr; }
  .module-card { min-height: 315px; }
  .trial-notice { grid-template-columns: 1fr 1fr; }
  .trial-notice .button { grid-column: 1 / -1; }
  .feedback-form { grid-template-columns: 1fr 1fr; }
  .feedback-form label:nth-of-type(2) { grid-column: 1 / -1; }
  .admin-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 720px) {
  .shell { width: min(calc(100% - 26px), var(--shell)); }
  .header-inner { min-height: 62px; }
  .main-nav { gap: 10px; }
  .main-nav > a { display: none; }
  .user-pill { max-width: 125px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dashboard-page, .admin-page { padding: 38px 0 58px; }
  .dashboard-heading { align-items: flex-start; flex-direction: column; }
  .mini-stats, .admin-metrics { width: 100%; }
  .mini-stats div, .admin-metrics div { flex: 1; min-width: 0; }
  .trial-notice { grid-template-columns: 1fr; }
  .trial-notice .button { grid-column: auto; }
  .auth-brand-panel { min-height: 360px; }
  .auth-copy { padding: 46px 0 22px; }
  .auth-copy h1 { font-size: 32px; }
  .auth-points { display: none; }
  .auth-card { padding: 28px 22px; }
  .auth-form-panel { padding: 30px 14px 55px; }
  .tool-toolbar { grid-template-columns: auto 1fr; }
  .tool-title { justify-content: flex-end; }
  .tool-title small { display: none; }
  .tool-actions { grid-column: 1 / -1; }
  .tool-actions .button { flex: 1; }
  .tool-frame { height: calc(100vh - 112px); }
  .feedback-form { grid-template-columns: 1fr; }
  .feedback-form label:nth-of-type(2) { grid-column: auto; }
  .invite-card { align-items: stretch; flex-direction: column; }
  .invite-form { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
