/* ==========================================================================
   ObraTrack — design tokens
   ========================================================================== */

:root {
  /* Surfaces */
  --bg: oklch(98% 0.004 250);
  --surface: white;
  --surface-muted: oklch(96% 0.005 250);
  --surface-hover: oklch(97% 0.006 250);
  --track: oklch(94% 0.006 250);
  --track-strong: oklch(95% 0.006 250);

  /* Borders */
  --border: oklch(91% 0.006 250);
  --border-soft: oklch(94% 0.006 250);
  --border-strong: oklch(88% 0.006 250);
  --border-hover: oklch(80% 0.02 255);
  --border-dashed: oklch(85% 0.006 250);

  /* Text */
  --text: oklch(22% 0.02 255);
  --text-nav: oklch(35% 0.02 255);
  --text-body: oklch(40% 0.02 255);
  --text-muted: oklch(52% 0.015 255);
  --text-soft: oklch(55% 0.015 255);
  --text-faint: oklch(58% 0.015 255);
  --text-placeholder: oklch(60% 0.015 255);

  /* Brand */
  --primary: oklch(52% 0.16 255);
  --primary-hover: oklch(46% 0.16 255);
  --primary-link-hover: oklch(45% 0.17 255);
  --primary-soft: oklch(96% 0.02 255);
  --primary-soft-hover: oklch(94% 0.03 255);
  --primary-soft-border: oklch(90% 0.03 255);
  --primary-avatar-bg: oklch(90% 0.03 255);
  --primary-avatar-fg: oklch(40% 0.1 255);
  --primary-deep: oklch(35% 0.05 255);

  /* Semaphore — schedule adherence */
  --status-ok: oklch(55% 0.14 145);
  --status-warn: oklch(65% 0.15 70);
  --status-late: oklch(55% 0.18 25);
  --status-idle: oklch(60% 0.02 255);

  /* Chart */
  --bar-planned: oklch(88% 0.01 255);
  --bar-planned-legend: oklch(85% 0.01 255);
  --gantt-marker: oklch(30% 0.02 255);
  --dot-inactive: oklch(80% 0.01 255);

  /* Type */
  --font-display: 'Manrope', system-ui, sans-serif;
  --font-body: 'Public Sans', system-ui, sans-serif;

  /* Shape */
  --radius-card: 14px;
  --radius-control: 9px;
  --radius-item: 8px;
}

/* ==========================================================================
   Base
   ========================================================================== */

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
}

h1, h2, h3, p { margin: 0; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

button:disabled { cursor: default; }

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-link-hover); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: oklch(88% 0.006 250); border-radius: 8px; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ==========================================================================
   Layout
   ========================================================================== */

/* Desktop-first admin layout, as designed. Below --shell-min the page pans
   horizontally rather than dropping the sidebar navigation. */
.shell {
  display: flex;
  height: 100vh;
  width: 100%;
  min-width: 1024px;
  overflow: hidden;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ==========================================================================
   Sidebar
   ========================================================================== */

.sidebar {
  width: 264px;
  min-width: 264px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 28px;
}

.brand__mark {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand__mark span {
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 2px;
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.01em;
}

.nav__section { margin-bottom: 20px; }

.nav__label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--text-placeholder);
  padding: 0 12px 8px;
  text-transform: uppercase;
}

.nav__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--radius-item);
  margin-bottom: 2px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-nav);
}

.nav__item:hover:not(:disabled) { background: var(--surface-hover); }

.nav__item.is-active {
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.nav__dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--primary);
  flex-shrink: 0;
}

.nav__item:disabled .nav__dot { background: var(--dot-inactive); }

.nav__text { flex: 1; }

.nav__badge {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-soft);
  background: oklch(95% 0.006 250);
  padding: 2px 6px;
  border-radius: 5px;
}

.sidebar__footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 20px;
}

.field-app {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--primary-soft);
  border: 1px solid var(--primary-soft-border);
}

.field-app:hover { background: var(--primary-soft-hover); }

.field-app__icon {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: 2px solid var(--primary);
  flex-shrink: 0;
}

.field-app__title {
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-deep);
}

.field-app__sub {
  display: block;
  font-size: 11.5px;
  color: oklch(52% 0.03 255);
}

.user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
}

.user__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
}

.user__name { font-size: 13.5px; font-weight: 700; }
.user__role { font-size: 11.5px; color: var(--text-soft); }

/* ==========================================================================
   Topbar
   ========================================================================== */

.topbar {
  height: 72px;
  min-height: 72px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
}

.topbar__title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
}

.topbar__subtitle {
  font-size: 12.5px;
  color: var(--text-soft);
  margin-top: 1px;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-muted);
  border-radius: var(--radius-control);
  padding: 9px 14px;
  width: 240px;
}

.search__icon {
  width: 15px;
  height: 15px;
  color: var(--text-placeholder);
  flex-shrink: 0;
}

.search__input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
}

.search__input::placeholder { color: var(--text-faint); }
.search__input:focus { outline: none; }
.search__input::-webkit-search-cancel-button { cursor: pointer; }

.icon-button {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-control);
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-body);
}

.icon-button:hover { background: oklch(93% 0.006 250); }
.icon-button svg { width: 17px; height: 17px; }

.icon-button__dot {
  position: absolute;
  top: 6px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-late);
  border: 1.5px solid white;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.button {
  font-size: 13.5px;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: var(--radius-control);
  white-space: nowrap;
}

.button--primary { background: var(--primary); color: white; }
.button--primary:hover { background: var(--primary-hover); }

.button--secondary {
  padding: 9px 16px;
  border-radius: var(--radius-item);
  border: 1px solid var(--border-strong);
  font-size: 13px;
}

.button--secondary:hover { background: var(--surface-hover); }

.button--compact {
  padding: 9px 16px;
  border-radius: var(--radius-item);
  font-size: 13px;
}

/* ==========================================================================
   Cards & shared blocks
   ========================================================================== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 22px;
}

.card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
}

/* Title that sits directly above the card body. */
.card__title--block { margin-bottom: 16px; }

.card--spaced { margin-bottom: 16px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.link-button {
  font-size: 13px;
  font-weight: 700;
  color: var(--primary);
}

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

/* display:block so the meter works whether it is built from divs or spans. */
.meter {
  display: block;
  height: 8px;
  background: var(--track);
  border-radius: 4px;
  overflow: hidden;
}

.meter__fill {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.status-chip {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed var(--border-dashed);
  border-radius: var(--radius-card);
  padding: 60px;
  text-align: center;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-soft);
}

/* ==========================================================================
   Dashboard
   ========================================================================== */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}

.kpi { padding: 20px; }

.kpi__label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-soft);
  margin-bottom: 10px;
}

.kpi__row {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.kpi__value {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 800;
}

.kpi__trend { font-size: 13px; font-weight: 700; }

.kpi .meter {
  height: 6px;
  margin-top: 14px;
}

.dashboard-split {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  font-weight: 600;
  color: oklch(50% 0.015 255);
}

.legend__item { display: flex; align-items: center; gap: 6px; }

.legend__swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

.legend__swatch--planned { background: var(--bar-planned-legend); }
.legend__swatch--real { background: var(--primary); }

.chart {
  display: flex;
  align-items: flex-end;
  gap: 18px;
  height: 150px;
  padding: 0 4px;
}

.chart__group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.chart__bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 120px;
}

.chart__bar {
  width: 16px;
  border-radius: 3px 3px 0 0;
}

.chart__bar--planned { background: var(--bar-planned); }
.chart__bar--real { background: var(--primary); }

.chart__label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-soft);
}

.alerts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.alert {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.alert__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.alert__project { font-size: 13px; font-weight: 700; }

.alert__message {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.gantt {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.gantt__row {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 14px;
}

.gantt__name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gantt__track {
  position: relative;
  height: 20px;
  background: var(--track-strong);
  border-radius: 6px;
}

.gantt__fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 6px;
}

.gantt__marker {
  position: absolute;
  top: -2px;
  height: 24px;
  width: 2px;
  background: var(--gantt-marker);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

/* ==========================================================================
   Project card
   ========================================================================== */

.project-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.project-card:hover { border-color: var(--border-hover); }

.project-card__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.project-card__name {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.3;
}

.project-card__status {
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.project-card__location {
  font-size: 12px;
  color: var(--text-soft);
}

.project-card__progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  font-weight: 600;
  color: oklch(50% 0.015 255);
  margin-bottom: 5px;
}

.project-card .meter { height: 7px; }

.project-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 10px;
  border-top: 1px solid var(--border-soft);
  margin-top: auto;
}

.project-card__manager {
  font-size: 12px;
  color: var(--text-muted);
}

.project-card__budget { font-size: 12px; font-weight: 700; }

/* ==========================================================================
   Projects list
   ========================================================================== */

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.filter {
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  background: var(--surface);
  color: var(--text-body);
  border: 1px solid var(--border-strong);
}

.filter:hover { border-color: var(--border-hover); }

.filter.is-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* ==========================================================================
   Project detail
   ========================================================================== */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 16px;
}

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

.detail-header {
  padding: 24px;
  margin-bottom: 16px;
}

.detail-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-header__title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.detail-header__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 21px;
}

.detail-header__meta {
  font-size: 13.5px;
  color: var(--text-muted);
}

.detail-header__actions { display: flex; gap: 8px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid oklch(93% 0.006 250);
}

.stat__label {
  font-size: 11.5px;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 4px;
}

.stat__value { font-size: 15px; font-weight: 700; }

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}

.tab {
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 700;
  color: oklch(50% 0.015 255);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

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

.tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.detail-split {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}

.goals {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.goal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 12px;
}

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

.goal__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.goal__name { font-size: 13.5px; font-weight: 700; }

.goal__figures {
  font-size: 12.5px;
  font-weight: 700;
  color: oklch(50% 0.015 255);
  white-space: nowrap;
}

.team {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.team__member {
  display: flex;
  align-items: center;
  gap: 10px;
}

.team__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary-avatar-bg);
  color: var(--primary-avatar-fg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.team__name { font-size: 13px; font-weight: 700; }
.team__role { font-size: 11.5px; color: var(--text-soft); }

.log { display: flex; flex-direction: column; }

.log__row {
  display: grid;
  grid-template-columns: 100px 44px 1fr 90px 130px;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}

.log__row:last-child { border-bottom: none; }

.log__date {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 600;
}

.log__thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: repeating-linear-gradient(45deg,
    oklch(92% 0.006 250), oklch(92% 0.006 250) 4px,
    oklch(96% 0.006 250) 4px, oklch(96% 0.006 250) 8px);
}

.log__activity { font-size: 13.5px; font-weight: 600; }
.log__percent { font-size: 13px; font-weight: 700; }
.log__responsible { font-size: 12.5px; color: var(--text-muted); }

/* ==========================================================================
   Mobile field app overlay
   ========================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  background: oklch(20% 0.01 255 / 62%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 50;
}

.overlay[hidden] { display: none; }

.overlay__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 100%;
}

.overlay__close {
  text-align: center;
  margin-top: 16px;
  color: white;
  font-size: 13px;
  font-weight: 700;
}

/* --- Android device frame (port of android-frame.jsx) --- */

.android {
  --md-surface: #f4fbf8;
  --md-on-surface: #171d1b;
  --md-on-surface-var: #49454f;
  --md-frame-border: rgba(116, 119, 117, 0.5);

  width: 412px;
  /* Nominal device height, capped so the frame always fits the viewport
     (the overlay adds 48px of padding plus the close button below). */
  height: min(892px, calc(100vh - 100px));
  flex-shrink: 0;
  border-radius: 18px;
  overflow: hidden;
  background: var(--md-surface);
  border: 8px solid var(--md-frame-border);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  font-family: Roboto, system-ui, sans-serif;
}

.android__status {
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  position: relative;
  flex-shrink: 0;
}

.android__time {
  width: 128px;
  font-size: 14px;
  letter-spacing: 0.25px;
  line-height: 20px;
  color: var(--md-on-surface);
}

.android__punch {
  position: absolute;
  left: 50%;
  top: 8px;
  transform: translateX(-50%);
  width: 24px;
  height: 24px;
  border-radius: 100px;
  background: #2e2e2e;
}

.android__status-icons {
  display: flex;
  align-items: center;
  color: var(--md-on-surface);
}

.android__status-icons svg { width: 16px; height: 16px; }
.android__status-icons svg + svg { margin-left: -2px; }
.android__status-icons svg:nth-child(2) { margin-right: 2px; }

.android__appbar {
  background: var(--md-surface);
  padding: 4px 4px 0;
  flex-shrink: 0;
}

.android__appbar-row {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.android__appbar-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.android__appbar-icon::after {
  content: '';
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--md-on-surface-var);
  opacity: 0.3;
}

.android__appbar-spacer { flex: 1; }

.android__appbar-title {
  padding: 16px 16px 20px;
  font-size: 28px;
  color: var(--md-on-surface);
}

.android__appbar-title--small {
  flex: 1;
  padding: 0;
  font-size: 22px;
}

.android__screen {
  flex: 1;
  overflow: auto;
  min-height: 0;
}

.android__nav {
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.android__nav::after {
  content: '';
  width: 108px;
  height: 4px;
  border-radius: 2px;
  background: var(--md-on-surface);
  opacity: 0.4;
}

/* --- Field app screen --- */

.field {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--bg);
  font-family: var(--font-body);
  color: var(--text);
}

.field__head { padding: 16px 18px 12px; }

.field__title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 17px;
}

.field__subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.field__offline {
  margin: 0 18px 12px;
  background: oklch(94% 0.06 70);
  border: 1px solid oklch(85% 0.08 70);
  border-radius: 10px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: oklch(45% 0.1 70);
}

.field__offline::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-warn);
  flex-shrink: 0;
}

.field__body {
  flex: 1;
  overflow-y: auto;
  padding: 0 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field__label {
  font-size: 12px;
  font-weight: 700;
  color: oklch(50% 0.015 255);
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

.field__value {
  background: var(--surface);
  border: 1px solid oklch(90% 0.006 250);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13.5px;
  font-weight: 600;
}

.field__progress {
  background: var(--surface);
  border: 1px solid oklch(90% 0.006 250);
  border-radius: 10px;
  padding: 16px 14px;
}

.field__progress .meter { margin-bottom: 8px; }

.field__progress-value {
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.field__photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field__photo,
.field__photo-add {
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10.5px;
  color: var(--text-soft);
  font-family: monospace;
}

.field__photo {
  background: repeating-linear-gradient(45deg,
    oklch(92% 0.006 250), oklch(92% 0.006 250) 6px,
    oklch(96% 0.006 250) 6px, oklch(96% 0.006 250) 12px);
}

.field__photo-add { border: 2px dashed var(--dot-inactive); }

.field__signature {
  height: 80px;
  border-radius: 10px;
  border: 1px solid oklch(90% 0.006 250);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: var(--text-placeholder);
  font-family: monospace;
}

.field__footer { padding: 14px 18px 20px; }

.field__submit {
  width: 100%;
  background: var(--primary);
  color: white;
  text-align: center;
  padding: 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
}

.field__submit:hover { background: var(--primary-hover); }

/* ==========================================================================
   Toolbar
   ========================================================================== */

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

.toolbar .filters { margin-bottom: 0; flex: 1; min-width: 0; }
.toolbar > .button { flex-shrink: 0; }

/* ==========================================================================
   Data table
   ========================================================================== */

.table { display: flex; flex-direction: column; }

.table__row {
  display: grid;
  grid-template-columns: 1.6fr repeat(5, 1fr);
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
  color: var(--text-muted);
}

.table--finance .table__row { grid-template-columns: 1.6fr 1fr 1fr 1fr 1.2fr 0.9fr; }

.table__row--head {
  padding-top: 0;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.table__row--total {
  border-bottom: none;
  border-top: 2px solid var(--border-strong);
  color: var(--text);
}

.table__row:last-child { border-bottom: none; }

.table__strong { font-weight: 700; color: var(--text); }
.table__negative { color: var(--status-late); font-weight: 700; }

.table__link {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
}

.table__link:hover { color: var(--primary); }

.table__bar-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.table__bar-cell .meter { flex: 1; min-width: 40px; }

.table__note {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 14px;
  max-width: 70ch;
}

/* ==========================================================================
   Timeline (Cronograma)
   ========================================================================== */

.timeline {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.timeline__head,
.timeline__row {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: center;
  gap: 16px;
}

.timeline__label {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.timeline__label--link:hover { color: var(--primary); }

.timeline__axis {
  position: relative;
  height: 20px;
}

.timeline__year {
  position: absolute;
  top: 0;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-faint);
  padding-left: 6px;
  border-left: 1px solid var(--border);
}

.timeline__track {
  position: relative;
  height: 26px;
  background: var(--track-strong);
  border-radius: 6px;
  overflow: hidden;
}

.timeline__gridline {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--border);
}

.timeline__bar {
  position: absolute;
  top: 3px;
  height: 20px;
  min-width: 4px;
  background: var(--bar-planned);
  border-radius: 5px;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.timeline__fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 5px;
}

.timeline__bar-label {
  position: relative;
  font-size: 10.5px;
  font-weight: 700;
  color: white;
  padding-left: 7px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.timeline__bar-label--outside {
  color: var(--text-muted);
  text-shadow: none;
}

.timeline__today {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--status-late);
}

.legend__swatch--ok { background: var(--status-ok); }
.legend__swatch--warn { background: var(--status-warn); }
.legend__swatch--late { background: var(--status-late); }

.legend__swatch--today {
  background: var(--status-late);
  width: 2px;
  border-radius: 0;
  height: 12px;
}

/* ==========================================================================
   Activity feed (Avance de obra)
   ========================================================================== */

.feed {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.feed__date {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.feed__entries {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.feed__entry {
  display: grid;
  grid-template-columns: 40px 1fr 160px 48px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
}

.feed__entry:hover { background: var(--surface-hover); }

.feed__thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: repeating-linear-gradient(45deg,
    oklch(92% 0.006 250), oklch(92% 0.006 250) 4px,
    oklch(96% 0.006 250) 4px, oklch(96% 0.006 250) 8px);
}

.feed__body { min-width: 0; }

.feed__activity {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
}

.feed__project {
  display: block;
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 1px;
}

.feed__percent {
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

/* ==========================================================================
   People directory
   ========================================================================== */

.people {
  display: flex;
  flex-direction: column;
}

.people__row {
  display: grid;
  grid-template-columns: 32px minmax(180px, 1fr) 2fr;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}

.people__row:last-child { border-bottom: none; }

.people__identity { min-width: 0; }

.people__projects {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.people__note {
  font-size: 12px;
  color: var(--text-soft);
}

.chip {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}

.chip:hover { filter: brightness(0.96); }

.kpi__note {
  font-size: 12px;
  color: var(--text-soft);
  margin-top: 10px;
}

.kpi-grid--three { grid-template-columns: repeat(3, 1fr); }

/* ==========================================================================
   Documents
   ========================================================================== */

.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.filter-bar__group {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.filter-bar__label {
  flex-shrink: 0;
  width: 62px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.filter-bar .filters { margin-bottom: 0; }

.filter-bar .filter {
  padding: 6px 13px;
  font-size: 12.5px;
}

.table--docs .table__row { grid-template-columns: 2.6fr 1.4fr 0.5fr 0.9fr 1fr 0.9fr; }
.table--docs-scoped .table__row { grid-template-columns: 3fr 0.5fr 0.9fr 1fr 0.9fr; }

.doc__name {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.doc__name .table__strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc__tag {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  white-space: nowrap;
}

.doc__size {
  flex-shrink: 0;
  font-size: 11.5px;
  color: var(--text-faint);
}

.doc__status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 700;
  font-size: 12.5px;
}

.doc__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.table__link--muted {
  font-weight: 600;
  color: var(--text-muted);
}

.table__note--inline { margin-top: 0; }

/* ==========================================================================
   Reports
   ========================================================================== */

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.report {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
}

.report:hover { border-color: var(--border-hover); }

.report__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.report__name {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.report__periodicity {
  flex-shrink: 0;
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--text-soft);
  white-space: nowrap;
}

.report__description {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
}

.report__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 4px;
}

.report__formats,
.report__file {
  display: flex;
  align-items: center;
  gap: 6px;
}

.report__format {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--primary-soft);
  color: var(--primary-deep);
}

.report__all {
  font-size: 12.5px;
  font-style: italic;
  color: var(--text-faint);
}

.table--reports .table__row { grid-template-columns: 2fr 1.4fr 1.3fr 1fr 1fr 1fr; }

/* ==========================================================================
   Login
   ========================================================================== */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login__caja {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 30px;
}

.login__marca {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.login__sub {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 22px;
}

/* ==========================================================================
   Formularios
   ========================================================================== */

.campo { display: block; margin-bottom: 14px; }

.campo__etiqueta {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-nav);
  margin-bottom: 5px;
}

.campo__sufijo {
  font-weight: 500;
  color: var(--text-faint);
  margin-left: 5px;
}

.campo__input {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: oklch(99% 0.002 250);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
}

.campo__input:focus {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  background: var(--surface);
}

.campo__input--error { border-color: var(--status-late); }

select.campo__input { cursor: pointer; }

.campo__ayuda {
  display: block;
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 5px;
}

.form__fila {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.form__contexto {
  font-size: 13px;
  color: var(--text-soft);
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}

.form__grupo {
  border: none;
  padding: 0;
  margin: 4px 0 18px;
}

.form__error,
.aviso {
  padding: 11px 13px;
  border-radius: var(--radius-control);
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 16px;
}

.form__error,
.aviso--error {
  background: oklch(95% 0.05 25);
  color: oklch(42% 0.15 25);
}

.form__error[hidden] { display: none; }

.form__acciones {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

.form__acciones-derecha {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

.equipo-fila {
  display: grid;
  grid-template-columns: 1fr 1fr 34px;
  gap: 8px;
  margin-bottom: 8px;
}

.check {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  font-size: 13.5px;
  margin: 14px 0;
  cursor: pointer;
}

.check input { margin-top: 2px; flex-shrink: 0; }

.check small {
  display: block;
  font-size: 11.5px;
  color: var(--text-soft);
  margin-top: 2px;
  line-height: 1.4;
}

.button--bloque { width: 100%; margin-top: 8px; }
.button--pequeno { padding: 7px 13px; font-size: 12.5px; }

.button--peligro {
  background: oklch(95% 0.05 25);
  color: oklch(42% 0.15 25);
  padding: 9px 16px;
  border-radius: var(--radius-item);
  font-size: 13px;
}

.button--peligro:hover { background: oklch(92% 0.08 25); }

.button:disabled { opacity: 0.55; cursor: default; }

/* ==========================================================================
   Modal
   ========================================================================== */

.modal {
  position: fixed;
  inset: 0;
  background: oklch(20% 0.01 255 / 55%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 24px;
  overflow-y: auto;
  z-index: 60;
}

.modal[hidden] { display: none; }

.modal__caja {
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
  margin: auto 0;
}

.modal__cabecera {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}

.modal__titulo {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 800;
}

.modal__cuerpo { padding: 24px; }

body.sin-scroll { overflow: hidden; }

/* ==========================================================================
   Usuarios
   ========================================================================== */

.table--usuarios .table__row { grid-template-columns: 2fr 1.2fr 1.4fr 1fr 0.8fr 0.7fr; }

.table__acciones { text-align: right; }

.team__avatar--pequeno {
  width: 26px;
  height: 26px;
  font-size: 10.5px;
}

.chip--tenue {
  background: var(--surface-muted);
  color: var(--text-soft);
  font-weight: 600;
}

.user__datos { min-width: 0; flex: 1; }

.icon-button--salir {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  background: transparent;
  color: var(--text-soft);
}

.icon-button--salir:hover { background: var(--surface-muted); color: var(--text); }
.icon-button--salir svg { width: 15px; height: 15px; }

.icon-button--quitar {
  width: 34px;
  height: 38px;
  font-size: 13px;
  color: var(--text-soft);
}

.icon-button--quitar:hover { color: var(--status-late); }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-split,
  .detail-split { grid-template-columns: 1fr; }
  .project-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
  .search { width: 190px; }
  .timeline__head,
  .timeline__row { grid-template-columns: 140px 1fr; }
  .people__row { grid-template-columns: 32px minmax(150px, 1fr) 1.4fr; }
  .report-grid { grid-template-columns: repeat(2, 1fr); }
}
