/* Chinise Git: shared desktop controls and server portal. */
:root {
  --bg: #17191c; --surface: #1d2024; --surface-2: #24282e;
  --surface-3: #2b3037; --border: #343941; --border-2: #454c56;
  --text: #e2e5e9; --text-dim: #b1b7c0; --text-mute: #8d96a3;
  --ac: #81afe2; --ac-soft: #233346; --ac-line: #435d7b; --ac-ink: #fff;
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-disp: var(--font-ui); --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { font: 14px/1.5 var(--font-ui); -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: var(--text); }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--ac); outline-offset: 3px; }
::selection { background: #355e86; color: #fff; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; line-height: 1.3; font-weight: 600; letter-spacing: -.02em; }
h2 { font-size: 17px; line-height: 1.4; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
small { font-size: 12px; color: var(--text-mute); }
.mono, .hash { font-family: var(--font-mono); }
.muted { color: var(--text-dim); }
.dim { color: var(--text-mute); }
.eyebrow { font-size: 12px; color: var(--text-mute); }
.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.stack { display: grid; gap: 14px; }
.grow { flex: 1; min-width: 0; }
.btn { color: var(--text); display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 6px 11px; min-height: 32px; background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 4px; font-size: 13px; line-height: 18px; white-space: nowrap; }
.btn:hover { background: #343b45; border-color: #647080; }
.btn.primary { background: #346a9f; border-color: #4d7eae; color: #fff; font-weight: 500; }
.btn.primary:hover { background: #3c78b1; border-color: #6596c6; }
.btn.ghost { background: transparent; border-color: var(--border); }
.btn.ghost:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn.danger { color: #f1a3a3; border-color: #754646; }
.btn.square { padding: 7px; }
a.btn { text-decoration: none; }
.badge { display: inline-flex; gap: 5px; align-items: center; border: 1px solid var(--border); border-radius: 3px; padding: 2px 7px; font-size: 11px; line-height: 20px; white-space: nowrap; color: var(--text-dim); }
.badge.blue { color: #a8c9ed; background: var(--ac-soft); border-color: var(--ac-line); }
.badge.green { color: #9ac4a2; border-color: #415b47; }
.badge.red { color: #f1a3a3; border-color: #754646; }
.panel { border: 1px solid var(--border); border-radius: 4px; background: var(--surface); min-width: 0; }
.panel-head { padding: 11px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.panel-head h2 { font-size: 13px; font-weight: 600; }
.panel-body { padding: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 13px; color: var(--text-dim); }
.input, select, textarea { background: #15171a; border: 1px solid var(--border-2); border-radius: 4px; padding: 8px 10px; outline: none; width: 100%; font-size: 13px; }
.input:focus, textarea:focus, select:focus { border-color: var(--ac); box-shadow: 0 0 0 1px var(--ac); }
textarea { resize: vertical; min-height: 82px; }
input[type=checkbox] { accent-color: #5791c9; width: 15px; height: 15px; margin: 0; }
.check { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.shell { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 224px; background: #1b1e22; border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 19px 12px 14px; z-index: 10; overflow-y: auto; }
.brand { display: flex; gap: 9px; align-items: center; padding: 0 9px 21px; }
.brand-mark { display: inline-flex; align-items: center; color: var(--ac); }
.brand-mark .icon { width: 23px; height: 23px; }
.brand-word { font-size: 17px; line-height: 1.3; font-weight: 600; letter-spacing: -.02em; }
.brand-sub { font-size: 11px; color: var(--text-mute); margin-top: 4px; }
.nav-label { display: flex; justify-content: space-between; align-items: center; padding: 17px 9px 8px; font-size: 11px; color: var(--text-mute); }
.repo-count { font-variant-numeric: tabular-nums; }
.repo-button { background: transparent; border: 1px solid transparent; border-radius: 4px; display: flex; align-items: center; text-align: left; gap: 9px; width: 100%; padding: 8px; color: var(--text-dim); font-size: 13px; overflow: hidden; }
.repo-button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.repo-button:hover { background: var(--surface-2); }
.repo-button.active { background: #2c3642; color: var(--text); }
.sidebar-footer { margin-top: auto; border-top: 1px solid var(--border); padding-top: 14px; }
.sidebar-footer .badge { border: 0; background: none; color: #99bda1; padding: 0 4px 4px; font-size: 11px; }
.sidebar-footer .btn { width: 100%; margin-top: 8px; justify-content: flex-start; font-size: 12px; }
.privacy-note { font-size: 12px; color: var(--text-mute); margin-top: 8px; }
.main { grid-column: 2; min-width: 0; }
.topbar { height: 52px; border-bottom: 1px solid var(--border); padding: 0 24px; display: flex; align-items: center; justify-content: space-between; background: var(--bg); gap: 12px; }
.topbar-title { font-size: 12px; color: var(--text-mute); }
.workspace { padding: 24px; max-width: 1600px; margin: auto; }
.title-row { margin-bottom: 18px; }
.title-row .eyebrow { margin-bottom: 6px; }
.path { font: 12px/1.5 var(--font-mono); color: var(--text-mute); margin-top: 6px; overflow-wrap: anywhere; }
.toolbar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin: 14px 0 18px; }
.tabs { display: flex; border-bottom: 1px solid var(--border); gap: 24px; margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 10px 0; background: transparent; color: var(--text-mute); border: 0; border-bottom: 2px solid transparent; font-size: 13px; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--ac); }
.changes-grid { display: grid; grid-template-columns: minmax(280px, 31%) minmax(0, 1fr); gap: 14px; }
.file-list { max-height: 380px; overflow: auto; }
.file { display: flex; gap: 8px; align-items: center; padding: 9px 12px; border-bottom: 1px solid var(--border); font: 12px var(--font-mono); cursor: pointer; }
.file:hover, .file.active { background: var(--surface-2); }
.file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-code { color: var(--ac); min-width: 20px; }
.file.conflict .file-code { color: #f1a3a3; }
.diff-header { padding: 10px 14px; display: flex; gap: 10px; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.diff-header .mono { font-size: 12px; overflow-wrap: anywhere; }
.diff { margin: 0; padding: 14px; max-height: 650px; overflow: auto; background: #191c20; font: 12px/1.7 var(--font-mono); tab-size: 4; white-space: pre; }
.diff-line { display: block; min-height: 1.7em; }
.diff-line.add { color: #a1cbaa; background: #23432d66; }
.diff-line.del { color: #e8a4a4; background: #512b2b66; }
.diff-line.chunk { color: var(--ac); padding: 6px 0; }
.empty { padding: 36px 20px; text-align: center; display: grid; justify-items: center; gap: 10px; color: var(--text-mute); }
.empty .icon { width: 25px; height: 25px; color: var(--text-mute); margin-bottom: 2px; }
.empty h2 { color: var(--text); font-size: 16px; }
.empty p { max-width: 440px; font-size: 13px; }
.empty .row { justify-content: center; }
.commit-box { padding: 14px; border-top: 1px solid var(--border); }
.commit-box textarea { margin-top: 10px; }
.commit-box .btn { width: 100%; margin-top: 10px; }
.commit-box .row .btn { width: auto; margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.history-list { max-height: 660px; overflow: auto; }
.commit-row { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; text-align: left; display: flex; gap: 12px; padding: 12px 14px; align-items: flex-start; position: relative; }
.commit-row:hover, .commit-row.active { background: var(--surface-2); }
.graph-node { width: 10px; height: 10px; border: 2px solid #93a9c0; border-radius: 50%; margin-top: 4px; flex: none; background: var(--surface); z-index: 1; }
.commit-row:before { content: ''; position: absolute; top: 22px; bottom: -19px; left: 18px; width: 1px; background: #4c5967; }
.commit-subject { font-size: 13px; margin-bottom: 4px; overflow-wrap: anywhere; }
.commit-meta { font-size: 11px; color: var(--text-mute); }
.hash { color: var(--ac); font-size: 11px; }
.decorations { margin-top: 5px; font-size: 11px; color: var(--text-dim); }
.branch-row { padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--border); }
.branch-name { font: 12px var(--font-mono); overflow-wrap: anywhere; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.stat { border-bottom: 1px solid var(--border); padding: 14px 0; }
.stat .number { font-size: 25px; font-variant-numeric: tabular-nums; margin: 6px 0 3px; }
.meter { height: 4px; background: var(--surface-3); margin: 14px 0 8px; }
.meter-fill { height: 100%; background: #6b98c3; width: 0; }
.security-card { display: flex; gap: 12px; padding: 14px 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; margin-bottom: 18px; }
.security-card > .icon { color: var(--text-mute); height: 20px; width: 20px; }
.security-card h2 { font-size: 14px; }
.security-card p { font-size: 13px; color: var(--text-dim); margin-top: 5px; }
.workspace-note { display: flex; align-items: flex-start; gap: 8px; max-width: 620px; margin-top: 18px; font-size: 12px; color: var(--text-mute); }
.workspace-note .icon { margin-top: 2px; }
.kv { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); padding: 10px 0; font-size: 13px; }
.kv span:last-child { font-family: var(--font-mono); overflow-wrap: anywhere; text-align: right; }
.job { display: flex; align-items: center; gap: 8px; font-size: 12px; padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.spinner { width: 12px; height: 12px; border: 2px solid var(--border-2); border-top-color: var(--ac); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin-card { width: min(440px, 100%); padding: 28px; border: 1px solid var(--border); border-radius: 5px; background: var(--surface); }
.signin-card .brand { padding: 0 0 25px; }
.signin-card h1 { font-size: 22px; margin-bottom: 10px; }
.signin-card p { font-size: 13px; color: var(--text-dim); margin-bottom: 20px; }
.signin-card .btn { width: 100%; margin-top: 14px; }
.signin-card .field + .field { margin-top: 14px; }
.signin-card small { display: block; margin-top: 16px; }
.error-text { font-size: 13px; color: #f1a3a3; margin-top: 10px; }
.modal-overlay { position: fixed; inset: 0; background: #0009; display: grid; place-items: center; z-index: 30; padding: 20px; }
.modal { background: var(--surface); border: 1px solid var(--border-2); border-radius: 5px; width: min(600px, 100%); max-height: 90vh; overflow: auto; }
.modal-title { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title h2 { font-size: 16px; }
.modal-body { padding: 20px; display: grid; gap: 16px; }
.modal-footer { padding: 13px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.notice { padding: 12px; font-size: 13px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; color: var(--text-dim); }
.editor { font: 13px/1.7 var(--font-mono); min-height: 420px; white-space: pre; }
.boot { height: 100vh; display: grid; place-content: center; gap: 10px; font-size: 16px; color: var(--text); }
.boot span { font-size: 12px; color: var(--text-mute); }
#toast { position: fixed; right: 20px; bottom: 20px; z-index: 50; max-width: 560px; }
.toast { background: var(--surface-3); border: 1px solid var(--border-2); border-radius: 4px; padding: 12px 16px; font-size: 13px; box-shadow: 0 4px 16px #0005; overflow-wrap: anywhere; }
.toast.error { border-color: #a15f5f; }
.menu-toggle { display: none; }
.search { max-width: 380px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--border); }
th { font-size: 12px; font-weight: 500; color: var(--text-mute); }
.link { color: var(--ac); text-decoration: none; }
.link:hover { text-decoration: underline; }
.footer-line { display: flex; justify-content: space-between; gap: 20px; margin-top: 24px; border-top: 1px solid var(--border); padding-top: 12px; font-size: 11px; color: var(--text-mute); }
.security-notice { margin: 18px 0; padding: 14px; border: 1px solid #755d35; border-radius: 4px; background: #30291f; color: #e4c38f; line-height: 1.5; }
.security-notice p { margin: 8px 0 0; font-size: 13px; }
.signin-card:has(.security-notice) { max-width: 600px; }
.folder-input { display: flex; gap: 8px; align-items: center; }
.folder-input .input { min-width: 0; flex: 1; }
.folder-input .btn { flex: none; }
.selection-note { display: block; padding: 0 14px 10px; color: var(--text-mute); font-size: 11px; }
.workflow { flex-wrap: wrap; align-items: center; }
.workflow > .grow { flex: 1 1 300px; min-width: 0; }
.workflow > .row { flex: 1 1 260px; }
.file:focus-visible, .btn:focus-visible, .tab:focus-visible, .repo-button:focus-visible, .command-item:focus-visible { outline: 2px solid var(--ac); outline-offset: -2px; }
.command-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; padding: 11px 12px; border: 1px solid transparent; border-radius: 3px; background: transparent; text-align: left; font-size: 13px; }
.command-item small { color: var(--text-mute); text-align: right; }
.command-item.active, .command-item:hover { background: var(--surface-3); }
#command-list { max-height: 45vh; overflow: auto; }
.folder-input + .error-text { margin-top: 8px; }
.topbar [data-action=accounts] { max-width: 180px; overflow: hidden; text-overflow: ellipsis; }

/* Public server page: downloads and account entry. */
.server-home .site-header { border-bottom: 1px solid var(--border); }
.site-header-inner { max-width: 1040px; padding: 0 28px; margin: auto; display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 24px; }
.site-header .brand { padding: 0; text-decoration: none; color: var(--text); }
.site-nav { display: flex; align-items: center; gap: 24px; font-size: 13px; }
.site-nav a { color: var(--text-dim); text-decoration: none; }
.site-nav a:hover { color: var(--text); }
.site-main { max-width: 1040px; margin: auto; padding: 40px 28px 28px; }
.site-intro { padding-bottom: 30px; }
.site-intro .eyebrow { font: 12px var(--font-mono); margin-bottom: 12px; }
.site-intro h1 { font-size: 32px; margin-bottom: 12px; }
.site-intro p { color: var(--text-dim); max-width: 660px; font-size: 15px; line-height: 1.6; }
.portal-columns { display: grid; grid-template-columns: 1.12fr 1fr; gap: 44px; }
.portal-section { border-top: 1px solid var(--border-2); padding-top: 18px; min-width: 0; }
.portal-section h2 { margin-bottom: 8px; }
.portal-section > p { color: var(--text-dim); font-size: 13px; margin-bottom: 18px; }
.download-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.download-row h3 { margin-bottom: 3px; }
.download-row p { color: var(--text-mute); font-size: 12px; }
.download-notes { margin-top: 13px; color: var(--text-mute); font-size: 12px; line-height: 1.6; }
.account-entry { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.account-links { list-style: none; padding: 0; margin: 0; }
.account-links li { border-bottom: 1px solid var(--border); }
.account-links a { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; color: var(--text-dim); text-decoration: none; font-size: 13px; }
.account-links a:hover { color: var(--ac); }
.site-guide { display: grid; grid-template-columns: 1.12fr 1fr; gap: 44px; border-top: 1px solid var(--border); margin-top: 32px; padding-top: 22px; }
.site-guide h2 { font-size: 14px; margin-bottom: 10px; }
.setup-steps { padding-left: 19px; margin: 0; font-size: 13px; color: var(--text-dim); }
.setup-steps li { padding-left: 5px; margin-bottom: 8px; }
.storage-note p { color: var(--text-dim); font-size: 13px; line-height: 1.6; margin-bottom: 8px; }
.site-files { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--border); }
.site-files h2 { font-size: 13px; color: var(--text-mute); font-weight: 500; margin-bottom: 10px; }
.site-files nav { display: flex; gap: 10px 22px; flex-wrap: wrap; font-size: 12px; }
.site-footer { display: flex; justify-content: space-between; gap: 12px; margin-top: 28px; font-size: 11px; color: var(--text-mute); }

@media (min-width: 1800px) { .workspace { padding: 28px 32px; } .diff { max-height: 740px; } }
@media (max-width: 1100px) {
  .changes-grid, .split { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 205px minmax(0, 1fr); }
  .sidebar { width: 205px; }
  .workspace { padding: 20px; }
  .topbar { padding: 0 20px; }
  .diff { max-height: 480px; }
}
@media (max-width: 720px) {
  .shell { display: block; }
  .sidebar { transform: translateX(-100%); transition: transform .15s; width: 250px; box-shadow: 8px 0 24px #0006; }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle { display: inline-flex; }
  .topbar { height: 52px; padding: 0 14px; }
  .topbar-title { display: none; }
  .topbar > .row { gap: 6px; min-width: 0; }
  .workspace { padding: 20px 14px; }
  .title-row { align-items: flex-start; }
  .title-row h1 { font-size: 22px; }
  .stats-grid { grid-template-columns: 1fr; }
  .toolbar .btn { flex: 1; }
  .tabs { gap: 20px; }
  .security-card { padding: 14px; }
  .footer-line { gap: 12px; }
  .branch-row { flex-wrap: wrap; }
  .signin { padding: 16px; }
  .signin-card { padding: 24px; }
  .changes-grid { gap: 14px; }
  .modal-overlay { padding: 12px; }
  .modal-body { padding: 16px; }
  .folder-input { flex-wrap: wrap; }
  .folder-input .input { flex-basis: 100%; }
  .folder-input .btn { width: 100%; }
  .workflow > .row { flex-basis: 100%; }
  .command-item { flex-wrap: wrap; gap: 3px; }
  .command-item small { text-align: left; }
  .diff-header { flex-wrap: wrap; }
  #toast { left: 12px; right: 12px; bottom: 12px; }
  .site-header-inner { padding: 0 20px; min-height: 58px; gap: 16px; }
  .site-nav { gap: 16px; }
  .site-main { padding: 28px 20px 24px; }
  .site-intro { padding-bottom: 24px; }
  .site-intro h1 { font-size: 28px; }
  .portal-columns, .site-guide { grid-template-columns: 1fr; gap: 26px; }
  .site-guide { margin-top: 26px; }
  .site-files nav { gap: 12px 18px; }
  .site-footer { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .topbar [data-action=commands] { font-size: 0; padding: 7px; width: 32px; height: 32px; }
  .topbar [data-action=accounts] { max-width: 195px; }
  .site-nav a[href="#files"] { display: none; }
  .download-row { gap: 8px; }
  .download-row .btn { padding: 6px 9px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
