/* Vance Family Condo — red rock & sand */
:root {
  --bg: #f7f2ec;
  --card: #ffffff;
  --ink: #2b2320;
  --muted: #7d6f66;
  --line: #eadfd3;
  --brand: #9a3412;
  --brand-2: #c2410c;
  --brand-soft: #fff1e6;
  --accent: #0f766e;
  --accent-soft: #e6f4f1;
  --danger: #b91c1c;
  --warn-bg: #fff7e0; --warn-line: #f3d27a; --warn-ink: #7a5300;
  --ok-bg: #e8f6ee; --ok-line: #a7dcbc; --ok-ink: #17603a;
  --err-bg: #fdecec; --err-line: #f2b8b8; --err-ink: #8f1d1d;
  --info-bg: #eaf1fb; --info-ink: #1e4f8f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(60, 30, 10, .05), 0 4px 16px rgba(60, 30, 10, .05);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand-2); }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0 0 .35rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
p { margin: 0 0 .8rem; }
code { background: #f3ebe2; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 40px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.plain { list-style: none; margin: 0; padding: 0; }
.inline { display: inline; }

/* Top bar */
.topbar { background: linear-gradient(135deg, #7c2d12, var(--brand) 55%, #b45309); color: #fff7ed; box-shadow: 0 2px 10px rgba(124, 45, 18, .25); }
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { color: #fff7ed; font-weight: 700; text-decoration: none; font-size: 1.1rem; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.sun { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(255, 237, 213, .18); }
.nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav a, .nav .linklike { color: #ffedd5; text-decoration: none; padding: 8px 12px; border-radius: 8px; font-size: .95rem; }
.nav a:hover, .nav .linklike:hover { background: rgba(255, 255, 255, .12); }
.nav a.active { background: rgba(255, 255, 255, .2); color: #fff; font-weight: 600; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.nav-toggle { display: none; background: none; border: 1px solid rgba(255, 255, 255, .35); color: #fff; border-radius: 8px; font-size: 1.1rem; padding: 4px 10px; cursor: pointer; }
@media (max-width: 720px) {
  .nav-toggle { display: block; }
  .nav { display: none; width: 100%; flex-direction: column; align-items: stretch; padding-bottom: 10px; }
  .nav.open { display: flex; }
  .nav form, .nav .linklike { width: 100%; text-align: left; }
}

/* Cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.card.narrow { max-width: 440px; margin: 32px auto; }
.narrow-wide { max-width: 680px; margin-left: auto; margin-right: auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.grid-wide-left { grid-template-columns: 1.4fr 1fr; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
@media (max-width: 820px) { .grid-2, .grid-wide-left, .row-3 { grid-template-columns: 1fr; } }
@media (max-width: 420px) { .row-2 { grid-template-columns: 1fr; } }
.footer { color: var(--muted); font-size: .8rem; padding-bottom: 28px; text-align: center; }

/* Forms */
.stack { display: grid; gap: 14px; }
label { display: grid; gap: 5px; font-weight: 600; font-size: .92rem; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: #fff;
  border: 1px solid #dccfc2; border-radius: 10px; padding: 10px 12px; width: 100%; min-height: 44px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(194, 65, 12, .2); border-color: var(--brand-2); }
input[type=checkbox] { width: auto; min-height: 0; }
.row-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.row-form label { flex: 1 1 160px; }
.row-form label.grow { flex: 3 1 240px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 16px; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--brand-2); color: #fff; border: 1px solid var(--brand-2); border-radius: 10px;
  padding: 10px 18px; min-height: 44px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand); border-color: var(--brand); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 5px 12px; min-height: 34px; font-size: .85rem; }
.btn-secondary { background: #fff; color: var(--brand-2); }
.btn-secondary:hover { background: var(--brand-soft); color: var(--brand); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f3ebe2; border-color: #dccfc2; }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: #0b5e57; border-color: #0b5e57; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: #f0c7c7; }
.btn-danger-ghost:hover { background: var(--err-bg); }
.btn-block { width: 100%; font-size: 1.05rem; min-height: 52px; margin-top: 8px; }

/* Flash */
.flash { border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; border: 1px solid; }
.flash-ok { background: var(--ok-bg); border-color: var(--ok-line); color: var(--ok-ink); }
.flash-error { background: var(--err-bg); border-color: var(--err-line); color: var(--err-ink); }
.flash-warn { background: var(--warn-bg); border-color: var(--warn-line); color: var(--warn-ink); }
.flash ul { margin: 0; }

/* Badges & avatars */
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok-ink); }
.badge-info { background: var(--info-bg); color: var(--info-ink); }
.badge-warn { background: var(--warn-bg); color: var(--warn-ink); }
.badge-alert { background: var(--err-bg); color: var(--err-ink); }
.badge-muted { background: #efe8e1; color: var(--muted); }
.avatar { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; color: #fff; font-weight: 700; font-size: .8rem; letter-spacing: .02em; vertical-align: middle; }
.avatar-blocked { background: #a8a29e; }
.avatar-google { background: #1a73e8; }

/* Calendar */
.cal-card { padding: 16px; }
.cal-nav { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.cal-nav h2 { margin: 0; min-width: 170px; text-align: center; font-size: 1.25rem; }
.cal-nav .btn-ghost { min-width: 44px; font-size: 1.2rem; padding: 6px 12px; }
.cal-nav .btn-ghost.small { font-size: .85rem; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.cal-dow { text-align: center; font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 8px 0; background: #faf6f1; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.cal-day { position: relative; min-height: 96px; padding: 4px 0 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; gap: 3px; }
.cal-day.out { background: #fbf8f5; }
.cal-day.out .cal-num { opacity: .45; }
.cal-day.past { background: #faf7f3; }
.cal-day.past .pill { opacity: .6; }
.cal-day.free { background: #fbfefc; }
.cal-day.free:hover { background: var(--accent-soft); }
.cal-day.blocked { background: repeating-linear-gradient(-45deg, #f4efea, #f4efea 6px, #ece4dc 6px, #ece4dc 12px); }
.cal-day.today .cal-num { background: var(--brand-2); color: #fff; }
.cal-num { align-self: flex-start; margin-left: 5px; font-size: .8rem; font-weight: 600; min-width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; padding: 0 4px; }
.cal-hit { position: absolute; inset: 0; z-index: 1; }
.pill { position: relative; z-index: 2; display: block; font-size: .74rem; font-weight: 600; line-height: 1.2; padding: 4px 6px; color: #fff; background: var(--c, var(--brand-2)); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill-start { margin-left: 4px; border-top-left-radius: 6px; border-bottom-left-radius: 6px; }
.pill-out { background: transparent; color: var(--c); border: 1px dashed var(--c); margin: 0 30% 0 0; border-left: 0; border-radius: 0 6px 6px 0; font-weight: 500; }
.pill-blocked { background: #78716c; margin: 0 4px; border-radius: 6px; white-space: normal; }
.pill-google { background: #4b5563; margin: 0 4px; border-radius: 6px; white-space: normal; border-left: 4px solid #1a73e8; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 12px; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -1px; margin-right: 4px; border: 1px solid var(--line); }
.sw-free { background: var(--accent-soft); }
.sw-booked { background: var(--brand-2); border-color: var(--brand-2); }
.sw-google { background: #4b5563; border-left: 3px solid #1a73e8; }
.sw-blocked { background: repeating-linear-gradient(-45deg, #e7e0d9, #e7e0d9 3px, #cfc6be 3px, #cfc6be 6px); }
@media (max-width: 640px) {
  .cal-card { padding: 10px; }
  .cal-day { min-height: 64px; }
  .pill { font-size: .62rem; padding: 3px 3px; }
  .pill-out { display: none; }
  .cal-dow { font-size: .62rem; letter-spacing: 0; }
  .cal-nav h2 { font-size: 1.05rem; min-width: 0; flex: 1; }
}

/* Booking lists */
.booking-list { list-style: none; margin: 0; padding: 0; }
.booking-list li + li { border-top: 1px solid var(--line); }
.booking-list a { display: flex; align-items: center; gap: 12px; padding: 12px 4px; color: inherit; text-decoration: none; border-radius: 8px; }
.booking-list a:hover { background: #fbf7f2; }
.bl-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.taken li { display: flex; gap: 10px; align-items: center; padding: 8px 0; }
.taken li + li { border-top: 1px solid var(--line); }

/* Booking detail */
.booking-hero { border-top: 5px solid var(--c); }
.bh-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.bh-top .avatar { width: 52px; height: 52px; font-size: 1.05rem; }
.bh-top h1 { margin: 0; }
.bh-top p { margin: 0; }
.bh-badge { margin-left: auto; }
.details { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px 20px; margin: 22px 0 0; }
.details div { background: #fbf7f2; border-radius: 10px; padding: 12px 14px; }
.details dt { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.details dd { margin: 3px 0 0; font-weight: 600; word-break: break-word; }
.notes { margin-top: 16px; background: var(--brand-soft); border-radius: 10px; padding: 12px 14px; }
.notes p { margin: 4px 0 0; }
.info-box { background: var(--brand-soft); border: 1px solid #fed7aa; border-radius: 10px; padding: 14px; }

/* Checklist */
.progress { height: 10px; background: #efe6dc; border-radius: 99px; overflow: hidden; margin: 18px 0 6px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), #14b8a6); border-radius: 99px; transition: width .3s; }
.checklist { list-style: none; padding: 0; margin: 14px 0 10px; display: grid; gap: 10px; }
.check { display: flex; align-items: flex-start; gap: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; font-weight: 400; background: #fff; transition: background .15s, border-color .15s; }
.check:hover { border-color: #d6c6b6; }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .box { flex: none; width: 26px; height: 26px; border-radius: 8px; border: 2px solid #cbbcad; display: grid; place-items: center; margin-top: 1px; transition: all .15s; }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box::after { content: ""; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg) translate(-1px, -1px); }
.check input:focus-visible + .box { outline: 3px solid rgba(15, 118, 110, .3); }
.check input:disabled + .box { opacity: .6; }
.check.is-checked { background: var(--accent-soft); border-color: #b7ded7; }
.check.is-checked strong { text-decoration: line-through; text-decoration-color: rgba(15, 118, 110, .5); }
.check-text { display: flex; flex-direction: column; gap: 2px; }

/* Admin */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 12px 0 18px; border-bottom: 1px solid var(--line); }
.tabs a { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 600; font-size: .92rem; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a.active { color: var(--brand-2); border-color: var(--brand-2); }
.seg { display: inline-flex; background: #f3ebe2; border-radius: 10px; padding: 3px; }
.seg a { padding: 6px 12px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .88rem; font-weight: 600; }
.seg a.active { background: #fff; color: var(--ink); box-shadow: var(--shadow); }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--line); }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table .avatar { width: 28px; height: 28px; font-size: .68rem; margin-right: 4px; }
.people { display: grid; gap: 8px; }
.person { border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; }
.person[open] { padding-bottom: 14px; background: #fdfbf8; }
.person summary { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; list-style: none; flex-wrap: wrap; }
.person summary::-webkit-details-marker { display: none; }
.person.inactive summary { opacity: .55; }
.person .row-form { margin-top: 4px; }
.cl-edit { display: grid; gap: 8px; margin-bottom: 16px; }
.cl-row { display: flex; gap: 10px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 10px; }
.cl-row.inactive { opacity: .55; }
.cl-sort { width: 70px !important; flex: none; }
.cl-fields { flex: 1; display: grid; gap: 6px; min-width: 0; }
.cl-fields input.small { min-height: 36px; padding: 6px 10px; }
.cl-active { display: flex; align-items: center; gap: 6px; flex: none; font-weight: 500; }
@media (max-width: 640px) { .cl-row { flex-wrap: wrap; } .cl-fields { flex-basis: 100%; order: -1; } }

/* ================= v3: notifications, tab bar, tickets, resources ================= */
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { display: inline-block; vertical-align: middle; flex: none; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.card.flush { padding: 0; overflow: hidden; }
.pad { padding: 18px 22px; margin: 0; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; padding: 18px 22px 6px; }
.card-head h2 { margin: 0; }
.hint { font-weight: 400; font-size: .8rem; color: var(--muted); }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chev { color: #c4b5a6; font-size: 1.5rem; line-height: 1; margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand-2); display: inline-block; flex: none; margin-left: 6px; }
.empty { text-align: center; padding: 36px 20px; }
.empty-ic { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; margin: 0 auto 10px; }
.empty p { margin: 0 0 4px; }

/* Bell + counts in the top bar */
.bell { position: relative; color: #ffedd5; display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; order: 3; }
.bell:hover, .bell.active { background: rgba(255, 255, 255, .15); }
.bell .count, .tab-ic .count {
  position: absolute; top: 2px; right: 0; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px;
  background: #fde047; color: #7c2d12; font-size: .68rem; font-weight: 800; display: grid; place-items: center; line-height: 1;
}
.nav { order: 2; }
.nav-toggle { order: 4; }
@media (max-width: 720px) { .nav { order: 5; } }
.pill-count { display: inline-block; min-width: 20px; padding: 1px 6px; border-radius: 99px; background: #fde047; color: #7c2d12; font-size: .72rem; font-weight: 800; text-align: center; margin-left: 2px; }

/* Phone tab bar */
.tabbar { display: none; }
@media (max-width: 720px) {
  .topbar .bell { display: none; }
  body { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(8px); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 16px rgba(60, 30, 10, .06);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600; padding: 4px 0; border-radius: 10px; }
  .tabbar a.active { color: var(--brand-2); }
  .tabbar a.active .tab-ic { background: var(--brand-soft); }
  .tab-ic { position: relative; display: grid; place-items: center; width: 48px; height: 30px; border-radius: 99px; }
  .tab-ic .count { top: -4px; right: 2px; }
  .footer { padding-bottom: 12px; }
}

/* Notifications */
.notif-list { list-style: none; margin: 0; padding: 0; }
.notif-list li + li { border-top: 1px solid var(--line); }
.notif-list a { display: flex; gap: 12px; align-items: center; padding: 14px 18px; text-decoration: none; color: inherit; }
.notif-list a:hover { background: #fbf7f2; }
.notif-list li.unread { background: #fff8f2; }
.notif-list li.unread strong { color: var(--brand); }
.notif-icon { width: 38px; height: 38px; border-radius: 50%; background: #f3ebe2; display: grid; place-items: center; flex: none; font-size: 1.05rem; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat:hover { border-color: #d6c6b6; }
.stat-num { font-size: 2rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .85rem; font-weight: 600; }
.stat-high .stat-num { color: var(--danger); }
.stat-warn .stat-num { color: #b45309; }
@media (max-width: 480px) { .stats { grid-template-columns: 1fr 1fr; } .stat-num { font-size: 1.6rem; } }

.seg-scroll { display: flex; overflow-x: auto; max-width: 100%; margin-bottom: 14px; scrollbar-width: none; }
.seg-scroll::-webkit-scrollbar { display: none; }
.seg-scroll a { white-space: nowrap; }

/* Priority colors */
.prio-high { background: #fee2e2; color: #991b1b; }
.prio-medium { background: #fef3c7; color: #92400e; }
.prio-low { background: #e2e8f0; color: #334155; }

/* Ticket list */
.ticket-list { list-style: none; margin: 0; padding: 0; }
.ticket-list li { border-left: 4px solid transparent; }
.ticket-list li + li { border-top: 1px solid var(--line); }
.ticket-list li.prio-edge-high { border-left-color: #dc2626; }
.ticket-list li.prio-edge-medium { border-left-color: #f59e0b; }
.ticket-list li.prio-edge-low { border-left-color: #94a3b8; }
.ticket-list a { display: flex; align-items: center; gap: 10px; padding: 14px 16px 14px 14px; text-decoration: none; color: inherit; }
.ticket-list a:hover { background: #fbf7f2; }
.ticket-list .bl-main { gap: 4px; }
.tl-top { display: flex; align-items: center; }
.tl-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* New ticket form */
.emergency { font-size: .92rem; }
.prio-pick { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.prio-pick legend { font-weight: 600; font-size: .92rem; margin-bottom: 6px; padding: 0; }
.prio-opt { position: relative; display: block; cursor: pointer; }
.prio-opt input { position: absolute; opacity: 0; }
.prio-opt span { display: flex; flex-direction: column; gap: 2px; border: 2px solid var(--line); border-radius: 12px; padding: 10px 12px; min-height: 64px; transition: all .15s; }
.prio-opt small { font-weight: 400; color: var(--muted); font-size: .76rem; line-height: 1.3; }
.prio-opt input:focus-visible + span { outline: 3px solid rgba(194, 65, 12, .25); }
.prio-opt-high input:checked + span { border-color: #dc2626; background: #fef2f2; }
.prio-opt-medium input:checked + span { border-color: #f59e0b; background: #fffbeb; }
.prio-opt-low input:checked + span { border-color: #64748b; background: #f8fafc; }
@media (max-width: 480px) { .prio-pick { grid-template-columns: 1fr; } .prio-opt span { min-height: 0; flex-direction: row; align-items: baseline; gap: 8px; } }

/* File picker */
.file-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-weight: 500; cursor: pointer; }
.file-pick input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-pick-btn { display: inline-flex; align-items: center; gap: 6px; border: 1.5px dashed #cdbba9; border-radius: 10px; padding: 9px 14px; background: #fbf7f2; color: var(--ink); font-weight: 600; font-size: .9rem; }
.file-pick:hover .file-pick-btn { border-color: var(--brand-2); color: var(--brand-2); }
.file-pick.has-files .file-pick-btn { border-style: solid; border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.file-pick-list { word-break: break-word; }
.file-pick input:focus-visible + .file-pick-list, .file-pick:focus-within .file-pick-btn { outline: 3px solid rgba(194, 65, 12, .2); }

/* Upload progress overlay */
.upload-overlay { position: fixed; inset: 0; background: rgba(43, 35, 32, .45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.upload-box { background: #fff; border-radius: var(--radius); padding: 22px; width: min(360px, 100%); text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, .2); }
.upload-box .progress { margin: 14px 0 6px; }
.upload-box p { margin: 10px 0 0; }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 14px 0; }
.gallery-compact { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); margin: 8px 0 0; }
.media { border-radius: 10px; overflow: hidden; background: #efe6dc; }
.media-image { display: block; aspect-ratio: 4 / 3; }
.media-image img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.media-image:hover img { transform: scale(1.03); }
.media-video, .media-embed { grid-column: 1 / -1; background: #000; }
.media-video video { display: block; width: 100%; max-height: 70vh; background: #000; }
.media-embed { position: relative; aspect-ratio: 16 / 9; margin: 0 0 12px; }
.media-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.gallery-compact .media-video { grid-column: 1 / -1; }

/* Ticket page */
.ticket-head { border-top: 5px solid #94a3b8; }
.prio-top-high { border-top-color: #dc2626; }
.prio-top-medium { border-top-color: #f59e0b; }
.ticket-head h1 { margin: 10px 0 14px; }
.ticket-by { display: flex; align-items: center; gap: 12px; }
.contact-mini { margin-left: auto; display: flex; gap: 6px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--accent); background: #fff; }
.icon-btn:hover { background: var(--accent-soft); }
.ticket-desc { margin: 16px 0 0; padding: 14px 16px; background: #fbf7f2; border-radius: 10px; white-space: normal; }
.edit-box { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.edit-box summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9rem; padding: 6px 0; }
.edit-box[open] summary { margin-bottom: 10px; }
.file-manage { display: flex; flex-wrap: wrap; gap: 6px; }

.thread { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 18px; }
.thread-event { text-align: center; }
.thread-event span { display: inline-block; font-size: .78rem; color: var(--muted); background: #efe6dc; padding: 4px 12px; border-radius: 99px; }
.msg { display: flex; gap: 10px; align-items: flex-end; max-width: 88%; }
.msg .avatar { width: 32px; height: 32px; font-size: .7rem; }
.msg-bubble { background: #fff; border: 1px solid var(--line); border-radius: 16px 16px 16px 4px; padding: 10px 14px; box-shadow: var(--shadow); min-width: 0; }
.msg-mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-mine .msg-bubble { background: #fff1e6; border-color: #fed7aa; border-radius: 16px 16px 4px 16px; }
.msg-meta { font-size: .78rem; margin-bottom: 3px; }
.msg-body { word-break: break-word; }
.reply-box { padding: 12px; }
.reply-box textarea { min-height: 76px; }
.reply-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.reply-actions .file-pick-list { display: none; }
.reply-actions .file-pick.has-files .file-pick-list { display: inline; }

/* Resources */
.res-tools { display: grid; gap: 10px; margin-bottom: 18px; }
.search { position: relative; display: block; }
.search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 44px; border-radius: 99px; min-height: 48px; background: #fff; }
.res-tools .seg-scroll { margin: 0; }
.res-section { margin-bottom: 26px; }
.res-h { font-size: 1.05rem; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 0 0 10px; }
.res-h .small { font-weight: 400; }
.accordion { display: grid; gap: 10px; }
.acc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; scroll-margin-top: 12px; }
.acc summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 16px 18px; min-height: 60px; }
.acc summary::-webkit-details-marker { display: none; }
.acc summary:hover { background: #fdfaf6; }
.acc-title { font-weight: 700; flex: 1; min-width: 0; }
.acc-tags { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tag { font-size: .72rem; font-weight: 700; color: var(--brand); background: var(--brand-soft); padding: 3px 8px; border-radius: 99px; white-space: nowrap; }
.acc-chev { width: 28px; height: 28px; flex: none; border-radius: 50%; background: #f3ebe2; position: relative; transition: transform .2s, background .2s; }
.acc-chev::after { content: ""; position: absolute; left: 50%; top: 45%; width: 8px; height: 8px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translate(-50%, -50%) rotate(45deg); }
.acc[open] .acc-chev { transform: rotate(180deg); background: var(--brand-soft); }
.acc[open] summary { border-bottom: 1px solid var(--line); }
.acc-body { padding: 16px 18px 18px; }
.acc-body > .gallery:first-child { margin-top: 0; }
.acc.is-hidden, .contact-card.is-hidden { opacity: .6; border-style: dashed; }
.prose p { margin: 0 0 .7rem; }
.prose ol, .prose ul { margin: 0 0 .8rem; padding-left: 1.3rem; }
.prose li { margin-bottom: .35rem; }
.prose ol li::marker { font-weight: 700; color: var(--brand-2); }
.res-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.res-actions .btn { gap: 6px; }
.res-actions .ic { width: 16px; height: 16px; }
.contact-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.contact-card { margin: 0; padding: 18px; scroll-margin-top: 12px; }
.cc-head { display: flex; align-items: baseline; gap: 8px; }
.cc-head h3 { margin: 0 0 6px; font-size: 1.02rem; flex: 1; }
.cta-card { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; background: var(--brand-soft); border-color: #fed7aa; }

/* Resource editor */
.group { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 0; display: grid; gap: 12px; }
.group legend { font-weight: 700; padding: 0 6px; }
.media-manage { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.media-manage li { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.media-manage img, .vid-thumb { width: 64px; height: 48px; object-fit: cover; border-radius: 6px; flex: none; }
.vid-thumb { background: #1f2937; color: #fff; display: grid; place-items: center; }
.mm-name { flex: 1; min-width: 0; word-break: break-word; }
.mm-btns { display: flex; gap: 4px; }
.check-inline { display: flex; align-items: center; gap: 8px; align-self: end; min-height: 44px; }
.danger-zone { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 14px; }
label .muted, label .small { font-weight: 400; }
@media (max-width: 720px) { .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; } .tabs a { white-space: nowrap; } }

.link-btn { color: var(--brand-2); padding: 0; font-size: inherit; text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
