:root {
  color-scheme: light;
  font-family: "DM Sans", sans-serif;
  color: #19221c;
  background: #f5f2eb;
  --ink: #19221c;
  --muted: #72776f;
  --paper: #fbfaf6;
  --line: #deddd5;
  --green: #174f3b;
  --green-soft: #e2ebe4;
  --amber: #e7a31d;
  --lavender: #dcd9f2;
  --blue: #dce8ef;
  --rose: #efdadd;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: #f5f2eb; }
button, input, select { font: inherit; }
button { color: inherit; }
button, a, input, select, [contenteditable="true"] { -webkit-tap-highlight-color: transparent; }
.hidden { display: none !important; }
.mobile-only { display: none; }

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 0.8fr);
  background: var(--paper);
}

.login-art {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 64px;
  background: var(--green);
  color: white;
}

.login-art p {
  position: relative;
  z-index: 2;
  margin: 0;
  max-width: 620px;
  font: 700 clamp(42px, 5.3vw, 84px)/1.03 "Manrope", sans-serif;
  letter-spacing: -0.055em;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 12px;
  background: var(--green);
  color: white;
  font: 800 14px "Manrope", sans-serif;
  letter-spacing: -0.05em;
}

.brand-mark.large { position: relative; z-index: 2; width: 56px; height: 56px; background: white; color: var(--green); font-size: 19px; }
.orbit { position: absolute; border: 1px solid rgba(255,255,255,.18); border-radius: 50%; }
.orbit-one { width: 620px; height: 620px; right: -230px; top: -150px; }
.orbit-two { width: 470px; height: 470px; right: -170px; top: -75px; }
.spark { position: absolute; border-radius: 50%; background: #f3bd4e; box-shadow: 0 0 50px rgba(243,189,78,.35); }
.spark-one { width: 18px; height: 18px; right: 22%; top: 23%; }
.spark-two { width: 9px; height: 9px; left: 25%; bottom: 21%; }

.login-card {
  align-self: center;
  width: min(440px, calc(100% - 48px));
  margin: auto;
  display: grid;
  gap: 18px;
}

.eyebrow { color: #8b7751; font-size: 11px; font-weight: 800; letter-spacing: .16em; }
.login-card h1 { margin: 0; font: 800 44px/1.05 "Manrope", sans-serif; letter-spacing: -.045em; }
.login-card > p { color: var(--muted); margin: -10px 0 12px; }
label { display: grid; gap: 7px; font-size: 13px; font-weight: 700; }
input, select {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d3d3ca;
  border-radius: 10px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}
input:focus, select:focus { outline: 3px solid rgba(23,79,59,.12); border-color: var(--green); }
.primary-button {
  min-height: 48px;
  border: 0;
  border-radius: 10px;
  background: var(--green);
  color: white;
  font-weight: 800;
  cursor: pointer;
}
.link-button { min-height: 34px; border: 0; padding: 0; background: transparent; color: var(--green); font-size: 12px; font-weight: 700; cursor: pointer; }
.login-card small { text-align: center; color: #9b9d96; }
.form-message { min-height: 18px; color: #a64040; font-size: 13px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 250px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #ebe8e1;
  padding: 22px 16px 14px;
}
.sidebar-head { display: flex; align-items: center; gap: 11px; padding: 0 7px 22px; }
.sidebar-head div:nth-child(2) { display: grid; gap: 1px; }
.sidebar-head strong { font: 800 15px "Manrope", sans-serif; }
.sidebar-head span, .profile-row small { color: var(--muted); font-size: 11px; }
.new-idea-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: white;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(23,79,59,.15);
}
.main-nav { display: grid; gap: 3px; margin-top: 20px; }
.nav-item, .folder-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  width: 100%;
  min-height: 37px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}
.nav-item:hover, .nav-item.active, .folder-item:hover, .folder-item.active { background: rgba(255,255,255,.67); }
.nav-item b { padding: 2px 7px; border-radius: 9px; background: rgba(25,34,28,.07); font-size: 10px; }
.sidebar-section { margin-top: 27px; }
.section-title { display: flex; justify-content: space-between; align-items: center; padding: 0 8px 7px; color: #8e8f88; font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.section-title button { border: 0; background: transparent; cursor: pointer; }
.folder-list { display: grid; gap: 2px; }
.folder-dot { width: 8px; height: 8px; border-radius: 50%; }
.sidebar-foot { margin-top: auto; padding-top: 13px; border-top: 1px solid #d8d5ce; }
.profile-row { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: center; border: 0; background: transparent; text-align: left; cursor: pointer; }
.profile-row > span:nth-child(2) { display: grid; gap: 2px; }
.avatar { display: grid; width: 34px; height: 34px; place-items: center; border-radius: 50%; background: #d6c7a6; color: #594622; font-size: 10px; font-weight: 800; }

.workspace { min-width: 0; }
.topbar { height: 68px; display: flex; align-items: center; gap: 13px; padding: 0 34px; border-bottom: 1px solid var(--line); background: rgba(251,250,246,.78); backdrop-filter: blur(10px); }
.search-box { width: min(460px, 55vw); display: flex; align-items: center; gap: 10px; font-weight: 400; }
.search-box input { min-height: 38px; border: 0; padding: 0; background: transparent; }
.search-box input:focus { outline: 0; }
kbd { margin-left: auto; border: 1px solid var(--line); border-radius: 5px; padding: 3px 7px; background: white; color: #92948e; font: 10px inherit; white-space: nowrap; }
.voice-button, .compact-new-button { margin-left: auto; border: 0; border-radius: 8px; cursor: pointer; }
.voice-button { min-height: 38px; padding: 0 15px; background: var(--green-soft); color: var(--green); font-size: 12px; font-weight: 800; }
.mic-dot { display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: #cf5c4c; }
.voice-button.listening .mic-dot, .toolbar-voice.listening { animation: pulse 1s infinite; }
.compact-new-button { display: none; width: 38px; height: 38px; background: var(--green); color: white; }

.content { position: relative; min-height: calc(100vh - 68px); padding: 45px clamp(24px, 4vw, 65px) 110px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.page-heading h2 { margin: 8px 0 7px; font: 800 clamp(30px, 4vw, 46px)/1 "Manrope", sans-serif; letter-spacing: -.05em; }
.page-heading p { margin: 0; color: var(--muted); }
.view-actions { display: flex; gap: 7px; }
.soft-button { min-height: 37px; border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; background: rgba(255,255,255,.63); font-size: 12px; font-weight: 700; cursor: pointer; }
.soft-button.wide { width: 100%; margin-top: 8px; }
.tag-filters { display: flex; flex-wrap: wrap; gap: 7px; margin: 27px 0 20px; }
.tag-filter { border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; background: transparent; color: #696e67; font-size: 11px; cursor: pointer; }
.tag-filter.active { border-color: var(--green); background: var(--green); color: white; }

.ideas-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.idea-card {
  position: relative;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(78,81,72,.13);
  border-radius: 12px;
  padding: 20px;
  background: var(--card-color, #ece9df);
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}
.idea-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(42,46,40,.09); }
.idea-card.priority::before { content: ""; position: absolute; width: 8px; height: 8px; right: 18px; top: 18px; border-radius: 50%; background: var(--amber); box-shadow: 0 0 0 4px rgba(231,163,29,.13); }
.card-top { display: flex; align-items: center; gap: 8px; padding-right: 20px; color: #6b6f68; font-size: 10px; font-weight: 800; letter-spacing: .09em; }
.idea-card h3 { margin: 15px 0 9px; font: 800 20px/1.18 "Manrope", sans-serif; letter-spacing: -.025em; }
.idea-card p { display: -webkit-box; overflow: hidden; margin: 0; color: #62675f; font-size: 13px; line-height: 1.55; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: auto; padding-top: 20px; color: #797d76; font-size: 10px; }
.card-tag { border-radius: 999px; padding: 4px 8px; background: rgba(255,255,255,.55); }
.shared-mark { margin-left: auto; }
.empty-state { grid-column: 1 / -1; display: grid; place-items: center; min-height: 330px; border: 1px dashed #c9c8bf; border-radius: 14px; text-align: center; color: var(--muted); }
.empty-state strong { display: block; margin-bottom: 8px; color: var(--ink); font: 800 22px "Manrope", sans-serif; }
.floating-new-button { position: fixed; right: 34px; bottom: 28px; min-height: 47px; border: 0; border-radius: 24px; padding: 0 20px; background: var(--green); color: white; font-weight: 800; box-shadow: 0 10px 28px rgba(23,79,59,.25); cursor: pointer; }

dialog { border: 0; padding: 0; background: transparent; color: var(--ink); }
dialog::backdrop { background: rgba(19,26,21,.45); backdrop-filter: blur(3px); }
.editor-dialog { width: min(1180px, calc(100% - 34px)); max-width: none; border-radius: 16px; }
.editor-shell { max-height: calc(100vh - 34px); overflow: auto; background: var(--paper); }
.editor-header { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; min-height: 65px; padding: 0 25px; border-bottom: 1px solid var(--line); background: rgba(251,250,246,.96); }
.editor-header > div:first-child { display: grid; gap: 3px; }
#saveStatus { color: #858a82; font-size: 10px; }
.editor-actions { display: flex; gap: 8px; }
.icon-button { width: 37px; height: 37px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 20px; cursor: pointer; }
.editor-body { display: grid; grid-template-columns: minmax(0, 1fr) 235px; }
.editor-main { min-height: 660px; padding: 48px clamp(28px, 6vw, 86px); border-right: 1px solid var(--line); }
.title-input { min-height: auto; border: 0; border-radius: 0; padding: 0; background: transparent; font: 800 clamp(31px, 4vw, 48px)/1.1 "Manrope", sans-serif; letter-spacing: -.045em; }
.title-input:focus { outline: 0; }
.idea-meta-row { display: grid; grid-template-columns: auto 170px 1fr; gap: 8px; margin: 25px 0; }
.meta-button, .meta-select, .tags-input { min-height: 36px; border: 1px solid var(--line); border-radius: 7px; background: white; font-size: 11px; }
.meta-button { padding: 0 10px; cursor: pointer; }
.meta-button.high { border-color: #e2b34b; background: #fff6de; color: #7b5810; }
.editor-toolbar { display: flex; align-items: center; gap: 3px; padding: 7px; border-block: 1px solid var(--line); }
.editor-toolbar button { min-width: 32px; height: 30px; border: 0; border-radius: 5px; background: transparent; font-size: 11px; cursor: pointer; }
.editor-toolbar button:hover { background: #eeece6; }
.editor-toolbar span { flex: 1; }
.idea-content { min-height: 270px; padding: 25px 3px; outline: 0; font-size: 16px; line-height: 1.75; }
.idea-content:empty::before { content: attr(data-placeholder); color: #a2a49e; }
.canvas-panel { margin-top: 20px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: white; }
.canvas-toolbar { display: flex; align-items: center; gap: 16px; min-height: 48px; padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 11px; }
.canvas-toolbar label { display: flex; align-items: center; gap: 5px; }
.canvas-toolbar input[type="color"] { width: 28px; min-height: 26px; padding: 2px; }
.canvas-toolbar input[type="range"] { width: 85px; min-height: 26px; padding: 0; }
.canvas-toolbar button { margin-left: auto; border: 0; background: transparent; cursor: pointer; }
#drawingCanvas { display: block; width: 100%; height: 300px; touch-action: none; background-image: radial-gradient(#d7d8d2 1px, transparent 1px); background-size: 18px 18px; cursor: crosshair; }
.editor-side { display: flex; flex-direction: column; gap: 12px; padding: 27px 20px; background: #f3f0e9; }
.insight-card, .detail-card { border-radius: 10px; padding: 17px; background: white; }
.insight-card span, .detail-card span { display: block; margin-bottom: 10px; color: #99835b; font-size: 9px; font-weight: 800; letter-spacing: .14em; }
.insight-card strong { display: block; font: 700 14px/1.5 "Manrope", sans-serif; }
.insight-card button { margin-top: 13px; border: 0; padding: 0; background: transparent; color: var(--green); font-size: 10px; font-weight: 800; cursor: pointer; }
.detail-card strong { font-size: 12px; }
.archive-button, .delete-button { min-height: 39px; border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 11px; cursor: pointer; }
.archive-button { margin-top: auto; }
.delete-button { color: #a14545; }

.small-dialog { width: min(450px, calc(100% - 32px)); border-radius: 15px; }
.small-dialog form { position: relative; display: grid; gap: 15px; padding: 31px; background: var(--paper); }
.small-dialog h3 { margin: 0; font: 800 28px "Manrope", sans-serif; letter-spacing: -.04em; }
.small-dialog p { margin: -8px 0 4px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.dialog-close { position: absolute; right: 16px; top: 13px; border: 0; background: transparent; font-size: 23px; cursor: pointer; }
.shared-people { display: grid; gap: 7px; }
.shared-person, .access-person { display: grid; grid-template-columns: 34px 1fr auto; gap: 9px; align-items: center; padding: 9px; border-radius: 8px; background: #efede7; font-size: 11px; }
.shared-person span:nth-child(2), .access-person span:nth-child(2) { display: grid; gap: 2px; }
.shared-person small, .access-person small { color: var(--muted); }
.shared-person button { border: 0; background: transparent; color: #a14545; cursor: pointer; }
.toast { position: fixed; z-index: 20; left: 50%; bottom: 25px; transform: translate(-50%, 20px); padding: 11px 16px; border-radius: 8px; background: #1d2821; color: white; font-size: 12px; opacity: 0; pointer-events: none; transition: .2s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }

@keyframes pulse { 50% { opacity: .35; } }

@media (max-width: 1050px) {
  .ideas-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  body { overflow-x: hidden; }
  .mobile-only { display: grid; place-items: center; }
  .login-view { min-height: 100svh; grid-template-columns: 1fr; }
  .login-art { min-height: 210px; padding: 28px 24px; }
  .login-art p { max-width: 330px; font-size: clamp(34px, 10vw, 45px); }
  .login-card { width: min(440px, calc(100% - 36px)); padding: 36px 0 max(36px, env(safe-area-inset-bottom)); }
  .login-card h1 { font-size: 38px; }
  .login-card input, .login-card .primary-button { min-height: 50px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; z-index: 10; left: 0; transform: translateX(-105%); width: min(300px, 88vw); padding-bottom: max(14px, env(safe-area-inset-bottom)); transition: transform .2s ease; box-shadow: 10px 0 30px rgba(0,0,0,.13); }
  .sidebar.open { transform: translateX(0); }
  .topbar { position: sticky; top: 0; z-index: 5; height: 62px; padding: 0 12px; gap: 8px; }
  .topbar .icon-button { flex: 0 0 40px; width: 40px; height: 40px; }
  .search-box { flex: 1; width: auto; }
  .search-box kbd { display: none; }
  .search-box input { min-width: 0; font-size: 16px; }
  .voice-button { padding: 0 11px; font-size: 0; }
  .voice-button .mic-dot { margin: 0; }
  .compact-new-button { display: block; flex: 0 0 40px; width: 40px; height: 40px; margin-left: 0; }
  .content { min-height: calc(100svh - 62px); padding: 30px 16px calc(100px + env(safe-area-inset-bottom)); }
  .page-heading { align-items: flex-start; }
  .page-heading h2 { font-size: clamp(31px, 10vw, 42px); }
  .page-heading p { max-width: 34ch; font-size: 14px; line-height: 1.45; }
  .view-actions { display: none; }
  .tag-filters { flex-wrap: nowrap; overflow-x: auto; margin: 23px -16px 18px; padding: 0 16px 5px; scrollbar-width: none; }
  .tag-filters::-webkit-scrollbar { display: none; }
  .tag-filter { flex: 0 0 auto; min-height: 34px; }
  .ideas-grid { grid-template-columns: 1fr; }
  .idea-card { min-height: 205px; padding: 19px; }
  .idea-card:hover { transform: none; box-shadow: none; }
  .card-foot { flex-wrap: wrap; row-gap: 8px; }
  .floating-new-button { right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); min-height: 50px; }
  .editor-dialog { width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .editor-shell { max-height: 100svh; min-height: 100svh; }
  .editor-header { min-height: 60px; padding: 0 12px; }
  .editor-header .eyebrow { display: none; }
  .editor-actions .soft-button { padding: 0 10px; }
  .editor-body { grid-template-columns: 1fr; }
  .editor-main { min-height: 0; padding: 28px 17px 34px; border-right: 0; }
  .title-input { font-size: clamp(30px, 9vw, 42px); }
  .idea-meta-row { grid-template-columns: 1fr; }
  .meta-button, .meta-select, .tags-input { min-height: 44px; font-size: 13px; }
  .editor-toolbar { margin-inline: -4px; overflow-x: auto; }
  .editor-toolbar button { flex: 0 0 auto; min-width: 38px; height: 38px; }
  .editor-toolbar span { min-width: 8px; }
  .idea-content { min-height: 235px; font-size: 17px; }
  .canvas-toolbar { flex-wrap: wrap; gap: 9px 13px; padding: 10px 12px; }
  .canvas-toolbar strong { width: 100%; }
  .canvas-toolbar button { min-height: 34px; }
  #drawingCanvas { height: 260px; }
  .editor-side { min-height: 300px; }
  .small-dialog { width: calc(100% - 24px); max-height: calc(100svh - 24px); }
  .small-dialog form { max-height: calc(100svh - 24px); overflow-y: auto; padding: 29px 21px calc(24px + env(safe-area-inset-bottom)); }
  .small-dialog input, .small-dialog select, .small-dialog .primary-button { min-height: 48px; }
  .toast { bottom: max(16px, env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 32px); text-align: center; }
}

@media (max-width: 390px) {
  .voice-button { display: none; }
  .floating-new-button span { display: none; }
  .floating-new-button { width: 50px; padding: 0; }
  .editor-actions .soft-button { font-size: 0; width: 39px; padding: 0; }
  .editor-actions .soft-button::first-letter { font-size: 16px; }
}
