:root {
  --primary-950: #04120e;
  --primary-900: #07211a;
  --primary-800: #0c2e25;
  --primary-700: #1a4437;
  --accent: #0f6e56;
  --accent-600: #0b523f;
  --accent-pale: #e1f5ee;
  --accent-mist: #f2f8f5;
  --gold: #ef9f27;
  --ink: #14231f;
  --ink-2: #4a5b54;
  --ink-3: #7c8a83;
  --paper: #fafcfb;
  --mist: #eff5f2;
  --line: #dce6e1;
  --line-2: #c3d3cc;
  --success: #1a7a4a;
  --danger: #c0392b;
  --serif: 'Songti SC', STSong, 'Noto Serif CJK SC', serif;
  --sans: 'PingFang SC', 'Microsoft YaHei', system-ui, -apple-system, sans-serif;
  --shadow-sm: 0 1px 2px rgba(20, 35, 31, .05);
  --shadow: 0 10px 28px rgba(20, 35, 31, .08);
  --shadow-lg: 0 22px 54px rgba(20, 35, 31, .12);
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  background:
    linear-gradient(180deg, rgba(15, 110, 86, .035), transparent 280px),
    var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input, select { font: inherit; }
button, summary, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, a:focus-visible {
  outline: 3px solid rgba(15, 110, 86, .18);
  outline-offset: 2px;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 72px;
  padding: 0 max(28px, calc((100vw - 1480px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 252, 251, .9);
  backdrop-filter: saturate(160%) blur(14px);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M66 88 H28 Q12 88 12 72 V28 Q12 12 28 12 H72 Q88 12 88 28 V64' fill='none' stroke='%230F6E56' stroke-width='11' stroke-linecap='round'/%3E%3Ccircle cx='50' cy='50' r='10' fill='%230F6E56'/%3E%3Ccircle cx='84' cy='83' r='7' fill='%23EF9F27'/%3E%3C/svg%3E") center / contain no-repeat;
}
.brand-mark span { display: none; }
.eyebrow, .section-index {
  color: var(--accent);
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}
h1 {
  margin: 2px 0 0;
  font-size: 1rem;
  line-height: 1.25;
  letter-spacing: .02em;
}

.top-status {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2);
  background: #fff;
  box-shadow: var(--shadow-sm);
  font-size: .82rem;
  font-weight: 600;
}
.top-status i, .service-dot {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
  box-shadow: 0 0 0 4px rgba(124, 138, 131, .1);
}
.top-status.running {
  color: var(--success);
  border-color: #cce7d7;
  background: #f5fbf7;
}
.top-status.running i, .service-dot.ok {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(26, 122, 74, .1);
}
.top-status.error { color: var(--danger); border-color: #efd0cc; background: #fff8f7; }
.top-status.error i { background: var(--danger); }

main {
  width: min(1480px, calc(100% - 56px));
  margin: 0 auto;
  flex: 1;
  padding: 44px 0 38px;
}

.connect-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
  gap: clamp(48px, 8vw, 130px);
  align-items: center;
  min-height: calc(100vh - 204px);
}
.intro-panel { padding-bottom: 28px; }
.intro-copy h2, .workspace-head h2 {
  margin: 20px 0 22px;
  max-width: 780px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(2.15rem, 4.4vw, 4.8rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -.025em;
}
.intro-copy p {
  max-width: 620px;
  margin: 0;
  color: var(--ink-2);
  font-size: 1.05rem;
  line-height: 1.8;
}

.security-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 42px;
}
.security-grid article {
  min-height: 120px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: border-color .2s, box-shadow .2s, transform .2s;
}
.security-grid article:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.security-grid strong { font-size: .98rem; }
.security-grid span { color: var(--ink-3); font-size: .8rem; line-height: 1.5; }

.connection-card {
  position: relative;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.connection-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 36px;
  width: 48px;
  height: 4px;
  border-radius: 0 0 4px 4px;
  background: var(--accent);
}
.connection-card::after {
  content: '';
  position: absolute;
  top: -2px;
  left: 94px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}
.card-heading { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 30px; }
.card-heading h3 { margin: 7px 0 0; font-family: var(--serif); font-size: 1.42rem; }
.lock-badge, .readonly-pill {
  display: inline-flex;
  align-items: center;
  min-height: 29px;
  padding: 0 11px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-pale);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .05em;
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 17px; }
.field > span:first-child { color: var(--ink-2); font-size: .84rem; font-weight: 600; }
.field input, .field select {
  width: 100%;
  height: 49px;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 4px;
  outline: none;
  color: var(--ink);
  background: #fff;
  transition: border-color .16s, box-shadow .16s;
}
.field input::placeholder { color: #a1ada7; }
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(15, 110, 86, .09); }
.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 64px; }
.reveal {
  position: absolute;
  right: 9px;
  top: 9px;
  height: 31px;
  padding: 0 7px;
  border: 0;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-size: .78rem;
  font-weight: 700;
}
details { margin: 4px 0 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
summary { cursor: pointer; padding: 14px 0; color: var(--ink-3); font-size: .83rem; }
.advanced-fields { grid-template-columns: .7fr 1.5fr 1.2fr; padding-top: 8px; }
.form-message { min-height: 34px; color: var(--ink-3); font-size: .84rem; line-height: 1.5; }
.form-message.error { color: var(--danger); }
.primary-button {
  width: 100%;
  height: 54px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 8px 22px rgba(15, 110, 86, .2);
  cursor: pointer;
  font-weight: 700;
  transition: background .18s, box-shadow .18s, transform .18s;
}
.primary-button:hover { background: var(--accent-600); box-shadow: 0 10px 26px rgba(15, 110, 86, .27); transform: translateY(-1px); }
.primary-button:disabled { opacity: .56; cursor: wait; transform: none; }
.primary-button b { font-size: 1.12rem; }

.workspace-view { min-height: calc(100vh - 204px); }
.workspace-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 30px;
  margin-bottom: 24px;
}
.workspace-head h2 { margin: 10px 0 0; font-size: clamp(2rem, 3.4vw, 3.35rem); }
.workspace-actions { display: flex; align-items: center; gap: 12px; padding-bottom: 4px; }
.ghost-button {
  height: 38px;
  padding: 0 15px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  color: var(--ink-2);
  background: #fff;
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  transition: color .16s, border-color .16s, background .16s;
}
.ghost-button.danger:hover { border-color: var(--danger); color: var(--danger); background: #fff8f7; }
.ghost-button:disabled { opacity: .55; cursor: not-allowed; }

.unified-workspace {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.workspace-sidebar {
  padding: 22px 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #f7fbf9 0%, #eef5f2 100%);
}
.nav-group { display: grid; gap: 6px; }
.nav-group-title {
  padding: 0 10px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-3);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .13em;
}
.unified-nav-item {
  min-height: 43px;
  padding: 0 10px;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink-2);
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: color .16s, border-color .16s, background .16s, transform .16s;
}
.unified-nav-item b {
  color: #8da098;
  font-family: var(--serif);
  font-size: .78rem;
}
.unified-nav-item span { font-size: .86rem; font-weight: 650; }
.unified-nav-item:hover { color: var(--accent); background: rgba(255, 255, 255, .72); transform: translateX(2px); }
.unified-nav-item.active {
  color: var(--accent);
  border-color: #c8ddd4;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.unified-nav-item.active b { color: var(--accent); }
.sidebar-note {
  margin: auto 8px 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: .7rem;
  line-height: 1.65;
}

.browser-frame {
  overflow: hidden;
  background: #fff;
}
.browser-bar {
  height: 46px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 100px 1fr 120px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  color: var(--ink-3);
  background: var(--mist);
  font-size: .76rem;
}
.browser-dots { display: flex; gap: 7px; }
.browser-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); }
.browser-dots i:nth-child(2) { background: #9db7ac; }
.browser-dots i:nth-child(3) { background: var(--accent); }
.browser-bar > span { text-align: center; font-weight: 600; }
.browser-bar .in-app-badge { color: var(--accent); text-align: right; font-size: .7rem; letter-spacing: .06em; }
.frame-stage { height: calc(100vh - 285px); min-height: 560px; background: #fff; }
.frame-stage iframe { width: 100%; height: 100%; display: block; border: 0; }
.hidden { display: none !important; }

.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 18%, rgba(93, 202, 165, .12), transparent 28%),
    var(--primary-900);
}
.login-shell {
  width: min(1220px, calc(100% - 56px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 64px 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 480px);
  gap: clamp(56px, 9vw, 140px);
  align-items: center;
}
.login-story { color: #e8f4ef; }
.login-brand { margin-bottom: clamp(60px, 10vh, 110px); }
.login-brand h1 { color: #fff; font-size: 1.08rem; }
.login-brand .eyebrow { color: #7acfae; }
.login-copy h2 {
  max-width: 720px;
  margin: 18px 0 24px;
  color: #fff;
  font-family: var(--serif);
  font-size: clamp(2.6rem, 5.3vw, 5.3rem);
  line-height: 1.08;
  letter-spacing: -.035em;
}
.login-copy p { max-width: 660px; margin: 0; color: rgba(225, 240, 235, .72); font-size: 1.02rem; line-height: 1.85; }
.login-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-top: 42px; background: rgba(255,255,255,.12); }
.login-features article { padding: 18px; background: var(--primary-900); }
.login-features b, .login-features span { display: block; }
.login-features b { color: #fff; font-family: var(--serif); font-size: 1.05rem; }
.login-features span { margin-top: 6px; color: rgba(225, 240, 235, .55); font-size: .76rem; }
.login-security { margin: 22px 0 0; color: rgba(225, 240, 235, .42); font-size: .75rem; letter-spacing: .12em; }
.login-panel { position: relative; }
.login-card { padding: 38px; border-radius: 12px; background: #fff; box-shadow: 0 32px 80px rgba(0, 0, 0, .28); }
.login-card .card-heading { margin-bottom: 30px; }
.login-card .field { margin-bottom: 18px; }
.login-card .form-message { min-height: 42px; }
.login-help { margin: 18px 0 0; color: var(--ink-3); font-size: .76rem; text-align: center; }

.account-area { display: flex; align-items: center; gap: 10px; }
.account-summary { display: grid; text-align: right; line-height: 1.25; }
.account-summary strong { font-size: .8rem; }
.account-summary small { color: var(--ink-3); font-size: .68rem; }
.text-button { border: 0; color: var(--accent); background: transparent; cursor: pointer; font-size: .76rem; font-weight: 700; }

.local-panel {
  min-height: 560px;
  padding: 30px;
  background: #f8fbf9;
}
.panel-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.panel-title h3 { margin: 6px 0 4px; font-family: var(--serif); font-size: 1.65rem; }
.panel-title p { margin: 0; color: var(--ink-3); font-size: .82rem; }
.access-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(340px, .65fr); gap: 20px; }
.access-card { padding: 22px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: var(--shadow-sm); }
.access-card h4 { margin: 0 0 18px; font-size: .96rem; }
.user-table { width: 100%; border-collapse: collapse; }
.user-table th, .user-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; font-size: .78rem; }
.user-table th { color: var(--ink-3); font-weight: 650; }
.role-badge { display: inline-flex; padding: 3px 8px; border-radius: 999px; color: var(--accent); background: var(--accent-pale); font-size: .7rem; }
.permission-form .field-row { gap: 10px; }
.permission-form textarea { width: 100%; min-height: 72px; padding: 10px 12px; resize: vertical; border: 1.5px solid var(--line); border-radius: 5px; font: inherit; }
.connection-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.connection-summary article { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.connection-summary small, .connection-summary strong { display: block; }
.connection-summary small { color: var(--ink-3); font-size: .72rem; }
.connection-summary strong { margin-top: 7px; font-size: .88rem; word-break: break-word; }

footer {
  min-height: 58px;
  padding: 0 max(28px, calc((100vw - 1480px) / 2));
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: rgba(225, 240, 235, .62);
  background: var(--primary-900);
  font-size: .72rem;
  letter-spacing: .1em;
}
footer span:first-child { color: #fff; font-weight: 700; }

@media (max-width: 980px) {
  .login-shell { grid-template-columns: 1fr; gap: 42px; padding: 38px 0; }
  .login-brand { margin-bottom: 42px; }
  .login-copy h2 { max-width: 760px; }
  .login-panel { max-width: 620px; width: 100%; }
  .access-layout { grid-template-columns: 1fr; }
  .connection-summary { grid-template-columns: repeat(2, 1fr); }
  main { width: min(100% - 40px, 1480px); }
  .connect-view { grid-template-columns: 1fr; min-height: auto; gap: 40px; }
  .intro-copy h2 { max-width: 650px; }
  .workspace-head { align-items: flex-start; flex-direction: column; }
  .workspace-actions { width: 100%; justify-content: space-between; }
  .unified-workspace { grid-template-columns: 1fr; }
  .workspace-sidebar {
    padding: 12px;
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .nav-group { display: inline-flex; align-items: center; gap: 6px; margin-right: 16px; }
  .nav-group-title { display: inline-flex; gap: 8px; padding: 0 4px; }
  .unified-nav-item { min-width: max-content; display: inline-grid; grid-template-columns: 24px 1fr; }
  .sidebar-note { display: none; }
  .frame-stage { height: 68vh; }
}

@media (max-width: 680px) {
  .login-shell { width: min(100% - 28px, 1220px); }
  .login-copy h2 { font-size: 2.55rem; }
  .login-features { grid-template-columns: 1fr; }
  .login-card { padding: 30px 22px; }
  .connection-summary { grid-template-columns: 1fr; }
  .topbar { height: 66px; padding: 0 18px; }
  .eyebrow { display: none; }
  .brand-mark { width: 30px; height: 30px; flex-basis: 30px; }
  h1 { font-size: .94rem; }
  .top-status { min-height: 30px; max-width: 46%; padding: 0 10px; font-size: .74rem; }
  .top-status span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  main { width: min(100% - 28px, 1480px); padding-top: 28px; }
  .intro-copy h2 { font-size: 2.35rem; }
  .security-grid { grid-template-columns: 1fr; margin-top: 30px; }
  .security-grid article { min-height: 86px; }
  .connection-card { padding: 30px 20px; }
  .connection-card::before { left: 20px; }
  .connection-card::after { left: 78px; }
  .field-row, .advanced-fields { grid-template-columns: 1fr; }
  .workspace-actions { align-items: flex-start; flex-direction: column; }
  .browser-bar { grid-template-columns: 62px 1fr 90px; }
  .browser-bar > span { text-align: center; }
  .frame-stage { height: 72vh; min-height: 480px; }
  footer { min-height: 68px; padding: 14px 18px; gap: 10px; flex-wrap: wrap; }
}

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