/* =====================================================================
   Shared styles for login, dashboard, and admin pages.
   Color scheme adapted from the EventSign reference: red accent on a
   warm cream background, white rounded cards with soft shadows.
   ===================================================================== */

:root {
  --accent:      #e23a3a;
  --accent-soft: #fde8e8;
  --bg:          #fcf6f3;
  --card:        #ffffff;
  --text:        #0f172a;
  --muted:       #6b7280;
  --border:      #f0e6e1;
  --shadow:      0 1px 2px rgba(15,23,42,0.04), 0 1px 3px rgba(15,23,42,0.03);
  --shadow-lift: 0 4px 14px rgba(15,23,42,0.06);
  --pink-bg:     #fde8e6;  --pink-fg:  #e23a3a;
  --mint-bg:     #d9f5ec;  --mint-fg:  #0fa97a;
  --amber-bg:    #fdf0d3;  --amber-fg: #d49a1a;
  --indigo-bg:   #e6e8fb;  --indigo-fg:#5b5fdf;
  --danger:      #dc2626;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif; background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }

/* ---------- Brand mark ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand .mark {
  height: 36px; width: auto; border-radius: 0; background: transparent;
  display: flex; align-items: center; justify-content: center;
  box-shadow: none;
}
.brand .mark svg { height: 30px; width: auto; }
.brand .mark img { height: 36px; width: auto; display: block; }
.brand .name { font-weight: 800; font-size: 17px; letter-spacing: -0.01em; }

/* ---------- Top nav ---------- */
.nav { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.nav-inner { max-width: 1280px; margin: 0 auto; padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.nav-tabs { display: flex; align-items: center; gap: 4px; }
.nav-tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px;
  border-radius: 999px; font-weight: 600; font-size: 14px; color: #475569;
  text-decoration: none; cursor: pointer; transition: background 0.15s, color 0.15s;
  background: transparent; border: none;
}
.nav-tab:hover { background: #f4eeea; }
.nav-tab.active { background: var(--accent); color: white; box-shadow: 0 2px 6px rgba(226,58,58,0.25); }
.nav-tab svg { width: 14px; height: 14px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg, #fda4a4, #e23a3a);
  color: white; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center;
  border: 2px solid white; box-shadow: var(--shadow);
}
.user-block { display: flex; align-items: center; gap: 12px; }
.user-block .who-name { font-weight: 600; font-size: 14px; }
.user-block .logout { font-size: 13px; color: var(--muted); cursor: pointer; background: none; border: none; }
.user-block .logout:hover { color: var(--accent); }

/* Hamburger menu button — hidden on desktop, shown on mobile */
.hamburger {
  display: none;
  align-items: center; justify-content: center;
  width: 38px; height: 38px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9px;
  cursor: pointer;
}
.hamburger:hover { background: #faf3f0; }
.hamburger svg { display: block; }

/* ---------- Page ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 28px 28px 60px; }
.page-head h1 { font-size: 28px; font-weight: 800; margin: 0; letter-spacing: -0.02em; }
.page-head p  { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.banner {
  margin-top: 22px; padding: 16px 20px; border-radius: 14px;
  background: linear-gradient(135deg, #fde8e6 0%, #fdf0e6 100%);
  border: 1px solid #fbd5d1;
  color: #1f1f1f; font-size: 14px; font-weight: 500;
}

/* ---------- Stat cards ---------- */
.stats { margin-top: 22px; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat {
  background: var(--card); border: 1px solid var(--border); border-radius: 16px;
  padding: 20px 22px; box-shadow: var(--shadow);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  min-height: 110px;
}
.stat .label { font-size: 13px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat .value { font-size: 30px; font-weight: 800; margin-top: 8px; letter-spacing: -0.02em; line-height: 1.1; }
.stat .sub   { font-size: 12px; color: var(--muted); margin-top: 4px; }
.chip { width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.chip svg { width: 18px; height: 18px; }
.chip.pink   { background: var(--pink-bg);   color: var(--pink-fg); }
.chip.mint   { background: var(--mint-bg);   color: var(--mint-fg); }
.chip.amber  { background: var(--amber-bg);  color: var(--amber-fg); }
.chip.indigo { background: var(--indigo-bg); color: var(--indigo-fg); }

/* ---------- Panel ---------- */
.grid-2 { display: grid; gap: 18px; grid-template-columns: 1fr 1fr; margin-top: 18px; }
@media (max-width: 880px) { .grid-2 { grid-template-columns: 1fr; } }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.panel-head { padding: 18px 22px 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 700; }
.panel-head .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.panel-head .actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px;
  background: var(--accent); color: white; border: none; border-radius: 10px;
  font-size: 14px; font-weight: 600; cursor: pointer; transition: filter 0.15s;
  font-family: inherit;
}
.btn:hover { filter: brightness(0.95); }
.btn.ghost { background: var(--card); color: #334155; border: 1px solid var(--border); }
.btn.ghost:hover { background: #faf3f0; filter: none; }
.btn.danger { background: var(--danger); }
.btn.sm { padding: 6px 12px; font-size: 13px; }

/* Active state for filter shortcut buttons (Today / Yesterday) */
.btn.ghost.btn-active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}
.btn.ghost.btn-active:hover { background: var(--accent-soft); filter: none; }

/* Clear button — softer amber to distinguish from the date shortcut buttons */
.btn.ghost.btn-clear { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.btn.ghost.btn-clear:hover { background: #fde68a; filter: none; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; padding: 8px; background: var(--card); border: 1px solid var(--border); border-radius: 9px; cursor: pointer; }
.icon-btn:hover { background: #faf3f0; }
.icon-btn svg { width: 16px; height: 16px; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); padding: 6px 10px; background: #f4eeea; border-radius: 999px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #10b981; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

/* ---------- Feed ---------- */
.feed { max-height: 520px; overflow-y: auto; }
.feed-row {
  padding: 14px 22px; display: flex; gap: 14px; align-items: flex-start;
  border-top: 1px solid var(--border); transition: background 0.3s;
}
.feed-row.new { background: var(--accent-soft); animation: highlight 2.4s ease forwards; }
@keyframes highlight { to { background: transparent; } }
.feed-row .avatar-sm { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; background: linear-gradient(135deg, #fda4a4, #e23a3a); color: white; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.feed-row .body { flex: 1; min-width: 0; }
.feed-row .who { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.feed-row .when-abs { font-size: 12.5px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.feed-row .what { color: var(--muted); font-size: 13px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-row .when { font-size: 12.5px; color: var(--muted); white-space: nowrap; padding-top: 2px; }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); font-size: 14px; }

/* ---------- Forms ---------- */
.form-card { background: var(--card); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lift); padding: 36px; max-width: 420px; width: 100%; }
.form-card h1 { margin: 0 0 6px; font-size: 22px; font-weight: 700; }
.form-card p  { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: #334155; margin-bottom: 6px; }
.field input, .field select {
  width: 100%; padding: 11px 14px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 10px; outline: none;
  font-family: inherit; background: var(--card); color: var(--text);
}
.field input:focus, .field select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; margin-top: 8px; }
.center-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }

/* ---------- Table ---------- */
.table-wrap { padding: 0 22px 22px; overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; padding: 12px 10px; border-bottom: 1px solid var(--border); }
table.t td { padding: 14px 10px; border-bottom: 1px solid var(--border); }
table.t tr:last-child td { border-bottom: none; }
.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.badge.admin      { background: var(--indigo-bg); color: var(--indigo-fg); }
.badge.consultant { background: var(--mint-bg);   color: var(--mint-fg); }
.badge.warn       { background: var(--amber-bg);  color: var(--amber-fg); }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(15,23,42,0.4); display: none; align-items: center; justify-content: center; padding: 24px; z-index: 50; }
.modal-bg.open { display: flex; }
.modal { background: var(--card); border-radius: 16px; padding: 28px; width: 100%; max-width: 480px; box-shadow: var(--shadow-lift); max-height: 90vh; overflow-y: auto; }
.modal h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.modal .sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* =====================================================================
   Mobile responsive
   ===================================================================== */

/* Tablet & smaller */
@media (max-width: 768px) {
  /* Page padding shrinks */
  .page { padding: 18px 14px 40px; }

  /* Nav: collapse tabs into a hamburger dropdown */
  .nav-inner { padding: 10px 14px; gap: 8px; flex-wrap: nowrap; position: relative; }
  .brand .name { font-size: 14px; }
  .brand .mark { height: 28px; }
  .brand .mark img { height: 28px; }
  .hamburger { display: inline-flex; }
  .nav-tabs {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px;
    box-shadow: var(--shadow-lift);
    min-width: 220px;
    flex-direction: column;
    gap: 2px;
    z-index: 30;
  }
  .nav-tabs.open { display: flex; }
  .nav-tabs .nav-tab {
    width: 100%;
    justify-content: flex-start;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
  }
  .nav-tabs .nav-tab svg { display: inline-block; width: 16px; height: 16px; }
  .user-block { gap: 8px; flex-shrink: 0; margin-left: auto; }
  .user-block .who-name { display: none; }
  .user-block .logout { font-size: 12px; }
  .avatar { width: 30px; height: 30px; font-size: 12px; }

  /* Headings shrink */
  .page-head h1 { font-size: 22px; }
  .stat .value { font-size: 24px; }

  /* Filter bar: search takes full row */
  .filters-bar { padding: 12px; gap: 8px; }
  .filters-bar input[type="search"] { flex-basis: 100%; min-width: 0; }
  .filters-bar select { min-width: 0; }
  .filters-bar .date-pair { flex: 1 1 130px; }
  .filters-bar .spacer { display: none; }

  /* Panel head can stack on mobile */
  .panel-head { padding: 14px 16px 10px; }
  .panel-head .actions { gap: 6px; }

  /* ===== Tables transform into card-style blocks ===== */
  .table-wrap { padding: 0 12px 16px; overflow-x: visible; }
  .table-wrap table.t,
  .table-wrap table.t tbody,
  .table-wrap table.t tr,
  .table-wrap table.t td { display: block; width: 100%; }
  .table-wrap table.t thead { display: none; }
  .table-wrap table.t tr {
    border: 1px solid var(--border); border-radius: 12px;
    padding: 12px 14px; margin-bottom: 10px;
    background: var(--card);
    position: relative;
  }
  .table-wrap table.t td {
    padding: 5px 0; border: none;
    text-align: left; font-size: 14px;
  }
  .table-wrap table.t td[data-label]::before {
    content: attr(data-label);
    display: inline-block; min-width: 92px;
    font-weight: 600; color: var(--muted);
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
    margin-right: 8px;
  }
  /* Checkbox cell stays inline at the top-right of each card */
  .table-wrap table.t td.cb {
    display: block; width: auto;
    position: absolute; top: 12px; right: 12px;
    padding: 0;
  }
  .table-wrap table.t td.cb::before { display: none; }
}

/* Phone */
@media (max-width: 480px) {
  .nav-inner { padding: 8px 10px; }
  .nav-tab { padding: 6px 8px; font-size: 12px; }
  .brand .name { font-size: 13px; }
  .brand .mark { height: 26px; }
  .brand .mark img { height: 26px; }

  /* Recent submissions feed: tighter spacing */
  .feed-row { padding: 12px 14px; gap: 10px; }
  .feed-row .avatar-sm { width: 32px; height: 32px; font-size: 12px; }
  .feed-row .who { font-size: 14px; }

  /* Stack date inputs */
  .filters-bar .date-pair { flex: 1 1 100%; }

  /* Stat cards: a touch smaller */
  .stat { padding: 16px 18px; }
  .stat .value { font-size: 22px; }
  .stat .chip { width: 32px; height: 32px; }
  .stat .chip svg { width: 16px; height: 16px; }

  /* Login/change-password cards take full width */
  .form-card { padding: 28px 22px; }
}

/* ---------- Filters bar (Sign-ins view) ---------- */
.filters-bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 14px 16px; margin-top: 18px; box-shadow: var(--shadow);
}
.filters-bar input[type="search"],
.filters-bar input[type="date"],
.filters-bar select {
  padding: 9px 12px; font-size: 14px; border: 1px solid var(--border);
  border-radius: 9px; font-family: inherit; outline: none;
  background: var(--card); color: var(--text);
}
.filters-bar input[type="search"]:focus,
.filters-bar input[type="date"]:focus,
.filters-bar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.filters-bar input[type="search"] { flex: 1 1 240px; min-width: 200px; }
.filters-bar select { min-width: 160px; cursor: pointer; }
.filters-bar .date-pair { display: flex; align-items: center; gap: 6px; }
.filters-bar .date-pair label { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.filters-bar .spacer { flex: 1; }

/* ---------- Checkboxes ---------- */
input.row-cb { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); margin: 0; vertical-align: middle; }
table.t th.cb, table.t td.cb { width: 36px; padding-left: 18px; padding-right: 6px; }

/* ---------- Clickable name in feed ---------- */
.feed-row .who.clickable { cursor: pointer; transition: color 0.15s; }
.feed-row .who.clickable:hover { color: var(--accent); }

/* ---------- Row flash (when jumping from feed to master list) ---------- */
table.t tr.flash td { animation: rowflash 2.4s ease forwards; }
@keyframes rowflash {
  0%, 25% { background: var(--accent-soft); }
  100%    { background: transparent; }
}

/* ---------- Event code badge ---------- */
.badge.code { background: #eef2ff; color: #4338ca; font-family: ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.04em; text-transform: none; }
.badge.code.typo { background: #fff4e6; color: #c2410c; cursor: help; }
.badge.code .warn { display: inline-block; margin-left: 3px; font-size: 11px; }
.muted { color: var(--muted); }

/* ---------- Source badges (master list) ---------- */
.badge.source-inperson { background: #e6e8fb; color: #5b5fdf; }
.badge.source-webinar  { background: #d9f5ec; color: #0fa97a; }

/* ---------- Welcome message cards (admin Messages tab) ---------- */
.msg-list { padding: 8px 22px 22px; display: flex; flex-direction: column; gap: 10px; }
.msg-card {
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
  background: #fbfaf8; transition: background 0.15s;
}
.msg-card:hover { background: #fdf6f3; }
.msg-text { font-size: 14.5px; line-height: 1.5; color: var(--text); }
.msg-meta { font-size: 12px; color: var(--muted); margin-top: 6px; }
.msg-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.msg-actions .btn { padding: 6px 12px; font-size: 12px; }
