:root {
  --paper: #f5f0e5;
  --surface: #fffdf8;
  --ink: #1f2828;
  --muted: #647078;
  --line: #d9ddd5;
  --accent: #2d7882;
  --accent-soft: #dcebed;
  --deep-green: #345943;
  --warning: #8b642e;
  --warning-soft: #f7f0e4;
  --danger: #9b4a45;
  --danger-soft: #f8e9e7;
  --shadow: 0 12px 34px rgb(31 41 34 / 12%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; background: var(--paper); }
button, input, select { font: inherit; }
button, select { color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible {
  outline: 3px solid #74a6a5;
  outline-offset: 2px;
}
[hidden] { display: none !important; }

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background-image: linear-gradient(135deg, rgb(239 244 239 / 70%), rgb(246 239 224 / 66%)), url("/static/quy-nhon-coast.png");
  background-size: cover;
  background-position: center;
}
.login-card {
  width: min(100%, 420px);
  padding: 36px clamp(24px, 7vw, 48px) 30px;
  border: 1px solid rgb(255 255 255 / 85%);
  border-radius: 18px;
  background: rgb(255 253 248 / 94%);
  box-shadow: var(--shadow);
  text-align: center;
  backdrop-filter: blur(10px);
}
.login-logo { display: block; width: 72px; height: 72px; object-fit: contain; margin: 0 auto 16px; border-radius: 50%; background: #fff; }
.login-card .eyebrow { margin: 0 0 7px; color: var(--deep-green); }
.login-card h1 { margin: 0; font-family: "Segoe Script", "Brush Script MT", cursive; font-size: 38px; font-weight: 500; letter-spacing: -.045em; }
.login-intro { margin: 14px 0 23px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.google-login-button {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid #cbd2cb;
  border-radius: 8px;
  background: #fff;
  color: #24352d;
  font-size: 14px;
  font-weight: 650;
  text-decoration: none;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.google-login-button:hover { border-color: #789581; box-shadow: 0 4px 13px rgb(31 41 34 / 10%); transform: translateY(-1px); }
.google-login-button.is-disabled { color: #66716c; background: #f4f4f0; cursor: not-allowed; }
.login-setup, .login-message { margin: 15px 0 0; padding: 10px 12px; border-radius: 7px; font-size: 12px; line-height: 1.55; }
.login-setup { background: #f4f0e7; color: #655842; }
.login-message { background: var(--danger-soft); color: var(--danger); }
.login-footnote { margin: 23px 0 0; color: var(--muted); font-size: 11px; }

.hero {
  position: relative;
  height: 312px;
  background-image: linear-gradient(90deg, rgb(246 243 232 / 66%), rgb(246 243 232 / 5%) 55%), url("/static/quy-nhon-coast.png");
  background-size: cover;
  background-position: center 69%;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgb(255 252 242 / 12%), transparent 74%, rgb(35 54 46 / 13%));
}
.hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  height: 100%;
  padding: 30px clamp(22px, 5vw, 78px);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 17px;
  color: #1d3134;
  text-decoration: none;
}
.brand-copy { display: grid; justify-items: start; }
.brand-title {
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: clamp(43px, 5.2vw, 68px);
  line-height: .95;
  font-weight: 500;
  letter-spacing: -.075em;
  text-shadow: 0 1px 12px rgb(255 255 255 / 45%);
}
.brand-subtitle {
  padding: 8px 0 0 14px;
  color: #253c3e;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .31em;
}
.brand-logo {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border: 3px solid rgb(255 255 255 / 93%);
  border-radius: 50%;
  background: white;
  box-shadow: 0 3px 14px rgb(31 41 34 / 15%);
}
.hero-actions { display: flex; gap: 13px; }
.round-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  padding: 0;
  border: 1px solid rgb(255 255 255 / 80%);
  border-radius: 50%;
  color: #273436;
  background: rgb(255 253 247 / 88%);
  box-shadow: 0 4px 14px rgb(31 41 34 / 12%);
  backdrop-filter: blur(8px);
  transition: transform .16s ease, background .16s ease;
}
.round-button:hover { transform: translateY(-2px); background: #fffdf8; }
.round-button:disabled { cursor: wait; opacity: .7; transform: none; }
.round-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.status-dot {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 12px;
  height: 12px;
  border: 2px solid #fffdf8;
  border-radius: 50%;
  background: #bd914d;
}
.status-dot.is-ready { background: #548264; }
.status-dot.is-error { background: var(--danger); }

.workspace {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: clamp(245px, 21.5vw, 330px) minmax(0, 1fr);
  min-height: calc(100vh - 312px);
  margin-top: 0;
  overflow: hidden;
  border-radius: 29px 29px 0 0;
  background: var(--surface);
}
.sidebar {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
  padding: 34px clamp(17px, 2vw, 30px) 28px;
  background-color: #f4efe4;
  background-image: url("/static/quy-nhon-watercolor.png");
  background-repeat: no-repeat;
  background-position: center bottom;
  background-size: 100% auto;
}
.side-nav { display: grid; gap: 9px; }
.nav-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 57px;
  width: 100%;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  color: #202b2c;
  background: transparent;
  text-align: left;
  font-size: 16px;
  transition: color .16s ease, background .16s ease, transform .16s ease;
}
.nav-item:hover { background: rgb(255 255 255 / 65%); transform: translateX(2px); }
.nav-item.is-active {
  color: white;
  background: #2d7882;
  box-shadow: 0 7px 18px rgb(34 94 103 / 20%);
  font-weight: 620;
}
.nav-icon {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-label { min-width: 0; }
.nav-count {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  color: #2b3738;
  background: rgb(37 48 48 / 10%);
  font-size: 14px;
  font-weight: 500;
}
.nav-item.is-active .nav-count { color: white; background: rgb(255 255 255 / 23%); }
.sidebar-signature {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: auto;
  padding: 0 3px 2px;
  color: #1e3235;
}
.sidebar-signature span {
  font-family: "Segoe Script", "Brush Script MT", cursive;
  font-size: 25px;
  font-style: italic;
  transform: rotate(-5deg);
}
.sidebar-signature img {
  width: 45px;
  height: 45px;
  border: 2px solid white;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 2px 8px rgb(31 41 34 / 12%);
}

.main-content {
  width: 100%;
  min-width: 0;
  padding: 45px clamp(20px, 2.6vw, 42px) 64px;
  background: rgb(255 253 248 / 96%);
  border-radius: 29px 0 0 0;
}
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.eyebrow { margin: 0 0 8px; font-size: 10px; font-weight: 700; letter-spacing: .1em; color: #879084; }
h1 { margin: 0; font-size: clamp(24px, 3vw, 31px); letter-spacing: -.045em; font-weight: 650; }
.count-label, .subtle-line { color: var(--muted); font-size: 12px; }
.filter-bar {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) minmax(160px, 198px) minmax(150px, 198px) auto;
  align-items: center;
  gap: 14px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--line);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  height: 52px;
  padding: 0 14px;
  border: 1px solid #d9dbd4;
  border-radius: 12px;
  background: rgb(255 255 255 / 65%);
  box-shadow: inset 0 1px 2px rgb(38 50 45 / 3%);
}
.search-box svg, .filter-control svg {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.search-box svg { color: #222e30; }
.search-box input {
  width: 100%;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  outline: none;
  color: var(--ink);
  background: transparent;
  font-size: 14px;
}
.search-box input:focus-visible { outline: none; }
.search-box input::placeholder { color: #7b8180; }
kbd {
  flex: 0 0 auto;
  color: #6f7775;
  font: 11px ui-monospace, SFMono-Regular, monospace;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 6px;
}
.filter-control { position: relative; display: flex; align-items: center; min-width: 0; }
.filter-control svg { position: absolute; left: 14px; z-index: 1; pointer-events: none; color: #202b2c; }
.filter-control select, .sort-control select, .mobile-filter select {
  border: 1px solid #d9dbd4;
  border-radius: 12px;
  background-color: rgb(255 255 255 / 65%);
  padding: 0 32px 0 43px;
  height: 52px;
  font-size: 14px;
  max-width: none;
}
.filter-control select { width: 100%; appearance: none; }
.filter-control::after {
  content: "";
  position: absolute;
  right: 14px;
  width: 8px;
  height: 8px;
  border-right: 1.7px solid currentColor;
  border-bottom: 1.7px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}
.view-toggle { display: flex; gap: 7px; }
.view-toggle-button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid #d9dbd4;
  border-radius: 12px;
  color: #293537;
  background: rgb(255 255 255 / 65%);
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.view-toggle-button:hover { border-color: #8da79b; }
.view-toggle-button.is-active { color: white; border-color: var(--deep-green); background: var(--deep-green); }
.view-toggle-button svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.idea-list { margin-top: 0; }
.idea-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) minmax(82px, auto) 145px 20px;
  gap: 18px;
  align-items: center;
  width: 100%;
  min-height: 84px;
  padding: 17px 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  text-align: left;
  transition: background .14s ease;
}
.idea-row:hover { background: rgb(228 237 230 / 44%); }
.idea-dot {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #2195a4;
}
.idea-dot[data-color="1"] { background: #d4a242; }
.idea-dot[data-color="2"] { background: #cc6938; }
.idea-dot[data-color="3"] { background: #27815f; }
.idea-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  min-width: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(16px, 1.45vw, 20px);
  font-weight: 600;
  line-height: 1.3;
}
.idea-category, .idea-date { color: var(--muted); font-size: 14px; white-space: nowrap; }
.idea-category { text-align: right; }
.idea-date { text-align: right; }
.row-more { color: #1d2829; font-size: 25px; line-height: 1; text-align: right; }
.level-pill, .origin-pill, .event-pill, .asset-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 620;
  white-space: nowrap;
  background: #eef0ed;
  color: #616a60;
}
.level-pill[data-level="light"] { color: #365846; background: #dfe9df; }
.level-pill[data-level="medium"] { color: #7b602e; background: #f4efe1; }
.level-pill[data-level="heavy"] { color: #675883; background: #f0ebf5; }
.origin-pill { color: #7b602e; background: var(--warning-soft); }
.idea-list.is-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 14px;
}
.idea-list.is-grid .idea-row {
  grid-template-columns: 18px minmax(0, 1fr) 20px;
  grid-template-rows: auto auto auto;
  min-height: 150px;
  padding: 22px 18px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.idea-list.is-grid .idea-dot { grid-column: 1; grid-row: 1; align-self: start; margin-top: 4px; }
.idea-list.is-grid .idea-main { grid-column: 2 / 4; grid-row: 1; }
.idea-list.is-grid .idea-category { grid-column: 2; grid-row: 2; margin-top: 12px; text-align: left; }
.idea-list.is-grid .idea-date { grid-column: 2; grid-row: 3; align-self: end; text-align: left; font-size: 11px; }
.idea-list.is-grid .row-more { grid-column: 3; grid-row: 1; align-self: start; }
.empty-state { padding: 56px 18px; text-align: center; border: 1px dashed #cfd5ce; border-radius: 9px; margin-top: 15px; color: var(--muted); }
.empty-state h2 { color: var(--ink); font-size: 16px; margin: 0 0 8px; }
.empty-state p { margin: 0; font-size: 13px; }
.message-card { margin: 10px 0 15px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); font-size: 12px; line-height: 1.55; white-space: pre-line; }
.message-card.is-error { color: var(--danger); border-color: #ebcbc7; background: var(--danger-soft); }
.message-card.is-warn { color: var(--warning); border-color: #ebdec3; background: var(--warning-soft); }

.detail-panel { position: sticky; top: 26px; height: calc(100vh - 26px); overflow: auto; padding: 20px 22px 38px; border-left: 1px solid var(--line); background: var(--surface); }
.workspace:has(.detail-panel:not([hidden])) { grid-template-columns: clamp(245px, 21.5vw, 330px) minmax(360px, 1fr) minmax(340px, 430px); }
.detail-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.icon-button { border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--muted); padding: 6px 9px; font-size: 11px; }
.detail-title { margin: 0 0 10px; font-size: 22px; line-height: 1.25; letter-spacing: -.035em; }
.detail-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.detail-section { border-top: 1px solid var(--line); padding: 14px 0; }
.detail-section h3 { margin: 0 0 8px; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.detail-section p, .detail-section li { margin: 0; font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.detail-section ul { margin: 0; padding-left: 19px; display: grid; gap: 5px; }
.quote-list { display: grid; gap: 7px; }
.quote-block { margin: 0; border-left: 2px solid #b7c5b8; padding-left: 10px; color: #465147; font-size: 12px; white-space: pre-wrap; }
.detail-links a, .asset-download { color: var(--accent); font-size: 12px; overflow-wrap: anywhere; }
.asset-card { border: 1px solid var(--line); border-radius: 7px; padding: 10px; margin-top: 8px; background: #fbfcfa; }
.asset-card img { display: block; max-width: 100%; max-height: 240px; object-fit: contain; border-radius: 4px; margin-bottom: 8px; }
.asset-filename { font-weight: 600; font-size: 12px; overflow-wrap: anywhere; }
.asset-description { color: var(--muted); margin-top: 6px !important; font-size: 11px !important; }
.asset-pill { margin-top: 8px; background: var(--warning-soft); color: var(--warning); }
.asset-pill.is-ready { color: #46634c; background: var(--accent-soft); }
.settings-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.setting-row { display: grid; grid-template-columns: minmax(140px, 220px) 1fr; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.setting-row strong { color: var(--muted); font-weight: 550; }
.setting-row span { overflow-wrap: anywhere; }
.logout-button { margin-top: 18px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--danger); font-size: 12px; }
.logout-button:hover { border-color: #ca9a95; background: var(--danger-soft); }
.logout-button:disabled { opacity: .6; cursor: wait; }
.settings-help { max-width: 700px; margin-top: 27px; padding: 17px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.settings-help h2 { font-size: 14px; margin: 0 0 8px; }
.settings-help p { font-size: 12px; line-height: 1.6; color: var(--muted); margin: 6px 0; }
.sort-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.activity-list { border-top: 1px solid var(--line); }
.activity-row { display: grid; grid-template-columns: 150px minmax(100px, 1fr) minmax(130px, 1.4fr); gap: 14px; padding: 13px 6px; border-bottom: 1px solid var(--line); font-size: 11px; }
.activity-time { color: var(--muted); }
.activity-detail { color: var(--muted); line-height: 1.5; overflow-wrap: anywhere; }
.event-pill[data-outcome="invalid"], .event-pill[data-outcome="failed"] { color: var(--danger); background: var(--danger-soft); }
.event-pill[data-outcome="imported"] { color: #46634c; background: var(--accent-soft); }
.event-pill[data-outcome="already_imported"] { color: #6b6550; background: #f1f0e9; }
.toast { position: fixed; z-index: 30; bottom: 20px; left: 50%; transform: translateX(-50%); max-width: min(600px, calc(100vw - 32px)); padding: 11px 15px; color: #fff; background: #27342b; border-radius: 7px; box-shadow: var(--shadow); font-size: 12px; }
.mobile-filter { display: none; }
.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; }

@media (max-width: 1080px) {
  .workspace, .workspace:has(.detail-panel:not([hidden])) { grid-template-columns: 245px minmax(0, 1fr); }
  .detail-panel { position: fixed; z-index: 20; top: 20px; right: 0; width: min(470px, 100vw); height: calc(100vh - 20px); box-shadow: var(--shadow); }
  .main-content { padding-right: 24px; padding-left: 24px; }
  .filter-bar { grid-template-columns: minmax(170px, 1fr) minmax(135px, .75fr) minmax(135px, .75fr) auto; gap: 9px; }
  .idea-row { grid-template-columns: 16px minmax(0, 1fr) 78px 118px 18px; gap: 10px; }
  .idea-title { font-size: 17px; gap: 9px; }
  .idea-category, .idea-date { font-size: 12px; }
}
@media (max-width: 760px) {
  .hero { height: 220px; background-position: center 66%; }
  .hero-inner { padding: 20px 17px; }
  .brand { gap: 10px; }
  .brand-title { font-size: 41px; }
  .brand-subtitle { padding: 6px 0 0 8px; font-size: 9px; }
  .brand-logo { width: 48px; height: 48px; border-width: 2px; }
  .hero-actions { gap: 7px; }
  .round-button { width: 43px; height: 43px; }
  .round-button svg { width: 20px; height: 20px; }
  .workspace, .workspace:has(.detail-panel:not([hidden])) { display: block; min-height: calc(100vh - 220px); margin-top: 0; overflow: visible; }
  .sidebar { display: none; }
  .main-content { min-height: calc(100vh - 200px); padding: 22px 16px 45px; border-radius: 20px 20px 0 0; }
  .mobile-filter { display: flex; align-items: center; gap: 9px; margin: 0 0 17px; color: var(--muted); font-size: 11px; }
  .mobile-filter select { flex: 1; max-width: none; height: 38px; padding: 0 10px; border-radius: 8px; }
  .filter-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; padding-bottom: 17px; }
  .search-box { grid-column: 1 / -1; height: 46px; }
  .search-box input { font-size: 12px; }
  .filter-control select { height: 43px; padding: 0 22px 0 34px; font-size: 11px; border-radius: 9px; }
  .filter-control svg { left: 10px; width: 17px; height: 17px; }
  .filter-control::after { right: 10px; width: 6px; height: 6px; }
  .view-toggle { grid-column: 3; gap: 5px; }
  .view-toggle-button { width: 39px; height: 43px; border-radius: 9px; }
  .view-toggle-button svg { width: 18px; height: 18px; }
  .idea-row { grid-template-columns: 14px minmax(0, 1fr) 18px; grid-template-rows: auto auto; gap: 4px 9px; min-height: 72px; padding: 13px 4px; }
  .idea-dot { width: 12px; height: 12px; grid-column: 1; grid-row: 1; margin-top: 6px; }
  .idea-main { grid-column: 2; grid-row: 1; }
  .idea-category { display: none; }
  .idea-date { grid-column: 2; grid-row: 2; text-align: left; font-size: 10px; }
  .row-more { grid-column: 3; grid-row: 1 / span 2; align-self: start; }
  .idea-title { font-size: 15px; gap: 8px; }
  .idea-list.is-grid { grid-template-columns: 1fr; }
  .idea-list.is-grid .idea-row { min-height: 112px; }
  .idea-list.is-grid .idea-date { display: block; }
  .detail-panel { top: 16px; width: 100vw; height: calc(100vh - 16px); padding: 17px 15px 36px; }
  .page-heading { align-items: center; margin-bottom: 17px; }
  .activity-row { grid-template-columns: 1fr auto; gap: 5px 8px; }
  .activity-detail { grid-column: 1 / -1; }
  .setting-row { grid-template-columns: 1fr; gap: 4px; }
  .sort-control { gap: 5px; }
  .sort-control select { max-width: 125px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

