/* Buckeye Portal — Milestone 1
   Brand tokens from buckeyearm.com. Mobile-first, no decorative animation. */

:root {
  --navy: #263D4E;
  --text: #1F2933;
  --muted: #5F6F7A;
  --accent: #2B9DEE;
  --accent-light: #48A7F0;
  --bg: #EEF2F6;
  --card: #FFFFFF;
  --warm: #FFBC7D;
  --danger: #C0392B;
  --success: #1E7E34;
  --border: #D8E0E8;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(38, 61, 78, 0.10);
  --font: 'Inter', -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 16px;
  line-height: 1.5;
}

h1 { font-size: 1.5rem; margin: 0 0 .25rem; color: var(--navy); }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; color: var(--navy); }
h3 { font-size: 1rem; margin: 0 0 .5rem; color: var(--navy); }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
code { background: #E9EEF3; padding: .1rem .4rem; border-radius: 4px; font-size: .85em; word-break: break-all; }

/* ---------- Auth shell ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--navy);
}
.auth-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem 1.75rem;
  width: 100%;
  max-width: 420px;
}
.auth-logo { display: block; max-width: 220px; height: auto; margin: 0 auto 1.25rem; }
.auth-title { text-align: center; }
.auth-sub { text-align: center; color: var(--muted); margin-top: 0; }
.auth-links { text-align: center; margin-top: 1rem; }

/* ---------- App frame ---------- */
.app { min-height: 100vh; display: flex; flex-direction: column; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.content { padding: 1rem 1rem 5.5rem; max-width: 1200px; width: 100%; margin: 0 auto; }

.sidebar { display: none; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy);
  color: #fff;
  padding: .6rem 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-brand img { height: 34px; width: auto; display: block; background: #fff; border-radius: 6px; padding: 2px 6px; }
.topbar-actions { display: flex; align-items: center; gap: .75rem; }
.topbar-user { font-size: .9rem; display: none; }
.icon-btn {
  position: relative;
  font-size: 1.25rem;
  text-decoration: none;
  background: rgba(255,255,255,.12);
  border-radius: 50%;
  width: 2.25rem; height: 2.25rem;
  display: inline-flex; align-items: center; justify-content: center;
}
.badge {
  position: absolute;
  top: -4px; right: -6px;
  background: var(--warm);
  color: var(--navy);
  font-size: .65rem;
  font-weight: 700;
  border-radius: 999px;
  padding: .05rem .35rem;
  min-width: 1.1rem;
  text-align: center;
}

.bottomnav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  display: flex;
  background: var(--card);
  border-top: 1px solid var(--border);
  z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottomnav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: .55rem .25rem;
  color: var(--muted);
  text-decoration: none;
  font-size: .7rem;
  position: relative;
}
.bottomnav a.active { color: var(--navy); font-weight: 600; }
.bn-icon { font-size: 1.3rem; }
.bottomnav .badge { top: 2px; right: calc(50% - 1.4rem); }

/* ---------- Components ---------- */
.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.page-sub { color: var(--muted); margin: 0; width: 100%; }

.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .75rem;
  margin-bottom: 1rem;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .9rem;
  border-left: 4px solid var(--border);
}
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--navy); }
.stat-label { font-size: .8rem; color: var(--muted); }
.stat-sub { font-size: .8rem; color: var(--muted); }
.stat-alert { border-left-color: var(--warm); }
.stat-danger { border-left-color: var(--danger); }
.stat-danger .stat-value { color: var(--danger); }

.grid-2 { display: grid; gap: 1rem; grid-template-columns: 1fr; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .6rem 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }

.empty { color: var(--muted); font-style: italic; }

.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { text-align: left; padding: .65rem .75rem; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table th { background: #F5F8FB; color: var(--navy); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.table tr:last-child td { border-bottom: 0; }
.row-actions { text-align: right; }

.pill {
  display: inline-block;
  font-size: .7rem;
  font-weight: 600;
  background: #E4EDF5;
  color: var(--navy);
  border-radius: 999px;
  padding: .1rem .5rem;
  margin-left: .35rem;
  vertical-align: middle;
}
.pill-owner { background: var(--navy); color: #fff; }

/* Forms */
.form { display: flex; flex-direction: column; gap: .9rem; }
.form-narrow { max-width: 560px; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > span { font-weight: 600; font-size: .9rem; color: var(--navy); }
.input, .field input, .field select, .field textarea, .filters input, .filters select {
  font: inherit;
  padding: .65rem .8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  width: 100%;
}
.field input:focus, .field select:focus, .input:focus {
  outline: 2px solid var(--accent-light);
  border-color: var(--accent);
}
.static-value { padding: .65rem 0; }
.form-actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: .5rem; }

.check { display: flex; gap: .6rem; align-items: flex-start; padding: .4rem 0; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; margin-top: .15rem; accent-color: var(--accent); flex-shrink: 0; }
.check-grid { display: grid; grid-template-columns: 1fr; gap: .1rem; }
.perm-group h3 { text-transform: capitalize; border-bottom: 1px solid var(--border); padding-bottom: .4rem; }

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  padding: .65rem 1.2rem;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  background: #E4EDF5;
  color: var(--navy);
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-light); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--border); }
.btn-sm { padding: .35rem .7rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger); }
.inline-form { display: inline; margin: 0; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }

.alert { padding: .8rem 1rem; border-radius: 8px; margin-bottom: 1rem; }
.alert-error { background: #FDECEA; color: #8E2A20; border: 1px solid #F5C6C0; }
.alert-success { background: #E7F4EA; color: var(--success); border: 1px solid #BFE3C8; }

.filters { display: flex; gap: .5rem; margin-bottom: 1rem; flex-wrap: wrap; }
.filters .input { flex: 1; min-width: 140px; width: auto; }
.filters select.input { flex: 0 1 auto; }

.dl { display: grid; grid-template-columns: auto 1fr; gap: .3rem .8rem; margin: 0 0 .5rem; }
.dl dt { font-weight: 600; color: var(--navy); }
.dl dd { margin: 0; }

.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .6rem; }
.notif {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .9rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.notif-unread { border-left: 4px solid var(--accent); }
.notif-body p { margin: .25rem 0; }
.notif-actions { display: flex; gap: .4rem; flex-shrink: 0; }

.pagination { display: flex; align-items: center; gap: 1rem; justify-content: center; margin: 1rem 0 2rem; }

/* ---------- Desktop ---------- */
@media (min-width: 1024px) {
  .app { flex-direction: row; }
  .sidebar {
    display: flex;
    flex-direction: column;
    width: 250px;
    flex-shrink: 0;
    background: var(--navy);
    color: #fff;
    min-height: 100vh;
    position: sticky;
    top: 0;
    height: 100vh;
  }
  .brand {
    display: flex;
    align-items: center;
    gap: .7rem;
    padding: 1.1rem 1rem;
    text-decoration: none;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,.12);
  }
  .brand img { height: 40px; width: auto; background: #fff; border-radius: 8px; padding: 3px 8px; }
  .brand-name { font-weight: 700; font-size: .95rem; line-height: 1.25; }
  .side-nav { display: flex; flex-direction: column; padding: .75rem; gap: .15rem; flex: 1; }
  .side-nav a {
    color: rgba(255,255,255,.78);
    text-decoration: none;
    padding: .65rem .8rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: .7rem;
    font-weight: 500;
  }
  .side-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
  .side-nav a.active { background: var(--accent); color: #fff; }
  .nav-icon { width: 1.4rem; text-align: center; }
  .side-user { padding: 1rem; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; }
  .side-user-name { font-weight: 600; }
  .side-user-role { color: rgba(255,255,255,.6); }

  .bottomnav { display: none; }
  .topbar-brand { display: none; }
  .topbar { background: var(--card); color: var(--text); border-bottom: 1px solid var(--border); }
  .topbar .btn-ghost { color: var(--muted); border-color: var(--border); }
  .topbar-user { display: inline; }
  .content { padding: 1.5rem 2rem 3rem; }
  .cards { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .check-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- Schedule / calendar (Milestone 4) ---------- */
.cal-nav {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-bottom: 1rem;
}
.cal-nav .spacer { flex: 1; }
.cal-views { display: flex; gap: .25rem; }
.cal-title { font-size: 1.25rem; font-weight: 700; color: var(--navy); margin: 0; }
.cal-month {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow);
}
.cal-dow {
  padding: .5rem .25rem; text-align: center; font-size: .72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted);
  background: #F5F8FB; border-bottom: 1px solid var(--border);
}
.cal-day {
  min-height: 4.2rem; padding: .3rem; border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border); font-size: .78rem;
}
.cal-day:nth-child(7n) { border-right: 0; }
.cal-day-num { font-weight: 700; color: var(--navy); }
.cal-day.other { background: #F7FAFC; color: var(--muted); }
.cal-day.today .cal-day-num {
  background: var(--accent); color: #fff; border-radius: 50%;
  display: inline-block; width: 1.5rem; height: 1.5rem; line-height: 1.5rem; text-align: center;
}
.cal-day a.day-link { color: inherit; text-decoration: none; display: block; }
.cal-ev {
  display: block; margin-top: .2rem; padding: .1rem .3rem; border-radius: 4px;
  font-size: .72rem; line-height: 1.3; color: #fff; text-decoration: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ev-visit { background: var(--accent); }
.ev-inspection { background: #B7791F; }
.ev-turnover { background: var(--navy); }
.ev-arrival { background: var(--success); }
.ev-departure { background: #6B7A90; }
.cal-more { font-size: .72rem; color: var(--muted); margin-top: .15rem; display: block; }
.cal-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: .5rem; }
.cal-week-col {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .5rem; min-height: 8rem; box-shadow: var(--shadow);
}
.cal-week-col h3 { font-size: .85rem; margin: 0 0 .4rem; }
.cal-week-col.today { border-color: var(--accent); }
.day-event {
  display: flex; gap: .75rem; padding: .7rem 0; border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.day-event:last-child { border-bottom: 0; }
.day-time { font-weight: 700; color: var(--navy); min-width: 4.5rem; font-size: .85rem; }
.day-kind { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.day-kind.k-visit { color: var(--accent); }
.day-kind.k-inspection { color: #B7791F; }
.day-kind.k-turnover { color: var(--navy); }
.day-kind.k-arrival { color: var(--success); }
.day-kind.k-departure { color: #6B7A90; }

/* ---------- Checklists (Milestone 4) ---------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li {
  display: flex; gap: .6rem; align-items: flex-start;
  padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .95rem;
}
.checklist li:last-child { border-bottom: 0; }
.checklist input[type="checkbox"] { width: 1.15rem; height: 1.15rem; margin-top: .15rem; flex-shrink: 0; }
.checklist .done { text-decoration: line-through; color: var(--muted); }
.check-grid { display: grid; gap: .75rem; grid-template-columns: 1fr; }

/* ---------- Print-friendly inspection report ---------- */
.report { max-width: 800px; margin: 0 auto; background: #fff; color: #111; padding: 2rem; font-size: 14px; }
.report h1 { color: #111; }
.report table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.report th, .report td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid #ddd; vertical-align: top; }
.report th { width: 11rem; color: #555; font-weight: 600; }
.report .check { color: #1E7E34; font-weight: 700; }
.report .uncheck { color: #999; }
@media print {
  .report { padding: 0; max-width: none; }
  .no-print { display: none !important; }
}
