:root {
  color-scheme: light;
  --background: #f7f7f8;
  --foreground: #18181b;
  --card: #ffffff;
  --card-foreground: #18181b;
  --muted: #f4f4f5;
  --muted-foreground: #71717a;
  --subtle-foreground: #a1a1aa;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --input: #dedee3;
  --primary: #18181b;
  --primary-foreground: #fafafa;
  --accent: #f4f4f5;
  --accent-foreground: #18181b;
  --success: #16825d;
  --success-muted: #e8f5ef;
  --destructive: #dc2626;
  --destructive-muted: #fef2f2;
  --sidebar: #fafafa;
  --selection: #eeeeef;
  --code: #fafafa;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 12px 34px rgba(24, 24, 27, 0.07);
  --radius: 11px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #09090b;
  --foreground: #fafafa;
  --card: #111113;
  --card-foreground: #fafafa;
  --muted: #1c1c1f;
  --muted-foreground: #a1a1aa;
  --subtle-foreground: #71717a;
  --border: #29292d;
  --border-strong: #3f3f46;
  --input: #3f3f46;
  --primary: #fafafa;
  --primary-foreground: #18181b;
  --accent: #232326;
  --accent-foreground: #fafafa;
  --success: #4adea3;
  --success-muted: #102b22;
  --destructive: #f87171;
  --destructive-muted: #351416;
  --sidebar: #0e0e10;
  --selection: #202023;
  --code: #0c0c0e;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 18px 44px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

html,
body { min-width: 320px; min-height: 100%; }

body {
  margin: 0;
  color: var(--foreground);
  background: var(--background);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }

button,
input { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
pre:focus-visible {
  outline: 2px solid var(--foreground);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.brand-symbol {
  position: relative;
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--primary-foreground);
  background: var(--primary);
  box-shadow: var(--shadow-sm);
}

.brand-symbol > span {
  position: relative;
  width: 17px;
  height: 13px;
  border: 1.7px solid currentColor;
  border-radius: 3px;
}

.brand-symbol > span::before {
  position: absolute;
  top: -5px;
  left: 2px;
  width: 11px;
  height: 2px;
  border: 1.7px solid currentColor;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  content: "";
}

.brand-symbol-large { width: 48px; height: 48px; border-radius: 14px; }
.brand-symbol-inverse { color: #fafafa; background: #18181b; border-color: #27272a; }

.ghost-icon,
.logout-button,
.copy-button {
  display: inline-grid;
  place-items: center;
  border: 1px solid transparent;
  color: var(--muted-foreground);
  background: transparent;
  cursor: pointer;
}

.ghost-icon {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  font-size: 17px;
}

.ghost-icon:hover,
.logout-button:hover { color: var(--foreground); background: var(--accent); }

.boot-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  color: var(--muted-foreground);
  background: var(--background);
}

.boot-screen .brand-symbol { animation: boot-pulse 1.4s ease-in-out infinite; }
.boot-label { font-size: 12px; }

@keyframes boot-pulse {
  50% { opacity: 0.56; transform: scale(0.96); }
}

/* Login */
.login-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  overflow: hidden;
  background:
    radial-gradient(circle at center, transparent 0 26%, var(--background) 72%),
    radial-gradient(var(--border) 0.75px, transparent 0.75px);
  background-size: auto, 20px 20px;
}

.login-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--foreground);
  text-decoration: none;
  font-weight: 670;
  letter-spacing: -0.015em;
}

.login-main {
  display: grid;
  place-items: center;
  padding: 48px 24px 80px;
}

.login-card {
  width: min(100%, 400px);
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(12px);
  animation: enter 320ms ease-out both;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(8px); }
}

.login-icon {
  position: relative;
  width: 44px;
  height: 44px;
  margin-bottom: 22px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--muted);
}

.login-icon::before {
  position: absolute;
  top: 11px;
  left: 14px;
  width: 14px;
  height: 16px;
  border: 1.8px solid var(--foreground);
  border-radius: 4px;
  content: "";
}

.login-icon::after {
  position: absolute;
  top: 7px;
  left: 17px;
  width: 8px;
  height: 8px;
  border: 1.8px solid var(--foreground);
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
  content: "";
}

.lock-dot {
  position: absolute;
  top: 27px;
  left: 20px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--foreground);
}

.login-heading { margin-bottom: 26px; }
.login-heading h1 {
  margin: 0 0 8px;
  font-size: 25px;
  line-height: 1.2;
  letter-spacing: -0.035em;
}

.login-heading p {
  margin: 0;
  color: var(--muted-foreground);
  line-height: 1.6;
}

.login-form { display: grid; gap: 17px; }

.field { display: grid; gap: 7px; }
.field > span { font-size: 12px; font-weight: 590; }
.field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--input);
  border-radius: 9px;
  color: var(--foreground);
  background: var(--background);
  box-shadow: var(--shadow-sm);
  outline: 0;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.field input::placeholder { color: var(--subtle-foreground); }
.field input:focus { border-color: var(--foreground); box-shadow: 0 0 0 3px color-mix(in srgb, var(--foreground) 10%, transparent); }

.primary-button,
.outline-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 9px;
  cursor: pointer;
  text-decoration: none;
  font-size: 12px;
  font-weight: 630;
  transition: opacity 140ms ease, background 140ms ease, transform 80ms ease;
}

.primary-button {
  border: 1px solid var(--primary);
  color: var(--primary-foreground);
  background: var(--primary);
  box-shadow: var(--shadow-sm);
}

.primary-button:hover { opacity: 0.88; }
.primary-button:active,
.outline-button:active { transform: translateY(1px); }

.outline-button {
  border: 1px solid var(--border);
  color: var(--foreground);
  background: var(--card);
  box-shadow: var(--shadow-sm);
}

.outline-button:hover { background: var(--accent); }
.outline-button:disabled,
.primary-button:disabled { opacity: 0.55; cursor: wait; }
.login-button { width: 100%; height: 43px; margin-top: 2px; }

.button-spinner {
  display: none;
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--primary-foreground) 35%, transparent);
  border-top-color: var(--primary-foreground);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.login-button.loading .button-label { display: none; }
.login-button.loading .button-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

.form-error {
  margin: -5px 0 0;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--destructive) 25%, transparent);
  border-radius: 8px;
  color: var(--destructive);
  background: var(--destructive-muted);
  font-size: 11px;
  line-height: 1.5;
}

.security-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted-foreground);
  font-size: 10px;
  line-height: 1.55;
}

.security-dot,
.status-indicator,
.code-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-muted);
}

.security-dot { margin-top: 4px; }
.login-footer { padding: 20px; color: var(--subtle-foreground); text-align: center; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }

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

.directory-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-right: 1px solid var(--border);
  background: var(--sidebar);
}

.directory-sidebar-header { padding: 17px 14px 14px; border-bottom: 1px solid var(--border); }
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 3px; color: var(--foreground); text-decoration: none; }
.sidebar-brand-copy { display: grid; gap: 1px; }
.sidebar-brand-copy strong { font-size: 12px; letter-spacing: -0.015em; }
.sidebar-brand-copy small { color: var(--muted-foreground); font-size: 8px; }

.repo-source { display: flex; min-width: 0; align-items: center; gap: 8px; margin-top: 15px; padding: 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--card); box-shadow: var(--shadow-sm); }
.repo-source .status-indicator { width: 6px; height: 6px; box-shadow: none; }
.repo-source-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.repo-source-copy small { color: var(--success); font-size: 7px; font-weight: 700; letter-spacing: 0.1em; }
.repo-source.error .repo-source-copy small,
.connection-state.error { color: var(--destructive); }
.repo-source.error .status-indicator,
.connection-state.error .status-indicator { background: var(--destructive); box-shadow: 0 0 0 3px var(--destructive-muted); }
.repo-source-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 530 8px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.readonly-badge { flex: 0 0 auto; padding: 2px 5px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted-foreground); background: var(--muted); font-size: 8px; letter-spacing: 0.06em; }

.directory-section { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); padding: 17px 9px 10px; }
.directory-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 0 7px 10px; }
.directory-heading h2 { margin: 0; font-size: 12px; letter-spacing: -0.015em; }
.tree-meta { padding: 3px 5px; border-radius: 5px; color: var(--muted-foreground); background: var(--muted); font-size: 7px; }
.directory-tree { min-height: 0; overflow: auto; padding: 2px 0 16px; scrollbar-width: thin; }
.tree-empty { padding: 14px 8px; color: var(--muted-foreground); font-size: 9px; line-height: 1.6; text-align: center; }
.tree-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: center; min-height: 33px; padding-left: calc(var(--depth, 0) * 13px); border-radius: 7px; }
.tree-row:hover { background: var(--accent); }
.tree-row[data-current="true"] { background: var(--selection); }
.tree-toggle { position: relative; width: 22px; height: 30px; border: 0; border-radius: 6px; color: var(--muted-foreground); background: transparent; cursor: pointer; }
.tree-toggle::before { position: absolute; top: 11px; left: 7px; width: 6px; height: 6px; border-right: 1.4px solid currentColor; border-bottom: 1.4px solid currentColor; transform: rotate(-45deg); transition: transform 120ms ease; content: ""; }
.tree-toggle[data-expanded="true"]::before { transform: rotate(45deg) translate(-1px, -1px); }
.tree-toggle[data-leaf="true"] { visibility: hidden; }
.tree-toggle.loading::after { position: absolute; inset: 8px; border: 1.5px solid var(--border); border-top-color: var(--foreground); border-radius: 50%; animation: spin 700ms linear infinite; content: ""; }
.tree-toggle.loading::before { display: none; }
.tree-link { display: flex; min-width: 0; height: 30px; align-items: center; gap: 8px; padding: 0 7px 0 1px; border: 0; color: var(--muted-foreground); background: transparent; cursor: pointer; text-align: left; }
.tree-row[data-current="true"] .tree-link { color: var(--foreground); font-weight: 630; }
.tree-folder-icon { position: relative; width: 14px; height: 10px; flex: 0 0 auto; border: 1.3px solid currentColor; border-radius: 2px; }
.tree-folder-icon::before { position: absolute; top: -4px; left: 1px; width: 7px; height: 4px; border: 1.3px solid currentColor; border-bottom: 0; border-radius: 2px 2px 0 0; content: ""; }
.tree-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }

.sidebar-user { display: flex; align-items: center; gap: 8px; margin: 10px; padding: 9px; border: 1px solid var(--border); border-radius: 9px; background: var(--card); box-shadow: var(--shadow-sm); }
.topbar-user { display: flex; min-width: 0; flex: 1; align-items: center; gap: 8px; }

.user-avatar {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: var(--primary-foreground);
  background: var(--primary);
  font-size: 9px;
  font-weight: 700;
}

.user-copy { display: grid; min-width: 0; flex: 1; gap: 2px; }
.user-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.user-copy small { color: var(--muted-foreground); font-size: 9px; }
.logout-button { width: 28px; height: 28px; border-radius: 7px; font-size: 14px; }

.sidebar-backdrop { display: none; }
.app-main { min-width: 0; }
.app-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--background) 88%, transparent);
  backdrop-filter: blur(14px);
}

.topbar-context { display: flex; min-width: 0; align-items: center; gap: 9px; }
.context-label { color: var(--muted-foreground); font-size: 9px; }
.topbar-context strong { max-width: min(50vw, 620px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 570 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.directory-toggle { display: none; position: relative; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 8px; color: var(--foreground); background: var(--card); cursor: pointer; }
.directory-toggle span,
.directory-toggle::before,
.directory-toggle::after { position: absolute; left: 9px; width: 14px; height: 1.5px; border-radius: 1px; background: currentColor; content: ""; }
.directory-toggle span { top: 16px; }
.directory-toggle::before { top: 11px; }
.directory-toggle::after { top: 21px; }
.connection-state { display: inline-flex; align-items: center; gap: 7px; color: var(--muted-foreground); font-size: 9px; }
.connection-state .status-indicator { width: 6px; height: 6px; box-shadow: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.page-content { width: min(1450px, 100%); margin: 0 auto; padding: 27px 26px 32px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.title-line { display: flex; align-items: center; gap: 10px; }
.page-heading h1 { margin: 0; font-size: 23px; line-height: 1.3; letter-spacing: -0.035em; }
.page-heading p { max-width: 720px; margin: 6px 0 0; overflow: hidden; color: var(--muted-foreground); text-overflow: ellipsis; white-space: nowrap; font: 10px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.outline-badge { padding: 3px 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted-foreground); background: var(--card); font-size: 8px; font-weight: 700; letter-spacing: 0.08em; }
.page-actions { display: flex; align-items: center; gap: 9px; }

.workspace-grid { display: grid; grid-template-columns: minmax(490px, 1.06fr) minmax(380px, 0.94fr); gap: 16px; align-items: stretch; }
.browser-panel,
.preview-panel { min-width: 0; min-height: calc(100vh - 154px); overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow-sm); }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 17px 18px; border-bottom: 1px solid var(--border); }
.panel-header h2 { margin: 0; font-size: 13px; line-height: 1.3; letter-spacing: -0.015em; }
.browser-header { min-height: 70px; }
.count-badge { flex: 0 0 auto; padding: 3px 7px; border-radius: 6px; color: var(--muted-foreground); background: var(--muted); font-size: 9px; font-weight: 620; }

.breadcrumbs { display: flex; align-items: center; gap: 3px; max-width: min(56vw, 570px); margin-top: 6px; overflow-x: auto; scrollbar-width: none; }
.breadcrumbs::-webkit-scrollbar { display: none; }
.breadcrumb-button { flex: 0 0 auto; padding: 0; border: 0; color: var(--muted-foreground); background: transparent; cursor: pointer; font: 9px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.breadcrumb-button:hover { color: var(--foreground); }
.breadcrumb-button:last-child { color: var(--foreground); }
.breadcrumb-separator { color: var(--subtle-foreground); font-size: 9px; }

.file-toolbar { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.search-box { position: relative; display: flex; height: 36px; align-items: center; gap: 8px; padding: 0 9px; border: 1px solid var(--border); border-radius: 8px; color: var(--muted-foreground); background: var(--background); transition: border-color 140ms ease, box-shadow 140ms ease; }
.search-box:focus-within { border-color: var(--border-strong); box-shadow: 0 0 0 3px color-mix(in srgb, var(--foreground) 7%, transparent); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--foreground); background: transparent; font-size: 11px; }
.search-box input::placeholder { color: var(--subtle-foreground); }
.search-box kbd { display: grid; min-width: 19px; height: 19px; place-items: center; border: 1px solid var(--border); border-bottom-color: var(--border-strong); border-radius: 5px; color: var(--subtle-foreground); background: var(--card); font: 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; box-shadow: 0 1px 0 var(--border); }
.search-icon { position: relative; width: 13px; height: 13px; flex: 0 0 auto; border: 1.5px solid currentColor; border-radius: 50%; }
.search-icon::after { position: absolute; right: -3px; bottom: -2px; width: 5px; height: 1.5px; border-radius: 1px; background: currentColor; transform: rotate(45deg); content: ""; }

.list-header,
.file-row { display: grid; grid-template-columns: minmax(0, 1fr) 36px; align-items: center; }
.list-header { grid-template-columns: minmax(190px, 1.7fr) 70px minmax(108px, 0.8fr) 54px 36px; gap: 10px; min-height: 33px; padding: 0 12px; border-bottom: 1px solid var(--border); color: var(--subtle-foreground); font-size: 8px; font-weight: 690; letter-spacing: 0.08em; text-transform: uppercase; }
.file-list { min-height: 300px; }
.file-row { min-height: 49px; padding: 0 7px 0 0; border-bottom: 1px solid var(--border); transition: background 100ms ease; }
.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--accent); }
.file-row[data-selected="true"] { background: var(--selection); box-shadow: inset 2px 0 0 var(--foreground); }
.file-open { display: grid; grid-template-columns: minmax(190px, 1.7fr) 70px minmax(108px, 0.8fr) 54px; align-items: center; gap: 10px; min-width: 0; height: 100%; padding: 7px 5px 7px 12px; border: 0; color: inherit; background: transparent; text-align: left; cursor: pointer; }
.file-name-cell { display: flex; min-width: 0; align-items: center; gap: 10px; }
.type-icon { position: relative; display: grid; width: 30px; height: 30px; flex: 0 0 auto; place-items: center; border: 1px solid var(--border); border-radius: 7px; color: var(--muted-foreground); background: var(--muted); font-size: 7px; font-weight: 740; letter-spacing: 0.02em; }
.type-icon.folder { color: transparent; background: var(--card); }
.type-icon.folder::before { position: absolute; top: 9px; left: 7px; width: 15px; height: 11px; border: 1.4px solid var(--muted-foreground); border-radius: 2px; content: ""; }
.type-icon.folder::after { position: absolute; top: 7px; left: 8px; width: 8px; height: 4px; border: 1.4px solid var(--muted-foreground); border-bottom: 0; border-radius: 2px 2px 0 0; content: ""; }
.file-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 10px; font-weight: 590; }
.cell-muted { overflow: hidden; color: var(--muted-foreground); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.row-download { display: grid; width: 29px; height: 29px; place-items: center; justify-self: end; border-radius: 7px; color: var(--muted-foreground); text-decoration: none; font-size: 13px; font-weight: 650; }
.row-download:hover { color: var(--foreground); background: var(--card); box-shadow: 0 0 0 1px var(--border); }

.empty-list,
.error-list,
.loading-list { display: grid; min-height: 300px; place-items: center; padding: 30px; color: var(--muted-foreground); text-align: center; font-size: 10px; }
.error-list { color: var(--destructive); }
.loading-stack { width: min(100%, 520px); display: grid; gap: 8px; }
.loading-line { height: 40px; border-radius: 7px; background: var(--muted); animation: skeleton-pulse 1.35s ease-in-out infinite; }
.loading-line:nth-child(2n) { animation-delay: 120ms; }
@keyframes skeleton-pulse { 50% { opacity: 0.46; } }

/* Preview */
.preview-panel { display: flex; }
.preview-empty { max-width: 320px; margin: auto; padding: 40px 28px; text-align: center; }
.empty-file { position: relative; display: grid; width: 60px; height: 70px; place-items: center; margin: 0 auto 24px; border: 1px solid var(--border-strong); border-radius: 9px 9px 14px 9px; color: var(--muted-foreground); background: var(--muted); box-shadow: 8px 8px 0 var(--accent); }
.empty-file::after { position: absolute; top: -1px; right: -1px; width: 16px; height: 16px; border-bottom: 1px solid var(--border-strong); border-left: 1px solid var(--border-strong); border-radius: 0 8px 0 5px; background: var(--card); content: ""; }
.empty-file span { font: 700 9px/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 0.08em; }
.preview-empty h2 { margin: 0 0 8px; font-size: 15px; letter-spacing: -0.02em; }
.preview-empty p { margin: 0; color: var(--muted-foreground); font-size: 10px; line-height: 1.7; }
.preview-hint { display: inline-block; margin-top: 17px; padding: 4px 7px; border: 1px solid var(--border); border-radius: 6px; color: var(--subtle-foreground); background: var(--background); font: 8px/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.preview-content { width: 100%; min-width: 0; }
.preview-heading { min-height: 70px; align-items: center; }
.file-identity { display: flex; min-width: 0; align-items: center; gap: 10px; }
.selected-file-icon { display: grid; width: 34px; height: 39px; flex: 0 0 auto; place-items: center; border: 1px solid var(--border); border-radius: 6px 6px 9px 6px; color: var(--muted-foreground); background: var(--muted); font-size: 7px; font-weight: 740; }
.section-kicker { margin: 0 0 4px; color: var(--subtle-foreground); font-size: 7px; font-weight: 730; letter-spacing: 0.12em; }
.file-identity h2 { max-width: min(28vw, 300px); margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.download-button { min-height: 32px; padding: 0 11px; font-size: 10px; }
.file-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; border-bottom: 1px solid var(--border); }
.meta-item { min-width: 0; padding: 11px 13px; border-right: 1px solid var(--border); }
.meta-item:last-child { border-right: 0; }
.meta-item dt { margin-bottom: 4px; color: var(--subtle-foreground); font-size: 7px; font-weight: 680; letter-spacing: 0.08em; }
.meta-item dd { margin: 0; overflow: hidden; color: var(--foreground); text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.code-frame { margin: 14px; overflow: hidden; border: 1px solid var(--border); border-radius: 9px; background: var(--code); }
.code-toolbar { height: 36px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 10px 0 12px; border-bottom: 1px solid var(--border); color: var(--muted-foreground); background: var(--muted); font-size: 8px; font-weight: 610; }
.code-toolbar > span { display: inline-flex; align-items: center; gap: 7px; }
.code-dot { width: 6px; height: 6px; box-shadow: none; }
.copy-button { min-height: 25px; padding: 0 7px; border-radius: 6px; font-size: 8px; }
.copy-button:hover { color: var(--foreground); background: var(--card); box-shadow: 0 0 0 1px var(--border); }
.preview-status { display: grid; min-height: 360px; place-items: center; padding: 34px; color: var(--muted-foreground); text-align: center; font-size: 10px; line-height: 1.65; }
.text-preview { min-height: 360px; max-height: calc(100vh - 330px); margin: 0; padding: 16px; overflow: auto; border: 0; outline: 0; color: var(--card-foreground); background: var(--code); font: 10px/1.7 "SFMono-Regular", Consolas, "Liberation Mono", monospace; tab-size: 4; white-space: pre; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 20; max-width: min(360px, calc(100vw - 40px)); padding: 11px 14px; border: 1px solid var(--border); border-radius: 9px; color: var(--card-foreground); background: var(--card); box-shadow: var(--shadow-md); font-size: 10px; animation: toast-in 180ms ease-out both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

@media (max-width: 1100px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .browser-panel,
  .preview-panel { min-height: 520px; }
  .file-identity h2 { max-width: 52vw; }
  .text-preview { max-height: 600px; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .directory-sidebar { position: fixed; left: 0; z-index: 20; width: min(304px, 86vw); transform: translateX(-101%); box-shadow: var(--shadow-md); transition: transform 180ms ease; }
  .directory-sidebar.open { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 15; display: block; border: 0; background: rgba(0, 0, 0, 0.38); backdrop-filter: blur(2px); }
  .directory-toggle { display: inline-block; }
  .app-topbar { height: 58px; padding: 0 12px; }
  .context-label { display: none; }
  .topbar-context strong { max-width: 48vw; }
  .page-content { padding: 22px 12px; }
  .page-heading { align-items: center; }
  .page-heading h1 { font-size: 20px; }
  .page-heading p { max-width: 60vw; }
  .outline-button span:last-child { display: none; }
  .outline-button { width: 38px; padding: 0; }
  .browser-panel,
  .preview-panel { min-height: 460px; }
  .list-header { display: none; }
  .file-row { grid-template-columns: minmax(0, 1fr) 34px; padding-right: 7px; }
  .file-open { grid-template-columns: minmax(0, 1fr); padding-left: 10px; }
  .file-open .cell-muted { display: none; }
  .file-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .meta-item:nth-child(2) { border-right: 0; }
  .meta-item:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
  .file-identity h2 { max-width: 40vw; }
}

@media (max-width: 480px) {
  .login-topbar { padding: 16px; }
  .login-main { padding: 24px 14px 60px; }
  .login-card { padding: 26px 22px; }
  .connection-state { display: none; }
  .topbar-context strong { max-width: 55vw; }
  .page-heading p { max-width: 76vw; }
  .title-line { gap: 7px; }
  .breadcrumbs { max-width: 72vw; }
  .preview-heading { align-items: flex-start; }
  .file-identity h2 { max-width: 42vw; }
  .download-button { min-width: 34px; padding: 0; }
  .download-button span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
