:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e2e5ea;
  --text: #1f2430;
  --muted: #6b7280;
  --accent: #3454d1;
  --accent-dark: #28409e;
  --accent-soft: #eef1fb;
  --danger: #c0392b;
  --success: #1f8a4c;
  --warning: #93650a;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 2px 8px rgba(16, 24, 40, 0.06);
  font-family: -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.icon { flex-shrink: 0; vertical-align: middle; }

/* --- app shell: sidebar + main content, modeled after a typical ----------
   dashboard/sidebar/header layout (nav on the left, content on the right) */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--accent);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 0.6rem;
  gap: 0.15rem;
  flex: 1;
}

.sidebar-nav a {
  color: var(--text);
  padding: 0.55rem 0.7rem;
  border-radius: 7px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: background-color 0.12s ease, color 0.12s ease;
}

.sidebar-nav a .icon { color: var(--muted); transition: color 0.12s ease; }

.sidebar-nav a:hover { background: var(--bg); text-decoration: none; }
.sidebar-nav a.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.sidebar-nav a.active .icon { color: var(--accent-dark); }

.nav-badge {
  background: var(--danger);
  color: #fff;
  font-size: 0.7rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  margin-left: auto;
}

.nav-badge.nav-badge-warning {
  background: #f59e0b;
  color: #ffffff;
}

.sidebar-footer {
  padding: 0.9rem 1rem;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
}

.sidebar-avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.sidebar-user-name { font-weight: 600; font-size: 0.88rem; }
.sidebar-user .role-badge {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--accent-soft);
  color: var(--accent-dark);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  display: inline-block;
  margin-top: 0.15rem;
}

.main-content {
  flex: 1;
  min-width: 0;
}

.page-header {
  padding: 1.25rem 2rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 1.3rem;
  margin: 0;
}

.timesheet-bubble {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.75rem;
  background: #fff8e6;
  border: 1px solid #f9d98a;
  color: #8f5c00;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.12);
  transition: all 0.15s ease;
}

.timesheet-bubble:hover {
  background: #fef0c7;
  border-color: #f59e0b;
  color: #78350f;
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(245, 158, 11, 0.2);
}

.timesheet-bubble .icon {
  color: #d97706;
}

.timesheet-bubble-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f59e0b;
  position: relative;
  flex-shrink: 0;
}

.timesheet-bubble-pulse::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  background: #f59e0b;
  opacity: 0.6;
  animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.9); opacity: 0; }
  100% { transform: scale(1.9); opacity: 0; }
}

.timesheet-bubble-count {
  background: #f59e0b;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  line-height: 1.2;
}

.page-body {
  max-width: 1100px;
  padding: 1.25rem 2rem 2rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.panel h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0;
  font-size: 1.05rem;
}

.panel h2 .icon { color: var(--accent); }

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.auth-card h1 {
  font-size: 1.25rem;
  margin-top: 0;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.75rem 0 0.25rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="date"],
input[type="time"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
}

textarea { resize: vertical; min-height: 4.5rem; }

/* --- toggle switch ("slider button") ------------------------------------ */

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 1rem 0 0.4rem;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.15s ease;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 3px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease;
}

.toggle-switch input:checked + .toggle-slider { background: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }
.toggle-switch input:focus-visible + .toggle-slider { outline: 2px solid var(--accent); outline-offset: 2px; }

.toggle-row-label {
  display: inline;
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 0.55rem 1rem;
  border-radius: 7px;
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 0.75rem;
  transition: background-color 0.12s ease, box-shadow 0.12s ease, transform 0.05s ease;
}

button:hover, .btn:hover { background: var(--accent-dark); box-shadow: var(--shadow-md); }
button:active, .btn:active { transform: translateY(1px); }

button.secondary, .btn.secondary {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

button.secondary:hover, .btn.secondary:hover { background: var(--bg); color: var(--text); box-shadow: none; }

button.danger { background: var(--danger); }
button.danger:hover { background: #a3281b; }

button.success, .btn.success { background: var(--success); }
button.success:hover, .btn.success:hover { background: #166b3b; }

button:disabled, .btn:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}
button:disabled:hover, .btn:disabled:hover { background: var(--border); box-shadow: none; }

.error-msg {
  background: #fdecea;
  color: var(--danger);
  border: 1px solid #f5c6c2;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.88rem;
  margin: 0.75rem 0;
}

.success-msg {
  background: #eafaf1;
  color: var(--success);
  border: 1px solid #bfe8cd;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.88rem;
  margin: 0.75rem 0;
}

.warning-msg {
  background: #fff6e0;
  color: var(--warning);
  border: 1px solid #f3dd9c;
  padding: 0.6rem 0.75rem;
  border-radius: 6px;
  font-size: 0.88rem;
  margin: 0.75rem 0;
}
.warning-msg a { color: inherit; text-decoration: underline; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.5rem 0.4rem;
  border-bottom: 1px solid var(--border);
}

th { color: var(--muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; }

.pill {
  font-size: 0.72rem;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: #eef1fb;
  color: var(--accent-dark);
}

.pill.inactive { background: #fdecea; color: var(--danger); }

.task-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.task-row.done span.title { text-decoration: line-through; color: var(--muted); }

.task-row form { margin: 0; display: inline; }
.task-row .btn, .task-row button { margin-top: 0; padding: 0.25rem 0.6rem; font-size: 0.8rem; }

.inline-form {
  display: flex;
  gap: 0.5rem;
}

.inline-form input { flex: 1; }

.task-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  transition: box-shadow 0.12s ease;
}

.task-card:hover { box-shadow: var(--shadow-sm); }

.task-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.task-card-head .title { font-weight: 600; }

.task-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 0.3rem;
}

.task-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.task-actions form { margin: 0; }
.task-actions .btn, .task-actions button { margin-top: 0; }

.pill.status-assigned { background: #eef1fb; color: var(--accent-dark); }
.pill.status-in_progress { background: #fff6e0; color: #93650a; }
.pill.status-completed { background: #eafaf1; color: var(--success); }
.pill.status-discontinued { background: #fdecea; color: var(--danger); }

.pill.billing-pending-invoice { background: #eef0f3; color: var(--muted); }
.pill.billing-pending-payment { background: #fff6e0; color: #93650a; }
.pill.billing-partial { background: var(--accent-soft); color: var(--accent-dark); }
.pill.billing-paid { background: #eafaf1; color: var(--success); }

.billing-cell {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.billing-cell form { margin: 0; }

/* A button that needs to sit inline in a table cell alongside a pill,
   rather than the default form-button size meant for standing alone
   under a label — same compact sizing already used for in-row task
   actions (.task-row, .task-actions), just named for reuse here too. */
.btn-compact {
  margin-top: 0 !important;
  padding: 0.25rem 0.6rem !important;
  font-size: 0.78rem !important;
  /* Same height for <a> and <button> capsules, with or without an icon. */
  line-height: 1rem;
  min-height: 1.6rem;
  box-sizing: border-box;
}
.btn-compact .icon { flex-shrink: 0; }

/* --- dashboard stats row ------------------------------------------------ */

.stats-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 0.85rem;
  color: var(--text);
  text-decoration: none;
  transition: box-shadow 0.12s ease, border-color 0.12s ease, transform 0.08s ease;
}

.stat-card:hover, .stat-card:focus-visible {
  text-decoration: none;
  box-shadow: var(--shadow-md);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.stat-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon-assigned { background: #eef0f3; color: #6b7280; }
.stat-icon-progress { background: #fff3d6; color: var(--warning); }
.stat-icon-completed { background: #e6f7e9; color: var(--success); }
.stat-icon-discontinued { background: #fdecea; color: var(--danger); }
.stat-icon-total { background: var(--accent-soft); color: var(--accent-dark); }

.stat-value { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: 0.78rem; margin-top: 0.1rem; }

/* --- dashboard charts --------------------------------------------------- */

.charts-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.charts-row .panel { margin-bottom: 0; }

@media (max-width: 760px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
}

/* --- chart interaction: hit targets, hover/focus lift, tooltip layer --- */

.chart svg, svg[aria-label] { overflow: visible; }

.bar-hit { cursor: pointer; }
.bar-hit:hover .bar-fill,
.bar-hit:focus .bar-fill,
.bar-hit:focus-visible .bar-fill {
  filter: brightness(1.12);
}
.bar-hit:focus-visible rect:first-child {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.bar-hit:focus { outline: none; }

.trend-hit-overlay { cursor: crosshair; }
.trend-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 50%; }
.trend-marker { transition: r 0.08s ease; }
.crosshair { transition: opacity 0.08s ease; pointer-events: none; }

path.pie-hit {
  cursor: pointer;
  transform-box: view-box;
  transform-origin: 140px 95px;
  transform: translate(0, 0) scale(1);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              filter 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
              opacity 0.25s ease;
  outline: none;
}

/* Base hover on the donut chart: all pieces expand outward slightly with a smooth zoom transition */
.chart[data-chart="donut"]:hover path.pie-hit {
  transform: translate(var(--dx), var(--dy)) scale(1.02);
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.08));
}

/* When a specific piece is active (hovered directly, focused, or activated via legend) */
.chart[data-chart="donut"] path.pie-hit.pie-active,
.chart[data-chart="donut"] path.pie-hit:hover,
.chart[data-chart="donut"] path.pie-hit:focus-visible {
  transform: translate(var(--hdx), var(--hdy)) scale(1.08) !important;
  filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.22)) brightness(1.1) !important;
  opacity: 1 !important;
}

/* Dim non-active pieces slightly when one piece is focused to emphasize the zoom effect */
.chart[data-chart="donut"].has-active path.pie-hit:not(.pie-active):not(:hover) {
  opacity: 0.6;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.04)) saturate(0.85);
}

path.pie-hit:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.donut-center-circle,
.donut-center-total,
.donut-center-label {
  pointer-events: none;
  transition: all 0.2s ease;
}

.pie-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin-top: 0.5rem;
}

.pie-legend-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  font-size: 0.8rem;
  transition: background-color 0.1s ease;
}
.pie-legend-item:hover,
.pie-legend-item.pie-legend-active,
.pie-legend-item:focus-visible {
  background: var(--bg);
}
.pie-legend-item:focus { outline: none; }
.pie-legend-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.pie-legend-swatch {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
  flex-shrink: 0;
}

.pie-legend-label { color: var(--muted); }
.pie-legend-value { font-weight: 700; }

.chart-tooltip {
  position: absolute;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--text);
  color: #fff;
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  white-space: nowrap;
}

.chart-tooltip[hidden] {
  display: none !important;
}

.chart-tooltip-key {
  width: 8px;
  height: 2px;
  border-radius: 1px;
  display: inline-block;
}

.chart-tooltip-value { font-weight: 700; }
.chart-tooltip-label { color: #d7d9e0; }

/* --- time records report ------------------------------------------------- */

.time-records-day {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text);
  margin: 1.1rem 0 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid var(--border);
}

.time-records-day:first-of-type { margin-top: 0.25rem; }

/* --- clients ---------------------------------------------------------------- */

/* --- search: client list filter + type-to-search dropdown --------------- */

[hidden] { display: none !important; }

.client-search {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.8rem;
}
.client-search input { flex: 1; margin: 0; }
.client-search .task-meta { white-space: nowrap; }

.combo { position: relative; }
.combo-input { width: 100%; }
.combo-list {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  max-height: 16rem;
  overflow-y: auto;
  margin: 0;
  padding: 0.25rem 0;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: var(--shadow-md);
}
.combo-option {
  padding: 0.45rem 0.7rem;
  cursor: pointer;
  font-size: 0.92rem;
}
.combo-option:hover,
.combo-option.active { background: var(--accent-soft); color: var(--accent-dark); }
.combo-option.selected { font-weight: 600; }
.combo-empty { padding: 0.45rem 0.7rem; color: var(--muted); font-size: 0.88rem; }

.client-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  margin-bottom: 0.6rem;
}

.client-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.client-card-name {
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Row of small outline action buttons. Shared by client cards and the
   Manage Users table so both pages' actions look the same. */
.client-card-actions,
.row-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.client-card-actions form,
.row-actions form { margin: 0; }

.client-card-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pill.client-group {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.pill.client-group-active { background: #eafaf1; color: var(--success); }
.pill.client-group-inactive { background: var(--bg); color: var(--muted); }

/* --- timesheet accordion --------------------------------------------------- */

.timesheet-day {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.6rem;
  overflow: hidden;
}

.timesheet-day > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
  background: var(--bg);
  font-weight: 600;
  font-size: 0.9rem;
  list-style: none;
}
.timesheet-day > summary::-webkit-details-marker { display: none; }
.timesheet-day > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.5rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.timesheet-day[open] > summary::before { transform: rotate(90deg); }

.timesheet-day-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.85rem;
}

.timesheet-day-body { padding: 0.6rem 0.9rem 0.75rem; }

.timesheet-user {
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-top: 0.5rem;
}
.timesheet-user:first-child { margin-top: 0; }

.timesheet-user > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.85rem;
  list-style: none;
}
.timesheet-user > summary::-webkit-details-marker { display: none; }
.timesheet-user > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 0.4rem;
  font-size: 0.75rem;
  color: var(--muted);
  transition: transform 0.15s ease;
}
.timesheet-user[open] > summary::before { transform: rotate(90deg); }

.timesheet-user-summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-weight: 400;
}

.timesheet-sessions {
  width: calc(100% - 1.5rem);
  margin: 0 0.75rem 0.6rem;
  font-size: 0.85rem;
}

/* --- timesheet manual entry polish --------------------------------------- */

.manual-time-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 1rem;
  margin-top: 0.25rem;
}

@media (max-width: 760px) {
  .manual-time-grid {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}

.form-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin: 0.75rem 0 0.25rem;
}

.form-label-row label {
  margin: 0;
}

.time-select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  font-family: inherit;
  background-color: var(--panel, #ffffff);
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.time-select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft, rgba(42, 120, 214, 0.15));
}

.time-select optgroup {
  font-weight: 700;
  color: var(--muted);
  font-size: 0.78rem;
  padding: 0.4rem 0.2rem;
  background: var(--bg);
}

.time-select option {
  font-weight: 400;
  color: var(--text);
  padding: 0.35rem 0.5rem;
  background: #ffffff;
}

.time-duration-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  background: #eef1fb;
  color: var(--accent-dark);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.time-duration-badge.is-invalid {
  background: #fdecea;
  color: var(--danger);
}

.time-presets-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  margin-top: 0.85rem;
  padding: 0.6rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
}

.time-presets-title {
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
}

.time-presets-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.time-preset-pill {
  border: 1px solid var(--border);
  background: var(--panel, #ffffff);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  margin-top: 0;
  box-shadow: none;
  transition: all 0.12s ease;
}

.time-preset-pill:hover {
  background: var(--accent-soft, #eef1fb);
  border-color: var(--accent);
  color: var(--accent-dark);
  box-shadow: none;
  transform: none;
}

.time-preset-pill:active {
  transform: scale(0.97);
}

.time-custom-toggle {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0.2rem 0.4rem;
  margin-left: auto;
  margin-top: 0;
  box-shadow: none;
  transition: color 0.12s ease;
}

.time-custom-toggle:hover {
  color: var(--accent);
  background: none;
  box-shadow: none;
  transform: none;
}

.custom-time-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 0.65rem;
  padding: 0.75rem;
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.time-inline-error {
  color: var(--danger);
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

/* --- notifications -------------------------------------------------------- */

.notif-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.notif-row.unread { font-weight: 600; }
.notif-row.unread::before { content: "●"; color: var(--accent); margin-right: 0.4rem; font-size: 0.6rem; }

/* --- calendar -------------------------------------------------------------- */

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-dow {
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  padding-bottom: 0.3rem;
}

.calendar-cell {
  min-height: 72px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.3rem;
  font-size: 0.78rem;
}

.calendar-cell.empty { border: none; }
.calendar-day-num { color: var(--muted); font-size: 0.72rem; margin-bottom: 0.2rem; }

.calendar-task {
  background: #eef1fb;
  color: var(--accent-dark);
  border-radius: 4px;
  padding: 0.1rem 0.3rem;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-task.status-completed { background: #eafaf1; color: var(--success); }
.calendar-task.status-in_progress { background: #fff6e0; color: #93650a; }

/* --- chat ------------------------------------------------------------------ */

.chat-log {
  max-height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.chat-msg {
  background: var(--bg);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  max-width: 80%;
}

.chat-msg.mine { align-self: flex-end; background: #eef1fb; }

.chat-msg-meta { font-size: 0.72rem; color: var(--muted); margin-bottom: 0.15rem; }
.chat-msg-body { font-size: 0.9rem; word-break: break-word; }

.pill.chat-connected { background: #eafaf1; color: var(--success); }
.pill.chat-disconnected { background: #fdecea; color: var(--danger); }

/* an auto-generated task update (assigned/started/progress/completed),
   rather than something either person typed — centered, no bubble, no
   "mine" offset, so it reads like a system log line in the timeline */
.chat-msg.system {
  align-self: center;
  background: transparent;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
  max-width: 100%;
  padding: 0.2rem 0;
}

/* --- timesheet tabs & time-by-task report -------------------------------- */

.tab-bar {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.1rem;
}

.tab {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.95rem;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); font-weight: 600; }

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
}

.filter-pills a.pill { color: var(--muted); }
.filter-pills a.pill:hover { text-decoration: none; color: var(--text); }
.filter-pills a.pill.pill-active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }

.task-time-title { font-weight: 600; }

.share-bar {
  display: inline-block;
  vertical-align: middle;
  width: 70px;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-right: 0.35rem;
}

.share-bar span { display: block; height: 100%; background: var(--accent); }

/* --- team chat groups ---------------------------------------------------- */

.chat-members {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin: 0.7rem 0;
  color: var(--muted);
}

.chat-archived-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #f3f4f6;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 0.8rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.chat-composer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.chat-composer input[type="text"] { flex: 1; margin: 0; }
.chat-composer button,
.chat-composer .chat-attach { margin: 0; }
.chat-attach { cursor: pointer; display: inline-flex; align-items: center; }

.chat-file {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
  padding: 0.35rem 0.6rem;
  background: var(--panel, #fff);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  max-width: 100%;
  word-break: break-all;
}

.chat-file-size { color: var(--muted); font-size: 0.75rem; }

.conversation-row.archived { opacity: 0.75; }

/* --- private-message inbox --------------------------------------------- */

.conversation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.conversation-row:hover { background: var(--bg); text-decoration: none; }
.conversation-row.unread .conversation-name { font-weight: 700; }

.conversation-name { font-size: 0.92rem; }
.conversation-preview {
  color: var(--muted);
  font-size: 0.82rem;
  margin-top: 0.1rem;
  max-width: 420px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Redesigned Import/Export on Clients page --- */
.client-data-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.15rem 1.4rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.client-data-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.client-data-info {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.client-data-icon {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #eafaf1;
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.client-data-text h3 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
}

.client-data-text p {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.client-data-buttons {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.btn-export-excel {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #1f8a4c;
  color: #ffffff;
  border: 1px solid #1a7741;
  padding: 0.55rem 1.05rem;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  margin: 0;
}

.btn-export-excel:hover {
  background: #186e3c;
  box-shadow: 0 2px 8px rgba(31, 138, 76, 0.3);
  text-decoration: none;
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-import-excel {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: #ffffff;
  color: #1f8a4c;
  border: 1.5px solid #1f8a4c;
  padding: 0.5rem 1rem;
  border-radius: 7px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  margin: 0;
}

.btn-import-excel:hover {
  background: #f0fdf4;
  border-color: #186e3c;
  color: #186e3c;
  box-shadow: 0 2px 6px rgba(31, 138, 76, 0.18);
  transform: translateY(-1px);
}
