:root {
  color-scheme: light;
  /* warm cream palette */
  --page: #faf7f3;
  --surface: #fffdfa;
  --surface-muted: #f3ede6;
  --surface-strong: #e8ddd1;
  --ink: #1d1f24;
  --ink-soft: #6b6259;
  --ink-muted: #8a7e74;
  --line: #e7e1d8;
  --line-strong: #c8bfb5;
  /* gold brand */
  --brand: #cda274;
  --brand-strong: #9d7045;
  --brand-soft: rgba(205, 162, 116, 0.14);
  --gold: #cda274;
  --gold-dark: #9d7045;
  --gold-soft: rgba(205, 162, 116, 0.13);
  /* utility */
  --blue: #2563eb;
  --blue-soft: #e8efff;
  --red: #c43838;
  --red-soft: #fde9e7;
  --shadow: 0 24px 70px rgba(100, 65, 25, 0.12);
  --shadow-soft: 0 12px 36px rgba(100, 65, 25, 0.08);
  --radius: 8px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --heading-color: var(--brand-strong);
  --accent-color: var(--brand);
  /* login panel tokens */
  --login-ink: #1d1f24;
  --login-muted: #717985;
  --login-line: #e7e1d8;
  --login-paper: #fffdfa;
}

/* ---- Keyframe animations ---- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%,  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
  50%        { box-shadow: 0 0 0 6px rgba(255, 255, 255, 0); }
}

/* ---- Scrollbar styling ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--page); }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--brand); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(205, 162, 116, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(205, 162, 116, 0.065) 1px, transparent 1px),
    var(--page);
  background-size: 42px 42px;
  color: var(--ink);
  font-family: "Manrope", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
button, input, select, textarea { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  padding: 20px 0 0;
  transition: padding 300ms var(--ease);
}

.header-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 1rem;
  padding: 7px 24px;
  border: 1px solid rgba(231, 225, 216, 0.9);
  border-radius: 50px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: 0 18px 48px rgba(100, 65, 25, 0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  transition:
    background 300ms var(--ease),
    border-color 300ms var(--ease),
    box-shadow 300ms var(--ease);
}

.site-header.scrolled { padding-top: 12px; }
.site-header.scrolled .header-container {
  background: rgba(255, 253, 250, 0.98);
  border-color: var(--line-strong);
  box-shadow: 0 16px 42px rgba(100, 65, 25, 0.14);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: linear-gradient(145deg, var(--surface), var(--brand-soft));
  color: var(--brand-strong);
  font-weight: 800;
  font-size: 0.88rem;
  box-shadow: var(--shadow-soft);
  flex: 0 0 auto;
}

.brand-title { display: block; font-size: 0.98rem; font-weight: 800; line-height: 1.1; }
.brand-subtitle { display: block; color: var(--ink-muted); font-size: 0.78rem; font-weight: 700; text-transform: uppercase; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 40px;
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 800;
  border: none;
  background: none;
  cursor: pointer;
  transition: color 180ms var(--ease), background 180ms var(--ease), transform 180ms var(--ease);
}

.nav-link:hover, .nav-link:focus-visible {
  color: var(--brand-strong);
  background: var(--brand-soft);
  outline: none;
}

.nav-link-primary {
  color: #fff;
  background: var(--brand);
}

.nav-link-primary:hover, .nav-link-primary:focus-visible {
  color: #fff;
  background: var(--brand-strong);
  transform: translateY(-1px);
}

/* ---- Buttons ---- */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.64rem 1.1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
  transition:
    transform 180ms var(--ease),
    border-color 180ms var(--ease),
    background 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

.button:hover, .button:focus-visible {
  transform: translateY(-1px);
  border-color: var(--brand);
  box-shadow: var(--shadow-soft);
  outline: none;
  color: inherit;
}

.button.primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-color: var(--gold-dark);
  color: #fff;
  letter-spacing: 0.01em;
}

.button.primary:hover, .button.primary:focus-visible {
  color: #fff;
  background: linear-gradient(135deg, var(--gold-dark), #7a5430);
  border-color: var(--gold-dark);
  box-shadow: 0 10px 22px rgba(157, 112, 69, 0.28);
}

.button.danger {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

.button.danger:hover {
  background: var(--red);
  color: #fff;
  border-color: var(--red);
}

.button.sm {
  min-height: 32px;
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.button.icon-only {
  width: 34px;
  min-width: 34px;
  padding-inline: 0;
}

/* ---- Login (split-panel: gold left + form right) ---- */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 3vw, 34px);
}

.login-page {
  width: min(1000px, 100%);
  display: grid;
  grid-template-columns: 0.82fr 1fr;
  background: var(--surface);
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(205, 162, 116, 0.22);
  box-shadow: 0 30px 80px rgba(9, 12, 17, 0.22);
}

/* Left: gold info panel */
.login-info {
  background:
    linear-gradient(165deg, rgba(205, 162, 116, 0.98), rgba(157, 112, 69, 0.95)),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.06) 0, rgba(255, 255, 255, 0.06) 18px,
      transparent 18px, transparent 36px
    );
  color: #fff;
  padding: clamp(34px, 4vw, 54px) clamp(28px, 4vw, 44px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  width: fit-content;
  margin-bottom: 22px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.login-eyebrow .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.22);
  flex: 0 0 auto;
  animation: pulse 2s infinite;
}

.login-brand-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
  font-size: 1.35rem;
  font-weight: 800;
  margin-bottom: 18px;
  color: #fff;
}

.login-info h2 {
  font-size: clamp(2rem, 3.5vw, 3.2rem);
  font-weight: 800;
  line-height: 0.96;
  margin: 0 0 12px;
  color: #fff;
}

.login-info > p {
  max-width: 340px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.95rem;
  margin: 0;
  line-height: 1.65;
}

.login-highlights {
  list-style: none;
  padding: 0;
  margin: 20px 0 0;
  display: grid;
  gap: 8px;
}

.login-highlights li {
  font-size: 0.84rem;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  opacity: 0.93;
}

/* Right: form panel */
.login-container {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(32px, 5vw, 62px) clamp(28px, 5vw, 54px);
  background:
    linear-gradient(135deg, rgba(205, 162, 116, 0.09), transparent 36%),
    var(--login-paper);
}

.login-container::before {
  content: "";
  position: absolute;
  top: 28px;
  right: 30px;
  width: 62px;
  height: 62px;
  border-top: 2px solid rgba(205, 162, 116, 0.36);
  border-right: 2px solid rgba(205, 162, 116, 0.36);
  pointer-events: none;
  border-radius: 0 6px 0 0;
}

.login-panel-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  margin-bottom: 16px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-dark);
  background: var(--gold-soft);
  border: 1px solid rgba(205, 162, 116, 0.26);
}

.login-header h1 {
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: clamp(1.8rem, 2.8vw, 2.7rem);
  font-weight: 800;
  line-height: 1;
  color: var(--login-ink);
  margin: 0;
}

.login-header h1 i {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, var(--gold), var(--gold-dark));
  font-size: 1rem;
  box-shadow: 0 10px 22px rgba(157, 112, 69, 0.24);
}

.login-header p {
  margin: 10px 0 0;
  color: var(--login-muted);
  font-size: 0.94rem;
}

.login-form {
  margin-top: 22px;
  width: 100%;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #3c3b37;
  margin-bottom: 8px;
}

.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .i-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gold-dark);
  font-size: 0.85rem;
  pointer-events: none;
}

.form-group input {
  width: 100%;
  min-height: 50px;
  padding: 0 44px 0 38px;
  border: 1px solid var(--login-line);
  border-radius: 11px;
  background: #fff;
  color: var(--login-ink);
  font-size: 0.95rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.76);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.form-group input:hover { border-color: rgba(205, 162, 116, 0.5); }
.form-group input:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(205, 162, 116, 0.14);
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--login-muted);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 180ms var(--ease), color 180ms var(--ease);
}

.password-toggle:hover {
  background: var(--gold-soft);
  color: var(--gold-dark);
}

.login-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  border: 0;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: 0.02em;
  box-shadow: 0 12px 26px rgba(157, 112, 69, 0.22);
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease);
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 34px rgba(157, 112, 69, 0.3);
}

.login-btn:active { transform: translateY(0); }

.login-submit-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  color: var(--login-muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.login-submit-note i { color: var(--brand); margin-top: 2px; }

.login-page-footer {
  margin-top: auto;
  padding-top: 24px;
  color: var(--login-muted);
  font-size: 0.76rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ---- Error message ---- */
.error-msg {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 16px;
  margin-bottom: 4px;
  padding: 11px 14px;
  border: 1px solid rgba(231, 76, 60, 0.24);
  border-radius: 10px;
  background: rgba(231, 76, 60, 0.08);
  color: #a72317;
  font-size: 0.88rem;
  font-weight: 700;
}

/* ---- Form fields (dashboard) ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-muted);
  letter-spacing: 0.04em;
}

.field input,
.field select,
.field textarea {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--page);
  color: var(--ink);
  transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(205, 162, 116, 0.18);
}

.field textarea {
  resize: vertical;
  min-height: 220px;
  font-family: "Source Code Pro", Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.65;
}

/* ---- Page layout ---- */
.page-hero {
  padding: clamp(2rem, 5vw, 4rem) 0 clamp(1.5rem, 3vw, 2rem);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  color: var(--brand-strong);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.eyebrow::before {
  content: "";
  width: 36px;
  height: 2px;
  background: var(--brand);
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 4rem);
  line-height: 0.95;
  color: var(--brand-strong);
}

.hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
}

.hero-count {
  color: var(--ink-muted);
  font-size: 0.95rem;
  font-weight: 700;
  margin: 0;
}

.dashboard-summary {
  margin-bottom: 0.75rem;
}

.quick-stats {
  display: flex;
  gap: 1.2rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink-muted);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
}

.quick-stats span,
.filter-count {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  white-space: nowrap;
}

.quick-stats i {
  color: var(--brand);
}

.dashboard-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px auto;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tool-search,
.tool-select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.tool-search {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0 0.85rem;
  color: var(--brand-strong);
}

.tool-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.tool-search:focus-within,
.tool-select:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(205, 162, 116, 0.16);
}

.tool-select {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.5rem;
  padding: 0 0.75rem;
}

.tool-select span {
  color: var(--ink-muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tool-select select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.filter-count {
  justify-content: center;
  min-height: 44px;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-muted);
  color: var(--ink-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

/* ---- New note form card ---- */
.form-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

/* Slide-down animation when new-note form is revealed */
#new-note-wrap:not([hidden]) .form-card {
  animation: slideDown 260ms var(--ease) both;
}

.form-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.2rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.form-card-title {
  font-weight: 800;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.form-card-body {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: 1rem;
}

/* ---- Notes grid ---- */
.notes-section {
  padding-bottom: 4rem;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
  gap: 1rem;
}

/* Staggered fade-up animation for note cards */
.notes-grid .note-card { animation: fadeUp 320ms var(--ease) both; }
.notes-grid .note-card:nth-child(1) { animation-delay:   0ms; }
.notes-grid .note-card:nth-child(2) { animation-delay:  50ms; }
.notes-grid .note-card:nth-child(3) { animation-delay: 100ms; }
.notes-grid .note-card:nth-child(4) { animation-delay: 150ms; }
.notes-grid .note-card:nth-child(5) { animation-delay: 200ms; }
.notes-grid .note-card:nth-child(6) { animation-delay: 250ms; }
.notes-grid .note-card:nth-child(7) { animation-delay: 300ms; }
.notes-grid .note-card:nth-child(8) { animation-delay: 350ms; }

.note-card {
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  cursor: pointer;
  transition:
    transform 180ms var(--ease),
    border-color 180ms var(--ease),
    box-shadow 180ms var(--ease);
}

.note-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  border-left-color: var(--brand);
  box-shadow: 0 20px 48px rgba(100, 65, 25, 0.14);
}

.note-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.1rem 1.2rem;
  border-bottom: 1px solid var(--line);
}

.note-card-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  background: var(--brand-soft);
  color: var(--brand-strong);
  letter-spacing: 0.04em;
}

.note-card-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--ink);
  margin: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.note-card-date {
  font-size: 0.78rem;
  color: var(--ink-muted);
  margin: 0.2rem 0 0;
}

.note-card-actions {
  display: flex;
  flex-direction: row;
  gap: 0.3rem;
  align-items: flex-end;
  flex-shrink: 0;
}

.note-card a,
.note-card button,
.note-card input,
.note-card select,
.note-card textarea {
  cursor: auto;
}

.note-card a,
.note-card button {
  cursor: pointer;
}

.note-card-actions form {
  display: contents;
}

.note-card-preview {
  padding: 0.85rem 1.2rem;
  flex: 1;
  background: linear-gradient(180deg, #faf6f0, #f7f0e8);
  border-bottom: 1px solid var(--line);
}

.note-card-preview pre {
  margin: 0;
  font-family: "Source Code Pro", Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
  color: var(--ink-soft);
  white-space: pre-wrap;
  word-break: break-all;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.note-card-footer {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.2rem;
  background: var(--surface-muted);
}

.note-card-foot-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex: 1;
}

.share-url-text {
  flex: 1;
  min-width: 0;
  font-family: "Source Code Pro", Consolas, monospace;
  font-size: 0.76rem;
  color: var(--ink-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-card[hidden] {
  display: none;
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--ink-muted);
  border: 2px dashed var(--line-strong);
  border-radius: 16px;
}

.empty-icon {
  font-size: 2.8rem;
  margin-bottom: 1rem;
  display: block;
  color: var(--line-strong);
}

.empty-state p {
  margin: 0;
  font-size: 1rem;
}

/* ---- View page ---- */
.view-hero {
  padding: clamp(2rem, 5vw, 4rem) 0 clamp(1.5rem, 3vw, 2rem);
}

.view-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.view-title {
  font-size: clamp(1.8rem, 4vw, 3.5rem);
  font-weight: 800;
  margin: 0;
  line-height: 1.1;
  color: var(--brand-strong);
}

.view-date {
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0.5rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* ---- Admin bar (view page delete) ---- */
.view-admin-bar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(205, 162, 116, 0.22);
  border-radius: var(--radius);
  background: rgba(205, 162, 116, 0.06);
  font-size: 0.82rem;
  color: var(--ink-muted);
  font-weight: 700;
}

.view-admin-bar .admin-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* ---- Share panel ---- */
.share-panel {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.share-panel-label {
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-muted);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.share-panel-url {
  flex: 1;
  font-family: "Source Code Pro", Consolas, monospace;
  font-size: 0.84rem;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}

/* Share panel URL input field */
.share-panel-input {
  flex: 1;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--page);
  font-family: "Source Code Pro", monospace;
  font-size: 0.82rem;
  color: var(--ink-soft);
  min-width: 0;
  cursor: text;
  user-select: all;
}

/* ---- Code block ---- */
.code-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  margin-bottom: 3rem;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.code-block-lang {
  font-family: "Source Code Pro", monospace;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
}

.code-block pre {
  margin: 0;
  padding: 1.25rem;
  background: #faf6f0;
  color: #2a2018;
  font-family: "Source Code Pro", Consolas, monospace;
  font-size: 0.88rem;
  line-height: 1.75;
  overflow-x: auto;
  white-space: pre;
  tab-size: 2;
  counter-reset: line;
}

/* Code with line numbers helper */
.code-with-lines {
  white-space: pre;
  tab-size: 2;
}

/* Line count label */
.line-count {
  font-family: "Source Code Pro", monospace;
  font-size: 0.72rem;
  color: var(--ink-muted);
}

/* ---- Char counter ---- */
.char-count {
  font-size: 0.74rem;
  color: var(--ink-muted);
  text-align: right;
  margin-top: 3px;
  font-weight: 700;
}

.char-count.warn { color: var(--gold-dark); }

/* ---- Toast notification ---- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 10px 18px;
  background: #1d1f24;
  color: #fff;
  border-radius: 99px;
  font-size: 0.84rem;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms var(--ease), transform 220ms var(--ease);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Temp share dropdown ---- */
.temp-share-menu {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: slideDown 160ms var(--ease) both;
}

.temp-share-menu-title {
  padding: 0.5rem 0.8rem;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.temp-share-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.52rem 0.8rem;
  border: none;
  background: none;
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 130ms var(--ease), color 130ms var(--ease);
  text-align: left;
}

.temp-share-option + .temp-share-option {
  border-top: 1px solid var(--line);
}

.temp-share-option:hover {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.temp-share-option i {
  color: var(--brand);
  width: 14px;
  flex-shrink: 0;
}

/* ---- Expiry banner (share.php) ---- */
.expiry-banner {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid rgba(205, 162, 116, 0.35);
  border-radius: var(--radius);
  background: rgba(205, 162, 116, 0.08);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--brand-strong);
}

.expiry-banner i {
  color: var(--brand);
  flex-shrink: 0;
}

/* ---- Responsive ---- */
@media (max-width: 760px) {
  .login-page { grid-template-columns: 1fr; }
  .login-info { min-height: 280px; justify-content: flex-start; padding-top: 32px; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 1180px); }
  .header-container { border-radius: 28px; padding: 10px 14px; }
  h1 { font-size: 2rem; }
  .form-row { grid-template-columns: 1fr; }
  .hero-row { flex-direction: column; align-items: flex-start; }
  .share-panel {
    align-items: stretch;
    gap: 0.65rem;
  }
  .share-panel-label {
    width: 100%;
  }
  .share-panel-input {
    flex-basis: calc(100% - 96px);
  }
  .dashboard-tools { grid-template-columns: 1fr; }
  .quick-stats { flex-wrap: wrap; gap: 0.7rem 1rem; }
  .filter-count { justify-content: flex-start; }
  .note-card-head,
  .note-card-footer { padding-inline: 0.9rem; }
  .note-card-footer { align-items: flex-start; }
  .note-card-foot-meta {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
  }
  .share-url-text { max-width: 100%; }
}

@media (max-width: 500px) {
  .login-wrap { padding: 0; }
  .login-page { border-radius: 0; min-height: 100vh; grid-template-columns: 1fr; }
  .login-container::before { display: none; }
}

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

/* ---- Refined workspace pass ---- */
body {
  background:
    radial-gradient(circle at 12% 0%, rgba(205, 162, 116, 0.16), transparent 30rem),
    linear-gradient(90deg, rgba(205, 162, 116, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(205, 162, 116, 0.04) 1px, transparent 1px),
    var(--page);
  background-size: auto, 42px 42px, 42px 42px, auto;
}

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

.hero-action {
  min-height: 40px;
  padding-inline: 0.9rem;
}

.hero-count {
  white-space: nowrap;
}

.note-card {
  border-radius: 12px;
}

.note-card-head {
  padding-block: 1rem;
}

.note-card-footer {
  min-height: 52px;
}

.share-url-label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  flex: 0 0 auto;
  color: var(--brand-strong);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.share-url-label i {
  font-size: 0.64rem;
}

.share-url-text {
  color: var(--ink-soft);
  font-size: 0.73rem;
}

.note-footer-stat {
  white-space: nowrap;
}

.share-panel-input {
  color: var(--brand-strong);
  font-weight: 700;
}

.share-panel-input:focus-visible,
.tool-search input:focus-visible,
.tool-select select:focus-visible,
.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible {
  outline: 3px solid rgba(205, 162, 116, 0.28);
  outline-offset: 1px;
}

.temp-share-menu {
  max-height: min(280px, calc(100vh - 24px));
  overflow-y: auto;
}

.temp-share-option {
  min-height: 40px;
}

.empty-state {
  background: rgba(255, 253, 250, 0.58);
}

@media (max-width: 640px) {
  .hero-actions {
    width: 100%;
    justify-content: space-between;
  }

  .hero-action {
    flex: 0 0 auto;
  }

  .note-card-footer {
    gap: 0.5rem;
  }

  .note-card-foot-meta {
    min-width: 0;
  }

  .share-url-text {
    max-width: 100%;
  }
}

@media (max-width: 420px) {
  .hero-actions {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.65rem;
  }

  .hero-action {
    width: 100%;
  }

  .note-card-head {
    gap: 0.55rem;
  }

  .note-card-actions .button:not(.icon-only) {
    padding-inline: 0.55rem;
  }
}
