/* Stu App shared styles.
   Mobile-first. On small screens the left sidebar becomes a fixed bottom
   tab bar; at ~640px and up it is a normal left column beside the content. */

* {
  box-sizing: border-box;
}

:root {
  --ink: #22313f;
  --muted: #64748b;
  --bg: #f2f5f7;
  --card: #ffffff;
  --line: #dbe2e8;
  --accent: #0f766e;
  --accent-dark: #0b5d57;
  --accent-soft: #e7f3f1;
  --accent-border: #bcded9;
  --banner-bg: #fdf3d7;
  --banner-ink: #7a5c14;
  --sidebar-w: 180px;
  --content-max: 900px;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
}

[hidden] {
  display: none !important;
}

/* Thin prototype banner at the very top of every page. */
.proto-banner {
  background: var(--banner-bg);
  color: var(--banner-ink);
  font-size: 12px;
  text-align: center;
  padding: 5px 10px;
  margin: 0;
}

/* ------------------------------------------------------------------ */
/* App shell layout                                                    */
/* ------------------------------------------------------------------ */

/* Left column holds the sidebar; right column holds topbar + tabs + body. */
.app {
  display: block;
}

/* --- Sidebar (mobile-first: it is a fixed bottom tab bar) --- */
.sidebar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: var(--card);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

/* Logo and profile mini-card are hidden in the bottom-bar (mobile) mode. */
.sidebar-logo,
.sidebar-profile {
  display: none;
}

.sidebar-nav {
  display: flex;
  flex: 1;
  justify-content: space-around;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex: 1;
  padding: 8px 2px;
  text-decoration: none;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.nav-item.active {
  color: var(--accent);
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
  display: block;
}

.nav-label {
  line-height: 1;
}

/* --- Top bar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 10px 16px;
}

.topbar-title {
  margin: 0;
  font-size: 18px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bell svg {
  width: 22px;
  height: 22px;
  fill: var(--muted);
  display: block;
}

.profile-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px 3px 3px;
}

.chip-name {
  font-size: 13px;
  font-weight: 600;
}

.chip-chevron {
  color: var(--muted);
  font-size: 11px;
}

/* Circular initials avatar. */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  flex: none;
}

.avatar-sm {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

/* --- Top tabs strip --- */
.top-tabs {
  display: flex;
  gap: 4px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.top-tab {
  border: none;
  background: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  padding: 12px 10px;
  cursor: pointer;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}

.top-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* --- Main content --- */
/* Bottom padding keeps content clear of the fixed bottom tab bar on mobile. */
.content {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 16px 16px 92px;
}

/* ------------------------------------------------------------------ */
/* Shared bits                                                         */
/* ------------------------------------------------------------------ */

h2.section {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 24px 0 10px;
}

.subline {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
}

/* Buttons */
.btn {
  display: inline-block;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-primary:disabled {
  background: #a9c4c1;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
}

.btn-block {
  display: block;
  width: 100%;
}

/* Forms */
label {
  font-size: 14px;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  margin: 4px 0 12px;
  background: #ffffff;
  color: var(--ink);
}

input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

/* Generic card */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}

/* ------------------------------------------------------------------ */
/* Sign-in screen (index.html, no shell)                              */
/* ------------------------------------------------------------------ */
.signin-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 16px;
}

.signin-card {
  margin-top: 48px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 28px 24px;
  text-align: center;
}

.app-name {
  margin: 0;
  font-size: 40px;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.tagline {
  margin: 6px 0 24px;
  color: var(--muted);
  font-size: 15px;
}

.signin-card form {
  text-align: left;
}

.signin-card .btn {
  width: 100%;
  margin-top: 4px;
}

/* ------------------------------------------------------------------ */
/* Dashboard cards                                                     */
/* ------------------------------------------------------------------ */
.card-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.dash-card h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.dash-card .big {
  font-size: 26px;
  font-weight: 700;
  margin: 4px 0;
}

.dash-card p {
  margin: 2px 0;
  font-size: 14px;
  color: var(--muted);
}

.dash-card .btn {
  margin-top: 10px;
}

.dash-card.link-card {
  text-decoration: none;
  color: inherit;
  display: block;
}

.dash-card.link-card:hover {
  border-color: var(--accent-border);
}

.card-cta {
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
  margin-top: 8px;
}

/* ------------------------------------------------------------------ */
/* Debrief: day list                                                  */
/* ------------------------------------------------------------------ */
.day {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
  overflow: hidden;
}

.day-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
  text-align: left;
  color: inherit;
}

.day-date {
  display: block;
  font-weight: 600;
}

.day-meta {
  display: block;
  font-size: 13px;
  color: var(--muted);
}

.day-chevron {
  color: var(--muted);
  font-size: 14px;
}

.day-cases {
  padding: 0 12px 12px;
}

.case-card {
  background: var(--bg);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 10px;
}

.case-card:last-child {
  margin-bottom: 0;
}

.case-title {
  margin: 0;
  font-size: 15px;
}

.case-author {
  margin: 2px 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.case-question {
  margin: 0;
  font-size: 14px;
}

.reply {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
}

.reply-supervisor {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.reply-author {
  margin: 0 0 2px;
  font-size: 13px;
  font-weight: 600;
}

.supervisor-badge {
  background: var(--accent);
  color: #ffffff;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  margin-left: 8px;
}

.reply-text {
  margin: 0;
  font-size: 14px;
}

.no-replies {
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
  margin: 8px 0 0;
}

/* Debrief: add-a-case form */
.add-case-form {
  margin-top: 12px;
}

.add-case-form .checklist {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 14px;
}

.add-case-form .checklist legend {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  padding: 0 4px;
}

.add-case-form .checklist label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-weight: 400;
  font-size: 14px;
  padding: 4px 0;
}

.add-case-form .checklist input[type="checkbox"] {
  margin-top: 3px;
  accent-color: var(--accent);
}

/* ------------------------------------------------------------------ */
/* Calendar                                                           */
/* ------------------------------------------------------------------ */
.roster-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.roster-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.roster-day {
  font-weight: 600;
  font-size: 15px;
}

.roster-sup {
  font-size: 13px;
  color: var(--muted);
}

.roster-session {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* Guide                                                              */
/* ------------------------------------------------------------------ */
.person-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.person-name {
  margin: 0;
  font-size: 16px;
}

.person-role {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.person-ask {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

ul.card {
  list-style: none;
  margin: 0;
}

.resource-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.resource-list li:last-child {
  border-bottom: none;
}

.resource-list a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
}

.resource-list a:hover {
  text-decoration: underline;
}

.tech-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.tech-item h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.tech-item p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Questions                                                          */
/* ------------------------------------------------------------------ */
.q-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.q-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.q-text {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
}

.q-author {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.q-status {
  font-size: 11px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

.q-status.answered {
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
}

.q-status.waiting {
  color: var(--banner-ink);
  background: var(--banner-bg);
  border: 1px solid #ecd9a3;
}

.q-answer {
  margin: 10px 0 0;
  font-size: 14px;
  background: var(--bg);
  border-radius: 8px;
  padding: 10px 12px;
}

/* ------------------------------------------------------------------ */
/* Profile                                                            */
/* ------------------------------------------------------------------ */
.detail-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.detail-row:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--muted);
  font-size: 14px;
}

.detail-value {
  font-weight: 600;
  font-size: 14px;
  text-align: right;
}

.goal-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}

.goal-item h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.goal-item p {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

/* ------------------------------------------------------------------ */
/* Desktop layout (sidebar becomes a left column)                     */
/* ------------------------------------------------------------------ */
@media (min-width: 640px) {
  .app {
    display: flex;
    align-items: stretch;
    min-height: 100vh;
  }

  .sidebar {
    position: sticky;
    top: 0;
    left: auto;
    right: auto;
    bottom: auto;
    align-self: flex-start;
    height: 100vh;
    width: var(--sidebar-w);
    flex: none;
    flex-direction: column;
    justify-content: flex-start;
    border-top: none;
    border-right: 1px solid var(--line);
    padding: 16px 12px;
    gap: 8px;
  }

  .sidebar-logo {
    display: block;
    font-size: 26px;
    font-weight: 800;
    color: var(--accent);
    text-decoration: none;
    padding: 4px 8px 12px;
    letter-spacing: -0.02em;
  }

  .sidebar-nav {
    flex-direction: column;
    flex: 1;
    justify-content: flex-start;
    gap: 2px;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 10px;
    flex: none;
    padding: 10px 10px;
    font-size: 14px;
    border-radius: 8px;
  }

  .nav-item.active {
    background: var(--accent-soft);
  }

  .nav-icon svg {
    width: 20px;
    height: 20px;
  }

  /* Profile mini-card pinned to the bottom on desktop. */
  .sidebar-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 8px;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
  }

  .sidebar-profile:hover {
    background: var(--bg);
  }

  .sidebar-profile-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
  }

  .sidebar-profile-name {
    font-size: 13px;
    font-weight: 600;
  }

  .sidebar-profile-role {
    font-size: 12px;
    color: var(--muted);
  }

  .main {
    flex: 1;
    min-width: 0;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  /* No fixed bottom bar on desktop, so less bottom padding needed. */
  .content {
    padding-bottom: 40px;
  }

  .card-grid {
    grid-template-columns: 1fr 1fr;
  }
}
