/* ==========================================================================
   TandAI — minimal, light, Apple × Swiss.  Mobile layout only.
   ========================================================================== */
:root {
  --bg: #ffffff;
  --bg2: #f5f5f7;
  --bg3: #ececf0;
  --ink: #0a0a0a;
  --ink2: #6e6e73;
  --ink3: #aeaeb2;
  --line: rgba(0, 0, 0, .08);
  --line2: rgba(0, 0, 0, .14);
  --accent: #ff3b30;
  --blue: #007aff;
  --orange: #ff9500;
  --r-xl: 26px;
  --r-lg: 22px;
  --r: 16px;
  --r-sm: 12px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tab-h: 62px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { background: #e9e9ec; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: #e9e9ec;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01", "ss03";
  overscroll-behavior-y: none;
}
#app {
  position: relative;
  max-width: 440px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  padding-bottom: calc(var(--tab-h) + var(--safe-b) + 28px);
}
@media (min-width: 441px) {
  #app { box-shadow: 0 0 0 1px var(--line), 0 40px 100px rgba(0, 0, 0, .08); }
}
body.no-tabs #app { padding-bottom: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
button:disabled { opacity: .35; pointer-events: none; }
input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; display: block; flex: none; }
img { -webkit-user-drag: none; user-select: none; }

/* ---------- Type ---------- */
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink2);
}
h1 { font-size: 44px; line-height: .98; letter-spacing: -.048em; font-weight: 800; }
h2 { font-size: 20px; letter-spacing: -.03em; font-weight: 700; }
mark { background: rgba(255, 204, 0, .38); color: inherit; border-radius: 3px; padding: 0 1px; }
.muted { color: var(--ink2); }
.pad { padding-left: 20px; padding-right: 20px; }

/* ---------- Top bar ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(var(--safe-t) + 14px) 20px 4px;
}
.top-actions { display: flex; gap: 8px; }
.wordmark { font-weight: 800; font-size: 21px; letter-spacing: -.05em; display: flex; align-items: center; gap: 8px; }
.wordmark span { color: var(--accent); }
.wordmark .mark {
  width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-size: 15px; position: relative;
}
.wordmark .mark::after {
  content: ""; position: absolute; right: 4px; bottom: 4px; width: 5px; height: 5px;
  border-radius: 50%; background: var(--accent);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 999px; background: var(--bg2);
  display: grid; place-items: center; transition: transform .15s, background .15s;
}
.icon-btn:active { transform: scale(.92); background: var(--bg3); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.dark { background: var(--ink); color: #fff; }

/* ---------- Hero ---------- */
.hero { padding: 22px 20px 22px; }
.hero h1 { margin-top: 10px; }
.hero .sub { margin-top: 12px; font-size: 15px; line-height: 1.4; color: var(--ink2); max-width: 30ch; }
.hero.sm h1 { font-size: 36px; }
.platform-row { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.platform-row .pb { width: 26px; height: 26px; border-radius: 8px; font-size: 11px; }

/* ---------- Quick save ---------- */
.quick { display: flex; gap: 10px; padding: 0 20px 14px; }
.quick-input {
  flex: 1; display: flex; align-items: center; gap: 10px;
  height: 54px; padding: 0 6px 0 16px; border-radius: var(--r);
  background: var(--bg2); border: 1px solid transparent; transition: border .15s, background .15s;
  min-width: 0;
}
.quick-input:focus-within { background: #fff; border-color: var(--ink); }
.quick-input .hash { color: var(--ink3); font-weight: 700; font-size: 17px; }
.quick-input .hash svg { width: 18px; height: 18px; }
.quick-input input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px;
}
.quick-input input::placeholder { color: var(--ink3); }
.paste { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; color: var(--ink2); }
.paste svg { width: 19px; height: 19px; }
.btn-square {
  width: 54px; height: 54px; border-radius: var(--r); background: var(--ink); color: #fff;
  display: grid; place-items: center; flex: none; transition: transform .15s;
}
.btn-square:active { transform: scale(.94); }

/* ---------- Inbox banner ---------- */
.inbox-banner {
  margin: 0 20px 30px; display: flex; align-items: center; gap: 14px;
  padding: 14px 14px 14px 14px; border-radius: var(--r-lg);
  background: var(--ink); color: #fff; transition: transform .15s;
}
.inbox-banner:active { transform: scale(.98); }
.ib-count {
  min-width: 44px; height: 44px; border-radius: 13px; background: var(--accent);
  display: grid; place-items: center; font-weight: 800; font-size: 18px; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
}
.ib-text { flex: 1; min-width: 0; }
.ib-text b { display: block; font-size: 16px; font-weight: 600; letter-spacing: -.02em; }
.ib-text small { font-size: 13px; color: rgba(255, 255, 255, .6); }
.ib-thumbs { display: flex; }
.ib-thumbs .thumb { width: 30px; height: 30px; border-radius: 9px; border: 2px solid var(--ink); margin-left: -10px; aspect-ratio: auto; }
.ib-thumbs .thumb .thumb-ph { font-size: 0; }
.inbox-banner > svg { color: rgba(255, 255, 255, .5); width: 18px; height: 18px; }
.caught-up {
  margin: 0 20px 30px; padding: 14px 16px; border-radius: var(--r-lg); border: 1px dashed var(--line2);
  display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink2);
}
.caught-up svg { width: 18px; height: 18px; color: #34c759; }

/* ---------- Section head ---------- */
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 20px 12px;
}
.sec-head .num { font-size: 13px; color: var(--ink3); font-weight: 600; margin-left: 6px; font-variant-numeric: tabular-nums; }
.link-btn { font-size: 15px; font-weight: 600; color: var(--blue); }
.section { margin-bottom: 30px; }

/* ---------- Collections ---------- */
.col-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 20px; }
.col-card {
  position: relative; background: var(--bg2); border-radius: var(--r-lg); padding: 14px;
  min-height: 136px; display: flex; flex-direction: column; justify-content: space-between;
  overflow: hidden; transition: transform .15s var(--ease);
}
.col-card:active { transform: scale(.97); }
.col-top { display: flex; justify-content: space-between; align-items: flex-start; }
.col-sq {
  width: 34px; height: 34px; border-radius: 10px; background: var(--c); color: #fff;
  display: grid; place-items: center; flex: none;
}
.col-sq svg { width: 18px; height: 18px; }
.col-sq.big { width: 52px; height: 52px; border-radius: 15px; }
.col-sq.big svg { width: 26px; height: 26px; }
.col-count {
  font-size: 30px; font-weight: 700; letter-spacing: -.05em; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.col-name { font-weight: 600; font-size: 15px; letter-spacing: -.02em; line-height: 1.2; }
.col-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--ink2); }
.badge-new {
  font-size: 10px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); background: #fff0ef; padding: 2px 6px; border-radius: 6px;
}
.col-card.add {
  background: #fff; border: 1.5px dashed var(--line2); align-items: center; justify-content: center;
  gap: 8px; color: var(--ink2); font-weight: 600; font-size: 14px;
}
.col-card.add .col-sq { background: var(--bg2); color: var(--ink); }

/* ---------- Pinned strip ---------- */
.strip { display: flex; gap: 12px; overflow-x: auto; padding: 0 20px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.strip::-webkit-scrollbar, .chips::-webkit-scrollbar { display: none; }
.strip .card { width: 150px; flex: none; scroll-snap-align: start; }

/* ---------- Thumbnail ---------- */
.thumb {
  position: relative; overflow: hidden; border-radius: 14px; aspect-ratio: 4 / 3; flex: none;
  background: var(--pc, #c7c7cc);
}
.thumb-ph {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: rgba(255, 255, 255, .92); font-weight: 700; font-size: 13px; letter-spacing: -.01em;
  background: linear-gradient(140deg, var(--pc), color-mix(in srgb, var(--pc) 55%, #000));
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--bg2); }
.thumb.sm { width: 62px; height: 62px; aspect-ratio: auto; border-radius: 13px; }
.thumb.sm .thumb-ph { font-size: 10px; }
.thumb.lg { aspect-ratio: 16 / 11; border-radius: 0; }
.thumb.hero { aspect-ratio: 16 / 10; border-radius: var(--r-lg); }
.play {
  position: absolute; left: 10px; bottom: 10px; width: 28px; height: 28px; border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: #000; display: grid; place-items: center;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .15);
}
.play svg { width: 13px; height: 13px; margin-left: 2px; }
.thumb.sm .play { left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); width: 22px; height: 22px; }
.thumb.sm .play svg { width: 10px; height: 10px; }
.thumb.lg .play, .thumb.hero .play { width: 44px; height: 44px; left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%); }
.thumb.lg .play svg, .thumb.hero .play svg { width: 18px; height: 18px; }
.shimmer {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, .55) 50%, transparent 80%);
  background-size: 200% 100%; animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }

/* ---------- Platform badge ---------- */
.pb {
  width: 16px; height: 16px; border-radius: 5px; background: var(--pc); color: #fff;
  font-size: 8px; font-weight: 800; letter-spacing: -.02em;
  display: inline-grid; place-items: center; flex: none; line-height: 1;
}

/* ---------- Rows (swipeable) ---------- */
.rows { display: flex; flex-direction: column; }
.row { position: relative; overflow: hidden; }
.row-actions { position: absolute; top: 0; right: 0; bottom: 0; display: flex; width: 222px; }
.ra {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; font-size: 11px; font-weight: 600; color: #fff;
}
.ra svg { width: 20px; height: 20px; }
.ra-open { background: var(--blue); }
.ra-pin { background: var(--orange); }
.ra-share { background: var(--ink); }
.row-main {
  position: relative; z-index: 1; display: flex; gap: 14px; align-items: center;
  padding: 11px 20px; background: var(--bg); touch-action: pan-y; cursor: pointer;
  transition: transform .32s var(--ease); user-select: none; -webkit-user-select: none;
}
.row-main.dragging { transition: none; }
.row-main::after {
  content: ""; position: absolute; left: 96px; right: 0; bottom: 0; height: 1px; background: var(--line);
}
.row:last-child .row-main::after { display: none; }
.row-main:active { background: #fafafa; }
.row-body { flex: 1; min-width: 0; }
.row-title {
  font-size: 15px; font-weight: 600; letter-spacing: -.02em; line-height: 1.28;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.row-meta {
  display: flex; align-items: center; gap: 6px; margin-top: 5px;
  font-size: 12.5px; color: var(--ink2); white-space: nowrap; overflow: hidden;
}
.row-meta > span { overflow: hidden; text-overflow: ellipsis; }
.row-meta .sep { color: var(--ink3); }
.cdot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.pinmark { color: var(--orange); align-self: flex-start; margin-top: 2px; }
.pinmark svg { width: 15px; height: 15px; }
.newdot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.hint { text-align: center; font-size: 12px; color: var(--ink3); padding: 18px 20px 0; }

/* ---------- Grid cards ---------- */
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 10px; padding: 0 20px; }
.card { position: relative; cursor: pointer; transition: transform .15s var(--ease); }
.card:active { transform: scale(.97); }
.card-label {
  position: absolute; left: 8px; top: 8px; display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 8px; background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  font-size: 11px; font-weight: 600; max-width: calc(100% - 16px);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-label.new { background: var(--accent); color: #fff; letter-spacing: .06em; text-transform: uppercase; font-size: 10px; }
.card-pin { position: absolute; right: 8px; top: 8px; width: 24px; height: 24px; border-radius: 8px; background: var(--orange); color: #fff; display: grid; place-items: center; }
.card-pin svg { width: 13px; height: 13px; }
.card-title {
  margin-top: 9px; font-size: 14px; font-weight: 600; line-height: 1.28; letter-spacing: -.02em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card .row-meta { margin-top: 4px; font-size: 12px; }

/* ---------- Search / Library ---------- */
.search-head {
  position: sticky; top: 0; z-index: 5; padding: calc(var(--safe-t) + 10px) 20px 12px;
  background: rgba(255, 255, 255, .86); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  display: flex; gap: 10px; align-items: center;
}
.search-field {
  flex: 1; height: 44px; border-radius: 13px; background: var(--bg2);
  display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--ink2);
}
.search-field svg { width: 18px; height: 18px; }
.search-field input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 16px; color: var(--ink); }
.search-field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-field .clear { width: 22px; height: 22px; border-radius: 50%; background: var(--ink3); color: #fff; display: none; place-items: center; }
.search-field .clear svg { width: 12px; height: 12px; stroke-width: 2.6; }
.search-field.has .clear { display: grid; }
.cancel { font-size: 16px; color: var(--blue); font-weight: 500; display: none; }
.search-head.active .cancel { display: block; }
.lib-title { padding: 6px 20px 16px; }
.lib-title h1 { font-size: 36px; }
.search-tips { font-size: 12.5px; color: var(--ink3); padding: 0 20px 14px; }
.search-tips code { font-family: inherit; background: var(--bg2); color: var(--ink2); padding: 1px 6px; border-radius: 6px; }

.stats { margin: 0 20px 18px; border-radius: var(--r-lg); background: var(--bg2); padding: 14px 0 16px; }
.stats-head { display: flex; justify-content: space-between; align-items: center; padding: 0 16px 12px; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { text-align: center; border-left: 1px solid var(--line); padding: 2px 0; border-radius: 0; }
.stat:first-child { border-left: 0; }
.stat svg { width: 16px; height: 16px; margin: 0 auto 6px; color: var(--ink2); }
.stat b { display: block; font-size: 24px; font-weight: 700; letter-spacing: -.05em; font-variant-numeric: tabular-nums; line-height: 1; }
.stat span { display: block; margin-top: 4px; font-size: 11px; color: var(--ink2); }
.stat.on b { color: var(--accent); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 0 20px 18px; scrollbar-width: none; }
.chip {
  flex: none; height: 34px; padding: 0 13px; border-radius: 999px; border: 1px solid var(--line2);
  font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap; background: #fff; transition: background .15s, color .15s, border-color .15s;
}
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.ghost { border-style: dashed; color: var(--ink2); }
.chip .sugg { font-size: 10px; font-weight: 700; color: var(--accent); letter-spacing: .04em; }
.chip.on .sugg { color: #ffb3ad; }

.seg { display: inline-flex; background: var(--bg2); border-radius: 10px; padding: 2px; }
.seg button { width: 34px; height: 28px; border-radius: 8px; display: grid; place-items: center; color: var(--ink2); }
.seg button svg { width: 16px; height: 16px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .1); }

.empty { text-align: center; padding: 50px 30px; color: var(--ink2); }
.empty .big { font-size: 28px; font-weight: 800; letter-spacing: -.04em; color: var(--ink); margin-bottom: 8px; }
.empty p { font-size: 14px; line-height: 1.45; }

/* ---------- Focus mode (Inbox) ---------- */
.focus { min-height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--safe-t) + 14px) 20px 0; }
.focus-head { display: flex; justify-content: space-between; align-items: flex-start; }
.counter { font-size: 38px; font-weight: 800; letter-spacing: -.05em; line-height: 1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.counter span { color: var(--ink3); font-weight: 600; font-size: 22px; }
.progress { display: flex; gap: 4px; margin: 16px 0 18px; }
.progress span { flex: 1; height: 3px; border-radius: 2px; background: var(--bg3); transition: background .3s; }
.progress span.done { background: var(--ink); }
.progress span.cur { background: var(--accent); }
.focus-stage { position: relative; }
.focus-stage::before, .focus-stage::after {
  content: ""; position: absolute; left: 14px; right: 14px; bottom: -8px; height: 40px;
  border-radius: 0 0 24px 24px; background: var(--bg2); z-index: 0;
}
.focus-stage::after { left: 28px; right: 28px; bottom: -15px; background: var(--bg3); z-index: -1; }
.focus-stage.single::before, .focus-stage.single::after { display: none; }
.focus-card {
  position: relative; z-index: 1; border-radius: var(--r-xl); overflow: hidden; background: #fff;
  border: 1px solid var(--line); box-shadow: 0 24px 50px -24px rgba(0, 0, 0, .22);
  touch-action: pan-y; user-select: none; -webkit-user-select: none;
  transition: transform .3s var(--ease), opacity .25s;
}
.focus-card.dragging { transition: none; }
.focus-card::after {
  position: absolute; top: 18px; padding: 6px 12px; border-radius: 10px; font-weight: 800;
  font-size: 13px; letter-spacing: .12em; border: 2px solid; opacity: 0; transition: opacity .15s;
  background: #fff;
}
.focus-card[data-hint="save"]::after { content: "SAVE"; left: 18px; color: #34c759; opacity: 1; transform: rotate(-8deg); }
.focus-card[data-hint="skip"]::after { content: "LATER"; right: 18px; color: var(--ink2); opacity: 1; transform: rotate(8deg); }
.fc-col {
  position: absolute; left: 12px; top: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 9px; border-radius: 9px; background: rgba(255, 255, 255, .94); font-size: 12px; font-weight: 600;
}
.fc-body { padding: 16px 18px 18px; }
.fc-body h3 { font-size: 21px; font-weight: 700; letter-spacing: -.035em; line-height: 1.18; margin-top: 8px; }
.fc-body p { font-size: 14px; color: var(--ink2); line-height: 1.45; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.fc-body .row-meta { margin-top: 0; }
.fc-body .tags-edit { margin-top: 12px; }
.moveto { margin: 26px -20px 0; }
.moveto .eyebrow { padding: 0 20px 10px; display: block; }
.moveto .chips { padding-bottom: 6px; }
.focus-actions {
  position: sticky; bottom: 0; margin-top: auto;
  display: grid; grid-template-columns: 54px 1fr 1.25fr 54px; gap: 8px;
  padding: 18px 0 calc(16px + var(--safe-b));
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 28%);
}
.focus-empty { flex: 1; display: flex; flex-direction: column; justify-content: center; padding-bottom: 80px; }
.focus-empty h1 { font-size: 52px; }
.focus-empty p { color: var(--ink2); margin: 14px 0 26px; font-size: 16px; line-height: 1.4; }

/* ---------- Buttons ---------- */
.btn {
  height: 54px; border-radius: var(--r); font-weight: 600; font-size: 16px; letter-spacing: -.01em;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 18px;
  transition: transform .15s, opacity .15s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--ink); color: #fff; }
.btn.secondary { background: var(--bg2); }
.btn.ghost { border: 1px solid var(--line2); background: #fff; }
.btn.danger { color: var(--accent); background: #fff1f0; }
.btn.block { width: 100%; }
.btn.icon { padding: 0; }

/* ---------- Sheet ---------- */
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .3); opacity: 0; transition: opacity .3s; }
.sheet {
  position: fixed; left: 50%; bottom: 0; z-index: 51; width: min(440px, 100%); max-height: 92dvh;
  overflow-y: auto; overscroll-behavior: contain; background: #fff; border-radius: 28px 28px 0 0;
  transform: translate(-50%, 104%); transition: transform .42s var(--ease);
  padding-bottom: calc(20px + var(--safe-b));
}
#sheet-root.open .scrim { opacity: 1; }
#sheet-root.open .sheet { transform: translate(-50%, 0); }
.sheet-grab { width: 38px; height: 5px; border-radius: 3px; background: var(--bg3); margin: 8px auto 2px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 20px 14px; }
.sheet-head h3 { font-size: 22px; font-weight: 700; letter-spacing: -.035em; }
.sh-brand { display: flex; align-items: center; gap: 12px; }
.sh-brand b { display: block; font-size: 17px; letter-spacing: -.03em; }
.sh-brand small { font-size: 13px; color: var(--ink2); }
.app-icon {
  width: 42px; height: 42px; border-radius: 12px; background: var(--ink); color: #fff;
  display: grid; place-items: center; font-weight: 800; font-size: 20px; position: relative;
}
.app-icon::after { content: ""; position: absolute; right: 6px; bottom: 6px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }

.preview {
  margin: 12px 20px 22px; display: flex; gap: 12px; align-items: center; padding: 10px;
  border-radius: var(--r); border: 1px solid var(--line);
}
.preview .row-body { padding-right: 4px; }
.preview .desc { font-size: 12.5px; color: var(--ink2); margin-top: 3px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.preview.empty-prev { border-style: dashed; color: var(--ink2); font-size: 13.5px; line-height: 1.4; flex-direction: column; align-items: flex-start; }
.skel { display: block; height: 12px; border-radius: 6px; background: var(--bg2); position: relative; overflow: hidden; }
.skel + .skel { margin-top: 8px; }

.pick-list { padding: 0 20px; }
.pick {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 0; text-align: left;
  border-bottom: 1px solid var(--line);
}
.pick:last-child { border-bottom: 0; }
.pick .col-sq { width: 36px; height: 36px; }
.pick b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.pick small { font-size: 12.5px; color: var(--ink2); }
.radio { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line2); transition: border .15s; flex: none; }
.pick.on .radio { border: 7px solid var(--ink); }

.sheet-foot {
  position: sticky; bottom: calc(-20px - var(--safe-b)); margin-top: 14px; padding: 14px 20px calc(20px + var(--safe-b));
  margin-bottom: calc(-20px - var(--safe-b));
  background: rgba(255, 255, 255, .92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line); display: flex; align-items: center; gap: 14px;
}
.sheet-foot .btn { flex: none; min-width: 140px; }
.switch-row { flex: 1; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch-row b { display: block; font-size: 15px; letter-spacing: -.02em; }
.switch-row small { font-size: 12px; color: var(--ink2); }
.switch {
  appearance: none; -webkit-appearance: none; width: 51px; height: 31px; border-radius: 999px;
  background: var(--bg3); position: relative; transition: background .2s; cursor: pointer; flex: none;
}
.switch::after {
  content: ""; position: absolute; left: 2px; top: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .25s var(--ease);
}
.switch:checked { background: #34c759; }
.switch:checked::after { transform: translateX(20px); }

/* Detail */
.detail-body { padding-top: 16px; }
.detail-title { font-size: 24px; line-height: 1.15; letter-spacing: -.04em; margin-top: 10px; }
.detail-author { font-size: 14px; color: var(--ink2); margin-top: 6px; font-weight: 500; }
.detail-desc { font-size: 15px; line-height: 1.5; color: #3a3a3c; margin-top: 10px; }
.action-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 20px 0 22px; }
.action {
  height: 66px; border-radius: var(--r); background: var(--bg2); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; font-size: 12px; font-weight: 600;
  transition: transform .15s;
}
.action:active { transform: scale(.95); }
.action svg { width: 20px; height: 20px; }
.action.primary { background: var(--ink); color: #fff; }
.action.on { background: #fff4e5; color: var(--orange); }
.field { padding: 14px 0; border-top: 1px solid var(--line); }
.field > .eyebrow { display: block; margin-bottom: 10px; }
.select-wrap { position: relative; }
.select-wrap select {
  width: 100%; height: 48px; border-radius: 13px; border: 0; background: var(--bg2);
  padding: 0 40px 0 14px; font-size: 16px; font-weight: 500; appearance: none; -webkit-appearance: none; outline: none;
}
.select-wrap svg { position: absolute; right: 12px; top: 14px; width: 18px; height: 18px; transform: rotate(90deg); color: var(--ink2); pointer-events: none; }
.detail-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.tiny { font-size: 12px; color: var(--ink3); margin-top: 14px; word-break: break-all; line-height: 1.4; }

/* Tags */
.tags-edit { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag {
  display: inline-flex; align-items: center; gap: 2px; height: 28px; padding: 0 4px 0 10px;
  border-radius: 8px; background: #f0f0ff; color: #5856d6; font-size: 13px; font-weight: 600;
}
.tag button { width: 20px; height: 20px; display: grid; place-items: center; color: inherit; opacity: .6; }
.tag button svg { width: 12px; height: 12px; stroke-width: 2.4; }
.tag-input {
  flex: 1; min-width: 90px; height: 28px; border: 0; outline: none; background: none; font-size: 16px;
  color: var(--ink);
}
.tag-input::placeholder { color: var(--ink3); }

/* Form bits */
.form { padding: 0 20px; }
.text-input {
  width: 100%; height: 54px; border-radius: var(--r); background: var(--bg2); border: 1px solid transparent;
  padding: 0 16px; font-size: 17px; outline: none; font-weight: 500;
}
.text-input:focus { background: #fff; border-color: var(--ink); }
.swatches { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin: 18px 0 22px; }
.swatch {
  aspect-ratio: 1; border-radius: 14px; background: var(--c); position: relative;
  transition: transform .15s;
}
.swatch.on { transform: scale(.88); box-shadow: 0 0 0 3px #fff, 0 0 0 5px var(--c); }
.form-actions { display: flex; flex-direction: column; gap: 10px; padding-bottom: 6px; }

/* ---------- Settings ---------- */
.group-title { padding: 0 20px 8px; }
.group { margin: 0 20px 28px; border-radius: var(--r-lg); background: var(--bg2); overflow: hidden; }
.cell {
  width: 100%; display: flex; align-items: center; gap: 14px; padding: 14px 16px; text-align: left;
  position: relative;
}
.cell + .cell::before { content: ""; position: absolute; top: 0; left: 62px; right: 0; height: 1px; background: var(--line); }
.cell .ic { width: 32px; height: 32px; border-radius: 9px; background: var(--c, var(--ink)); color: #fff; display: grid; place-items: center; flex: none; }
.cell .ic svg { width: 17px; height: 17px; }
.cell .tx { flex: 1; min-width: 0; }
.cell .tx b { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.02em; }
.cell .tx small { display: block; font-size: 13px; color: var(--ink2); line-height: 1.4; margin-top: 2px; }
.cell > svg { width: 16px; height: 16px; color: var(--ink3); }
.cell.danger .tx b { color: var(--accent); }
.bookmarklet {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 6px 12px; border-radius: 9px;
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600;
}
.steps { padding: 4px 16px 16px 62px; font-size: 13px; color: var(--ink2); line-height: 1.55; }
.steps li { margin-bottom: 2px; }
.footer-note { text-align: center; color: var(--ink3); font-size: 12px; line-height: 1.5; padding: 0 30px 20px; }

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); z-index: 40;
  width: min(440px, 100%); height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, .85); backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line);
}
body.no-tabs .tabbar { display: none; }
.tabbar a {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--ink3); font-size: 10.5px; font-weight: 600; letter-spacing: -.01em;
}
.tabbar a svg { width: 23px; height: 23px; }
.tabbar a.on { color: var(--ink); }
.tabbar .badge {
  position: absolute; top: 7px; left: calc(50% + 6px); min-width: 17px; height: 17px; padding: 0 5px;
  border-radius: 999px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700;
  font-style: normal; display: grid; place-items: center; border: 2px solid #fff; box-sizing: content-box;
}
.tabbar .badge:empty { display: none; }

/* ---------- Toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 14px); z-index: 60;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  display: flex; align-items: center; gap: 14px; max-width: calc(min(440px, 100vw) - 40px);
  padding: 12px 16px; border-radius: 14px; background: rgba(20, 20, 20, .94); color: #fff;
  font-size: 14px; font-weight: 500; box-shadow: 0 10px 30px rgba(0, 0, 0, .2);
  transition: transform .3s var(--ease), opacity .3s;
}
body.no-tabs #toast { bottom: calc(100px + var(--safe-b)); }
#toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
#toast button { color: #ffd60a; font-weight: 700; }

/* ---------- SaaS Account & Pricing ---------- */
.tier-pill {
  height: 26px; padding: 0 9px; border-radius: 999px; font-size: 11px; font-weight: 800;
  letter-spacing: .04em; text-transform: uppercase; display: inline-flex; align-items: center; gap: 4px;
  background: var(--bg2); color: var(--ink2);
}
.tier-pill.pro { background: #111; color: #ffd60a; }
.saas-card {
  margin: 0 20px 22px; padding: 18px; border-radius: var(--r-lg);
  background: linear-gradient(145deg, #0a0a0a, #1f1f24); color: #fff;
  display: flex; flex-direction: column; gap: 12px;
}
.saas-card .sc-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.saas-card h3 { font-size: 20px; font-weight: 800; letter-spacing: -.03em; }
.saas-card p { font-size: 13.5px; color: rgba(255,255,255,.7); line-height: 1.4; }
.quota-bar { height: 6px; border-radius: 99px; background: rgba(255,255,255,.16); overflow: hidden; }
.quota-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; }
.saas-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.saas-btns .btn { height: 42px; font-size: 14px; border-radius: 12px; padding: 0 14px; }
.btn.gold { background: #ffd60a; color: #0a0a0a; font-weight: 700; }
.btn.dark-ghost { background: rgba(255,255,255,.12); color: #fff; }

.plan-option {
  width: 100%; text-align: left; padding: 14px 16px; border-radius: 16px;
  border: 1.5px solid var(--line2); background: #fff; margin-bottom: 10px;
  display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, background .15s;
}
.plan-option.on { border-color: var(--ink); background: #fafafa; box-shadow: 0 0 0 1px var(--ink); }
.plan-option .po-head { display: flex; justify-content: space-between; align-items: baseline; }
.plan-option .po-name { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.plan-option .po-price { font-size: 18px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.plan-option .po-feats { font-size: 12.5px; color: var(--ink2); line-height: 1.45; }

/* ---------- Motion ---------- */
.view-enter { animation: enter .35s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
