:root {
  --bg-page: #fafafa;
  --bg-card: #fff;
  --bg-hover: #f5f5f5;
  --bg-input: #fff;
  --bg-code: #f0f0f0;
  --bg-pill: #f0f0f0;
  --bg-pill-hover: #e0e0e0;
  --bg-visibility: #f8f8f8;
  --text-primary: #111;
  --text-body: #333;
  --text-secondary: #666;
  --text-muted: #888;
  --text-faint: #aaa;
  --color-link: #0066cc;
  --color-error: #e53e3e;
  --color-success: #38a169;
  --bg-error: #fff5f5;
  --bg-success: #f0fff4;
  --border-light: #eee;
  --border-medium: #ddd;
  --border-focus: #999;
  --btn-github-bg: #24292e;
  --btn-github-hover: #1b1f23;
  --btn-google-bg: #fff;
  --btn-google-hover: #f8f8f8;
  --btn-google-text: #333;
  --pill-active-bg: #111;
  --pill-active-text: #fff;
  --pill-active-hover: #333;
}

[data-theme="dark"] {
  --bg-page: #1a1a1a;
  --bg-card: #232323;
  --bg-hover: #2d2d2d;
  --bg-input: #2a2a2a;
  --bg-code: #2d2d2d;
  --bg-pill: #333;
  --bg-pill-hover: #444;
  --bg-visibility: #2a2a2a;
  --text-primary: #e8e8e8;
  --text-body: #d4d4d4;
  --text-secondary: #9a9a9a;
  --text-muted: #787878;
  --text-faint: #606060;
  --color-link: #7cacf8;
  --color-error: #f87171;
  --color-success: #68d391;
  --bg-error: #3b1c1c;
  --bg-success: #1c3b2a;
  --border-light: #333;
  --border-medium: #3a3a3a;
  --border-focus: #666;
  --btn-github-bg: #3a3f44;
  --btn-github-hover: #4a4f54;
  --btn-google-bg: #2a2a2a;
  --btn-google-hover: #333;
  --btn-google-text: #d4d4d4;
  --pill-active-bg: #e8e8e8;
  --pill-active-text: #1a1a1a;
  --pill-active-hover: #d4d4d4;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: var(--text-body);
  background: var(--bg-page);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-light);
}

.nav-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
}

.nav-user {
  color: var(--text-secondary);
  text-decoration: none;
}

.nav-user:hover {
  color: var(--text-primary);
}

.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
  width: 100%;
}

.profile {
  margin-bottom: 2rem;
}

.profile h1 {
  font-size: 1.5rem;
  color: var(--text-primary);
}

.profile-count {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

.note-list {
  list-style: none;
}

.note-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-light);
}

.note-item-title {
  color: var(--text-primary);
  text-decoration: none;
  font-size: 1.05rem;
}

.note-item-title:hover {
  color: var(--color-link);
}

.note-item-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.note-item-date {
  color: var(--text-faint);
  font-size: 0.85rem;
  white-space: nowrap;
}

.btn-delete-sm {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.15rem 0.4rem;
  font-family: inherit;
  border-radius: 3px;
  transition: color 0.15s;
}

.btn-delete-sm:hover {
  color: var(--color-error);
}

.delete-form-inline {
  display: inline;
  margin-left: auto;
}

.note-header {
  margin-bottom: 2rem;
}

.note-header h1 {
  font-size: 2rem;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.note-date {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.markdown-body {
  line-height: 1.8;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  color: var(--text-primary);
}

.markdown-body h1 { font-size: 1.6rem; }
.markdown-body h2 { font-size: 1.35rem; }
.markdown-body h3 { font-size: 1.15rem; }

.markdown-body p {
  margin-bottom: 1em;
}

.markdown-body a {
  color: var(--color-link);
}

.markdown-body code {
  background: var(--bg-code);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
}

.markdown-body pre {
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  margin-bottom: 1em;
}

.markdown-body pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.markdown-body blockquote {
  border-left: 3px solid var(--border-medium);
  padding-left: 1rem;
  color: var(--text-secondary);
  margin-bottom: 1em;
}

.markdown-body ul,
.markdown-body ol {
  padding-left: 1.5em;
  margin-bottom: 1em;
}

.markdown-body img {
  max-width: 100%;
  border-radius: 6px;
}

.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1em;
}

.markdown-body th,
.markdown-body td {
  border: 1px solid var(--border-medium);
  padding: 0.5rem 0.75rem;
  text-align: left;
}

.markdown-body th {
  background: var(--bg-hover);
  font-weight: 600;
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border-light);
  margin: 2em 0;
}

.footer {
  text-align: center;
  padding: 2rem;
  color: var(--text-faint);
  font-size: 0.85rem;
}

.footer a {
  color: var(--text-muted);
}

/* Nav right section */
.nav-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-link:hover {
  color: var(--text-primary);
}

.nav-logout-form {
  display: inline;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  font-family: inherit;
}

.btn-link:hover {
  color: var(--text-primary);
}

/* Login page */
.login-card {
  max-width: 400px;
  margin: 4rem auto;
  text-align: center;
}

.login-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.login-error {
  color: var(--color-error);
  background: var(--bg-error);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.login-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  border: 1px solid var(--border-medium);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-github {
  background: var(--btn-github-bg);
  color: #fff;
  border-color: var(--btn-github-bg);
}

.btn-github:hover {
  background: var(--btn-github-hover);
}

.btn-google {
  background: var(--btn-google-bg);
  color: var(--btn-google-text);
  border-color: var(--border-medium);
}

.btn-google:hover {
  background: var(--btn-google-hover);
  border-color: var(--border-medium);
}

.btn-danger {
  color: var(--color-error);
  border-color: var(--color-error);
  background: var(--bg-card);
}

.btn-danger:hover {
  background: var(--bg-error);
}

/* Settings page */
.settings-section {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-light);
}

.settings-section:first-of-type {
  border-top: none;
}

.settings-section h2 {
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.settings-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.settings-message {
  color: var(--color-success);
  background: var(--bg-success);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin-top: 1rem;
  font-size: 0.9rem;
}

.token-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-hover);
  padding: 0.75rem 1rem;
  border-radius: 6px;
  overflow-x: auto;
}

.token-box code {
  font-size: 0.9rem;
  word-break: break-all;
  flex: 1;
}

.token-regen {
  margin-top: 0.75rem;
}

.settings-info {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.5rem 1rem;
}

.settings-info dt {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.settings-info dd {
  color: var(--text-body);
  font-size: 0.9rem;
}

/* Password form */
.password-form {
  margin-top: 1rem;
}

.password-label {
  display: block;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.password-input-row {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.password-input {
  flex: 1;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg-input);
  color: var(--text-body);
}

.password-input:focus {
  border-color: var(--border-focus);
}

.password-btn {
  white-space: nowrap;
}

.note-lock {
  font-size: 0.8em;
  margin-left: 0.3em;
}

/* Settings toggle button */
.btn-settings-toggle {
  margin-bottom: 0.75rem;
  background: var(--bg-card);
  color: var(--text-secondary);
}

.btn-settings-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Visibility bar (owner only) */
.visibility-bar {
  margin-bottom: 1.5rem;
  padding: 0.6rem 1rem;
  background: var(--bg-visibility);
  border: 1px solid var(--border-light);
  border-radius: 6px;
}

.visibility-form {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.visibility-option {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
}

.visibility-option input[type="radio"] {
  margin: 0;
}

.visibility-pwd {
  display: inline-flex;
  align-items: center;
}

.password-input-sm {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  width: 150px;
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  outline: none;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-body);
}

.password-input-sm:focus {
  border-color: var(--border-focus);
}

/* Category bar */
.cat-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.cat-pill {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-pill);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.cat-pill:hover {
  background: var(--bg-pill-hover);
  color: var(--text-primary);
}

.cat-pill-active {
  background: var(--pill-active-bg);
  color: var(--pill-active-text);
}

.cat-pill-active:hover {
  background: var(--pill-active-hover);
  color: var(--pill-active-text);
}

/* Note category tag */
.note-cat {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-pill);
  text-decoration: none;
  margin-left: 0.4rem;
  vertical-align: middle;
}

a.note-cat:hover {
  background: var(--bg-pill-hover);
  color: var(--text-secondary);
}

.note-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Category input in settings */
.category-input {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
  width: 120px;
  border: 1px solid var(--border-medium);
  border-radius: 4px;
  outline: none;
  font-family: inherit;
  background: var(--bg-input);
  color: var(--text-body);
}

.category-input:focus {
  border-color: var(--border-focus);
}

/* Search bar */
.search-bar {
  display: flex;
  margin-bottom: 1rem;
}

.search-input {
  flex: 1;
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg-input);
  color: var(--text-body);
}

.search-input:focus {
  border-color: var(--border-focus);
}

.search-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
}

.search-clear {
  color: var(--color-link);
  margin-left: 0.5rem;
  font-size: 0.85rem;
  text-decoration: none;
}

.search-clear:hover {
  text-decoration: underline;
}

/* Edit form */
.edit-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.edit-title-input {
  width: 100%;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  font-size: 1.25rem;
  font-weight: 600;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg-input);
  color: var(--text-primary);
}

.edit-title-input:focus {
  border-color: var(--border-focus);
}

.edit-content-textarea {
  width: 100%;
  min-height: 420px;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--border-medium);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  line-height: 1.6;
  outline: none;
  resize: vertical;
  transition: border-color 0.15s;
  background: var(--bg-input);
  color: var(--text-body);
}

.edit-content-textarea:focus {
  border-color: var(--border-focus);
}

.edit-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.edit-cancel {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.9rem;
}

.edit-cancel:hover {
  color: var(--text-primary);
}

/* Profile tabs */
.profile-tabs {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.profile-tab {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  background: var(--bg-pill);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.profile-tab:hover {
  background: var(--bg-pill-hover);
  color: var(--text-primary);
}

.profile-tab-active {
  background: var(--pill-active-bg);
  color: var(--pill-active-text);
}

.profile-tab-active:hover {
  background: var(--pill-active-hover);
  color: var(--pill-active-text);
}

/* Project layout */
.project-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
  flex: 1;
  width: 100%;
}

.project-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.project-name {
  font-size: 1.35rem;
  color: var(--text-primary);
}

.project-back {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
}

.project-back:hover {
  color: var(--color-link);
}

.project-layout {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
  min-height: 500px;
}

/* File tree sidebar */
.file-tree {
  width: 260px;
  min-width: 200px;
  border-right: 1px solid var(--border-light);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0.5rem 0;
  background: var(--bg-page);
  flex-shrink: 0;
  transition: width 0.2s, min-width 0.2s, padding 0.2s;
}

.tree-folder-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
  user-select: none;
}

.tree-folder-label:hover {
  background: var(--bg-hover);
}

.tree-icon {
  font-size: 0.7rem;
  width: 1rem;
  text-align: center;
  flex-shrink: 0;
}

.tree-icon-folder {
  color: var(--text-muted);
}

.tree-icon-file {
  font-size: 0.8rem;
  color: var(--text-faint);
}

.tree-file {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.85rem;
  color: var(--text-body);
  text-decoration: none;
  cursor: pointer;
}

.tree-file:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.tree-file-active {
  background: var(--bg-hover);
  color: var(--color-link);
  font-weight: 500;
}

/* Tree toggle button */
.tree-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  border: none;
  background: var(--bg-page);
  color: var(--text-faint);
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0;
  flex-shrink: 0;
  border-right: 1px solid var(--border-light);
  transition: color 0.15s, background 0.15s;
}

.tree-toggle:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* Collapsed state */
.project-layout.tree-collapsed .file-tree {
  width: 0;
  min-width: 0;
  padding: 0;
  border-right: none;
  overflow: hidden;
}

/* File viewer */
.file-viewer {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.file-viewer-path {
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-page);
  border-bottom: 1px solid var(--border-light);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.file-viewer-content {
  flex: 1;
  overflow: auto;
  padding: 1rem;
}

.file-viewer-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-faint);
  font-size: 0.95rem;
}

.file-viewer-content .markdown-body {
  max-width: 720px;
}

/* Code viewer */
.code-view pre {
  margin: 0;
  background: #1e1e1e;
  color: #d4d4d4;
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
}

.code-view pre code {
  background: none;
  padding: 0;
  color: inherit;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* Responsive: mobile */
@media (max-width: 767px) {
  .project-layout {
    flex-direction: column;
  }

  .file-tree {
    width: 100%;
    min-width: 0;
    max-height: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-light);
    overflow: hidden;
    transition: max-height 0.2s;
    padding: 0;
  }

  .file-tree-show {
    max-height: 50vh;
    overflow-y: auto;
    padding: 0.5rem 0;
  }

  .tree-toggle {
    display: none;
  }

  .project-container {
    padding: 1rem;
  }
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 2rem;
  padding: 1rem 0;
}

.page-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.5rem;
  border-radius: 6px;
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.page-num:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.page-active {
  background: var(--pill-active-bg);
  color: var(--pill-active-text);
  font-weight: 600;
}

.page-active:hover {
  background: var(--pill-active-hover);
  color: var(--pill-active-text);
}

.page-ellipsis {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.page-prev,
.page-next {
  display: inline-flex;
  align-items: center;
  height: 2rem;
  padding: 0 0.6rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.page-prev:hover,
.page-next:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.page-prev {
  margin-right: 0.25rem;
}

.page-next {
  margin-left: 0.25rem;
}

/* Back to top button */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--border-medium);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, background 0.15s, color 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  z-index: 100;
}

.back-to-top-show {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Access log table */
.log-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.log-table th {
  text-align: left;
  padding: 0.5rem 0.6rem;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  border-bottom: 2px solid var(--border-light);
  white-space: nowrap;
}

.log-table td {
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}

.log-row:hover {
  background: var(--bg-hover);
}

.log-cell-time {
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 0.8rem;
}

.log-cell-ip {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.8rem;
}

.log-cell-location {
  color: var(--text-muted);
  font-size: 0.78rem;
}

.log-cell-isp {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.log-badge {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.log-badge-success {
  background: var(--bg-success);
  color: var(--color-success);
}

.log-badge-fail {
  background: var(--bg-error);
  color: var(--color-error);
}

.btn-expand {
  background: none;
  border: none;
  color: var(--color-link);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.15rem 0.3rem;
  font-family: inherit;
  white-space: nowrap;
}

.btn-expand:hover {
  text-decoration: underline;
}

.log-detail-row td {
  padding: 0;
  background: var(--bg-hover);
}

.log-detail {
  padding: 0.75rem 1rem;
}

.log-detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.3rem 1rem;
  font-size: 0.82rem;
}

.log-detail-grid dt {
  color: var(--text-muted);
  white-space: nowrap;
}

.log-detail-grid dd {
  color: var(--text-body);
  word-break: break-all;
}

.log-detail-ua {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.78rem;
}

@media (max-width: 767px) {
  .log-table {
    font-size: 0.78rem;
  }

  .log-table th,
  .log-table td {
    padding: 0.4rem;
  }

  .log-cell-isp {
    max-width: 80px;
  }
}

/* Theme toggle */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.25rem;
  line-height: 1;
  color: var(--text-secondary);
}