/* ═══════════════════════════════════════════════════════════
   Bajra Time Logger — Linear-inspired UI
   ═══════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button, input, select, textarea, optgroup { font-family: inherit; }

/* ── Design tokens: dark theme (default) ─────────────────── */
:root,
[data-theme="dark"] {
  --bg:            #0d0f18;
  --surface:       #131620;
  --surface2:      #1a1d2e;
  --surface3:      #222540;
  --border:        #272b44;
  --border-focus:  #5b73f5;
  --accent:        #5b73f5;
  --accent-hover:  #7389f7;
  --accent-dim:    rgba(91,115,245,0.12);
  --accent-dim2:   rgba(91,115,245,0.06);
  --text:          #e4e6f4;
  --text-muted:    #6b7299;
  --text-dim:      #3d4268;
  --success:       #3ecf8e;
  --success-bg:    rgba(62,207,142,0.1);
  --success-border:rgba(62,207,142,0.25);
  --error:         #f76f72;
  --error-bg:      rgba(247,111,114,0.1);
  --error-border:  rgba(247,111,114,0.25);
  --shadow:        0 2px 16px rgba(0,0,0,0.5);
  --shadow-sm:     0 1px 4px rgba(0,0,0,0.3);
  --glass-bg:      rgba(19,22,32,0.72);
  --glass-border:  rgba(91,115,245,0.14);
  --header-bg:     rgba(13,15,24,0.82);
  --sidebar-border:#1e2138;
}

/* ── Design tokens: light theme ──────────────────────────── */
[data-theme="light"] {
  --bg:            #f0f2fa;
  --surface:       #ffffff;
  --surface2:      #f5f6fc;
  --surface3:      #ebedf7;
  --border:        #dde0f0;
  --border-focus:  #5b73f5;
  --accent:        #5b73f5;
  --accent-hover:  #4560e8;
  --accent-dim:    rgba(91,115,245,0.1);
  --accent-dim2:   rgba(91,115,245,0.05);
  --text:          #1a1c2e;
  --text-muted:    #5a6080;
  --text-dim:      #a8adc8;
  --success:       #1aab6d;
  --success-bg:    rgba(26,171,109,0.08);
  --success-border:rgba(26,171,109,0.25);
  --error:         #d94040;
  --error-bg:      rgba(217,64,64,0.08);
  --error-border:  rgba(217,64,64,0.25);
  --shadow:        0 2px 16px rgba(0,0,0,0.08);
  --shadow-sm:     0 1px 4px rgba(0,0,0,0.06);
  --glass-bg:      rgba(255,255,255,0.65);
  --glass-border:  rgba(91,115,245,0.12);
  --header-bg:     rgba(240,242,250,0.82);
  --sidebar-border:#e4e7f5;
}

/* ── Base ────────────────────────────────────────────────── */
html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: background 0.2s, color 0.2s;
}

#app-root {
  display: contents;
}

/* ── App header ──────────────────────────────────────────── */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--glass-bg);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  flex-shrink: 0;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--accent-dim);
  border: 1px solid rgba(91,115,245,0.25);
  border-radius: 8px;
  color: var(--accent);
  flex-shrink: 0;
}

.header-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* ── Theme toggle ────────────────────────────────────────── */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.theme-toggle:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-focus);
}

[data-theme="dark"] .icon-sun  { display: block; }
[data-theme="dark"] .icon-moon { display: none;  }
[data-theme="light"] .icon-sun  { display: none;  }
[data-theme="light"] .icon-moon { display: block; }

/* ── App layout ─────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w, 340px) 6px 1fr 0px 0px;
  flex: 1;
  min-height: 0;
  transition: grid-template-columns 0.26s cubic-bezier(0.4, 0, 0.2, 1);
}

body.monthly-open .app-layout {
  grid-template-columns: var(--sidebar-w, 340px) 6px 1fr 0px 420px;
}

/* ── Resizer drag handle ─────────────────────────────────── */
.resizer {
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 5;
  transition: background 0.15s;
}
.resizer::before {
  content: '';
  position: absolute;
  inset: 0 2px;
  background: var(--sidebar-border);
  transition: background 0.15s;
}
.resizer:hover::before,
.resizer.dragging::before,
.resizer:focus-visible::before {
  background: var(--accent);
}
.resizer:focus-visible {
  outline: none;
}
body.resizing {
  cursor: col-resize;
  user-select: none;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow-y: auto;
  padding: 16px 0 40px;
  background: var(--surface);
}

.context-path {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 16px 10px;
  flex-wrap: wrap;
}

.context-path.empty .ctx-segment {
  color: var(--text-dim);
  background: var(--surface3);
  font-weight: 500;
  max-width: none;
}

.ctx-segment {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.ctx-sep {
  color: var(--text-dim);
  flex-shrink: 0;
}

.sidebar-section {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-bottom: 1px solid var(--sidebar-border);
}

.sidebar-section--tasks {
  flex: 1;
  border-bottom: none;
  padding-bottom: 0;
}

/* ── Fields & labels ─────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  flex: 1;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.req {
  color: var(--accent);
  font-size: 0.9rem;
  line-height: 1;
  text-transform: none;
}

/* ── Inputs ──────────────────────────────────────────────── */
select,
input[type="text"],
input[type="search"],
input[type="number"],
input[type="date"],
textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 0.7rem;
  width: 100%;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(91,115,245,0.15);
  background: var(--surface3);
}

select:disabled,
input:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* custom dropdown arrow — hide on csel-host (replaced by custom trigger) */
.select-wrap { position: relative; }
.select-wrap::after {
  content: '';
  position: absolute;
  right: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-muted);
  pointer-events: none;
}
.select-wrap.csel-host::after { display: none; }
.select-wrap select { padding-right: 2rem; }

/* ── Custom select dropdowns ─────────────────────────────── */
.csel-host { position: relative; }

.csel-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 0.875rem;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  outline: none;
}
.csel-trigger:hover {
  background: var(--surface3);
  border-color: var(--border-focus);
}
.csel-trigger[aria-expanded="true"],
.csel-trigger:focus-visible {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(91,115,245,0.15);
  background: var(--surface3);
}
.csel-trigger:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.csel-trigger.invalid {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 3px rgba(247,111,114,0.12) !important;
}
.csel-text { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel-text.csel-ph { color: var(--text-muted); }
.csel-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.csel-trigger[aria-expanded="true"] .csel-chevron { transform: rotate(180deg); }

.csel-drop {
  position: absolute;
  z-index: 9999;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.32);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 280px;
  overflow-y: auto;
}

textarea {
  resize: vertical;
  min-height: 80px;
  line-height: 1.5;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(0.5);
  cursor: pointer;
}

/* ── Date stepper ────────────────────────────────────────── */
.date-stepper {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface2);
  transition: border-color 0.15s;
}
.date-stepper:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(91,115,245,0.15);
}
.date-stepper input[type="date"] {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  outline: none;
  box-shadow: none;
  padding: 0.5rem 0.3rem;
}
.date-stepper input[type="date"]:focus {
  border-color: transparent;
  box-shadow: none;
  background: transparent;
}
.date-step-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  flex-shrink: 0;
  height: 100%;
  min-height: 34px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  padding: 0;
}
.date-step-btn:hover {
  background: var(--surface3);
  color: var(--accent);
}
.date-step-btn:first-child {
  border-right: 1px solid var(--border);
}
.date-step-btn:last-child {
  border-left: 1px solid var(--border);
}

/* ── Task header row ─────────────────────────────────────── */
.task-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.task-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
}
.toggle-label:hover { color: var(--text); }
.toggle-label input[type="checkbox"] {
  width: 13px;
  height: 13px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ── View toggle (list / table) ──────────────────────────── */
.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface2);
}
.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 24px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.view-btn + .view-btn {
  border-left: 1px solid var(--border);
}
.view-btn:hover {
  color: var(--text);
  background: var(--surface3);
}
.view-btn.active {
  background: var(--accent);
  color: #fff;
}

.task-table-hint {
  padding: 14px 12px;
  color: var(--text-dim);
  font-size: 0.78rem;
  font-style: italic;
  text-align: center;
}

/* ── Task search ─────────────────────────────────────────── */
.task-search-wrap {
  position: relative;
}
.task-search-wrap .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.task-search-wrap input {
  padding-left: 32px;
  border-radius: 7px 7px 0 0;
  border-bottom-color: var(--border);
}
.task-search-wrap input:focus {
  border-bottom-color: var(--border-focus);
  border-radius: 7px 7px 0 0;
}

/* ── Custom task list ────────────────────────────────────── */
.task-list {
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 0 0 7px 7px;
  overflow-y: auto;
  max-height: calc(100vh - 420px);
  min-height: 120px;
  background: var(--surface2);
}

.task-empty {
  padding: 14px 12px;
  color: var(--text-dim);
  font-size: 0.8rem;
  font-style: italic;
  text-align: center;
}

.task-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 9px 11px;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.1s, border-color 0.1s;
  user-select: none;
}
.task-item:hover {
  background: var(--surface3);
}
.task-item.selected {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.task-item.selected .task-name {
  font-weight: 600;
  color: var(--accent);
}
.task-item + .task-item {
  border-top: 1px solid var(--border);
}

.task-row-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-code {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--accent-dim2);
  border: 1px solid rgba(91,115,245,0.2);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}

.task-name {
  flex: 1;
  font-size: 0.84rem;
  line-height: 1.4;
  color: var(--text);
  min-width: 0;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* selection checkmark (hidden until selected) */
.task-check {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.12s, transform 0.12s;
}
.task-item.selected .task-check {
  opacity: 1;
  transform: scale(1);
}

.task-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding-left: 2px;
}

.task-stage {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface3);
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.task-stage:hover, .task-stage:focus-visible {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  outline: none;
}
.task-stage.stage-loading {
  opacity: 0.5;
  pointer-events: none;
}
.task-stage.stage-fixed {
  cursor: default;
  pointer-events: none;
  opacity: 0.7;
}

.task-hrs {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 1px 6px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
  cursor: pointer;
  transition: opacity 0.12s;
}
.task-hrs:hover { opacity: 0.75; }

/* ── Task logs popup ────────────────────────────────── */
.task-logs-popup {
  position: fixed;
  z-index: 2000;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.32);
  overflow: hidden;
  animation: tlp-in 0.14s ease;
}
@keyframes tlp-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tlp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.tlp-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 3px;
  border-radius: 4px;
  display: flex;
  align-items: center;
}
.tlp-close:hover { color: var(--text); background: var(--surface3); }
.tlp-table-wrap {
  overflow-x: auto;
  max-height: 260px;
  overflow-y: auto;
}
.tlp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}
.tlp-table thead th {
  padding: 6px 10px;
  text-align: left;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.tlp-table tbody tr { border-bottom: 1px solid var(--border); }
.tlp-table tbody tr:last-child { border-bottom: none; }
.tlp-table tbody tr:hover { background: var(--surface2); }
.tlp-table td { padding: 7px 10px; color: var(--text); vertical-align: top; }
.tlp-date  { white-space: nowrap; color: var(--text-muted); font-size: 0.74rem; }
.tlp-hours { white-space: nowrap; font-weight: 600; color: var(--accent); }
.tlp-type  { white-space: nowrap; color: var(--text-muted); font-size: 0.74rem; }
.tlp-comment { line-height: 1.4; max-width: 200px; word-break: break-word; white-space: pre-line; }
.tlp-actions { width: 28px; padding: 4px 6px !important; text-align: center; }
.tlp-edit-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 0 auto;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, background 0.12s;
}
.tlp-table tbody tr:hover .tlp-edit-btn { opacity: 1; }
.tlp-edit-btn:hover { color: var(--accent); background: var(--accent-dim); }
.tlp-table tfoot td {
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}
.tlp-total { font-weight: 600; font-size: 0.78rem; color: var(--accent); }
.tlp-loading, .tlp-empty { padding: 14px 16px; font-size: 0.8rem; color: var(--text-muted); text-align: center; }

.task-mine {
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--success);
  flex-shrink: 0;
}

/* highlight invalid task selection */
.task-list.invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(247,111,114,0.12);
}

/* ── Task table (table view) ─────────────────────────────── */
.task-table-card {
  padding-bottom: 6px;
}
.task-table-card.invalid {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(247,111,114,0.12);
}
.task-table-wrap {
  overflow-x: auto;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.task-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.task-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 8px 12px;
  box-shadow: inset 0 -1px 0 var(--border);
  white-space: nowrap;
}
.task-table .col-code { width: 1%; white-space: nowrap; }
.task-table .col-stage { width: 1%; white-space: nowrap; }
.task-table .col-hrs  { width: 1%; white-space: nowrap; text-align: right; }
.task-table .col-mine { width: 1%; white-space: nowrap; }
.task-table tbody tr {
  display: table-row;
  flex-direction: row;
  gap: 0;
  padding: 0;
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: background 0.1s;
}
.task-table tbody tr:hover {
  background: var(--surface3);
}
.task-table tbody tr.selected {
  background: var(--accent-dim);
  border-left-color: var(--accent);
}
.task-table tbody tr.selected .tt-name {
  font-weight: 600;
  color: var(--accent);
}
.task-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.task-table tbody tr:last-child td {
  border-bottom: none;
}
.tt-code {
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  background: var(--accent-dim2);
  border: 1px solid rgba(91,115,245,0.2);
  padding: 1px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.tt-name {
  color: var(--text);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.tt-stage {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface3);
  padding: 1px 7px;
  border-radius: 10px;
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.tt-stage:hover, .tt-stage:focus-visible {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  outline: none;
}
.tt-stage.stage-loading {
  opacity: 0.5;
  pointer-events: none;
}
.tt-stage.stage-fixed {
  cursor: default;
  pointer-events: none;
  opacity: 0.7;
}
.tt-hrs {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 7px;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
.tt-mine {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--success);
  white-space: nowrap;
}
.task-table .task-empty {
  text-align: center;
  color: var(--text-dim);
  font-style: italic;
  padding: 16px;
}

/* ── Main panel ──────────────────────────────────────────── */
.main-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 24px 40px;
  overflow-y: auto;
  background: var(--bg);
}

/* ── Panel card ──────────────────────────────────────────── */
[hidden] {
  display: none !important;
}

.panel-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  box-shadow: 0 4px 24px rgba(0,0,0,0.18);
}

.panel-card-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ── Hours row ───────────────────────────────────────────── */
.hours-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.hours-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.quick-btn {
  flex: 0 0 auto;
  padding: 3px 10px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  line-height: 1.6;
}
.quick-btn:hover {
  background: var(--surface3);
  border-color: var(--accent);
  color: var(--accent);
}
.quick-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ── Submit button ───────────────────────────────────────── */
button[type="submit"] {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--accent);
  border: none;
  border-radius: 10px;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.65rem 1.25rem;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
  width: 100%;
  letter-spacing: 0.01em;
}
button[type="submit"]:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}
button[type="submit"]:active:not(:disabled) {
  transform: translateY(0);
}
button[type="submit"]:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ── Cancel edit button ──────────────────────────────────── */
.cancel-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0.5rem 1rem;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  width: 100%;
  margin-top: -6px;
}
.cancel-edit-btn:hover {
  background: var(--error-bg);
  border-color: var(--error-border);
  color: var(--error);
}

/* Edit mode: accent ring on panel-card */
#logForm.edit-mode .panel-card {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  box-shadow: 0 0 0 3px rgba(91,115,245,0.12), 0 4px 24px rgba(0,0,0,0.18);
}

/* ── Field validation ────────────────────────────────────── */
input.invalid,
select.invalid,
textarea.invalid {
  border-color: var(--error) !important;
  box-shadow: 0 0 0 3px rgba(247,111,114,0.12) !important;
}

/* ── Session log section ─────────────────────────────────── */
.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.session-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}

.session-total {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 9px;
  border-radius: 20px;
}

/* ── Log entry cards ─────────────────────────────────────── */
.log-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 6px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px 10px;
  transition: border-color 0.15s;
}
.log-entry:hover {
  border-color: var(--border-focus);
}

.log-hours {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  grid-row: 1;
}

.log-task {
  color: var(--text);
  font-size: 0.83rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  grid-row: 1;
}

.log-date {
  color: var(--text-muted);
  font-size: 0.73rem;
  white-space: nowrap;
  grid-row: 1;
}

.log-comment {
  grid-column: 2 / -1;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Toast notifications ─────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 70px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 260px;
  max-width: 380px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 0.83rem;
  line-height: 1.4;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toast-in-top 0.22s ease;
}

.toast.success {
  background: linear-gradient(var(--success-bg), var(--success-bg)), var(--surface);
  border: 1px solid var(--success-border);
  color: var(--success);
}

.toast.error {
  background: linear-gradient(var(--error-bg), var(--error-bg)), var(--surface);
  border: 1px solid var(--error-border);
  color: var(--error);
}

.toast-icon {
  flex-shrink: 0;
  margin-top: 1px;
}

.toast-msg { flex: 1; }

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  margin-top: -1px;
  transition: opacity 0.15s;
}
.toast-close:hover { opacity: 1; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)   scale(1);    }
}

@keyframes toast-in-top {
  from { opacity: 0; transform: translateY(-12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0)     scale(1);    }
}

/* ── Scrollbar styling ───────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── Responsive ──────────────────────────────────────────── */

/* Tablet: collapse sidebar to top */
@media (max-width: 860px) {
  body {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }
  .app-layout {
    display: flex;
    flex-direction: column;
    flex: unset;
    min-height: 0;
    height: auto;
  }
  /* hide grid resizers */
  .resizer, .monthly-col-resizer {
    display: none;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--sidebar-border);
    height: auto;
    overflow: visible;
  }
  .task-list {
    max-height: 260px;
  }
  /* Mobile: force list view, hide table + toggle */
  .view-toggle { display: none; }
  #taskList { display: block !important; }
  #taskTableSection, #taskTableHint { display: none !important; }
  .main-panel {
    padding: 16px;
    height: auto;
    overflow: visible;
  }
  /* Monthly panel: bottom sheet on ≤860px */
  .monthly-panel {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100% !important;
    height: 80dvh;
    border-radius: 18px 18px 0 0;
    border-top: 1px solid var(--border);
    box-shadow: 0 -8px 40px rgba(0,0,0,0.35);
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 300;
    overflow-y: auto;
  }
  body.monthly-open .monthly-panel {
    transform: translateY(0);
  }
  /* scrim behind the bottom sheet */
  body.monthly-open::after {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 299;
  }
  /* drag handle at top of sheet */
  .monthly-panel-inner::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 10px auto 0;
  }
  /* AI panel: bottom sheet on mobile */
  .ai-panel {
    position: fixed !important;
    bottom: 0 !important; left: 0 !important; right: 0 !important; top: auto !important;
    width: 100% !important;
    height: 85dvh;
    max-height: 85dvh;
    border-radius: 18px 18px 0 0 !important;
    border: none !important;
    border-top: 1px solid var(--border) !important;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.35) !important;
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 400;
  }
  body.ai-panel-open .ai-panel {
    transform: translateY(0);
  }
  body.ai-panel-open::before {
    content: '';
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 399;
  }
  .ai-panel-header {
    cursor: default;
    padding-top: 24px;
  }
  .ai-panel-header::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* Mobile: further adjustments ≤ 480px */
@media (max-width: 480px) {
  .app-header {
    padding: 0 12px;
  }
  /* Hide "Monthly" text, show icon only */
  .monthly-log-btn span.monthly-label {
    display: none;
  }
  .field-row {
    grid-template-columns: 1fr;
  }
  .hours-quick {
    gap: 4px;
  }
  /* Comment action buttons: icon-only on small screens */
  .comment-btn-group .ai-fill-btn {
    font-size: 0;
    gap: 0;
    width: 30px;
    padding: 0;
    justify-content: center;
  }
  .panel-card {
    padding: 14px 12px;
  }
  .task-list {
    max-height: 200px;
  }
  .monthly-panel {
    height: 88dvh;
  }
}

/* ── Monthly Log button ──────────────────────────────────── */
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.header-target-wrap { position: relative; display: flex; }
.header-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.header-icon-btn:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-focus);
}

.monthly-log-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.monthly-log-btn:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-focus);
}

/* ── Monthly col-resizer (between main and monthly panel) ── */
.monthly-col-resizer {
  overflow: hidden;
  pointer-events: none;
  cursor: default;
}
body.monthly-open .monthly-col-resizer {
  pointer-events: none;
}

/* ── Monthly panel (in-flow column) ─────────────────────── */
.monthly-panel {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  overflow: hidden;
  min-width: 0;
}

/* active state on the toggle button */
.monthly-log-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* ── Panel inner scroll container ────────────────────────── */
.monthly-panel-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  width: 100%;
}

/* ── Panel header ────────────────────────────────────────── */
.monthly-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}

.monthly-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  justify-content: space-between;
}

.monthly-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  min-width: 140px;
  text-align: center;
}

.monthly-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.monthly-nav-btn:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-focus);
}

/* ── Monthly summary stats ───────────────────────────────── */

/* Selected day highlight */
.monthly-summary {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
}

.monthly-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 12px;
  gap: 3px;
  border-right: 1px solid var(--border);
}
.monthly-stat:last-child { border-right: none; }

.monthly-stat-val {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.monthly-stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ── Calendar grid ───────────────────────────────────────── */
.monthly-calendar {
  padding: 16px;
  overflow-y: auto;
}

.monthly-loading,
.monthly-error {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.monthly-error { color: var(--error); }

/* ── Modal body: calendar on top, detail on bottom ──────── */
.monthly-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.monthly-body .monthly-calendar {
  flex: 0 0 var(--monthly-cal-h, 320px);
  height: var(--monthly-cal-h, 320px);
  border-bottom: none;
  overflow: hidden;
}

/* ── Vertical resizer between calendar and detail ──────── */
.monthly-vresizer {
  flex-shrink: 0;
  height: 6px;
  cursor: row-resize;
  background: transparent;
  position: relative;
  z-index: 5;
  transition: background 0.15s;
}
.monthly-vresizer::before {
  content: '';
  position: absolute;
  inset: 2px 0;
  background: var(--sidebar-border);
  transition: background 0.15s;
}
.monthly-vresizer:hover::before,
.monthly-vresizer.dragging::before,
.monthly-vresizer:focus-visible::before {
  background: var(--accent);
}
.monthly-vresizer:focus-visible { outline: none; }
body.resizing-v { cursor: row-resize; user-select: none; }

/* ── Detail panel ────────────────────────────────────────── */
.monthly-detail {
  flex: 1;
  overflow: auto;
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.monthly-detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-dim);
  font-size: 0.8rem;
  padding: 32px 16px;
}

.monthly-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  position: sticky;
  top: 0;
  z-index: 2;
}

.detail-total {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 10px;
  border-radius: 999px;
}

.detail-table-wrap {
  flex: 1;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.detail-table thead tr {
  background: var(--surface3);
}

.detail-table th {
  padding: 7px 10px;
  text-align: left;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface3);
}

.detail-th-hrs  { width: 1%; white-space: nowrap; }
.detail-th-type { width: 1%; white-space: nowrap; }
.detail-th-task { }
.detail-th-edit { width: 1%; white-space: nowrap; }

.detail-tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.detail-tr:last-child { border-bottom: none; }
.detail-tr:hover { background: var(--surface2); }
.detail-tr:hover .detail-edit-btn { opacity: 1; }

.detail-tr td {
  padding: 8px 10px;
  vertical-align: top;
}

.detail-td-hrs  { white-space: nowrap; }
.detail-td-type { white-space: nowrap; }
.detail-td-edit { white-space: nowrap; vertical-align: middle; }

.detail-edit-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.12s, color 0.12s, border-color 0.12s;
  padding: 0;
  margin: 0 auto;
}
.detail-edit-btn:hover {
  background: var(--accent-dim);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
  color: var(--accent);
  opacity: 1;
}

.detail-hours {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.detail-type {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface3);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 10px;
  white-space: nowrap;
}

.detail-task {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text);
  line-height: 1.4;
}

.detail-comment {
  display: block;
  font-size: 0.71rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 3px;
}

/* Selected day highlight */
.monthly-day-cell.selected-day {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.monthly-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.monthly-day-header {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 4px 0 8px;
}

.monthly-day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid transparent;
  background: var(--surface2);
  overflow: hidden;
  cursor: pointer;
  isolation: isolate;
}

.monthly-day-cell.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
}
.monthly-day-cell.weekend {
  background: var(--surface);
}
.monthly-day-cell.today {
  border-color: var(--accent) !important;
  border-width: 2px !important;
}
.monthly-day-cell.today .monthly-day-num {
  color: var(--accent);
  font-weight: 700;
}

/* ── Water fill ────────────────────────────────────────────
   ::before  = the water body (fills from bottom by --fill %)
   ::after   = the wave on top of the water (animated)       */

@keyframes wave-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

@keyframes pour-stream {
  0%   { transform: scaleY(0) translateY(-100%); opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: scaleY(1) translateY(0); opacity: 0; }
}

@keyframes pour-splash {
  0%   { transform: scale(0.3); opacity: 0.8; }
  100% { transform: scale(2.2); opacity: 0; }
}

.monthly-day-cell.has-log {
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  border-width: 1px;
}

/* water body */
.monthly-day-cell.has-log::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  /* clip from the top: 100% - fill = top gap */
  clip-path: inset(calc(100% - var(--fill, 0%)) 0 0 0);
  border-radius: 0 0 7px 7px;
  transition: clip-path 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Pouring state ── */
/* speed up the wave during pour */
.monthly-day-cell.pouring:not(.log-full)::after {
  animation-duration: 0.6s;
}

/* water stream falling from top — uses a box-shadow trick on a tiny element */
.monthly-day-cell.pouring .monthly-day-num::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  width: 3px;
  transform: translateX(-50%);
  height: 100%;
  background: linear-gradient(to bottom,
    color-mix(in srgb, var(--accent) 70%, transparent),
    color-mix(in srgb, var(--accent) 20%, transparent));
  border-radius: 2px;
  animation: pour-stream 0.9s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  z-index: 3;
  pointer-events: none;
}

/* splash ring at the waterline */
.monthly-day-cell.pouring .monthly-day-hours::after {
  content: '';
  position: absolute;
  bottom: calc(var(--fill, 0%) - 2px);
  left: 50%;
  transform: translateX(-50%);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 60%, transparent);
  animation: pour-splash 0.5s 0.3s ease-out forwards;
  z-index: 3;
  pointer-events: none;
}

/* wave stripe — only shown when not full */
.monthly-day-cell.has-log:not(.log-full)::after {
  content: '';
  position: absolute;
  z-index: 1;
  /* Wave is a wide repeating SVG-style sine shape */
  width: 200%;
  height: 12px;
  /* bottom of wave = top of the water fill */
  bottom: calc(var(--fill, 0%) - 6px);
  left: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 12'%3E%3Cpath d='M0 6 Q25 0 50 6 Q75 12 100 6 Q125 0 150 6 Q175 12 200 6 L200 12 L0 12Z' fill='%235b73f5' fill-opacity='0.35'/%3E%3C/svg%3E") repeat-x;
  background-size: 100px 12px;
  animation: wave-scroll 2.2s linear infinite;
  transition: bottom 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* when full, solid top edge instead of wave */
.monthly-day-cell.log-full::before {
  background: color-mix(in srgb, var(--accent) 32%, transparent);
  clip-path: inset(0 0 0 0);
  border-radius: 7px;
}

/* text sits above the fill */
.monthly-day-num,
.monthly-day-hours {
  position: relative;
  z-index: 2;
}

.monthly-day-num {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1;
}

.monthly-day-hours {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* ── AI Assist ───────────────────────────────────────────── */

/* Hide all AI controls when the logged-in user isn't allowed to use AI */
body.ai-off #aiAssistBtn,
body.ai-off #aiFillBtn,
body.ai-off #aiRewriteBtn,
body.ai-off #aiPanel {
  display: none !important;
}

/* Header button */
.ai-assist-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ai-assist-btn:hover {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-focus);
}
.ai-assist-btn.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

/* Panel overlay — hidden for floating window */
.ai-panel-scrim { display: none; }
.ai-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: min(440px, calc(100vw - 48px));
  max-height: calc(100dvh - 90px);
  z-index: 1200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 48px rgba(0,0,0,0.40), 0 2px 8px rgba(0,0,0,0.18);
  overflow: hidden;
}
.ai-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  flex-shrink: 0;
  cursor: grab;
  border-radius: 16px 16px 0 0;
  user-select: none;
}
.ai-panel-header:active { cursor: grabbing; }
body.ai-dragging { cursor: grabbing !important; user-select: none; }
.ai-panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent);
}
.ai-panel-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ai-panel-close:hover { background: var(--hover); color: var(--text); }

/* Panel body */
.ai-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ai-section { display: flex; flex-direction: column; gap: 6px; }

/* PAT input */
.ai-label-sm { font-size: 0.75rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.ai-pat-row { display: flex; gap: 6px; }
.ai-pat-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg, var(--bg));
  color: var(--text);
  font-size: 0.82rem;
  font-family: monospace;
  outline: none;
}
.ai-pat-input:focus { border-color: var(--accent); }
.ai-pat-toggle {
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
}
.ai-pat-toggle:hover { color: var(--text); }
.ai-pat-hint { font-size: 0.72rem; color: var(--text-muted); line-height: 1.4; margin: 0; }
.ai-pat-hint code { font-family: monospace; background: var(--surface2); padding: 1px 4px; border-radius: 3px; }

/* Fetch row */
.ai-fetch-row { display: flex; flex-direction: column; gap: 10px; }
.ai-date-wrap { display: flex; flex-direction: column; gap: 4px; }
.ai-date-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--input-bg, var(--bg));
  color: var(--text);
  font-size: 0.82rem;
  outline: none;
}
.ai-date-input:focus { border-color: var(--accent); }
.ai-fetch-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.ai-fetch-btn:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); }
.ai-fetch-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* Status */
.ai-status {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.4;
}
.ai-status--loading { background: var(--surface2); color: var(--text-muted); }
.ai-status--error   { background: rgba(239,68,68,0.1);  color: #ef4444; }
.ai-status--info    { background: rgba(99,102,241,0.08); color: var(--accent); }

/* Suggestion cards */
.ai-suggestions { display: flex; flex-direction: column; gap: 10px; }
.ai-empty { font-size: 0.82rem; color: var(--text-muted); text-align: center; padding: 12px 0; margin: 0; }

.ai-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.ai-card:has(.ai-card-check:checked) { border-color: var(--accent); }

.ai-card-check-wrap {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
}
.ai-card-check {
  margin-top: 3px;
  accent-color: var(--accent);
  flex-shrink: 0;
  width: 15px;
  height: 15px;
}
.ai-card-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.ai-card-task { font-size: 0.84rem; font-weight: 600; color: var(--text); line-height: 1.3; }
.ai-card-commits { display: flex; flex-wrap: wrap; gap: 4px; }
.ai-commit-ref {
  font-size: 0.7rem;
  background: var(--surface2);
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 10px;
  font-family: monospace;
  line-height: 1.4;
  word-break: break-word;
}
.ai-card-fields { display: flex; gap: 8px; align-items: flex-start; }
.ai-card-field { display: flex; flex-direction: column; gap: 4px; }
.ai-card-field label { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }
.ai-card-field--type { flex: 1; }
.ai-card-field--comment { width: 100%; }
.ai-card-hours { width: 70px; }
.ai-card-logtype { /* global select styles apply */ }
.ai-card-comment { resize: vertical; min-height: 60px; }

/* Log footer */
.ai-log-footer {
  padding-top: 8px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.ai-log-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  justify-content: center;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: 10px;
  background: var(--success);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.15s, transform 0.1s, opacity 0.15s;
}
.ai-log-btn:hover:not(:disabled) { background: var(--success); filter: brightness(1.1); transform: translateY(-1px); }
.ai-log-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* AI fill button next to comment label */
.comment-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.comment-label-row label { margin-bottom: 0; }
.comment-btn-group { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.ai-fill-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.ai-fill-btn:hover {
  background: var(--surface3);
  color: var(--accent);
  border-color: var(--border-focus);
}
.ai-fill-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ai-fill-btn.is-loading {
  opacity: 1;
  color: var(--accent);
  border-color: var(--border-focus);
  cursor: progress;
}
.btn-spinner { animation: btn-spin 0.6s linear infinite; transform-origin: 50% 50%; }
@keyframes btn-spin { to { transform: rotate(360deg); } }

@media (max-width: 480px) {
  .ai-label { display: none; }
}

/* higher fills → slightly stronger text for contrast */
.monthly-day-cell.log-high .monthly-day-num,
.monthly-day-cell.log-full .monthly-day-num,
.monthly-day-cell.log-high .monthly-day-hours,
.monthly-day-cell.log-full .monthly-day-hours {
  color: var(--text);
}

@media (max-width: 480px) {
  .monthly-panel { width: 100% !important; }
  .monthly-day-cell { aspect-ratio: 1; }
  .monthly-day-num  { font-size: 0.7rem; }
  .monthly-day-hours { font-size: 0.6rem; }
}

/* ── PIN overlay ─────────────────────────────────────────── */
.pin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background:
    radial-gradient(900px 500px at 50% -8%, var(--accent-dim), transparent 62%),
    radial-gradient(700px 500px at 50% 108%, var(--accent-dim2), transparent 60%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.25s;
}
.pin-overlay.pin-success {
  opacity: 0;
  pointer-events: none;
}

.pin-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 48px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.25);
  min-width: 320px;
}

.pin-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.pin-prompt {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.pin-inputs {
  display: flex;
  gap: 10px;
}

.pin-digit {
  width: 44px;
  height: 52px;
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-text-security: disc;
}
.pin-digit:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.pin-digit:disabled {
  opacity: 0.5;
}

.pin-error {
  min-height: 1.2em;
  font-size: 0.78rem;
  color: var(--error, #f87171);
  margin: 0;
  text-align: center;
}

/* ── Login form ────────────────────────────────────────────────── */
.login-card {
  width: min(390px, 92vw);
  padding: 38px 38px 32px;
  gap: 0;
  align-items: stretch;
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.55), 0 2px 8px rgba(0,0,0,0.2);
}
.login-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.login-badge {
  align-self: center;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid var(--glass-border);
  box-shadow: 0 0 0 6px var(--accent-dim2);
  margin-bottom: 18px;
}

.login-head {
  text-align: center;
  margin-bottom: 26px;
}
.login-title {
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.login-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.login-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}
.login-field {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  text-align: left;
}
.login-field span {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.login-field input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  color: var(--text);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.login-field input::placeholder { color: var(--text-dim); }
.login-field input:focus {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.login-btn {
  width: 100%;
  height: 48px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent-hover), var(--accent));
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 20px -8px var(--accent);
  transition: transform 0.12s, box-shadow 0.15s, filter 0.15s, opacity 0.15s;
}
.login-btn:hover { filter: brightness(1.06); box-shadow: 0 10px 24px -8px var(--accent); }
.login-btn:active { transform: translateY(1px); }
.login-btn:disabled { opacity: 0.6; cursor: not-allowed; box-shadow: none; transform: none; }
.login-error { margin-top: 12px; }

/* ── Stage change dropdown ─────────────────────────────────────── */
.stage-dropdown {
  position: absolute;
  z-index: 9999;
  min-width: 200px;
  max-width: 280px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  max-height: 320px;
  overflow-y: auto;
}
.stage-dropdown-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  text-align: left;
  padding: 7px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.1s, color 0.1s;
}
.stage-dropdown-item::before {
  content: '';
  display: inline-block;
  width: 10px;
  flex-shrink: 0;
}
.stage-dropdown-item.active::before {
  content: '✓';
  color: var(--accent);
}
.stage-dropdown-item:hover {
  background: var(--surface2);
  color: var(--text);
}
.stage-dropdown-item.active {
  background: var(--accent-dim);
  color: var(--accent);
}

/* ─── Delete log buttons ─────────────────────────────────────────────────── */
.detail-td-edit { white-space: nowrap; vertical-align: middle; }
.detail-del-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  opacity: 0;
  margin: 2px auto 0;
  transition: opacity 0.15s, background 0.12s, color 0.12s, border-color 0.12s;
  padding: 0;
}
.detail-tr:hover .detail-del-btn { opacity: 1; }
.detail-del-btn:hover {
  background: color-mix(in srgb, var(--error) 14%, transparent);
  border-color: color-mix(in srgb, var(--error) 35%, transparent);
  color: var(--error);
  opacity: 1;
}
.tlp-del-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 2px auto 0;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s, background 0.12s;
}
.tlp-table tbody tr:hover .tlp-del-btn { opacity: 1; }
.tlp-del-btn:hover { color: var(--error); background: color-mix(in srgb, var(--error) 14%, transparent); }

/* ─── Confirm toast ──────────────────────────────────────────────────────── */
.toast-confirm-btns {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}
.toast-btn-yes, .toast-btn-no {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.toast-btn-yes {
  background: var(--error);
  border-color: var(--error);
  color: #fff;
}
.toast-btn-yes:hover { filter: brightness(1.08); }
.toast-btn-no {
  background: var(--surface2);
  color: var(--text);
}
.toast-btn-no:hover { background: var(--surface3); border-color: var(--border-focus); }

/* ─── Daily target popover ───────────────────────────────────────────────── */
.daily-target-pop {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 200;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  min-width: 190px;
}
.daily-target-label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.daily-target-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.daily-target-input {
  width: 70px;
  padding: 6px 8px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  text-align: center;
}
.daily-target-input:focus { outline: none; border-color: var(--border-focus); }
.daily-target-unit { font-size: 0.8rem; color: var(--text-muted); }

/* ─── Ctrl+K command palette ─────────────────────────────────────────────── */
.cmd-palette {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 16vh;
}
.cmd-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}
.cmd-card {
  position: relative;
  width: min(580px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: toast-in 0.16s ease;
}
.cmd-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 52px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.cmd-search-icon { color: var(--text-muted); flex-shrink: 0; }
.cmd-input {
  flex: 1;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.95rem;
}
.cmd-input:focus { outline: none; }
.cmd-input::placeholder { color: var(--text-muted); }
.cmd-esc {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
}
.cmd-results {
  max-height: 340px;
  overflow-y: auto;
  padding: 6px;
}
.cmd-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border: none;
  background: none;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
}
.cmd-item:hover, .cmd-item.active { background: var(--accent-dim); }
.cmd-item-code {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--surface2);
  border-radius: 5px;
  padding: 2px 7px;
  flex-shrink: 0;
}
.cmd-item-name {
  font-size: 0.85rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cmd-empty { padding: 18px; text-align: center; font-size: 0.82rem; color: var(--text-muted); }

/* ─── Copy yesterday panel ───────────────────────────────────────────────── */
.copy-yest {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.copy-yest-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(3px);
}
.copy-yest-card {
  position: relative;
  width: min(520px, 94vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  animation: toast-in 0.16s ease;
}
.copy-yest-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.copy-yest-title { font-size: 0.92rem; font-weight: 600; color: var(--text); }
.copy-yest-close {
  display: flex;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
}
.copy-yest-close:hover { background: var(--surface2); color: var(--text); }
.copy-yest-body {
  overflow-y: auto;
  padding: 8px;
  flex: 1;
}
.copy-yest-loading, .copy-yest-empty {
  padding: 24px 16px;
  text-align: center;
  font-size: 0.83rem;
  color: var(--text-muted);
}
.copy-yest-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.copy-yest-item:hover { background: var(--surface2); }
.copy-yest-check { margin-top: 3px; accent-color: var(--accent); cursor: pointer; }
.copy-yest-allcheck { margin-top: 3px; accent-color: var(--accent); cursor: pointer; }
.copy-yest-allrow {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  z-index: 1;
}
.copy-yest-allrow .copy-yest-item-task {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.copy-yest-item-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.copy-yest-item-task { font-size: 0.83rem; font-weight: 600; color: var(--text); }
.copy-yest-item-comment {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}
.copy-yest-item-hrs { font-size: 0.8rem; font-weight: 600; color: var(--accent); flex-shrink: 0; }
.copy-yest-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}
.copy-yest-btn-cancel, .copy-yest-btn-go {
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.copy-yest-btn-cancel { background: var(--surface2); color: var(--text); }
.copy-yest-btn-cancel:hover { background: var(--surface3); border-color: var(--border-focus); }
.copy-yest-btn-go { background: var(--accent); border-color: var(--accent); color: #fff; }
.copy-yest-btn-go:hover:not(:disabled) { filter: brightness(1.08); }
.copy-yest-btn-go:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Templates list items ─────────────────────────────────────────────── */
.tmpl-item { padding: 0; align-items: stretch; gap: 0; }
.tmpl-apply {
  flex: 1;
  display: flex;
  align-items: center;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 9px 10px;
  border-radius: 8px;
  min-width: 0;
}
.tmpl-apply:hover { background: var(--surface2); }
.tmpl-del {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 8px;
}
.tmpl-del:hover { color: var(--error); background: color-mix(in srgb, var(--error) 14%, transparent); }

