:root{
  --bg:#f5f5f7;
  --panel:#ffffff;
  --text:#111111;
  --muted:#6b7280;
  --border:#e5e7eb;
  --blue:#0a84ff;
  --danger:#ff453a;
  --shadow:0 12px 30px rgba(0,0,0,.06);
  --radius:18px;
}
*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:-apple-system,BlinkMacSystemFont,"SF Pro Text","SF Pro Display","Segoe UI",Inter,system-ui,sans-serif;
  color:var(--text);
  background:linear-gradient(180deg,#fcfcfd 0%, #f3f4f7 100%);
}
a{text-decoration:none;color:inherit}
button,input,textarea{font:inherit}
button{
  cursor:pointer;
  border:1px solid var(--border);
  border-radius:14px;
  padding:11px 14px;
  background:#fff;
  color:var(--text);
  transition:.18s ease;
}
button:hover{transform:translateY(-1px);box-shadow:var(--shadow)}
button.primary{background:var(--blue);color:#fff;border-color:var(--blue)}
button.danger{background:#fff5f4;color:var(--danger);border-color:#ffd7d4}
input,textarea{
  width:100%;
  border:1px solid var(--border);
  border-radius:14px;
  padding:13px 14px;
  background:#fff;
  color:var(--text);
  outline:none;
}
input:focus,textarea:focus{
  border-color:#b6d7ff;
  box-shadow:0 0 0 4px rgba(10,132,255,.08);
}
textarea{min-height:260px;resize:vertical;line-height:1.6}
.layout{min-height:100vh;display:grid;grid-template-columns:280px 1fr}
.sidebar{
  background:rgba(255,255,255,.84);
  backdrop-filter:blur(22px);
  border-right:1px solid var(--border);
  padding:24px 18px;
  display:flex;
  flex-direction:column;
  gap:18px;
}
.brand{display:flex;align-items:center;gap:12px;padding:6px 8px 10px}
.brand-mark{
  width:40px;height:40px;border-radius:12px;
  background:linear-gradient(180deg,#ffe066,#ffd60a);
  display:grid;place-items:center;
  box-shadow:0 10px 20px rgba(255,214,10,.25);
}
.brand-text strong{display:block;font-size:17px}
.brand-text span{display:block;color:var(--muted);font-size:12px}
.nav{display:grid;gap:6px}
.nav a{padding:11px 12px;border-radius:12px;color:#374151}
.nav a:hover,.nav a.active{background:#fff;box-shadow:var(--shadow)}
.user-box{
  margin-top:auto;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:12px;
  padding:14px;
  background:#fff;
  border:1px solid var(--border);
  border-radius:18px;
}
.user-left{display:flex;align-items:center;gap:12px;min-width:0}
.avatar{
  width:38px;height:38px;border-radius:999px;
  background:var(--blue);color:#fff;
  display:grid;place-items:center;
  font-weight:700;font-size:16px;flex:0 0 38px;
}
.username{
  font-size:14px;font-weight:600;
  white-space:nowrap;overflow:hidden;text-overflow:ellipsis;
}
.icon-btn{
  width:40px;height:40px;border-radius:12px;
  display:grid;place-items:center;padding:0;font-size:18px;
}
.main{padding:24px}
.topbar{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:20px}
.page-title h1{margin:0;font-size:34px;letter-spacing:-.03em}
.grid{display:grid;grid-template-columns:minmax(320px,430px) 1fr;gap:18px}
.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}
.card-header{padding:18px 20px 0;min-height:20px}
.card-header h2{margin:0;font-size:20px}
.card-body{padding:18px 20px 20px}
.search-row{display:flex;gap:10px;margin-bottom:14px}
.notes{display:grid;gap:12px}
.note-item{
  background:linear-gradient(180deg,#fff,#fcfcff);
  border:1px solid var(--border);
  border-radius:16px;
  padding:16px;
  cursor:pointer;
  transition:.18s ease;
}
.note-item:hover{transform:translateY(-1px);box-shadow:var(--shadow)}
.note-item.active{border-color:#b6d7ff;box-shadow:0 0 0 4px rgba(10,132,255,.08)}
.note-title{margin:0 0 6px;font-size:16px;font-weight:600}
.note-meta{font-size:13px;color:var(--muted)}
.note-actions{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}
.preview{min-height:560px;display:flex;flex-direction:column}
.preview .card-body{
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
}
.preview .empty{margin:auto;color:var(--muted)}
.preview-note{
  display:flex;
  flex-direction:column;
  flex:1;
  min-height:0;
}
.preview-note h2{margin:0 0 8px;font-size:30px;letter-spacing:-.03em}
.preview-note .meta{color:var(--muted);font-size:14px;margin-bottom:18px}
.preview-note .content{
  white-space:pre-wrap;
  line-height:1.72;
  flex:1;
}
.preview-note .note-actions{
  margin-top:auto;
  justify-content:flex-end;
}
.center-wrap{min-height:100vh;display:grid;place-items:center;padding:24px}
.auth-page{
  width:min(460px,100%);
  background:#fff;
  border:1px solid var(--border);
  border-radius:24px;
  box-shadow:var(--shadow);
  padding:26px;
}
.auth-hero{text-align:center;margin-bottom:18px}
.auth-hero .brand-mark{margin:0 auto 14px}
.auth-hero h1{margin:0;font-size:30px;letter-spacing:-.03em}
.stack{display:grid;gap:12px}
.toolbar{display:flex;gap:10px;flex-wrap:wrap}
.toast{
  position:fixed;right:20px;bottom:20px;
  background:#111827;color:#fff;
  padding:12px 14px;border-radius:14px;
  box-shadow:var(--shadow);opacity:0;
  transform:translateY(10px);pointer-events:none;transition:.2s ease;
}
.toast.show{opacity:1;transform:translateY(0)}
@media(max-width:980px){
  .layout{grid-template-columns:1fr}
  .sidebar{display:none}
  .grid{grid-template-columns:1fr}
}
