:root {
  --bg: #f4f1eb;
  --bg-strong: #ece6dc;
  --panel: rgba(255, 255, 255, 0.82);
  --panel-strong: #ffffff;
  --panel-soft: #efe9df;
  --text: #1d2430;
  --muted: #67717f;
  --primary: #0f766e;
  --primary-dark: #0b5b56;
  --secondary: #d97706;
  --secondary-soft: #fff1dc;
  --border: rgba(29, 36, 48, 0.1);
  --shadow: 0 18px 60px rgba(25, 32, 42, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Aptos", "Segoe UI", "Helvetica Neue", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(217, 119, 6, 0.14), transparent 28%),
    linear-gradient(180deg, #fbfaf7 0%, var(--bg) 100%);
  color: var(--text);
}

a {
  color: inherit;
  text-decoration: none;
}

.auth-body {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.app-shell,
.auth-shell,
.page-shell {
  width: min(1220px, calc(100vw - 32px));
  margin: 0 auto;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.auth-card,
.detail-card,
.pv-card,
.empty-card,
.hero-panel,
.stat-card {
  background: var(--panel);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(480px, 100%);
  padding: 36px;
  margin: 0 auto;
}

.brand-line {
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
  font-weight: 700;
}

.muted {
  color: var(--muted);
}

.hero-text {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
  max-width: 720px;
}

.auth-form,
.card-list,
.details-grid,
.stat-grid {
  display: grid;
  gap: 18px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  font-weight: 700;
  font-size: 14px;
}

.field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.95);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.btn-primary,
.btn-secondary,
.btn-ghost,
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-ghost:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 118, 110, 0.2);
}

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

.btn-secondary {
  background: var(--panel-soft);
  color: var(--text);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  border: 1px solid var(--border);
}

.wide-btn {
  width: 100%;
}

.chip {
  background: var(--secondary-soft);
  color: #8a4b05;
  padding: 8px 14px;
  font-size: 14px;
}

.hero-panel {
  margin: 20px auto 24px;
  padding: 28px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: stretch;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.detail-hero {
  padding-top: 24px;
}

.detail-hero-top {
  width: 100%;
  display: flex;
  justify-content: flex-start;
}

.detail-back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  border: 1px solid rgba(29, 36, 48, 0.08);
  box-shadow: 0 10px 24px rgba(25, 32, 42, 0.08);
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.detail-back-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(25, 32, 42, 0.12);
  background: rgba(255, 255, 255, 0.96);
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -80px -120px auto;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(15, 118, 110, 0.18), transparent 70%);
  pointer-events: none;
}

.hero-copy,
.hero-side {
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: grid;
  gap: 10px;
  align-content: start;
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 48px);
  line-height: 1.04;
}

.hero-side {
  min-width: 280px;
  display: grid;
  gap: 14px;
  align-content: start;
  justify-items: end;
}

.hero-user-card {
  width: 100%;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 18px 20px;
  display: grid;
  gap: 8px;
}

.hero-user-card.compact {
  max-width: 320px;
}

.hero-user-label,
.stat-label,
.info-label,
.section-kicker,
.file-callout-label,
.photo-index {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 700;
}

.hero-user-name,
.stat-value {
  font-size: 28px;
  font-weight: 800;
}

.hero-user-meta {
  color: var(--muted);
  font-size: 14px;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  background: var(--secondary-soft);
  color: #8a4b05;
  font-weight: 700;
  font-size: 13px;
}

.meta-grid,
.pv-actions,
.header-actions,
.pager,
.file-strip,
.info-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-bottom: 22px;
}

.stat-card {
  padding: 18px 20px;
  display: grid;
  gap: 8px;
}

.pv-card,
.detail-card {
  padding: 24px;
}

.detail-card-compact {
  padding: 18px 18px 16px;
  border-radius: 24px;
}

.modern-card-list {
  gap: 20px;
}

.modern-pv-card {
  display: grid;
  gap: 18px;
}

.pv-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.pv-card-main h2,
.detail-card h2 {
  margin: 0;
}

.pv-type-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 7px 11px;
  border-radius: 999px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.detail-chip {
  margin-bottom: 0;
}

.status-pill {
  padding: 10px 15px;
  border-radius: 999px;
  background: rgba(217, 119, 6, 0.12);
  color: #8a4b05;
  font-weight: 700;
  white-space: nowrap;
}

.pv-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.details-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  margin-bottom: 22px;
}

.detail-layout {
  align-items: start;
}

.detail-card-span {
  grid-column: 1 / -1;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.detail-card-compact .section-heading {
  margin-bottom: 14px;
}

.detail-card-compact h2 {
  font-size: 20px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.info-grid-compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.info-tile {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 14px 16px;
  display: grid;
  gap: 8px;
}

.info-grid-compact .info-tile {
  border-radius: 16px;
  padding: 11px 12px;
  gap: 5px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}

.info-tile strong {
  font-size: 15px;
  line-height: 1.45;
}

.info-grid-compact .info-tile strong {
  font-size: 14px;
  line-height: 1.32;
}

.file-callout {
  min-width: min(100%, 320px);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 16px 18px;
  display: grid;
  gap: 8px;
}

.muted-callout {
  opacity: 0.86;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.photo-thumb {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-thumb:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(25, 32, 42, 0.12);
}

.photo-preview-link {
  display: block;
}

.photo-thumb img {
  width: 100%;
  aspect-ratio: 4 / 3.15;
  object-fit: cover;
  border-radius: 16px;
  background: var(--panel-soft);
}

.photo-meta {
  display: grid;
  gap: 6px;
}

.photo-meta strong {
  line-height: 1.4;
}

.photo-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 2px;
}

.photo-save-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #efe7fb;
  color: #44345f;
  border: 1px solid rgba(120, 105, 150, 0.16);
  font-size: 12px;
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.photo-save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(68, 52, 95, 0.14);
  background: #e8dcfb;
}

@media (max-width: 720px) {
  .info-grid-compact {
    grid-template-columns: 1fr;
  }
}

.alert-error {
  margin: 14px 0;
  background: #ffe7e8;
  color: #9a1f28;
  border: 1px solid #f2b8bc;
  border-radius: 16px;
  padding: 12px 14px;
}

.empty-card {
  padding: 30px;
}

.empty-card h2 {
  margin-top: 0;
}

@media (max-width: 720px) {
  .hero-panel,
  .pv-card-top,
  .section-heading {
    flex-direction: column;
  }

  .hero-side {
    width: 100%;
    justify-items: stretch;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions > * {
    flex: 1 1 auto;
  }
}

.home-shell {
  width: min(1260px, calc(100vw - 20px));
  margin: 0 auto;
  padding: 8px 0 32px;
}

.home-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 8px 0 14px;
}

.home-topbar h1 {
  margin: 4px 0 0;
}

.home-main {
  display: grid;
  gap: 16px;
}

.home-controls {
  display: grid;
  gap: 14px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(29, 36, 48, 0.24);
  border-radius: 18px;
  padding: 14px 18px;
  box-shadow: 0 8px 24px rgba(25, 32, 42, 0.06);
}

.search-icon {
  font-size: 22px;
  color: var(--muted);
  line-height: 1;
}

.search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: 18px;
  color: var(--text);
}

.search-input::placeholder {
  color: #7b7482;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  align-items: center;
}

.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 10px 18px;
  border-radius: 12px;
  background: #e9def9;
  color: #47367a;
  font-weight: 700;
  border: 1px solid rgba(111, 100, 124, 0.14);
  box-shadow: inset 0 0 0 1px rgba(111, 100, 124, 0.08);
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.filter-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(71, 54, 122, 0.12);
}

.filter-pill.active {
  background: linear-gradient(135deg, #6a57b8 0%, #4f5eb7 100%);
  color: #fff;
  border-color: rgba(79, 94, 183, 0.82);
  box-shadow:
    0 10px 24px rgba(79, 94, 183, 0.28),
    inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.show-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: -4px;
}

.show-more-btn {
  min-width: 190px;
}

.older-month-section[hidden] {
  display: none !important;
}

.user-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  min-height: 40px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid rgba(111, 100, 124, 0.5);
  font-weight: 700;
  color: #5d4d8c;
}

.user-filter-pill label {
  white-space: nowrap;
}

.user-filter-pill select {
  border: none;
  background: transparent;
  color: #5d4d8c;
  font-weight: 700;
  max-width: 280px;
  outline: none;
}

.home-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  justify-content: center;
  color: var(--muted);
  font-size: 14px;
}

.home-section {
  display: grid;
  gap: 10px;
}

.section-title {
  margin: 8px 0 0;
  text-align: center;
  font-size: 15px;
  font-weight: 800;
}

.work-title {
  color: #b14633;
}

.finalized-title {
  color: #4f5eb7;
  margin: 0;
  white-space: nowrap;
}

.month-title {
  color: #5a55b6;
  text-align: left;
}

.home-phase-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.phase-divider-line {
  height: 1px;
  flex: 1;
  background: rgba(90, 85, 182, 0.18);
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 16px;
}

@media (min-width: 1380px) {
  .home-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.home-card {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(120, 105, 150, 0.22);
  border-radius: 16px;
  box-shadow: 0 3px 10px rgba(46, 39, 53, 0.07);
  padding: 11px 12px 10px;
  display: grid;
  gap: 8px;
}

.home-card-clickable {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.home-card-clickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(46, 39, 53, 0.12);
  border-color: rgba(98, 84, 142, 0.34);
}

.home-card-clickable:focus-within {
  outline: 2px solid rgba(79, 94, 183, 0.35);
  outline-offset: 2px;
}

.home-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.home-card-title-wrap {
  display: flex;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.home-card-icon {
  font-size: 15px;
  line-height: 1;
  margin-top: 2px;
}

.home-card-title-block {
  min-width: 0;
}

.home-card-title-block h2 {
  margin: 0;
  font-size: 13px;
  line-height: 1.2;
  color: #6d62b5;
  font-weight: 800;
}

.home-card-title-block a,
.home-card-title-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.home-card-title-link {
  color: inherit;
}

.home-card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 9px;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid rgba(111, 100, 124, 0.22);
  color: #84768f;
  background: rgba(255, 255, 255, 0.86);
}

.status-chip.success {
  color: #4e8b4b;
  border-color: rgba(78, 139, 75, 0.38);
}

.status-chip.warning {
  color: #b8860b;
  border-color: rgba(184, 134, 11, 0.38);
}

.status-chip.neutral {
  color: #857a8f;
}

.mini-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 6px;
  border-radius: 6px;
  background: #eee7fb;
  color: #8677be;
  font-size: 9px;
  font-weight: 700;
}

.home-card-body {
  display: grid;
  gap: 2px;
  color: #7b7482;
  font-size: 13px;
}

.home-card-body p {
  margin: 0;
  line-height: 1.22;
}

.home-card-divider {
  height: 1px;
  background: rgba(120, 105, 150, 0.16);
}

.home-card-footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}

.home-card-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-height: 24px;
}

.flag {
  font-size: 11px;
  font-weight: 800;
}

.flag-red {
  color: #e34c44;
}

.flag-magenta {
  color: #ff2fd5;
}

.home-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

.action-bubble {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #efe7fb;
  color: #382f4f;
  border: 1px solid rgba(120, 105, 150, 0.12);
  font-size: 11px;
  font-weight: 800;
}

.action-bubble.pdf {
  font-size: 10px;
}

.action-bubble.camera {
  width: auto;
  min-width: 30px;
  padding: 0 8px;
}

@media (max-width: 900px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .search-input {
    font-size: 16px;
  }

  .user-filter-pill {
    width: 100%;
    justify-content: space-between;
  }

  .user-filter-pill select {
    max-width: none;
    width: 100%;
  }

  .home-card-head,
  .home-card-footer {
    flex-direction: column;
    align-items: stretch;
  }

  .home-card-badges {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .home-card-actions {
    margin-left: 0;
    justify-content: flex-end;
  }
}
