:root {
  color-scheme: light;
  --ink: #10213f;
  --muted: #60708c;
  --line: #dce4f2;
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --primary: #165dff;
  --primary-dark: #0d45c7;
  --mint: #0aae86;
  --orange: #ec7a25;
  --shadow: 0 18px 50px rgba(39, 71, 125, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--canvas); }
body { margin: 0; color: var(--ink); background: var(--canvas); font-size: 16px; min-height: 100vh; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
.app-shell { min-height: 100vh; }
.topbar { height: 82px; padding: 0 30px; display: flex; align-items: center; justify-content: space-between; gap: 20px; background: rgba(255,255,255,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #fff; font-size: 21px; font-weight: 900; background: var(--primary); box-shadow: 0 8px 20px rgba(22,93,255,.25); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; letter-spacing: -.02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.sync-state { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; font-weight: 650; }
.sync-state i { width: 8px; height: 8px; border-radius: 50%; background: #9aa7ba; }
.sync-state.is-connected i { background: var(--mint); box-shadow: 0 0 0 4px rgba(10,174,134,.12); }
.sync-state.is-syncing i { background: var(--primary); animation: pulse 1s infinite alternate; }
.sync-state.is-error i { background: #db3b49; }
.button { min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750; cursor: pointer; transition: transform .15s, background .15s, border-color .15s; }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .58; cursor: wait; transform: none; }
.button-primary, .button-copy { color: #fff; background: var(--primary); }
.button-primary:hover, .button-copy:hover { background: var(--primary-dark); }
.button-ghost { background: #fff; border-color: var(--line); }
.button-google { background: #fff; border-color: #cad5e6; box-shadow: 0 2px 6px rgba(16,33,63,.06); }
.button-google svg { width: 20px; height: 20px; }
.workspace { min-height: calc(100vh - 82px); display: grid; grid-template-columns: 260px minmax(0, 1fr); }
.sidebar { padding: 28px 20px 24px; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 82px; height: calc(100vh - 82px); }
.sidebar-heading { padding: 0 10px 14px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.icon-button { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-size: 21px; }
.folder-item { width: 100%; min-height: 46px; padding: 0 12px; border: 0; border-radius: 12px; background: transparent; display: grid; grid-template-columns: 24px 1fr auto; align-items: center; gap: 7px; text-align: left; font-weight: 650; cursor: pointer; }
.folder-item:hover { background: #f3f6fb; }
.folder-item.is-active { color: var(--primary); background: #eaf1ff; }
.folder-item b { color: var(--muted); font-size: 12px; }
.folder-item-wrap { display: grid; grid-template-columns: minmax(0,1fr) 30px; align-items: center; }
.folder-item-wrap .folder-item { min-width: 0; }
.folder-menu { width: 30px; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; }
.folder-menu:hover { background: #eef3fa; }
.folder-dot { width: 9px; height: 9px; border-radius: 50%; margin-left: 3px; }
.blue { background: #e9f0ff; color: #1456de; }
.folder-dot.blue { background: #3377ff; }
.mint { background: #e4f8f1; color: #087a61; }
.folder-dot.mint { background: var(--mint); }
.orange { background: #fff0e5; color: #b9550d; }
.folder-dot.orange { background: var(--orange); }
.purple { background: #f1ebff; color: #7040bf; }
.folder-dot.purple { background: #8156d8; }
.folder-separator { height: 1px; background: var(--line); margin: 12px 8px; }
.sidebar-footer { margin-top: auto; padding-top: 20px; border-top: 1px solid var(--line); }
.settings-link { width: 100%; padding: 10px; border: 0; background: transparent; color: var(--muted); font-weight: 650; cursor: pointer; }
.top-settings-button { flex: 0 0 auto; font-size: 18px; }
.content-area { width: min(1220px, 100%); margin: 0 auto; padding: 46px 46px 80px; }
.content-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; }
.eyebrow { margin: 0 0 9px; color: var(--primary); font-size: 12px; font-weight: 900; letter-spacing: .17em; }
h1 { margin: 0; font-size: clamp(30px, 4vw, 46px); line-height: 1.05; letter-spacing: -.045em; }
.search-box { height: 62px; margin-top: 30px; padding: 0 18px; border: 1px solid #cbd7e9; border-radius: 17px; background: #fff; display: flex; align-items: center; gap: 13px; box-shadow: 0 10px 34px rgba(37,72,130,.08); }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(22,93,255,.10); }
.search-box svg { width: 23px; fill: none; stroke: #71809a; stroke-width: 1.8; stroke-linecap: round; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 17px; }
kbd { padding: 5px 8px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 7px; color: var(--muted); background: #f8fafc; font-size: 12px; white-space: nowrap; }
.mobile-folders { display: none; }
.result-meta { margin: 21px 2px 13px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; font-weight: 650; }
.snippet-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.snippet-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 8px 24px rgba(41,72,125,.06); transition: transform .18s, box-shadow .18s, border-color .18s; }
.snippet-card:hover { transform: translateY(-2px); border-color: #bccbea; box-shadow: var(--shadow); }
.card-top { display: flex; align-items: center; justify-content: space-between; }
.category { display: inline-flex; align-items: center; min-height: 27px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.star-button, .more-button { border: 0; background: transparent; color: #8a98ad; cursor: pointer; }
.star-button { font-size: 21px; }
.star-button.is-active { color: #f0a000; }
.snippet-card h2 { margin: 17px 0 11px; font-size: 19px; letter-spacing: -.02em; }
.snippet-card p { min-height: 180px; margin: 0; color: #3f506d; line-height: 1.62; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-actions { margin-top: 20px; padding-top: 16px; border-top: 1px solid #e7ecf4; display: grid; grid-template-columns: 1fr 42px 42px; gap: 8px; }
.button-copy { min-height: 42px; }
.more-button { border-radius: 11px; background: #f3f6fa; font-weight: 900; }
.card-icon-button { border: 0; border-radius: 11px; background: #f3f6fa; color: #5c6d86; cursor: pointer; font-size: 17px; }
.card-icon-button:hover { color: var(--primary); background: #e9f0ff; }
.card-icon-button.delete:hover { color: #c8293a; background: #fff0f2; }
.empty-state { min-height: 260px; border: 1px dashed #bdc9da; border-radius: 18px; display: grid; place-content: center; text-align: center; gap: 7px; color: var(--muted); }
.empty-state strong { color: var(--ink); font-size: 18px; }
.dialog { width: min(620px, calc(100vw - 28px)); padding: 0; border: 0; border-radius: 20px; color: var(--ink); box-shadow: 0 30px 90px rgba(15,32,61,.28); }
.dialog-small { width: min(470px, calc(100vw - 28px)); }
.dialog::backdrop { background: rgba(11,25,49,.55); backdrop-filter: blur(4px); }
.dialog form { padding: 26px; }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; }
.dialog-heading h2 { margin: 0; font-size: 26px; }
.dialog-close { width: 36px; height: 36px; border: 0; border-radius: 10px; background: #eff3f8; font-size: 24px; cursor: pointer; }
.dialog label { display: grid; gap: 7px; margin-top: 15px; font-size: 14px; font-weight: 750; }
.dialog input, .dialog select, .dialog textarea { width: 100%; padding: 12px 13px; border: 1px solid #cad5e5; border-radius: 11px; color: var(--ink); background: #fff; outline: 0; }
.dialog input:focus, .dialog select:focus, .dialog textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(22,93,255,.1); }
.dialog textarea { resize: vertical; line-height: 1.55; }
.security-note { margin: 15px 0 0; padding: 11px 13px; border-radius: 10px; color: #765200; background: #fff8dc; font-size: 13px; line-height: 1.45; }
.dialog-actions { margin-top: 22px; display: flex; justify-content: flex-end; gap: 9px; }
.button-danger { color: #fff; background: #d63244; }
.button-danger:hover { background: #b92132; }
.settings-section { padding: 17px 0; border-top: 1px solid var(--line); }
.settings-section:first-of-type { border-top: 0; padding-top: 0; }
.settings-section strong { font-size: 16px; }
.settings-section p { margin: 6px 0 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.settings-actions { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.settings-section.compact { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.settings-section.compact p { max-width: 370px; }
.settings-section.compact div { display: flex; flex-direction: column; gap: 5px; text-align: right; }
.settings-section a { color: var(--primary); font-size: 13px; font-weight: 700; text-decoration: none; }
.file-button { position: relative; overflow: hidden; cursor: pointer; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.confirm-message { color: var(--muted); line-height: 1.6; }
.toast { position: fixed; left: 50%; bottom: 26px; z-index: 60; padding: 12px 18px; border-radius: 12px; color: #fff; background: #10213f; font-weight: 750; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: .2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.mobile-toolbar { display: none; }
@keyframes pulse { from { opacity: .35; } to { opacity: 1; } }
.simple-page { min-height: 100vh; padding: 36px 20px; }
.simple-nav { width: min(760px, 100%); margin: 0 auto 18px; }
.simple-nav a { color: var(--primary); font-weight: 750; text-decoration: none; }
.simple-card { width: min(760px, 100%); margin: 0 auto; padding: clamp(25px, 5vw, 48px); border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.simple-card h1 { font-size: clamp(34px, 6vw, 52px); }
.simple-card p, .simple-card li { color: var(--muted); line-height: 1.72; }
.simple-card h2 { margin-top: 30px; font-size: 20px; }
.simple-card ul { padding-left: 21px; }
.simple-card .button { margin-top: 12px; text-decoration: none; }
@media (max-width: 980px) {
  .workspace { grid-template-columns: 220px minmax(0, 1fr); }
  .content-area { padding: 38px 28px 70px; }
  .snippet-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .topbar { height: auto; min-height: 70px; padding: 10px 15px; }
  .brand small, .sync-state, .button-google, .top-settings-button { display: none; }
  .button-google { min-height: 42px; padding: 0 12px; font-size: 13px; }
  .workspace { display: block; }
  .sidebar { display: none; }
  .content-area { padding: 27px 15px 112px; }
  .content-heading { align-items: center; }
  .content-heading .button { width: 48px; padding: 0; font-size: 0; }
  .content-heading .button span { font-size: 23px; }
  h1 { font-size: 31px; }
  .search-box { height: 56px; margin-top: 24px; }
  kbd { display: none; }
  .mobile-folders { margin: 14px -15px 0; padding: 0 15px 4px; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
  .chip { min-height: 37px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; white-space: nowrap; font-weight: 700; }
  .chip.is-active { color: #fff; border-color: var(--primary); background: var(--primary); }
  .result-meta span:last-child { display: none; }
  .snippet-grid { grid-template-columns: 1fr; }
  .snippet-card p { min-height: 0; }
  .settings-section.compact { display: block; }
  .settings-section.compact div { margin-top: 13px; text-align: left; }
  .mobile-toolbar { position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 30; height: 66px; padding: 7px 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border: 1px solid rgba(202,213,230,.9); border-radius: 19px; background: rgba(255,255,255,.96); box-shadow: 0 14px 42px rgba(21,48,93,.2); backdrop-filter: blur(18px); }
  .mobile-toolbar button { min-width: 0; border: 0; border-radius: 13px; background: transparent; display: grid; place-content: center; gap: 1px; color: var(--muted); font-weight: 750; cursor: pointer; }
  .mobile-toolbar button span { font-size: 20px; line-height: 1; }
  .mobile-toolbar button small { font-size: 11px; }
  .mobile-toolbar button.is-primary { color: #fff; background: var(--primary); box-shadow: 0 7px 17px rgba(22,93,255,.25); }
  .toast { bottom: 92px; width: max-content; max-width: calc(100vw - 30px); text-align: center; }
  .dialog { max-height: calc(100dvh - 24px); overflow: auto; }
}
@media (max-width: 460px) {
  .brand-mark { width: 39px; height: 39px; border-radius: 11px; }
  .brand strong { font-size: 16px; }
  .topbar-actions { gap: 6px; }
  #installButton { min-height: 40px; padding: 0 11px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
