:root {
  color-scheme: light;
  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-soft: #edf5f2;
  --line: #d8e2df;
  --text: #172522;
  --muted: #64716f;
  --accent: #14765f;
  --accent-strong: #0b5748;
  --shadow: 0 18px 44px rgba(24, 44, 40, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1180px;
  height: 100vh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
  font-size: 14px;
}

button,
a {
  font: inherit;
}

.oa-shell {
  display: grid;
  grid-template-rows: 58px minmax(0, 1fr);
  height: 100vh;
}

.oa-topbar {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr) max-content;
  align-items: center;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 4px 18px rgba(24, 44, 40, 0.06);
}

.oa-brand {
  display: grid;
  gap: 2px;
}

.oa-brand strong {
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 800;
}

.oa-brand span,
.oa-user {
  color: var(--muted);
  font-size: 12px;
}

.module-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-width: 0;
  overflow: visible;
  white-space: nowrap;
  scrollbar-width: none;
}

.module-tabs::-webkit-scrollbar {
  display: none;
}

.module-tab {
  min-width: auto;
  height: 38px;
  flex: 0 1 auto;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #31423e;
  cursor: pointer;
  padding: 0 8px;
  font-size: 13px;
  font-weight: 750;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  position: relative;
  white-space: nowrap;
}

.module-tab-badge {
  min-width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  padding: 0 5px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
}

.module-tab:hover,
.module-tab.is-active {
  border-color: rgba(20, 118, 95, 0.28);
  background: var(--surface-soft);
  color: var(--accent-strong);
}

.oa-user {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
  white-space: nowrap;
}

.oa-logout,
.oa-password-open {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  padding: 0 12px;
  font-weight: 750;
}

.oa-logout:hover:not(:disabled),
.oa-password-open:hover:not(:disabled) {
  border-color: rgba(20, 118, 95, 0.38);
  background: var(--surface-soft);
}

.oa-logout:disabled,
.oa-password-open:disabled {
  cursor: wait;
  opacity: 0.62;
}

.oa-old-link {
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  padding: 0 12px;
  font-weight: 750;
  text-decoration: none;
}

.oa-old-link:hover {
  border-color: rgba(20, 118, 95, 0.38);
  background: var(--surface-soft);
}

.password-dialog {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: rgba(13, 28, 24, 0.32);
}

.password-panel {
  width: 360px;
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: var(--shadow);
}

.password-panel header,
.password-panel footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.password-panel header strong {
  font-size: 16px;
}

.password-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.password-panel input {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
}

.password-close,
.password-cancel,
.password-submit {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  cursor: pointer;
  padding: 0 12px;
  font-weight: 750;
}

.password-close {
  width: 32px;
  padding: 0;
}

.password-submit {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.password-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.password-error {
  min-height: 18px;
  margin: 0;
  color: #b42318;
  font-size: 12px;
  font-weight: 700;
}

.oa-body {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  min-height: 0;
}

.oa-body.is-wide {
  grid-template-columns: minmax(0, 1fr);
}

.oa-sidebar {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: #fbfdfc;
}

.oa-sidebar[hidden] {
  display: none;
}

.section-nav {
  display: grid;
  align-content: start;
  gap: 7px;
  overflow: auto;
}

.section-button {
  width: 100%;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #2a3b37;
  cursor: pointer;
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
}

.section-button:hover,
.section-button.is-active {
  border-color: rgba(20, 118, 95, 0.25);
  background: #eaf5f1;
  color: var(--accent-strong);
}

.workspace {
  display: grid;
  grid-template-rows: minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: 0 16px 16px;
  gap: 0;
}

.workspace-head {
  display: none;
}

.workspace-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.workspace-head h1 {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 820;
  letter-spacing: 0;
}

.open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-strong);
  padding: 0 12px;
  text-decoration: none;
  font-weight: 700;
}

.open-link:hover {
  border-color: rgba(20, 118, 95, 0.4);
  background: var(--surface-soft);
}

#workspace-frame {
  width: 100%;
  height: 100%;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}


.oa-body.is-wide .workspace {
  padding-left: 18px;
}


.oa-login {
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 28px 18px;
}

.oa-login-card {
  width: min(440px, calc(100vw - 48px));
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px 30px 30px;
}

.oa-login-kicker {
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
}

.oa-login-card h1 {
  margin: 0 0 4px;
  font-size: 26px;
  letter-spacing: 0;
}

.oa-login-card label {
  display: grid;
  gap: 7px;
  color: #31423e;
  font-weight: 750;
}

.oa-login-card input {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  outline: none;
}

.oa-login-card input:focus {
  border-color: rgba(20, 118, 95, 0.52);
  box-shadow: 0 0 0 3px rgba(20, 118, 95, 0.12);
}

.oa-login-error {
  min-height: 18px;
  margin: 0;
  color: #b42318;
  font-size: 13px;
  font-weight: 700;
}

.oa-login-submit {
  height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.oa-login-submit:hover:not(:disabled) {
  background: var(--accent-strong);
}

.oa-login-submit:disabled {
  cursor: wait;
  opacity: 0.68;
}


[hidden],
.module-tabs[hidden],
.oa-user[hidden],
.oa-body[hidden],
.oa-login[hidden],
.oa-sidebar[hidden] {
  display: none !important;
}


.oa-greeting-input {
  width: 92px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 0 8px;
  outline: none;
  font-size: 12px;
  font-weight: 700;
}

.oa-greeting-input:focus {
  border-color: rgba(20, 118, 95, 0.52);
  box-shadow: 0 0 0 3px rgba(20, 118, 95, 0.12);
}


.oa-greeting {
  display: inline-flex;
  align-items: center;
  gap: 0;
}

.oa-greeting-prefix {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 750;
}

.oa-greeting-prefix:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}


.oa-greeting-hint {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}


/* AI cleanup */
.open-link {
  display: none !important;
}

@media (max-width: 1500px) {
  .oa-topbar {
    grid-template-columns: 128px minmax(0, 1fr) max-content;
    gap: 8px;
    padding: 0 10px;
  }

  .module-tabs {
    gap: 3px;
  }

  .module-tab {
    padding: 0 6px;
    gap: 4px;
  }

  .oa-user {
    gap: 6px;
  }

  .oa-old-link,
  .oa-password-open,
  .oa-logout {
    padding: 0 8px;
  }
}

@media (max-width: 1320px) {
  .oa-topbar {
    grid-template-columns: 86px minmax(0, 1fr) max-content;
    gap: 5px;
    padding: 0 8px;
  }

  .oa-brand span,
  .oa-greeting {
    display: none;
  }

  .oa-brand strong {
    font-size: 16px;
  }

  .module-tabs {
    gap: 2px;
  }

  .module-tab {
    padding: 0 3px;
    gap: 3px;
  }

  .module-tab-badge {
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    font-size: 10px;
  }

  .oa-user {
    gap: 4px;
  }

  .oa-old-link,
  .oa-password-open,
  .oa-logout {
    padding: 0 6px;
  }
}

@media (max-width: 900px) {
  body {
    min-width: 0;
  }

  .oa-shell {
    grid-template-rows: auto minmax(0, 1fr);
  }

  .oa-topbar {
    grid-template-columns: minmax(0, 1fr) max-content;
    min-height: 58px;
    padding: 8px 10px;
  }

  .module-tabs {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .oa-body,
  .oa-body.is-wide {
    grid-template-columns: minmax(0, 1fr);
  }

  .oa-sidebar {
    padding: 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .section-nav {
    grid-auto-flow: column;
    grid-auto-columns: minmax(112px, max-content);
    overflow-x: auto;
  }

  .workspace,
  .oa-body.is-wide .workspace {
    padding: 8px;
  }

  .oa-login {
    padding: 18px 12px;
  }

  .oa-login-card {
    width: min(440px, 100%);
    padding: 22px 18px 24px;
  }
}
