/* Campus Connect: one stylesheet, mobile-first (this is used standing in a queue, between classes). */
:root {
  color-scheme: light;
  --bg: #F6F4FB;
  --surface: #ffffff;
  --surface-2: #F0ECFB;
  --ink: #1C1530;
  --ink-2: #4B4166;
  --muted: #837A9C;
  --line: #E6E1F5;
  --accent: #6D28D9;
  --accent-ink: #4C1D95;
  --accent-wash: #EDE4FC;
  --gold: #F5C400;
  --good: #0CA30C; --good-ink: #0A6B14; --good-wash: #E5F5E6;
  --warn: #C98500; --warn-ink: #8A5A00; --warn-wash: #FDF3DC;
  --bad: #D03B3B; --bad-ink: #AD2A2A; --bad-wash: #FBE9E9;
  --shadow: 0 1px 2px rgba(28, 21, 48, .06), 0 6px 20px rgba(28, 21, 48, .08);
  --radius: 14px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #15112B; --surface: #1E1838; --surface-2: #241D44;
    --ink: #F1EDFB; --ink-2: #C9C0E6; --muted: #938AB3;
    --line: #322A54; --accent: #8B5CF6; --accent-ink: #C4B5FD; --accent-wash: #2B2152;
    --good-ink: #4CC75A; --good-wash: #12291A;
    --warn: #E0A116; --warn-ink: #F0BF4F; --warn-wash: #2C2310;
    --bad-ink: #EF7D7D; --bad-wash: #2F1717;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 'Plus Jakarta Sans', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 15.5px; }
p { margin: 0 0 .7em; }
a { color: var(--accent-ink); }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12.5px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

input, select, textarea {
  font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%; outline: none; margin-bottom: 10px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin: 2px 0 5px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 10px; padding: 10px 16px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 650; font-size: 14px;
  color: var(--ink); text-decoration: none;
}
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-danger { color: var(--bad-ink); border-color: color-mix(in srgb, var(--bad) 40%, var(--line)); }
.btn-danger:hover { background: var(--bad-wash); }
.btn-ghost { background: none; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.badge.ok { background: var(--good-wash); color: var(--good-ink); }
.badge.warn { background: var(--warn-wash); color: var(--warn-ink); }
.notice { border-radius: 10px; padding: 11px 13px; font-size: 13.5px; background: var(--surface-2); margin: 10px 0; }
.notice.ok { background: var(--good-wash); color: var(--good-ink); }
.notice.bad { background: var(--bad-wash); color: var(--bad-ink); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--ink-2); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.dev-credit {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 18px 0 6px;
  padding: 10px; border: 1px dashed var(--line); border-radius: 12px; background: none; cursor: pointer;
  color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 600;
}
.dev-credit:hover { background: var(--surface-2); color: var(--ink-2); }
.dev-credit img { border-radius: 8px; flex-shrink: 0; }
.dev-topics .btn { justify-content: flex-start; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.check input { width: auto; margin: 0; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 12px; }
.seg button { border: 0; background: none; padding: 8px 14px; border-radius: 8px; font-weight: 650; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--accent-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.avatar { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 13px; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 64px; height: 64px; font-size: 20px; }

/* ------------------------------------------------------------ auth + onboarding */
.auth-screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 20px; background: linear-gradient(160deg, var(--accent) 0%, var(--accent-ink) 100%); }
.auth-card { background: var(--surface); border-radius: 20px; padding: 28px 24px; width: 100%; max-width: 380px; box-shadow: 0 30px 70px rgba(0, 0, 0, .35); }
.auth-card.wide { max-width: 440px; }
.auth-card.center { text-align: center; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.auth-logo { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 800; font-size: 15px; }
.auth-logo.sm { width: 28px; height: 28px; font-size: 11px; border-radius: 8px; }
.auth-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 16px; }
#ob-uni input { margin-bottom: 8px; }
.uni-option { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; margin-bottom: 6px; }
.uni-option:hover { border-color: var(--accent); background: var(--accent-wash); }
.picked-uni { display: flex; align-items: center; justify-content: space-between; padding: 12px; border: 1px solid var(--accent); background: var(--accent-wash); border-radius: 10px; margin-bottom: 12px; }
details#ob-add { margin: 8px 0 14px; font-size: 13px; color: var(--muted); }
details#ob-add summary { cursor: pointer; font-weight: 600; }
.add-uni { margin-top: 10px; }

/* ------------------------------------------------------------ shell */
.shell { display: flex; flex-direction: column; min-height: 100dvh; }
.topbar { position: sticky; top: 0; z-index: 5; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; }
.page { flex: 1; padding: 16px 16px 90px; max-width: 640px; width: 100%; margin: 0 auto; }
.page-head { margin-bottom: 14px; }
.page-head h1 { display: inline; }
.page-head .btn { float: right; }
.tabs-bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 1px solid var(--line); padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); }
.tabs-bottom a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; padding: 4px; border-radius: 10px; }
.tabs-bottom a.on { color: var(--accent-ink); background: var(--accent-wash); }
.tab-ico { font-size: 19px; }
.match-card .avatar { width: 46px; height: 46px; font-size: 15px; }
.balloon-banner { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; background: var(--accent-wash); color: var(--accent-ink); }
.ad-banner { position: relative; margin-bottom: 14px; }
.ad-card { display: block; text-decoration: none; color: inherit; padding-bottom: 34px; position: relative; }
.ad-tag { flex-shrink: 0; }
.ad-photo { display: block; width: 100%; max-height: 140px; object-fit: cover; border-radius: 10px; margin-bottom: 8px; }
.ad-card b { display: block; margin-bottom: 2px; }
.ad-cta { position: absolute; bottom: 10px; right: 16px; font-size: 11px; font-weight: 700; color: var(--accent-ink); text-decoration: none; }
@media (min-width: 720px) {
  .tabs-bottom { position: sticky; top: 57px; grid-template-columns: none; display: flex; gap: 4px; border-top: 0; border-bottom: 1px solid var(--line); padding: 10px 16px; max-width: 640px; margin: 0 auto; }
  .tabs-bottom a { flex-direction: row; padding: 8px 14px; }
}

/* ------------------------------------------------------------ confessions */
.new-confession textarea { margin-bottom: 8px; }
.confession-meta { display: flex; justify-content: space-between; margin-bottom: 6px; }
.confession-body { white-space: pre-wrap; }
.confession-actions { margin-top: 6px; }
.comment-list { max-height: 50vh; overflow-y: auto; }
.comment { padding: 8px 0; border-bottom: 1px solid var(--line); }
.comment:last-child { border-bottom: 0; }
.comment p { margin: 2px 0 0; }

/* ------------------------------------------------------------ lost & found */
.lf-post { display: flex; gap: 12px; }
.lf-post.resolved { opacity: .6; }
.lf-photo { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; flex-shrink: 0; }
.lf-body { flex: 1; min-width: 0; }
.field-hint { font-size: 12px; color: var(--muted); margin: -6px 0 10px; }

/* ------------------------------------------------------------ marketplace */
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.listing-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; cursor: pointer; box-shadow: var(--shadow); }
.listing-photo { aspect-ratio: 1; background: var(--surface-2); display: grid; place-items: center; }
.listing-photo img { width: 100%; height: 100%; object-fit: cover; }
.listing-noimg { color: var(--muted); font-size: 12px; }
.listing-noimg.lg { aspect-ratio: 1; display: grid; place-items: center; background: var(--surface-2); border-radius: 10px; }
.listing-info { padding: 8px 10px; }
.listing-info b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.listing-price { color: var(--accent-ink); font-weight: 700; font-size: 13px; }
.listing-price.lg { font-size: 20px; }
.listing-photos { display: flex; gap: 8px; overflow-x: auto; margin-bottom: 10px; }
.listing-photos img { height: 140px; border-radius: 10px; flex-shrink: 0; }

/* ------------------------------------------------------------ chats */
.chat-row { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.chat-thread { display: flex; flex-direction: column; height: calc(100dvh - 160px); }
.chat-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 2px; }
.bubble { max-width: 78%; background: var(--surface-2); border-radius: 14px 14px 14px 4px; padding: 8px 12px; align-self: flex-start; }
.bubble.mine { background: var(--accent); color: #fff; border-radius: 14px 14px 4px 14px; align-self: flex-end; }
.bubble p { margin: 0; white-space: pre-wrap; }
.bubble-time { display: block; font-size: 10.5px; opacity: .65; margin-top: 2px; }
.chat-photo { max-width: 220px; border-radius: 10px; display: block; margin-bottom: 4px; }
.chat-input { display: flex; gap: 8px; align-items: center; padding-top: 10px; }
.chat-input input[type="text"], .chat-input input:not([type]) { margin: 0; }
.topbar-avatar { text-decoration: none; }

/* ------------------------------------------------------------ profile */
.profile-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.profile-top h2 { margin: 0; }

/* ------------------------------------------------------------ modal + toast */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(15, 10, 30, .5); display: grid; place-items: center; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; width: min(480px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 22px; position: relative; }
.modal-sheet { width: min(480px, 100%); }
.modal-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--surface-2); font-size: 18px; cursor: pointer; color: var(--ink-2); }
#toast-root { position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 99px; font-size: 13.5px; box-shadow: var(--shadow); opacity: 1; transition: opacity .25s; }
.toast.out { opacity: 0; }
