:root {
  color-scheme: light;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --color-bg: #f6f5f3;
  --color-panel: #ffffff;
  --color-panel-soft: #fbfaf8;
  --color-text: #211d19;
  --color-muted: #706a64;
  --color-subtle: #938b83;
  --color-line: rgb(52 40 30 / 11%);
  --color-accent: #f45b18;
  --color-accent-soft: rgb(244 91 24 / 10%);
  --font-display: "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius-sm: 12px;
  --radius-md: 18px;
  --radius-lg: 24px;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #101114;
  --color-panel: #18191d;
  --color-panel-soft: #202126;
  --color-text: #f4f1ed;
  --color-muted: #aaa39c;
  --color-subtle: #827a73;
  --color-line: rgb(255 255 255 / 9%);
  --color-accent: #ff762f;
  --color-accent-soft: rgb(255 118 47 / 14%);
}

* { box-sizing: border-box; }
html { overflow-x: clip; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--color-text);
  background:
    radial-gradient(ellipse at 77% -8%, rgb(244 91 24 / 8%), transparent 34rem),
    var(--color-bg);
}

button, input, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
}

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

.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 2;
  display: flex;
  width: 248px;
  flex-direction: column;
  padding: 29px 18px 20px;
  border-right: 1px solid var(--color-line);
  background: rgb(255 255 255 / 86%);
  backdrop-filter: blur(24px);
}

.brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 10px;
  margin: 0 0 35px 7px;
  font: 800 21px var(--font-display);
  letter-spacing: -1px;
}

.brand-icon {
  display: grid;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 11px;
  background: #242529;
  box-shadow: 0 5px 16px rgb(0 0 0 / 22%);
}

.brand-mark {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  border-radius: 10px;
  color: #171310;
  background: var(--color-accent);
  font: 800 22px var(--font-display);
  transform: rotate(-5deg);
}

.brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  flex: 0 0 auto;
  border: 0;
  border-radius: inherit;
  object-fit: cover;
  transform: scale(1.9);
}

.brand-light { color: #847b73; font-weight: 500; }
.sidebar-create { margin-bottom: 38px; }
.nav-group { display: grid; gap: 6px; }
.nav-label, .eyebrow {
  margin: 0;
  color: var(--color-subtle);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.35px;
}
.nav-label { padding: 0 10px 9px; }

.nav-item {
  display: flex;
  width: 100%;
  min-height: 43px;
  align-items: center;
  gap: 11px;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #706a64;
  background: transparent;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  transition: background 160ms ease, color 160ms ease;
}

.nav-item:hover, .nav-item.is-active { color: var(--color-text); background: rgb(52 40 30 / 4%); }
.nav-item.is-active { border-color: rgb(52 40 30 / 5%); }
.nav-item.is-active .nav-icon { color: var(--color-accent); }
.nav-icon { width: 17px; color: #77757d; font-size: 17px; text-align: center; }
.nav-count { margin-left: auto; color: var(--color-subtle); font-size: 11px; }
.sidebar-bottom { display: grid; gap: 18px; margin-top: auto; }
.folder-section { display: grid; gap: 6px; margin-top: 28px; }
.folder-heading { display: flex; align-items: center; justify-content: space-between; padding: 0 4px 4px 0; }
.folder-heading .nav-label { padding-bottom: 0; }
.folder-add { width: 26px; height: 26px; color: var(--color-subtle); }
.folder-list { display: grid; gap: 3px; }
.folder-row { display: grid; min-width: 0; grid-template-columns: minmax(0, 1fr) 24px 24px 24px; align-items: center; border: 1px solid transparent; border-radius: 11px; transition: background 160ms ease; }
.folder-row:hover, .folder-row.is-active { background: rgb(52 40 30 / 4%); }
.folder-item { min-width: 0; gap: 8px; padding-right: 5px; border: 0; }
.folder-row.is-active .folder-item { color: var(--color-text); background: transparent; }
.folder-row.is-active .folder-icon { color: var(--color-accent); }
.folder-name { overflow: hidden; flex: 1; text-overflow: ellipsis; white-space: nowrap; }
.folder-action { display: grid; width: 24px; height: 26px; place-items: center; border: 0; border-radius: 7px; color: var(--color-subtle); background: transparent; cursor: pointer; opacity: 0; transition: color 150ms ease, background 150ms ease, opacity 150ms ease; }
.folder-row:hover .folder-action, .folder-action:focus-visible { opacity: 1; }
.folder-action:hover { color: var(--color-accent); background: var(--color-accent-soft); }
.folder-remove:hover { color: #ff918b; background: rgb(255 90 85 / 10%); }
.account-area { min-width: 0; }
.account-link { display: block; padding: 8px 5px; color: var(--color-muted); font-size: 11px; }
.account-link:hover { color: var(--color-text); }
.account-card { display: grid; gap: 6px; min-width: 0; padding: 8px; border: 1px solid var(--color-line); border-radius: 14px; background: rgb(255 255 255 / 72%); }
.account-trigger { display: flex; min-width: 0; align-items: center; gap: 9px; padding: 4px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; }
.account-trigger:hover { background: var(--color-accent-soft); }
.account-avatar-mini { display: grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; overflow: hidden; border: 1px solid rgb(244 91 24 / 22%); border-radius: 11px; color: #fff; background: linear-gradient(145deg, #ff9a5c, #e94d10); font: 700 13px var(--font-display); }
.account-avatar-mini img { width: 100%; height: 100%; object-fit: cover; }
.account-trigger-copy { display: grid; min-width: 0; gap: 3px; }
.account-email { overflow: hidden; color: var(--color-text); font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.account-caption { color: var(--color-subtle); font-size: 9px; line-height: 1.5; }
.account-logout { width: 100%; padding: 5px 7px 2px; border: 0; border-top: 1px solid var(--color-line); color: var(--color-muted); background: transparent; cursor: pointer; font-size: 9px; text-align: left; }
.account-logout:hover { color: var(--color-accent); }
.privacy-card { padding: 14px; border: 1px solid var(--color-line); border-radius: 14px; background: rgb(255 255 255 / 72%); }
.privacy-icon { color: var(--color-accent); font-size: 16px; }
.privacy-card p { margin: 9px 0 0; color: var(--color-muted); font-size: 11px; line-height: 1.7; }
.privacy-card strong { color: #39332e; font-weight: 600; }
.sidebar-link { display: flex; justify-content: space-between; padding: 0 5px; color: var(--color-muted); font-size: 11px; }
.sidebar-link:hover { color: var(--color-text); }

.main-panel { min-height: 100vh; margin-left: 248px; padding: 0 clamp(24px, 3.2vw, 58px) 70px; }
.topbar { display: flex; min-height: 114px; align-items: center; justify-content: space-between; gap: 28px; border-bottom: 1px solid var(--color-line); }
.page-heading .eyebrow { margin-bottom: 7px; }
h1, h2, h3, p { overflow-wrap: anywhere; }
.page-heading { min-width: 0; }
.page-heading h1 { margin: 0; font: 700 clamp(20px, 1.5vw, 24px) var(--font-display); letter-spacing: -0.7px; }
.topbar-actions { display: flex; flex: 0 1 auto; align-items: center; gap: 10px; }
.search-box { display: flex; width: min(250px, 26vw); height: 41px; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid var(--color-line); border-radius: 11px; color: var(--color-muted); background: rgb(255 255 255 / 88%); }
.search-box > span:first-child { font-size: 20px; transform: rotate(-20deg); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--color-text); background: transparent; font-size: 12px; }
.search-box input::placeholder { color: #938b83; }
kbd { flex: 0 0 auto; padding: 3px 5px; border: 1px solid var(--color-line); border-radius: 5px; color: #938b83; font: 10px "Segoe UI", system-ui, sans-serif; }
.notes-section { max-width: 1180px; margin: 42px auto 0; }
.section-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 22px; }
.section-heading h2 { margin: 0 0 5px; font: 650 16px var(--font-display); letter-spacing: -0.3px; }
.section-heading p { margin: 0; color: var(--color-muted); font-size: 12px; }
.notes-meta { color: var(--color-subtle); font-size: 11px; }
.section-actions { display: flex; align-items: center; gap: 15px; }
.theme-control { display: flex; height: 38px; align-items: center; padding: 0 10px; border: 1px solid var(--color-line); border-radius: 10px; color: var(--color-muted); background: rgb(255 255 255 / 78%); }
.theme-control select { max-width: 78px; border: 0; outline: 0; color: var(--color-text); background: transparent; cursor: pointer; font-size: 11px; }
.theme-control select option { color: #211d19; background: #fff; }
.account-mobile-trigger { display: none; min-height: 38px; padding: 0 10px; font-size: 10px; }
.account-mobile-trigger > span { color: var(--color-accent); font-size: 14px; }

@media (max-width: 900px) {
  .sidebar { width: 215px; }
  .main-panel { margin-left: 215px; padding-right: 26px; padding-left: 26px; }
  .search-box { width: min(190px, 22vw); }
  .topbar { flex-wrap: wrap; gap: 14px; padding-block: 22px; }
  .topbar-actions { width: 100%; }
  .search-box { width: auto; flex: 1; }
}

@media (max-width: 680px) {
  .sidebar { position: static; display: grid; width: auto; height: auto; grid-template-columns: 1fr; gap: 12px; padding: 13px 18px; border-right: 0; border-bottom: 1px solid var(--color-line); }
  .brand { margin: 0; font-size: 18px; }
  .brand-icon { width: 33px; height: 33px; flex-basis: 33px; border-radius: 9px; }
  .sidebar-create { display: none; }
  .nav-group { display: flex; width: 100%; gap: 8px; }
  .nav-label, .nav-count, .sidebar-bottom { display: none; }
  .folder-section { display: grid; gap: 4px; margin-top: 0; }
  .folder-heading { justify-content: space-between; }
  .folder-heading .nav-label { display: block; padding: 0 0 0 4px; font-size: 9px; }
  .folder-list { display: flex; overflow-x: auto; gap: 5px; padding-bottom: 2px; scrollbar-width: thin; }
  .folder-row { min-width: 145px; flex: 0 0 auto; }
  .nav-item { width: auto; min-width: 0; min-height: 36px; flex: 1; justify-content: center; gap: 6px; padding: 0 9px; font-size: 11px; }
  .nav-icon { font-size: 15px; }
  .main-panel { margin-left: 0; padding: 0 18px 48px; }
  .topbar { min-height: auto; flex-wrap: wrap; padding: 24px 0 16px; }
  .page-heading h1 { font-size: 19px; }
  .topbar-actions { width: 100%; gap: 8px; }
  .search-box { width: auto; flex: 1; }
  .theme-control { flex: 0 0 auto; }
  .account-mobile-trigger { display: inline-flex; flex: 0 0 auto; }
  .top-create { padding: 0 12px; }
  .notes-section { margin-top: 28px; }
}

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

html[data-theme="dark"] body {
  background:
    radial-gradient(ellipse at 77% -8%, rgb(255 118 47 / 8%), transparent 34rem),
    var(--color-bg);
}
html[data-theme="dark"] .sidebar { background: rgb(23 24 28 / 86%); }
html[data-theme="dark"] .nav-item { color: #aaa39c; }
html[data-theme="dark"] .nav-item:hover,
html[data-theme="dark"] .nav-item.is-active,
html[data-theme="dark"] .folder-row:hover,
html[data-theme="dark"] .folder-row.is-active { background: rgb(255 255 255 / 5%); }
html[data-theme="dark"] .nav-item.is-active { border-color: rgb(255 255 255 / 5%); }
html[data-theme="dark"] .brand-light { color: #aaa39c; }
html[data-theme="dark"] .account-card,
html[data-theme="dark"] .privacy-card { background: rgb(255 255 255 / 3%); }
html[data-theme="dark"] .account-trigger:hover { background: rgb(255 118 47 / 9%); }
html[data-theme="dark"] .privacy-card strong { color: #e8e4df; }
html[data-theme="dark"] .search-box,
html[data-theme="dark"] .theme-control { background: rgb(255 255 255 / 4%); }
html[data-theme="dark"] .search-box input { color: var(--color-text); }
html[data-theme="dark"] .theme-control select option { color: #f4f1ed; background: #202126; }
