/* =========================================================
   Breakroom — design tokens
   Ink navy + working-shift teal/coral, ticket-paper background.
   Display: Fraunces · Body: Inter · Utility/data: IBM Plex Mono
   ========================================================= */
:root {
  --ink: #1B2430;
  --ink-soft: #4A5568;
  --paper: #F6F5F1;
  --paper-raised: #FFFFFF;
  --border: #D8D3C7;
  --teal: #2F6F5E;
  --teal-dark: #204F42;
  --coral: #E8622C;
  --coral-soft: #FBE3D6;
  --teal-soft: #DCEBE6;
  --danger: #C6432B;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 2px rgba(27,36,48,.06), 0 1px 0 rgba(27,36,48,.04);
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; }
button, input, textarea, select { font-family: inherit; font-size: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.icon-svg { flex-shrink: 0; vertical-align: -3px; }

/* ---------- Landing / login (used by error & setup-needed pages) ---------- */
.landing-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--ink); }
.landing { padding: 24px; width: 100%; max-width: 420px; }
.landing-card {
  background: var(--paper);
  border-radius: 20px;
  padding: 40px 32px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.brand-logo { display: block; border-radius: 6px; }
.hero-brand .brand-logo, .marketing-footer .brand-logo { width: 20px; height: 20px; vertical-align: -5px; }
.landing-card h1 { font-size: 32px; margin-bottom: 8px; }
.landing-sub { color: var(--ink-soft); margin: 0 0 28px; line-height: 1.5; }
.landing-footnote { margin-top: 16px; font-size: 13px; color: var(--ink-soft); }

/* ---------- Split-screen sign-in page (base page when signed out) ---------- */
.auth-body { margin: 0; }
.auth-split { display: grid; grid-template-columns: 1.1fr 1fr; min-height: 100vh; }

.auth-visual { background: var(--teal-dark); position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; padding: 48px; }
.auth-visual-pattern {
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.09) 1.5px, transparent 1.5px);
  background-size: 22px 22px;
}
.auth-visual-content { position: relative; max-width: 380px; color: #fff; }
.auth-visual-logo { width: 44px; height: 44px; border-radius: 12px; margin-bottom: 28px; }
.auth-visual-content h2 { font-size: 30px; line-height: 1.2; color: #fff; margin-bottom: 16px; }
.auth-visual-content p { font-size: 15px; line-height: 1.6; color: #CFE3DC; margin: 0; }

.auth-panel { display: flex; align-items: center; justify-content: center; padding: 32px; background: var(--paper); }
.auth-panel-inner { width: 100%; max-width: 340px; }
.auth-panel-brand { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 600; font-size: 15px; color: var(--ink-soft); margin-bottom: 36px; }
.auth-panel h1 { font-size: 28px; margin-bottom: 8px; }
.auth-panel-sub { color: var(--ink-soft); font-size: 14.5px; margin: 0 0 26px; }
.btn-discord.auth-discord-btn { width: 100%; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.auth-footnote { margin-top: 18px; font-size: 12.5px; color: var(--ink-soft); line-height: 1.5; }

@media (max-width: 820px) {
  .auth-split { grid-template-columns: 1fr; }
  .auth-visual { display: none; }
  .auth-panel { min-height: 100vh; }
}

/* ---------- Admin panel ---------- */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.admin-card { background: var(--paper-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; }
.admin-card h2 { font-size: 17px; margin-bottom: 6px; }
.admin-form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.admin-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.admin-form input[type="text"], .admin-form input[type="url"] { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 14px; color: var(--ink); font-weight: 400; }
.admin-logo-row { display: flex; align-items: center; gap: 12px; }
.admin-logo-preview { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--border); object-fit: contain; background: var(--paper); }
.admin-form-inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; gap: 10px; border-top: 1px solid var(--border); padding-top: 16px; margin-top: 16px; }
.admin-link-list { display: flex; flex-direction: column; gap: 2px; margin-top: 14px; }
.admin-link-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--border); }
.admin-link-row:first-child { border-top: none; }
.admin-link-meta { flex: 1; }
.admin-link-label { font-size: 13.5px; font-weight: 600; }

@media (max-width: 760px) {
  .admin-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .hero-inner { grid-template-columns: 1fr; padding: 44px 22px 56px; text-align: center; }
  .hero-copy { order: 2; }
  .hero-copy h1 { font-size: 38px; }
  .hero-sub { margin-left: auto; margin-right: auto; }
  .hero-visual { order: 1; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr; }
  .stamp-ring { width: 160px; height: 160px; }
  .stamp-time { font-size: 24px; }
}
.btn-discord {
  display: inline-flex; align-items: center; gap: 10px; justify-content: center;
  width: fit-content; padding: 14px 20px; border-radius: var(--radius-sm);
  background: #5865F2; color: #fff; font-weight: 600; border: none; cursor: pointer;
}
.btn-discord:hover { background: #4752C4; }

/* ---------- App shell (top nav) ---------- */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; background: var(--paper); }

.topbar { background: var(--paper-raised); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 30; box-shadow: 0 1px 3px rgba(27,36,48,.04); }
.topbar-row { display: flex; align-items: center; gap: 20px; padding: 13px 24px; }
.topbar-brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.topbar-brand .brand-logo { width: 24px; height: 24px; }
.topbar-brand-name { font-family: var(--font-display); font-weight: 600; font-size: 18px; color: var(--ink); }

.topbar-search { flex: 1; max-width: 420px; display: flex; align-items: center; gap: 9px; background: var(--paper); border: 1px solid var(--border); border-radius: 999px; padding: 8px 14px; transition: border-color .15s; }
.topbar-search:focus-within { border-color: var(--teal); }
.topbar-search-icon { color: var(--ink-soft); }
.topbar-search input { flex: 1; background: transparent; border: none; color: var(--ink); font-size: 13.5px; }
.topbar-search input::placeholder { color: #A8A498; }
.topbar-search input:focus { outline: none; }

.topbar-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-shrink: 0; }
.topbar-clock { font-family: var(--font-mono); font-size: 12px; color: var(--ink-soft); display: flex; align-items: center; gap: 6px; padding: 0 10px; }
.icon-btn { background: none; border: none; color: var(--ink-soft); cursor: pointer; padding: 8px; border-radius: 999px; display: inline-flex; }
.icon-btn:hover { background: var(--paper); color: var(--ink); }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-live { background: #2FA872; box-shadow: 0 0 0 3px rgba(47,168,114,.18); }

.avatar-menu { position: relative; }
.avatar-menu-trigger { background: none; border: none; padding: 2px; cursor: pointer; border-radius: 50%; display: flex; margin-left: 4px; }
.avatar-menu-trigger:hover { outline: 2px solid var(--border); }
.avatar-menu-panel { position: absolute; right: 0; top: calc(100% + 10px); width: 200px; background: var(--paper-raised); color: var(--ink); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: 0 16px 40px rgba(27,36,48,.14); overflow: hidden; z-index: 40; }
.avatar-menu-header { padding: 12px 14px; border-bottom: 1px solid var(--border); }
.rail-user-name { font-size: 13.5px; font-weight: 600; }
.rail-user-role { font-size: 11.5px; color: var(--ink-soft); text-transform: capitalize; }
.avatar-menu-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 10px 14px; font-size: 13.5px; background: none; border: none; cursor: pointer; color: var(--ink); }
.avatar-menu-item:hover { background: var(--paper); }
.avatar-menu-signout { color: var(--danger); font-weight: 600; }

.topbar-tabs { display: flex; gap: 2px; padding: 0 20px; overflow-x: auto; border-top: 1px solid var(--border); }
.topbar-tabs a {
  display: flex; align-items: center; gap: 7px; padding: 12px 14px; white-space: nowrap;
  color: var(--ink-soft); font-weight: 500; font-size: 13.5px; border-bottom: 2px solid transparent; transition: color .12s;
}
.topbar-tabs a:hover { color: var(--ink); }
.topbar-tabs a.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--teal); }

.link-btn { background: none; border: none; color: var(--ink-soft); cursor: pointer; font-size: 13px; padding: 4px; }
.link-btn:hover { color: var(--ink); }

.main-col, .bare { flex: 1; max-width: 900px; margin: 0 auto; padding: 32px 28px 80px; width: 100%; }
.bare { max-width: 100%; padding: 0; }

/* ---------- Page furniture ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.page-head h1 { font-size: 26px; }
.section-label { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-soft); margin: 28px 0 12px; }
.muted-sm { color: var(--ink-soft); font-size: 13px; margin: 2px 0; }
.empty-state { background: var(--paper-raised); border: 1px dashed var(--border); border-radius: var(--radius); padding: 32px; text-align: center; color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; border: 1px solid transparent; cursor: pointer; font-weight: 600; padding: 9px 18px; transition: background-color .12s, border-color .12s, transform .08s; }
.btn:active { transform: scale(.98); }
.btn-sm { padding: 7px 14px; font-size: 13.5px; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-quiet { background: var(--paper-raised); border-color: var(--border); color: var(--ink); }
.btn-quiet:hover { background: var(--paper); border-color: #C7C2B4; }
.chip-btn { border: 1px solid var(--border); background: var(--paper-raised); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--ink-soft); }
.chip-btn-active { background: var(--teal-soft); border-color: var(--teal); color: var(--teal-dark); }
.file-btn { font-size: 13px; color: var(--ink-soft); cursor: pointer; padding: 6px 10px; border-radius: var(--radius-sm); }
.file-btn:hover { background: var(--paper); }

/* ---------- Avatars ---------- */
.avatar { border-radius: 50%; object-fit: cover; background: var(--border); flex-shrink: 0; }
.avatar-xs { width: 22px; height: 22px; }
.avatar-sm { width: 36px; height: 36px; }
.avatar-md { width: 56px; height: 56px; }

/* ---------- Layout with side rail ---------- */
.col-with-side { display: flex; gap: 28px; align-items: flex-start; }
.col-main { flex: 1; min-width: 0; }
.col-side { width: 260px; flex-shrink: 0; display: flex; flex-direction: column; gap: 16px; }
.side-card { background: var(--paper-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.side-card h3 { font-size: 14px; margin-bottom: 10px; }
.side-item { padding: 8px 0; border-top: 1px solid var(--border); }
.side-item:first-of-type { border-top: none; }
.side-item-title { font-size: 13.5px; font-weight: 600; }
.side-item-sub { font-size: 12px; color: var(--ink-soft); }
.side-link { display: inline-block; margin-top: 8px; font-size: 13px; color: var(--teal-dark); font-weight: 600; }
.side-person { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13.5px; }

/* ---------- My Groups / Quick Links sidebar widgets ---------- */
.side-group-row, .quick-link-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.side-group-row:first-of-type, .quick-link-row:first-of-type { border-top: none; }
.side-group-icon { font-size: 15px; }
.quick-link-row a { flex: 1; font-weight: 600; }
.quick-link-icon { font-size: 16px; width: 20px; text-align: center; }

/* ---------- Composer ---------- */
.composer { display: flex; gap: 12px; background: var(--paper-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; margin-bottom: 20px; box-shadow: var(--shadow-card); transition: border-color .15s; }
.composer:focus-within { border-color: var(--teal); }
.composer-form { flex: 1; }
.composer textarea { width: 100%; border: none; resize: vertical; font-size: 14.5px; background: transparent; }
.composer-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }

/* ---------- Post card ---------- */
.post { background: var(--paper-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow-card); position: relative; transition: box-shadow .15s; }
.post:hover { box-shadow: 0 4px 16px rgba(27,36,48,.08); }
.post-pinned { border-color: var(--coral); }
.post-pin-flag { font-size: 11.5px; font-weight: 700; color: var(--coral); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.post-author { font-weight: 600; font-size: 14.5px; }
.post-meta { font-size: 12.5px; color: var(--ink-soft); }
.post-pin-form { margin-left: auto; }
.post-body { font-size: 14.5px; line-height: 1.55; white-space: pre-wrap; margin: 0 0 10px; }
.post-image { width: 100%; border-radius: var(--radius-sm); margin-bottom: 10px; max-height: 420px; object-fit: cover; }
.post-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Priority posts ---------- */
.post-priority { border-color: var(--coral); box-shadow: 0 0 0 1px var(--coral); }
.priority-banner { display: flex; align-items: center; justify-content: space-between; background: var(--coral); color: #fff; border-radius: var(--radius-sm); padding: 8px 12px; margin-bottom: 12px; font-size: 13px; font-weight: 700; }
.priority-flag { display: flex; align-items: center; gap: 6px; letter-spacing: .02em; }
.priority-ack-done { font-weight: 600; font-size: 12.5px; opacity: .95; }
.btn-priority { background: #fff; color: var(--coral); font-weight: 700; }
.btn-priority:hover { background: #fff4ee; }
.priority-checkbox-row { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--coral); font-weight: 600; margin-right: auto; }
.priority-checkbox-row input { width: auto; }

/* ---------- Reactions ---------- */
.reaction-bar { position: relative; display: flex; align-items: center; gap: 8px; }
.reaction-toggle { border: 1px solid var(--border); background: var(--paper-raised); border-radius: 999px; padding: 5px 12px; font-size: 13px; cursor: pointer; color: var(--ink-soft); }
.reaction-toggle:hover { background: var(--paper); }
.reaction-picker { position: absolute; bottom: calc(100% + 6px); left: 0; display: flex; gap: 4px; background: var(--paper-raised); border: 1px solid var(--border); border-radius: 999px; padding: 6px; box-shadow: var(--shadow-card); z-index: 5; }
.reaction-picker[hidden] { display: none; }
.reaction-picker-form { display: contents; }
.reaction-option { border: none; background: transparent; font-size: 18px; line-height: 1; padding: 4px 6px; border-radius: 999px; cursor: pointer; }
.reaction-option:hover { background: var(--paper); }
.reaction-option-active { background: var(--teal-soft); }
.reaction-summary { display: flex; gap: 4px; }
.reaction-chip { font-size: 12.5px; background: var(--paper); border-radius: 999px; padding: 3px 8px; color: var(--ink-soft); }
.comments { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 10px; }
.comments-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.comment-row { font-size: 13px; }
.comment-author { font-weight: 600; margin-right: 6px; }
.comment-form { display: flex; gap: 8px; }
.comment-form input { flex: 1; border: 1px solid var(--border); border-radius: 999px; padding: 7px 12px; font-size: 13px; }
.comment-form button { border: none; background: var(--teal); color: #fff; border-radius: 999px; padding: 7px 14px; font-size: 13px; cursor: pointer; }

/* ---------- Announcements (notice board) ---------- */
.notice { background: var(--paper-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 18px 18px 18px 44px; margin-bottom: 14px; position: relative; }
.notice-pinned { background: var(--coral-soft); border-color: var(--coral); }
.notice-pin-icon { position: absolute; left: 14px; top: 16px; font-size: 16px; }
.notice-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.notice-title { font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.badge { display: inline-block; font-size: 11px; text-transform: capitalize; background: var(--teal-soft); color: var(--teal-dark); border-radius: 999px; padding: 2px 8px; margin-left: 4px; }
.badge-role-admin { background: var(--coral-soft); color: var(--coral); }
.badge-role-manager { background: var(--teal-soft); color: var(--teal-dark); }
.badge-role-crew { background: #EDEBE3; color: var(--ink-soft); }

/* ---------- Communities ---------- */
.community-grid { display: block; }
.card-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 8px; }
.community-card { background: var(--paper-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 4px; transition: box-shadow .15s, border-color .15s; }
.community-card:hover { box-shadow: 0 4px 16px rgba(27,36,48,.08); border-color: #C7C2B4; }
.community-card-name { font-weight: 700; font-family: var(--font-display); font-size: 16px; }
.community-card-actions { display: flex; gap: 8px; margin-top: 10px; }

/* ---------- Directory ---------- */
.search-form input { border: 1px solid var(--border); border-radius: 999px; padding: 9px 16px; width: 260px; background: var(--paper-raised); }
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.person-card { background: var(--paper-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; transition: box-shadow .15s, border-color .15s; }
.person-card:hover { box-shadow: 0 4px 16px rgba(27,36,48,.08); border-color: #C7C2B4; }
.person-name { font-weight: 700; margin-top: 8px; }
.person-actions { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.role-form select { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--border); padding: 6px; font-size: 12.5px; }

/* ---------- Messages / chat ---------- */
.conversation-list { display: flex; flex-direction: column; gap: 4px; }
.conversation-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius-sm); background: var(--paper-raised); border: 1px solid var(--border); margin-bottom: 6px; }
.conversation-row:hover { border-color: var(--teal); }
.conversation-name { font-weight: 600; font-size: 14.5px; }
.conversation-preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 420px; }
.dm-pick-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.dm-pick-row:first-of-type { border-top: none; }
.dm-pick-row span { flex: 1; }

.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - 64px); }
.chat-log { flex: 1; overflow-y: auto; padding: 10px 4px; display: flex; flex-direction: column; gap: 10px; }
.chat-bubble-row { display: flex; align-items: flex-end; gap: 8px; max-width: 70%; }
.chat-bubble-row.me { margin-left: auto; flex-direction: row-reverse; }
.chat-bubble { background: var(--paper-raised); border: 1px solid var(--border); border-radius: 14px; padding: 9px 13px; font-size: 14px; }
.chat-bubble-row.me .chat-bubble { background: var(--teal); color: #fff; border-color: var(--teal); }
.chat-form { display: flex; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; border: 1px solid var(--border); border-radius: 999px; padding: 11px 16px; }
.chat-form button { border: none; background: var(--teal); color: #fff; border-radius: 999px; padding: 0 20px; font-weight: 600; cursor: pointer; }

/* ---------- Schedule ---------- */
.shift-list { display: flex; flex-direction: column; gap: 8px; }
.shift-row { display: flex; align-items: center; gap: 14px; background: var(--paper-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 13.5px; }
.shift-time { font-family: var(--font-mono); font-weight: 600; color: var(--teal-dark); }

/* ---------- Modals ---------- */
dialog { border: none; border-radius: var(--radius); padding: 0; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(27,36,48,.45); }
.modal-form { padding: 24px; display: flex; flex-direction: column; gap: 12px; width: 340px; max-width: 84vw; max-height: 80vh; overflow-y: auto; }
.modal-form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.modal-form input, .modal-form textarea, .modal-form select { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 11px; font-size: 14px; color: var(--ink); font-weight: 400; }
.checkbox-row { flex-direction: row !important; align-items: center; gap: 8px !important; }
.checkbox-row input { width: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .topbar-search { display: none; }
  .topbar-clock { display: none; }
  .main-col { padding: 16px 14px 40px; }
  .col-with-side { flex-direction: column; }
  .col-side { width: 100%; }
  .topbar-row { padding: 10px 14px; gap: 12px; }
  .topbar-tabs { padding: 0 8px; }
}
