/* ============================================================================
   SHIFT & HABIT OPS — ARCHITECTURAL MINIMALIST EDITION
   Matches MateoBalestrini.com: Matte obsidian canvas, Instrument Serif +
   JetBrains Mono + Inter, 1px hairline rules, and generous negative space.
   ============================================================================ */

:root {
  --bg: #0a0a0c;
  --bg-subtle: #101014;
  --text: #f5f5f3;
  --muted: #9a9a96;
  --subtle: #5c5c58;
  --line: rgba(245, 245, 243, 0.09);
  --line-strong: rgba(245, 245, 243, 0.22);
  --accent: #ff3b30;
  --emerald: #34d399;
  --amber: #f59e0b;

  --font-serif: 'Instrument Serif', Georgia, serif;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 140px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 40px;
}

/* Top Navigation Bar */
.topbar {
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 12, 0.88);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--text);
}

.divider {
  color: var(--subtle);
}

.brand-title {
  color: var(--text);
  font-weight: 500;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.sync-pill {
  background: transparent;
  border: 1px solid var(--line);
  padding: 5px 11px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.sync-pill:hover {
  border-color: var(--line-strong);
  color: var(--text);
}

.sync-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--amber);
}

.sync-pill.is-online {
  border-color: rgba(52, 211, 153, 0.35);
  color: var(--text);
}

.sync-pill.is-online .sync-indicator {
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.sync-pill.is-offline .sync-indicator {
  background: var(--amber);
}

.text-action {
  background: transparent;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.text-action:hover {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* Editorial Hero Intro */
.hero-intro {
  padding: 84px 0 56px;
}

.hero-kicker {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 16px;
}

.hero-title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.8rem, 5vw, 4.4rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.hero-title em {
  font-style: italic;
  color: var(--muted);
}

/* Borderless Typographic KPI Strip */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 32px;
  padding: 36px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 110px;
}

.kpi-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi-val {
  font-family: var(--font-serif);
  font-size: clamp(2.2rem, 3.2vw, 3.1rem);
  line-height: 1;
  color: var(--text);
}

.accent-text {
  color: var(--accent);
}

.kpi-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

/* Asymmetric 3.5fr / 8.5fr Editorial Split Sections */
.editorial-section {
  display: grid;
  grid-template-columns: 3.5fr 8.5fr;
  gap: 64px;
  padding-bottom: 120px;
  margin-bottom: 120px;
  border-bottom: 1px solid var(--line);
  align-items: start;
}

.editorial-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
}

.section-sidebar {
  position: sticky;
  top: 108px;
}

.section-index {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin-bottom: 12px;
}

.section-sidebar h2 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 2.3rem;
  line-height: 1.1;
  margin-bottom: 14px;
}

.section-note {
  font-size: 0.92rem;
  color: var(--muted);
  margin-bottom: 28px;
  max-width: 28ch;
}

.sidebar-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.mono-label {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  color: var(--subtle);
  text-transform: uppercase;
}

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-align: left;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease;
}

.link-btn:hover {
  color: var(--accent);
}

/* Sidebar Filters */
.sidebar-filters {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.sidebar-filters .mono-label {
  margin-top: 8px;
}

/* Inputs & Controls — Minimal Hairline Underlines */
input,
select,
textarea {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line-strong);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.92rem;
  font-weight: 300;
  padding: 10px 0;
  width: 100%;
  border-radius: 0;
  transition: border-color 0.2s ease;
}

select {
  cursor: pointer;
}

select option {
  background: var(--bg);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-bottom-color: var(--accent);
}

input::placeholder,
textarea::placeholder {
  color: var(--subtle);
}

/* Section 01: SOP & Habit Rows */
.habit-list {
  border-top: 1px solid var(--line);
}

.habit-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  transition: opacity 0.2s ease;
}

.habit-left {
  display: flex;
  align-items: baseline;
  gap: 16px;
  cursor: pointer;
  flex: 1;
}

.habit-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  transform: translateY(2px);
  flex-shrink: 0;
}

.habit-title {
  font-size: 1.02rem;
  font-weight: 400;
  color: var(--text);
  transition: color 0.15s ease;
}

.habit-item.completed .habit-title {
  text-decoration: line-through;
  color: var(--subtle);
}

.habit-meta {
  display: inline-flex;
  gap: 12px;
  margin-left: 12px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--subtle);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.habit-right {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-shrink: 0;
}

.streak-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.row-micro-btn {
  background: none;
  border: none;
  color: var(--subtle);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s ease;
}

.row-micro-btn:hover {
  color: var(--text);
}

.delete-btn {
  background: none;
  border: none;
  color: var(--subtle);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.45;
  transition: opacity 0.15s ease, color 0.15s ease;
}

.habit-item:hover .delete-btn,
.shift-card:hover .delete-btn {
  opacity: 1;
}

.delete-btn:hover {
  color: var(--accent);
}

/* Minimal Add SOP Bar */
.minimal-add-bar {
  display: grid;
  grid-template-columns: 1fr 180px auto;
  gap: 20px;
  align-items: end;
  padding-top: 20px;
}

.btn-minimal,
.btn-submit {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line-strong);
  padding: 10px 22px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.btn-minimal:hover,
.btn-submit:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Section 02: Streamlined Shift Composer */
.shift-composer {
  padding-bottom: 48px;
  margin-bottom: 56px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.composer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.composer-grid-main {
  display: grid;
  grid-template-columns: 1fr 1.3fr 1.2fr;
  gap: 28px;
}

.composer-grid-metrics {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 1fr 1fr;
  gap: 28px;
}

.clean-field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}

/* Progressive Disclosure Drawer for Anomalies */
.anomaly-drawer {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.anomaly-drawer summary {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.04em;
  list-style: none;
  transition: color 0.15s ease;
}

.anomaly-drawer summary::-webkit-details-marker {
  display: none;
}

.anomaly-drawer summary:hover {
  color: var(--text);
}

.anomaly-fields {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 24px;
}

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

/* Clean Borderless Shift Feed */
.shift-list {
  display: flex;
  flex-direction: column;
}

.shift-card {
  padding: 36px 0;
  border-bottom: 1px solid var(--line);
}

.shift-card:first-child {
  padding-top: 0;
}

.shift-card-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.shift-identity {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
}

.shift-role {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 400;
  color: var(--text);
  line-height: 1.15;
}

.operator-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.facility-line {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.shift-stats {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  flex-wrap: wrap;
}

.shift-notes {
  font-size: 0.98rem;
  color: var(--text);
  max-width: 72ch;
  margin-bottom: 14px;
}

/* Minimal Structured Anomaly Lines */
.shift-structured-blocks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
  padding-left: 16px;
  border-left: 1px solid var(--line-strong);
}

.handoff-line {
  font-size: 0.86rem;
  color: var(--muted);
}

.handoff-line strong {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-right: 8px;
}

.empty-state {
  padding: 40px 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--subtle);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 12, 0.86);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-dialog {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  width: 100%;
  max-width: 720px;
  padding: 36px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.modal-header h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.9rem;
}

.report-textarea {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  line-height: 1.6;
  background: var(--bg-subtle);
  border: 1px solid var(--line);
  padding: 20px;
  margin-bottom: 24px;
  resize: vertical;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 24px;
}

/* Minimal Toast */
.ops-toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: var(--text);
  padding: 12px 20px;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  z-index: 120;
}

/* Responsive Breakpoints */
@media (max-width: 980px) {
  .kpi-strip {
    grid-template-columns: repeat(3, 1fr);
  }
  .editorial-section {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .section-sidebar {
    position: static;
  }
  .composer-grid-main,
  .composer-grid-metrics,
  .anomaly-fields {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 20px;
  }
  .topbar-inner {
    height: auto;
    padding: 16px 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .kpi-strip {
    grid-template-columns: 1fr 1fr;
  }
  .minimal-add-bar,
  .composer-grid-main,
  .composer-grid-metrics,
  .anomaly-fields {
    grid-template-columns: 1fr;
  }
}
