/* ============================================================
   OneFit Operations OS — UI
   Clean white-card design, lime accent, pill controls
   ============================================================ */

/* ---- Tokens ---- */
:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface2: #f8fafc;
  --line: rgba(0,0,0,.07);
  --line2: rgba(0,0,0,.12);
  --text: #111827;
  --muted: #6b7280;
  --muted2: #9ca3af;
  --lime: #8ab934;
  --lime-dark: #6d9429;
  --lime2: #eef7d0;
  --navy: #0d1b35;
  --red: #dc2626;
  --red2: #fef2f2;
  --green: #16a34a;
  --green2: #f0fdf4;
  --amber: #d97706;
  --amber2: #fffbeb;
  --blue: #2563eb;
  --blue2: #eff6ff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.05);
  --r: 18px;
  --max: 1140px;
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
.hidden { display: none !important; }

/* ---- Glass (redefined as plain white card) ---- */
.glass {
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

/* ---- Logo ---- */
.logo {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: var(--navy);
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 6px 20px rgba(13,27,53,.2);
}
.logo.small { width: 40px; height: 40px; }
.logo img { width: 34px; }
.logo.small img { width: 26px; }
.eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .2em;
  color: var(--lime-dark);
  font-weight: 800;
}

/* ---- Buttons ---- */
.btn {
  min-height: 44px;
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 0 22px;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  white-space: nowrap;
  transition: background .12s, transform .1s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn:hover { background: var(--surface2); }
.btn:active { transform: scale(.97); }
.btn-primary {
  background: var(--lime);
  border-color: var(--lime);
  color: #fff;
  font-weight: 800;
}
.btn-primary:hover { background: var(--lime-dark); border-color: var(--lime-dark); }
.btn-danger { color: var(--red); border-color: rgba(220,38,38,.2); }
.btn-danger:hover { background: var(--red2); }
.full { width: 100%; justify-content: center; }
.mini {
  min-height: 32px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line2);
  background: var(--surface);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
}
.mini.primary { background: var(--lime); border-color: var(--lime); color: #fff; }
.mini.danger { color: var(--red); }
.icon-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--line2);
  border-radius: 999px;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--muted);
  transition: background .12s;
}
.icon-btn:hover { background: var(--surface2); }
.icon-btn:active { transform: scale(.97); }

/* ---- Fields ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field span, .label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}
.field input, .field select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line2);
  border-radius: 999px;
  background: var(--surface);
  padding: 0 18px;
  color: var(--text);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field textarea {
  width: 100%;
  min-height: 100px;
  border: 1px solid var(--line2);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 16px;
  color: var(--text);
  outline: none;
  resize: vertical;
  transition: border-color .12s, box-shadow .12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--lime);
  box-shadow: 0 0 0 3px rgba(138,185,52,.14);
}
.field input[type="file"] {
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13px;
  height: auto;
}
.field input[readonly] { color: var(--muted); background: var(--surface2); }
.helper { font-size: 12px; color: var(--muted); line-height: 1.5; text-align: center; margin: 4px 0 14px; }
.helper.left { text-align: left; margin: 0; }

/* ---- Login ---- */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(460px, 100%);
  border-radius: 24px;
  padding: 36px;
}
.login-brand {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-bottom: 28px;
}
.login-brand h1 { font-size: 30px; letter-spacing: -.04em; }
.login-brand p { color: var(--muted); margin-top: 6px; font-size: 15px; }

/* ---- App shell ---- */
.app { position: relative; }

/* ---- Topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 28px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  height: 64px;
  box-shadow: none;
  border-radius: 0;
  width: 100%;
  margin: 0;
}
.brand {
  border: 0;
  background: transparent;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 0;
}
.brand strong { display: block; font-size: 15px; letter-spacing: -.02em; }
.brand .eyebrow { margin-bottom: 1px; }
.topnav {
  display: flex;
  justify-content: center;
  gap: 4px;
}
.topnav button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  display: flex;
  gap: 6px;
  align-items: center;
  transition: background .12s, color .12s;
}
.topnav button:hover { background: var(--surface2); color: var(--text); }
.topnav button.active { background: var(--lime); color: #fff; font-weight: 700; }
.user-area { display: flex; align-items: center; gap: 8px; }
.user-pill {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  min-height: 38px;
  padding: 0 14px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  font-weight: 600;
  transition: background .12s;
}
.user-pill:hover { background: var(--surface2); }
.user-pill small { color: var(--muted); font-size: 13px; }
.user-avatar-mini {
  width: 26px; height: 26px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  object-fit: cover;
  background: var(--lime2);
  color: #365f00;
  font-size: 10px;
  font-weight: 800;
  overflow: hidden;
  flex: 0 0 auto;
}
.notif-btn {
  position: relative;
  width: 38px; height: 38px;
  border: 1px solid var(--line2);
  border-radius: 999px;
  background: var(--surface);
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--muted);
  transition: background .12s;
}
.notif-btn:hover { background: var(--surface2); }
.notif-count {
  position: absolute;
  top: -4px; right: -4px;
  min-width: 18px; height: 18px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

/* ---- Mobile bottom nav (hidden on desktop) ---- */
.mobile-bottom-nav { display: none; }

/* ---- Page ---- */
.page {
  width: min(var(--max), calc(100% - 56px));
  margin: 28px auto 80px;
}

/* ---- Home hero ---- */
.home-hero {
  border-radius: var(--r);
  padding: 32px 36px;
  margin-bottom: 20px;
}
.home-hero-profile {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 28px;
}
.date-line {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.home-hero h1 { font-size: 34px; letter-spacing: -.05em; line-height: 1.05; }
.accent { color: var(--lime); }
.home-hero p { max-width: 580px; margin-top: 10px; color: var(--muted); line-height: 1.45; font-size: 15px; }
.summary-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
}
.status-chip.orange { background: #fde8d0; color: #92400e; }
.status-chip.blue { background: var(--blue2); color: #1d4ed8; }
.status-chip.green { background: var(--green2); color: #166534; }

/* ---- Profile card ---- */
.profile-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 20px;
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  min-width: 200px;
}
.profile-card strong { display: block; font-size: 16px; }
.profile-card small { display: block; color: var(--muted); margin-top: 4px; font-size: 13px; }
.profile-card-actions { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.profile-card-meta { min-width: 0; }
.profile-photo-btn {
  border: 0;
  background: transparent;
  padding: 0;
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.profile-photo {
  width: 72px; height: 72px;
  border-radius: 20px;
  object-fit: cover;
  background: var(--navy);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.profile-photo.large { width: 100px; height: 100px; border-radius: 26px; font-size: 30px; }
.profile-photo.initials { background: linear-gradient(135deg, var(--navy), #1a3060); }
.photo-edit {
  position: absolute;
  left: 50%; bottom: -8px;
  transform: translateX(-50%);
  white-space: nowrap;
  border-radius: 999px;
  background: var(--lime);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 4px 8px;
}
.profile-form { display: flex; flex-direction: column; gap: 14px; }
.profile-preview { display: grid; place-items: center; margin: 4px 0 8px; }
.profile-modal-actions { flex-wrap: wrap; }

/* ---- My work ---- */
.my-work {
  border-radius: var(--r);
  padding: 22px 26px;
  margin-bottom: 20px;
}
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.section-head h2 { font-size: 17px; font-weight: 800; letter-spacing: -.02em; }
.work-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.work-card {
  background: var(--surface2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  text-align: left;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
  box-shadow: var(--shadow-sm);
}
.work-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.work-card span { display: block; color: var(--lime-dark); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; font-weight: 800; margin-bottom: 6px; }
.work-card strong { display: block; font-size: 14px; margin-bottom: 4px; line-height: 1.3; }
.work-card small { color: var(--muted); font-size: 12px; }
.work-empty {
  grid-column: 1/-1;
  border: 1px dashed var(--line2);
  border-radius: 14px;
  padding: 18px;
  background: transparent;
}
.work-empty strong { display: block; font-size: 14px; }
.work-empty span { display: block; color: var(--muted); margin-top: 4px; font-size: 13px; }
.empty.compact { padding: 30px 20px; }
.empty-action { margin-top: 14px; }

/* ---- Module grid ---- */
.module-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.module-card {
  min-height: 180px;
  border-radius: var(--r);
  padding: 24px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform .14s, box-shadow .14s;
  cursor: pointer;
}
.module-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.module-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 22px;
  margin-bottom: 18px;
}
.module-icon.warn { background: #fde8d0; }
.module-icon.maint { background: #dbeafe; }
.module-icon.task { background: var(--lime2); }
.module-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.module-card p { color: var(--muted); line-height: 1.45; font-size: 14px; min-height: 0; }
.open-link { display: inline-block; margin-top: 18px; color: var(--lime-dark); font-weight: 700; font-size: 14px; }

/* ---- Module header ---- */
.module-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 20px;
}
.module-head h1 { font-size: 32px; letter-spacing: -.04em; }
.module-head .eyebrow { margin-bottom: 4px; }
.module-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---- Filter row ---- */
.filter-row { margin-bottom: 20px; }
.search {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line2);
  border-radius: 999px;
  min-height: 46px;
  padding: 0 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.search span { color: var(--muted); font-size: 15px; flex: 0 0 auto; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--text); font-size: 14px; }
.segmented { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.segmented button {
  border: 1px solid var(--line2);
  border-radius: 999px;
  min-height: 34px;
  padding: 0 14px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: background .12s, color .12s, border-color .12s;
}
.segmented button:hover { background: var(--surface2); color: var(--text); }
.segmented button.active { background: #111827; border-color: #111827; color: #fff; font-weight: 700; }
.board-tabs { margin-bottom: 14px; }

/* ---- List ---- */
.list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.empty {
  grid-column: 1/-1;
  text-align: center;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r);
  padding: 60px 20px;
  color: var(--muted);
  box-shadow: var(--shadow-sm);
}
.item-card {
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  text-align: left;
  transition: transform .12s, box-shadow .12s;
  cursor: pointer;
}
.item-card:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.item-card h3 { font-size: 16px; font-weight: 700; letter-spacing: -.02em; margin: 10px 0 6px; }
.item-card p { color: var(--muted); line-height: 1.4; font-size: 14px; }
.meta { color: var(--muted); font-size: 12px; margin-top: 12px; }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 7px; margin-top: 14px; flex-wrap: wrap; }

/* ---- Tags ---- */
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
}
.tag.open, .tag.pending, .tag.todo { background: #fde8d0; color: #92400e; }
.tag.in_progress, .tag.review { background: var(--blue2); color: #1d4ed8; }
.tag.completed, .tag.done, .tag.approved { background: var(--green2); color: #166534; }
.tag.rejected, .tag.danger { background: #fef2f2; color: var(--red); }
.tag.high { background: #fef2f2; color: var(--red); }
.tag.medium, .tag.orange { background: #fef9c3; color: #854d0e; }
.tag.low { background: var(--green2); color: #166534; }
.tag.neutral { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }
.tag.due-overdue { background: #fef2f2; color: var(--red); }
.tag.due-due_today { background: #fef9c3; color: #854d0e; }
.tag.due-due_week { background: var(--blue2); color: #1d4ed8; }
.tag.due-scheduled, .tag.due-no_due { background: var(--surface2); color: var(--muted); border: 1px solid var(--line); }

/* ---- Kanban ---- */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(230px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 8px;
}
.kanban-help { margin: -12px 0 14px; color: var(--muted); font-size: 13px; }
.column {
  min-height: 200px;
  border-radius: 16px;
  background: var(--surface2);
  border: 1px solid var(--line);
  padding: 14px;
  transition: border-color .14s, background .14s;
}
.column.drag-over { border-color: var(--lime); background: var(--lime2); }
.column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}
.column-head > span:first-child { flex: 1; }
.count {
  background: rgba(0,0,0,.07);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.column-add {
  width: 26px; height: 26px;
  border: 1px solid var(--line2);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  display: grid;
  place-items: center;
  transition: background .12s;
}
.column-add:hover { background: var(--lime); border-color: var(--lime); color: #fff; }
.task-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 14px;
  text-align: left;
  width: 100%;
  margin-bottom: 10px;
  cursor: grab;
  transition: transform .12s, box-shadow .12s, opacity .12s;
  box-shadow: var(--shadow-sm);
}
.task-card:active { cursor: grabbing; }
.task-card:hover { box-shadow: var(--shadow); }
.task-card.dragging { opacity: .5; transform: scale(.97); box-shadow: var(--shadow-lg); }
.task-card h3 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.task-card p { color: var(--muted); font-size: 13px; }
.drop-empty {
  border: 1px dashed var(--line2);
  border-radius: 14px;
  background: transparent;
  min-height: 70px;
  display: grid;
  place-items: center;
  color: var(--muted2);
  font-size: 13px;
}

/* ---- Team ---- */
.team-wrap { max-width: 880px; margin: 0 auto; }
.team-hero {
  border-radius: var(--r);
  padding: 24px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 28px 0 16px;
}
.team-hero h1 { font-size: 28px; letter-spacing: -.04em; }
.team-hero p { color: var(--muted); margin-top: 6px; font-size: 14px; }
.team-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.team-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.team-row:last-child { border-bottom: 0; }
.team-person { display: flex; align-items: center; gap: 12px; }
.team-avatar {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  object-fit: cover;
  background: var(--lime2);
  color: #365f00;
  font-weight: 800;
  overflow: hidden;
  flex: 0 0 auto;
}
.role-pill {
  background: var(--lime2);
  color: #365f00;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 700;
  margin-left: 8px;
}
.staff-pill { background: var(--surface2); color: var(--muted); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- Audit ---- */
.audit-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.audit-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}
.audit-row:last-child { border-bottom: 0; }
.audit-row span, .audit-row small, .audit-row time {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.audit-row b { display: block; text-align: right; font-size: 14px; }

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.2);
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(740px, 100%);
  max-height: min(88vh, 820px);
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.modal.wide { width: min(900px, 100%); }
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 20px 26px;
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.modal-head h2 { font-size: 24px; letter-spacing: -.04em; }
.modal-head .eyebrow { margin-bottom: 2px; }
.close { font-size: 20px; color: var(--muted); line-height: 1; }
.modal-body {
  padding: 22px 26px;
  overflow-y: auto;
  flex: 1 1 auto;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.modal-status-row { display: contents; }

/* ---- Form layout (modal) ---- */
.form-grid, .detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.wide { grid-column: 1/-1; }
.check-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.check-card {
  border: 1px solid var(--line2);
  border-radius: 14px;
  background: var(--surface2);
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  cursor: pointer;
}
.section-title { grid-column: 1/-1; margin: 10px 0 2px; }
.section-title strong { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 800; }
.section-title span { display: block; color: var(--muted2); font-size: 13px; margin-top: 2px; }

/* ---- Detail view ---- */
.detail-box {
  border: 1px solid var(--line);
  background: var(--surface2);
  border-radius: 14px;
  padding: 14px;
}
.detail-box span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.detail-box strong { font-size: 15px; line-height: 1.3; }
.detail-note {
  border: 1px solid var(--line);
  background: var(--surface2);
  border-radius: 14px;
  padding: 16px;
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  grid-column: 1/-1;
}

/* ---- Media ---- */
.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 8px;
}
.media-thumb {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  overflow: hidden;
  text-align: left;
  padding: 0;
  cursor: pointer;
  transition: box-shadow .12s;
}
.media-thumb:hover { box-shadow: var(--shadow); }
.media-thumb img { width: 100%; height: 90px; object-fit: cover; display: block; }
.media-thumb span {
  display: block;
  font-size: 12px;
  color: var(--text);
  padding: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-icon {
  height: 90px;
  display: grid;
  place-items: center;
  font-size: 24px;
  background: var(--surface2);
  color: var(--text);
}
.media-box {
  border: 1px dashed var(--line2);
  border-radius: 14px;
  background: var(--surface2);
  padding: 14px;
  color: var(--muted);
  font-size: 14px;
}
.media-preview { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 14px; }
.file-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.file-chip {
  border: 1px solid var(--line);
  background: var(--surface2);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  color: var(--muted);
}

/* ---- Comments / Timeline ---- */
.comment-list, .timeline-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.comment-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 14px;
}
.comment-item p { color: var(--muted); margin: 4px 0; font-size: 14px; line-height: 1.4; }
.comment-item small { color: var(--muted2); font-size: 12px; }
.timeline-item {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 12px 14px 12px 40px;
}
.timeline-item::before {
  content: "";
  position: absolute;
  left: 15px; top: 16px;
  width: 10px; height: 10px;
  border-radius: 999px;
  background: var(--lime);
  box-shadow: 0 0 0 4px var(--lime2);
}
.timeline-item strong { display: block; font-size: 14px; font-weight: 700; }
.timeline-item p { color: var(--muted); margin: 4px 0 0; font-size: 13px; line-height: 1.35; }
.timeline-item small { display: block; color: var(--muted2); margin-top: 6px; font-size: 12px; }

/* ---- Notifications ---- */
.notification-list { display: flex; flex-direction: column; gap: 8px; }
.notification-item {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background .12s;
}
.notification-item:hover { background: var(--surface2); }
.notification-item.unread { border-color: var(--lime); box-shadow: 0 0 0 3px var(--lime2); }
.notification-item span { color: var(--muted); font-size: 13px; }
.notification-item small { color: var(--muted2); font-size: 12px; }
.notif-header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.notif-header strong { flex: 1; min-width: 0; font-size: 14px; }
.notif-header small { flex-shrink: 0; font-size: 11px; color: var(--muted2); }
.notif-footer { padding: 10px 0 2px; text-align: center; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: #111827;
  color: #fff;
  border-radius: 999px;
  padding: 11px 22px;
  font-weight: 700;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .16s, transform .16s;
  z-index: 99;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---- Loading state ---- */
[data-open].loading { opacity: .5; pointer-events: none; transition: opacity .1s; }

/* ---- Medium screens ---- */
@media (max-width: 960px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 20px; }
  .topnav { display: none; }
  .module-grid, .list { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(4, 260px); }
  .modal { max-height: 92vh; }
  .form-grid, .check-grid { grid-template-columns: 1fr; }
  .form-grid .wide, .check-grid .wide { grid-column: auto; }
  .detail-grid .wide { grid-column: 1/-1; }
  .work-grid { grid-template-columns: 1fr; }
  .module-head { align-items: stretch; flex-direction: column; }
  .module-actions { justify-content: flex-start; }
  .home-hero-profile { grid-template-columns: 1fr; }
  .profile-card { min-width: 0; width: 100%; }
  .team-hero { flex-direction: column; align-items: flex-start; }
  .audit-row { grid-template-columns: 1fr; }
  .audit-row b { text-align: left; }
  .media-gallery { grid-template-columns: repeat(2, 1fr); }
  .modal-actions .btn { white-space: normal; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .segmented button { flex: 0 0 auto; }
}

/* ============================================================
   Mobile (≤ 760px)
   ============================================================ */
@media (max-width: 760px) {
  html, body { overflow-x: hidden; }
  *, *::before, *::after { min-width: 0; }
  body { font-size: 14px; line-height: 1.4; overscroll-behavior-y: none; }
  body.modal-open { overflow: hidden; touch-action: none; }

  /* App */
  .app { min-height: 100svh; padding-bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }

  /* Topbar */
  .topbar {
    height: 56px;
    padding: 0 14px;
    grid-template-columns: 1fr auto;
  }
  .topnav { display: none; }
  .user-pill { display: none; }

  /* Page */
  .page {
    width: 100%;
    max-width: 100%;
    margin: 14px 0 16px;
    padding: 0 14px;
  }

  /* Home */
  .home-hero { padding: 20px; border-radius: 16px; margin-bottom: 12px; }
  .home-hero-profile { display: block; }
  .home-hero h1 { font-size: clamp(26px, 8vw, 34px); }
  .profile-card { display: none; }
  .module-grid { display: none; }
  .my-work { padding: 16px; border-radius: 16px; margin-bottom: 12px; }
  .work-grid { grid-template-columns: 1fr; gap: 8px; }

  /* Module pages */
  .module-head { flex-direction: column; align-items: stretch; margin: 14px 0 12px; gap: 10px; }
  .module-actions { flex-wrap: wrap; }
  .filter-row { margin-bottom: 12px; }
  .search { min-height: 42px; padding: 0 14px; }
  .segmented { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .segmented button { flex: 0 0 auto; min-height: 32px; }
  .list { grid-template-columns: 1fr; gap: 10px; }
  .item-card { padding: 16px; border-radius: 16px; }

  /* Kanban */
  .kanban {
    grid-template-columns: repeat(4, calc(100vw - 56px));
    scroll-snap-type: x mandatory;
    gap: 10px;
    padding-bottom: 4px;
  }
  .column { scroll-snap-align: start; }

  /* Team / Audit */
  .team-hero { margin: 14px 0 12px; padding: 18px; flex-direction: column; align-items: flex-start; }
  .team-row { grid-template-columns: 1fr; gap: 10px; }
  .row-actions { justify-content: flex-start; }
  .audit-row { grid-template-columns: 1fr; }
  .audit-row b { text-align: left; }
  .media-gallery { grid-template-columns: repeat(2, 1fr); }

  /* Mobile bottom nav */
  .mobile-bottom-nav {
    display: flex;
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 20px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 6px;
    gap: 4px;
    z-index: 70;
    box-shadow: var(--shadow-lg);
  }
  .mobile-bottom-nav button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 48px;
    border: 0;
    background: transparent;
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 18px;
    font-weight: 700;
    color: var(--muted);
    padding: 0 4px;
    overflow: hidden;
    transition: background .12s, color .12s;
  }
  .mobile-bottom-nav button span {
    display: block;
    font-size: 9px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -.01em;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .mobile-bottom-nav button.active { background: var(--lime2); color: var(--lime-dark); }
  body.modal-open .mobile-bottom-nav,
  body.modal-open .topbar { pointer-events: none; }

  /* Modal — bottom sheet */
  .modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: none;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    touch-action: none;
  }
  .modal-backdrop.open { display: flex; align-items: flex-end; }
  .modal {
    width: 100vw;
    max-width: 100vw;
    height: auto;
    max-height: min(90svh, calc(100svh - env(safe-area-inset-top, 0px) - 8px));
    border-radius: 24px 24px 0 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }
  .modal::before {
    content: "";
    width: 36px; height: 4px;
    border-radius: 999px;
    background: var(--line2);
    align-self: center;
    margin: 8px 0 0;
    flex: 0 0 auto;
  }
  .modal-head { padding: 12px 18px; min-height: 62px; }
  .modal-head h2 { font-size: clamp(19px, 6vw, 23px); letter-spacing: -.04em; }
  .modal-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 14px 18px calc(20px + env(safe-area-inset-bottom, 0px));
  }
  .modal-body * { max-width: 100%; }

  /* Detail grid stays 2-col on mobile so boxes stay compact */
  .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Wide items (timeline, media, comments) span both detail columns */
  .detail-grid .wide { grid-column: 1/-1; }
  /* Forms go single column */
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide, .check-grid .wide { grid-column: auto; }
  .check-grid { grid-template-columns: 1fr 1fr; }

  /* Modal actions — no sticky (avoids overlap with scrolling content) */
  .modal-actions {
    position: static;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    flex-direction: column;
    gap: 8px;
  }
  /* Form save/cancel — primary at bottom naturally, full width */
  .modal-actions .btn { width: 100%; min-height: 50px; font-size: 15px; justify-content: center; }
  /* Status action buttons sit side by side */
  .modal-status-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .modal-status-row .btn { font-size: 14px; min-height: 50px; }
  .toast { bottom: calc(88px + env(safe-area-inset-bottom, 0px)); max-width: calc(100% - 28px); font-size: 13px; text-align: center; }

  /* Login */
  .login-screen {
    min-height: 100svh;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 14px calc(20px + env(safe-area-inset-bottom, 0px));
    align-items: flex-start;
    padding-top: calc(60px + env(safe-area-inset-top, 0px));
  }
  .login-card { width: 100%; max-width: 100%; padding: 24px 18px; border-radius: 20px; }
  .login-brand h1 { font-size: clamp(22px, 7vw, 28px); }
}

@media (max-width: 380px) {
  .page { padding: 0 12px; }
  .mobile-bottom-nav { left: 8px; right: 8px; border-radius: 18px; }
  .home-hero h1 { font-size: 26px; }
  .topbar { padding: 0 12px; }
}
