/* ============================================================
   EEIS Milestones PWA – style.css
   Dark theme matching the CMMS Maintenance Form design
   ============================================================ */

/* ── Reset & Variables ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-app:      #f8f2ee;
  --bg-surface:  rgba(255, 255, 255, .94);
  --bg-card:     rgba(255, 255, 255, .97);
  --bg-input:    rgba(250, 244, 240, .96);
  --bg-hover:    rgba(248, 238, 233, .96);

  --clr-primary:      #bf1f1f;
  --clr-primary-dark: #8d1818;
  --clr-primary-glow: rgba(191, 31, 31, 0.16);

  --clr-text:        #3f2b28;
  --clr-text-muted:  #7a5c52;
  --clr-border:      #d8c6c1;
  --clr-border-light:#eadcd8;

  --clr-success:  #bf1f1f;
  --clr-error:    #bf1f1f;
  --clr-warning:  #e86958;
  --clr-badge-ok: rgba(191,31,31,.12);
  --clr-badge-no: rgba(255,83,112,.14);

  --radius:    18px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --shadow:    0 18px 48px rgba(0,0,0,.38);
  --shadow-soft: 0 10px 28px rgba(0,0,0,.22);
  --transition: .25s ease;
}

html, body {
  height: 100%;
  font-family: 'Bahnschrift', 'Segoe UI', Tahoma, sans-serif;
  font-size: 14px;
  background: var(--bg-app);
  color: var(--clr-text);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  position: relative;
  isolation: isolate;
  background:
    radial-gradient(circle at 15% 10%, rgba(191, 31, 31, .10), transparent 28%),
    radial-gradient(circle at 85% 0%, rgba(219, 46, 46, .08), transparent 26%),
    linear-gradient(180deg, #f8f2ee 0%, #f2e7e2 45%, #f7f0eb 100%);
}

body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

body::before {
  background:
    radial-gradient(circle at 20% 18%, rgba(211, 47, 47, .12), transparent 0 26%),
    radial-gradient(circle at 82% 12%, rgba(140, 30, 30, .10), transparent 0 24%),
    radial-gradient(circle at 50% 90%, rgba(211, 47, 47, .06), transparent 0 34%);
}

body::after {
  opacity: .18;
  background-image:
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px);
  background-size: 28px 28px;
}

/* ── Screens ───────────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, rgba(255,255,255,.98) 0%, rgba(245, 238, 232, .98) 100%);
  backdrop-filter: blur(18px) saturate(120%);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity var(--transition), transform var(--transition);
  z-index: 10;
}
.screen.active {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
  z-index: 20;
}

/* ── Splash ────────────────────────────────────────────────── */
#screen-splash {
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, #fff9f6 0%, #f7d8d6 60%, #f8efeb 100%);
}
.splash-content { text-align: center; }
.splash-logo {
  width: 130px;
  height: 130px;
  margin: 0 auto 20px;
  filter: drop-shadow(0 0 24px rgba(211,47,47,.4));
  animation: pulse 2.4s ease-in-out infinite;
}
.splash-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 20px; }
@keyframes pulse {
  0%,100% { filter: drop-shadow(0 0 18px rgba(211,47,47,.35)); }
  50%      { filter: drop-shadow(0 0 36px rgba(211,47,47,.65)); }
}
.splash-company { font-size: 28px; font-weight: 800; letter-spacing: 4px; color: #fff; }
.splash-tagline { font-size: 12px; color: var(--clr-text-muted); letter-spacing: 2px; margin-top: 4px; text-transform: uppercase; }
.splash-loader {
  width: 160px;
  height: 3px;
  background: var(--clr-border);
  border-radius: 99px;
  margin: 32px auto 0;
  overflow: hidden;
}
.loader-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--clr-primary), #ff8a80);
  border-radius: 99px;
  animation: load 2.3s ease-in-out forwards;
}
@keyframes load { to { width: 100%; } }

/* ── App Header ────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid rgba(191, 31, 31, .12);
  backdrop-filter: blur(20px) saturate(130%);
  box-shadow: 0 18px 36px rgba(0, 0, 0, .12);
  flex-shrink: 0;
  position: relative;
  z-index: 10;
}
.header-title { flex: 1; min-width: 0; text-align: center; }
.header-title span { display: block; font-size: 16px; font-weight: 700; color: var(--clr-text); letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-title small { display: block; font-size: 12px; color: var(--clr-text-muted); margin-top: 4px; line-height: 1.5; white-space: normal; }
.header-left, .header-right { min-width: 46px; flex-shrink: 0; }
.header-right { display: flex; justify-content: flex-end; align-items: center; gap: 8px; flex-wrap: wrap; }
.btn-icon { width: 42px; height: 42px; border-radius: 14px; }
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:hover { transform: translateY(-2px); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-icon {
  width: 38px;
  height: 38px;
  border: 1px solid rgba(255, 255, 255, .03);
  background: rgba(255, 255, 255, .03);
  color: var(--clr-text-muted);
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition), transform var(--transition), border-color var(--transition);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}
.btn-icon svg { width: 20px; height: 20px; }
.btn-icon:hover  { background: rgba(45, 20, 20, .92); color: var(--clr-text); border-color: rgba(211, 47, 47, .18); transform: translateY(-1px); }
.btn-icon.primary { background: linear-gradient(135deg, var(--clr-primary), #ff8a80); color: #fff; border-color: transparent; box-shadow: 0 8px 18px rgba(211, 47, 47, .25); }
.btn-icon.primary:hover { filter: brightness(1.05); transform: translateY(-1px); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), opacity var(--transition), transform var(--transition), box-shadow var(--transition);
}
.btn-primary  { background: linear-gradient(135deg, var(--clr-primary), #ff8a80); color: #fff; box-shadow: 0 10px 22px rgba(211, 47, 47, .20); }
.btn-primary:hover  { filter: brightness(1.04); transform: translateY(-1px); }
.btn-secondary { background: rgba(255, 251, 248, .92); color: var(--clr-text); border: 1px solid rgba(191, 31, 31, .15); }
.btn-secondary:hover { background: rgba(255, 236, 234, .96); transform: translateY(-1px); }
.btn-danger  { background: rgba(255,83,112,.15); color: var(--clr-error); border: 1px solid rgba(255,83,112,.3); }
.btn-danger:hover { background: rgba(255,83,112,.25); }
.btn-full { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Login ─────────────────────────────────────────────────── */
#screen-login {
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(145deg, #fff9f6 0%, #f8dad7 60%, #fef4ef 100%);
}
.login-container {
  width: 100%;
  max-width: 360px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(252, 244, 241, .95));
  border: 1px solid rgba(191, 31, 31, .15);
  border-radius: 28px;
  padding: 34px 28px 30px;
  box-shadow: var(--shadow);
}
.login-logo {
  width: 70px;
  height: 70px;
  margin: 0 auto 20px;
  filter: drop-shadow(0 0 18px rgba(211, 47, 47, .35));
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 18px; }
.login-title    { text-align: center; font-size: 20px; font-weight: 700; }
.login-subtitle { text-align: center; font-size: 13px; color: var(--clr-text-muted); margin: 4px 0 24px; }

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 12px; font-weight: 600; color: var(--clr-text-muted); text-transform: uppercase; letter-spacing: .5px; }
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--bg-input);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xs);
  color: var(--clr-text);
  font-size: 14px;
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--clr-text-muted); }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px var(--clr-primary-glow);
}
.form-group select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b84b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.form-group textarea { resize: vertical; min-height: 80px; }
.req { color: var(--clr-error); }

/* ── Login form ────────────────────────────────────────────── */
.login-form { display: flex; flex-direction: column; gap: 16px; }

/* ── Filters bar ───────────────────────────────────────────── */
.filters-bar {
  display: flex;
  gap: 10px;
  padding: 10px 14px 12px;
  background: rgba(255, 250, 247, .95);
  border-bottom: 1px solid rgba(191, 31, 31, .12);
  flex-shrink: 0;
}
.filter-select {
  background: rgba(255, 251, 248, .96);
  border: 1px solid rgba(191, 31, 31, .15);
  border-radius: var(--radius-xs);
  color: var(--clr-text);
  font-size: 13px;
  padding: 8px 28px 8px 10px;
  outline: none;
  flex: 1;
  min-width: 0;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b84b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 251, 248, .96);
  border: 1px solid rgba(191, 31, 31, .15);
  border-radius: var(--radius-xs);
  padding: 0 10px;
  flex: 1.4;
  min-width: 0;
}
.search-box svg { width: 16px; height: 16px; color: var(--clr-text-muted); flex-shrink: 0; }
.search-box input {
  background: transparent;
  border: none;
  color: var(--clr-text);
  font-size: 13px;
  outline: none;
  width: 100%;
  padding: 8px 0;
}
.search-box input::placeholder { color: var(--clr-text-muted); }

/* ── Milestones list ───────────────────────────────────────── */
.milestones-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 80px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.milestones-container::-webkit-scrollbar { width: 4px; }
.milestones-container::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 4px; }

/* ── Milestone Card ────────────────────────────────────────── */
.milestone-card {
  background: var(--bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.milestone-card:hover { border-color: var(--clr-primary); background: var(--bg-hover); transform: translateY(-1px); }
.milestone-card:active { transform: translateY(0); }

.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.card-equipment { font-size: 15px; font-weight: 700; color: var(--clr-text); line-height: 1.3; flex: 1; }
.card-badges { display: flex; gap: 6px; flex-shrink: 0; align-items: center; }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .3px;
}
.badge-complete   { background: rgba(211,47,47,.12); color: #d32f2f; border: 1px solid rgba(211,47,47,.25); }
.badge-incomplete { background: var(--clr-badge-no); color: var(--clr-error);   border: 1px solid rgba(255,83,112,.2); }

.card-location {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12px;
  color: var(--clr-text-muted);
}
.card-location span { display: flex; align-items: center; gap: 4px; }
.card-location svg { width: 13px; height: 13px; }

.card-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--clr-text-muted);
  border-top: 1px solid var(--clr-border);
  padding-top: 8px;
}
.card-project { color: var(--clr-primary); font-weight: 600; }

/* ── Loading / Empty states ────────────────────────────────── */
.loading-state, .empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 20px;
  color: var(--clr-text-muted);
  text-align: center;
}
.empty-state svg { width: 52px; height: 52px; opacity: .4; }
.empty-state p   { font-size: 15px; }
.empty-state small { font-size: 12px; }
.hidden { display: none !important; }

.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--clr-border);
  border-top-color: var(--clr-primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Add / Edit Form Screen ────────────────────────────────── */
.form-container {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 80px;
}
.form-container::-webkit-scrollbar { width: 4px; }
.form-container::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 4px; }

#milestone-form { display: flex; flex-direction: column; gap: 14px; }

/* CMMS toggle row */
.form-section {
  background: var(--bg-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.toggle-label { font-size: 13px; font-weight: 600; color: var(--clr-text); }

/* Toggle switch */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--clr-border);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--clr-primary); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Form grid rows */
.form-row-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; }
.form-row-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 10px; }
.form-row-2 { display: grid; grid-template-columns: repeat(2,1fr); gap: 10px; }
@media (max-width: 600px) {
  .form-row-3 { grid-template-columns: 1fr; }
  .form-row-4 { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 380px) {
  .form-row-2, .form-row-4 { grid-template-columns: 1fr; }
}

.task-assignees-list,
#tasks-members-list,
.member-grid {
  display: grid;
  gap: 10px;
}
.task-assignees-list,
#tasks-members-list {
  max-height: 42vh;
  overflow-y: auto;
  padding-right: 2px;
}
.task-assignees-list::-webkit-scrollbar,
#tasks-members-list::-webkit-scrollbar {
  width: 6px;
}
.task-assignees-list::-webkit-scrollbar-thumb,
#tasks-members-list::-webkit-scrollbar-thumb {
  background: var(--clr-border);
  border-radius: 4px;
}
.task-assignees-list::-webkit-scrollbar-track,
#tasks-members-list::-webkit-scrollbar-track {
  background: transparent;
}

.form-section-divider {
  font-size: 11px;
  font-weight: 700;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--clr-border);
}

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
  flex-wrap: wrap;
}

/* Error / Success messages */
.error-msg   { background: rgba(255,83,112,.1); border: 1px solid rgba(255,83,112,.3); color: var(--clr-error);   border-radius: var(--radius-xs); padding: 10px 14px; font-size: 13px; }
.success-msg { background: rgba(211,47,47,.10);  border: 1px solid rgba(211,47,47,.25); color: var(--clr-text); border-radius: var(--radius-xs); padding: 10px 14px; font-size: 13px; }

/* ── Detail Screen ─────────────────────────────────────────── */
.detail-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 12px 100px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  -webkit-overflow-scrolling: touch;
}

/* section card */
.detail-section {
  background: var(--bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  min-width: 0;
  overflow: visible;
}

.detail-section-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  padding: 9px 14px 8px;
  background: linear-gradient(90deg, rgba(191,31,31,.07) 0%, transparent 100%);
  border-bottom: 1px solid var(--clr-border);
  border-radius: var(--radius) var(--radius) 0 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 12px;
  background: var(--clr-primary);
  border-radius: 99px;
  flex-shrink: 0;
}

/* info rows (replaces the 2-col grid) */
.detail-grid {
  display: flex;
  flex-direction: column;
}

.detail-field {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--clr-border-light);
  min-width: 0;
}
.detail-field:last-child { border-bottom: none; }
.detail-field.full { flex-direction: column; align-items: flex-start; gap: 4px; }

.detail-field label {
  font-size: 10px;
  font-weight: 700;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 110px;
  margin-bottom: 0;
}

.detail-field span {
  font-size: 13.5px;
  color: var(--clr-text);
  font-weight: 500;
  overflow-wrap: anywhere;
  word-break: break-word;
  min-width: 0;
  flex: 1;
}

.detail-field.full label {
  min-width: unset;
  margin-bottom: 2px;
}
.detail-field.full span {
  width: 100%;
  flex: none;
}

/* Remove broken nth-child rules from old grid */
.detail-field:nth-child(odd) { border-right: none; }
.detail-field:nth-last-child(2):nth-child(odd) { border-bottom: none; }

/* section body padding (for member/task blocks) */
.task-block-padded {
  padding: 12px 14px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-actions {
  display: flex;
  gap: 10px;
  padding: 4px 0;
  flex-wrap: wrap;
}

.global-loader-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 16, 31, .62);
  backdrop-filter: blur(2px);
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.global-loader-overlay.show {
  opacity: 1;
  pointer-events: all;
}

.global-loader-box {
  min-width: 170px;
  background: var(--bg-surface);
  border: 1px solid var(--clr-border-light);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow);
}

.global-loader-box span {
  font-size: 13px;
  font-weight: 700;
  color: var(--clr-text);
}

.global-loader-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(211, 47, 47, .25);
  border-top-color: var(--clr-primary);
  animation: gl-spin .7s linear infinite;
}

@keyframes gl-spin {
  to { transform: rotate(360deg); }
}

/* ── Toast ─────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--clr-text);
  box-shadow: var(--shadow);
  z-index: 999;
  max-width: calc(100vw - 32px);
  transition: transform .3s ease, opacity .3s ease;
  pointer-events: none;
  opacity: 0;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: rgba(211,47,47,.4); color: var(--clr-text); }
.toast.error   { border-color: rgba(255,83,112,.4); color: var(--clr-error); }

/* ── FAB (main screen add button) ──────────────────────────── */
.fab {
  position: fixed;
  bottom: 24px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--clr-primary);
  color: #0a1a14;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 18px rgba(211,47,47,.4);
  transition: background var(--transition), transform var(--transition);
  z-index: 30;
}
.fab svg { width: 24px; height: 24px; }
.fab:hover { background: var(--clr-primary-dark); transform: scale(1.08); }
.fab:active { transform: scale(.97); }

/* ── Confirm Dialog ────────────────────────────────────────── */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.dialog-overlay.show { opacity: 1; pointer-events: all; }
.dialog-box {
  background: var(--bg-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 28px 24px;
  max-width: 320px;
  width: 100%;
  box-shadow: var(--shadow);
  transform: scale(.95);
  transition: transform .2s ease;
}
.dialog-overlay.show .dialog-box { transform: scale(1); }
.dialog-box h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.dialog-box p  { font-size: 13px; color: var(--clr-text-muted); margin-bottom: 20px; }
.dialog-required-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}
.dialog-required-row label {
  font-size: 12px;
  color: var(--clr-text-muted);
}
.dialog-required-row input {
  width: 100%;
  min-height: 42px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--clr-border);
  background: var(--bg-surface);
  color: var(--clr-text);
  font-size: 14px;
}
.dialog-required-row input.invalid {
  border-color: var(--clr-error);
  box-shadow: 0 0 0 3px rgba(255,83,112,.16);
}
.dialog-box .btn[disabled] {
  opacity: .56;
  cursor: not-allowed;
}
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }
.project-card,
.task-item {
  cursor: pointer;
}
.project-card:hover,
.task-item:hover {
  transform: translateY(-1px);
}

/* ── Bottom Navigation ─────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  height: calc(66px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, .92);
  border: 1px solid rgba(191, 31, 31, .14);
  border-radius: 24px;
  display: flex;
  z-index: 40;
  box-shadow: 0 18px 48px rgba(0, 0, 0, .12);
  backdrop-filter: blur(18px) saturate(130%);
  display: none; /* shown only on tab screens via JS */
}
.bottom-nav.visible { display: flex; }
.nav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--clr-text-muted);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--transition);
  padding: 0;
}
.nav-tab svg    { width: 22px; height: 22px; }
.nav-tab.active { color: var(--clr-primary); text-shadow: 0 0 16px rgba(211, 47, 47, .22); }
.nav-tab.active svg { stroke: var(--clr-primary); }

.nav-tab-profile {
  gap: 4px;
}

.nav-profile-avatar-wrap {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(191, 31, 31, .15);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 251, 248, .94);
}

.nav-profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.nav-profile-avatar-fallback {
  font-size: 10px;
  font-weight: 700;
  color: var(--clr-primary);
}

.nav-tab.active .nav-profile-avatar-wrap {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 2px rgba(211, 47, 47, .12);
}

/* When bottom nav is visible, push scroll containers up */
.screen.active .milestones-container,
.screen.active .detail-container,
.screen.active .form-container,
.screen.active .tasks-container {
  padding-bottom: calc(102px + env(safe-area-inset-bottom, 0px));
}

/* ── Project Status Badges ─────────────────────────────────── */
.badge-not-started { background: rgba(107,132,176,.12); color: var(--clr-text-muted);  border: 1px solid rgba(107,132,176,.25); }
.badge-in-progress { background: rgba(211, 47, 47, .10);  color: #d32f2f;               border: 1px solid rgba(211, 47, 47, .25); }
.badge-on-hold     { background: rgba(255,179,71,.12); color: var(--clr-warning);     border: 1px solid rgba(255,179,71,.25); }
.badge-canceled    { background: rgba(255,83,112,.12); color: var(--clr-error);       border: 1px solid rgba(255,83,112,.2); }
.badge-finished    { background: rgba(211,47,47,.15);  color: #d32f2f;     border: 1px solid rgba(211,47,47,.25); }

/* ── Progress Bar ──────────────────────────────────────────── */
.progress-wrap {
  background: var(--clr-border);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--clr-primary), #ff8a80);
  transition: width .5s ease;
  min-width: 4px;
}

/* ── Project Card ──────────────────────────────────────────── */
.project-card {
  background: var(--bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.project-card:hover { border-color: var(--clr-primary); background: var(--bg-hover); transform: translateY(-1px); }
.project-card:active { transform: translateY(0); }

.project-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.project-name  { font-size: 15px; font-weight: 700; color: var(--clr-text); flex: 1; line-height: 1.3; }
.project-short { font-size: 12px; color: var(--clr-text-muted); margin-top: 2px; }

.project-progress-row { display: flex; align-items: center; gap: 10px; }
.project-progress-row .progress-wrap { flex: 1; }
.project-progress-pct { font-size: 12px; font-weight: 700; color: var(--clr-primary); white-space: nowrap; min-width: 34px; text-align: right; }

.project-meta { display: flex; justify-content: space-between; font-size: 11px; color: var(--clr-text-muted); border-top: 1px solid var(--clr-border); padding-top: 8px; }
.project-milestones { color: var(--clr-primary); font-weight: 600; }

/* ── Project card stats row (equipment + tasks + dates) ──── */
.project-name-wrap { flex: 1; min-width: 0; }
.project-name-wrap .project-name { white-space: normal; }

.project-stats-row {
  display: flex;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--clr-border);
  padding-top: 8px;
  flex-wrap: wrap;
}
.project-stat {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--clr-text-muted);
}
.project-stat strong { color: var(--clr-primary); font-weight: 700; }
.project-stat svg { flex-shrink: 0; stroke: var(--clr-text-muted); }
.project-dates { margin-left: auto; font-size: 11px; color: var(--clr-text-muted); white-space: nowrap; }

.milestone-progress-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.milestone-progress-row .progress-wrap { flex: 1; }

.milestone-card-stats {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--clr-border);
  padding-top: 8px;
  font-size: 11px;
  color: var(--clr-text-muted);
  flex-wrap: wrap;
}

/* ── Project detail progress panel ─────────────────────────── */
.project-detail-progress {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.pdp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--clr-text-muted);
}
.pdp-pct { font-size: 22px; font-weight: 800; color: var(--clr-primary); }
.pdp-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}
.pdp-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}
.pdp-stat-card > svg { flex-shrink: 0; margin-top: 2px; stroke: var(--clr-primary); opacity: .85; }
.pdp-stat-card > div { flex: 1; min-width: 0; }
.pdp-stat-nums { font-size: 18px; font-weight: 800; color: var(--clr-text); line-height: 1.1; }
.pdp-stat-nums strong { color: var(--clr-primary); }
.pdp-stat-nums span   { font-size: 13px; color: var(--clr-text-muted); font-weight: 400; }
.pdp-stat-label { font-size: 10px; color: var(--clr-text-muted); margin-top: 4px; }
.project-progress-exact { font-size: 12px; color: var(--clr-text-muted); }
@media (max-width: 360px) {
  .pdp-stats { grid-template-columns: 1fr; }
  .project-dates { display: none; }
}

/* ── Scrollbar (desktop) ───────────────────────────────────── */
::-webkit-scrollbar       { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 3px; }

.milestones-container,
.form-container,
.detail-container,
.tasks-container,
.notif-list {
  scrollbar-width: thin;
  scrollbar-color: var(--clr-border) rgba(255, 255, 255, .08);
}

.milestones-container::-webkit-scrollbar,
.form-container::-webkit-scrollbar,
.detail-container::-webkit-scrollbar,
.tasks-container::-webkit-scrollbar,
.notif-list::-webkit-scrollbar {
  width: 5px;
}

.milestones-container::-webkit-scrollbar-track,
.form-container::-webkit-scrollbar-track,
.detail-container::-webkit-scrollbar-track,
.tasks-container::-webkit-scrollbar-track,
.notif-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, .05);
}

.milestones-container::-webkit-scrollbar-thumb,
.form-container::-webkit-scrollbar-thumb,
.detail-container::-webkit-scrollbar-thumb,
.tasks-container::-webkit-scrollbar-thumb,
.notif-list::-webkit-scrollbar-thumb {
  background: rgba(97, 111, 159, .95);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: content-box;
}

.milestones-container::-webkit-scrollbar-thumb:hover,
.form-container::-webkit-scrollbar-thumb:hover,
.detail-container::-webkit-scrollbar-thumb:hover,
.tasks-container::-webkit-scrollbar-thumb:hover,
.notif-list::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 132, 176, .95);
}

/* ═══════════════════════════════════════════════════════════
   TASKS
═══════════════════════════════════════════════════════════ */

/* Stats bar */
.task-stats-bar {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
  gap: 10px;
}
.task-stats-bar span { font-size: 12px; color: var(--clr-text-muted); white-space: nowrap; }

/* Members section */
.members-section {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--clr-border);
  flex-shrink: 0;
}
.members-section { overflow-x: hidden; }
.members-section > div { flex: 1 1 auto; min-width: 0; }
.members-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  white-space: nowrap;
}

/* Avatar stack */
.avatar-stack { display: flex; align-items: center; }
.avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  object-fit: cover;
  margin-left: -6px;
  background: var(--bg-hover);
  flex-shrink: 0;
}
.avatar:first-child { margin-left: 0; }
.avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--clr-primary), #ff8a80);
  text-transform: uppercase;
}
.avatar-more {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: var(--clr-text-muted);
  background: var(--clr-border);
}

/* Tasks container */
.tasks-container {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px 80px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tasks-container::-webkit-scrollbar { width: 4px; }
.tasks-container::-webkit-scrollbar-thumb { background: var(--clr-border); border-radius: 4px; }

/* Task item */
.task-item {
  background: var(--bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  transition: border-color var(--transition);
  min-width: 0;
  min-width: 0;
  min-width: 0;
}
.task-item:hover { border-color: var(--clr-border-light); }
.task-item.complete { opacity: .75; }

/* Checkbox */
.task-check {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--clr-border);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  margin-top: 1px;
}
.task-check:hover { border-color: var(--clr-primary); }
.task-check.checked { background: var(--clr-primary); border-color: var(--clr-primary); }
.task-check svg { width: 12px; height: 12px; stroke: #0a1a14; }

/* Task body */
.task-body { flex: 1; min-width: 0; }
.task-heading { font-size: 14px; font-weight: 600; color: var(--clr-text); line-height: 1.4; word-break: break-word; }
.task-meta { overflow-wrap: anywhere; }
.task-heading.done { text-decoration: line-through; color: var(--clr-text-muted); }
.task-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 7px;
  flex-wrap: wrap;
}
.task-due { font-size: 11px; color: var(--clr-text-muted); }
.task-due.overdue { color: var(--clr-error); font-weight: 600; }
.task-by  { font-size: 11px; color: var(--clr-text-muted); }

/* Task actions (delete) */
.task-actions { display: flex; gap: 6px; }
.task-delete-btn {
  width: 26px;
  height: 26px;
  border: none;
  background: transparent;
  color: var(--clr-text-muted);
  cursor: pointer;
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
  flex-shrink: 0;
}
.task-delete-btn:hover { background: var(--clr-badge-no); color: var(--clr-error); }
.task-delete-btn svg { width: 14px; height: 14px; }

/* Task count badge (inside detail view) */
.task-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--clr-primary);
  color: #0a1a14;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  min-width: 18px;
  margin-left: 4px;
}

/* Task project / milestone tags */
.task-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.task-project-tag,
.task-milestone-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
  max-width: clamp(100px, 45vw, 200px);
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-project-tag {
  background: rgba(0, 160, 240, .12);
  color: #d32f2f;
  border: 1px solid rgba(211, 47, 47, .25);
}
.task-project-tag svg { flex-shrink:0; stroke: #d32f2f; }
.task-milestone-tag {
  background: rgba(211, 47, 47, .10);
  color: var(--clr-primary);
  border: 1px solid rgba(211, 47, 47, .22);
}
.task-milestone-tag svg { flex-shrink:0; stroke: var(--clr-primary); }

/* All-tasks filter bar */
.all-tasks-filter-bar {
  display: flex;
  gap: 8px;
  padding: 10px 14px 4px;
  flex-shrink: 0;
}
.all-tasks-filter-bar select {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--clr-border);
  color: var(--clr-text);
  border-radius: var(--radius-xs);
  padding: 8px 28px 8px 10px;
  font-size: 12px;
  cursor: pointer;
  min-width: 0;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b84b0' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
.all-tasks-filter-bar select:focus {
  outline: none;
  border-color: var(--clr-primary);
}

.task-form-context { margin-bottom: 14px; }
.task-form-context .detail-grid { grid-template-columns: 1fr 1fr; }

.task-assignees-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.task-assignee-option {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
}

.task-assignee-option input {
  accent-color: var(--clr-primary);
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.task-assignee-option span {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.task-assignee-option strong {
  font-size: 13px;
  color: var(--clr-text);
}

.task-assignee-option small,
.task-mini-muted {
  font-size: 11px;
  color: var(--clr-text-muted);
}

.task-block-padded {
  padding: 14px 16px;
  min-width: 0;
}

.task-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-empty-block {
  font-size: 12px;
  color: var(--clr-text-muted);
  padding: 4px 0;
}

.task-comment-form textarea {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  background: var(--bg-surface);
  border: 1px solid var(--clr-border);
  color: var(--clr-text);
  border-radius: var(--radius-sm);
  padding: 12px 13px;
  font: inherit;
}

.task-comment-form textarea:focus {
  outline: none;
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px rgba(211, 47, 47, .12);
}

.task-comment-actions,
.task-inline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.task-comment-card,
.task-note-card {
  background: var(--bg-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}

.task-comment-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.task-comment-head strong,
.task-note-card strong {
  display: block;
  font-size: 13px;
  color: var(--clr-text);
}

.task-comment-head small,
.task-note-card small,
.task-timeline-meta,
.task-file-item small {
  font-size: 11px;
  color: var(--clr-text-muted);
}

.task-comment-body,
.task-note-card div,
.task-timeline-text {
  font-size: 13px;
  color: var(--clr-text);
  line-height: 1.6;
  word-break: break-word;
}

.task-link-btn {
  border: none;
  background: transparent;
  color: var(--clr-primary);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.task-link-btn.danger { color: var(--clr-error); }

.task-timeline-item {
  position: relative;
  padding-left: 16px;
  border-left: 2px solid var(--clr-border);
}

.task-timeline-item::before {
  content: '';
  position: absolute;
  left: -5px;
  top: 5px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--clr-primary);
}

.task-file-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: inherit;
  text-decoration: none;
}

.task-file-item strong {
  display: block;
  font-size: 13px;
  color: var(--clr-text);
}

.task-file-item span {
  font-size: 12px;
  font-weight: 700;
  color: var(--clr-primary);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════════════════
   NOTIFICATIONS
═══════════════════════════════════════════════════════════ */

/* Permission banner */
.notif-banner {
  position: fixed;
  top: 12px;
  left: 12px;
  right: 12px;
  background: rgba(15, 24, 43, .94);
  border: 1px solid rgba(211, 47, 47, .28);
  border-radius: 20px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 99;
  transform: translateY(-100%);
  transition: transform .3s ease, opacity .3s ease;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px) saturate(130%);
}
.notif-banner:not(.hidden) { transform: translateY(0); }
.notif-banner.hidden { transform: translateY(-100%); pointer-events: none; }
.notif-banner span { flex: 1; font-size: 12px; color: var(--clr-text); }
#btn-notif-allow {
  background: var(--clr-primary);
  color: #0a1a14;
  border: none;
  border-radius: var(--radius-xs);
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
#btn-notif-dismiss {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--clr-text-muted);
  font-size: 20px;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  padding: 0;
}

#btn-notif-allow:hover,
#btn-notif-dismiss:hover {
  filter: brightness(1.05);
}

/* Bell button + badge */
.notif-badge {
  position: absolute;
  top: -1px;
  right: -1px;
  background: linear-gradient(135deg, var(--clr-error), #ff8b5a);
  color: #fff;
  border-radius: 99px;
  font-size: 9px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  pointer-events: none;
  box-shadow: 0 0 0 3px rgba(7, 13, 24, .92);
}
.notif-badge.hidden { display: none; }

.notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 9, 16, .58);
  backdrop-filter: blur(4px);
  z-index: 97;
}

.notif-drawer {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 12px;
  max-height: min(78vh, 760px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 14px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(250,244,240,.98));
  border: 1px solid rgba(191, 31, 31, .15);
  border-radius: 28px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .12);
  z-index: 98;
  backdrop-filter: blur(18px) saturate(140%);
}

.notif-drawer-handle {
  width: 56px;
  height: 5px;
  margin: 0 auto;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(211, 47, 47, .65), rgba(180, 30, 30, .65));
  opacity: .9;
}

.notif-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.notif-drawer-header h3 {
  font-size: 17px;
  font-weight: 800;
  color: var(--clr-text);
}

.notif-drawer-header small,
.notif-drawer-subtitle,
.notif-empty span {
  color: var(--clr-text-muted);
}

.notif-drawer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-chip {
  border-radius: 999px;
  padding-inline: 14px;
  min-height: 34px;
}

.notif-drawer-subtitle {
  font-size: 12px;
  line-height: 1.5;
  padding: 0 2px;
}

.notif-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}

.notif-item {
  width: 100%;
  border: 1px solid rgba(191, 31, 31, .15);
  background: rgba(255, 251, 248, .96);
  border-radius: 18px;
  padding: 12px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: transform var(--transition), border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.notif-item:hover {
  transform: translateY(-1px);
  border-color: rgba(211, 47, 47, .28);
  background: rgba(255, 251, 248, .98);
  box-shadow: var(--shadow-soft);
}

.notif-item.unread {
  border-color: rgba(211, 47, 47, .30);
  background: linear-gradient(180deg, rgba(255,255,255,.99), rgba(254,247,244,.98));
}

.notif-item-icon {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(211, 47, 47, .16), rgba(180, 30, 30, .16));
  color: var(--clr-primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .5px;
}

.notif-item-icon.kind-comment {
  background: linear-gradient(135deg, rgba(180, 30, 30, .16), rgba(211, 47, 47, .10));
}

.notif-item-icon.kind-project,
.notif-item-icon.kind-milestone {
  background: linear-gradient(135deg, rgba(211, 47, 47, .18), rgba(180, 30, 30, .08));
}

.notif-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.notif-item-body strong {
  font-size: 13px;
  color: var(--clr-text);
  line-height: 1.35;
}

.notif-item-body span {
  font-size: 12px;
  color: var(--clr-text-muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.notif-item-body small {
  font-size: 11px;
  color: var(--clr-text-muted);
}

.notif-item-dot {
  width: 10px;
  height: 10px;
  margin-top: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .10);
  background: transparent;
  flex-shrink: 0;
}

.notif-item-dot.live {
  background: linear-gradient(135deg, var(--clr-primary), #ff8a80);
  box-shadow: 0 0 0 4px rgba(211, 47, 47, .10);
}

.notif-empty {
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  border: 1px dashed rgba(191, 31, 31, .35);
  border-radius: 22px;
  background: rgba(255, 255, 255, .85);
}

/* ── Detail section members row ────────────────────────────── */
.detail-members-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
}
.detail-members-row .members-label {
  font-size: 11px;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  font-weight: 700;
}

.member-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  min-width: 0;
}

.member-card-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  margin-left: 0;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.member-card-body {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.member-card-body strong {
  font-size: 13px;
  color: var(--clr-text);
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.member-card-body small,
.member-empty,
.linked-empty,
.linked-item-meta {
  font-size: 11px;
  color: var(--clr-text-muted);
}

.member-card-body small {
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.linked-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.linked-item {
  width: 100%;
  text-align: left;
  background: var(--bg-surface);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
  color: inherit;
  min-width: 0;
}

.linked-item:hover { border-color: var(--clr-primary); }

/* ── Profile screen ───────────────────────────────────────── */
.profile-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-card {
  background: linear-gradient(140deg, rgba(211,47,47,.14), rgba(180,32,32,.10));
  border: 1px solid rgba(211,47,47,.35);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-avatar-wrap {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid rgba(211,47,47,.65);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(7,24,32,.55);
}

.profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-avatar-fallback {
  font-size: 22px;
  font-weight: 800;
  color: var(--clr-primary);
}

.profile-main-info h3 {
  font-size: 18px;
  margin: 0 0 4px;
  color: var(--clr-text);
}

.profile-main-info p {
  margin: 0;
  font-size: 12px;
  color: var(--clr-text-muted);
}

.profile-password-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.linked-item-head,
.linked-item-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.linked-item-head strong {
  font-size: 13px;
  color: var(--clr-text);
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#tasks-members-list {
  flex: 1;
  width: 100%;
  min-width: 0;
}

.linked-item-badge {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--clr-text-muted);
  background: rgba(107,132,176,.12);
  border: 1px solid rgba(107,132,176,.25);
  border-radius: 99px;
  padding: 3px 7px;
}

.linked-item-badge.ok {
  color: var(--clr-success);
  background: rgba(211,47,47,.14);
  border-color: rgba(211,47,47,.22);
}

.linked-item-progress .progress-wrap { flex: 1; }

.linked-item-progress span {
  min-width: 38px;
  text-align: right;
  font-size: 11px;
  color: var(--clr-primary);
  font-weight: 700;
}

/* ── Search wrap (all-tasks screen & general reuse) ─────────── */
.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-input);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-xs);
  padding: 0 12px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-wrap:focus-within {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 3px var(--clr-primary-glow);
}
.search-icon { width: 16px; height: 16px; stroke: var(--clr-text-muted); flex-shrink: 0; }
.search-wrap input {
  background: transparent;
  border: none;
  color: var(--clr-text);
  font-size: 13px;
  outline: none;
  width: 100%;
  padding: 10px 0;
}
.search-wrap input::placeholder { color: var(--clr-text-muted); }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE – Safe Area + Small / Large Screens
═══════════════════════════════════════════════════════════ */

/* ── iOS notch / Dynamic Island safe areas ──────────────────── */
@supports (padding: env(safe-area-inset-top)) {
  .screen {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .app-header {
    padding-top: max(16px, calc(16px + env(safe-area-inset-top)));
  }

  #screen-splash,
  #screen-login {
    padding-top:    env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ── Very small phones (≤ 360px) ───────────────────────────── */
@media (max-width: 360px) {
  .splash-company    { font-size: 22px; letter-spacing: 2px; }
  .splash-logo       { width: 100px; height: 100px; }
  .login-container   { padding: 22px 16px; }
  .login-title       { font-size: 17px; }

  .app-header        { padding: 10px 10px 8px; gap: 6px; flex-wrap: wrap; justify-content: space-between; }
  .header-title      { order: 2; text-align: left; }
  .header-title span { font-size: 13px; }
  .header-title small { font-size: 10px; }
  .btn-icon          { width: 34px; height: 34px; }
  .btn-icon svg      { width: 18px; height: 18px; }
  .header-left, .header-right { min-width: 36px; }
  .header-right      { gap: 6px; justify-content: flex-end; }

  .milestone-card,
  .project-card,
  .task-item         { padding: 10px 12px; }
  .card-equipment,
  .project-name      { font-size: 14px; }
  .task-heading      { font-size: 13px; }

  .detail-field      { padding: 8px 12px; }
  .detail-field label { min-width: 90px; font-size: 9px; }
  .detail-field span  { font-size: 12px; }
  .detail-section-title { font-size: 9px; padding: 8px 12px; }
  .detail-actions    { flex-direction: column; }
  .detail-actions .btn { width: 100%; justify-content: center; }

  .milestones-container,
  .detail-container,
  .form-container,
  .tasks-container   { padding-left: 10px; padding-right: 10px; }

  .filters-bar       { gap: 6px; padding: 8px 10px; }
  .all-tasks-filter-bar { flex-direction: column; gap: 6px; }
  .task-comment-head { flex-direction: column; }
  .task-comment-actions { justify-content: stretch; flex-wrap: wrap; }
  .task-file-item { flex-direction: column; align-items: flex-start; }
  .member-grid { grid-template-columns: 1fr; }
  .linked-item-head,
  .linked-item-progress,
  .milestone-card-stats { flex-direction: column; align-items: flex-start; }

  .task-stats-bar    { gap: 6px; padding: 8px 10px; }
  .task-stats-bar span { font-size: 11px; }

  .btn               { padding: 9px 14px; font-size: 13px; }
  .badge             { font-size: 10px; padding: 2px 7px; }

  .nav-tab           { font-size: 10px; }
  .nav-tab svg       { width: 20px; height: 20px; }
}

@media (max-width: 560px) {
  .app-header {
    flex-wrap: wrap;
    justify-content: space-between;
    padding: 14px 14px 10px;
  }
  .header-title {
    order: 2;
    width: 100%;
    text-align: left;
    margin-top: 6px;
  }
  .header-right {
    gap: 6px;
    justify-content: flex-end;
    width: 100%;
    order: 3;
  }
  .header-left {
    order: 1;
  }
  .filters-bar {
    flex-wrap: wrap;
    gap: 10px;
  }
}

@media (max-width: 640px) {
  body {
    background: #faf4ef;
  }
  body::before,
  body::after {
    display: none;
  }
  .screen {
    background: #fff;
    backdrop-filter: none;
    box-shadow: none;
  }
  .app-header,
  .filters-bar,
  .task-stats-bar,
  .toast,
  .dialog-box,
  .global-loader-box,
  .fab,
  .bottom-nav,
  .notif-banner,
  .notif-drawer,
  .import-modal .dialog-box,
  #import-modal .dialog-box {
    box-shadow: none !important;
  }
  .app-header {
    background: #fff;
    border-bottom: 1px solid rgba(191, 31, 31, .10);
    backdrop-filter: none;
  }
  .header-title span,
  .header-title small {
    color: var(--clr-text);
  }
  .header-right,
  .header-left {
    flex-wrap: wrap;
  }
  .btn-icon,
  .btn,
  .fab {
    transition: none !important;
  }
  .btn-icon:hover,
  .btn:hover,
  .fab:hover,
  .milestone-card:hover,
  .project-card:hover,
  .task-item:hover {
    transform: none !important;
    background: var(--bg-card) !important;
  }
  .milestone-card,
  .project-card,
  .task-item,
  .dialog-box,
  .global-loader-box,
  .toast {
    box-shadow: none !important;
  }
  .filters-bar {
    background: #fff;
    border-bottom: 1px solid rgba(191, 31, 31, .08);
  }
  .search-box,
  .filter-select {
    border-radius: 12px;
  }
  .global-loader-overlay,
  .dialog-overlay,
  #import-modal {
    background: rgba(255, 255, 255, .92) !important;
    backdrop-filter: none !important;
  }
}

/* ── Mid-range phones (361px – 480px) – default, no changes needed ─ */

/* ── Tablet & Desktop (≥ 640px) ────────────────────────────── */
@media (min-width: 640px) {
  /* Dark outer backdrop to frame the app */
  body { background: #07101f; }

  .screen {
    left:  0;
    right: 0;
    border-left:  none;
    border-right: none;
    box-shadow: none;
  }

  .bottom-nav,
  .notif-banner,
  .notif-drawer,
  .global-loader-overlay {
    left:  12px;
    right: 12px;
  }

  .notif-banner {
    border-radius: 20px;
  }

  /* Dialog is already centered via flex – fine as-is */
  /* Toast: lift above nav bar on tablet */
  .toast { bottom: 96px; max-width: 460px; }

  /* Slightly more breathing room inside cards */
  .milestone-card,
  .project-card      { padding: 16px 18px; }
  .task-item         { padding: 14px 16px; }

  .milestones-container,
  .detail-container,
  .form-container,
  .tasks-container   { padding-left: 18px; padding-right: 18px; }
  .task-assignees-list { display: grid; grid-template-columns: 1fr 1fr; }
  .member-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); display: grid; }
  .detail-field label { min-width: 130px; }

  .all-tasks-filter-bar { padding: 12px 18px 6px; }

  /* Slightly larger type */
  .card-equipment,
  .project-name      { font-size: 16px; }
  .task-heading      { font-size: 15px; }
  .detail-field span { font-size: 15px; }
  .header-title span { font-size: 16px; }

  /* Login card */
  .login-container   { padding: 40px 36px; }
  .btn-full          { font-size: 16px; padding: 15px; }
}

/* ── Reduce motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration:  0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .splash-logo { animation: none; }
  .loader-bar  { animation: none; width: 100%; }
}


/* -----------------------------------------------------------
   IMPORT/EXPORT MODAL
----------------------------------------------------------- */
#import-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

#import-modal.show {
  display: flex;
}

#import-modal .dialog-box {
  background: var(--bg-surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

#import-modal h3 {
  font-size: 18px;
  color: var(--clr-text);
  margin-bottom: 16px;
}

#import-file-input {
  padding: 10px;
  border: 2px dashed var(--clr-border);
  border-radius: var(--radius-xs);
  background: var(--bg-input);
  cursor: pointer;
  font-size: 13px;
}

#import-file-input:hover {
  border-color: var(--clr-primary);
  background: var(--bg-hover);
}

.hidden {
  display: none !important;
}

/* ============================================================
   Mobile app polish + PWA states
   ============================================================ */
:root {
  --bg-app: #f7efe7;
  --bg-surface: rgba(255, 252, 248, .86);
  --bg-card: rgba(255, 255, 255, .92);
  --bg-input: rgba(255, 249, 245, .92);
  --bg-hover: rgba(255, 246, 240, .96);
  --clr-primary: #a51f1f;
  --clr-primary-dark: #7b1818;
  --clr-primary-glow: rgba(165, 31, 31, .16);
  --clr-text: #2e1f1c;
  --clr-text-muted: #806259;
  --clr-border: rgba(135, 72, 58, .16);
  --clr-border-light: rgba(135, 72, 58, .10);
  --radius: 24px;
  --radius-sm: 18px;
  --radius-xs: 15px;
  --shadow: 0 22px 60px rgba(74, 34, 25, .16);
  --shadow-soft: 0 14px 34px rgba(74, 34, 25, .12);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html {
  background: #25130f;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100dvh;
  font-family: 'Aptos Display', 'Bahnschrift', 'Trebuchet MS', sans-serif;
  background:
    radial-gradient(circle at 14% 6%, rgba(223, 85, 58, .22), transparent 30%),
    radial-gradient(circle at 88% 10%, rgba(121, 34, 27, .18), transparent 28%),
    linear-gradient(160deg, #fff8f2 0%, #f8eee6 50%, #f3e4d8 100%);
  overscroll-behavior-y: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

input,
textarea {
  user-select: text;
  -webkit-user-select: text;
}

body::before,
body::after {
  display: block;
}

body::before {
  opacity: .72;
  background:
    radial-gradient(circle at 18% 14%, rgba(188, 45, 34, .14), transparent 0 25%),
    radial-gradient(circle at 88% 0%, rgba(255, 178, 122, .18), transparent 0 26%),
    linear-gradient(120deg, transparent 0 42%, rgba(255, 255, 255, .30) 42% 43%, transparent 43% 100%);
}

body::after {
  opacity: .08;
  background-image:
    linear-gradient(rgba(110, 49, 40, .36) 1px, transparent 1px),
    linear-gradient(90deg, rgba(110, 49, 40, .30) 1px, transparent 1px);
  background-size: 22px 22px;
}

.screen {
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(255, 250, 245, .96) 0%, rgba(248, 236, 225, .96) 100%);
  overflow: hidden;
}

.screen.active {
  animation: screen-enter .28s cubic-bezier(.2, .8, .2, 1);
}

@keyframes screen-enter {
  from { opacity: .88; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

#screen-splash {
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, .78), transparent 34%),
    linear-gradient(150deg, #fff9f5 0%, #f4d0c7 58%, #8f1d1d 130%);
}

.splash-content {
  width: min(82vw, 360px);
  padding: 30px 24px;
  border: 1px solid rgba(255, 255, 255, .58);
  border-radius: 34px;
  background: rgba(255, 255, 255, .42);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(130%);
}

.splash-company {
  color: var(--clr-primary-dark);
  text-shadow: none;
}

.splash-tagline {
  color: var(--clr-text-muted);
  letter-spacing: .9px;
  line-height: 1.5;
  text-transform: none;
}

.app-header {
  min-height: calc(70px + var(--safe-top));
  padding: calc(10px + var(--safe-top)) 14px 10px;
  gap: 10px;
  flex-wrap: nowrap;
  background: linear-gradient(180deg, rgba(255, 252, 248, .92), rgba(255, 247, 240, .78));
  border-bottom: 1px solid rgba(135, 72, 58, .12);
  box-shadow: 0 14px 34px rgba(78, 34, 24, .10);
  backdrop-filter: blur(22px) saturate(145%);
}

.header-left,
.header-right {
  min-width: 44px;
  display: flex;
  align-items: center;
}

.header-right {
  max-width: 52%;
  gap: 7px;
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.header-right::-webkit-scrollbar {
  display: none;
}

.header-title {
  order: initial;
  width: auto;
  margin-top: 0;
  text-align: left;
}

.header-title span {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -.02em;
}

.header-title small {
  font-size: 11px;
  line-height: 1.35;
  color: rgba(70, 43, 35, .68);
}

.btn-icon,
.btn {
  touch-action: manipulation;
  -webkit-touch-callout: none;
}

.btn-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .76);
  border: 1px solid rgba(135, 72, 58, .13);
  color: var(--clr-text);
  box-shadow: 0 8px 20px rgba(80, 38, 27, .08), inset 0 1px 0 rgba(255, 255, 255, .75);
}

.btn-icon:hover,
.btn-icon:focus-visible {
  background: rgba(255, 250, 246, .96);
  color: var(--clr-primary);
  border-color: rgba(165, 31, 31, .22);
  transform: translateY(-1px);
}

.btn-icon:active,
.btn:active,
.nav-tab:active,
.milestone-card:active,
.project-card:active,
.task-item:active {
  transform: scale(.985);
}

.btn-icon.primary {
  background: linear-gradient(145deg, #c73a2e, #8f1d1d);
  color: #fff;
  box-shadow: 0 14px 28px rgba(165, 31, 31, .26);
}

.btn {
  min-height: 44px;
  border-radius: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
}

.btn-primary {
  background: linear-gradient(145deg, #c73a2e, #8f1d1d);
  color: #fff;
  box-shadow: 0 14px 28px rgba(165, 31, 31, .22);
}

.btn-secondary {
  background: rgba(255, 255, 255, .74);
  border: 1px solid rgba(135, 72, 58, .14);
}

.filters-bar,
.all-tasks-filter-bar,
.task-stats-bar,
.members-section {
  background: transparent;
  border-bottom: none;
}

.filters-bar {
  padding: 12px 14px 8px;
}

.all-tasks-filter-bar {
  padding: 12px 14px 8px;
}

.filter-select,
.search-box,
.search-wrap,
.all-tasks-filter-bar select {
  min-height: 48px;
  border: 1px solid rgba(135, 72, 58, .14);
  border-radius: 19px;
  background-color: rgba(255, 255, 255, .78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .70), 0 10px 26px rgba(74, 34, 25, .07);
  backdrop-filter: blur(12px);
}

.filter-select,
.search-box input,
.search-wrap input,
.all-tasks-filter-bar select,
.form-group input,
.form-group select,
.form-group textarea {
  font-size: 16px;
}

.search-box,
.search-wrap {
  padding-inline: 14px;
}

.search-box input,
.search-wrap input {
  padding: 12px 0;
}

.milestones-container,
.tasks-container,
.detail-container,
.form-container {
  padding: 14px 14px calc(112px + var(--safe-bottom));
  gap: 12px;
  -webkit-overflow-scrolling: touch;
  scroll-padding-bottom: calc(120px + var(--safe-bottom));
}

.milestone-card,
.project-card,
.task-item,
.detail-section,
.form-section,
.profile-card,
.pdp-stat-card,
.task-file-item,
.task-assignee-option,
.linked-item,
.notif-item {
  border: 1px solid rgba(135, 72, 58, .12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .96), rgba(255, 250, 246, .88));
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.milestone-card,
.project-card,
.task-item {
  position: relative;
  overflow: hidden;
  padding: 16px;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.milestone-card::before,
.project-card::before,
.task-item::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: linear-gradient(180deg, #d9533d, #8f1d1d);
  opacity: .78;
}

.task-item.complete::before {
  background: linear-gradient(180deg, #7d8f6e, #486245);
}

.milestone-card:hover,
.project-card:hover,
.task-item:hover {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .98), rgba(255, 249, 244, .94)) !important;
  border-color: rgba(165, 31, 31, .20);
  box-shadow: 0 18px 42px rgba(74, 34, 25, .14) !important;
  transform: translateY(-1px);
}

.card-equipment,
.project-name,
.task-heading {
  color: var(--clr-text);
  font-weight: 800;
  letter-spacing: -.01em;
}

.card-location,
.card-meta,
.project-meta,
.project-stats-row,
.milestone-card-stats,
.task-meta {
  color: var(--clr-text-muted);
}

.badge {
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  font-weight: 800;
}

.progress-wrap {
  height: 7px;
  background: rgba(135, 72, 58, .12);
}

.progress-bar {
  background: linear-gradient(90deg, #8f1d1d, #e56a42);
}

.detail-section-title {
  padding: 12px 16px 10px;
  background: linear-gradient(90deg, rgba(165, 31, 31, .09), rgba(255, 255, 255, 0));
}

.detail-field {
  padding: 12px 16px;
}

.detail-field label {
  color: rgba(80, 53, 45, .70);
}

.form-container form,
#milestone-form,
#project-form,
#task-form {
  gap: 14px;
}

.form-group label {
  color: rgba(80, 53, 45, .72);
  letter-spacing: .04em;
}

.form-group input,
.form-group select,
.form-group textarea {
  min-height: 48px;
  border-radius: 17px;
  border: 1px solid rgba(135, 72, 58, .15);
  background: rgba(255, 255, 255, .78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

.form-group textarea {
  min-height: 104px;
}

.form-row-2,
.form-row-3,
.form-row-4 {
  gap: 12px;
}

.toggle-switch {
  width: 52px;
  height: 30px;
}

.toggle-slider::before {
  width: 24px;
  height: 24px;
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
}

.bottom-nav {
  left: 14px;
  right: 14px;
  bottom: max(10px, var(--safe-bottom));
  height: calc(76px + var(--safe-bottom));
  padding: 8px 8px var(--safe-bottom);
  border-radius: 30px;
  background: rgba(255, 252, 248, .88);
  border: 1px solid rgba(135, 72, 58, .15);
  box-shadow: 0 24px 58px rgba(74, 34, 25, .18);
  backdrop-filter: blur(24px) saturate(150%);
}

.nav-tab {
  position: relative;
  min-height: 58px;
  border-radius: 23px;
  color: rgba(82, 55, 48, .72);
  font-size: 11px;
  letter-spacing: -.01em;
}

.nav-tab svg {
  transition: transform .18s ease;
}

.nav-tab.active {
  color: var(--clr-primary);
  background: rgba(165, 31, 31, .10);
  text-shadow: none;
}

.nav-tab.active svg,
.nav-tab.active .nav-profile-avatar-wrap {
  transform: translateY(-1px);
}

.nav-tab.active::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 6px;
  width: 20px;
  height: 3px;
  border-radius: 999px;
  background: var(--clr-primary);
  transform: translateX(-50%);
}

.nav-profile-avatar-wrap {
  width: 27px;
  height: 27px;
  background: #fff;
}

.toast {
  bottom: calc(104px + var(--safe-bottom));
  border-radius: 19px;
  border-color: rgba(135, 72, 58, .14);
  background: rgba(255, 252, 248, .94);
  box-shadow: 0 18px 46px rgba(74, 34, 25, .18);
  backdrop-filter: blur(18px);
}

.notif-banner,
.pwa-update-banner,
.network-status,
.install-app-btn {
  backdrop-filter: blur(20px) saturate(150%);
}

.notif-banner {
  top: calc(12px + var(--safe-top));
  background: rgba(255, 252, 248, .92);
  color: var(--clr-text);
  border-color: rgba(165, 31, 31, .18);
}

.notif-banner span {
  color: var(--clr-text);
}

#btn-notif-allow {
  color: #fff;
  background: linear-gradient(145deg, #c73a2e, #8f1d1d);
}

.notif-badge {
  box-shadow: 0 0 0 3px rgba(255, 252, 248, .92);
}

.notif-drawer {
  left: 12px;
  right: 12px;
  bottom: max(12px, var(--safe-bottom));
  border-radius: 30px;
}

.network-status {
  position: fixed;
  top: calc(12px + var(--safe-top));
  left: 50%;
  z-index: 130;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid rgba(135, 72, 58, .16);
  border-radius: 999px;
  background: rgba(255, 252, 248, .94);
  color: var(--clr-text);
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--shadow-soft);
  transform: translate(-50%, -140%);
  transition: transform .24s ease, opacity .24s ease;
  opacity: 0;
}

.network-status:not(.hidden) {
  transform: translate(-50%, 0);
  opacity: 1;
}

.network-status.online .network-dot {
  background: #2e9d62;
}

.network-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #c73a2e;
  box-shadow: 0 0 0 4px rgba(199, 58, 46, .12);
}

.install-app-btn {
  position: fixed;
  right: 16px;
  bottom: calc(102px + var(--safe-bottom));
  z-index: 42;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, .46);
  border-radius: 999px;
  background: linear-gradient(145deg, #c73a2e, #8f1d1d);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 18px 36px rgba(143, 29, 29, .26);
}

.pwa-update-banner {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(102px + var(--safe-bottom));
  z-index: 125;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(135, 72, 58, .16);
  border-radius: 24px;
  background: rgba(255, 252, 248, .94);
  color: var(--clr-text);
  box-shadow: 0 22px 54px rgba(74, 34, 25, .20);
}

.pwa-update-banner span {
  flex: 1;
  font-size: 13px;
  font-weight: 900;
}

.pwa-update-banner .btn-icon {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
}

.dialog-overlay {
  background: rgba(57, 28, 20, .42);
  backdrop-filter: blur(8px);
}

.dialog-box,
#import-modal .dialog-box {
  border-radius: 28px;
  border: 1px solid rgba(135, 72, 58, .14);
  background: rgba(255, 252, 248, .96);
  box-shadow: 0 28px 70px rgba(74, 34, 25, .26);
}

#import-file-input {
  min-height: 56px;
  border-radius: 18px;
  background: rgba(255, 248, 243, .90);
}

@media (max-width: 560px) {
  .app-header {
    flex-wrap: nowrap;
    padding: calc(10px + var(--safe-top)) 12px 10px;
  }

  .header-title {
    order: initial;
    width: auto;
    min-width: 0;
    text-align: left;
    margin-top: 0;
  }

  .header-title span {
    font-size: 16px;
  }

  .header-right {
    width: auto;
    max-width: 54%;
    order: initial;
    justify-content: flex-end;
  }

  .header-left {
    order: initial;
  }

  .btn-icon {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
    border-radius: 15px;
  }

  .filters-bar {
    flex-wrap: nowrap;
  }

  .filter-select {
    max-width: 42%;
  }
}

@media (max-width: 420px) {
  .header-right {
    max-width: 50%;
  }

  .header-title small {
    display: none;
  }

  .filters-bar,
  .all-tasks-filter-bar {
    flex-direction: column;
  }

  .filter-select {
    max-width: none;
    width: 100%;
  }

  .bottom-nav {
    left: 10px;
    right: 10px;
  }

  .nav-tab {
    font-size: 10px;
  }
}

@media (max-width: 640px) {
  .dialog-overlay,
  #import-modal {
    align-items: flex-end;
    padding: 12px;
  }

  .dialog-box,
  #import-modal .dialog-box {
    width: 100%;
    max-width: none;
    max-height: min(86vh, 720px);
    border-radius: 30px 30px 22px 22px;
    transform: translateY(24px);
  }

  .dialog-overlay.show .dialog-box,
  #import-modal.show .dialog-box {
    transform: translateY(0);
  }
}

@media (min-width: 760px) {
  .screen {
    width: min(100vw, 560px);
    left: 50%;
    right: auto;
    border-left: 1px solid rgba(255, 255, 255, .20);
    border-right: 1px solid rgba(255, 255, 255, .20);
    box-shadow: 0 0 0 1px rgba(80, 38, 27, .05), 0 28px 90px rgba(20, 9, 6, .34);
    transform: translateX(-50%) translateY(8px);
  }

  .screen.active {
    transform: translateX(-50%) translateY(0);
  }

  @keyframes screen-enter {
    from { opacity: .88; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
  }

  .bottom-nav,
  .notif-banner,
  .notif-drawer,
  .pwa-update-banner {
    width: min(calc(100vw - 28px), 532px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
  }

  .install-app-btn {
    right: calc(50% - min(50vw, 280px) + 14px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .screen.active {
    animation: none;
  }

  .milestone-card,
  .project-card,
  .task-item,
  .btn,
  .btn-icon,
  .nav-tab,
  .toast,
  .network-status,
  .pwa-update-banner {
    transition: none !important;
  }
}

/* ============================================================
   Readability fix: prevent compressed cards and header overlap
   ============================================================ */
#screen-main .app-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  min-height: auto;
  padding: calc(12px + var(--safe-top)) 14px 12px;
  gap: 10px;
}

#screen-main .header-left,
#screen-main .header-right {
  min-width: 0;
  width: auto;
}

#screen-main .header-right {
  max-width: none;
  overflow: visible;
}

#screen-main .header-title {
  min-width: 0;
  text-align: left;
}

#screen-main .header-title span {
  font-size: 17px;
  line-height: 1.18;
}

#screen-main .header-title small {
  display: block;
  margin-top: 5px;
  font-size: 12px;
  line-height: 1.45;
}

#screen-main .filters-bar {
  display: grid;
  grid-template-columns: minmax(128px, .82fr) minmax(0, 1.18fr);
  gap: 10px;
  padding: 12px 14px 10px;
}

#screen-main .filter-select,
#screen-main .search-box {
  width: 100%;
  max-width: none;
}

.equipment-card {
  min-height: 132px;
  overflow: visible;
  display: grid;
  grid-template-rows: auto auto auto auto;
  gap: 10px;
  padding: 16px 16px 14px 18px;
  border-radius: 24px;
}

.equipment-card > * {
  position: relative;
  z-index: 1;
  min-width: 0;
}

.equipment-card-header {
  align-items: flex-start;
  gap: 10px;
}

.equipment-card-title-wrap {
  min-width: 0;
  flex: 1;
}

.equipment-card .card-equipment {
  display: block;
  font-size: 16px;
  line-height: 1.25;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
}

.equipment-card-subtitle {
  margin-top: 4px;
  color: var(--clr-text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.equipment-card .card-badges {
  align-self: flex-start;
  max-width: 42%;
}

.equipment-card .badge {
  white-space: nowrap;
  line-height: 1;
}

.equipment-card-location {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  min-height: 26px;
}

.equipment-card-location span {
  min-height: 26px;
  padding: 5px 9px;
  border: 1px solid rgba(135, 72, 58, .12);
  border-radius: 999px;
  background: rgba(255, 247, 242, .86);
  color: rgba(58, 39, 34, .78);
  font-size: 11px;
  font-weight: 800;
}

.equipment-card-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 20px;
}

.equipment-card .progress-wrap {
  min-width: 0;
  height: 8px;
}

.equipment-card .project-progress-pct {
  min-width: 42px;
  text-align: right;
  font-size: 12px;
  font-weight: 900;
  color: var(--clr-primary);
}

.equipment-card .milestone-card-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 9px;
  border-top: 1px solid rgba(135, 72, 58, .10);
  color: var(--clr-text-muted);
  font-size: 12px;
  font-weight: 800;
}

.equipment-card .milestone-card-stats span:last-child {
  text-align: right;
}

@media (max-width: 430px) {
  #screen-main .app-header {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    padding-inline: 12px;
  }

  #screen-main .header-right {
    gap: 6px;
  }

  #screen-main .header-right .btn-icon {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  #screen-main .header-title span {
    font-size: 15px;
  }

  #screen-main .header-title small {
    font-size: 11px;
  }

  #screen-main .filters-bar {
    grid-template-columns: 1fr;
  }

  .equipment-card {
    min-height: 142px;
    padding: 15px 14px 13px 17px;
  }

  .equipment-card .card-equipment {
    font-size: 15px;
  }

  .equipment-card .card-badges {
    max-width: 46%;
  }
}

/* ============================================================
   Unified responsive card system across pages
   ============================================================ */
:root {
  --page-x: clamp(12px, 3.5vw, 20px);
  --page-gap: 12px;
  --card-pad: clamp(14px, 3.8vw, 18px);
  --card-gap: 10px;
  --card-radius: 24px;
}

.milestones-container,
.tasks-container,
.detail-container,
.form-container,
.profile-container {
  gap: var(--page-gap) !important;
  padding-left: var(--page-x) !important;
  padding-right: var(--page-x) !important;
}

.filters-bar,
.all-tasks-filter-bar,
.task-stats-bar,
.members-section {
  padding-left: var(--page-x) !important;
  padding-right: var(--page-x) !important;
}

.project-card,
.task-item,
.detail-section,
.form-section,
.profile-card,
.member-card,
.linked-item,
.notif-item,
.pdp-stat-card {
  border-radius: var(--card-radius) !important;
  border: 1px solid rgba(124, 70, 57, .13) !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .97), rgba(255, 250, 246, .91)) !important;
  box-shadow: 0 12px 34px rgba(74, 34, 25, .10) !important;
}

.project-card,
.task-item,
.linked-item,
.member-card {
  padding: var(--card-pad) !important;
}

.project-card,
.equipment-card {
  gap: var(--card-gap) !important;
}

.project-card-header,
.equipment-card-header,
.linked-item-head {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start !important;
  gap: 10px !important;
}

.project-name-wrap,
.equipment-card-title-wrap,
.task-body,
.linked-item-head strong {
  min-width: 0;
}

.project-name,
.card-equipment,
.task-heading,
.linked-item-head strong {
  font-size: clamp(15px, 4vw, 17px) !important;
  line-height: 1.28 !important;
  letter-spacing: -.015em;
  white-space: normal !important;
  overflow: visible !important;
  text-overflow: clip !important;
  overflow-wrap: anywhere;
}

.project-short,
.equipment-card-subtitle,
.linked-item-meta,
.task-by,
.task-due {
  line-height: 1.35;
}

.project-card .badge,
.equipment-card .badge,
.linked-item-badge {
  max-width: 38vw;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-progress-row,
.equipment-card-progress,
.linked-item-progress {
  min-height: 22px;
}

.project-progress-row,
.project-stats-row,
.milestone-card-stats,
.task-meta,
.task-tags,
.linked-item-progress {
  gap: 8px !important;
}

.project-stats-row,
.milestone-card-stats {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
}

.project-stats-row .project-dates,
.milestone-card-stats span:last-child {
  margin-left: 0 !important;
  justify-self: end;
  max-width: 100%;
  text-align: right;
  white-space: normal;
}

.project-stat,
.milestone-card-stats span,
.task-meta span {
  min-width: 0;
}

.task-item {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start !important;
  gap: 12px !important;
  min-height: 88px;
  overflow: visible !important;
}

.task-check {
  margin-top: 2px;
}

.task-body {
  display: grid;
  gap: 8px;
}

.task-meta,
.task-tags {
  display: flex;
  flex-wrap: wrap;
}

.task-project-tag,
.task-milestone-tag,
.task-status-tag {
  min-height: 25px !important;
  max-width: min(100%, 260px) !important;
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  border-radius: 999px !important;
  padding: 4px 9px !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  line-height: 1.1 !important;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-actions {
  align-self: start;
}

.task-delete-btn {
  width: 34px;
  height: 34px;
  border-radius: 13px;
  background: rgba(255, 246, 242, .82);
}

.task-stats-bar {
  min-height: 54px;
  display: grid !important;
  grid-template-columns: auto minmax(88px, 1fr) auto;
  align-items: center;
}

.all-tasks-filter-bar {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px !important;
}

.all-tasks-filter-bar .search-wrap {
  grid-column: 1 / -1;
}

.detail-section {
  overflow: hidden !important;
}

.detail-grid {
  gap: 0;
}

.detail-field {
  display: grid !important;
  grid-template-columns: minmax(110px, .42fr) minmax(0, 1fr);
  align-items: start !important;
  gap: 10px !important;
  padding: 13px var(--card-pad) !important;
}

.detail-field.full {
  grid-template-columns: 1fr;
}

.detail-field label,
.detail-field span {
  min-width: 0;
}

.profile-card {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px !important;
  padding: var(--card-pad) !important;
}

.member-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
}

.linked-list {
  display: grid;
  gap: 10px;
}

@media (max-width: 430px) {
  :root {
    --page-x: 12px;
    --page-gap: 10px;
    --card-pad: 14px;
    --card-radius: 22px;
  }

  #screen-main .app-header,
  .app-header {
    gap: 8px;
  }

  .project-card-header,
  .equipment-card-header,
  .linked-item-head {
    grid-template-columns: 1fr;
  }

  .project-card .badge,
  .equipment-card .badge,
  .linked-item-badge {
    max-width: 100%;
    justify-self: start;
  }

  .project-stats-row,
  .milestone-card-stats {
    grid-template-columns: 1fr;
  }

  .project-stats-row .project-dates,
  .milestone-card-stats span:last-child {
    justify-self: start;
    text-align: left;
  }

  .task-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .task-actions {
    grid-column: 2;
  }

  .all-tasks-filter-bar {
    grid-template-columns: 1fr;
  }

  .detail-field {
    grid-template-columns: 1fr;
    gap: 4px !important;
  }
}

/* ============================================================
   Task cards: full mobile layout
   ============================================================ */
.tasks-container {
  gap: 12px !important;
}

.task-card {
  min-height: 128px !important;
  padding: 15px 16px 14px 18px !important;
  grid-template-columns: 30px minmax(0, 1fr) auto !important;
  gap: 12px !important;
  align-items: start !important;
}

.task-card::before {
  width: 5px;
}

.task-card .task-check {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  border-width: 2px;
  background: rgba(255, 255, 255, .72);
}

.task-card .task-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.task-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.task-card .task-heading {
  min-width: 0;
  font-size: 15.5px !important;
  line-height: 1.42 !important;
  font-weight: 850 !important;
  color: var(--clr-text);
  word-break: normal;
  overflow-wrap: anywhere;
}

.task-card .task-heading.done {
  color: rgba(80, 53, 45, .58);
}

.task-card-chips,
.task-card-footer,
.task-card .task-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px !important;
  margin-top: 0 !important;
}

.task-chip,
.task-card .task-project-tag,
.task-card .task-milestone-tag,
.task-card .task-status-tag {
  min-height: 28px !important;
  border-radius: 999px !important;
  padding: 6px 10px !important;
  font-size: 11px !important;
  line-height: 1.1 !important;
  font-weight: 850 !important;
  max-width: 100% !important;
}

.task-card .task-project-tag,
.task-card .task-milestone-tag {
  background: rgba(255, 247, 242, .92);
  color: rgba(59, 39, 34, .78);
  border: 1px solid rgba(135, 72, 58, .13);
}

.task-card .task-status-tag {
  background: var(--task-status-color, var(--clr-primary)) !important;
  color: #fff !important;
  box-shadow: 0 8px 18px color-mix(in srgb, var(--task-status-color, #8f1d1d) 22%, transparent);
}

.task-chip {
  display: inline-flex;
  align-items: center;
  color: var(--clr-text-muted);
  background: rgba(255, 255, 255, .70);
  border: 1px solid rgba(135, 72, 58, .11);
}

.task-chip.overdue,
.task-due.overdue {
  color: #a51f1f !important;
  background: rgba(199, 58, 46, .10);
  border-color: rgba(199, 58, 46, .18);
}

.task-card .avatar-stack {
  margin-inline-end: 2px;
}

.task-card .avatar {
  width: 26px;
  height: 26px;
}

.task-card .task-actions {
  min-width: 34px;
}

#screen-all-tasks .task-card .task-actions:empty {
  display: none;
}

@media (max-width: 430px) {
  .task-card {
    min-height: 142px !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    padding: 14px 14px 13px 17px !important;
  }

  .task-card-head {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .task-card .task-status-tag {
    justify-self: start;
  }

  .task-card .task-actions {
    grid-column: 2;
  }
}

/* ============================================================
   Reference card redesign inspired by compact task dashboard
   ============================================================ */
body,
.screen {
  background:
    linear-gradient(180deg, #eef3f7 0%, #f7f9fb 42%, #f3f6f8 100%) !important;
}

.milestones-container,
.tasks-container {
  gap: 16px !important;
}


.ref-card {
  display: block !important;
  width: 100% !important;
  min-height: auto !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 1px solid rgba(191, 31, 31, .14) !important;
  border-radius: 24px !important;
  background: #fff !important;
  box-shadow: 0 18px 36px rgba(191, 31, 31, .10) !important;
  color: #2f1f19;
  box-sizing: border-box;
}

.ref-card::before {
  display: none !important;
}

.ref-card:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 22px 40px rgba(191, 31, 31, .12) !important;
  border-color: rgba(191, 31, 31, .20) !important;
}

.ref-card-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 16px;
}

.ref-card-copy {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.ref-card-title {
  min-width: 0;
  color: #2f1f19;
  font-size: 17px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: .01em;
  overflow-wrap: anywhere;
}

.ref-card-title.done {
  color: #8a98a8;
  text-decoration: line-through;
}

.ref-card-desc {
  min-width: 0;
  color: #6d5c56;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.ref-card .badge,
.ref-card .task-status-tag {
  min-height: 34px !important;
  padding: 9px 14px !important;
  border-radius: 999px !important;
  border: none !important;
  background: var(--clr-primary) !important;
  color: #fff !important;
  box-shadow: none !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.ref-card .badge-incomplete,
.ref-card .badge-not-started,
.ref-card .badge-on-hold {
  background: rgba(255, 83, 112, .14) !important;
  color: #bf1f1f !important;
}

.ref-card .badge-canceled {
  background: rgba(255, 196, 200, .24) !important;
  color: #d94455 !important;
}

.ref-card-progress {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(191, 31, 31, .10);
}

.ref-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #8a98a8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.ref-progress-head strong {
  color: #2f1f19;
  font-size: 13px;
  font-weight: 800;
}

.ref-card .progress-wrap {
  height: 8px !important;
  border-radius: 999px;
  background: rgba(191, 31, 31, .10) !important;
}

.ref-card .progress-bar {
  background: linear-gradient(90deg, var(--clr-primary), var(--clr-primary-dark)) !important;
  border-radius: inherit;
}

.ref-subtasks-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid rgba(191, 31, 31, .08);
  color: #748296;
  font-size: 13px;
  font-weight: 700;
}

.ref-dots {
  display: inline-flex;
  gap: 9px;
  align-items: center;
}

.ref-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: rgba(191, 31, 31, .08);
  border: 1px solid rgba(191, 31, 31, .18);
}

.ref-dot.active {
  background: var(--clr-primary) !important;
  border-color: var(--clr-primary) !important;
}

.ref-row-caret {
  color: var(--clr-primary);
  font-size: 18px;
  line-height: 1;
}

.ref-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 0 20px 16px;
}

.ref-card-tags span,
.ref-card .task-project-tag,
.ref-card .task-milestone-tag,
.ref-card .task-chip {
  min-height: 36px !important;
  display: inline-flex !important;
  align-items: center;
  max-width: 100% !important;
  padding: 10px 13px !important;
  border-radius: 12px !important;
  border: 1px solid rgba(191, 31, 31, .12) !important;
  background: rgba(191, 31, 31, .06) !important;
  color: var(--clr-primary-dark) !important;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}

.ref-card-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px 18px;
  border-top: 1px solid rgba(191, 31, 31, .08);
  color: #748296;
  font-size: 12px;
  font-weight: 700;
}

.ref-actions {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.ref-action,
.ref-card .task-check,
.ref-card .task-delete-btn {
  width: 40px !important;
  height: 40px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  border-radius: 999px !important;
  background: #fff !important;
  border: 1px solid rgba(191, 31, 31, .12) !important;
  color: var(--clr-primary) !important;
  font-size: 18px;
  font-weight: 600;
  box-shadow: none !important;
}

.ref-action.danger,
.ref-card .task-delete-btn {
  color: #bf1f1f !important;
}

.ref-action.edit {
  color: #8d1818 !important;
}

.ref-action.warn {
  color: #f0bd48 !important;
}

.ref-card .task-check.checked,
.ref-action.ok {
  border-color: rgba(191, 31, 31, .24) !important;
  color: var(--clr-primary) !important;
  box-shadow: 0 0 0 4px rgba(191, 31, 31, .08) !important;
}

.task-card .avatar-stack {
  justify-self: end;
}

.ref-card .avatar {
  border-color: #fff;
}

/* Override reference card palette for app branding */
body,
.screen {
  background: var(--bg-app) !important;
  backdrop-filter: none !important;
}

body::before,
body::after {
  display: none !important;
}

.ref-card {
  border: 1px solid rgba(191, 31, 31, .14) !important;
  box-shadow: 0 14px 36px rgba(191, 31, 31, .10) !important;
  background: rgba(255, 255, 255, .98) !important;
  max-width: 100% !important;
}

.ref-card:hover {
  transform: translateY(-1px) !important;
  box-shadow: 0 18px 42px rgba(191, 31, 31, .12) !important;
}

.ref-card .badge,
.ref-card .task-status-tag {
  background: rgba(191, 31, 31, .12) !important;
  color: var(--clr-primary-dark) !important;
  border: 1px solid rgba(191, 31, 31, .18) !important;
}

.ref-card .badge-incomplete,
.ref-card .badge-not-started,
.ref-card .badge-on-hold {
  background: rgba(255, 83, 112, .12) !important;
  color: #bf1f1f !important;
}

.ref-card .badge-canceled {
  background: rgba(255, 196, 200, .28) !important;
  color: #d94455 !important;
}

.ref-card-progress .progress-bar {
  background: linear-gradient(90deg, var(--clr-primary), var(--clr-primary-dark)) !important;
}

.ref-dot.active {
  background: var(--clr-primary) !important;
  border-color: var(--clr-primary) !important;
}

.ref-card-tags span,
.ref-card .task-project-tag,
.ref-card .task-milestone-tag,
.ref-card .task-chip {
  background: rgba(191, 31, 31, .06) !important;
  border-color: rgba(191, 31, 31, .12) !important;
  color: var(--clr-primary-dark) !important;
}

.ref-actions,
.ref-action,
.ref-card .task-check,
.ref-card .task-delete-btn {
  background: #fff !important;
  border: 1px solid rgba(191, 31, 31, .12) !important;
  color: var(--clr-primary) !important;
}

.ref-action.ok,
.ref-card .task-check.checked {
  border-color: rgba(191, 31, 31, .24) !important;
  color: var(--clr-primary) !important;
  box-shadow: 0 0 0 5px rgba(191, 31, 31, .08) !important;
}

@media (max-width: 640px) {
  .ref-card {
    border-radius: 20px !important;
    width: 100% !important;
  }
  .ref-card-top {
    flex-direction: column;
    align-items: stretch;
    padding: 18px 18px 16px;
  }
  .ref-card-footer {
    flex-direction: column;
    align-items: stretch;
  }
  .ref-actions {
    justify-content: flex-start !important;
    gap: 10px !important;
  }
  .ref-card-progress,
  .ref-subtasks-row,
  .ref-card-tags,
  .ref-card-footer {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}

@media (max-width: 420px) {
  .ref-card {
    width: 100% !important;
  }
}

@media (max-width: 430px) {
  .ref-card-top {
    grid-template-columns: 1fr;
    padding: 18px 18px 16px;
  }

  .ref-card .badge,
  .ref-card .task-status-tag {
    justify-self: start;
  }

  .ref-card-progress,
  .ref-subtasks-row,
  .ref-card-tags,
  .ref-card-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .ref-card-footer {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .ref-actions {
    grid-column: 1 / -1;
    justify-content: space-between;
    margin-top: 4px;
  }
}

.card-pager {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
  margin-top: 2px;
  border: 1px solid rgba(210, 219, 229, .82);
  border-radius: 18px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 12px 28px rgba(35, 50, 70, .06);
}

.card-pager-btn {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #dfe7ef;
  border-radius: 999px;
  background: #fff;
  color: #344054;
  font-size: 12px;
  font-weight: 850;
}

.card-pager-btn:disabled {
  opacity: .42;
}

.card-pager-info {
  min-width: 0;
  display: grid;
  gap: 2px;
  justify-items: center;
  color: #344054;
  font-size: 12px;
  font-weight: 900;
}

.card-pager-info small {
  color: #748296;
  font-size: 10px;
  font-weight: 800;
}

/* ── Detail Inner Tabs ───────────────────────────────────── */
.detail-tab-host {
  background: var(--bg-card);
  border: 1px solid var(--clr-border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}

.detail-tab-bar {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  background: linear-gradient(90deg, rgba(191,31,31,.05) 0%, transparent 100%);
  border-bottom: 1px solid var(--clr-border);
  padding: 0 4px;
  flex-shrink: 0;
  gap: 0;
}
.detail-tab-bar::-webkit-scrollbar { display: none; }

.detail-tab-btn {
  flex-shrink: 0;
  padding: 13px 16px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--clr-text-muted);
  background: none;
  border: none;
  border-bottom: 2.5px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  letter-spacing: .02em;
}
.detail-tab-btn:hover {
  color: var(--clr-text);
}
.detail-tab-btn.active {
  color: var(--clr-primary);
  border-bottom-color: var(--clr-primary);
}

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: rgba(191,31,31,.12);
  color: var(--clr-primary);
  border-radius: 99px;
  font-size: 10px;
  font-weight: 800;
}

.detail-tab-panel {
  display: none;
}
.detail-tab-panel.active {
  display: block;
}

.detail-tab-body {
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-subsection-title {
  font-size: 10px;
  font-weight: 800;
  color: var(--clr-text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 4px 0 8px;
}

/* panel-internal sections: no outer border, no radius (tabs provide the container) */
.detail-tab-panel .detail-section {
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
.detail-tab-panel .detail-section + .detail-section {
  border-top: 1px solid var(--clr-border) !important;
}

