* {
  box-sizing: border-box;
}
:root {
  --size: 17px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #f7f5ef;
  --card: #fff;
  --text: #242b29;
  --muted: #6e7670;
  --line: #e3e5db;
  --accent: #e9b949;
  --soft: #f1eddf;
  --danger: #b43b32;
  color-scheme: light;
  font-size: var(--size);
  font-family: var(--font);
}
:root[data-theme="dark"] {
  --bg: #151a18;
  --card: #202722;
  --text: #f2f2e9;
  --muted: #a8b3aa;
  --line: #374139;
  --soft: #2b332b;
  --danger: #ff9b90;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --bg: #151a18;
    --card: #202722;
    --text: #f2f2e9;
    --muted: #a8b3aa;
    --line: #374139;
    --soft: #2b332b;
    --danger: #ff9b90;
    color-scheme: dark;
  }
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button {
  cursor: pointer;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.9rem;
  min-height: 46px;
  overflow-wrap: anywhere;
}
button:hover {
  border-color: #9b8c55;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.5;
}
h1,
h2,
h3,
p {
  margin: 0 0 0.7rem;
}
h1 {
  font-size: 2rem;
  line-height: 1.18;
  letter-spacing: -0.04em;
}
h2 {
  font-size: 1.15rem;
  line-height: 1.35;
}
h3 {
  font-size: 1.1rem;
  line-height: 1.4;
}
small,
.muted {
  color: var(--muted);
  font-size: 0.85rem;
}
a {
  color: inherit;
  overflow-wrap: anywhere;
}
strong {
  font-weight: 650;
}
.shell {
  max-width: 1050px;
  margin: auto;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg);
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 6px 32px;
}
.brand {
  display: flex;
  flex-shrink: 0;
  gap: 12px;
  align-items: center;
  border: 0;
  background: none;
  padding: 0;
  text-align: left;
  font-size: 1.2rem;
  font-weight: 750;
}
.brand img {
  height: 64px;
  width: 64px;
  border-radius: 12px;
}
.brand small {
  display: block;
  font-weight: 400;
  font-size: 0.65rem;
  letter-spacing: 0;
}
.quiet {
  background: transparent;
  border-color: transparent;
}
.icon {
  padding: 0.3rem 0.8rem;
}
.primary {
  background: var(--accent);
  color: #272714;
  border-color: var(--accent);
  font-weight: 650;
}
.danger {
  color: var(--danger);
}
main {
  padding: 36px 32px max(36px, env(safe-area-inset-bottom));
}
.hero {
  padding: 17px 0 30px;
  max-width: 620px;
}
.eyebrow {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 12px;
}
.hero h1 {
  font-size: 2.65rem;
}
.hero h1 span {
  color: #8b753d;
}
.hero p {
  color: var(--muted);
  max-width: 440px;
  margin-top: 16px;
  font-size: 0.94rem;
}
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 0 20px;
  flex-wrap: wrap;
}
.toolbar h2,
.toolbar h1 {
  margin: 0;
}
.count {
  font-size: 0.72rem;
  background: var(--soft);
  padding: 3px 9px;
  border-radius: 20px;
  vertical-align: middle;
}
.collection {
  display: grid;
  gap: 16px;
}
.collection.grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.collection.list {
  grid-template-columns: 1fr;
}
.tile {
  position: relative;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
}
.tile-open {
  display: flex;
  flex-direction: column;
  width: 100%;
  border: 0;
  border-radius: 0;
  align-items: flex-start;
  text-align: left;
  padding: 24px 21px;
  min-height: 175px;
}
.tile-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--soft);
  color: #9a7e2f;
  font-size: 1.5rem;
  margin-bottom: 22px;
}
.tile strong {
  font-size: 1.15rem;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}
.tile .muted {
  font-size: 0.7rem;
}
.more {
  position: absolute;
  right: 9px;
  top: 10px;
  border: 0;
  background: none;
  font-size: 1.1rem;
  padding: 0.2rem 0.6rem;
  letter-spacing: 1px;
}
.new-tile {
  border: 1.5px dashed #c7c9ba;
  background: transparent;
  color: var(--muted);
  min-height: 175px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  font-size: 0.85rem;
  border-radius: 18px;
}
.new-tile > span {
  font-size: 2rem;
  font-weight: 300;
}
.list .tile-open {
  min-height: 95px;
  padding: 16px 20px;
  display: grid;
  grid-template-columns: 48px 1fr;
  gap: 2px 14px;
}
.list .tile-symbol {
  grid-row: span 2;
  margin: 0;
}
.list .tile .muted {
  grid-column: 2;
}
.list .new-tile {
  min-height: 80px;
  flex-direction: row;
}
.system-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 30px;
}
.system-cards button {
  display: grid;
  grid-template-columns: 35px 1fr 20px;
  gap: 0 12px;
  text-align: left;
  padding: 20px;
  border-radius: 16px;
  background: var(--soft);
  border: 0;
}
.system-cards button > span {
  grid-row: span 2;
  font-size: 1.6rem;
}
.system-cards small {
  grid-column: 2;
  font-size: 0.7rem;
}
.system-cards b {
  grid-column: 3;
  grid-row: 1 / span 2;
  font-weight: 400;
}
.local-info {
  color: var(--muted);
  font-size: 0.7rem;
  margin: 26px 0;
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #6c8d5e;
  border-radius: 50%;
  margin-right: 6px;
}
.panel {
  padding: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  margin: 20px 0;
}
.panel p {
  font-size: 0.9rem;
}
.actions,
.inline {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.inline select {
  flex: 1;
  min-width: 0;
}
.record {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.record-open {
  text-align: left;
  display: block;
  width: 100%;
  border: 0;
  padding: 20px;
  background: none;
}
.record p {
  font-size: 0.85rem;
  color: var(--muted);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.record h3 {
  overflow-wrap: anywhere;
}
.record .eyebrow {
  font-size: 0.6rem;
}
.bought {
  margin: 0 14px 14px;
  background: var(--soft);
}
.empty {
  color: var(--muted);
  padding: 30px 4px;
  font-size: 0.9rem;
}
.breadcrumb {
  margin-bottom: 15px;
}
.section-heading {
  margin: 32px 0 16px;
}
label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 18px;
}
input,
select,
textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-size: max(16px, 1rem);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  margin-top: 7px;
}
textarea {
  resize: vertical;
}
input[type="range"] {
  padding: 10px 0;
}
input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  margin: 0;
}
.check {
  display: flex;
  align-items: center;
  gap: 10px;
}
.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  padding: 0.65rem 0.9rem;
  min-height: 46px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  background: var(--card);
  margin: 0;
}
.file-button input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.file-button:focus-within {
  outline: 3px solid var(--accent);
}
dialog {
  --dialog-padding: 24px;
  width: min(94vw, 650px);
  max-height: 88dvh;
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  color: var(--text);
  box-shadow: 0 24px 100px #0005;
}
dialog::backdrop {
  background: #101a1870;
  backdrop-filter: blur(3px);
}
dialog header {
  position: sticky;
  top: calc(-1 * var(--dialog-padding));
  z-index: 6;
  background: var(--card);
  margin: calc(-1 * var(--dialog-padding)) calc(-1 * var(--dialog-padding)) 20px;
  padding: 16px var(--dialog-padding);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
}
dialog header h2 {
  margin: 0;
  overflow-wrap: anywhere;
}
dialog footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  flex-wrap: wrap;
}
.menu {
  display: grid;
  gap: 8px;
}
.menu > button {
  text-align: left;
}
.attachment-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.attachment-row > span,
.attachment-row > button:first-child,
.attachment-row > a {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
.link-row {
  background: var(--soft);
  padding: 12px;
  border-radius: 12px;
  margin-bottom: 10px;
}
.note-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.preview {
  width: 100%;
  max-height: 60dvh;
  object-fit: contain;
}
.pdf {
  width: 100%;
  height: 60dvh;
  border: 0;
}
.warning {
  background: var(--soft);
  padding: 12px;
  border-left: 3px solid var(--accent);
}
.search-hit {
  width: 100%;
  text-align: left;
  display: block;
  margin: 10px 0;
}
.search-hit small {
  display: block;
}
#results .record {
  margin: 12px 0;
}
#status:empty {
  display: none;
}
#status {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(24px, env(safe-area-inset-bottom));
  width: max-content;
  max-width: 90%;
  padding: 13px 20px;
  background: var(--text);
  color: var(--bg);
  border-radius: 12px;
  z-index: 10;
  font-size: 0.85rem;
  box-shadow: 0 4px 24px #0003;
}
.busy {
  cursor: progress;
}
.busy button {
  cursor: progress;
}
hr {
  border: 0;
  border-top: 1px solid var(--line);
  width: 100%;
}
@media (max-width: 650px) {
  .topbar {
    padding: 4px 20px;
  }
  .brand small {
    display: none;
  }
  .brand img {
    width: 64px;
    height: 64px;
  }
  main {
    padding: 24px 20px max(24px, env(safe-area-inset-bottom));
  }
  .hero {
    padding: 12px 0 22px;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .hero p {
    font-size: 0.85rem;
  }
  .collection.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .tile-open {
    padding: 20px 15px;
    min-height: 168px;
  }
  .tile strong {
    font-size: 1rem;
  }
  .tile-symbol {
    margin-bottom: 18px;
  }
  .new-tile {
    min-height: 168px;
  }
  .system-cards {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 24px;
  }
  .system-cards button {
    padding: 16px;
  }
  .panel {
    padding: 18px;
  }
  h1 {
    font-size: 1.75rem;
  }
  .toolbar {
    gap: 8px;
  }
  .toolbar > button {
    font-size: 0.8rem;
  }
  .record-open {
    padding: 15px;
  }
  .attachment-row {
    align-items: flex-start;
  }
  dialog {
    --dialog-padding: 20px;
    padding: 20px;
  }
  .topbar .quiet {
    font-size: 0.8rem;
    padding: 0.5rem;
  }
}
@media (max-width: 360px) {
  .topbar {
    padding-right: 6px;
    padding-left: 6px;
  }
  .collection.grid {
    grid-template-columns: 1fr;
  }
  .hero h1 {
    font-size: 1.8rem;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

/* Per-tile design. Defaults are resolved from the active app theme. */
[hidden] {
  display: none !important;
}
.tile {
  border: 3px solid var(--tile-border);
  border-radius: 22px;
  background: var(--tile-background);
  color: var(--tile-text);
}
.tile .tile-open {
  background: transparent;
  color: var(--tile-text);
  min-height: 200px;
  align-items: center;
  text-align: center;
  padding: 24px 14px 20px;
}
.tile .tile-label {
  text-shadow: var(--tile-text-shadow);
  background: var(--tile-text-backing);
  color: var(--tile-text);
  padding: 0 5px;
  border-radius: 6px;
  max-width: 100%;
}
.tile .tile-meta {
  text-shadow: var(--tile-text-shadow);
  font-size: 0.7rem;
  color: var(--tile-text);
  background: var(--tile-text-backing);
  padding: 1px 5px;
  border-radius: 5px;
}
.tile .tile-symbol {
  color: var(--tile-symbol);
  background: var(--tile-symbol-backing);
  width: 64px;
  height: 64px;
  padding: 6px;
  margin: 10px 0 18px;
  flex-shrink: 0;
}
.tile-symbol svg,
.library-symbol svg {
  width: 100%;
  height: 100%;
  display: block;
}
.tile .more {
  text-shadow: var(--tile-text-shadow);
  color: var(--tile-text);
  background: var(--tile-text-backing);
  right: 6px;
  top: 4px;
  min-width: 44px;
}
.tile-photo {
  display: block;
  width: min(100%, 130px);
  aspect-ratio: 1;
  margin: 15px 0 14px;
  border-radius: 12px;
  overflow: hidden;
  background: #d0d0d0;
  flex-shrink: 0;
}
.tile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tile-photo.photo-error {
  padding: 8px;
  color: #111;
}
.vault-system {
  width: 100%;
  margin-top: 20px;
}
.vault-open {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  min-height: 120px;
  padding: 20px;
  background: transparent;
  color: var(--tile-text);
  border: 0;
}
.vault-system .tile-symbol {
  margin: 0;
}
.tile.mode-name .tile-open {
  justify-content: center;
  padding-top: 44px;
}
.tile.mode-visual .tile-open {
  justify-content: center;
}
.tile.mode-visual .tile-symbol,
.tile.mode-visual .tile-photo {
  margin-bottom: 0;
}
.list .tile .tile-open {
  grid-template-columns: 76px minmax(0, 1fr);
  text-align: left;
  align-items: center;
  padding: 18px 50px 18px 16px;
  min-height: 115px;
}
.list .tile .tile-symbol,
.list .tile .tile-photo {
  grid-row: span 2;
  width: 68px;
  height: 68px;
  margin: 0;
}
.list .tile .tile-label,
.list .tile .tile-meta {
  grid-column: 2;
  justify-self: start;
}
.list .tile.mode-name .tile-open,
.list .tile.mode-visual .tile-open {
  display: flex;
  align-items: flex-start;
}
.design-preview {
  position: sticky;
  top: 56px;
  z-index: 2;
  background: var(--card);
  padding: 10px 0;
}
.design-preview .tile {
  max-width: 240px;
  margin: auto;
}
.design-preview .tile .tile-open {
  min-height: 180px;
}
.tile-color-settings {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin: 22px 0 0;
  min-width: 0;
}
.tile-color-settings legend {
  padding: 0 6px;
}
.color-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.color-inputs input[type="color"] {
  min-height: 48px;
  width: 100%;
  padding: 4px;
  cursor: pointer;
}
.icon-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
  padding: 3px;
  margin-bottom: 16px;
}
.icon-picker button {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 5px;
  font-size: 0.7rem;
  min-width: 0;
}
.icon-picker button svg {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.icon-picker button[aria-pressed="true"] {
  border: 2px solid var(--text);
  background: var(--soft);
}
.symbol-library {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}
.symbol-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  padding: 16px;
  min-width: 0;
}
.library-symbol {
  width: 44px;
  height: 44px;
  color: var(--text);
  flex-shrink: 0;
}
.symbol-description {
  flex: 1;
  min-width: 140px;
  overflow-wrap: anywhere;
}
.symbol-description small {
  display: block;
}
.symbol-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.symbol-actions button {
  font-size: 0.75rem;
  min-width: 44px;
}
@media (max-width: 650px) {
  .tile .tile-open {
    min-height: 195px;
    padding-right: 9px;
    padding-left: 9px;
  }
  .tile .tile-label {
    font-size: 1rem;
  }
  .tile-photo {
    width: min(100%, 110px);
  }
  .design-preview .tile .tile-open {
    min-height: 175px;
  }
}

.top-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}
.header-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 10px;
  background: transparent;
  border-color: transparent;
  flex-shrink: 0;
}
.header-icon svg {
  display: block;
  width: 24px;
  height: 24px;
}
.window-close {
  min-width: 46px;
  min-height: 46px;
  flex-shrink: 0;
}
.page-footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
@media (max-width: 420px) {
  .top-actions {
    gap: 0;
  }
  .header-icon {
    width: 44px;
    min-width: 44px;
    padding: 9px;
  }
  .window-close {
    min-width: 44px;
  }
}
.photo-attachment {
  display: block;
  max-width: 320px;
  margin: 0 0 10px;
  overflow: hidden;
  border-radius: 12px;
}
.photo-attachment img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}
.editor-thumb {
  flex: 0 0 70px !important;
}
.editor-thumb img {
  display: block;
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 9px;
}
.record-thumb {
  display: block;
  margin: 12px 0;
}
.record-thumb img {
  display: block;
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 9px;
}
.tile .attachment-badge {
  margin-top: 6px;
  font-weight: 650;
}
.list .tile .attachment-badge {
  grid-column: 2;
}
@media (max-width: 420px) {
  .topbar {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .brand span {
    display: none;
  }
}
.catalog-suggestions {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: -8px 0 18px;
}
.catalog-suggestions[hidden] {
  display: none;
}
.catalog-suggestions button {
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0;
  text-align: left;
  background: var(--card);
}
.catalog-suggestions button:hover,
.catalog-suggestions [aria-selected="true"] {
  background: var(--soft);
}

.app-website { text-align: center; }
.app-website img { display: block; width: min(100%, 320px); height: auto; margin: 16px auto; background: white; }
.app-website a { overflow-wrap: anywhere; }

.record.shopping-colored {
  --card: var(--shopping-bg);
  --soft: rgba(255, 255, 255, 0.38);
  --line: rgba(32, 39, 34, 0.3);
  --muted: #374139;
  color: #202722;
}

