:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-soft: #f7f7f7;
  --surface-hover: #f3f3f3;
  --text: #202020;
  --muted: #777777;
  --faint: #a3a3a3;
  --line: #e2e2e2;
  --line-strong: #cccccc;
  --dark: #262626;
  --warning: #8a7543;
  --warning-bg: #fbf9f1;
  --danger: #8a3d3d;
  --danger-bg: #fbf5f5;
  --success: #51665a;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", Consolas, "Liberation Mono", monospace;
  --shadow: 0 14px 40px rgba(0, 0, 0, .1);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; line-height: 1.5; }
button, input, select, textarea { color: inherit; font: inherit; }
button { cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--dark); }
code, kbd, .mono-id, .event-code { font-family: var(--mono); }

/* Login */
.login-shell { min-height: 100vh; background: var(--bg); }
.login-panel { min-height: 100vh; display: grid; place-items: center; padding: 40px 24px; }
.login-card { width: min(500px, 100%); }
.login-logo { width: 52px; height: 64px; margin: 0 auto 42px; border: 10px solid var(--dark); padding: 9px 0; }
.login-logo span { display: block; height: 100%; background: linear-gradient(to bottom, #fff 50%, #d8d8d8 50%); }
.login-card h2 { margin: 0 0 6px; text-align: center; font-size: 28px; font-weight: 650; letter-spacing: -.025em; }
.login-card > p { margin: 0 0 42px; color: var(--muted); text-align: center; font-size: 16px; }
.field { display: grid; gap: 8px; margin-bottom: 20px; }
.field label { font-weight: 560; }
.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 3px;
  outline: 0; background: var(--surface); color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus { border-color: #777; box-shadow: 0 0 0 2px rgba(0,0,0,.08); }
.textarea { min-height: 90px; resize: vertical; }
.login-submit { min-height: 48px; margin-top: 8px; font-size: 16px; }
.login-hint { display: flex; justify-content: space-between; margin-top: 16px; color: var(--faint); font: 11px var(--mono); }
.login-demo { margin-top: 30px; color: var(--faint); text-align: center; font-size: 12px; }

/* Shared controls */
.btn {
  min-height: 38px; padding: 8px 14px;
  border: 1px solid var(--line-strong); border-radius: 3px;
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,.025);
  transition: background .15s, border-color .15s;
}
.btn:hover { border-color: #aaa; background: var(--surface-hover); }
.btn:disabled { cursor: not-allowed; opacity: .45; }
.btn-primary { border-color: var(--dark); background: var(--dark); color: #fff; }
.btn-primary:hover { border-color: #111; background: #111; }
.btn-danger { border-color: #d9c3c3; background: var(--surface); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-block { width: 100%; }
.btn-sm { min-height: 31px; padding: 5px 10px; font-size: 12px; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface); }
.icon-button:hover { background: var(--surface-hover); }

/* Header navigation */
.app-shell { min-height: 100vh; }
.site-header { position: sticky; top: 0; z-index: 30; border-bottom: 1px solid var(--line); background: rgba(250,250,250,.96); backdrop-filter: blur(16px); }
.header-main { height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; }
.header-left, .header-right { display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 4px; background: var(--dark); color: #fff; font: 700 10px var(--mono); }
.brand-copy strong { font-size: 14px; font-weight: 650; }
.brand-copy span { display: none; }
.header-divider { width: 1px; height: 24px; background: var(--line); }
.workspace-switch { display: flex; align-items: center; gap: 9px; height: 38px; padding: 5px 10px; border: 1px solid transparent; border-radius: 5px; background: transparent; }
.workspace-switch:hover { border-color: var(--line); background: var(--surface-hover); }
.workspace-avatar { display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--muted); }
.workspace-switch strong { font-weight: 550; }
.system-state { color: var(--muted); font-size: 12px; }
.system-state i { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: var(--success); }
.admin-chip { display: flex; align-items: center; gap: 9px; }
.avatar { width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 11px; }
.admin-chip strong { display: block; font-size: 12px; font-weight: 550; }
.admin-chip span { display: block; color: var(--faint); font-size: 10px; }
.nav { height: 48px; display: flex; align-items: end; gap: 4px; padding: 0 28px; overflow-x: auto; }
.nav-item { position: relative; height: 48px; display: flex; align-items: center; gap: 7px; padding: 0 13px; border: 0; background: transparent; color: var(--muted); white-space: nowrap; }
.nav-item:hover { color: var(--text); }
.nav-item.active { color: var(--text); font-weight: 560; }
.nav-item.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px; background: var(--dark); }
.nav-count { min-width: 19px; padding: 1px 5px; border: 1px solid var(--line); border-radius: 8px; color: var(--faint); font: 10px var(--mono); text-align: center; }
.mobile-current { display: none; }

/* Main layout */
.main { min-width: 0; }
.content { width: min(1220px, calc(100% - 48px)); margin: 0 auto; padding: 48px 0 80px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 34px; }
.page-head h1 { margin: 0 0 6px; font-size: 22px; font-weight: 620; letter-spacing: -.025em; }
.page-head p { max-width: 670px; margin: 0; color: var(--muted); font-size: 14px; }
.eyebrow { display: none; }
.page-actions { display: flex; align-items: center; gap: 8px; }

/* Overview */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.stat { min-height: 130px; padding: 21px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat-label { color: var(--muted); font-size: 12px; }
.stat-value { margin: 16px 0 8px; font: 600 28px var(--mono); letter-spacing: -.04em; }
.stat-foot { color: var(--faint); font: 11px var(--mono); }
.delta { color: var(--muted); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(290px, .75fr); gap: 18px; margin-top: 18px; }
.panel, .detail-card, .project { border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.panel-head { min-height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; border-bottom: 1px solid var(--line); }
.panel-head h2, .section-title h3 { margin: 0; font-size: 13px; font-weight: 600; }
.panel-head span { color: var(--faint); font: 10px var(--mono); }
.panel-body { padding: 18px 20px; }
.activity-row { display: grid; grid-template-columns: 25px 1fr auto; gap: 12px; align-items: start; padding: 14px 0; border-bottom: 1px solid var(--line); }
.activity-row:last-child { border-bottom: 0; }
.activity-mark { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--line-strong); color: var(--muted); font: 10px var(--mono); }
.activity-copy strong { display: block; margin-bottom: 3px; font: 550 11px var(--mono); }
.activity-copy span { color: var(--muted); font-size: 12px; }
.activity-time { color: var(--faint); font: 10px var(--mono); }
.health-list { display: grid; gap: 9px; }
.health { display: flex; justify-content: space-between; align-items: center; padding: 11px 12px; border: 1px solid var(--line); }
.health code { color: var(--faint); font-size: 10px; }
.dot { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--success); }

/* Toolbars and tables */
.toolbar { display: flex; gap: 8px; margin-bottom: 13px; }
.search { position: relative; flex: 1; }
.search::before { content: "⌕"; position: absolute; left: 12px; top: 9px; color: var(--faint); font-size: 17px; }
.search .input { padding-left: 34px; }
.toolbar .select { width: 155px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.table { width: 100%; min-width: 860px; border-collapse: collapse; }
.table th { padding: 11px 15px; border-bottom: 1px solid var(--line); background: var(--surface-soft); color: var(--muted); font-size: 11px; font-weight: 520; text-align: left; }
.table td { padding: 14px 15px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: #fcfcfc; }
.cell-main { display: flex; align-items: center; gap: 11px; }
.mini-avatar { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-soft); color: var(--muted); font: 10px var(--mono); }
.cell-main strong { display: block; font-size: 12px; font-weight: 580; }
.cell-main small, .subtle { color: var(--faint); font-size: 10px; }
.mono-id { color: var(--faint); font-size: 10px; }
.badge { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 7px; border: 1px solid var(--line); border-radius: 3px; background: var(--surface-soft); color: var(--muted); font-size: 10px; font-weight: 500; }
.badge.green, .badge.red, .badge.amber { border-color: var(--line); background: var(--surface-soft); color: var(--muted); }
.badge.dark { border-color: var(--dark); background: var(--dark); color: #fff; }
.badge + .badge { margin-left: 4px; }
.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 13px; color: var(--faint); font-size: 11px; }

/* Details and projects */
.split { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(330px, .8fr); gap: 18px; }
.detail-hero { display: flex; align-items: center; gap: 15px; padding: 22px; border-bottom: 1px solid var(--line); }
.detail-avatar { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 5px; background: var(--dark); color: #fff; }
.detail-hero h2 { margin: 0 0 3px; font-size: 17px; }
.detail-hero p { margin: 0; color: var(--faint); font: 10px var(--mono); }
.detail-section { padding: 20px 22px; border-bottom: 1px solid var(--line); }
.detail-section:last-child { border-bottom: 0; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.data-list { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.data-item label { display: block; margin-bottom: 5px; color: var(--faint); font-size: 10px; }
.data-item div { overflow-wrap: anywhere; }
.project-list { display: grid; gap: 16px; }
.project { overflow: hidden; }
.project-top { display: grid; grid-template-columns: 1fr auto; gap: 16px; padding: 18px 20px; }
.project-name { display: flex; align-items: center; gap: 13px; }
.project-glyph { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface-soft); color: var(--muted); font: 10px var(--mono); }
.project-name h2 { margin: 0 0 4px; font-size: 14px; font-weight: 600; }
.project-name p { margin: 0; color: var(--faint); font: 10px var(--mono); }
.client-grid { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--line); }
.client { min-height: 120px; padding: 16px; border-right: 1px solid var(--line); cursor: pointer; }
.client:last-child { border-right: 0; }
.client:hover { background: var(--surface-soft); }
.client-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 18px; }
.client strong { font-size: 12px; font-weight: 580; }
.client code { display: block; overflow: hidden; color: var(--faint); font-size: 9px; text-overflow: ellipsis; }
.platform { color: var(--muted); font: 9px var(--mono); letter-spacing: .07em; text-transform: uppercase; }
.empty-client { min-height: 120px; display: grid; place-items: center; border-top: 1px solid var(--line); color: var(--faint); }
.audit-detail { max-width: 310px; color: var(--muted); font-size: 12px; }
.event-code { color: var(--text); font-size: 10px; }

/* Modal and overlays */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(0,0,0,.36); backdrop-filter: blur(2px); }
.modal { width: min(610px, 100%); max-height: calc(100vh - 48px); overflow: auto; border: 1px solid var(--line-strong); border-radius: 9px; background: var(--surface); box-shadow: var(--shadow); }
.modal.wide { width: min(800px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 24px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0 0 4px; font-size: 18px; font-weight: 620; }
.modal-head p { margin: 0; color: var(--muted); font-size: 12px; }
.modal-body { padding: 23px 24px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 16px 24px; border-top: 1px solid var(--line); }
.close { border: 0; background: transparent; color: var(--muted); font-size: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 17px; }
.span-2 { grid-column: span 2; }
.check-row { display: flex; align-items: flex-start; gap: 9px; color: var(--muted); font-size: 12px; }
.check-row input { margin-top: 3px; }
.notice { padding: 12px 14px; border: 1px solid #ede8d8; border-left: 3px solid #d8ceb0; border-radius: 3px; background: var(--warning-bg); color: #756b51; font-size: 12px; }
.secret-box { margin: 17px 0; padding: 15px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface-soft); }
.secret-box label { display: block; margin-bottom: 8px; color: var(--faint); font: 10px var(--mono); }
.secret-row { display: flex; align-items: center; gap: 10px; }
.secret-row code { flex: 1; overflow-wrap: anywhere; color: var(--text); }
.input-row { display: grid; grid-template-columns: 112px 1fr; }
.input-row .select { border-right: 0; }

.toast { position: fixed; right: 24px; top: 24px; z-index: 150; width: min(360px, calc(100vw - 48px)); display: flex; gap: 11px; padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: 2px; background: var(--surface); box-shadow: var(--shadow); animation: toast-in .18s ease-out; }
.toast-mark { color: var(--muted); }
.toast strong { display: block; font-size: 12px; }
.toast span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 980px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .dashboard-grid, .split { grid-template-columns: 1fr; }
  .client-grid { grid-template-columns: 1fr 1fr; }
  .client:nth-child(2) { border-right: 0; }
  .client:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 700px) {
  .header-main { padding: 0 16px; }
  .brand-copy, .system-state, .admin-chip div:not(.avatar), .header-divider { display: none; }
  .workspace-switch { padding: 5px 7px; }
  .nav { padding: 0 10px; }
  .nav-item { padding: 0 10px; }
  .content { width: calc(100% - 32px); padding: 30px 0 55px; }
  .page-head { display: block; }
  .page-actions { margin-top: 18px; }
  .stats { grid-template-columns: 1fr; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat:last-child { border-bottom: 0; }
  .toolbar { flex-wrap: wrap; }
  .search { flex-basis: 100%; }
  .toolbar .select { flex: 1; width: auto; }
  .form-grid, .data-list { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .client-grid { grid-template-columns: 1fr; }
  .client { border-right: 0; border-bottom: 1px solid var(--line); }
  .client:last-child { border-bottom: 0; }
  .project-top { grid-template-columns: 1fr; }
  .project-name p { max-width: 270px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .login-card h2 { font-size: 24px; }
}

/* V3: OpenCode-inspired mono typography and left navigation */
:root {
  --success: #4b7d61;
  --success-strong: #2f7650;
  --disabled: #88774e;
  --disabled-bg: #f8f6ef;
  --sans: "Berkeley Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "PingFang SC", "Microsoft YaHei", monospace;
  --mono: "Berkeley Mono", "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", "PingFang SC", "Microsoft YaHei", monospace;
}

body { font-family: var(--sans); }

.login-logo {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 40px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: var(--dark);
  color: #fff;
  font: 700 18px/1 var(--mono);
  letter-spacing: -.08em;
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: 232px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: rgba(250, 250, 250, .97);
  backdrop-filter: blur(16px);
}

.sidebar-head {
  height: 68px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
}

.sidebar-head .brand-copy { display: block; }
.sidebar-head .brand-copy strong { font-size: 13px; }
.sidebar-head .brand-mark { width: 30px; height: 30px; }

.sidebar .nav {
  height: auto;
  flex: 1;
  display: block;
  padding: 18px 12px;
  overflow: auto;
}

.sidebar .nav-item {
  position: relative;
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 3px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 3px;
  color: var(--muted);
  text-align: left;
}

.sidebar .nav-item:hover { border-color: var(--line); background: var(--surface); color: var(--text); }
.sidebar .nav-item.active { border-color: var(--line); background: var(--surface); color: var(--text); font-weight: 600; }
.sidebar .nav-item.active::after {
  left: 0;
  right: auto;
  top: 8px;
  bottom: 8px;
  width: 2px;
  height: auto;
  background: var(--dark);
}
.nav-icon { width: 17px; color: var(--faint); font: 11px var(--mono); text-align: center; }
.sidebar .nav-count { margin-left: auto; }
.sidebar-meta { display: flex; justify-content: space-between; padding: 14px 17px; border-top: 1px solid var(--line); color: var(--faint); font-size: 9px; }

.main { grid-column: 2; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 250, 250, .96);
  backdrop-filter: blur(16px);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-left strong { font-size: 13px; font-weight: 600; }
.mobile-menu { display: none; }
.content { width: min(1220px, calc(100% - 56px)); }

.system-state i, .dot { background: var(--success); }
.system-state { color: #66736b; }

.badge.green {
  border-color: #bed4c7;
  background: #f3f8f5;
  color: var(--success-strong);
}

.badge.red {
  border-color: #ddd5bd;
  background: var(--disabled-bg);
  color: var(--disabled);
}

.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 38px;
  background-color: var(--surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%236b6b6b' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  cursor: pointer;
}

.select:hover { border-color: #aaa; background-color: #fdfdfd; }
.select:focus { background-color: var(--surface); }
.select:disabled { cursor: not-allowed; background-color: var(--surface-soft); color: var(--faint); }
.select option { background: var(--surface); color: var(--text); }
.input-row .select { border-right: 1px solid var(--line-strong); }

/* Custom select: replaces the OS-rendered option popup while retaining the native value. */
.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.toolbar .custom-select {
  width: 155px;
  flex: 0 0 155px;
}

.custom-select .native-select {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  border: 0 !important;
  white-space: nowrap !important;
}

.select-trigger {
  width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.select-trigger:hover { border-color: #aaa; background: #fdfdfd; }
.custom-select.open .select-trigger,
.select-trigger:focus-visible { border-color: #777; box-shadow: 0 0 0 2px rgba(0,0,0,.08); }
.select-trigger::after {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%236b6b6b' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat;
  transition: transform .14s ease;
}
.custom-select.open .select-trigger::after { transform: rotate(180deg); }

.select-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  z-index: 130;
  display: none;
  padding: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0,0,0,.12);
}
.custom-select.open .select-menu { display: grid; gap: 2px; }

.select-option {
  width: 100%;
  min-height: 36px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.select-option::before { content: ""; width: 18px; color: var(--muted); text-align: center; }
.select-option:hover,
.select-option:focus-visible { outline: 0; background: var(--surface-hover); }
.select-option.selected { background: #f0f0f0; font-weight: 600; }
.select-option.selected::before { content: "✓"; }
.select-option:disabled { color: var(--faint); cursor: not-allowed; }

@media (max-width: 760px) {
  .app-shell { display: block; }
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow); transition: transform .18s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { grid-column: auto; }
  .topbar { height: 60px; padding: 0 16px; }
  .mobile-menu { display: grid; }
  .content { width: calc(100% - 32px); padding-top: 28px; }
  .header-right .system-state { display: none; }
  .toolbar .custom-select { flex: 1; width: auto; }
}

/* V3 refinement: tighter corners */
.input,
.select,
.textarea,
.btn,
.icon-button,
.stats,
.panel,
.detail-card,
.project,
.table-wrap,
.badge,
.notice,
.secret-box,
.sidebar .nav-item {
  border-radius: 2px;
}

.modal { border-radius: 2px; }

/* V6 themes: V5 warm grid by default, with V3 clean as an alternative. */
html[data-theme="warm-grid"] {
  --bg: #f7f6f1;
  --surface: #fffefb;
  --surface-soft: #f5f3ee;
  --surface-hover: #f1efe9;
  --grid-line: rgba(69, 62, 51, .035);
}

html[data-theme="warm-grid"] body {
  background:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
}

html[data-theme="warm-grid"] .sidebar,
html[data-theme="warm-grid"] .topbar {
  background: rgba(247, 246, 241, .96);
}

html[data-theme="clean"] body {
  background: var(--bg);
}

.theme-toggle {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.theme-toggle:hover {
  border-color: var(--line-strong);
  background: var(--surface-hover);
  color: var(--text);
}

.theme-icon {
  width: 14px;
  color: var(--text);
  font: 12px/1 var(--mono);
  text-align: center;
}

.login-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
}

@media (max-width: 700px) {
  .header-right .theme-toggle span:last-child { display: none; }
  .header-right .theme-toggle { width: 32px; justify-content: center; padding: 5px; }
}

/* V7 sidebar wordmark */
.sidebar-head {
  height: 68px;
  flex: 0 0 68px;
  justify-content: center;
  padding: 0 20px;
}

.sidebar-wordmark {
  display: block;
  width: 156px;
  max-width: 100%;
  height: auto;
}

.login-wordmark {
  display: block;
  width: min(344px, 92%);
  height: auto;
  margin: 0 auto 76px;
}

/* 正式管理后台补充状态；主体视觉保持与已确认原型一致。 */
.loading,.empty-state{padding:72px 24px;text-align:center;color:var(--muted)}
.empty-state strong{display:block;color:var(--text);margin-bottom:8px}
.empty-inline{padding:28px;text-align:center;color:var(--faint)}
.form-error{margin:0 0 16px;padding:10px 12px;border:1px solid #dbc6c6;border-radius:2px;background:#fbf5f5;color:var(--danger);font-size:12px}
.detail-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:22px;padding-top:18px;border-top:1px solid var(--line)}
.secret-box code{display:block;overflow-wrap:anywhere}
#toast-root{position:relative;z-index:150}
.confirm-backdrop{z-index:140}
.pagination-controls{display:flex;align-items:center;gap:8px}
.pagination-controls .btn:disabled{opacity:.4;cursor:not-allowed}
.pagination-arrow{display:grid;place-items:center;width:34px;height:32px;padding:0;font-size:16px;color:var(--text)}
.pagination-current{display:grid;place-items:center;min-width:76px;height:32px;padding:0 12px;color:var(--text);font:12px var(--mono)}
.project-pagination{padding:12px 16px;border-top:1px solid var(--line);margin-top:0}
@media(max-width:760px){.sidebar{z-index:60}.modal-backdrop{padding:12px}.modal{max-height:calc(100vh - 24px)}}
