@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
  --gold:       #C9A96E;
  --gold-light: #E8D5B0;
  --gold-dark:  #A07840;
  --earth:      #8B6914;
  --forest:     #4A5240;
  --stone:      #6B6B5C;
  --cream:      #F5F0E8;
  --warm-white: #FDFAF5;
  --dark:       #1C1A14;
  --dark-card:  #242118;
  --dark-border:#2E2B22;
  --text-main:  #2C2A20;
  --text-muted: #7A7464;
  --sidebar-w:  260px;
  --header-h:   64px;
  --radius:     12px;
  --radius-sm:  8px;
  --shadow:     0 4px 24px rgba(0,0,0,.08);
  --shadow-lg:  0 12px 48px rgba(0,0,0,.14);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--cream);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.6;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gold-light); border-radius: 99px; }

/* ══════════════════════════════════════
   SIDEBAR
══════════════════════════════════════ */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--dark);
  display: flex;
  flex-direction: column;
  z-index: 100;
  border-right: 1px solid var(--dark-border);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
}

.sidebar-logo {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--dark-border);
}

.sidebar-logo .logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  margin-bottom: .75rem;
  box-shadow: 0 4px 12px rgba(201,169,110,.3);
}

.sidebar-logo .project-name {
  font-family: 'Playfair Display', serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--cream);
  line-height: 1.3;
}

.sidebar-logo .project-sub {
  font-size: .75rem;
  color: var(--stone);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-top: .15rem;
}

.sidebar-nav {
  flex: 1;
  padding: 1rem 0;
  overflow-y: auto;
}

.nav-section-title {
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--stone);
  padding: .5rem 1.5rem .25rem;
  margin-top: .5rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1.5rem;
  color: #9A9080;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 400;
  border-radius: 0;
  transition: all .2s;
  position: relative;
}

.nav-item:hover {
  color: var(--cream);
  background: rgba(255,255,255,.04);
}

.nav-item.active {
  color: var(--gold);
  background: rgba(201,169,110,.08);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 4px; bottom: 4px;
  width: 3px;
  background: var(--gold);
  border-radius: 0 3px 3px 0;
}

.nav-item .nav-icon {
  width: 18px;
  text-align: center;
  font-size: .95rem;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--dark-border);
}

.user-info {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .5rem;
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--gold), var(--earth));
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.user-details .user-name {
  font-size: .8rem;
  font-weight: 600;
  color: var(--cream);
  line-height: 1.2;
}

.user-details .user-role {
  font-size: .7rem;
  color: var(--stone);
  text-transform: capitalize;
}

.logout-link {
  display: block;
  margin-top: .5rem;
  padding: .4rem .5rem;
  font-size: .75rem;
  color: var(--stone);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: color .2s;
}

.logout-link:hover { color: #E57373; }

/* ══════════════════════════════════════
   MAIN LAYOUT
══════════════════════════════════════ */
.main-wrapper {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  position: sticky;
  top: 0;
  background: rgba(245,240,232,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(201,169,110,.2);
  padding: 0 2rem;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 50;
}

.page-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--dark);
}

.page-actions {
  display: flex;
  gap: .75rem;
  align-items: center;
}

.back-btn {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(201,169,110,.25);
  background: rgba(255,255,255,.8);
  color: var(--dark);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  line-height: 1;
  transition: transform .15s, background .15s, border-color .15s;
}

.back-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(201,169,110,.45);
  background: rgba(255,255,255,.95);
}

.main-content {
  flex: 1;
  padding: 2rem;
}

/* ══════════════════════════════════════
   CARDS
══════════════════════════════════════ */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  border: 1px solid rgba(201,169,110,.12);
}

.card-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(201,169,110,.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--dark);
}

.card-body { padding: 1.5rem; }

/* ══════════════════════════════════════
   GRID
══════════════════════════════════════ */
.grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ══════════════════════════════════════
   STAT CARDS
══════════════════════════════════════ */
.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(201,169,110,.12);
  position: relative;
  overflow: hidden;
}

.stat-card::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: radial-gradient(circle at top right, rgba(201,169,110,.1), transparent);
  border-radius: 0 var(--radius) 0 80px;
}

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: .75rem;
}

.stat-value {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1;
}

.stat-label {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: .25rem;
  font-weight: 500;
}

.stat-sub {
  font-size: .75rem;
  color: var(--gold-dark);
  margin-top: .4rem;
}

/* ══════════════════════════════════════
   PROGRESS
══════════════════════════════════════ */
.progress-bar {
  height: 8px;
  background: var(--gold-light);
  border-radius: 99px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  border-radius: 99px;
  transition: width .6s cubic-bezier(.4,0,.2,1);
}

.progress-bar.lg { height: 12px; }
.progress-bar.sm { height: 5px; }

/* ══════════════════════════════════════
   BUTTONS
══════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .2s;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: white;
  box-shadow: 0 2px 8px rgba(201,169,110,.3);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(201,169,110,.4);
}

.btn-outline {
  background: transparent;
  color: var(--gold-dark);
  border: 1.5px solid var(--gold-light);
}

.btn-outline:hover {
  background: var(--gold-light);
  border-color: var(--gold);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: .4rem .7rem;
}

.btn-ghost:hover { background: var(--cream); color: var(--text-main); }

.btn-danger { background: #FEE2E2; color: #B91C1C; }
.btn-danger:hover { background: #FECACA; }

.btn-sm { padding: .35rem .75rem; font-size: .8rem; }
.btn-lg { padding: .8rem 1.75rem; font-size: .95rem; }

/* ══════════════════════════════════════
   BADGES & STATUS
══════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .15rem .55rem;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 600;
}

.badge-overdue { background: #FEE2E2; color: #B91C1C; }
.badge-today   { background: #FEF3C7; color: #92400E; }
.badge-soon    { background: #FEF9EE; color: #A07840; }
.badge-normal  { background: var(--cream); color: var(--stone); }

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .65rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.status-badge.pending    { background: #F3F4F6; color: #6B7280; }
.status-badge.active     { background: #D1FAE5; color: #065F46; }
.status-badge.done       { background: #DBEAFE; color: #1E40AF; }
.status-badge.open       { background: #FEF3C7; color: #92400E; }
.status-badge.inprogress { background: #EDE9FE; color: #5B21B6; }
.status-badge.blocked    { background: #FEE2E2; color: #B91C1C; }

/* ══════════════════════════════════════
   TABLES
══════════════════════════════════════ */
.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}

th {
  text-align: left;
  padding: .75rem 1rem;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(201,169,110,.15);
}

td {
  padding: .9rem 1rem;
  border-bottom: 1px solid rgba(201,169,110,.08);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(201,169,110,.03); }

/* ══════════════════════════════════════
   FORMS
══════════════════════════════════════ */
.form-group { margin-bottom: 1rem; }

label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: .35rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

input[type=text], input[type=email], input[type=password],
input[type=date], input[type=time], input[type=number],
select, textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid rgba(201,169,110,.25);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: .875rem;
  background: white;
  color: var(--text-main);
  transition: border-color .2s, box-shadow .2s;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,169,110,.15);
}

textarea { resize: vertical; min-height: 80px; }

/* ══════════════════════════════════════
   PHASE TIMELINE
══════════════════════════════════════ */
.phase-timeline {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.phase-item {
  background: white;
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  border: 1.5px solid transparent;
  box-shadow: var(--shadow);
  transition: border-color .2s, transform .2s;
  cursor: pointer;
}

.phase-item:hover {
  transform: translateX(4px);
  border-color: var(--gold-light);
}

.phase-item.active-phase {
  border-color: var(--gold);
  background: linear-gradient(135deg, white, #FEFAF2);
}

.phase-item.done-phase { opacity: .75; }

.phase-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: .6rem;
}

.phase-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.phase-name {
  font-weight: 600;
  font-size: .9rem;
  flex: 1;
}

.phase-pct {
  font-family: 'Playfair Display', serif;
  font-size: .9rem;
  font-weight: 700;
  color: var(--gold-dark);
}

.phase-dates {
  font-size: .75rem;
  color: var(--text-muted);
  margin-top: .4rem;
}

/* ══════════════════════════════════════
   APPOINTMENT CARDS
══════════════════════════════════════ */
.appt-card {
  display: flex;
  gap: 1rem;
  padding: .9rem 1rem;
  border-radius: var(--radius-sm);
  background: white;
  border: 1px solid rgba(201,169,110,.12);
  transition: box-shadow .2s;
}

.appt-card:hover { box-shadow: var(--shadow); }

.appt-date-box {
  text-align: center;
  min-width: 48px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: var(--radius-sm);
  padding: .4rem;
  color: white;
}

.appt-day {
  font-family: 'Playfair Display', serif;
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

.appt-month {
  font-size: .65rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .85;
}

.appt-info { flex: 1; min-width: 0; }
.appt-title { font-weight: 600; font-size: .9rem; }
.appt-meta { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }

/* ══════════════════════════════════════
   TASK ITEMS
══════════════════════════════════════ */
.task-item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  transition: background .15s;
  border-bottom: 1px solid rgba(201,169,110,.07);
}

.task-item:last-child { border-bottom: none; }
.task-item:hover { background: var(--cream); }

.task-check {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--gold-light);
  flex-shrink: 0;
  cursor: pointer;
  transition: all .2s;
  display: flex; align-items: center; justify-content: center;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  padding: 0;
}

.task-check:hover { border-color: var(--gold); background: rgba(201,169,110,.1); }
.task-check.done-check { background: var(--gold); border-color: var(--gold); }
.task-check.done-check::after { content: '✓'; font-size: .65rem; color: white; font-weight: 700; }
.task-check.disabled { cursor: not-allowed; opacity: .55; }
.task-check.disabled:hover { border-color: var(--gold-light); background: transparent; }

.task-content { flex: 1; min-width: 0; }
.task-title { font-size: .875rem; font-weight: 500; }
.task-title.done-task { text-decoration: line-through; color: var(--text-muted); }
.task-meta { font-size: .72rem; color: var(--text-muted); margin-top: .15rem; }

.task-toolbar {
  margin-bottom: 1.25rem;
}

.task-toolbar-row {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.task-toolbar-filters {
  display: flex;
  gap: .45rem;
  flex-wrap: wrap;
  align-items: center;
}

.task-toolbar-phase {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .45rem;
}

.task-toolbar-phase select {
  min-width: 220px;
}

.task-toolbar-count {
  color: var(--text-muted);
  font-size: .8rem;
}

.task-mobile-list {
  display: none;
  margin-top: 1rem;
  gap: .65rem;
  flex-direction: column;
}

.task-mobile-top {
  display: flex;
  gap: .6rem;
  justify-content: space-between;
  align-items: flex-start;
}

.task-mobile-title {
  font-weight: 750;
  font-size: .98rem;
  line-height: 1.2;
  min-width: 0;
}

.task-mobile-card { position: relative; }

.task-mobile-link {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: var(--radius);
  text-decoration: none;
}

.task-mobile-link:focus-visible {
  outline: 2px solid rgba(201,169,110,.8);
  outline-offset: 2px;
}

.task-mobile-actions { flex-shrink: 0; position: relative; z-index: 3; }

.task-mobile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .45rem;
}

.task-mobile-meta {
  margin-top: .45rem;
  color: var(--text-muted);
  font-size: .78rem;
}

.task-mobile-desc {
  margin-top: .4rem;
  color: var(--text-muted);
  font-size: .82rem;
}

.invoice-mobile-list {
  display: none;
  margin-top: 1rem;
  gap: .65rem;
  flex-direction: column;
}

.invoice-mobile-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .6rem;
}

.invoice-mobile-title {
  font-weight: 800;
  font-size: .98rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-mobile-meta {
  margin-top: .25rem;
  color: var(--text-muted);
  font-size: .78rem;
}

.invoice-mobile-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  margin-top: .55rem;
}

.assignee-pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .15rem .45rem;
  border-radius: 99px;
  background: #f3efe7;
  color: var(--text-main);
  font-size: .72rem;
}

.assignee-pill-avatar {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: white;
  font-size: .65rem;
  font-weight: 700;
}

.overdue-alert {
  border-left: 4px solid #e74c3c;
  background: #fdf0ef;
  border-radius: var(--radius-sm);
  padding: 1rem 1rem 1rem 1.1rem;
}

.overdue-alert-title {
  color: #b42318;
  font-weight: 700;
  margin-bottom: .6rem;
  font-size: .95rem;
}

.overdue-alert-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.overdue-alert-item {
  display: flex;
  gap: .65rem;
  flex-wrap: wrap;
  text-decoration: none;
  color: #7a271a;
  background: rgba(255,255,255,.65);
  border: 1px solid #f7c6c1;
  border-radius: var(--radius-sm);
  padding: .5rem .65rem;
  font-size: .8rem;
}

.overdue-alert-item:hover {
  background: #fff;
}

.phase-timeline-scroll {
  overflow-x: auto;
  padding: 1rem 0;
  -webkit-overflow-scrolling: touch;
}

.phase-timeline-track {
  display: flex;
  gap: 1rem;
  min-width: max-content;
  padding: 0 .5rem;
}

.phase-timeline-item {
  flex: 0 0 160px;
  background: #fff;
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  border: 1px solid rgba(201,169,110,.2);
  transition: transform .2s, box-shadow .2s;
}

.phase-timeline-item.active {
  flex: 0 0 220px;
  border-color: var(--gold);
  box-shadow: 0 4px 20px rgba(201,169,110,.2);
  transform: scale(1.05);
}

.phase-timeline-item.done { opacity: .65; }
.phase-timeline-item.pending { opacity: .55; }

.phase-timeline-label {
  margin-top: .5rem;
  font-weight: 600;
  font-size: .82rem;
  min-height: 2.5em;
}

.phase-timeline-progress {
  color: var(--gold-dark);
  font-weight: 700;
  font-size: .85rem;
  margin-bottom: .4rem;
}

/* ══════════════════════════════════════
   DASHBOARD (SLIM)
══════════════════════════════════════ */
.dash {
  display: flex;
  flex-direction: column;
  gap: .9rem;
}

.dash-hero {
  position: relative;
  border: 1px solid rgba(201,169,110,.18);
}

.dash .card-header {
  padding: .75rem 1rem;
}

.dash .card-title {
  font-size: .95rem;
}

.dash-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 70% at 15% 20%, rgba(201,169,110,.14) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 85% 10%, rgba(138,105,20,.10) 0%, transparent 55%),
    linear-gradient(135deg, #ffffff 0%, #FEFAF2 60%, #ffffff 100%);
  pointer-events: none;
}

.dash-hero-top,
.dash-kpis {
  position: relative;
  z-index: 1;
}

.dash-hero-top {
  padding: 1.15rem 1.25rem .35rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.dash-hero-copy { min-width: 0; flex: 1; }

.dash-eyebrow {
  font-size: .68rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--gold-dark);
  font-weight: 800;
}

.dash-hero-row {
  margin-top: .65rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.dash-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.dash-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
  line-height: 1.2;
  margin-top: .15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-sub {
  margin-top: .25rem;
  font-size: .82rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  align-items: center;
}

.dash-sub-sep {
  color: rgba(160,120,64,.65);
  margin: 0 .25rem;
}

.dash-hero-metrics {
  display: flex;
  align-items: center;
  gap: .85rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dash-ring {
  --pct: 0;
  --ring: var(--gold);
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: conic-gradient(var(--ring) calc(var(--pct) * 1%), rgba(201,169,110,.20) 0);
  padding: 7px;
  box-shadow: 0 10px 28px rgba(201,169,110,.18);
}

.dash-ring-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.dash-ring-inner {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(255,255,255,.9);
  border: 1px solid rgba(201,169,110,.22);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dash-ring-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--gold-dark);
  line-height: 1;
}

.dash-ring-label {
  margin-top: .2rem;
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.dash-mini {
  border: 1px solid rgba(201,169,110,.18);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.7);
  padding: .5rem .6rem;
  min-width: 92px;
}

.dash-mini-label {
  font-size: .66rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 700;
}

.dash-mini-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--dark);
  margin-top: .15rem;
  line-height: 1.1;
}

.dash-kpis {
  padding: .65rem 1.25rem 1.1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
}

.dash-kpi {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .6rem .75rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(201,169,110,.26);
  background: rgba(255,255,255,.9);
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.dash-kpi:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
  border-color: rgba(201,169,110,.45);
}

.dash-kpi-label {
  font-size: .68rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-muted);
  font-weight: 800;
}

.dash-kpi-value {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--dark);
}

.dash-kpi.warn { border-color: #f59e0b44; background: #fff8e7; }
.dash-kpi.danger { border-color: #dc262655; background: #fff1f1; }

.dash-alert {
  border-left: 4px solid #dc2626;
}

.dash-alert-head {
  padding: .75rem 1.25rem;
  border-bottom: 1px solid rgba(201,169,110,.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dash-alert-title {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  font-weight: 700;
  color: #7a271a;
}

.dash-alert-list {
  padding: .85rem 1.25rem 1.1rem;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .6rem;
}

.dash-alert-item {
  display: block;
  text-decoration: none;
  color: #7a271a;
  border: 1px solid #f7c6c1;
  border-radius: var(--radius-sm);
  background: #fff7f6;
  padding: .6rem .7rem;
  transition: background .15s, transform .15s;
}

.dash-alert-item:hover { background: #fff; transform: translateY(-1px); }

.dash-alert-item-title {
  font-weight: 800;
  font-size: .86rem;
  line-height: 1.2;
}

.dash-alert-item-meta {
  margin-top: .25rem;
  font-size: .73rem;
  color: #7a271a;
  opacity: .85;
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: .8rem;
  align-items: start;
}

.dash-panel-body { padding: .85rem 1rem; }

.dash-panel-mine { grid-column: 1 / -1; }
.dash-panel-timeline { grid-column: 1 / -1; }
.dash-panel-phases { grid-column: 1 / span 7; }
.dash-panel-meta { grid-column: 8 / span 5; }
.dash-panel-activity { grid-column: 1 / span 12; }

/* Desktop: put tasks + timeline next to each other for a true 1-screen dashboard. */
@media (min-width: 901px) {
  .dash-panel-mine { grid-column: 1 / span 7; }
  .dash-panel-timeline { grid-column: 8 / span 5; }
}

.dash-task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: .55rem;
}

.dash-task-card {
  border: 1px solid rgba(201,169,110,.16);
  border-radius: 12px;
  background: rgba(255,255,255,.90);
  padding: .55rem .6rem;
  display: flex;
  gap: .55rem;
  align-items: flex-start;
  transition: transform .15s, box-shadow .15s, border-color .15s, background .15s;
  min-width: 0;
}

.dash-task-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
  border-color: rgba(201,169,110,.42);
  background: rgba(255,255,255,.98);
}

.dash-task-card.overdue {
  border-color: rgba(220,38,38,.35);
  background: #fff7f6;
}

.dash-task-card.overdue:hover { border-color: rgba(220,38,38,.55); }

.dash-task-card-toggle { padding-top: .05rem; }

.dash-task-card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
}

.dash-task-card-more {
  justify-content: center;
  text-align: center;
  border-style: dashed;
  background: rgba(255,255,255,.78);
}

.dash-task-toggle {
  background: none;
  border: none;
  padding: .1rem;
  cursor: pointer;
}

.dash-task-link {
  display: block;
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
}

.dash-task-title {
  font-weight: 650;
  font-size: .92rem;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-task-meta {
  margin-top: .2rem;
  font-size: .75rem;
  color: var(--text-muted);
}

.dash-seg {
  display: inline-flex;
  border: 1px solid rgba(201,169,110,.25);
  background: rgba(255,255,255,.7);
  border-radius: 999px;
  padding: .2rem;
  gap: .2rem;
  margin-bottom: .8rem;
}

.dash-seg-btn {
  border: none;
  background: transparent;
  padding: .35rem .6rem;
  border-radius: 999px;
  cursor: pointer;
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}

.dash-seg-btn span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 18px;
  padding: 0 .4rem;
  border-radius: 999px;
  background: rgba(201,169,110,.14);
  color: var(--gold-dark);
  font-weight: 800;
  font-size: .72rem;
}

.dash-seg-btn.active {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: white;
}

.dash-seg-btn.active span { background: rgba(255,255,255,.25); color: white; }

.dash-timeline-range { display: none; }
.dash-timeline-range.active { display: block; }

.dash-timeline-item {
  display: block;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(201,169,110,.16);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.85);
  padding: .55rem .65rem;
  margin-bottom: .5rem;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}

.dash-timeline-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
  border-color: rgba(201,169,110,.35);
}

.dash-timeline-main {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-weight: 650;
  font-size: .86rem;
}

.dash-timeline-icon { width: 1.1rem; text-align: center; }

.dash-timeline-title {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-timeline-meta {
  margin-top: .15rem;
  font-size: .74rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-timeline-more {
  margin-top: .2rem;
}

/* Dashboard axis (Rueckblick + Vorschau) */
.dash-axis-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: .45rem;
}

.dash-axis-note {
  font-size: .8rem;
  color: var(--text-muted);
}

.dash-axis-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .35rem;
}

.dash-axis-track {
  display: flex;
  gap: .6rem;
  align-items: stretch;
  min-height: 175px;
}

.dash-day {
  flex: 0 0 156px;
  border: 1px solid rgba(201,169,110,.18);
  border-radius: 12px;
  background: rgba(255,255,255,.85);
  overflow: hidden;
}

.dash-day.today {
  border-color: rgba(201,169,110,.55);
  box-shadow: 0 12px 28px rgba(201,169,110,.14);
}

.dash-day.past {
  opacity: .92;
  background: rgba(255,255,255,.72);
}

.dash-day.past .dash-day-head {
  background: linear-gradient(135deg, rgba(16,185,129,.10), rgba(255,255,255,.9));
}

.dash-day-head {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  padding: .45rem .55rem;
  background: linear-gradient(135deg, rgba(201,169,110,.12), rgba(255,255,255,.9));
  border-bottom: 1px solid rgba(201,169,110,.15);
}

.dash-day-dow {
  font-weight: 900;
  color: var(--gold-dark);
  font-size: .78rem;
}

.dash-day-date {
  font-size: .78rem;
  color: var(--text-muted);
  font-weight: 800;
}

.dash-day-pill {
  margin-left: auto;
  font-size: .68rem;
  font-weight: 900;
  color: white;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  padding: .18rem .45rem;
  border-radius: 999px;
}

.dash-day-body {
  padding: .45rem .55rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.dash-day-empty {
  color: var(--text-muted);
  font-size: .8rem;
  padding: .35rem 0;
}

.dash-axis-item {
  display: flex;
  align-items: center;
  gap: .45rem;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(201,169,110,.14);
  border-radius: 10px;
  background: #fcfaf4;
  padding: .33rem .45rem;
  font-size: .72rem;
  line-height: 1.15;
}

.dash-axis-item:hover { border-color: rgba(201,169,110,.35); background: #fff; }

.dash-axis-ic { width: 1rem; text-align: center; flex-shrink: 0; }

.dash-axis-txt {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}

.dash-axis-time {
  color: var(--text-muted);
  font-weight: 800;
  font-size: .7rem;
  flex-shrink: 0;
}

.dash-axis-more {
  text-decoration: none;
  font-size: .75rem;
  font-weight: 800;
  color: var(--gold-dark);
  padding: .15rem .1rem;
}

/* In-app toast (small hint, no browser alert) */
.hb-toast-wrap {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 200;
  display: none;
}

.hb-toast-wrap.open { display: block; }

.hb-toast {
  max-width: 720px;
  margin: 0 auto;
  border: 1px solid rgba(201,169,110,.25);
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(0,0,0,.16);
  padding: .8rem .9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}

.hb-toast-text {
  font-size: .85rem;
  color: var(--text-main);
  font-weight: 650;
  min-width: 0;
}

.hb-toast-actions { flex-shrink: 0; }

/* Event type accents */
.dash-axis-item.task_done { border-color: rgba(16,185,129,.35); background: rgba(16,185,129,.10); }
.dash-axis-item.task_due { border-color: rgba(185,28,28,.25); background: rgba(185,28,28,.06); }
.dash-axis-item.subtask_due { border-color: rgba(180,83,9,.28); background: rgba(180,83,9,.07); }
.dash-axis-item.appointment { border-color: rgba(201,169,110,.35); background: rgba(201,169,110,.10); }
.dash-axis-item.phase_start,
.dash-axis-item.phase_end { border-color: rgba(29,78,216,.22); background: rgba(29,78,216,.06); }

/* Timeline height is already stabilized by .dash-axis-track min-height. */

.dash-phase-strip {
  display: flex;
  gap: .65rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: .35rem;
}

.dash-phase-chip {
  flex: 0 0 240px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius);
  border: 1px solid rgba(201,169,110,.18);
  background: rgba(255,255,255,.92);
  padding: .75rem .85rem;
  transition: transform .15s, border-color .15s, box-shadow .15s;
}

.dash-phase-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(201,169,110,.45);
  box-shadow: 0 10px 24px rgba(0,0,0,.06);
}

.dash-phase-chip.active {
  border-color: var(--gold);
  box-shadow: 0 12px 28px rgba(201,169,110,.18);
}

.dash-phase-chip.done { opacity: .72; }

.dash-phase-chip-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .6rem;
}

.dash-phase-chip-name {
  font-weight: 800;
  font-size: .88rem;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-phase-chip-pct {
  font-family: 'Playfair Display', serif;
  font-weight: 800;
  color: var(--gold-dark);
}

.dash-activity-list { display: flex; flex-direction: column; gap: .55rem; }

.dash-activity-item {
  border: 1px solid rgba(201,169,110,.14);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.85);
  padding: .55rem .65rem;
}

.dash-activity-action { font-weight: 650; font-size: .86rem; }
.dash-activity-meta { margin-top: .15rem; font-size: .74rem; color: var(--text-muted); }

.dash-kv { display: flex; flex-direction: column; gap: .55rem; }
.dash-kv-row { display: flex; align-items: baseline; justify-content: space-between; gap: .8rem; }
.dash-kv-row span { color: var(--text-muted); font-size: .82rem; font-weight: 650; }
.dash-kv-row strong { font-family: 'Playfair Display', serif; font-size: 1.15rem; }

.dashboard-compact {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dashboard-lean {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}

.dashboard-lean-stats {
  gap: .6rem;
}

.dashboard-lean-main {
  gap: .6rem;
  align-items: start;
}

.dashboard-mini-card .card-header {
  padding: .55rem .72rem;
}

.dashboard-mini-card .card-title {
  font-size: .86rem;
}

.dashboard-mini-body {
  padding: .55rem .72rem;
}

.dashboard-mini-scroll {
  max-height: 165px;
  overflow-y: auto;
}

.dashboard-brief-card .dashboard-mini-body {
  padding: .65rem .8rem;
}

.dashboard-brief-top {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  align-items: center;
}

.dashboard-brief-title {
  font-size: .84rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--gold-dark);
  font-weight: 700;
}

.dashboard-brief-line {
  font-size: .8rem;
  margin-top: .2rem;
}

.dashboard-brief-progress {
  min-width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 3px solid rgba(201,169,110,.35);
  background: #fff8eb;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.dashboard-brief-progress span {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--gold-dark);
  line-height: 1;
}

.dashboard-brief-progress small {
  color: var(--text-muted);
  font-size: .65rem;
}

.dashboard-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .55rem;
}

.dashboard-chip {
  display: inline-flex;
  align-items: center;
  padding: .2rem .45rem;
  border: 1px solid rgba(201,169,110,.28);
  border-radius: 99px;
  font-size: .7rem;
  background: #fff;
}

.dashboard-chip.warn {
  border-color: #f59e0b44;
  background: #fff8e7;
}

.dashboard-chip.danger {
  border-color: #dc262655;
  background: #fff1f1;
}

.phase-now-next {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .7rem;
}

.dashboard-overdue-line {
  display: block;
  text-decoration: none;
  color: #7a271a;
  border: 1px solid #f7c6c1;
  border-radius: 8px;
  background: #fff7f6;
  padding: .42rem .5rem;
  margin-bottom: .45rem;
}

.dashboard-now-line {
  display: block;
  text-decoration: none;
  color: #6b4e16;
  border: 1px solid #f3d28a;
  border-radius: 8px;
  background: #fff9ec;
  padding: .35rem .45rem;
  margin-bottom: .4rem;
}

.dashboard-now-line span {
  display: block;
  margin-top: .1rem;
  font-size: .7rem;
  color: #907134;
}

.dashboard-overdue-line span {
  display: block;
  margin-top: .15rem;
  font-size: .72rem;
  color: #9f3a30;
}

.dashboard-timeline-body {
  padding: .65rem .8rem;
}

.dashboard-timeline-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .45rem;
}

.dashboard-timeline-col {
  border: 1px solid rgba(201,169,110,.2);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.dashboard-timeline-head {
  background: #f9f4ea;
  color: var(--gold-dark);
  font-weight: 700;
  font-size: .76rem;
  padding: .35rem .42rem;
  border-bottom: 1px solid rgba(201,169,110,.2);
}

.dashboard-timeline-list {
  padding: .4rem .42rem;
  max-height: 158px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.dashboard-timeline-item {
  border: 1px solid rgba(201,169,110,.15);
  border-radius: 8px;
  background: #fcfaf4;
  padding: .3rem .4rem;
  font-size: .72rem;
}

.dashboard-mini-phases {
  margin-top: .55rem;
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.dashboard-mini-phase {
  border: 1px solid rgba(201,169,110,.2);
  border-radius: 8px;
  background: #fff;
  padding: .35rem .42rem;
}

.dashboard-mini-phase.active {
  border-color: var(--gold);
  background: #fff8eb;
}

.dashboard-mini-phase.done {
  opacity: .75;
}

.dashboard-mini-phase-row {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  font-size: .74rem;
  margin-bottom: .3rem;
}

.dashboard-mini-phase-row strong {
  color: var(--gold-dark);
}

.dashboard-activity-item {
  padding: .35rem .42rem;
  border: 1px solid rgba(201,169,110,.16);
  border-radius: 8px;
  background: #fcfaf4;
  margin-bottom: .4rem;
  font-size: .74rem;
}

.dashboard-activity-item small {
  display: block;
  color: var(--text-muted);
  margin-top: .1rem;
  font-size: .66rem;
}

.dashboard-kpi-row {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  align-items: center;
  padding: .35rem .42rem;
  border: 1px solid rgba(201,169,110,.18);
  border-radius: 8px;
  margin-bottom: .4rem;
  background: #fffdf8;
  font-size: .8rem;
}

.dashboard-hero {
  margin-bottom: 0 !important;
  padding: 1.1rem 1.3rem;
}

.dashboard-hero .progress-hero-value {
  font-size: 2.1rem;
}

.dashboard-stats {
  margin-bottom: 0 !important;
  gap: .8rem;
}

.dashboard-stats .stat-card {
  padding: .9rem 1rem;
}

.dashboard-stats .stat-value {
  font-size: 1.5rem;
}

.dashboard-columns {
  align-items: start;
}

.dashboard-stack {
  min-width: 0;
}

.dashboard-card {
  overflow: hidden;
}

.dashboard-list-body {
  max-height: 265px;
  overflow-y: auto;
}

.dashboard-phase-body {
  padding-top: .7rem;
}

.phase-stepper-wrap {
  overflow-x: auto;
  padding-bottom: .35rem;
}

.phase-stepper {
  display: flex;
  gap: .5rem;
  min-width: max-content;
}

.phase-step {
  border: 1px solid rgba(201,169,110,.22);
  background: #fff;
  border-radius: 10px;
  min-width: 172px;
  padding: .45rem .55rem;
  display: flex;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  text-align: left;
}

.phase-step.is-active {
  border-color: var(--gold);
  background: #fff8ea;
  box-shadow: 0 3px 14px rgba(201,169,110,.2);
}

.phase-step-index {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.phase-step-text {
  min-width: 0;
}

.phase-step-name {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  line-height: 1.2;
}

.phase-step-meta {
  display: block;
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .15rem;
}

.phase-detail-panels {
  margin-top: .65rem;
}

.phase-detail-panel {
  display: none;
  border: 1px solid rgba(201,169,110,.2);
  border-radius: var(--radius-sm);
  background: #fff;
  padding: .75rem .8rem;
}

.phase-detail-panel.is-active {
  display: block;
}

.phase-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .6rem;
}

.phase-detail-title-row {
  display: flex;
  align-items: center;
  gap: .45rem;
  min-width: 0;
}

.phase-detail-title {
  font-size: .9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.phase-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .5rem;
}

.phase-detail-stat {
  background: #faf7ef;
  border: 1px solid rgba(201,169,110,.18);
  border-radius: 8px;
  padding: .4rem .5rem;
}

.phase-detail-stat span {
  display: block;
  font-size: .68rem;
  color: var(--text-muted);
}

.phase-detail-stat strong {
  font-size: .86rem;
  color: var(--dark);
}

.phase-detail-progress {
  margin-top: .6rem;
}

.phase-detail-dates {
  margin-top: .45rem;
  font-size: .72rem;
  color: var(--text-muted);
}

.nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: #dc2626;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .68rem;
  font-weight: 700;
  padding: 0 .35rem;
}

.notif-wrap {
  position: relative;
}

.notif-btn {
  border: 1px solid rgba(201,169,110,.3);
  background: white;
  color: var(--dark);
  width: 38px;
  height: 38px;
  border-radius: 19px;
  cursor: pointer;
  position: relative;
}

.notif-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  background: #dc2626;
  color: white;
  font-size: .65rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 .25rem;
}

.notif-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(360px, 88vw);
  background: white;
  border: 1px solid rgba(201,169,110,.2);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  display: none;
  z-index: 90;
  max-height: 420px;
  overflow-y: auto;
}

.notif-dropdown.open { display: block; }

.notif-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .7rem .8rem;
  border-bottom: 1px solid rgba(201,169,110,.15);
  font-size: .8rem;
}

.notif-head a {
  color: var(--gold-dark);
  text-decoration: none;
}

.notif-empty {
  padding: 1rem;
  font-size: .82rem;
  color: var(--text-muted);
}

.notif-item {
  display: block;
  text-decoration: none;
  padding: .65rem .8rem;
  border-bottom: 1px solid rgba(201,169,110,.08);
}

.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #fffbf1; }
.notif-item:hover { background: #faf6ed; }

.notif-message {
  color: var(--text-main);
  font-size: .8rem;
  line-height: 1.3;
}

.notif-meta {
  color: var(--text-muted);
  font-size: .7rem;
  margin-top: .15rem;
}

.task-comments-list {
  max-height: 260px;
  overflow-y: auto;
  padding-right: .25rem;
}

.task-comment-item {
  display: flex;
  gap: .6rem;
  margin-bottom: .65rem;
}

.task-comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #fff;
  font-weight: 700;
  font-size: .75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.task-comment-body {
  flex: 1;
  background: #faf8f2;
  border: 1px solid rgba(201,169,110,.2);
  border-radius: var(--radius-sm);
  padding: .5rem .65rem;
}

.task-comment-head {
  display: flex;
  justify-content: space-between;
  gap: .65rem;
  margin-bottom: .15rem;
}

.task-comment-user {
  font-size: .78rem;
  font-weight: 700;
}

.task-comment-date {
  font-size: .7rem;
  color: var(--text-muted);
}

.task-comment-text {
  font-size: .82rem;
  white-space: pre-wrap;
}

.mention-dropdown {
  display: none;
  margin-top: .4rem;
  border: 1px solid rgba(201,169,110,.25);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
}

.mention-dropdown.open { display: block; }

.mention-option {
  width: 100%;
  display: block;
  text-align: left;
  border: 0;
  background: #fff;
  padding: .5rem .65rem;
  font-size: .82rem;
  cursor: pointer;
}

.mention-option:hover {
  background: #f8f2e8;
}

.task-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: .55rem;
}

.task-photo-item {
  display: block;
  text-decoration: none;
  border: 1px solid rgba(201,169,110,.25);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.task-photo-item img {
  width: 100%;
  height: 92px;
  object-fit: cover;
  display: block;
}

.task-photo-item span {
  display: block;
  padding: .35rem .45rem;
  font-size: .68rem;
  color: var(--text-muted);
}

.hb-row-link { cursor: pointer; }

.hb-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.task-upload-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.task-upload-hint {
  color: var(--text-muted);
  font-size: .8rem;
}

.task-history-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  padding-right: .2rem;
}

.task-history-item {
  display: flex;
  gap: .55rem;
}

.task-history-dot {
  width: 8px;
  height: 8px;
  margin-top: .45rem;
  border-radius: 50%;
  background: var(--gold-dark);
  flex-shrink: 0;
}

.task-history-body {
  background: #f9f6ef;
  border: 1px solid rgba(201,169,110,.18);
  border-radius: 8px;
  padding: .35rem .5rem;
  flex: 1;
}

.task-history-text {
  font-size: .78rem;
  color: var(--text-main);
}

.task-history-meta {
  font-size: .67rem;
  color: var(--text-muted);
  margin-top: .1rem;
}

.task-subtasks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .6rem;
}

.task-subtasks-bar {
  flex: 1;
  height: 8px;
  background: rgba(0,0,0,.06);
  border-radius: 999px;
  overflow: hidden;
}

.task-subtasks-bar-fill {
  height: 100%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
}

.task-subtasks-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.task-subtask-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .45rem .55rem;
  border: 1px solid rgba(201,169,110,.2);
  background: #faf8f2;
  border-radius: 10px;
}

.subtask-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(201,169,110,.25);
  background: rgba(255,255,255,.8);
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
  touch-action: none;
  flex-shrink: 0;
}

.subtask-drag-handle:active { cursor: grabbing; }

.hb-dragging { cursor: grabbing; }

.hb-subtask-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: .95;
  transform: rotate(.2deg);
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
  border-radius: 10px;
}

.hb-subtask-placeholder {
  border: 2px dashed rgba(201,169,110,.55);
  border-radius: 10px;
  background: rgba(201,169,110,.08);
}

.plan-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(201,169,110,.25);
  background: rgba(255,255,255,.8);
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.plan-drag-handle:active { cursor: grabbing; }

.hb-plan-ghost {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  opacity: .95;
  transform: rotate(.2deg);
  box-shadow: 0 14px 34px rgba(0,0,0,.18);
  border-radius: 12px;
  padding: .7rem .9rem;
  background: #fff;
  border: 1px solid rgba(201,169,110,.35);
  font-weight: 800;
}

.hb-plan-placeholder td {
  padding: 0 !important;
  border: 0 !important;
}

.hb-plan-placeholder div {
  border: 2px dashed rgba(201,169,110,.55);
  border-radius: 10px;
  background: rgba(201,169,110,.08);
}

.task-subtask-item.done {
  opacity: .8;
}

.task-subtask-toggle { margin: 0; }

.task-subtask-check {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  cursor: pointer;
}

.task-subtask-check input { display: none; }

.task-subtask-check span,
.task-subtask-check.readonly {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.18);
  background: #fff;
  display: inline-block;
  position: relative;
}

.task-subtask-item.done .task-subtask-check span,
.task-subtask-check.readonly.checked {
  background: rgba(16,185,129,.18);
  border-color: rgba(16,185,129,.55);
}

.task-subtask-item.done .task-subtask-check span::after,
.task-subtask-check.readonly.checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 2px;
  width: 5px;
  height: 10px;
  border: solid #065F46;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-subtask-title {
  flex: 1;
  font-size: .86rem;
}

.task-subtask-meta {
  margin-top: .15rem;
  font-size: .75rem;
  color: var(--text-muted);
}

.task-subtask-item.done .task-subtask-title {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-subtask-actions {
  display: flex;
  gap: .25rem;
  align-items: center;
}

.task-subtask-add {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.task-subtask-add input[type="text"] {
  flex: 1;
}

/* ══════════════════════════════════════
   OVERALL PROGRESS HERO
══════════════════════════════════════ */
.progress-hero {
  background: var(--dark);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  color: white;
  position: relative;
  overflow: hidden;
}

.progress-hero::before {
  content: '🏠';
  position: absolute;
  right: 1.5rem; top: 50%;
  transform: translateY(-50%);
  font-size: 5rem;
  opacity: .06;
}

.progress-hero-label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--gold-light);
  margin-bottom: .5rem;
}

.progress-hero-value {
  font-family: 'Playfair Display', serif;
  font-size: 3rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.progress-hero-bar {
  margin-top: 1rem;
  height: 6px;
  background: rgba(255,255,255,.1);
  border-radius: 99px;
  overflow: hidden;
}

.progress-hero-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), #E8D5B0);
  border-radius: 99px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

/* ══════════════════════════════════════
   FLASH MESSAGES
══════════════════════════════════════ */
.flash {
  padding: .9rem 1.25rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1.5rem;
  font-size: .875rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.flash-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.flash-error   { background: #FEE2E2; color: #B91C1C; border: 1px solid #FCA5A5; }
.flash-info    { background: #EFF6FF; color: #1D4ED8; border: 1px solid #BFDBFE; }

/* ══════════════════════════════════════
   MODAL
══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(28,26,20,.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.open { display: flex; }

.modal {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalIn .25s cubic-bezier(.34,1.56,.64,1);
}

@keyframes modalIn {
  from { transform: scale(.94) translateY(8px); opacity: 0; }
  to   { transform: scale(1) translateY(0); opacity: 1; }
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(201,169,110,.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-muted);
  padding: .25rem;
  border-radius: var(--radius-sm);
  transition: color .2s, background .2s;
}

.modal-close:hover { color: var(--dark); background: var(--cream); }

.modal-body { padding: 1.5rem; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(201,169,110,.1);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
}

/* ══════════════════════════════════════
   MOBILE HAMBURGER
══════════════════════════════════════ */
.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: .5rem;
  flex-direction: column;
  gap: 5px;
}

.hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--dark);
  border-radius: 2px;
  transition: all .3s;
}

.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 99;
}

/* ══════════════════════════════════════
   LOGIN PAGE
══════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--dark);
  padding: 1rem;
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 60% at 20% 50%, rgba(201,169,110,.07) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 80% 20%, rgba(138,105,20,.1) 0%, transparent 60%);
}

.login-card {
  background: var(--dark-card);
  border: 1px solid var(--dark-border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem;
}

.login-logo .logo-mark {
  width: 56px; height: 56px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  margin: 0 auto 1rem;
  box-shadow: 0 8px 24px rgba(201,169,110,.3);
}

.login-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cream);
}

.login-logo p {
  font-size: .8rem;
  color: var(--stone);
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-top: .25rem;
}

.login-card label { color: var(--stone); }

.login-card input {
  background: rgba(255,255,255,.04);
  border-color: var(--dark-border);
  color: var(--cream);
}

.login-card input:focus {
  border-color: var(--gold);
  background: rgba(255,255,255,.07);
  box-shadow: 0 0 0 3px rgba(201,169,110,.15);
}

.login-card input::placeholder { color: var(--stone); }

/* ══════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════ */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }

  .main-wrapper { margin-left: 0; }
  .hamburger { display: flex; }

	  .page-header { padding: 0 1rem; }
	  .main-content { padding: 1rem; }

	  /* Mobile: header title should not push actions off-screen */
	  .page-header > div:first-child { min-width: 0; }
	  .page-title {
	    white-space: nowrap;
	    overflow: hidden;
	    text-overflow: ellipsis;
	    max-width: calc(100vw - 170px);
	  }

	  /* Mobile: notifications dropdown should stay within viewport */
	  .notif-dropdown {
	    position: fixed;
	    left: max(.75rem, env(safe-area-inset-left));
	    right: max(.75rem, env(safe-area-inset-right));
	    top: calc(var(--header-h) + .5rem + env(safe-area-inset-top));
	    width: auto;
	    max-height: calc(100vh - var(--header-h) - 1.25rem - env(safe-area-inset-top) - env(safe-area-inset-bottom));
	    z-index: 120;
	    -webkit-overflow-scrolling: touch;
	    overscroll-behavior: contain;
	  }

  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .phase-timeline-item.active { transform: none; }
  .dashboard-list-body { max-height: 220px; }
  .phase-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .phase-step { min-width: 150px; }
  .dashboard-timeline-grid { grid-template-columns: 1fr; }
  .dashboard-mini-scroll { max-height: 146px; }
  .dashboard-timeline-list { max-height: 132px; }
  .dashboard-brief-progress { min-width: 64px; height: 64px; }

  .task-table-card { display: none; }
  .task-mobile-list { display: flex; }
  .task-toolbar-filters { overflow-x: auto; flex-wrap: nowrap; padding-bottom: .25rem; -webkit-overflow-scrolling: touch; }
  .task-toolbar-phase { width: 100%; margin-left: 0; }
  .task-toolbar-phase select { width: 100%; min-width: 0; }
  .task-toolbar-count { width: 100%; }

  .invoice-table-card { display: none; }
  .invoice-mobile-list { display: flex; }

  .dash-hero-top { flex-direction: column; }
  .dash-hero-row { grid-template-columns: 1fr; }
  .dash-hero-metrics { width: 100%; justify-content: space-between; }
  .dash-alert-list { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-panel-mine,
  .dash-panel-timeline,
  .dash-panel-phases,
  .dash-panel-meta,
  .dash-panel-activity { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  .grid-3, .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .stat-value { font-size: 1.6rem; }
  .dashboard-hero { padding: .85rem .95rem; }
  .dashboard-hero .progress-hero-value { font-size: 1.65rem; }
  .dashboard-stats .stat-card { padding: .7rem .8rem; }
  .dashboard-stats .stat-value { font-size: 1.2rem; }
  .dashboard-list-body { max-height: 190px; }
  .phase-step { min-width: 132px; padding: .35rem .45rem; }
  .phase-step-name { font-size: .73rem; }
  .phase-step-meta { font-size: .65rem; }
  .phase-detail-head { flex-direction: column; align-items: flex-start; margin-bottom: .45rem; }
  .phase-detail-grid { gap: .4rem; }
  .overdue-alert { padding: .75rem; }
  .overdue-alert-item { font-size: .73rem; gap: .35rem; padding: .4rem .48rem; }
  .task-item { padding: .5rem .65rem; gap: .55rem; }
  .appt-card { padding: .6rem .65rem; gap: .65rem; }
  .appt-date-box { min-width: 40px; padding: .3rem; }
  .appt-day { font-size: 1.15rem; }
  .appt-title { font-size: .82rem; }
  .dashboard-mini-card .card-header { padding: .55rem .65rem; }
  .dashboard-mini-body, .dashboard-timeline-body { padding: .55rem .65rem; }
  .dashboard-mini-scroll { max-height: 128px; }
  .phase-now-next { grid-template-columns: 1fr; gap: .45rem; }
  .dashboard-overdue-line { padding: .35rem .42rem; }
  .dashboard-timeline-list { max-height: 122px; }
  .dashboard-brief-top { align-items: flex-start; }
  .dashboard-brief-progress { min-width: 58px; height: 58px; }
  .dashboard-brief-progress span { font-size: .95rem; }
  .dashboard-chip { font-size: .66rem; }

  .dash-hero-top { padding: .95rem 1rem .3rem; }
  .dash-kpis { padding: .55rem 1rem 1rem; }
  .dash-ring { width: 86px; height: 86px; }
  .dash-value { font-size: 1.15rem; }
  .dash-kpi { min-width: 140px; }
  .dash-panel-body { padding: .75rem .85rem; }
  .dash-phase-chip { flex: 0 0 84%; }
}

/* ══════════════════════════════════════
   UTILITY
══════════════════════════════════════ */
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--gold-dark); }
.text-sm { font-size: .8rem; }
.font-serif { font-family: 'Playfair Display', serif; }
.divider { border: none; border-top: 1px solid rgba(201,169,110,.12); margin: 1rem 0; }
.gap-1 { gap: .5rem; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.items-center { align-items: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }
.hidden { display: none !important; }
