/* ============================================================
   Tools World — Design System
   ============================================================ */

/* ── Tokens ────────────────────────────────────────────────── */
:root {
  --bg:            #f8fafc;
  --surface:       #ffffff;
  --surface-2:     #f8fafc;
  --border:        #e2e8f0;
  --border-light:  #f1f5f9;

  --primary:       #6366f1;
  --primary-dark:  #4f46e5;
  --primary-light: #eef2ff;
  --primary-ring:  rgba(99, 102, 241, 0.25);

  --text:          #0f172a;
  --text-2:        #475569;
  --text-3:        #94a3b8;

  --green:         #10b981;
  --green-bg:      #d1fae5;
  --green-text:    #065f46;
  --red:           #ef4444;
  --red-bg:        #fee2e2;
  --red-text:      #991b1b;
  --yellow:        #f59e0b;
  --yellow-bg:     #fef3c7;
  --yellow-text:   #92400e;
  --blue:          #3b82f6;
  --blue-bg:       #dbeafe;
  --blue-text:     #1e40af;

  --sidebar-w:     240px;
  --topbar-h:      60px;
  --radius-sm:     6px;
  --radius:        8px;
  --radius-lg:     12px;
  --radius-xl:     16px;
  --shadow-sm:     0 1px 2px rgba(0,0,0,.05);
  --shadow:        0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,.06), 0 2px 4px -1px rgba(0,0,0,.04);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.07), 0 4px 6px -2px rgba(0,0,0,.04);
  --t:             150ms ease;
}

/* ── Dark mode ──────────────────────────────────────────────────── */
[data-theme="dark"] {
  --bg:            #0f172a;
  --surface:       #1e293b;
  --surface-2:     #162032;
  --border:        #2d3f55;
  --border-light:  #243347;

  --primary-light: #1e2a4a;
  --primary-ring:  rgba(99, 102, 241, 0.35);

  --text:          #f1f5f9;
  --text-2:        #94a3b8;
  --text-3:        #4f6a8a;

  --green-bg:      #052e16;
  --green-text:    #4ade80;
  --red-bg:        #2d0a0a;
  --red-text:      #f87171;
  --yellow-bg:     #2d1f00;
  --yellow-text:   #fbbf24;
  --blue-bg:       #0c1a3a;
  --blue-text:     #60a5fa;

  --shadow-sm:     0 1px 2px rgba(0,0,0,.3);
  --shadow:        0 1px 3px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
  --shadow-md:     0 4px 6px -1px rgba(0,0,0,.4), 0 2px 4px -1px rgba(0,0,0,.3);
  --shadow-lg:     0 10px 15px -3px rgba(0,0,0,.5), 0 4px 6px -2px rgba(0,0,0,.3);
}

[data-theme="dark"] .highlight-github { display: none; }
[data-theme="dark"] .highlight-github-dark { display: block !important; }

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

[data-theme="dark"] .login-card,
[data-theme="dark"] .modal {
  background: var(--surface);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, textarea, select { font-family: inherit; }
img { max-width: 100%; }

/* ── Layout ─────────────────────────────────────────────────── */
#app {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  transition: transform var(--t), width var(--t);
  z-index: 100;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}
.sidebar-logo span {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.3px;
}

.sidebar-nav { padding: 8px 8px 24px; flex: 1; }

.nav-section { margin-bottom: 4px; }
.nav-section + .nav-section { margin-top: 8px; }

.nav-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-3);
  padding: 8px 10px 4px;
}
.nav-label-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  border-radius: 6px;
  padding-right: 8px;
  transition: color 120ms;
}
.nav-label-toggle:hover { color: var(--text-2); }
.nav-chevron {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform 220ms ease;
}
.nav-section.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-section-items {
  overflow: hidden;
  max-height: 600px;
  transition: max-height 220ms ease, opacity 200ms ease;
  opacity: 1;
}
.nav-section.collapsed .nav-section-items {
  max-height: 0;
  opacity: 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: background var(--t), color var(--t);
  white-space: nowrap;
  overflow: hidden;
}
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active .nav-icon { color: var(--primary); }
.nav-icon { width: 17px; height: 17px; flex-shrink: 0; color: var(--text-3); transition: color var(--t); }
.nav-item:hover .nav-icon { color: var(--text); }

/* ── Main Area ────────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: auto;
  min-width: 0;
}

#topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  flex-shrink: 0;
}

#page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

#content {
  flex: 1;
  padding: 28px;
}

/* ── Footer ──────────────────────────────────────────────── */
#site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 32px 28px;
  margin-top: auto;
  flex-shrink: 0;
}
.footer-inner {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.footer-tagline {
  font-size: 13px;
  color: var(--text-3);
  max-width: 480px;
  line-height: 1.6;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  justify-content: center;
}
.footer-links a {
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  transition: color 120ms;
}
.footer-links a:hover { color: var(--primary); }
.footer-copy {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 4px;
}

/* ── Policy pages ────────────────────────────────────────── */
.policy-page {
  max-width: 720px;
  margin: 0 auto;
}
.policy-page h1 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
}
.policy-page .policy-meta {
  font-size: 12.5px;
  color: var(--text-3);
  margin-bottom: 28px;
}
.policy-page h2 {
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 8px;
  color: var(--text);
}
.policy-page p, .policy-page li {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.75;
}
.policy-page ul {
  padding-left: 20px;
  margin: 8px 0;
}
.policy-page a { color: var(--primary); text-decoration: none; }
.policy-page a:hover { text-decoration: underline; }

/* ── Cards ───────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.card-subtitle {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 2px;
}

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  transition: background var(--t), color var(--t), transform 80ms ease, box-shadow var(--t);
  line-height: 1;
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border-light); color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger {
  background: var(--red-bg);
  color: var(--red-text);
}
.btn-danger:hover { background: #fecaca; }

.btn-sm { padding: 5px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 22px; font-size: 14.5px; }
.btn-icon { padding: 8px; border-radius: var(--radius); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.icon-btn {
  background: none;
  border: none;
  padding: 6px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  display: inline-flex;
  align-items: center;
  transition: background var(--t), color var(--t);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── Form Controls ───────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

label, .label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 6px;
}

.input, input[type="text"], input[type="url"], input[type="number"],
input[type="email"], input[type="password"], textarea, select {
  width: 100%;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13.5px;
  color: var(--text);
  outline: none;
  transition: border-color var(--t), box-shadow var(--t);
  line-height: 1.5;
}
.input:focus, input[type="text"]:focus, input[type="url"]:focus,
input[type="number"]:focus, input[type="email"]:focus,
input[type="password"]:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-ring);
}
textarea { resize: vertical; min-height: 120px; font-family: inherit; }
select { cursor: pointer; }
.input-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.input-row .input, .input-row input { flex: 1; }

/* ── Tables ──────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
thead { background: var(--surface-2); }
th {
  text-align: left;
  padding: 11px 14px;
  font-weight: 600;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-2);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

.table-url {
  max-width: 250px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

/* ── Badges ──────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
}
.badge-green  { background: var(--green-bg);  color: var(--green-text); }
.badge-red    { background: var(--red-bg);    color: var(--red-text); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow-text); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue-text); }
.badge-gray   { background: var(--surface-2); color: var(--text-2); }

.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-green  { background: var(--green); }
.dot-red    { background: var(--red); }
.dot-yellow { background: var(--yellow); }
.dot-gray   { background: var(--text-3); }

/* ── Custom Dialog ───────────────────────────────────────── */
#dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dialog-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  animation: dialog-in 140ms ease;
}
@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to   { opacity: 1; transform: scale(1)    translateY(0); }
}
.dialog-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.dialog-message {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.6;
  margin-bottom: 20px;
}
.dialog-input-wrap { margin-bottom: 12px; }
.dialog-input-wrap .input { width: 100%; }
.dialog-error {
  font-size: 12.5px;
  color: var(--red, #ef4444);
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.25);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 16px;
  line-height: 1.5;
}
.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── Success overlay ─────────────────────────────────────── */
#success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 9100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.success-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 36px 32px;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: dialog-in 180ms ease;
}
.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.success-icon.icon-success { background: rgba(34,197,94,.12); color: #22c55e; }
.success-icon.icon-info    { background: rgba(99,102,241,.12); color: #6366f1; }
.success-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 10px;
}
.success-body {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.65;
}

/* ── Toast ───────────────────────────────────────────────── */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  background: var(--text);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 200ms ease;
  max-width: 320px;
}
.toast.success { background: #064e3b; border-left: 3px solid var(--green); }
.toast.error   { background: #7f1d1d; border-left: 3px solid var(--red); }
.toast.info    { background: #1e3a5f; border-left: 3px solid var(--blue); }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Dashboard ───────────────────────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12.5px; color: var(--text-3); font-weight: 500; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub   { font-size: 12px; color: var(--text-3); margin-top: 4px; }

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 20px 16px;
  cursor: pointer;
  transition: box-shadow var(--t), border-color var(--t), transform 100ms ease;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.tool-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
  transform: translateY(-2px);
}
.tool-card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 10px;
  flex-shrink: 0;
}
.tool-card-icon svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}
.tool-card-name { font-size: 13px; font-weight: 600; color: var(--text); }
.tool-card-desc { font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

/* ── Code / Mono ─────────────────────────────────────────── */
.mono, code, pre {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'Courier New', monospace;
  font-size: 13px;
}
.code-block {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: auto;
}
.code-block pre { padding: 16px; margin: 0; white-space: pre-wrap; word-break: break-all; }

.output-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13.5px;
  word-break: break-all;
  color: var(--text);
}

/* ── Result Row (URL shortener, paste link) ────────────────── */
.result-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-light);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-lg);
  padding: 12px 16px;
  margin-top: 16px;
}
.result-url {
  flex: 1;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result-url a { color: var(--primary); }
.result-url a:hover { text-decoration: underline; }

/* ── File Drop Zone ──────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 48px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
  background: var(--surface-2);
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}
.drop-zone p { font-size: 14px; color: var(--text-2); margin-top: 8px; }
.drop-zone small { font-size: 12px; color: var(--text-3); }

/* ── Password Strength ───────────────────────────────────── */
.strength-bar {
  height: 4px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
  margin-top: 8px;
}
.strength-fill {
  height: 100%;
  border-radius: 4px;
  transition: width .3s ease, background .3s ease;
}

/* ── Markdown Split Editor ───────────────────────────────── */
.md-editor {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  height: 520px;
}
.md-editor textarea {
  border: none;
  border-right: 1px solid var(--border);
  border-radius: 0;
  height: 100%;
  resize: none;
  padding: 16px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  background: var(--surface);
  box-shadow: none;
}
.md-editor textarea:focus { box-shadow: none; border-color: var(--border); }
.md-preview {
  padding: 16px;
  overflow-y: auto;
  background: var(--surface);
  font-size: 13.5px;
  line-height: 1.7;
}
.md-preview h1, .md-preview h2, .md-preview h3 { margin: .8em 0 .4em; font-weight: 700; }
.md-preview p  { margin-bottom: .6em; }
.md-preview code { background: var(--surface-2); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.md-preview pre  { background: var(--surface-2); padding: 12px; border-radius: var(--radius); margin: .6em 0; overflow: auto; }
.md-preview ul, .md-preview ol { padding-left: 20px; margin-bottom: .6em; }
.md-preview a { color: var(--primary); text-decoration: underline; }
.md-preview blockquote { border-left: 3px solid var(--border); padding-left: 12px; color: var(--text-2); }
.md-toolbar {
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  background: var(--surface-2);
  padding: 8px 12px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

/* ── Notes Layout ────────────────────────────────────────── */
.notes-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  height: 580px;
}
.notes-list {
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface-2);
}
.notes-list-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
}
.note-item {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-light);
  cursor: pointer;
  transition: background var(--t);
}
.note-item:hover { background: var(--surface); }
.note-item.active { background: var(--primary-light); border-left: 3px solid var(--primary); }
.note-item-title { font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 2px; }
.note-item-date  { font-size: 11.5px; color: var(--text-3); }
.note-editor { display: flex; flex-direction: column; background: var(--surface); }
.note-editor-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.note-editor-header input {
  flex: 1;
  border: none;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  outline: none;
  box-shadow: none;
  padding: 0;
}
.note-editor textarea {
  flex: 1;
  border: none;
  border-radius: 0;
  resize: none;
  padding: 16px;
  height: 100%;
  box-shadow: none;
  font-size: 13.5px;
  line-height: 1.7;
}
.note-editor textarea:focus { box-shadow: none; border-color: transparent; }
.note-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-3);
  gap: 8px;
}

/* ── IP Lookup Card Grid ─────────────────────────────────── */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 20px;
}
.info-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.info-item-label { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.info-item-value { font-size: 14px; font-weight: 600; color: var(--text); }

/* ── Converter ───────────────────────────────────────────── */
.converter-box {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
}
.converter-arrow {
  padding-bottom: 10px;
  color: var(--text-3);
  font-size: 18px;
  text-align: center;
}
.converter-result {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary);
  padding: 20px;
  background: var(--primary-light);
  border-radius: var(--radius-xl);
  text-align: center;
  margin-top: 20px;
}

/* ── Loading spinner ─────────────────────────────────────── */
.spinner {
  width: 24px; height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px;
  color: var(--text-3);
  font-size: 13.5px;
}

/* ── Uptime chart dots ───────────────────────────────────── */
.uptime-dots {
  display: flex;
  gap: 2px;
  align-items: center;
}
.uptime-dot {
  width: 8px;
  height: 28px;
  border-radius: 3px;
  background: var(--green);
  flex-shrink: 0;
}
.uptime-dot.down    { background: var(--red); }
.uptime-dot.unknown { background: var(--border); }

/* ── Utility helpers ─────────────────────────────────────── */
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }
.mt-24  { margin-top: 24px; }
.mb-16  { margin-bottom: 16px; }
.mb-20  { margin-bottom: 20px; }
.gap-8  { gap: 8px; }
.flex   { display: flex; }
.flex-1 { flex: 1; }
.items-center   { align-items: center; }
.justify-between { justify-content: space-between; }
.text-sm   { font-size: 12.5px; }
.text-muted { color: var(--text-3); }
.text-secondary { color: var(--text-2); }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-3);
}
.empty-state p { font-size: 13.5px; margin-top: 8px; }

.section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 12px;
}

/* Divider */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* JSON formatter panels */
.json-panels {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.json-panel label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .5px;
  display: block;
  margin-bottom: 6px;
}
.json-panel textarea {
  height: 440px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  resize: none;
}

/* hljs override */
.hljs { background: transparent !important; padding: 0 !important; }

/* ── Login Modal ─────────────────────────────────────────── */
#login-screen {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#login-screen.visible { display: flex; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  justify-content: center;
}
.login-logo span {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}
.login-tabs {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 24px;
}
.login-tab {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t), color var(--t);
}
.login-tab.active {
  background: var(--primary);
  color: #fff;
}
.login-error {
  background: var(--red-bg);
  color: var(--red-text);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.login-error.visible { display: block; }

/* ── Topbar user pill ────────────────────────────────────── */
.user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
}

/* ── User dropdown menu ──────────────────────────────────── */
.user-menu-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}
.user-pill-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  color: var(--text);
  font-family: inherit;
  transition: background 140ms;
}
.user-pill-btn:hover { background: var(--surface-2); }
.user-chevron { color: var(--text-3); transition: transform 200ms; flex-shrink: 0; }
.user-menu-wrap.open .user-chevron { transform: rotate(180deg); }
.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 228px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  padding: 6px;
  animation: dropdown-in 130ms ease;
}
@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}
.user-menu-wrap.open .user-dropdown { display: block; }
.user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 10px;
}
.user-avatar-lg {
  width: 38px !important;
  height: 38px !important;
  font-size: 16px !important;
  flex-shrink: 0;
}
.user-dropdown-uname {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.user-dropdown-since {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
}
.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--text);
  text-align: left;
  transition: background 120ms;
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item svg { color: var(--text-3); flex-shrink: 0; }
.dropdown-item-danger { color: var(--red); }
.dropdown-item-danger svg { color: var(--red); }
.dropdown-item-danger:hover { background: #fee2e2; }
[data-theme="dark"] .dropdown-item-danger:hover { background: rgba(239,68,68,0.12); }

/* ── Vault ───────────────────────────────────────────────── */
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.vault-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--t), border-color var(--t);
}
.vault-card:hover { box-shadow: var(--shadow-md); border-color: var(--primary); }
.vault-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.vault-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.vault-url {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.vault-username {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.vault-pass-row {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 10px;
}
.vault-pass-val {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text);
  letter-spacing: .05em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.vault-actions {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}

/* ── Vault modal ─────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: 28px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 16px; font-weight: 700; }

/* ── Sidebar collapsed (desktop) ─────────────────────────── */
#app.sidebar-collapsed #sidebar {
  width: 0;
  border-right: none;
  overflow: hidden;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
    z-index: 200;
  }
  #sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  #content { padding: 16px; }
  .md-editor, .json-panels { grid-template-columns: 1fr; }
  .notes-layout { grid-template-columns: 1fr; }
  .converter-box { grid-template-columns: 1fr; }
  .converter-arrow { display: none; }
  #topbar { padding: 0 16px; }
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
