/* jaybot.fyi dashboard. Builds on /styles.css tokens. */

body.admin { min-height: 100dvh; }

.wordmark { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; }

/* login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 350px; display: flex; flex-direction: column; gap: 14px; text-align: center; }
.login-card .wordmark { font-size: 40px; margin-bottom: 4px; }
.login-sub { color: var(--muted); margin-bottom: 10px; }
.back { color: var(--muted); font-size: 13px; margin-top: 8px; }
.back:hover { color: var(--text); }

/* fields */
.field { display: flex; flex-direction: column; gap: 6px; text-align: left; }
.field > span { font-size: 13px; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .field select {
  width: 100%; padding: 11px 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font: inherit; font-size: 16px;
  transition: border-color 150ms, box-shadow 150ms;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.field .hint { font-size: 12px; color: var(--muted); }
.form-err { color: var(--like); font-size: 13px; text-align: left; }
.btn.big { height: 46px; font-size: 15px; flex: none; }
.btn.danger { color: var(--like); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; flex: none; }
.btn:disabled { opacity: 0.5; cursor: default; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; cursor: pointer; }
.switch-text strong { display: block; font-weight: 600; }
.switch-text span { color: var(--muted); font-size: 13px; }
.switch input { appearance: none; flex: none; width: 46px; height: 28px; border-radius: 14px; background: var(--surface-hover); position: relative; cursor: pointer; transition: background-color 200ms; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / 0.3); transition: translate 250ms var(--ease); }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { translate: 18px 0; }

/* shell */
:root { --panel: color-mix(in srgb, var(--text) 3%, var(--bg)); }

.me-avatar {
  display: grid; place-items: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface) center/cover; border: 1px solid var(--border);
  font-size: 12px; font-weight: 700; color: var(--muted);
}

/* phone: top bar + bottom tab bar */
.side { display: none; }
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  height: 52px; padding: env(safe-area-inset-top) 12px 0 8px; box-sizing: content-box;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.bar h1 { margin: 0 auto 0 8px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-back:not([hidden]) + h1 { margin-left: 0; font-size: 17px; }
.bar-back { display: grid; place-items: center; width: 40px; height: 44px; }
.bar-action { display: flex; }
.bar-action:empty { display: none; }
.bar-action button, .bar-action a { color: var(--accent); font-weight: 700; padding: 8px 10px; font-size: 15px; }
.bar-action button:disabled { opacity: 0.4; }
.bar-live {
  display: inline-flex; align-items: center; gap: 6px; flex: none;
  height: 34px; padding: 0 10px 0 4px; border-radius: 17px;
  background: var(--surface); font-weight: 600; font-size: 13px;
  transition: background-color 150ms;
}
.bar-live:active { background: var(--surface-hover); }
.bar-live .i { width: 14px; height: 14px; stroke-width: 2.4; color: var(--muted); }
.bar-live .me-avatar { width: 26px; height: 26px; }

.tabbar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: flex; align-items: stretch;
  height: 56px; padding-bottom: env(safe-area-inset-bottom); box-sizing: content-box;
  background: var(--bg); border-top: 1px solid var(--border);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 11px; font-weight: 600;
}
.tabbar a .i { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--text); }
.tabbar a[aria-current="page"] .i { stroke-width: 2.6; }
.tabbar a:active .i { transform: scale(0.9); }
.tab-new-btn {
  display: grid; place-items: center; width: 48px; height: 36px; border-radius: 12px;
  background: var(--accent); color: var(--accent-text);
}
.tab-new-btn .i { stroke-width: 2.6; }
.tabbar a.tab-new[aria-current="page"] .tab-new-btn { background: var(--text); color: var(--bg); box-shadow: none; }

.view { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(104px + env(safe-area-inset-bottom)); outline: none; }

/* desktop: sidebar */
@media (min-width: 900px) {
  .bar, .tabbar { display: none; }
  .side {
    position: fixed; inset: 0 auto 0 0; z-index: 20;
    display: flex; flex-direction: column; gap: 2px;
    width: 256px; padding: 20px 14px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }
  .side-logo { display: flex; align-items: baseline; gap: 8px; padding: 6px 10px 18px; }
  .side-logo .wordmark { font-size: 24px; }
  .side-badge { font-size: 12px; font-weight: 600; color: var(--muted); }
  .me-card {
    display: flex; align-items: center; gap: 10px;
    padding: 10px; margin-bottom: 10px; border-radius: 12px;
    background: var(--bg); border: 1px solid var(--border);
    transition: border-color 150ms, background-color 150ms;
  }
  .me-card:hover { border-color: var(--accent); }
  .me-card .me-avatar { width: 40px; height: 40px; font-size: 16px; }
  .me-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .me-text strong { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .me-text span { font-size: 13px; color: var(--accent); font-weight: 600; }
  .me-card > .i { width: 16px; height: 16px; color: var(--muted); }
  .side-new {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; margin-bottom: 14px; border-radius: 10px;
    background: var(--accent); color: var(--accent-text); font-weight: 700;
    transition: background-color 150ms, transform 150ms var(--ease);
  }
  .side-new:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
  .side-new:active { transform: scale(0.98); }
  .side-new .i { width: 18px; height: 18px; stroke-width: 2.6; }
  .side-item {
    display: flex; align-items: center; gap: 12px; width: 100%;
    height: 42px; padding: 0 10px; border-radius: 10px; font-size: 15px; color: var(--text);
    transition: background-color 150ms;
  }
  .side-item .i { width: 22px; height: 22px; }
  .side-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
  .side-item[aria-current="page"] { font-weight: 700; background: color-mix(in srgb, var(--text) 8%, transparent); }
  .side-item[aria-current="page"] .i { stroke-width: 2.6; }
  .side-item .count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 11px; background: var(--accent); color: var(--accent-text); font-size: 12px; font-weight: 700; text-align: center; }
  .side-foot { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
  .view { margin-left: 256px; max-width: 780px; padding: 40px 48px 80px; }
  .view-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
  .view-head h2 { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
}
@media (min-width: 1360px) { .view { margin-left: max(256px, calc(50vw - 390px)); } }
.view-head { display: none; }
@media (min-width: 900px) { .view-head { display: flex; } }

/* sections */
.section { margin-bottom: 28px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; font-size: 13px; font-weight: 700; color: var(--muted); }
.section-title a, .section-title button { color: var(--accent); font-weight: 600; font-size: 13px; }
.card { border: 1px solid var(--border); border-radius: 14px; padding: 4px 16px; }
.card + .card { margin-top: 12px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* overview */
.hero { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.hero .me-avatar { width: 72px; height: 72px; font-size: 28px; }
.hero-main { flex: 1; min-width: 0; }
.hero-main h3 { margin: 0; font-size: 18px; font-weight: 700; display: flex; align-items: center; gap: 4px; }
.hero-main h3 .i { width: 16px; height: 16px; color: var(--accent); }
.hero-stats { display: flex; gap: 18px; margin-top: 6px; }
.hero-stats span { color: var(--muted); font-size: 13px; }
.hero-stats b { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 15px; margin-right: 3px; }
.hero-actions { display: flex; gap: 8px; margin-bottom: 24px; }
.hero-actions .btn { height: 38px; }
.create { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 28px; }
.create a {
  display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--border); font-weight: 600;
  transition: border-color 150ms, background-color 150ms;
}
.create a:hover { border-color: var(--accent); }
.create a:active { background: var(--surface); }
.create a .i { color: var(--accent); }
.settings-list { border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.settings-list > * {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 50px; padding: 0 14px; text-align: left;
  border-bottom: 1px solid var(--border);
  transition: background-color 150ms;
}
.settings-list > *:last-child { border-bottom: 0; }
.settings-list > *:hover { background: var(--panel); }
.settings-list .i { width: 20px; height: 20px; color: var(--muted); }
.settings-list span { flex: 1; }
.settings-list .chev { width: 16px; height: 16px; }
.settings-list .danger { color: var(--like); }
.settings-list .danger .i { color: var(--like); }
.hint-line { color: var(--muted); font-size: 13px; margin: -4px 0 10px; }
@media (min-width: 900px) { .hero-actions .btn { flex: none; padding: 0 18px; } }
.mini-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; border-radius: 10px; overflow: hidden; }
@media (min-width: 600px) { .mini-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.mini-grid a, .mini-grid button { position: relative; aspect-ratio: 3 / 4; background: var(--surface) center/cover; display: block; }
.mini-grid .flag { position: absolute; top: 6px; right: 6px; color: #fff; filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.6)); }
.mini-grid .flag .i { width: 16px; height: 16px; }
.mini-grid .expired { position: absolute; inset: auto 0 0 0; padding: 4px 6px; font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(transparent, rgb(0 0 0 / 0.6)); text-align: left; }

/* composer */
.picker {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  min-height: 220px; padding: 24px; border-radius: 16px;
  border: 2px dashed var(--border); text-align: center; cursor: pointer;
  transition: border-color 150ms, background-color 150ms;
}
.picker:hover, .picker.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.picker .i { width: 48px; height: 48px; stroke-width: 1.4; }
.picker strong { font-size: 17px; }
.picker span { color: var(--muted); font-size: 13px; }
.picker input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.thumbs { display: flex; gap: 10px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
.thumb { position: relative; flex: none; width: 120px; }
.thumb-img { width: 120px; aspect-ratio: 3 / 4; border-radius: 10px; background: var(--surface) center/cover; }
.thumb-tools { display: flex; justify-content: space-between; margin-top: 6px; }
.thumb-tools button { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--surface); }
.thumb-tools button:disabled { opacity: 0.35; }
.thumb-tools .i { width: 16px; height: 16px; }
.thumb .n { position: absolute; top: 6px; left: 6px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: rgb(0 0 0 / 0.6); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.thumb input { margin-top: 6px; width: 100%; font-size: 12px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.add-more { flex: none; width: 120px; aspect-ratio: 3 / 4; border-radius: 10px; border: 2px dashed var(--border); display: grid; place-items: center; color: var(--muted); }

.progress { height: 4px; border-radius: 2px; background: var(--surface); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width 200ms; }

/* lists */
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.item:last-child { border-bottom: 0; }
.item-thumb { width: 44px; height: 44px; flex: none; border-radius: 10px; background: var(--surface) center/cover; display: grid; place-items: center; color: var(--muted); }
.item-thumb.round { border-radius: 50%; }
.item-main { flex: 1; min-width: 0; }
.item-main strong { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main span { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-main p { margin-top: 2px; white-space: pre-line; overflow-wrap: anywhere; }
.item-main .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.item-tools { display: flex; gap: 2px; flex: none; }
.tool { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--muted); }
.tool:hover { background: var(--surface); color: var(--text); }
.tool.del:hover { color: var(--like); }
.tool:disabled { opacity: 0.3; }
.tool .i { width: 18px; height: 18px; }
.item.off .item-main { opacity: 0.5; }
.item-main strong .tag, .tag { display: inline; width: auto; padding: 1px 6px; border-radius: 6px; font-size: 11px; font-weight: 700; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); margin-left: 6px; vertical-align: 1px; }

.edit-panel { padding: 12px 0 16px; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 12px; }

.seg { display: flex; padding: 3px; border-radius: 10px; background: var(--surface); }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; text-align: center; padding: 8px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--bg); color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / 0.12); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); }

.avatar-edit { display: flex; align-items: center; gap: 16px; }
.avatar-edit .item-thumb { width: 72px; height: 72px; font-size: 28px; font-weight: 600; }

.empty-note { color: var(--muted); padding: 20px 0; text-align: center; }

.hl-strip { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 10px; }
.hl-strip button { flex: none; width: 72px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.hl-strip .ring { width: 64px; height: 64px; border-radius: 50%; padding: 2px; border: 1px solid var(--border); }
.hl-strip .ring span { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--surface) center/cover; color: var(--muted); }
.hl-strip button[aria-pressed="true"] .ring { border: 2px solid var(--accent); }
.hl-strip small { font-size: 12px; font-weight: 600; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

dialog.sheet { border: 0; border-radius: 16px; padding: 0; background: var(--bg); color: var(--text); box-shadow: var(--elev); }
dialog.sheet::backdrop { background: var(--scrim); }
.section-title .soft { font-weight: 400; color: var(--muted); }
.tag { white-space: nowrap; }
.create a { white-space: nowrap; }
