:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-subtle: #f9fafb;
  --border: #d9dee7;
  --border-strong: #c3cad6;
  --text: #172033;
  --muted: #687386;
  --quiet: #8a94a6;
  --ink: #0d1321;
  --blue: #2563eb;
  --blue-soft: #eff5ff;
  --green: #0f8a70;
  --green-soft: #eaf8f3;
  --red: #d33b3b;
  --red-soft: #fff0f0;
  --amber: #a86200;
  --shadow: 0 18px 42px rgb(17 24 39 / 8%);
}

html {
  font-size: 16px;
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.app-nav {
  display: none;
}

.footer {
  display: none;
}

.app-shell {
  max-width: none;
  padding: 0;
}

.app-frame {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  min-height: 100vh;
}

.time-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: 100vh;
}

.workspace-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  min-height: 100vh;
  padding: 18px 12px;
  border-right: 1px solid var(--border);
  background: #0f172a;
  color: #fff;
}

.rail-brandmark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 900;
  text-decoration: none;
}

.rail-nav {
  display: grid;
  gap: 10px;
  width: 100%;
}

.rail-nav a {
  display: grid;
  min-height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #bac4d3;
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

.rail-nav a:hover,
.rail-nav a.is-active {
  background: rgb(255 255 255 / 12%);
  color: #fff;
}

.rail-tools {
  display: grid;
  gap: 8px;
  width: 100%;
  margin-top: auto;
}

.rail-tools a,
.rail-tools span {
  display: grid;
  min-height: 32px;
  place-items: center;
  border-radius: 7px;
  background: rgb(255 255 255 / 8%);
  color: #dce4f0;
  font-size: 0.72rem;
  font-weight: 850;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-icon-link svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.auth-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 74%), rgb(244 246 248 / 95%)),
    var(--bg);
}

.auth-panel {
  display: grid;
  width: min(420px, 100%);
  gap: 18px;
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  font-size: 1.85rem;
}

.auth-panel p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.auth-panel form,
.auth-debug-link {
  display: grid;
}

.auth-local-form {
  gap: 14px;
}

.auth-local-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.auth-local-form input {
  width: 100%;
  min-height: 44px;
  box-sizing: border-box;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  padding: 0 12px;
}

.auth-local-form input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 14%);
  outline: none;
}

.auth-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.auth-footer a {
  color: var(--blue);
  text-decoration: none;
}

.auth-footer a:hover {
  text-decoration: underline;
}

.tracker-surface {
  min-width: 0;
  padding: 28px;
}

.tracker-header,
.section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.tracker-header {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--ink);
  font-weight: 850;
  letter-spacing: 0;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.08rem;
}

.section-title p,
.tracker-header p {
  margin: 4px 0 0;
  color: var(--muted);
}

.section-title.compact {
  align-items: start;
}

.header-stats {
  display: grid;
  min-width: 150px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  text-align: right;
}

.header-stats span,
.metrics-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.header-stats strong {
  color: var(--ink);
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.timer-card,
.entries-panel,
.manual-sheet,
.quality-list,
.admin-panel,
.inventory-grid > div,
.report-filters,
.report-grid > div,
.summary-strip {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.timer-card {
  margin-bottom: 16px;
  max-height: 180px;
}

.mobile-timer-action {
  display: none;
}

.quick-start {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  min-height: 132px;
  padding: 20px 24px;
}

.quick-copy {
  display: flex;
  align-items: center;
  gap: 16px;
}

.quick-copy p,
.running-clock-block p {
  margin: 0 0 3px;
  color: var(--muted);
  font-weight: 800;
}

.quick-copy strong {
  color: var(--ink);
  font-size: 1.65rem;
}

.status-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
}

.status-dot.idle {
  background: var(--quiet);
}

.status-dot.running {
  background: var(--green);
  box-shadow: 0 0 0 7px var(--green-soft);
}

.start-button,
.stop-button,
.primary-button,
.secondary-button,
.ghost-button,
.link-button,
.danger-link,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 850;
}

.start-button {
  display: grid;
  width: 132px;
  height: 132px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 22px 40px rgb(15 138 112 / 24%);
}

.start-button:hover {
  background: #0c735e;
}

.stop-button {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
}

.primary-button,
.secondary-button,
.ghost-button,
.link-button {
  padding: 0 16px;
}

.primary-button {
  background: var(--ink);
  color: #fff;
}

.primary-button.small {
  min-height: 36px;
}

.secondary-button {
  border-color: var(--border-strong);
  background: #fff;
  color: var(--ink);
}

.ghost-button,
.link-button {
  border-color: var(--border);
  background: var(--panel-subtle);
  color: var(--text);
}

.link-button {
  color: var(--blue);
}

.danger-link {
  padding: 0 12px;
  background: var(--red-soft);
  color: var(--red);
}

.icon-button {
  display: grid;
  width: 42px;
  min-width: 42px;
  padding: 0;
  place-items: center;
  border-color: var(--border);
  background: var(--ink);
  color: #fff;
  font-size: 1.2rem;
  line-height: 1;
}

.recent-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 0 28px 24px;
}

.recent-strip > span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.recent-strip button {
  min-height: 34px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--text);
  font-weight: 750;
}

.running-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) 108px;
  gap: 16px;
  align-items: start;
  padding: 16px;
}

.running-clock-block {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 8px;
  background: var(--green-soft);
}

.timer-clock {
  color: var(--ink);
  font-size: 2.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 900;
  line-height: 1;
}

.running-clock-block small {
  color: var(--muted);
  font-weight: 700;
}

.running-details,
.edit-grid {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(170px, 1fr) 112px 112px;
  gap: 12px;
  align-items: end;
}

.compact-time-editor {
  grid-template-columns: minmax(240px, 1.4fr) minmax(160px, 0.8fr) minmax(160px, 0.8fr) 150px 94px 150px 94px 112px 46px;
  gap: 10px;
}

.compact-time-editor .span-2 {
  grid-column: span 1;
}

.running-details label,
.edit-grid label,
.stack-form label,
.report-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.full-width {
  grid-column: 1 / -1;
}

.focus-input {
  min-height: 48px;
  font-size: 1.05rem;
}

.stop-form {
  display: flex;
  justify-content: flex-end;
}

.metrics-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metrics-row > div {
  display: grid;
  gap: 5px;
  min-height: 84px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.metrics-row strong {
  color: var(--ink);
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
}

.tracker-tabs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 16px;
}

.segmented-control {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.segmented-control button {
  min-height: 36px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segmented-control button.is-active {
  background: var(--blue-soft);
  color: var(--blue);
}

.entries-panel {
  padding: 18px;
  box-shadow: none;
}

.entry-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.entry-item {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.entry-item.is-invoiced {
  border-color: #d8b4fe;
  background: #faf5ff;
}

.entry-item[hidden] {
  display: none;
}

.entry-item summary {
  display: grid;
  grid-template-columns: 18px minmax(220px, 1fr) minmax(90px, 170px) 118px 96px 100px;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  cursor: pointer;
  list-style: none;
}

.entry-main {
  display: grid;
  min-width: 0;
}

.entry-main strong,
.entry-main small,
.entry-tags {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-main small,
.entry-time {
  color: var(--muted);
}

.entry-tags {
  display: flex;
  gap: 5px;
}

.entry-tags em,
.tag-check {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-subtle);
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
}

.entry-duration,
.entry-amount {
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  text-align: right;
}

.project-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 7px;
  border-radius: 50%;
  vertical-align: middle;
}

.entry-editor {
  display: grid;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel-subtle);
}

.editor-actions,
.entry-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.entry-actions {
  justify-content: flex-end;
}

.right-drawer {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 28px 24px 28px 0;
}

.manual-sheet,
.quality-list {
  padding: 18px;
  box-shadow: none;
}

.manual-sheet {
  position: sticky;
  top: 24px;
}

.stack-form {
  display: grid;
  gap: 11px;
  margin-top: 14px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag-picker {
  position: relative;
  display: inline-flex;
  align-self: end;
  width: max-content;
}

.tag-picker-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 38px;
  min-height: 38px;
  padding: 0 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--blue);
  font-weight: 850;
}

.tag-picker:focus-within .tag-picker-trigger,
.tag-picker.is-open .tag-picker-trigger {
  background: var(--blue-soft);
}

.tag-picker > .tag-row,
.tag-picker > .tag-create-row {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 8;
  display: none;
  width: min(320px, calc(100vw - 48px));
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.tag-picker > .tag-create-row {
  top: calc(100% + 58px);
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.tag-picker:focus-within > .tag-row,
.tag-picker:focus-within > .tag-create-row,
.tag-picker.is-open > .tag-row,
.tag-picker.is-open > .tag-create-row {
  display: flex;
}

.entry-item:has(.tag-picker.is-open),
.entry-item:has(.tag-picker:focus-within) {
  overflow: visible;
  position: relative;
  z-index: 20;
}

.tag-create-row {
  display: grid;
  grid-template-columns: minmax(140px, 260px) auto;
  gap: 8px;
  align-items: center;
}

.manual-inline {
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-subtle);
}

.manual-inline-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.manual-inline-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.tag-check {
  gap: 6px;
  min-height: 32px;
  cursor: pointer;
}

.tag-check input[type="checkbox"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.tag-check:has(input[type="checkbox"]:checked) {
  border-color: #b8e2d5;
  background: var(--green-soft);
  color: var(--green) !important;
}

.check-switch {
  display: inline-flex !important;
  align-items: center;
  justify-content: start;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text) !important;
}

.empty-state,
.done-state,
.attention-row {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px dashed var(--border-strong);
  border-radius: 8px;
  background: var(--panel-subtle);
}

.empty-state {
  margin-top: 14px;
}

.attention-row {
  margin-top: 10px;
  border-style: solid;
  background: #fff9ed;
}

.attention-row span {
  color: var(--amber);
  font-size: 0.86rem;
  font-weight: 750;
}

.done-state {
  margin-top: 12px;
  color: var(--green);
  font-weight: 800;
}

.form-control,
.form-select {
  min-height: 38px;
  border-color: var(--border);
  border-radius: 8px;
}

.date-input {
  width: 150px;
  max-width: 150px;
}

.time-input,
.hours-input {
  width: 94px;
  max-width: 94px;
}

.quantity-input,
.unit-input,
.price-input {
  width: 110px;
  max-width: 110px;
}

.short-input {
  max-width: 150px;
}

.select-input {
  max-width: 260px;
}

.text-input-wide {
  max-width: 520px;
}

.form-control:focus,
.form-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 0.18rem rgb(37 99 235 / 14%);
}

.btn {
  border-radius: 8px;
  font-weight: 800;
}

.autosave-state {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

/* Existing secondary pages */
.settings-page {
  padding: 0 0 28px;
}

.settings-tab[hidden] {
  display: none;
}

.settings-tab {
  margin: 0 28px;
}

.inventory-panel {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.inline-create {
  position: relative;
}

.inline-create summary {
  display: grid;
  min-height: 42px;
  padding: 0 16px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
  list-style: none;
}

.inline-create summary::-webkit-details-marker {
  display: none;
}

.inline-create-form {
  position: absolute;
  right: 0;
  z-index: 5;
  display: grid;
  width: min(560px, calc(100vw - 130px));
  gap: 10px;
  margin-top: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 24px 28px 16px;
}

.admin-grid,
.inventory-grid,
.report-grid {
  display: grid;
  gap: 16px;
  margin: 0 28px 22px;
}

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

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

.inventory-grid > div:last-child {
  grid-column: 1 / -1;
}

.admin-panel,
.inventory-grid > div,
.report-grid > div {
  padding: 18px;
}

.report-filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
  margin: 0 28px 16px;
  padding: 16px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 28px 16px;
}

.summary-strip > div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  border-right: 1px solid var(--border);
}

.summary-strip > div:last-child {
  border-right: 0;
}

.report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 110px;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.report-row strong {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.app-table {
  margin: 0;
  vertical-align: middle;
}

.app-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.billing-page {
  padding: 28px;
}

.compact-hero {
  margin-bottom: 14px;
}

.compact-hero h1 {
  font-size: 1.65rem;
}

.compact-filters {
  grid-template-columns: 150px 150px minmax(180px, 260px) minmax(180px, 260px) auto;
  padding: 12px;
}

.compact-summary > div {
  padding: 12px 16px;
}

.report-table {
  display: grid;
  gap: 6px;
  margin: 0 28px;
}

.report-table-head,
.report-record {
  display: grid;
  grid-template-columns: 150px minmax(220px, 1fr) minmax(160px, 230px) 130px 120px 190px;
  gap: 12px;
  align-items: center;
}

.report-table-head {
  padding: 0 12px 6px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.report-record {
  min-height: 58px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.report-record.is-locked {
  background: var(--panel-subtle);
}

.report-record-time,
.report-record-title {
  display: grid;
  min-width: 0;
}

.report-record small,
.report-record-time small {
  color: var(--muted);
}

.report-record-title strong,
.report-record-title small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.numeric {
  font-variant-numeric: tabular-nums;
  font-weight: 850;
  text-align: right;
}

.report-record-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 850;
}

.status-pill.open {
  background: var(--blue-soft);
  color: var(--blue);
}

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

.status-pill.locked {
  background: var(--panel-subtle);
  color: var(--muted);
}

.entry-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 80px rgb(15 23 42 / 28%);
}

.entry-dialog::backdrop {
  background: rgb(15 23 42 / 38%);
}

.dialog-surface {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: #fff;
}

.dialog-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.compact-edit-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0;
  background: #fff;
}

.span-2 {
  grid-column: span 2;
}

.material-table-section {
  display: grid;
  gap: 10px;
}

.material-table th,
.material-table td {
  padding: 8px;
}

.material-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.inline-row-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-review-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin: 0 28px;
  align-items: start;
}

.report-sync-form {
  display: flex;
  justify-content: flex-end;
  margin: -4px 28px 12px;
}

.calendar-view {
  display: grid;
  gap: 10px;
  margin: 0;
}

.calendar-view.week-view {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.calendar-view.month-view {
  grid-template-columns: repeat(7, minmax(120px, 1fr));
}

.calendar-day {
  display: grid;
  align-content: start;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.calendar-day header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 11px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-subtle);
}

.calendar-day header span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.calendar-entry-stack {
  display: grid;
  gap: 7px;
  padding: 9px;
}

.calendar-entry {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 9px;
  border: 1px solid #bfd0ff;
  border-left: 4px solid var(--blue);
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--text);
  text-align: left;
}

.month-view .calendar-entry {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px 6px;
  padding: 5px 7px;
}

.month-view .calendar-entry small,
.month-view .calendar-entry em {
  display: none;
}

.calendar-entry span,
.calendar-entry small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.calendar-entry strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-entry em {
  justify-self: start;
  margin-top: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff;
  color: var(--green);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
}

.calendar-entry.is-locked {
  border-color: #b8e2d5;
  border-left-color: var(--green);
  background: var(--green-soft);
}

.calendar-entry.is-locked strong {
  color: #095f4d;
}

.calendar-entry.is-invoiced {
  border-color: #d8b4fe;
  border-left-color: #7e22ce;
  background: #faf5ff;
}

.calendar-entry.is-invoiced strong {
  color: #581c87;
}

.calendar-trip {
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 6px;
  padding: 5px 7px;
  pointer-events: none;
  border-color: #cbd5e1;
  border-left-color: #64748b;
  background: #f8fafc;
  opacity: 0.92;
}

.calendar-trip small {
  justify-self: end;
}

.calendar-trip.is-linked {
  border-color: #b8e2d5;
  border-left-color: var(--green);
  background: var(--green-soft);
}

.calendar-trip strong {
  color: #334155;
}

.calendar-trip.is-linked strong {
  color: #095f4d;
}

.abax-modal-section {
  display: grid;
  gap: 10px;
}

.abax-trip-table {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.abax-trip-table th,
.abax-trip-table td {
  padding: 7px 8px;
  white-space: nowrap;
}

.abax-trip-table td:nth-child(2) {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.abax-trip-row.is-linked td {
  background: var(--green-soft);
}

.muted-note {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.abax-trip-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding: 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.abax-trip-panel > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.abax-trip-panel h2 {
  margin: 0;
  font-size: 1rem;
}

.abax-trip-panel > header > span {
  min-width: 30px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-subtle);
  color: var(--muted);
  font-weight: 850;
  text-align: center;
}

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

.abax-trip-card {
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--panel-subtle);
}

.abax-trip-card.is-linked {
  border-color: #b8e2d5;
  background: var(--green-soft);
}

.abax-trip-main {
  display: grid;
  gap: 3px;
}

.abax-trip-main strong,
.abax-trip-main span,
.abax-trip-main small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.abax-trip-main span,
.abax-trip-main small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 760;
}

.abax-trip-main p {
  margin: 2px 0 0;
  color: var(--text);
  font-size: 0.85rem;
}

.abax-attach-form,
.abax-trip-link,
.abax-inline-form,
.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.abax-attach-form .select-input {
  min-width: 0;
  flex: 1;
}

.abax-trip-link {
  flex-wrap: wrap;
  justify-content: space-between;
}

.abax-trip-link > span {
  flex: 1 1 100%;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 780;
}

.switch-row {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 820;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
}

.compact-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-weight: 800;
}

.integrations-page {
  display: grid;
  gap: 16px;
  padding: 28px;
}

.integrations-hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.integrations-hero p:not(.eyebrow) {
  max-width: 780px;
  margin: 7px 0 0;
  color: var(--muted);
}

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

.integration-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.integration-card header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.integration-card header span {
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.integration-card header strong {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--panel-subtle);
  color: var(--muted);
  font-size: 0.78rem;
}

.integration-card.connected header strong {
  background: var(--green-soft);
  color: var(--green);
}

.integration-card.pending header strong {
  background: #fff8eb;
  color: var(--amber);
}

.integration-card p {
  margin: 0;
  color: var(--muted);
}

.integration-meta {
  display: grid;
  gap: 8px;
  margin: 0;
}

.integration-meta div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 12px;
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

.integration-meta dt {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.integration-meta dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.integration-note {
  padding: 11px 12px;
  border: 1px solid #f2d19b;
  border-radius: 8px;
  background: #fff8eb;
  color: var(--amber);
  font-size: 0.88rem;
  font-weight: 750;
}

.integration-settings-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-subtle);
}

.integration-settings-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 820;
}

.integration-dialog .integration-settings-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.integration-settings-form button {
  justify-self: end;
}

.split-actions {
  justify-content: space-between;
}

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

.billing-hero,
.billing-filters,
.billing-metrics,
.billing-grid {
  display: grid;
  gap: 16px;
}

.billing-hero {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  margin-bottom: 16px;
}

.billing-hero p {
  max-width: 780px;
  margin: 7px 0 0;
  color: var(--muted);
}

.status-banner {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #b8e3d5;
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 800;
}

.status-banner.warning {
  border-color: #f2d19b;
  background: #fff8eb;
  color: var(--amber);
}

.toast-host {
  position: fixed;
  top: 18px;
  right: 18px;
  z-index: 1200;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.app-toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  border: 1px solid #cbd5e1;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 760;
  pointer-events: auto;
  animation: toast-in 160ms ease-out;
}

.app-toast.is-closing {
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.app-toast span {
  min-width: 0;
}

.app-toast button {
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 900;
}

.app-toast button:hover {
  background: var(--panel-subtle);
  color: var(--text);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.billing-filters {
  grid-template-columns: 150px 150px minmax(220px, 1fr) minmax(220px, 1fr) auto;
  align-items: end;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.billing-filters label,
.invoice-panel label,
.billing-entry-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.billing-metrics {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 16px 0;
}

.billing-metrics > div {
  display: grid;
  gap: 5px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.billing-metrics span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 850;
}

.billing-metrics strong {
  color: var(--ink);
  font-size: 1.28rem;
  font-variant-numeric: tabular-nums;
}

.billing-grid {
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: start;
}

.calendar-review,
.invoice-panel {
  display: grid;
  gap: 12px;
}

.invoice-panel {
  position: sticky;
  top: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

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

.billing-day {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.billing-day > header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-subtle);
}

.billing-day > header div {
  display: grid;
  gap: 3px;
}

.billing-day > header span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.billing-entry {
  border-bottom: 1px solid var(--border);
}

.billing-entry:last-child {
  border-bottom: 0;
}

.billing-entry summary {
  display: grid;
  grid-template-columns: 28px minmax(260px, 1fr) 110px 110px;
  gap: 12px;
  align-items: center;
  padding: 13px 16px;
  cursor: pointer;
  list-style: none;
}

.billing-entry.is-signed summary {
  background: #fbfffd;
}

.billing-entry summary span {
  display: grid;
  min-width: 0;
}

.billing-entry summary strong,
.billing-entry summary small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.billing-entry summary small {
  color: var(--muted);
}

.billing-entry summary em {
  justify-self: start;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 850;
}

.billing-entry summary b {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.billing-entry-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 16px;
  background: var(--panel-subtle);
}

.material-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 12px;
  background: var(--panel-subtle);
}

.material-list span {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.client-invoice-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}

.client-invoice-row span {
  color: var(--muted);
  font-weight: 800;
}

.invoice-entry-check {
  display: grid !important;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text) !important;
}

.invoice-entry-check span {
  display: grid;
  min-width: 0;
}

.invoice-entry-check strong,
.invoice-entry-check small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-entry-check small {
  color: var(--muted);
}

.invoice-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.invoice-entry-panel,
.invoice-aggregate-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.invoice-entry-panel > header,
.invoice-aggregate-panel > header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.invoice-entry-panel h2,
.invoice-aggregate-panel h2 {
  margin: 0;
}

.invoice-entry-table {
  display: grid;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.invoice-entry-head,
.invoice-entry-row {
  display: grid;
  grid-template-columns: 34px minmax(260px, 1fr) 110px 120px;
  gap: 10px;
  align-items: center;
}

.invoice-entry-head {
  padding: 9px 12px;
  background: var(--panel-subtle);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.invoice-entry-row {
  padding: 11px 12px;
  border-top: 1px solid var(--border);
  color: var(--text);
}

.invoice-entry-row span {
  min-width: 0;
}

.invoice-entry-row strong,
.invoice-entry-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invoice-entry-row small {
  color: var(--muted);
}

.invoice-entry-row b {
  text-align: right;
}

.billing-entry > form {
  padding: 0 16px 14px;
  background: var(--panel-subtle);
}

.invoice-summary {
  display: grid;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.invoice-summary p {
  margin: 0;
  color: var(--muted);
}

.summary-line,
.summary-total {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.summary-line small {
  grid-column: 1;
  color: var(--muted);
  font-weight: 750;
}

.summary-line strong {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
}

.summary-total {
  border-bottom: 0;
  font-size: 1.08rem;
  font-weight: 900;
}

body > .container-fluid > main > section:not(.time-workspace),
body > .container-fluid > main > h2,
body > .container-fluid > main > .table-responsive {
  margin-left: 28px;
  margin-right: 28px;
}

@media (max-width: 1180px) {
  .app-frame {
    grid-template-columns: 118px minmax(0, 1fr);
  }

  .time-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .right-drawer {
    grid-template-columns: 1fr 1fr;
    padding: 0 28px 28px;
  }

  .manual-sheet {
    position: static;
  }

  .running-layout,
  .metrics-row,
  .admin-grid,
  .inventory-grid,
  .report-grid,
  .report-review-layout,
  .invoice-workbench,
  .billing-grid {
    grid-template-columns: 1fr 1fr;
  }

  .report-review-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .abax-trip-panel {
    position: static;
    max-height: none;
  }

  .running-details,
  .edit-grid,
  .report-filters,
  .billing-filters,
  .billing-entry-form {
    grid-template-columns: 1fr 1fr;
  }

  .billing-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    background: #fff;
  }

  .app-frame,
  .time-workspace {
    grid-template-columns: 1fr;
  }

  .workspace-rail {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 10;
    flex-direction: row;
    justify-content: space-between;
    min-height: auto;
    height: 54px;
    padding: 8px 86px 8px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }

  .rail-nav {
    display: none;
  }

  .rail-tools {
    grid-auto-flow: column;
    width: auto;
    margin-top: 0;
  }

  .rail-tools span,
  .rail-tools a[href^="/language/"] {
    display: none;
  }

  .rail-nav a {
    padding: 0 10px;
    white-space: nowrap;
  }

  .mobile-timer-action {
    position: fixed;
    top: 8px;
    right: 10px;
    z-index: 30;
    display: block;
  }

  .mobile-timer-action form {
    margin: 0;
  }

  .mobile-start-stop {
    width: 64px;
    height: 38px;
    border: 0;
    border-radius: 999px;
    color: #fff;
    font-size: 0.78rem;
    font-weight: 900;
    box-shadow: 0 10px 24px rgb(15 23 42 / 20%);
  }

  .mobile-start-stop.is-start {
    background: var(--green);
  }

  .mobile-start-stop.is-stop {
    background: var(--red);
  }

  .tracker-surface,
  .right-drawer {
    grid-column: 1;
    padding: 70px 12px 16px;
  }

  .tracker-header,
  .quick-start,
  .running-layout,
  .metrics-row,
  .tracker-tabs,
  .right-drawer,
  .billing-hero,
  .billing-grid,
  .billing-filters,
  .billing-metrics,
  .billing-entry-form,
  .invoice-workbench,
  .integration-settings-form,
  .integration-grid,
  .admin-grid,
  .inventory-grid,
  .report-grid,
  .report-review-layout,
  .report-filters,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .start-button {
    width: 100%;
    height: 56px;
    border-radius: 8px;
  }

  .timer-card {
    max-height: none;
    margin-bottom: 10px;
    border-radius: 0;
    border-right: 0;
    border-left: 0;
    box-shadow: none;
  }

  .timer-card.timer-idle {
    display: none;
  }

  .timer-card.timer-running {
    position: relative;
    overflow: visible;
  }

  .quick-start {
    min-height: auto;
    padding: 12px;
  }

  .quick-copy strong {
    font-size: 1.1rem;
  }

  .recent-strip {
    display: none;
  }

  .running-layout {
    gap: 8px;
    padding: 10px 0;
  }

  .running-clock-block {
    grid-template-columns: auto 1fr;
    align-items: center;
    padding: 10px 12px;
  }

  .running-clock-block p,
  .running-clock-block small {
    display: none;
  }

  .timer-clock {
    font-size: 1.55rem;
  }

  .stop-form {
    display: none;
  }

  .running-details {
    gap: 8px;
  }

  .running-details .full-width {
    grid-column: 1;
  }

  .running-details label {
    font-size: 0.74rem;
  }

  .focus-input,
  .running-details .form-select {
    min-height: 38px;
  }

  .metrics-row,
  .right-drawer {
    display: none;
  }

  .entry-item summary {
    grid-template-columns: 14px minmax(0, 1fr) 80px;
  }

  .report-table-head {
    display: none;
  }

  .report-table {
    margin: 0;
  }

  .report-record {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .report-record-actions {
    justify-content: start;
  }

  .calendar-view.week-view,
  .calendar-view.month-view {
    grid-template-columns: 1fr;
  }

  .calendar-view {
    margin: 0;
  }

  .compact-edit-form,
  .material-add-row {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: 1;
  }

  .entry-tags,
  .entry-time,
  .entry-amount {
    display: none;
  }

  .running-details,
  .edit-grid {
    grid-template-columns: 1fr;
  }

  .compact-time-editor {
    grid-template-columns: 1fr;
  }

  .billing-page {
    padding: 16px;
  }

  .settings-tab {
    margin: 0 16px;
  }

  .inline-create {
    width: 100%;
  }

  .inline-create-form {
    position: static;
    width: 100%;
  }

  .invoice-panel {
    position: static;
  }

  .billing-entry summary {
    grid-template-columns: 24px minmax(0, 1fr) 86px;
  }

  .billing-entry summary b {
    display: none;
  }
}
