/* Work Tracking - Design Department (JVS Switchgears – teal palette) */
:root {
  --bg: #ffffff;
  --surface: #f0fdfa;
  --surface2: #ccfbf1;
  --border: #99f6e4;
  --text: #0a3d38;
  --text-muted: #0d5c57;
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-soft: rgba(13, 148, 136, 0.15);
  --success: #0d9488;
  --danger: #dc2626;
  --radius: 10px;
  --font: "DM Sans", -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 18px;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.wrapper {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

@media (min-width: 768px) {
  .wrapper {
    padding: 2rem 1.5rem;
  }
}

/* Header */
.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
  .site-header {
    margin-bottom: 2rem;
  }
}

.header-logo {
  margin-bottom: 0.5rem;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #134e4a;
  margin: 0 0 1rem 0;
  letter-spacing: -0.02em;
}

@media (min-width: 768px) {
  .site-title {
    font-size: 1.75rem;
  }
}

.site-logo {
  display: block;
  max-width: 90px;
  height: auto;
}

.header-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

@media (min-width: 768px) {
  h1 {
    font-size: 1.5rem;
  }
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

nav a {
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
}

nav a:hover {
  color: var(--text);
  background: var(--surface2);
}

nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
}

/* Tabs / Sections */
.section {
  display: none;
  animation: fade 0.2s ease;
}

.section.active {
  display: block;
}

@keyframes fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
  color: var(--text);
}

/* Form */
label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.label-bold {
  font-weight: 700;
}

input[type="text"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
}

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

.form-field input:last-child,
.form-field select:last-child {
  margin-bottom: 0;
}

/* Log form: I am | From date (above To date) */
.form-row-log {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.form-row-log .date-range-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-row-log .date-range-group .form-field {
  margin-bottom: 0;
}

.form-row-log .date-range-group .form-field + .form-field {
  margin-top: 1rem;
}

@media (min-width: 640px) {
  .form-row-log {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .form-row-log .form-field:first-child {
    margin-bottom: 0;
  }

  .form-row-log .date-range-group {
    max-width: 220px;
  }
}

/* Generic form row (e.g. admin, other forms) */
.form-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 600px) {
  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Checkboxes for projects */
.project-checkboxes {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

@media (min-width: 480px) {
  .project-checkboxes {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .project-checkboxes {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
}

.project-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
  cursor: pointer;
  padding: 0.4rem 0;
}

.project-checkboxes input {
  width: auto;
  margin: 0;
}

.project-group {
  margin-bottom: 0.75rem;
}

.hours-per-day-section {
  margin-bottom: 1rem;
}
.hours-per-day-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem 0;
}
.hours-per-day-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}
.hours-per-day-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.hours-per-day-row label {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  min-width: 3.5rem;
}
.hours-per-day-row input {
  width: 4rem;
  margin: 0;
  padding: 0.4rem 0.5rem;
}

.projects-section {
  margin-top: 1.5rem;
}

.project-customer-row {
  margin-bottom: 0.75rem;
}

.project-customer-row label {
  margin-bottom: 0.35rem;
}

.project-customer-row select {
  max-width: 280px;
  margin-bottom: 0;
}

.project-checkboxes-wrap {
  margin-top: 0.5rem;
}

.project-checkboxes-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 0.5rem 0;
}

.select-project-label {
  margin: 0 0 0.5rem 0;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-muted);
  display: none;
}

.project-group-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.35rem;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid var(--border);
}
.project-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.5rem;
}
.project-group-grid label {
  margin: 0;
  padding: 0.4rem 0;
}
.project-group-grid input {
  margin: 0;
}

/* Buttons */
button,
.btn {
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: background 0.2s, color 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-apply {
  background: #2dd4bf;
  color: #134e4a;
}
.btn-apply:hover {
  background: var(--accent);
  color: #fff;
}

/* Messages */
.message {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.message.success {
  background: #0f766e;
  color: #fff;
  border: 1px solid #0d5c57;
}

.message.error {
  background: rgba(220, 38, 38, 0.12);
  color: #b91c1c;
  border: 1px solid rgba(220, 38, 38, 0.3);
}

/* Dashboard table */
.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
  align-items: flex-end;
}

.filters label {
  margin-bottom: 0.25rem;
}

.filters select,
.filters input[type="date"] {
  width: 100%;
  min-width: 0;
  margin-bottom: 0;
}

.filters .btn {
  grid-column: 1 / -1;
}

@media (min-width: 640px) {
  .filters {
    grid-template-columns: auto auto auto auto auto;
    flex-wrap: wrap;
  }

  .filters .btn {
    grid-column: auto;
  }

  .filters select {
    min-width: 140px;
  }

  .filters input[type="date"] {
    min-width: 140px;
  }
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.5rem;
  padding: 0 0.5rem;
}

table {
  width: 100%;
  min-width: 320px;
  border-collapse: collapse;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  table {
    font-size: 0.9rem;
  }
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

@media (min-width: 768px) {
  th,
  td {
    padding: 0.75rem;
  }
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

th.col-delete,
td.col-delete {
  width: 2.25rem;
  text-align: center;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

th.col-edit,
td.col-edit {
  width: 4.5rem;
  text-align: center;
  padding-left: 0.35rem;
  padding-right: 0.35rem;
}

.btn-edit {
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  white-space: nowrap;
  background: var(--surface2);
  color: var(--accent);
  border: 1px solid var(--border);
}

.btn-edit:hover {
  background: var(--accent-soft);
  color: var(--accent-hover);
}

.edit-entry-dialog {
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.edit-entry-message {
  margin-bottom: 0.5rem;
}

.edit-entry-message .message {
  margin: 0;
}

.edit-project-group-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 0.5rem;
  margin-bottom: 0.25rem;
}

.edit-project-group-label:first-child {
  margin-top: 0;
}

/* Project Priorities */
.priorities-list {
  list-style: none;
  padding: 0;
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.priorities-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
  cursor: grab;
  background: var(--surface);
}
.priorities-row:last-child {
  border-bottom: none;
}
.priorities-row:active {
  cursor: grabbing;
}
.priorities-row.priorities-dragging {
  opacity: 0.5;
}
.priorities-row.priorities-drag-over {
  background: var(--accent-soft);
  border-top: 2px solid var(--accent);
}
.priorities-drag-handle {
  color: var(--text-muted);
  font-size: 1rem;
  user-select: none;
}
.priorities-customer {
  min-width: 12rem;
  font-weight: 500;
  color: var(--text-muted);
}
.priorities-project {
  flex: 1;
  font-weight: 600;
}
.priorities-empty {
  padding: 1.5rem;
  color: var(--text-muted);
  text-align: center;
  list-style: none;
}

tr:hover td {
  background: rgba(13, 148, 136, 0.06);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.8rem;
  background: var(--surface2);
  color: var(--text-muted);
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}

.admin-link {
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
}

.admin-link:hover {
  color: var(--accent);
}

/* Password modal (dashboard download) */
.password-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.password-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(19, 78, 74, 0.35);
}
.password-modal-dialog {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  min-width: 280px;
  max-width: 100%;
}
.password-modal-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
}
.password-modal-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Workload timeline chart (dashboard) – day grid, multiple projects per day (hours) */
.card-workload {
  margin-bottom: 1.5rem;
}
.workload-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: -0.5rem 0 0.75rem 0;
}
.workload-view-control {
  margin-bottom: 1rem;
}
.workload-view-control label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}
.workload-view-control select {
  max-width: 280px;
  margin-bottom: 0;
}
.workload-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  margin-bottom: 1rem;
}
.workload-chart-wrap {
  padding: 0.5rem 0;
}
.workload-total-hours-box {
  display: block;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(13, 148, 136, 0.12);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  color: var(--text);
}
.workload-total-hours-label {
  color: var(--text-muted);
  font-weight: 500;
}
.workload-total-hours-value {
  font-weight: 700;
  color: var(--accent);
}
.workload-total-hours-share {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.9em;
}
.workload-scroll-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface2);
}
.workload-scroll-inner {
  display: flex;
  flex-shrink: 0;
}
.workload-scroll-inner.workload-rows {
  flex-direction: column;
}
.workload-row {
  display: flex;
  flex-direction: row;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.workload-row:last-child {
  border-bottom: none;
}
.workload-y-axis-sticky {
  flex-shrink: 0;
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface2);
  border-right: 1px solid var(--border);
}
.workload-employee-block-left {
  padding: 0.5rem 0;
}
.workload-employee-block-left .workload-employee-name {
  padding-left: 0.25rem;
}
.workload-y-axis-labels {
  position: relative;
  width: 100%;
  padding-right: 6px;
  box-sizing: border-box;
}
.workload-y-label {
  position: absolute;
  left: 0;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font);
  pointer-events: none;
}
.workload-charts-column {
  flex-shrink: 0;
}
.workload-employee-block {
  padding: 0.5rem 0;
  overflow: visible;
}
.workload-employee-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
  padding: 0 0 0.25rem 0.25rem;
  padding-left: 0.5rem;
  background: var(--surface2);
}
.workload-chart-inner {
  width: 100%;
  overflow: visible;
}
.workload-stack-chart {
  width: 100%;
  height: 240px;
  display: block;
}
.workload-stack-chart .workload-grid-y,
.workload-stack-chart .workload-grid-x {
  stroke: var(--border);
  stroke-dasharray: 3 3;
  stroke-opacity: 0.8;
}
.workload-stack-chart .workload-axis-x {
  font-size: 10px;
  fill: var(--text-muted);
  font-family: var(--font);
}
.workload-stack-chart .workload-today-col {
  pointer-events: none;
}
.workload-stack-chart .workload-stack-bar {
  transition: opacity 0.15s;
}
.workload-stack-chart .workload-stack-bar:hover {
  opacity: 0.9;
}
.workload-stack-chart .workload-cumul-line {
  pointer-events: none;
}
.workload-stack-chart .workload-cumul-dot {
  pointer-events: none;
}
.workload-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}
.workload-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}
.workload-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.workload-legend-cumul .workload-legend-line {
  width: 16px;
  height: 3px;
  background: #0a3d38;
  border-radius: 2px;
}
