.ve-time-tracker {
  display: flex;
  flex: 0 1 auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.ve-time-tracker[hidden],
.ve-time-tracker [hidden],
.ve-time-dialog [hidden],
.ve-time-drawer-trigger[hidden] { display: none !important; }

.ve-time-open, .ve-time-stop {
  min-height: 40px;
  border: 1px solid var(--cd-border, #dce3ec);
  border-radius: 10px;
  padding: 6px 12px;
  background: var(--cd-surface, #fff);
  color: var(--cd-ink-strong, #14233a);
  font: inherit;
  cursor: pointer;
}

.ve-time-open {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 8px;
  min-width: 0;
}

.ve-time-open:focus-visible, .ve-time-stop:focus-visible,
.ve-time-dialog :focus-visible {
  outline: 2px solid var(--brand, #2854bd);
  outline-offset: 2px;
}

.ve-time-stop { flex: none; font-weight: 700; display: inline-flex; align-items: center; gap: 7px; }
.ve-time-stop::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: #a62134;
}
.ve-time-copy { display: grid; min-width: 0; gap: 2px; }
.ve-time-title, .ve-time-case, .ve-time-state { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ve-time-title { font-size: 12px; font-weight: 750; }
.ve-time-state { color: var(--cd-ink-muted, #506078); font-size: 12px; font-weight: 650; }
.ve-time-case { font-size: 12px; font-weight: 650; }
.ve-time-running .ve-time-open {
  display: grid;
  flex: 1 1 auto;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "record elapsed" "case case";
  row-gap: 3px;
  min-height: 0;
  padding-block: 5px;
  border-color: #efc8ce;
  background: #fff7f8;
}
.ve-time-running .ve-time-rec { grid-area: record; justify-self: start; }
.ve-time-running .ve-time-copy { grid-area: case; }
.ve-time-running .ve-time-case { font-size: 13px; font-weight: 750; line-height: 16px; }
.ve-time-running .ve-time-elapsed { grid-area: elapsed; }
.ve-time-running .ve-time-state,
.ve-time-running .ve-time-elapsed { color: #842134; }
.ve-time-rec {
  display: inline-flex;
  flex: none;
  align-items: center;
  gap: 6px;
  border-radius: 6px;
  padding: 2px 6px;
  background: #fce3e7;
  color: #8d1d32;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: .07em;
}
.ve-time-rec-dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #bf2840;
}
.ve-time-rec-dot::after {
  position: absolute;
  inset: -2px;
  border: 1px solid #bf2840;
  border-radius: inherit;
  content: '';
  animation: ve-time-recording-pulse 1.6s linear infinite;
}
@keyframes ve-time-recording-pulse {
  from { opacity: .72; transform: scale(.95); }
  to { opacity: 0; transform: scale(1.7); }
}
@media (prefers-reduced-motion: reduce) {
  .ve-time-rec-dot::after { animation: none; opacity: .55; }
}
.ve-time-review .ve-time-open { border-color: #dfba72; background: #fffaed; }
.ve-time-review .ve-time-state { color: #76500e; }
.ve-time-elapsed { flex: none; font-size: 13px; font-weight: 750; font-variant-numeric: tabular-nums; }
.ve-time-drawer-trigger { margin: 10px 0; }

.ve-time-dialog {
  width: min(530px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  margin: auto;
  overflow: auto;
  border: 1px solid var(--cd-border, #dce3ec);
  border-radius: 16px;
  padding: clamp(18px, 4vw, 26px);
  color: var(--cd-ink-strong, #14233a);
  background: var(--cd-surface, #fff);
  box-shadow: 0 20px 72px #12223e38;
}

.ve-time-dialog::backdrop { background: #12223e76; }
.ve-time-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.ve-time-dialog-head h2 { font-size: 24px; letter-spacing: -.025em; margin: 0; }
.ve-time-dialog p { margin: 10px 0; }
.ve-time-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-block: 18px;
  padding: 14px;
  border: 1px solid #dce4ed;
  border-radius: 12px;
  background: #f5f8fc;
}
.ve-time-caption {
  display: block;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--cd-ink-muted, #506078);
}
.ve-time-summary-clock { padding-inline-start: 12px; border-inline-start: 1px solid #dce4ed; }
.ve-time-dialog .ve-time-summary p { margin: 4px 0 0; }
.ve-time-dialog [data-time-case] { font-weight: 750; overflow-wrap: anywhere; }
.ve-time-dialog [data-time-ref] { font-size: 11px; color: var(--cd-ink-muted, #506078); overflow-wrap: anywhere; }
.ve-time-dialog label:not(.ve-time-billable) { display: grid; gap: 6px; margin: 14px 0 6px; font-weight: 700; }
.ve-time-dialog input:not([type="checkbox"]), .ve-time-dialog textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #bdcada;
  border-radius: 9px;
  padding: 9px 11px;
  background: #fff;
  color: inherit;
  font: inherit;
  font-size: 16px;
}
.ve-time-dialog textarea { display: block; min-height: 82px; resize: vertical; }
.ve-time-hours { position: relative; width: min(100%, 142px); }
.ve-time-dialog .ve-time-hours input[name="hours"] { padding-inline-end: 34px; appearance: textfield; font-variant-numeric: tabular-nums; }
.ve-time-hours input::-webkit-inner-spin-button { appearance: none; }
.ve-time-hours > span {
  position: absolute;
  inset-inline-end: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #506078;
  pointer-events: none;
}
.ve-time-hours-note { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 12px; margin-top: 7px; }
.ve-time-hours-note p { flex: 1 1 200px; color: #506078; font-size: 12px; margin: 0; }
.ve-time-dialog [data-time-message] { color: var(--cd-ink-muted, #506078); }
.ve-time-dialog [data-time-error] { color: #a21d22; }
.ve-time-dialog [data-time-readout] { font-size: clamp(20px, 5vw, 27px); letter-spacing: -.035em; }
.ve-time-billable { display: flex; align-items: center; gap: 8px; width: fit-content; min-height: 36px; margin-top: 8px; font-weight: 650; }
.ve-time-billable input { width: 16px; height: 16px; accent-color: #132942; }
.ve-time-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.ve-time-dialog-actions .btn { min-height: 40px; }
.ve-time-contact { color: var(--cd-ink-muted, #506078); font-size: 13px; font-weight: 650; overflow-wrap: anywhere; }
.ve-time-dialog [data-time-search-status] { color: var(--cd-ink-muted, #506078); font-size: 13px; }
.ve-time-options { display: grid; gap: 6px; max-height: min(28dvh, 240px); overflow: auto; padding: 2px 4px 2px 2px; }
.ve-time-options button {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--cd-border, #dce3ec);
  border-radius: 8px;
  padding: 7px 11px;
  background: var(--cd-surface, #fff);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ve-time-options strong { overflow-wrap: anywhere; line-height: 1.25; }
.ve-time-options small { color: var(--cd-ink-muted, #506078); }
.ve-time-options button[aria-pressed="true"] { border-color: var(--brand, #2854bd); background: #eef3ff; }
.ve-time-announcement { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 1200px) {
  .topbar.ve-caseaid-header:has(.ve-caseaid-time > :not([hidden])) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    gap: 3px 8px;
    height: auto;
    flex-basis: auto;
    min-height: var(--topbar-h);
    padding-block: 5px;
  }
  .ve-caseaid-header .ve-caseaid-actions { grid-area: 1 / 2; }
  .ve-caseaid-header .menu-btn { grid-area: 1 / 1; justify-self: start; }
  .ve-caseaid-header .ve-caseaid-time { grid-area: 2 / 1 / 3 / -1; max-width: 100%; justify-self: start; }
  .ve-time-open, .ve-time-stop, .ve-caseaid-time #quickTime { min-height: 44px; }
}

@media (max-width: 520px) {
  .ve-caseaid-header .ve-caseaid-time { justify-self: stretch; }
  .ve-time-tracker { flex: 1 1 auto; }
  .ve-time-open { width: 100%; justify-content: space-between; }
  .ve-time-stop { padding-inline: 9px; }
}
