:root {
  color-scheme: light;
  --bg: #fff7f7;
  --panel: #ffffff;
  --panel-soft: #fff0f1;
  --ink: #241b1d;
  --muted: #745f63;
  --line: #efd0d4;
  --navy: #9f1022;
  --teal: #d71935;
  --green: #2f8f46;
  --amber: #b87812;
  --red: #c5162e;
  --blue: #9f1022;
  --shadow: 0 14px 34px rgba(159, 16, 34, 0.1);
  --radius: 8px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(180deg, rgba(215, 25, 53, 0.09), transparent 310px),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  border-radius: var(--radius);
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(82px + env(safe-area-inset-bottom));
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(215, 25, 53, 0.09), rgba(255, 255, 255, 0.7)),
    var(--bg);
}

.login-panel {
  display: grid;
  gap: 22px;
  width: min(480px, 100%);
  padding: clamp(20px, 5vw, 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.login-brand {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.login-panel h2 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.45rem, 4vw, 2rem);
  line-height: 1.1;
}

.login-copy,
.login-note {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.login-note {
  font-size: 0.82rem;
}

.eyebrow.dark {
  color: var(--teal);
}

.is-hidden {
  display: none !important;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fdeceb;
  color: var(--red);
  font-size: 0.86rem;
  font-weight: 750;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 14px clamp(16px, 4vw, 36px);
  border-bottom: 1px solid rgba(159, 16, 34, 0.14);
  background: rgba(255, 247, 247, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--navy);
  color: white;
  font-weight: 800;
}

.brand-title {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.05rem, 1.8vw, 1.35rem);
  line-height: 1.1;
}

.brand-subtitle {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.login-language {
  display: flex;
  justify-content: flex-start;
}

.language-select {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.language-select select {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: var(--navy);
  outline: none;
}

.view-switch,
.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.view-switch button,
.segmented button {
  min-height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  white-space: nowrap;
}

.view-switch button.is-active,
.segmented button.is-active {
  background: var(--navy);
  color: white;
}

.ghost-button,
.secondary-button,
.primary-button,
.danger-button,
.icon-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 8px;
  font-weight: 750;
}

.primary-button {
  background: var(--red);
  color: white;
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
  color: var(--navy);
}

.ghost-button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--navy);
}

.danger-button {
  background: #fff0f1;
  color: var(--red);
}

.icon-button {
  width: 40px;
  padding: 0;
  border: 1px solid var(--line);
  background: white;
  color: var(--navy);
}

.main-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 4vw, 36px) 36px;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 16px;
  align-items: stretch;
}

.hero-band > *,
.manager-grid > * {
  min-width: 0;
}

.hero-copy,
.manager-form,
.report-panel,
.filter-panel,
.employee-picker,
.summary-strip,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: clamp(16px, 2.5vw, 24px);
  background: var(--red);
  color: white;
}

.eyebrow {
  margin: 0 0 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.hero-copy h2 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(1.45rem, 2.6vw, 2.2rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 680px;
  margin: 14px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.96rem, 1.5vw, 1.08rem);
}

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

.hero-actions .secondary-button {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.12);
  color: white;
}

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

.metric {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.metric-label {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.metric-value {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 850;
  line-height: 1;
}

.metric-value.good {
  color: var(--green);
}

.metric-value.warn {
  color: var(--amber);
}

.metric-value.bad {
  color: var(--red);
}

.section-head {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 10px;
}

.section-head.compact {
  margin: 16px 0 8px;
}

.section-head.compact h3 {
  font-size: 1rem;
}

.task-group + .task-group {
  margin-top: 18px;
  padding-top: 2px;
  border-top: 1px solid rgba(217, 225, 222, 0.7);
}

.section-head h3 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.manager-grid {
  display: grid;
  grid-template-columns: minmax(290px, 0.95fr) minmax(0, 1.35fr);
  gap: 16px;
  align-items: start;
}

.manager-form,
.report-panel,
.filter-panel,
.employee-picker {
  padding: 16px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

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

.field label {
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(215, 25, 53, 0.15);
}

.inline-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.boss-pin-panel {
  margin-bottom: 16px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.department-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}

.department-tabs::-webkit-scrollbar {
  display: none;
}

.department-tab {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--navy);
  font-weight: 800;
  white-space: nowrap;
}

.department-tab.is-active {
  border-color: transparent;
  background: var(--navy);
  color: white;
}

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

.task-column {
  min-width: 0;
}

.column-title {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 10px;
  color: var(--navy);
  font-size: 0.95rem;
}

.count-pill,
.status-pill,
dept-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 850;
  white-space: nowrap;
}

.count-pill {
  background: var(--panel-soft);
  color: var(--navy);
}

.status-pill.pending {
  background: #fff3d6;
  color: var(--amber);
}

.status-pill.done {
  background: #e9f7ec;
  color: var(--green);
}

.dept-pill {
  background: #e9f0f8;
  color: var(--blue);
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--teal);
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 24px rgba(159, 16, 34, 0.07);
}

.task-card.is-done {
  border-left-color: var(--green);
}

.task-card.is-late {
  border-left-color: var(--red);
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.task-title {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
}

.task-details {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.task-foot {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.82rem;
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-input {
  display: none;
}

.photo-preview {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 8px;
  border-radius: 8px;
  background: var(--panel-soft);
}

.photo-preview img {
  width: 70px;
  height: 70px;
  object-fit: cover;
  border-radius: 7px;
}

.photo-preview p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.employee-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.employee-overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.employee-admin-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: start;
}

.employee-admin-list {
  display: grid;
  gap: 10px;
}

.employee-row {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.employee-row-fields {
  display: grid;
  grid-template-columns: minmax(130px, 1.1fr) minmax(110px, 0.8fr) minmax(100px, 0.65fr);
  gap: 10px;
}

.employee-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.department-row-fields {
  grid-template-columns: minmax(160px, 1fr) minmax(120px, 0.6fr);
}

.row-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.person-tile {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.person-name {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0;
  color: var(--navy);
  font-weight: 850;
}

.person-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.progress {
  overflow: hidden;
  height: 8px;
  border-radius: 999px;
  background: #e3e9e7;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.report-panel {
  display: grid;
  gap: 12px;
}

.report-list {
  display: grid;
  gap: 9px;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.9fr) minmax(0, 1.4fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.report-row strong {
  color: var(--navy);
}

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

.empty-state {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 24px;
  text-align: center;
}

.empty-state h3 {
  margin: 0 0 6px;
  color: var(--navy);
}

.empty-state p {
  margin: 0;
  color: var(--muted);
}

.bottom-nav {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 12;
  display: none;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 6px;
  padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  min-height: 48px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.bottom-nav button.is-active {
  background: var(--navy);
  color: white;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 92px;
  z-index: 30;
  max-width: min(360px, calc(100vw - 28px));
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: white;
  box-shadow: var(--shadow);
  transform: translateY(18px);
  opacity: 0;
  pointer-events: none;
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

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

  .toolbar {
    justify-content: flex-start;
  }

  .hero-band,
  .manager-grid,
  .employee-admin-grid {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .employee-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding-bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: static;
    padding: 14px;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .language-select {
    grid-auto-flow: column;
    justify-content: space-between;
    width: 100%;
  }

  .view-switch {
    width: 100%;
  }

  .view-switch button,
  .segmented button {
    min-width: 0;
    padding: 0 8px;
  }

  .main-layout {
    padding: 14px 12px 28px;
  }

  .hero-copy {
    min-height: 190px;
  }

  .summary-strip,
  .task-columns,
  .employee-picker,
  .employee-overview,
  .employee-row-fields,
  .department-row-fields,
  .inline-fields,
  .filters {
    grid-template-columns: 1fr;
  }

  .manager-form,
  .report-panel,
  .filter-panel,
  .employee-picker {
    padding: 13px;
  }

  .task-card {
    padding: 13px;
  }

  .task-foot {
    display: grid;
    gap: 7px;
  }

  .task-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .employee-row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .task-actions button,
  .task-actions label {
    width: 100%;
  }

  .report-row {
    grid-template-columns: 1fr;
  }

  .desktop-only {
    display: none !important;
  }

  .bottom-nav {
    display: grid;
  }
}

@media print {
  .topbar,
  .bottom-nav,
  .manager-form,
  .filter-panel,
  .department-tabs,
  .hero-band,
  .task-actions {
    display: none !important;
  }

  body {
    background: white;
  }

  .main-layout {
    width: 100%;
    padding: 0;
  }

  .report-panel,
  .summary-strip,
  .report-row {
    box-shadow: none;
  }
}

@media (min-width: 721px) {
  .mobile-only {
    display: none !important;
  }
}
