:root {
  --bg: #f3eee4;
  --bg-2: #ebe2d3;
  --panel: rgba(255, 252, 246, 0.62);
  --glass-strong: rgba(255, 252, 246, 0.78);
  --glass-soft: rgba(255, 255, 255, 0.34);
  --ink: #1f1914;
  --muted: #685d53;
  --line: #ddcfbc;
  --accent: #166534;
  --accent-2: #b45309;
  --accent-3: #0f766e;
  --shadow: 0 24px 60px rgba(64, 47, 28, 0.1);
  --shadow-soft: 0 14px 30px rgba(64, 47, 28, 0.07);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top right, rgba(180, 83, 9, 0.13), transparent 28%),
    radial-gradient(circle at left bottom, rgba(15, 118, 110, 0.1), transparent 24%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.45), transparent 40%),
    var(--bg);
  color: var(--ink);
  font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
}

a {
  color: var(--accent);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.shell {
  display: grid;
  grid-template-columns: 300px 1fr;
  min-height: 100vh;
}

.shell,
.sidebar,
.content,
.panel,
.hero,
.page-head,
.ongoing-card,
.stat-card,
.panel-head,
.clean-list li,
.form-grid,
.date-grid {
  min-width: 0;
}

.sidebar {
  padding: 24px 20px;
  background:
    linear-gradient(180deg, rgba(255, 253, 250, 0.58), rgba(246, 239, 229, 0.42)),
    rgba(255, 255, 255, 0.22);
  border-left: 1px solid rgba(255, 255, 255, 0.4);
  position: sticky;
  top: 0;
  height: 100vh;
  backdrop-filter: blur(22px) saturate(1.15);
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  position: sticky;
  z-index: 90;
  isolation: isolate;
}

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

.home-shortcut {
  width: 52px;
  height: 52px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  border: 1px solid rgba(22, 101, 52, 0.16);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(233, 245, 237, 0.92));
  box-shadow: var(--shadow-soft);
  color: var(--accent);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.home-shortcut:hover {
  transform: translateY(-1px);
  border-color: rgba(22, 101, 52, 0.32);
  box-shadow: 0 14px 28px rgba(22, 101, 52, 0.12);
}

.brand {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 14px;
  align-items: center;
  color: inherit;
  margin-bottom: 24px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.brand h1 {
  margin: 0 0 6px;
  font-size: 1.65rem;
}

.muted {
  color: var(--muted);
  line-height: 1.9;
  margin: 0;
}

.nav {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.mobile-nav,
.mobile-footer-actions,
.mobile-drawer,
.mobile-menu-button {
  display: none;
}

.mobile-menu-button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav a {
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.2));
  backdrop-filter: blur(14px) saturate(1.08);
  font-weight: 600;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.38);
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.home-shortcut svg,
.nav-link-inner svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.nav-link-inner {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
}

.nav a:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.28));
  border-color: rgba(205, 183, 154, 0.72);
  box-shadow: 0 14px 28px rgba(64, 47, 28, 0.08);
}

.button.nav-cta {
  display: block;
  width: 100%;
  text-align: center;
  border: 0;
  padding: 14px 16px;
  box-shadow: var(--shadow-soft);
  color: white;
}

.button.nav-cta:hover,
.button.nav-cta:focus,
.button.nav-cta:active,
.button.nav-cta:visited {
  color: white;
}

.nav .button.nav-cta .nav-link-inner {
  width: 100%;
  justify-content: flex-start;
}

.nav a.button.nav-cta:hover,
.nav a.button.nav-cta:focus,
.nav a.button.nav-cta:active,
.mobile-nav a.button.nav-cta:hover,
.mobile-nav a.button.nav-cta:focus,
.mobile-nav a.button.nav-cta:active {
  background: linear-gradient(135deg, var(--accent), #15803d);
  border-color: transparent;
}

.badge {
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #c62828;
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1;
}

.sidebar-foot {
  margin-top: auto;
  padding-top: 18px;
}

.small-user {
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.content {
  padding: 28px;
  position: relative;
  z-index: 1;
}

#page-content {
  scroll-margin-top: 12px;
}

.site-ribbon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 12px;
  padding: 10px 16px;
  border: 1px solid rgba(180, 83, 9, 0.22);
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(180, 83, 9, 0.1), rgba(22, 101, 52, 0.08));
  color: #6b4a1e;
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-align: center;
}

.site-ribbon img {
  width: 24px;
  height: 24px;
  object-fit: contain;
  flex: 0 0 auto;
}

.site-ribbon span {
  display: inline-block;
}

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

.login-card {
  width: min(100%, 420px);
  background: var(--panel);
  border: 1px solid rgba(217, 205, 191, 0.8);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-brand {
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  border-radius: 24px;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: grid;
  place-items: center;
  overflow: visible;
}

.login-brand img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* When the on-screen keyboard shrinks the viewport, compact the card so the
   username, password and submit button all stay reachable without hunting. */
@media (max-height: 560px) {
  .login-shell {
    align-items: start;
    padding-top: 12px;
  }

  .login-card {
    padding: 18px;
  }

  .login-brand {
    width: 52px;
    height: 52px;
    margin-bottom: 8px;
  }

  .login-card h1 {
    font-size: 1.25rem;
    margin: 4px 0;
  }

  .login-card .eyebrow,
  .login-card > .muted {
    display: none;
  }

  .login-card .form-grid {
    gap: 10px;
  }
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), rgba(255, 250, 244, 0.2)),
    rgba(255, 252, 246, 0.24);
  border-radius: 18px;
  backdrop-filter: blur(22px) saturate(1.16);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.42);
  position: relative;
  overflow: visible;
  z-index: 35;
}

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

.topbar-start {
  display: flex;
  align-items: center;
}

/* Shared circular icon button (back / logout in the topbar). */
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid rgba(22, 101, 52, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(232, 245, 236, 0.72));
  color: #14532d;
  box-shadow: 0 10px 20px rgba(22, 101, 52, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, transform 140ms ease;
}

.icon-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button:hover {
  border-color: rgba(22, 101, 52, 0.34);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(214, 239, 222, 0.84));
  color: #166534;
}

.icon-button:active {
  transform: scale(0.96);
}

.icon-button-danger {
  border-color: rgba(198, 40, 40, 0.2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(253, 236, 236, 0.75));
  color: #a52121;
  box-shadow: 0 10px 20px rgba(198, 40, 40, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.icon-button-danger:hover {
  border-color: rgba(198, 40, 40, 0.38);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(252, 226, 226, 0.86));
  color: #c62828;
}

.topbar-logout-form {
  display: inline-flex;
  margin: 0;
}

.mobile-header-shell {
  position: relative;
  z-index: 40;
}

.current-user-link {
  color: inherit;
}

.mobile-drawer-foot {
  display: grid;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.36);
}

.mobile-profile-link {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-weight: 700;
  text-align: center;
}

.notif-bell {
  position: relative;
  z-index: 60;
}

.mobile-bell {
  display: none;
}

.notif-bell-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  box-shadow: none;
  color: var(--ink);
}

.notif-bell.is-open .notif-bell-button,
.notif-bell-button:hover {
  border-color: #cdb79a;
  background: white;
}

.notif-bell-badge {
  position: absolute;
  top: -4px;
  left: -4px;
  min-width: 20px;
  height: 20px;
  font-size: 0.72rem;
  padding: 0 5px;
}

.notif-dropdown {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: min(320px, calc(100vw - 24px));
  background: #fffdf9;
  border: 1px solid rgba(221, 207, 188, 0.92);
  border-radius: var(--radius);
  box-shadow: 0 28px 56px rgba(64, 47, 28, 0.2), 0 10px 22px rgba(64, 47, 28, 0.1);
  padding: 14px;
  z-index: 9999;
  transform: translateY(6px);
  opacity: 0;
  transition: opacity 160ms ease, transform 180ms ease;
  overflow: hidden;
}

.notif-bell.is-open .notif-dropdown {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

.notif-dropdown-head {
  font-weight: 800;
  margin-bottom: 10px;
}

.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
}

.notif-list a {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.notif-list a:hover {
  background: white;
  border-color: #cdb79a;
}

.notif-list a span {
  color: var(--muted);
  font-size: 0.88rem;
}

.notif-see-all {
  display: block;
  text-align: center;
  margin-top: 10px;
  padding: 11px 12px;
  border-radius: 14px;
  border: 1px solid rgba(104, 93, 83, 0.18);
  background: rgba(104, 93, 83, 0.08);
  font-weight: 800;
  color: #5b524a;
}

.notif-see-all:hover {
  background: rgba(104, 93, 83, 0.14);
  border-color: rgba(104, 93, 83, 0.28);
}

.notif-empty {
  margin: 0;
}

.hero,
.panel,
.stat-card,
.ongoing-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.44), rgba(255, 250, 244, 0.24)),
    var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.12);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.46);
}

.hero,
.page-head,
.panel,
.ongoing-card {
  padding: 22px;
}

.page-head,
.hero,
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-2);
  font-weight: 800;
}

.hero h2,
.page-head h2,
.panel h3 {
  margin: 0 0 10px;
}

.hero h2,
.page-head h2 {
  font-size: clamp(1.6rem, 2.4vw, 2.3rem);
}

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

.panel-actions {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-project-actions {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.dashboard-expand-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
}

.dashboard-expand-arrow {
  font-size: 0.9rem;
  line-height: 1;
}

.extra-project-list {
  margin-top: 14px;
}

.add-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.add-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.18);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.expandable-panel .expandable-content {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-6px);
  transition: max-height 220ms ease, opacity 180ms ease, transform 180ms ease, margin-top 180ms ease;
}

.expandable-panel.is-expanded .expandable-content {
  max-height: 420px;
  opacity: 1;
  transform: translateY(0);
  margin-top: 16px;
}

.dashboard-projects-panel.is-expanded .expandable-content {
  max-height: 3200px;
}

.button,
button {
  border: 0;
  border-radius: 16px;
  padding: 12px 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(239, 228, 214, 0.46));
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  white-space: normal;
  overflow-wrap: anywhere;
  border: 1px solid rgba(255, 255, 255, 0.36);
  backdrop-filter: blur(16px) saturate(1.08);
}

.button.primary,
button.primary {
  background: linear-gradient(135deg, rgba(22, 101, 52, 0.92), rgba(21, 128, 61, 0.82));
  color: white;
}

.button.ghost,
button.ghost {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.34);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34);
}

.button.danger,
button.danger {
  color: #8a1c1c;
  border-color: rgba(138, 28, 28, 0.22);
}

.button.danger-fill,
button.danger-fill {
  background: linear-gradient(135deg, #b42318, #d92d20);
  color: white;
  border: 0;
}

.button.wide {
  width: 100%;
  text-align: center;
}

.stats-grid,
.two-col,
.ongoing-grid {
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.stats-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-counter-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.dashboard-counter-card {
  position: relative;
  overflow: hidden;
  min-height: 152px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.52), rgba(247, 240, 229, 0.24)),
    rgba(255, 252, 246, 0.38);
  backdrop-filter: blur(22px) saturate(1.14);
}

.dashboard-counter-card::after {
  content: "";
  position: absolute;
  inset: auto -18px -26px auto;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  background: rgba(22, 101, 52, 0.06);
}

.dashboard-counter-card span,
.dashboard-counter-card strong {
  position: relative;
  z-index: 1;
}

.dashboard-counter-card span {
  font-size: 1rem;
  font-weight: 700;
}

.dashboard-counter-card strong {
  font-size: clamp(2.5rem, 4vw, 3.7rem);
  line-height: 1;
  color: #14532d;
  letter-spacing: -0.04em;
}

.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.ongoing-grid {
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  align-items: start;
}

.dashboard-projects-panel {
  position: relative;
  overflow: hidden;
}

.dashboard-projects-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 32%),
    radial-gradient(circle at bottom right, rgba(22, 101, 52, 0.12), transparent 30%);
  pointer-events: none;
}

.project-pulse-board {
  position: relative;
  min-height: 180px;
  padding: 18px 18px 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(22, 101, 52, 0.1);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(243, 250, 244, 0.92)),
    repeating-linear-gradient(
      to top,
      rgba(22, 101, 52, 0.05) 0,
      rgba(22, 101, 52, 0.05) 1px,
      transparent 1px,
      transparent 34px
    );
  overflow: hidden;
}

.project-pulse-grid {
  position: absolute;
  inset: 18px 18px 18px 18px;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  align-items: end;
  gap: 14px;
}

.project-pulse-column {
  position: relative;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(22, 101, 52, 0.06), rgba(22, 101, 52, 0.02));
  overflow: hidden;
}

.project-pulse-fill {
  position: absolute;
  right: 0;
  left: 0;
  bottom: 0;
  border-radius: 999px 999px 16px 16px;
  background: linear-gradient(180deg, #43b581, #1f8f61 58%, #166534);
  box-shadow: 0 10px 20px rgba(22, 101, 52, 0.22);
  transform-origin: bottom;
  animation: pulseRise 900ms ease forwards;
}

.project-pulse-line {
  position: absolute;
  inset: 0 18px 0 18px;
}

.project-pulse-line::before {
  content: "";
  position: absolute;
  right: 5%;
  left: 5%;
  top: 52%;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(180, 83, 9, 0.2), rgba(15, 118, 110, 0.8), rgba(22, 101, 52, 0.88));
  transform: rotate(-7deg);
  box-shadow: 0 0 0 6px rgba(15, 118, 110, 0.05);
}

.project-pulse-node {
  position: absolute;
  width: 14px;
  height: 14px;
  right: auto;
  border-radius: 999px;
  background: #fff;
  border: 3px solid #0f766e;
  box-shadow: 0 6px 12px rgba(15, 118, 110, 0.18);
  opacity: 0;
  animation: pulseNodeIn 650ms ease forwards;
}

.project-pulse-node:nth-child(1) { right: 8%; }
.project-pulse-node:nth-child(2) { right: 24%; }
.project-pulse-node:nth-child(3) { right: 40%; }
.project-pulse-node:nth-child(4) { right: 56%; }
.project-pulse-node:nth-child(5) { right: 72%; }
.project-pulse-node:nth-child(6) { right: 88%; }

.project-track-list {
  position: relative;
  display: grid;
  gap: 14px;
}

.project-track-card {
  position: relative;
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.48), rgba(248, 244, 235, 0.24)),
    rgba(255, 252, 246, 0.34);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px) saturate(1.1);
  opacity: 0;
  transform: translateY(12px);
  animation: cardSlideIn 550ms ease forwards;
}

.project-track-head,
.project-track-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.project-track-title {
  display: inline-block;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--ink);
  margin-bottom: 5px;
}

.project-track-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.project-track-metrics {
  text-align: left;
}

.project-track-metrics strong {
  display: block;
  font-size: 1.55rem;
  line-height: 1;
  color: #0f766e;
}

.project-track-metrics span,
.project-track-footer span {
  color: var(--muted);
  font-size: 0.88rem;
}

.project-track-bar {
  position: relative;
  height: 12px;
  margin: 14px 0 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(22, 101, 52, 0.08), rgba(15, 118, 110, 0.06));
  overflow: hidden;
}

.project-track-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #166534, #1f8f61 45%, #0f766e 100%);
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.22);
  transform-origin: right center;
  animation: fillBarGrow 900ms ease forwards;
}

.settlement-panel {
  margin-top: 22px;
}

.settlement-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.settlement-pill,
.settlement-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 800;
  border: 1px solid transparent;
}

.settlement-pill.neutral {
  background: rgba(31, 25, 20, 0.06);
  color: var(--ink);
  border-color: rgba(31, 25, 20, 0.08);
}

.settlement-badge.settled,
.settlement-pill.settled {
  background: rgba(22, 101, 52, 0.12);
  color: #14532d;
  border-color: rgba(22, 101, 52, 0.16);
}

.settlement-badge.unsettled,
.settlement-pill.unsettled {
  background: rgba(180, 83, 9, 0.12);
  color: #9a3412;
  border-color: rgba(180, 83, 9, 0.18);
}

.buttonless {
  appearance: none;
  cursor: pointer;
  font: inherit;
}

.settlement-toggle-form {
  display: inline-flex;
}

.settlement-toggle-form .settlement-badge {
  background-clip: padding-box;
}

.settlement-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 14px;
  border: 1px solid rgba(180, 83, 9, 0.22);
  background: rgba(255, 250, 240, 0.95);
  color: var(--ink);
}

.settlement-check.is-checked {
  border-color: rgba(22, 101, 52, 0.24);
  background: rgba(240, 253, 244, 0.95);
  color: #14532d;
}

.settlement-check-label {
  font-weight: 700;
  white-space: nowrap;
}

.recent-stint-list {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.recent-stint-card {
  padding: 16px 18px;
  border-radius: 20px;
  border: 1px solid rgba(22, 101, 52, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(248, 244, 235, 0.94));
  box-shadow: var(--shadow-soft);
}

.recent-stint-card.is-settled {
  border-color: rgba(22, 101, 52, 0.18);
}

.recent-stint-card.is-unsettled {
  border-color: rgba(180, 83, 9, 0.16);
}

.recent-stint-head,
.recent-stint-meta,
.report-line-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.recent-stint-head strong {
  font-size: 1rem;
}

.recent-stint-head .muted,
.recent-stint-meta {
  font-size: 0.93rem;
}

.recent-stint-bar {
  height: 10px;
  margin-top: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(31, 25, 20, 0.07);
}

.recent-stint-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #b45309, #d97706 40%, #166534 100%);
}

.report-line {
  display: inline-block;
}

.manager-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
  gap: 18px;
  margin-top: 22px;
}

.worker-settlement-list {
  display: grid;
  gap: 12px;
}

.worker-settlement-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(31, 25, 20, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(247, 240, 229, 0.92));
}

.worker-settlement-card.needs-settlement {
  border-color: rgba(180, 83, 9, 0.18);
}

.worker-settlement-card.is-clear {
  border-color: rgba(22, 101, 52, 0.16);
}

.worker-settlement-head,
.worker-settlement-meta,
.worker-settlement-alert,
.worker-ongoing-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.worker-settlement-head {
  margin-bottom: 10px;
}

.worker-settlement-meta {
  color: var(--muted);
  font-size: 0.92rem;
}

.worker-ongoing-strip {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(15, 118, 110, 0.08);
  color: #115e59;
  font-size: 0.92rem;
}

.worker-settlement-alert {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(180, 83, 9, 0.25);
  color: #9a3412;
}

.worker-settlement-clear {
  margin-top: 12px;
  font-size: 0.92rem;
}

@keyframes fillBarGrow {
  from {
    transform: scaleX(0.1);
    opacity: 0.4;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@keyframes pulseRise {
  from {
    transform: scaleY(0.15);
    opacity: 0.4;
  }
  to {
    transform: scaleY(1);
    opacity: 1;
  }
}

@keyframes pulseNodeIn {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes cardSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card {
  padding: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(250, 243, 231, 0.24)),
    rgba(255, 252, 246, 0.34);
}

.stat-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 8px;
}

.stat-card strong {
  font-size: 2rem;
}

.ongoing-names {
  display: block;
  font-size: 1rem;
  line-height: 1.9;
  white-space: normal;
  word-break: break-word;
}

.ongoing-names.is-empty {
  font-size: 0.95rem;
  opacity: 0.88;
}

.stat-card.accent {
  background: linear-gradient(135deg, #1f6f5f, #2f8a76);
  color: white;
}

.stat-card.accent span {
  color: rgba(255, 255, 255, 0.82);
}

.form-grid,
.date-grid {
  display: grid;
  gap: 14px;
}

.form-grid {
  margin-top: 10px;
}

.form-grid.wide {
  grid-template-columns: 1fr;
}

.form-grid label,
.date-grid {
  width: 100%;
}

.form-section {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(221, 207, 188, 0.88);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0.22)),
    rgba(255, 252, 246, 0.42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.46);
}

.section-head {
  display: grid;
  gap: 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(221, 207, 188, 0.72);
}

.section-head strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 800;
}

.section-head span {
  color: var(--muted);
  font-size: 0.88rem;
}

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

.full-width {
  grid-column: 1 / -1;
}

label span,
.date-grid strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.22)),
    rgba(255, 252, 246, 0.3);
  font: inherit;
  font-size: 16px;
  line-height: 1.5;
  transition: border-color 120ms ease, box-shadow 120ms ease;
  backdrop-filter: blur(18px) saturate(1.12);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.44);
}

input::placeholder,
textarea::placeholder {
  color: #b5aa9d;
  font-size: 0.8rem;
  font-weight: 400;
}

select:required:invalid {
  color: #b5aa9d;
  font-size: 0.84rem;
  font-weight: 400;
}

select option[value=""] {
  color: #b5aa9d;
}

select option:not([value=""]) {
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #b58a55;
  box-shadow: 0 0 0 4px rgba(181, 138, 85, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.48);
}

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

.field-error {
  border-color: #c62828 !important;
  box-shadow: 0 0 0 4px rgba(198, 40, 40, 0.12) !important;
}

.field-error-hint {
  margin: 0;
  color: #c62828;
  font-weight: 700;
  font-size: 0.92rem;
}

.date-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.date-grid.outlined {
  padding: 16px;
  border: 1px dashed rgba(221, 207, 188, 0.92);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.34);
}

.date-grid strong {
  grid-column: 1 / -1;
}

.date-grid.is-disabled {
  opacity: 0.45;
  filter: grayscale(0.15);
}

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

.date-grid.compact {
  grid-template-columns: repeat(3, minmax(118px, 1fr));
  gap: 10px;
}

[data-close-date-picker] select:required:invalid {
  font-size: 0.74rem;
}

[data-close-date-picker] select {
  min-width: 0;
}

.checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.55);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 12px 14px;
}

.checkbox input {
  width: auto;
}

/* Decision archive on the approvals page. */
.history-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 14px;
  margin: 10px 0 6px;
}

.history-filter-calendar {
  min-width: 140px;
}

.history-date-group {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 280px;
  flex: 1 1 280px;
}

.history-date-group strong {
  grid-column: 1 / -1;
}

.history-filter-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.decision-tag {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}

.decision-approved {
  background: rgba(22, 101, 52, 0.12);
  color: #14532d;
}

.decision-rejected {
  background: rgba(198, 40, 40, 0.12);
  color: #a52121;
}

.decision-revision {
  background: rgba(180, 83, 9, 0.14);
  color: #92400e;
}

/* Export controls: the settlement opt-in sits next to its export button. */
.export-form {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0;
}

.checkbox.export-option {
  padding: 8px 12px;
  font-size: 0.9rem;
  white-space: nowrap;
}

.checkbox.prominent {
  min-height: 58px;
  border-style: solid;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0.3)),
    rgba(255, 252, 246, 0.38);
}

.summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-card {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid rgba(221, 207, 188, 0.82);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.38);
}

.summary-card span {
  color: var(--muted);
  font-size: 0.88rem;
}

.summary-card strong {
  color: var(--accent);
  font-size: 1.45rem;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 8px;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.92rem;
}

.clean-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.clean-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.clean-list li > * {
  min-width: 0;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.table-mini-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 0.86rem;
  line-height: 1.2;
  white-space: nowrap;
}

.worker-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

.status-pill.warning {
  background: rgba(217, 119, 6, 0.14);
  color: #9a5a00;
  border: 1px solid rgba(217, 119, 6, 0.24);
}

.flash-list {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid transparent;
}

.flash.success {
  background: rgba(22, 101, 52, 0.09);
  color: #12492a;
  border-color: rgba(22, 101, 52, 0.15);
}

.flash.error {
  background: rgba(183, 60, 60, 0.09);
  color: #7d2323;
  border-color: rgba(183, 60, 60, 0.14);
}

.report-block + .report-block {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

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

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-left: 0;
    border-bottom: 1px solid var(--line);
  }

  .page-head,
  .hero,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  /* The topbar holds only compact icon buttons, so it stays a single row. */
  .topbar {
    flex-direction: row;
    align-items: center;
  }

  .stats-grid,
  .manager-home-grid,
  .two-col,
  .ongoing-grid,
  .form-grid.wide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  html,
  body {
    overflow-x: hidden;
  }

  body {
    font-size: 15px;
  }

  .content,
  .login-shell {
    padding: 14px;
    /* Sit near the top instead of dead-centre so the on-screen keyboard
       can't cover the password field once the username is focused. */
    align-items: start;
    padding-top: 20px;
  }

  .sidebar {
    display: none;
  }

  #page-content {
    scroll-margin-top: 8px;
  }

  .mobile-drawer {
    display: grid;
    gap: 10px;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    z-index: 25;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 250, 244, 0.2)),
      rgba(255, 252, 246, 0.34);
    backdrop-filter: blur(22px) saturate(1.14);
    box-shadow: var(--shadow-soft), inset 0 1px 0 rgba(255, 255, 255, 0.46);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px) scale(0.98);
    transform-origin: top center;
    transition: opacity 180ms ease, transform 220ms ease, visibility 180ms ease;
  }

  .mobile-drawer.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0) scale(1);
  }

  .mobile-drawer a,
  .mobile-drawer .button,
  .mobile-drawer form {
    width: 100%;
  }

  .mobile-drawer a {
    min-height: 50px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    text-align: right;
    line-height: 1.6;
    padding: 12px 10px;
    border: 1px solid rgba(255, 255, 255, 0.34);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.18);
    font-weight: 700;
  }

  .mobile-drawer .nav-link-inner {
    width: 100%;
    justify-content: flex-start;
  }

  .mobile-drawer .nav-cta {
    display: block;
    text-align: right;
  }

  .login-brand {
    width: 84px;
    height: 84px;
    border-radius: 22px;
  }

  .topbar {
    position: sticky;
    top: 10px;
    z-index: 50;
    padding: 10px 12px;
    margin-bottom: 14px;
  }

  body.mobile-menu-open .topbar {
    margin-bottom: 184px;
  }

  .site-ribbon {
    margin-bottom: 10px;
    padding: 9px 12px;
    font-size: 0.74rem;
    letter-spacing: 0.16em;
  }

  .mobile-bell {
    display: block;
  }

  .mobile-menu-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid rgba(22, 101, 52, 0.18);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(232, 245, 236, 0.72));
    color: #14532d;
    box-shadow: 0 10px 20px rgba(22, 101, 52, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  }

  .mobile-menu-button:hover,
  .mobile-menu-button[aria-expanded="true"] {
    border-color: rgba(22, 101, 52, 0.34);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(214, 239, 222, 0.84));
    color: #166534;
  }

  .topbar-start {
    gap: 10px;
  }

  .topbar-actions,
  .hero-actions,
  .panel-actions,
  .row-actions {
    align-items: stretch;
  }

  .topbar-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    width: auto;
  }

  .topbar-actions .button,
  .hero-actions .button,
  .panel-actions .button,
  .row-actions .button,
  .hero-actions a,
  .panel-actions a,
  .row-actions a {
    width: 100%;
    text-align: center;
  }

  .topbar-actions .button {
    width: auto;
    min-width: 96px;
  }

  .home-shortcut {
    display: none;
  }

  .sidebar-tools {
    display: none;
  }

  .site-ribbon {
    margin-bottom: 8px;
    gap: 8px;
  }

  .site-ribbon img {
    width: 20px;
    height: 20px;
  }

  .hero,
  .page-head,
  .panel,
  .ongoing-card,
  .login-card,
  .stat-card {
    padding: 16px;
    border-radius: 18px;
  }

  .panel-head {
    align-items: stretch;
  }

  .page-head h2,
  .hero h2 {
    font-size: 1.35rem;
    line-height: 1.7;
  }

  .panel h3 {
    margin-bottom: 8px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .project-pulse-board {
    min-height: 146px;
    padding: 14px 14px 10px;
  }

  .project-pulse-grid,
  .project-pulse-line {
    inset: 14px;
  }

  .project-track-card {
    padding: 14px;
  }

  .project-track-head,
  .project-track-footer,
  .recent-stint-head,
  .recent-stint-meta,
  .report-line-meta,
  .settlement-summary,
  .worker-settlement-head,
  .worker-settlement-meta,
  .worker-settlement-alert,
  .worker-ongoing-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .project-track-metrics {
    text-align: right;
  }

  .project-track-metrics strong {
    font-size: 1.3rem;
  }

  .stat-card strong {
    font-size: 1.35rem;
    line-height: 1.8;
  }

  .form-grid,
  .form-grid.wide,
  .form-section-grid,
  .summary-grid,
  .status-grid,
  .date-grid,
  .date-grid.compact {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-grid > *,
  .date-grid > * {
    min-width: 0;
  }

  .checkbox {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .clean-list li {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 12px;
  }

  tr {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 10px 12px;
  }

  td {
    display: grid;
    grid-template-columns: minmax(88px, 110px) 1fr;
    gap: 10px;
    align-items: start;
    white-space: normal;
    padding: 8px 0;
    border-bottom: 1px dashed rgba(221, 207, 188, 0.75);
    font-size: 0.95rem;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 700;
    font-size: 0.86rem;
    line-height: 1.8;
  }

  td form,
  td .button,
  td a.button,
  td .settlement-badge {
    width: 100%;
  }

  td,
  td a,
  td span,
  td strong,
  small,
  .muted {
    overflow-wrap: anywhere;
  }
}
