:root {
  color-scheme: light;
  --ink: #14212b;
  --muted: #64727c;
  --line: #dbe1e5;
  --line-strong: #c8d0d5;
  --surface: #ffffff;
  --surface-soft: #f4f6f7;
  --surface-hover: #edf1f2;
  --accent: #e85d31;
  --accent-dark: #c84821;
  --accent-soft: #fff0ea;
  --blue: #235d72;
  --series-1: #e85d31;
  --series-2: #235d72;
  --series-3: #6f56a5;
  --series-4: #2f7d5c;
  --series-5: #bb7a12;
  --series-6: #b64667;
  --series-7: #397aa8;
  --series-8: #7a7132;
  --series-9: #7d4f3f;
  --series-10: #4d7b82;
  --danger: #a53225;
  --danger-soft: #fff0ed;
  --shadow: 0 18px 50px rgba(24, 41, 50, 0.11);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 5%, rgba(232, 93, 49, 0.08), transparent 30rem),
    #eef1f2;
  color: var(--ink);
}

.startup-loading { position: fixed; inset: 0; z-index: 1000; padding: 24px; background: rgba(240, 244, 245, .94); backdrop-filter: blur(10px); display: grid; place-items: center; opacity: 1; transition: opacity .22s ease; }
.startup-loading.is-leaving { opacity: 0; pointer-events: none; }
.startup-loading-card { width: min(440px, 100%); padding: 30px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); text-align: center; }
.startup-loading-card img { width: 118px; height: auto; margin-bottom: 14px; }
.startup-loading-card .eyebrow { margin: 0 0 6px; }
.startup-loading-card h2 { margin: 0; color: var(--ink); font-size: 24px; }
.startup-loading-card > p:not(.eyebrow) { margin: 9px 0 16px; color: var(--muted); font-size: 12px; }
.startup-loading-card progress { width: 100%; height: 12px; overflow: hidden; border: 0; border-radius: 999px; accent-color: var(--accent); }
.startup-loading-card output { display: block; margin-top: 7px; color: var(--ink); font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; }
.startup-loading-card small { display: block; margin-top: 15px; color: var(--muted); font-size: 9px; }

button, input { font: inherit; }

button, label { -webkit-tap-highlight-color: transparent; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  height: calc(100vh - 32px);
  min-height: 620px;
  margin: 16px auto;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(20, 33, 43, 0.1);
  border-radius: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}

.app-header {
  min-height: 82px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.brand { min-width: 0; display: flex; align-items: center; gap: 14px; }
.brand-logo { width: 112px; height: auto; display: block; }
.brand-copy { min-width: 0; }

.app-tabs {
  margin-left: 12px;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-soft);
  display: inline-flex;
}

.app-tab {
  height: 34px;
  padding: 0 13px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.app-tab.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(20, 33, 43, 0.13); }
.app-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: clamp(22px, 2.1vw, 30px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.folder-button {
  margin-left: auto;
  min-height: 42px;
  padding: 0 17px;
  border: 0;
  border-radius: 9px;
  background: var(--ink);
  color: white;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  font-weight: 700;
  transition: background 150ms ease, transform 150ms ease;
}

.folder-button:hover { background: #263945; }
.folder-button:active { transform: translateY(1px); }
.folder-button:focus-within { outline: 3px solid rgba(232, 93, 49, 0.25); outline-offset: 2px; }
.folder-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; }
#folderInput { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }

.workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
}

.sidebar {
  min-height: 0;
  border-right: 1px solid var(--line);
  background: #fafbfb;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--line);
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.sidebar-title-row h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}

.file-count {
  min-width: 26px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-hover);
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.search-box {
  height: 38px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
}

.search-box:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(35, 93, 114, 0.12); }
.search-box svg { width: 17px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-box input { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.search-box input::placeholder { color: #89949b; }
.search-box:has(input:disabled) { opacity: 0.58; }

.file-list {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
  outline: none;
  overscroll-behavior: contain;
}

.file-list:focus-visible { box-shadow: inset 0 0 0 2px var(--blue); }
.file-list-content { position: relative; width: 100%; }

.file-row {
  position: absolute;
  left: 0;
  right: 0;
  height: 50px;
  padding: 7px 14px 7px 17px;
  border: 0;
  border-bottom: 1px solid #e7ebed;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  display: block;
}

.file-row:hover { background: var(--surface-hover); }
.file-row.is-selected { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.file-row:focus-visible { outline: 2px solid var(--blue); outline-offset: -3px; }
.file-row-name, .file-row-path { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row-name { font-size: 13px; font-weight: 700; }
.file-row-path { margin-top: 4px; color: var(--muted); font-size: 11px; }

.list-empty {
  position: absolute;
  inset: 0;
  padding: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

.list-empty svg { width: 34px; fill: none; stroke: #9aa5ac; stroke-width: 1.4; }

.viewer {
  min-width: 0;
  min-height: 0;
  padding: 20px 24px 17px;
  display: flex;
  flex-direction: column;
}

.viewer-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 12px;
}

.file-heading { min-width: 0; }
.file-heading h2 { margin: 2px 0 0; font-size: 21px; letter-spacing: -0.025em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-path { margin: 0; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.measurement-time { margin: 4px 0 0; color: var(--blue); font-size: 12px; font-weight: 650; }

.unit-switch {
  flex: none;
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-soft);
}

.unit-option {
  min-width: 72px;
  height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
}

.unit-option.is-active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 4px rgba(20, 33, 43, 0.13); }
.unit-option:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }

.message {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid #f0c3ba;
  border-radius: 8px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
}

.timeline {
  margin-bottom: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafbfb;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  align-items: end;
  gap: 10px 14px;
}

.timeline-dates, .timeline-transport, .timeline-slider-row { display: flex; align-items: center; gap: 7px; }
.timeline-dates label, .timeline-speed { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: 0.045em; text-transform: uppercase; }
.timeline-dates span, .timeline-speed span { display: block; margin-bottom: 3px; }
.timeline input[type="date"], .timeline select {
  height: 30px;
  padding: 0 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-size: 11px;
}

.timeline-transport { min-width: 0; justify-content: center; }
.timeline-slider-row { grid-column: 1 / -1; min-width: 0; align-items: flex-start; }
.timeline-slider-track { min-width: 0; flex: 1; }
.timeline-slider-track input[type="range"] { width: 100%; display: block; }
.timeline-ticks { position: relative; height: 18px; margin: -1px 8px 0; color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.timeline-ticks span { position: absolute; top: 0; transform: translateX(-50%); white-space: nowrap; }
.timeline-ticks span:first-child { transform: none; }
.timeline-ticks span:last-child { transform: translateX(-100%); }
.timeline button {
  flex: none;
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.timeline button:disabled, .timeline input:disabled { cursor: default; opacity: 0.48; }
.timeline-icon { width: 30px; padding: 0; font-size: 21px; line-height: 1; }
.timeline-play { min-width: 38px; padding: 0 9px; color: var(--accent-dark) !important; font-size: 12px; }
.timeline input[type="range"] { min-width: 160px; flex: 1; accent-color: var(--accent); }
.timeline output { min-width: 54px; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.timeline input.is-invalid { border-color: var(--danger); background: var(--danger-soft); }
.timeline-status { grid-column: 1 / -1; margin: -3px 0 0; color: var(--muted); font-size: 10px; }

.viewer-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.chart-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.chart-options { flex: none; display: flex; align-items: center; gap: 10px; }
.downhole-toggle { min-height: 38px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 11px; font-weight: 700; }
.downhole-toggle input { margin: 0; accent-color: var(--accent); }

.year-view { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.year-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 9px; }
.year-header h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.year-header p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.year-actions { display: flex; align-items: flex-end; gap: 9px; }
.year-legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 7px; color: var(--muted); font-size: 9px; }
.year-legend span { display: inline-flex; align-items: center; gap: 5px; }
.year-state { display: inline-block; width: 15px; height: 7px; border-radius: 3px; background: var(--line); }
.year-state.is-green, .year-day.is-green { background: #49a665; }
.year-state.is-yellow, .year-day.is-yellow { background: #e1a32a; }
.year-state.is-red, .year-day.is-red { background: #d64b3f; }
.year-state.is-empty, .year-day.is-empty { background: #e8ecee; }
.year-hover-label { min-height: 17px; margin: 0 0 6px; color: var(--blue); font-size: 10px; font-weight: 650; }
.year-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(175px, 1fr)); gap: 10px; }
.year-month { position: relative; min-width: 0; min-height: 155px; padding: 10px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; text-align: left; transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease, transform .14s ease; }
.year-month::before { position: absolute; inset: 0 0 auto; height: 6px; background: var(--line-strong); content: ""; }
.year-month.is-green::before { background: #49a665; }
.year-month.is-yellow::before { background: #e1a32a; }
.year-month.is-red::before { background: #d64b3f; }
.year-month:hover { border-color: #2f7d5c; background: #eef9f1; box-shadow: 0 7px 20px rgba(47, 125, 92, .14); transform: translateY(-1px); }
.year-month:hover .year-day:not(.is-outside) { box-shadow: inset 0 0 0 999px rgba(73, 166, 101, .13); }
.year-month:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.year-month header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin: 3px 0 6px; }
.year-month header strong { font-size: 13px; }
.year-month header span, .year-month-footer { color: var(--muted); font-size: 8px; }
.year-weekdays, .year-heatmap { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.year-weekdays { margin-bottom: 3px; color: var(--muted); font-size: 7px; font-style: normal; text-align: center; }
.year-weekdays i { font-style: normal; }
.year-day { min-width: 0; height: 10px; border-radius: 2px; background: #e8ecee; transition: background-color .1s ease, box-shadow .1s ease, outline-color .1s ease, transform .1s ease; }
.year-month:hover .year-day:not(.is-outside):hover { z-index: 1; background: #2f7d5c; outline: 2px solid #1f6046; outline-offset: 1px; box-shadow: none; transform: scale(1.28); }
.year-day.is-outside { background: transparent; }
.year-month-footer { display: block; margin-top: 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.week-view { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.week-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 10px; }
.week-header h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.week-range { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.week-actions { display: flex; align-items: flex-end; gap: 12px; }
.overview-toggle { min-height: 34px; padding: 0 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 10px; font-weight: 700; }
.overview-toggle input { margin: 0; accent-color: var(--accent); }
.week-count { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.week-count span { display: block; margin-bottom: 3px; }
.week-count select, .daily-date input { height: 34px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); font-size: 11px; }
.week-navigation { display: inline-flex; align-items: center; gap: 5px; }
.week-navigation button { height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 700; }
.week-navigation button:first-child, .week-navigation button:last-child { width: 34px; padding: 0; font-size: 19px; }
.week-navigation button:hover { background: var(--surface-hover); }
.week-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(190px, 1fr); gap: 10px; }
.week-day { position: relative; min-width: 0; min-height: 190px; margin: 0; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); display: flex; flex-direction: column; }
.week-day[role="button"] { cursor: pointer; transition: border-color 140ms ease, background 140ms ease; }
.week-day[role="button"]:hover { border-color: var(--accent); background: #fffdfc; }
.week-day[role="button"]:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.week-day header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.week-day h3 { margin: 0; color: var(--ink); font-size: 12px; letter-spacing: .08em; }
.week-date { color: var(--muted); font-size: 10px; }
.week-state-strip { display: block; flex: none; width: 100%; height: 7px; margin-bottom: 8px; border-radius: 999px; background: var(--line-strong); }
.week-state-strip.is-green { background: #49a665; }
.week-state-strip.is-yellow { background: #e1a32a; }
.week-state-strip.is-red { background: #d64b3f; }
.week-state-strip.is-empty { opacity: .45; }
.week-day canvas { width: 100%; flex: 1; min-height: 130px; display: block; }
.week-day-status { margin: 2px 0 0; color: var(--muted); font-size: 9px; text-align: center; }
.week-status { margin: 9px 0 0; color: var(--muted); font-size: 10px; }

.card-type-legend { display: flex; flex-wrap: wrap; gap: 12px; color: var(--muted); font-size: 9px; }
.card-type-legend span { display: inline-flex; align-items: center; gap: 5px; }
.type-line { width: 20px; height: 0; display: inline-block; border-top: 2px solid var(--muted); }
.type-surface { border-color: var(--muted); }
.type-downhole { border-color: var(--muted); border-top-style: dotted; }
.week-view > .card-type-legend { margin-bottom: 8px; }
.week-status-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin: -2px 0 8px; color: var(--muted); font-size: 9px; }
.week-status-legend span { display: inline-flex; align-items: center; gap: 5px; }
.week-status-swatch { display: inline-block; width: 24px; height: 6px; border-radius: 999px; background: var(--line-strong); }
.week-status-swatch.is-green { background: #49a665; }
.week-status-swatch.is-yellow { background: #e1a32a; }
.week-status-swatch.is-red { background: #d64b3f; }
.state-distribution { margin: 2px 0 9px; }
.state-distribution[hidden] { display: none; }
.state-distribution-bar { display: flex; width: 100%; height: 11px; overflow: hidden; border-radius: 999px; background: var(--line); }
.state-distribution-bar i { display: block; min-width: 0; height: 100%; transition: width 220ms ease; }
.state-distribution-bar i[data-state-segment="green"] { background: #49a665; }
.state-distribution-bar i[data-state-segment="yellow"] { background: #e1a32a; }
.state-distribution-bar i[data-state-segment="red"] { background: #d64b3f; }
.state-distribution-bar i[hidden], .month-status-strip[hidden] { display: none; }
.state-distribution-labels { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; color: var(--muted); font-size: 9px; }
.state-distribution-labels span { display: inline-flex; align-items: center; gap: 4px; }
.state-distribution-swatch { display: inline-block; width: 12px; height: 5px; border-radius: 999px; background: var(--line-strong); }
.state-distribution-swatch.is-green { background: #49a665; }
.state-distribution-swatch.is-yellow { background: #e1a32a; }
.state-distribution-swatch.is-red { background: #d64b3f; }

.month-view { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.month-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 9px; }
.month-header h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.month-header p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.month-navigation { display: inline-flex; align-items: center; gap: 5px; }
.month-actions { display: flex; align-items: center; gap: 9px; }
.month-navigation button { height: 34px; padding: 0 11px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 700; }
.month-navigation button:first-child, .month-navigation button:last-child { width: 34px; padding: 0; font-size: 19px; }
.month-navigation button:hover { background: var(--surface-hover); }
.month-guide { margin-bottom: 8px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: 9px; }
.month-guide > span { display: inline-flex; align-items: center; gap: 5px; }
.month-status-strip { display: inline-block; width: 38px; height: 7px; flex: none; border-radius: 999px; background: var(--line-strong); }
.month-status-strip.is-green { background: #49a665; }
.month-status-strip.is-yellow { background: #e1a32a; }
.month-status-strip.is-red { background: #d64b3f; }
.month-calendar-scroll { flex: 1; min-height: 0; overflow: auto; }
.month-weekdays, .month-grid { min-width: 770px; display: grid; grid-template-columns: repeat(7, minmax(100px, 1fr)); gap: 6px; }
.month-weekdays { margin-bottom: 5px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .08em; text-align: center; }
.month-day, .month-day-blank { min-width: 0; min-height: 118px; border-radius: 8px; transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease; }
.month-day-blank { border: 1px solid transparent; }
.month-day { padding: 7px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; display: flex; flex-direction: column; text-align: left; }
.month-day:hover:not(:disabled) { border-color: #2f7d5c; background: #dff3e5; box-shadow: 0 0 0 2px rgba(47, 125, 92, .22); }
.month-day.is-week-highlighted, .month-day-blank.is-week-highlighted { border-color: rgba(73, 166, 101, .46); background: #eef9f1; box-shadow: 0 0 0 1px rgba(73, 166, 101, .09); }
.month-day.is-week-highlighted:hover { border-color: #2f7d5c; background: #dff3e5; box-shadow: 0 0 0 2px rgba(47, 125, 92, .22); }
.month-day:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.month-day:disabled { cursor: default; color: var(--muted); }
.month-day.has-yellow { box-shadow: inset 3px 0 0 #e1a32a; }
.month-day.has-red { box-shadow: inset 3px 0 0 #d64b3f; }
.month-day-header { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.month-day-header b { font-size: 11px; }
.month-day > .month-status-strip { width: 100%; height: 8px; margin-bottom: 5px; }
.month-day canvas { width: 100%; flex: 1; min-height: 72px; display: block; }
.month-day-footer { overflow: hidden; color: var(--muted); font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
.month-status { margin: 8px 0 0; color: var(--muted); font-size: 10px; }

.daily-view { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.daily-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.daily-header h2 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.daily-header p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.daily-actions { display: flex; align-items: flex-end; gap: 9px; }
.daily-date, .daily-count, .daily-kpi-select { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .045em; text-transform: uppercase; }
.daily-date span, .daily-count span, .daily-kpi-select span { display: block; margin-bottom: 3px; }
.daily-count select, .daily-kpi-select select { height: 34px; min-width: 72px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); color: var(--ink); font-size: 11px; }
.daily-kpis { margin: 12px 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.daily-kpis > div { min-width: 0; padding: 10px 13px; border-right: 1px solid var(--line); }
.daily-kpis > div:last-child { border-right: 0; }
.daily-kpis dt { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; }
.daily-kpis dd { margin: 4px 0 0; color: var(--ink); font-size: 19px; font-weight: 750; font-variant-numeric: tabular-nums; }
.daily-grid { flex: 1; min-height: 340px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 12px; }
.daily-panel { min-width: 0; min-height: 330px; padding: 12px; border: 1px solid var(--line); border-radius: 9px; display: flex; flex-direction: column; }
.daily-panel > header { min-height: 42px; display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.daily-panel h3 { margin: 0; font-size: 13px; }
.daily-panel header p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.daily-panel canvas { width: 100%; flex: 1; min-height: 250px; display: block; }
.daily-overlay-panel canvas { cursor: pointer; }
.daily-panel-legends { max-width: 58%; display: flex; align-items: flex-end; flex-direction: column; gap: 5px; }
.daily-panel-legends .card-type-legend { justify-content: flex-end; }
.daily-legend { max-width: 58%; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 8px; color: var(--muted); font-size: 9px; }
.daily-legend span { display: inline-flex; align-items: center; gap: 4px; }
.daily-legend i { width: 12px; height: 2px; display: inline-block; background: var(--series-color); }
.daily-status { margin: 9px 0 0; color: var(--muted); font-size: 10px; }

.settings-view { flex: 1; min-height: 0; overflow: auto; }
.settings-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.settings-heading h2 { margin: 0; font-size: 22px; }
.settings-heading p:last-child { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.settings-columns { max-width: 820px; margin-top: 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.settings-group h3 { margin: 0 0 12px; font-size: 15px; }
.settings-subheading { margin-top: 24px !important; padding-top: 18px; border-top: 1px solid var(--line); }
.settings-group .parameter-section > p { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 10px; line-height: 1.4; }
.settings-note { color: var(--muted); font-size: 10px; line-height: 1.45; }
.settings-preview { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.settings-preview > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.settings-preview h4 { margin: 0; font-size: 12px; }
.settings-preview header p { max-width: 185px; margin: 3px 0 0; overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.settings-preview-legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px 10px; color: var(--muted); font-size: 9px; }
.settings-preview-legend span { display: inline-flex; align-items: center; gap: 4px; }
.settings-preview-chart { position: relative; height: 260px; border: 1px solid var(--line); background: var(--surface); }
.settings-preview-chart canvas { display: block; width: 100%; height: 100%; }
.settings-preview-chart > p { position: absolute; inset: 0; margin: 0; padding: 20px; display: grid; place-items: center; color: var(--muted); font-size: 11px; text-align: center; pointer-events: none; }

.plot-column {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.animation-layout {
  flex: 1;
  min-height: 330px;
  display: grid;
  grid-template-columns: minmax(0, 820px) minmax(260px, 330px);
  justify-content: center;
  gap: 12px;
}

.animation-insights { min-width: 0; min-height: 0; overflow: auto; }
.animation-insights .file-details { margin: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.animation-insights .file-details > div { border-bottom: 1px solid var(--line); }
.animation-insights .file-details > div:nth-child(even) { border-right: 0; }
.animation-insights .file-details > div:nth-last-child(-n+2) { border-bottom: 0; }
.animation-insights .analysis-panel { grid-template-columns: 1fr; }
.animation-insights .analysis-bar,
.animation-insights .analysis-conditions,
.animation-insights .analysis-metrics,
.animation-insights .analysis-disclaimer { grid-column: 1; }

.chart-wrap {
  position: relative;
  flex: 1;
  min-height: 220px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  width: 100%;
}

#chartCanvas { display: block; width: 100%; height: 100%; cursor: crosshair; }

.chart-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  text-align: center;
}

.chart-empty-icon {
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
}

.chart-empty svg { width: 29px; fill: none; stroke: var(--accent); stroke-width: 1.5; }
.chart-empty strong { color: var(--ink); font-size: 15px; }
.chart-empty span { margin-top: 5px; font-size: 13px; }

.chart-tooltip {
  position: absolute;
  z-index: 4;
  min-width: 116px;
  padding: 8px 10px;
  border-radius: 7px;
  background: rgba(20, 33, 43, 0.93);
  color: white;
  box-shadow: 0 6px 20px rgba(20, 33, 43, 0.18);
  pointer-events: none;
  font-size: 12px;
  line-height: 1.55;
  font-variant-numeric: tabular-nums;
}

.chart-tooltip b { color: #ffb196; font-weight: 750; }

.chart-legend {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 14px;
  display: flex;
  gap: 14px;
  padding: 6px 9px;
  border: 1px solid rgba(20, 33, 43, 0.1);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.9);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  pointer-events: none;
}

.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-line { display: inline-block; width: 18px; height: 0; border-top: 2px solid; }
.legend-surface { border-color: var(--accent); }
.legend-downhole { border-color: var(--blue); border-top-style: dashed; }

.file-details {
  margin: 12px 0 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
}

.file-details > div { min-width: 0; padding: 10px 13px; border-right: 1px solid var(--line); }
.file-details > div:last-child { border-right: 0; }
.file-details dt { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.07em; text-transform: uppercase; }
.file-details dd { margin: 5px 0 0; overflow: hidden; color: var(--ink); font-size: 12px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }

.analysis-panel {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fafbfb;
  display: grid;
  grid-template-columns: 178px minmax(0, 1fr);
  gap: 7px 14px;
}
.analysis-fillage { display: flex; align-items: center; gap: 8px; }
.analysis-label { color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .055em; text-transform: uppercase; }
.analysis-fillage strong { color: var(--accent-dark); font-size: 22px; line-height: 1; }
.analysis-fillage strong.is-kpi-updated { animation: kpiPulse 360ms ease; }
@keyframes kpiPulse {
  0% { opacity: .55; transform: scale(.96); }
  60% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .analysis-fillage strong.is-kpi-updated { animation: none; }
  .traffic-light i, .analysis-bar i, .state-distribution-bar i { transition: none; }
}
.analysis-state { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; padding-top: 7px; border-top: 1px solid var(--line); }
.analysis-state .analysis-label { flex-basis: 100%; }
.analysis-condition-value { color: var(--ink); font-size: 14px; font-weight: 800; line-height: 1.15; }
.analysis-condition-value.is-normal { color: #25643b; }
.analysis-condition-value.is-warning { color: var(--danger); }
.traffic-light { display: inline-flex; align-items: center; gap: 3px; padding: 3px 5px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-hover); }
.traffic-light i { display: block; width: 8px; height: 8px; border-radius: 50%; opacity: .22; transition: opacity 180ms ease, box-shadow 180ms ease; }
.traffic-light i[data-light="red"] { background: #d64b3f; }
.traffic-light i[data-light="yellow"] { background: #e1a32a; }
.traffic-light i[data-light="green"] { background: #49a665; }
.traffic-light.traffic-light-red i[data-light="red"] { opacity: 1; box-shadow: 0 0 0 2px rgba(214, 75, 63, .16); }
.traffic-light.traffic-light-yellow i[data-light="yellow"] { opacity: 1; box-shadow: 0 0 0 2px rgba(225, 163, 42, .18); }
.traffic-light.traffic-light-green i[data-light="green"] { opacity: 1; box-shadow: 0 0 0 2px rgba(73, 166, 101, .18); }
.confidence-badge { max-width: 190px; padding: 2px 6px; border-radius: 999px; background: var(--surface-hover); color: var(--muted); font-size: 9px; font-weight: 750; white-space: normal; text-align: center; }
.confidence-badge.is-high { background: #e4f3e9; color: #25643b; }
.confidence-badge.is-medium { background: #fff2d8; color: #805800; }
.confidence-badge.is-low { background: var(--danger-soft); color: var(--danger); }
.analysis-bar { align-self: center; height: 7px; overflow: hidden; border-radius: 999px; background: #e1e6e8; }
.analysis-bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #65a56f); transition: width 180ms ease; }
.analysis-bar i.is-state-warning { background: linear-gradient(90deg, #e7a14a, var(--danger)); }
.analysis-evidence { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.analysis-evidence summary { padding: 6px 8px; color: var(--ink); cursor: pointer; font-size: 10px; font-weight: 750; list-style-position: inside; }
.analysis-evidence .analysis-conditions { padding: 0 8px 8px; }
.analysis-conditions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 5px 8px; }
.condition-chip { padding: 4px 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 10px; }
.condition-chip b { color: var(--blue); }
.condition-chip.is-primary { border-color: #e8ae9a; background: var(--accent-soft); }
.analysis-metrics, .analysis-disclaimer { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.35; }
.analysis-disclaimer { font-style: italic; }

.parameter-panel {
  min-height: 0;
  overflow: auto;
  padding: 15px;
  border: 1px solid var(--line);
  background: #fafbfb;
}

.parameter-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.parameter-heading .eyebrow { margin-bottom: 4px; }
.parameter-heading h3 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.reset-button { padding: 4px 0; border: 0; background: transparent; color: var(--blue); cursor: pointer; font-size: 11px; font-weight: 700; }
.reset-button:hover { text-decoration: underline; }
.reset-button:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.parameter-error {
  margin-bottom: 10px;
  padding: 8px 9px;
  border: 1px solid #f0c3ba;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 11px;
  line-height: 1.4;
}

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

.parameter-field { display: block; min-width: 0; }
.parameter-field-wide { grid-column: 1 / -1; }
.parameter-field > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 0.045em; text-transform: uppercase; }
.parameter-field small { font-size: 9px; font-weight: 650; letter-spacing: 0; text-transform: none; }
.parameter-field input, .parameter-field select {
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  outline: 0;
  background: var(--surface);
  color: var(--ink);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.parameter-field input:focus, .parameter-field select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(35, 93, 114, 0.1); }
.parameter-field input.is-invalid { border-color: var(--danger); background: var(--danger-soft); }

.axis-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.axis-section h4 { grid-column: 1 / -1; margin: 0; font-size: 12px; }
.axis-section p, .downhole-section > p { grid-column: 1 / -1; margin: -2px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }

.downhole-section { margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.downhole-section summary { margin-bottom: 10px; color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 750; }
.downhole-section > p { margin-top: 8px; }
.downhole-section code { font-size: 9px; }

@media (max-width: 1180px) {
  .animation-layout { grid-template-columns: 1fr; min-height: 620px; }
  .animation-insights { overflow: visible; }
  .year-grid { grid-template-columns: repeat(3, minmax(175px, 1fr)); }
}

@media (max-width: 1100px) {
  .app-header { flex-wrap: wrap; }
  .app-tabs { order: 3; width: 100%; margin-left: 0; justify-content: center; }
}

@media (max-width: 820px) {
  .app-shell { width: 100%; height: 100vh; min-height: 680px; margin: 0; border: 0; border-radius: 0; }
  .workspace { grid-template-columns: 240px minmax(0, 1fr); }
  .viewer { padding-inline: 16px; }
  .file-details { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .file-details > div:nth-child(2) { border-right: 0; }
  .file-details > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .analysis-panel { grid-template-columns: 1fr; }
  .analysis-bar, .analysis-conditions, .analysis-metrics, .analysis-disclaimer { grid-column: 1; }
  .brand-logo { width: 92px; }
  .app-tab { padding-inline: 9px; }
  .year-grid { grid-template-columns: repeat(2, minmax(175px, 1fr)); }
  .week-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 200px; }
  .daily-grid { grid-template-columns: 1fr; }
  .daily-panel { min-height: 300px; }
  .settings-columns { grid-template-columns: 1fr; gap: 22px; }
  .settings-preview-chart { height: 300px; }
  .timeline { grid-template-columns: 1fr auto; }
  .timeline-dates { grid-column: 1; }
  .timeline-speed { grid-column: 2; }
  .timeline-transport { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .timeline-slider-row { grid-row: 3; }
  .timeline-status { grid-row: 4; }
}

@media (max-width: 620px) {
  .app-header { min-height: 72px; padding: 12px 14px; }
  .brand-logo { width: 72px; }
  .brand-copy .eyebrow { display: none; }
  h1 { font-size: 21px; }
  .folder-button { width: 42px; padding: 0; justify-content: center; font-size: 0; }
  .app-tabs { order: 3; width: 100%; margin-left: 0; }
  .app-tab { flex: 1; padding-inline: 5px; font-size: 10px; }
  .app-header { flex-wrap: wrap; }
  .brand { flex: 1; }
  .folder-button { margin-left: 0; }
  .workspace { grid-template-columns: 1fr; grid-template-rows: 210px minmax(0, 1fr); }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .viewer { padding: 12px; }
  .viewer-toolbar { align-items: center; }
  .file-heading h2 { font-size: 16px; }
  .unit-option { min-width: 60px; padding-inline: 7px; }
  .viewer-content { overflow: auto; }
  .plot-column { min-height: 420px; }
  .chart-wrap { min-height: 280px; }
  .timeline { grid-template-columns: 1fr; align-items: stretch; }
  .timeline-dates { justify-content: space-between; }
  .timeline-dates label { flex: 1; }
  .timeline input[type="date"] { width: 100%; }
  .timeline-speed { position: static; grid-column: 1; }
  .timeline-transport { grid-column: 1; grid-row: auto; justify-content: flex-start; }
  .timeline-slider-row { grid-column: 1; grid-row: auto; }
  .timeline-status { grid-row: auto; }
  .week-header { align-items: flex-start; flex-direction: column; }
  .year-header { align-items: flex-start; flex-direction: column; }
  .year-actions { width: 100%; justify-content: space-between; }
  .year-grid { grid-template-columns: 1fr; }
  .week-actions { width: 100%; align-items: flex-end; justify-content: space-between; }
  .week-grid { grid-template-columns: 1fr; grid-auto-rows: 210px; }
  .month-header { align-items: flex-start; flex-direction: column; }
  .daily-header { align-items: flex-start; flex-direction: column; }
  .daily-actions { width: 100%; justify-content: space-between; }
  .daily-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .daily-kpis > div:nth-child(2) { border-right: 0; }
  .daily-kpis > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .daily-legend { max-width: 100%; justify-content: flex-start; }
  .daily-panel-legends { max-width: 100%; align-items: flex-start; }
  .daily-panel-legends .card-type-legend { justify-content: flex-start; }
  .timeline-ticks span:nth-child(even) { display: none; }
  .chart-options { align-items: flex-end; flex-direction: column-reverse; }
  .settings-heading { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
