:root {
  color-scheme: light;
  --page: #f3f5f8;
  --white: #fff;
  --ink: #102238;
  --muted: #526177;
  --line: #e3e1db;
  --accent: #2457d6;
  --accent-dark: #1947b8;
  --accent-soft: #eaf0ff;
  --ok: #1c644f;
  --ok-soft: #e9f6ef;
  --danger: #a5233b;
  --ease: cubic-bezier(.16, 1, .3, 1);
  font-family: "Microsoft YaHei UI", "PingFang SC", "Noto Sans SC", system-ui, sans-serif;
  color: var(--ink);
  background: var(--page);
  line-height: 1.55;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
::selection { color: var(--ink); background: #c9d9ff; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a, input, select { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
:where(a, button, input, select):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 2rem; line-height: 1.2; text-wrap: balance; }
h2 { font-size: 1.1rem; line-height: 1.35; }
h3 { font-size: 1rem; }

.frame { width: min(76rem, 100% - 3rem); margin: 0 auto; }
.masthead { background: var(--white); border-bottom: 1px solid var(--line); }
.masthead-inner { min-height: 4rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.identity, .operator { display: flex; align-items: center; gap: .75rem; }
.identity { font-weight: 700; white-space: nowrap; }
.mark { width: 2.125rem; height: 2.125rem; color: var(--accent); }
.operator { color: var(--muted); font-size: .875rem; flex-wrap: wrap; justify-content: flex-end; }
.operator form { margin: 0; }
.workspace { padding: clamp(1.75rem, 5vw, 3.5rem) 0; }
.titlebar { display: flex; align-items: end; justify-content: space-between; gap: 1.125rem; margin-bottom: 1.625rem; }
.caption, .empty p { color: var(--muted); }
.caption { margin-top: .2rem; font-size: .81rem; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 15rem; gap: 1.25rem; align-items: start; }
.directory, .projects { border: 1px solid var(--line); border-radius: .5rem; background: var(--white); min-width: 0; }
.skip-link { position: absolute; top: .5rem; left: .5rem; transform: translateY(-150%); background: var(--white); padding: .5rem; z-index: 5; }
.skip-link:focus { transform: none; }
.directory-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.25rem; flex-wrap: wrap; }
.filters, .dialog-actions, td .actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.button, select, input { min-height: 2.55rem; border: 1px solid var(--line); border-radius: .55rem; background: var(--white); color: var(--ink); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .35rem .75rem; white-space: nowrap; font-weight: 600; font-size: .84rem; cursor: pointer; transition: background-color 150ms var(--ease), transform 150ms var(--ease); }
.button:hover, .button.quiet:hover { background: #f3f6fc; }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:disabled { cursor: default; opacity: .62; }
.button.primary { background: var(--accent); border-color: transparent; color: white; }
.button.primary:hover { background: var(--accent-dark); }
.button.destructive { color: var(--danger); }
.button.confirm-delete { color: white; background: var(--danger); border-color: transparent; }
.button.quiet { border-color: transparent; min-height: 2.2rem; }
svg:not(.mark) { width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; margin-left: .65rem; color: var(--muted); pointer-events: none; }
.search input { padding: .35rem .6rem .35rem 2.05rem; width: min(100%, 13rem); }
select { padding: .35rem 1.1rem .35rem .6rem; background: white; }
input { min-width: 0; padding: .45rem .7rem; }
input::placeholder { color: #5a687b; opacity: 1; }

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
thead { background: #f7f8fb; color: var(--muted); white-space: nowrap; }
th, td { padding: .7rem .95rem; border-top: 1px solid #ebedf0; font-size: .875rem; }
th:first-child, td:first-child { padding-left: 1.25rem; }
td { vertical-align: middle; }
td:first-child div { display: grid; gap: .18rem; overflow-wrap: anywhere; }
.account-cell { min-width: 8.5rem; }
.secondary { color: var(--muted); font-size: .8rem; }
.badge { display: inline-flex; padding: .19rem .55rem; border-radius: 20rem; font-size: .76rem; white-space: nowrap; color: #505f72; background: #f1f2f4; }
.badge.live { color: var(--ok); background: var(--ok-soft); }
.scope-button { min-height: 2.45rem; gap: .5rem; }
.scope-button.compact { min-height: 2rem; padding: .18rem .5rem; font-size: .8rem; }
.scope-indicator { position: relative; width: 1.8rem; height: 1.05rem; border-radius: 1rem; background: #dce2ed; transition: background-color 150ms var(--ease); }
.scope-indicator::after { position: absolute; top: .16rem; left: .16rem; content: ''; width: .73rem; height: .73rem; border-radius: 50%; background: white; transition: transform 170ms var(--ease); }
.scope-button[aria-checked="true"] .scope-indicator { background: var(--accent); }
.scope-button[aria-checked="true"] .scope-indicator::after { transform: translateX(.75rem); }
.project-access { display: grid; gap: .45rem; min-width: 10rem; }
.project-scope { display: flex; align-items: center; justify-content: space-between; gap: .65rem; }
.project-label { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.actions-cell .actions { display: grid; grid-template-columns: repeat(2, max-content); }
.actions-cell .button { padding-right: .55rem; padding-left: .55rem; font-size: .8rem; }
.actions-cell .destructive { grid-column: 1 / -1; justify-self: start; }
.projects { padding: 1.15rem 1.05rem .35rem; }
.project-list { padding: 0; margin: .8rem 0 0; list-style: none; }
.project-list li { min-height: 2.6rem; display: flex; justify-content: space-between; align-items: center; gap: .25rem; border-top: 1px solid #edf0f4; font-size: .87rem; }
.empty { padding: 2.25rem 1.25rem; text-align: center; border-top: 1px solid #edf0f4; }
.empty p { margin: .35rem auto .6rem; font-size: .87rem; }
.action-feedback { padding: .65rem 1.25rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.action-feedback.error, .form-error { color: var(--danger); }

dialog { width: min(28rem, 100% - 2rem); border: 1px solid var(--line); border-radius: 1rem; padding: 1.5rem; color: var(--ink); overscroll-behavior: contain; }
dialog::backdrop { background: #1022386b; }
dialog p { margin: .4rem 0 1rem; color: var(--muted); font-size: .9rem; }
dialog label { display: grid; gap: .35rem; margin-bottom: .8rem; font-weight: 600; font-size: .9rem; }
dialog label span { font-weight: 400; font-size: .8rem; color: var(--muted); }
dialog input { width: 100%; }
.dialog-actions { justify-content: flex-end; margin-top: 1.3rem; }
.login { max-width: 29rem; margin: 13vh auto; background: white; border: 1px solid var(--line); border-radius: .95rem; padding: 1.65rem; width: calc(100% - 2rem); }
.login p { color: var(--muted); margin: .65rem 0 1.15rem; }
.login-actions { display: flex; gap: .6rem; flex-wrap: wrap; }

@media (max-width: 56rem) { .workspace-grid { grid-template-columns: minmax(0, 1fr); } .projects { max-width: 31rem; } }
@media (max-width: 38rem) {
  .frame { width: calc(100% - 1.5rem); }
  .titlebar { align-items: start; flex-direction: column; }
  h1 { font-size: 1.8rem; }
  .table-wrap { overflow: visible; }
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: .75rem 1rem; border-top: 1px solid var(--line); gap: .4rem; }
  th, td, td:first-child { border: 0; padding: 0; }
  tbody tr .account-cell { grid-column: 1; }
  tbody tr .status-cell { grid-column: 2; justify-self: end; }
  tbody tr .access-cell, tbody tr .actions-cell { grid-column: 1 / -1; justify-self: stretch; }
  tbody tr .actions-cell { margin-top: .35rem; }
  tbody tr .access-cell .project-scope { max-width: 22rem; }
  .button, input, select { min-height: 2.75rem; }
}
@media (prefers-reduced-motion: reduce) { *, *::after { transition-duration: .01ms !important; } }
