:root {
  color-scheme: light;
  --bg: #f5f2ed;
  --surface: #ffffff;
  --surface-2: #eee9df;
  --ink: #111111;
  --muted: #6c6a64;
  --line: #ded7ca;
  --accent: #111111;
  --accent-2: #c79b3b;
  --accent-3: #9b7a2f;
  --danger: #9f3a3a;
  --success: #111111;
  --warning: #9b7a2f;
  --shadow: 0 22px 60px rgba(17, 17, 17, 0.09);
  font-family: "Open Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.auth-gate {
  display: none;
}

.v2-mode:not(.authenticated) .app-shell {
  display: none;
}

.v2-mode:not(.authenticated) .auth-gate {
  min-height: 100vh;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 30px;
  padding: 32px 20px;
  background: #f5f2ed;
}

.v2-mode.authenticated .auth-gate {
  display: none;
}

.auth-brand {
  width: min(420px, 100%);
  display: flex;
  align-items: center;
  gap: 14px;
}

.auth-brand img {
  width: 96px;
  height: auto;
  display: block;
}

.auth-brand strong,
.auth-brand span {
  display: block;
}

.auth-brand strong {
  font-size: 22px;
}

.auth-brand span {
  color: var(--muted);
  margin-top: 3px;
  font-size: 14px;
}

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

.auth-form h1 {
  margin: -8px 0 4px;
  font-size: 28px;
  line-height: 1.2;
}

.auth-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 12px;
}

.auth-form input:focus {
  outline: 2px solid rgba(199, 155, 59, 0.3);
  border-color: var(--accent-2);
}

.auth-submit {
  width: 100%;
  min-height: 46px;
}

.auth-error {
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 13px;
  line-height: 1.45;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

.app-shell.sidebar-collapsed {
  grid-template-columns: 82px minmax(0, 1fr);
}

.session-identity {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  min-width: 210px;
}

.session-identity span,
.session-identity strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-identity span {
  color: var(--muted);
  font-size: 12px;
}

.session-identity strong {
  font-size: 14px;
}

.session-identity .ghost-button {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.sync-conflict {
  margin: 0 32px 16px;
  padding: 12px 14px;
  border: 1px solid rgba(159, 58, 58, 0.35);
  border-radius: 8px;
  background: #fff7f4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.sync-conflict div,
.sync-conflict strong,
.sync-conflict span {
  display: block;
}

.sync-conflict span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.sidebar {
  background: #ffffff;
  color: #111111;
  border-right: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 26px;
  position: sticky;
  top: 0;
  height: 100vh;
  transition: padding 180ms ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 78px;
  height: auto;
  display: block;
  flex: 0 0 auto;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.sidebar-toggle {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f0;
  color: #111111;
  min-height: 38px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
}

.sidebar-toggle:hover {
  border-color: rgba(199, 155, 59, 0.75);
  background: #fffaf0;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  border: 0;
  background: transparent;
  color: #111111;
  text-align: left;
  padding: 12px 14px;
  border-radius: 8px;
  min-height: 44px;
  overflow: hidden;
  white-space: nowrap;
}

.nav-item:hover,
.nav-item.active {
  background: #111111;
  color: #ffffff;
}

.sidebar-card {
  margin-top: auto;
  background: #111111;
  border: 1px solid #111111;
  border-radius: 8px;
  padding: 16px;
}

.sidebar-card span {
  color: rgba(255, 255, 255, 0.64);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-card strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  color: #ffffff;
}

.sidebar-card p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
  line-height: 1.45;
}

.app-shell.sidebar-collapsed .sidebar {
  padding: 18px 10px;
  gap: 18px;
}

.app-shell.sidebar-collapsed .brand {
  justify-content: center;
}

.app-shell.sidebar-collapsed .brand-logo {
  width: 46px;
}

.app-shell.sidebar-collapsed .brand div,
.app-shell.sidebar-collapsed .sidebar-card {
  display: none;
}

.app-shell.sidebar-collapsed .sidebar-toggle {
  min-height: 36px;
  padding: 0;
}

.app-shell.sidebar-collapsed .nav-item {
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 0;
}

.app-shell.sidebar-collapsed .nav-item::after {
  content: attr(data-short);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
}

.workspace {
  padding: 28px;
  overflow: visible;
}

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

.topbar h1,
.panel h2,
.presentation-hero h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
}

.brand-subtitle {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-start;
}

.approve-action {
  display: grid;
  gap: 6px;
  justify-items: end;
}

.approve-context {
  max-width: 280px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.active-context {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  margin-bottom: 24px;
  padding: 16px 18px;
  border: 1px solid rgba(199, 155, 59, 0.55);
  border-radius: 8px;
  background: #faf7f0;
  box-shadow: var(--shadow);
}

.active-context.neutral {
  border-color: var(--line);
  background: var(--surface);
}

.active-context.neutral .context-kicker {
  color: var(--muted);
}

.context-kicker {
  margin: 0 0 6px;
  color: var(--accent-2);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.context-title {
  display: block;
  font-size: 20px;
  line-height: 1.2;
}

.context-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.context-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.primary-button,
.secondary-button,
.ghost-button,
.icon-button {
  border-radius: 8px;
  border: 1px solid transparent;
  min-height: 40px;
  padding: 0 16px;
  font-weight: 700;
}

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

.secondary-button {
  background: var(--ink);
  color: white;
}

.ghost-button {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.icon-button {
  width: 40px;
  padding: 0;
  background: var(--surface-2);
  color: var(--ink);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric {
  padding: 18px;
}

.metric[data-dashboard-filter] {
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.metric[data-dashboard-filter]:hover,
.metric[data-dashboard-filter]:focus-visible {
  border-color: rgba(199, 155, 59, 0.72);
  box-shadow: inset 0 0 0 1px rgba(199, 155, 59, 0.28), var(--shadow);
  outline: none;
}

.metric.active {
  border-color: rgba(199, 155, 59, 0.9);
  box-shadow: inset 0 0 0 2px rgba(199, 155, 59, 0.34), var(--shadow);
  background: #fffdf8;
}

.metric span {
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 26px;
  margin-top: 8px;
}

.metric p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.4;
  font-size: 13px;
}

.dashboard-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 380px);
  gap: 18px;
  align-items: start;
}

.card-focus-mode .metric-grid {
  display: none;
}

.card-focus-mode .calendar-panel {
  display: none;
}

.card-focus-mode .workspace-panel {
  min-width: 0;
}

.dashboard-side {
  display: grid;
  gap: 14px;
  align-content: start;
  position: sticky;
  top: 18px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  padding-right: 2px;
}

.lifecycle-panel {
  margin-top: 0;
}

.lifecycle-panel .panel-header {
  margin-bottom: 10px;
}

.lifecycle-panel .panel-header h2 {
  font-size: 18px;
}

.panel {
  padding: 20px;
  overflow: hidden;
}

.calendar-panel {
  margin-bottom: 18px;
  overflow: visible;
}

.calendar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.calendar-actions .ghost-button {
  min-height: 34px;
  padding: 0 11px;
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calendar-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.calendar-dot.lead {
  background: #cf4a2f;
}

.calendar-dot.estimate {
  background: #d68a1f;
}

.calendar-dot.project {
  background: #3b8d45;
}

.calendar-day.lead,
.calendar-day.has-lead {
  background: #ffe5df;
  color: #8a2d1c;
}

.calendar-day.estimate,
.calendar-day.has-estimate {
  background: #fff1d7;
  color: #80510a;
}

.calendar-day.project,
.calendar-day.has-project {
  background: #e4f4e5;
  color: #245f2a;
}

.calendar-day.mixed {
  background: #fffdf8;
  color: var(--ink);
}

.year-calendar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.calendar-carousel {
  align-items: start;
}

.calendar-month {
  position: relative;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf8;
  overflow: visible;
}

.calendar-month h3 {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.2;
  text-transform: capitalize;
}

.calendar-weekdays,
.calendar-days {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  overflow: visible;
}

.calendar-weekdays {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-align: center;
}

.calendar-day,
.calendar-empty,
.calendar-day-wrap {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 24px;
  border-radius: 6px;
  font-size: 11px;
  line-height: 1;
}

.calendar-day-wrap {
  position: relative;
  overflow: visible;
}

.calendar-day-wrap.has-tooltip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  z-index: 19;
  display: none;
  width: min(320px, 82vw);
  height: 18px;
  transform: translateX(-50%);
}

.calendar-day-wrap.has-tooltip:hover::before,
.calendar-day-wrap.has-tooltip:focus-within::before {
  display: block;
}

.calendar-day {
  border: 1px solid transparent;
  color: var(--muted);
}

button.calendar-day {
  position: relative;
  width: 100%;
  padding: 0;
  border-color: rgba(0, 0, 0, 0.04);
  font-weight: 900;
  cursor: pointer;
}

button.calendar-day:hover,
button.calendar-day:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(199, 155, 59, 0.2);
}

button.calendar-day.selected {
  border-color: var(--ink);
  box-shadow: 0 0 0 2px rgba(17, 17, 17, 0.16);
}

.calendar-day .calendar-count {
  position: absolute;
  right: -2px;
  top: -3px;
  display: grid;
  place-items: center;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--ink);
  color: white;
  font-size: 8px;
  line-height: 1;
}

.calendar-status-dots {
  position: absolute;
  left: 4px;
  bottom: 3px;
  display: flex;
  gap: 2px;
  pointer-events: none;
}

.calendar-status-dot {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.9);
}

.calendar-status-dot.lead {
  background: #cf4a2f;
}

.calendar-status-dot.estimate {
  background: #d68a1f;
}

.calendar-status-dot.project {
  background: #3b8d45;
}

.calendar-tooltip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  z-index: 20;
  width: min(320px, 82vw);
  padding: 10px 12px;
  border: 1px solid rgba(199, 155, 59, 0.5);
  border-radius: 8px;
  background: #fffdfa;
  box-shadow: 0 18px 36px rgba(35, 30, 22, 0.16);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.14s ease 0.16s, transform 0.14s ease 0.16s, visibility 0s linear 0.3s;
}

.calendar-tooltip::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 10px;
  height: 10px;
  border-right: 1px solid rgba(199, 155, 59, 0.5);
  border-bottom: 1px solid rgba(199, 155, 59, 0.5);
  background: #fffdfa;
  transform: translate(-50%, -5px) rotate(45deg);
}

.calendar-tooltip strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.calendar-tooltip ol {
  margin: 0;
  padding-left: 18px;
}

.calendar-tooltip li + li {
  margin-top: 5px;
}

.calendar-tooltip-event {
  appearance: none;
  width: 100%;
  padding: 4px 5px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.calendar-tooltip-event:hover,
.calendar-tooltip-event:focus-visible {
  background: #fff6df;
  outline: none;
}

.calendar-tooltip li span {
  display: inline-block;
  margin-right: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--accent-3);
  background: #fff6df;
  font-weight: 900;
}

.calendar-tooltip-kind.lead {
  background: #ffe5df;
  color: #8a2d1c;
}

.calendar-tooltip-kind.estimate {
  background: #fff1d7;
  color: #80510a;
}

.calendar-tooltip-kind.project {
  background: #e4f4e5;
  color: #245f2a;
}

.calendar-tooltip li em {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-style: normal;
}

.calendar-tooltip-event > strong {
  display: inline;
  margin: 0;
  font-size: 12px;
}

.calendar-day-wrap:hover .calendar-tooltip,
.calendar-day-wrap:focus-within .calendar-tooltip {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
  transition-delay: 0s;
}

.calendar-date-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid rgba(199, 155, 59, 0.42);
  border-radius: 8px;
  background: #fffaf0;
}

.calendar-date-toolbar strong {
  display: block;
  margin-top: 2px;
  font-size: 18px;
}

.calendar-event-card.lead {
  border-left: 4px solid #cf4a2f;
}

.calendar-event-card.estimate {
  border-left: 4px solid #d68a1f;
}

.calendar-event-card.project {
  border-left: 4px solid #3b8d45;
}

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

.panel h2 {
  font-size: 22px;
}

.risk-panel {
  padding: 16px;
}

.risk-panel .panel-header {
  margin-bottom: 10px;
}

.risk-panel .panel-header h2 {
  font-size: 18px;
}

.timeline {
  display: block;
}

.timeline-scale {
  position: relative;
  padding: 4px 2px 0;
}

.timeline-line {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 15px;
  height: 3px;
  border-radius: 999px;
  background: #e6ded1;
  overflow: hidden;
}

.timeline-line span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.timeline-points {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
}

.timeline-point {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  text-align: center;
}

.timeline-point span {
  width: 24px;
  height: 24px;
  border: 3px solid #e6ded1;
  border-radius: 50%;
  background: var(--surface);
}

.timeline-point.done span {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 4px var(--surface);
}

.timeline-point strong {
  font-size: 12px;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.timeline-scale p {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.stage-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.stage-pill {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 6px;
  align-items: baseline;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f2e8;
  padding: 8px 10px;
  color: var(--muted);
}

.stage-pill.done {
  border-color: rgba(199, 155, 59, 0.55);
  background: #fffaf0;
  color: var(--ink);
}

.stage-pill strong {
  font-size: 12px;
}

.stage-pill em {
  font-size: 12px;
  font-style: normal;
}

.readiness-scale {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.readiness-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6ded1;
}

.readiness-bar span {
  display: block;
  width: var(--progress);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.readiness-scale p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.readiness-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 10px;
}

.dashboard-side .readiness-grid {
  grid-template-columns: 1fr;
}

.readiness-item {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f0;
  padding: 12px;
  color: inherit;
  text-align: left;
}

.readiness-item:hover {
  border-color: rgba(199, 155, 59, 0.75);
  background: #fffaf0;
}

.readiness-item > span {
  grid-row: span 2;
  width: 22px;
  height: 22px;
  border: 2px solid #d8cdbc;
  border-radius: 50%;
  background: var(--surface);
}

.readiness-item.done > span {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: inset 0 0 0 4px var(--surface);
}

.readiness-item strong {
  font-size: 13px;
  line-height: 1.2;
}

.readiness-item p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.risk-item p,
.item-card p,
.project-summary p,
.empty-state p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.risk-list,
.rule-list,
.entity-switcher {
  display: grid;
  gap: 10px;
}

.brief-draft-area {
  display: grid;
  gap: 14px;
}

.brief-save-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf0;
}

.brief-draft-status {
  display: block;
  margin-top: 3px;
  font-size: 13px;
  line-height: 1.35;
}

.changed-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.changed-fields.empty {
  display: none;
}

.changed-field-chip {
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid rgba(199, 155, 59, 0.55);
  border-radius: 999px;
  background: #fff6df;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.changed-field-chip:hover,
.changed-field-chip:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.brief-draft-area.has-draft .brief-save-bar {
  border-color: rgba(199, 155, 59, 0.72);
  box-shadow: inset 0 0 0 1px rgba(199, 155, 59, 0.2);
}

.brief-save-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.brief-save-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.brief-draft-area label.is-draft-changed {
  border: 1px solid rgba(199, 155, 59, 0.78);
  border-radius: 8px;
  background: #fff8e8;
  box-shadow: inset 0 0 0 1px rgba(199, 155, 59, 0.18);
  padding: 8px;
}

.brief-draft-area label.is-draft-changed input,
.brief-draft-area label.is-draft-changed textarea,
.brief-draft-area label.is-draft-changed select {
  border-color: rgba(199, 155, 59, 0.88);
  background: #fffdfa;
}

.brief-draft-area label.is-draft-pulse {
  box-shadow: 0 0 0 4px rgba(199, 155, 59, 0.24), inset 0 0 0 1px rgba(199, 155, 59, 0.2);
}

.full-card-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.full-card-toolbar h2 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.2;
}

.risk-list {
  gap: 6px;
}

.risk-item,
.rule-item,
.task-card,
.employee-card,
.project-summary,
.finance-row,
.entity-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f0;
  padding: 14px;
}

.risk-item {
  display: grid;
  grid-template-columns: 8px minmax(92px, 0.8fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  width: 100%;
  appearance: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.risk-item:hover {
  border-color: rgba(199, 155, 59, 0.75);
  background: #fffaf0;
  transform: translateY(-1px);
}

.entity-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  text-align: left;
}

.entity-switcher > .entity-card:nth-child(odd) {
  background: #fffaf0;
}

.entity-switcher > .entity-card:nth-child(even) {
  background: #f5efe3;
}

.entity-card.archived {
  background: #f4f1ea;
  opacity: 0.86;
}

.entity-switcher > .entity-card.archived:nth-child(even) {
  background: #ece5d8;
}

.entity-card.active {
  border-color: rgba(199, 155, 59, 0.8);
  box-shadow: inset 0 0 0 1px rgba(199, 155, 59, 0.45);
  background: #fff7df;
}

.entity-accordion {
  grid-column: 1 / -1;
  padding-top: 12px;
  border-top: 1px solid rgba(199, 155, 59, 0.28);
}

.entity-accordion .workspace-card {
  box-shadow: none;
}

.entity-main {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.entity-main:hover strong {
  color: var(--accent-3);
}

.accordion-status {
  color: var(--accent-3);
  font-size: 12px;
  font-weight: 800;
  margin-top: 8px;
}

.entity-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.entity-card strong,
.entity-card span,
.entity-card p {
  display: block;
  margin: 0;
}

.entity-card p {
  color: var(--muted);
  margin-top: 4px;
}

.entity-detail {
  margin-bottom: 14px;
}

.workspace-card {
  border: 1px solid rgba(199, 155, 59, 0.45);
  border-radius: 8px;
  background: #fffdf8;
  padding: 16px;
}

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

.workspace-card h3 {
  font-size: 22px;
  margin: 4px 0 0;
}

.workspace-card-meta {
  margin-top: 12px;
}

.workspace-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.workspace-tab {
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.workspace-tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: white;
}

.workspace-card-body {
  margin-top: 14px;
}

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

.card-form-grid .wide {
  grid-column: 1 / -1;
}

.board-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.card-note {
  margin: 12px 0 0;
  color: var(--muted);
}

.card-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.labor-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.labor-summary article {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(199, 155, 59, 0.36);
  border-radius: 8px;
  background: #fffdf8;
}

.labor-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.labor-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
  line-height: 1.15;
}

.labor-summary p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.card-add-item-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f0;
}

.card-estimate-board {
  display: grid;
  gap: 12px;
}

.card-presentation-actions {
  margin-bottom: 14px;
}

.card-presentation-block {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.card-presentation-block h4 {
  margin: 0;
  font-size: 18px;
}

.references-panel {
  display: grid;
  gap: 14px;
}

.budget-panel {
  display: grid;
  gap: 14px;
}

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

.reference-intro h3 {
  margin: 0;
  font-size: 20px;
}

.reference-fields {
  margin-bottom: 14px;
}

.reference-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.reference-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fffaf0;
}

.reference-image-button,
.reference-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #eadfca;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.reference-image-button {
  border: 0;
  padding: 0;
  cursor: zoom-in;
  overflow: hidden;
}

.reference-image-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.18s ease;
}

.reference-image-button:hover img {
  transform: scale(1.03);
}

.reference-card-body {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.upload-reference-button {
  justify-content: center;
  cursor: pointer;
}

.upload-reference-button input {
  display: none;
}

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

.image-dialog {
  border: 0;
  padding: 0;
  width: min(1120px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  background: transparent;
}

.image-dialog::backdrop {
  background: rgba(17, 17, 17, 0.72);
}

.image-modal {
  background: #fffaf0;
  border-radius: 8px;
  border: 1px solid rgba(199, 155, 59, 0.28);
  padding: 16px;
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 28px);
}

.image-modal-header {
  align-items: center;
}

.image-viewer {
  position: relative;
  display: grid;
  place-items: center;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  min-height: 280px;
  max-height: calc(100vh - 190px);
}

.image-viewer img {
  max-width: 100%;
  max-height: calc(100vh - 190px);
  object-fit: contain;
  display: block;
}

.image-nav-button {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 44px;
  height: 54px;
  border: 1px solid rgba(255, 250, 240, 0.42);
  background: rgba(17, 17, 17, 0.52);
  color: #fffaf0;
  font-size: 40px;
  line-height: 1;
  display: grid;
  place-items: center;
  cursor: pointer;
  transform: translateY(-50%);
  border-radius: 8px;
}

.image-nav-button:hover:not(:disabled) {
  background: rgba(199, 155, 59, 0.82);
}

.image-nav-button:disabled {
  opacity: 0.25;
  cursor: default;
}

.image-nav-prev {
  left: 12px;
}

.image-nav-next {
  right: 12px;
}

.image-modal-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.image-modal-footer .card-note {
  margin: 0;
}

.image-counter {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.budget-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.project-summary.attention {
  border-color: rgba(181, 107, 45, 0.6);
  background: #fff6ec;
}

.budget-fields {
  margin-bottom: 14px;
}

.budget-fields button {
  width: 100%;
}

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

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

.section-head.compact h3 {
  margin: 2px 0 0;
  font-size: 18px;
}

.budget-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.2fr) minmax(90px, 0.6fr) minmax(95px, 0.6fr) minmax(120px, 0.8fr) minmax(150px, 1fr) auto;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffaf0;
}

.budget-row.over {
  border-color: rgba(181, 107, 45, 0.6);
  background: #fff6ec;
}

.budget-row-result strong,
.budget-row-result p {
  display: block;
  margin: 0;
}

.budget-row-result p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.questionnaire-card {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.inline-questionnaire {
  margin-top: 14px;
}

.compact-panel-header {
  margin-bottom: 12px;
}

.compact-panel-header h2 {
  font-size: 18px;
}

.checklist-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.card-presentation-grid,
.card-project-grid,
.card-team-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.risk-item strong,
.rule-item strong {
  display: block;
  margin-bottom: 6px;
}

.risk-item strong {
  margin-bottom: 0;
  font-size: 13px;
  line-height: 1.2;
}

.risk-item p {
  font-size: 12px;
  line-height: 1.25;
  text-align: left;
  overflow-wrap: anywhere;
}

.risk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
}

.risk-item[data-kind="ok"] {
  border-color: rgba(199, 155, 59, 0.45);
}

.risk-item[data-kind="ok"] .risk-dot {
  background: #6f8f42;
}

.risk-item[data-kind="warn"] {
  border-color: rgba(166, 107, 31, 0.45);
}

.risk-item[data-kind="warn"] .risk-dot {
  background: #b56b2d;
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.compact-label {
  gap: 5px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 11px 12px;
  min-height: 42px;
}

.voice-field {
  position: relative;
}

.voice-field-inline {
  display: block;
  width: 100%;
}

.voice-field .voice-input {
  padding-right: 48px;
}

.voice-field-button {
  position: absolute;
  right: 7px;
  bottom: 7px;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  min-height: 30px;
  border: 1px solid rgba(17, 17, 17, 0.16);
  border-radius: 50%;
  background: #f5f2ed;
  color: #111111;
  padding: 0;
}

.voice-field-button:hover,
.voice-field-button.listening {
  border-color: rgba(199, 155, 59, 0.72);
  background: #111111;
  color: #ffffff;
}

.voice-field-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.voice-field.listening .voice-input {
  border-color: rgba(199, 155, 59, 0.9);
  box-shadow: 0 0 0 3px rgba(199, 155, 59, 0.14);
}

textarea {
  resize: vertical;
}

.wide {
  grid-column: 1 / -1;
}

.estimate-board {
  display: grid;
  gap: 16px;
}

.estimate-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f0;
  overflow: hidden;
}

.estimate-block.collapsed {
  background: #f4f1ea;
}

.block-header {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 130px minmax(240px, auto);
  gap: 10px;
  align-items: center;
  padding: 12px;
  background: #efe9de;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.estimate-block.collapsed .block-header {
  border-bottom: 0;
}

.block-header input {
  font-weight: 800;
}

.block-header input,
.block-header select,
.block-header button,
.block-header label {
  cursor: auto;
}

.block-meta {
  display: grid;
  gap: 3px;
  justify-items: end;
}

.block-meta strong {
  color: var(--accent-3);
  font-size: 18px;
  font-weight: 800;
  text-align: right;
}

.block-meta span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.block-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.danger-button {
  border-color: rgba(120, 40, 30, 0.26);
  color: #7a2a20;
}

.estimate-items {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.item-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.worker-items {
  background: #f6f1e8;
}

.worker-block-note {
  margin: 0;
  padding: 10px 12px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.worker-resource-card {
  border-color: rgba(199, 155, 59, 0.42);
  background: #fffdf8;
}

.worker-resource-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.worker-resource-head strong {
  display: block;
  font-size: 16px;
}

.worker-grid {
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
}

.worker-formula {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(199, 155, 59, 0.32);
  border-radius: 8px;
  background: #faf7f0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.item-card.is-focus-target,
.reference-card.is-focus-target,
.card-form-grid label.is-focus-target,
.card-add-item-bar.is-focus-target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(199, 155, 59, 0.22);
}

.card-form-grid label.is-focus-target {
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: #fffaf0;
  padding: 8px;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 10px;
  align-items: end;
}

.item-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  align-items: center;
}

.url-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 10px;
  background: #f6f1e8;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.meta-preview img,
.meta-placeholder {
  width: 70px;
  height: 54px;
  border-radius: 8px;
  object-fit: cover;
  flex: 0 0 auto;
  background: #e3ddd2;
}

.meta-placeholder {
  display: grid;
  place-items: center;
  padding: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.meta-preview strong,
.meta-preview p {
  display: block;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.meta-preview p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
}

.check-label {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: var(--ink);
}

.check-label input {
  width: 18px;
  min-height: 18px;
}

.item-total {
  font-weight: 800;
  color: var(--accent-3);
}

.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
}

.segment {
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 6px;
  font-weight: 800;
  color: var(--muted);
}

.segment.active {
  background: white;
  color: var(--ink);
}

.presentation-panel {
  padding: 0;
}

.presentation-panel .panel-header {
  padding: 20px 20px 0;
}

.presentation-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.presentation-hero {
  min-height: 260px;
  display: flex;
  align-items: flex-end;
  padding: 28px;
  color: white;
  background:
    linear-gradient(180deg, rgba(17, 17, 17, 0.05), rgba(17, 17, 17, 0.86)),
    url("https://static.tildacdn.com/tild3036-3065-4137-b166-313536343231/1111edding_1386_resi.jpg") center / cover;
}

.presentation-hero p,
.presentation-hero span {
  display: block;
  margin: 0;
  color: rgba(255, 255, 255, 0.82);
  font-weight: 800;
}

.presentation-hero h2 {
  font-size: clamp(30px, 5vw, 58px);
  max-width: 780px;
  margin: 8px 0;
}

.presentation-grid {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.presentation-block {
  display: grid;
  gap: 12px;
}

.presentation-block h3 {
  margin: 0;
  font-size: 18px;
}

.presentation-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

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

.presentation-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #e3ddd2;
  display: block;
}

.presentation-card-body {
  padding: 12px;
}

.presentation-card-body strong {
  display: block;
  margin-bottom: 6px;
}

.presentation-card-body a {
  color: var(--accent-3);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 32px;
  text-align: center;
  background: #faf7f0;
}

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

.task-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  align-items: start;
}

.task-column {
  background: #f3eee5;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.task-column h3 {
  margin: 4px 4px 2px;
  font-size: 14px;
}

.task-card {
  background: white;
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.task-card strong,
.task-card p {
  min-width: 0;
  overflow-wrap: anywhere;
}

.task-meta,
.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  background: var(--surface-2);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.accent {
  color: #111111;
  background: rgba(199, 155, 59, 0.18);
}

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

.team-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: -4px 0 16px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.team-summary div {
  display: grid;
  gap: 3px;
  padding: 12px 14px;
}

.team-summary div + div {
  border-left: 1px solid var(--line);
}

.team-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.team-summary strong {
  font-size: 22px;
  line-height: 1;
}

.team-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px);
  gap: 12px;
  margin-bottom: 16px;
}

.team-notice {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent-2);
  background: #fffaf0;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.team-notice.error {
  border-left-color: var(--danger);
  color: var(--danger);
}

.employee-card {
  background: white;
  display: grid;
  gap: 12px;
  min-width: 0;
  border-left: 4px solid var(--accent-2);
}

.employee-card.inactive {
  border-left-color: #a8a39a;
  background: #f7f5f1;
}

.employee-card-header,
.employee-card-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.employee-card h3 {
  margin: 0;
  font-size: 17px;
  overflow-wrap: anywhere;
}

.employee-card-contact {
  display: grid;
  gap: 4px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.employee-card-contact span {
  overflow-wrap: anywhere;
}

.employee-card-footer {
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.employee-card-footer small {
  color: var(--muted);
  line-height: 1.35;
}

.employee-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.employee-status::before {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3b8d45;
  content: "";
}

.employee-status.no-access::before {
  background: #d68a1f;
}

.employee-status.inactive::before {
  background: #8e8a83;
}

.team-empty {
  grid-column: 1 / -1;
}

.employee-form-grid {
  margin-top: 18px;
}

.employee-form-grid small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
}

.team-option-group {
  margin: 18px 0 0;
  padding: 14px 0 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.team-option-group legend {
  padding: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.team-option-group > p {
  margin: 5px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.team-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 18px;
}

.team-option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  color: var(--ink);
  font-size: 13px;
}

.team-option input,
.employee-form-grid .check-label input {
  width: 18px;
  min-height: 18px;
  flex: 0 0 auto;
}

.team-option.is-disabled {
  color: var(--muted);
}

.custom-function-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.team-loading {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.team-readonly-note {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.rule-item time {
  color: var(--muted);
  font-size: 12px;
}

.launch-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(1040px, calc(100vw - 28px));
}

.launch-dialog::backdrop {
  background: rgba(17, 17, 17, 0.58);
}

.estimate-dialog {
  width: min(720px, calc(100vw - 28px));
}

.launch-modal {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.modal-header,
.modal-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0;
}

.wizard-step {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f0;
  font-weight: 800;
  color: var(--muted);
}

.wizard-step.active {
  background: var(--ink);
  color: white;
}

.template-preview {
  display: grid;
  gap: 14px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf7f0;
}

.template-preview strong {
  display: block;
  margin-top: 4px;
  line-height: 1.45;
}

.template-block-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.template-block-list span {
  padding: 8px 10px;
  border: 1px solid rgba(199, 155, 59, 0.32);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.wizard-page {
  display: none;
  min-height: 340px;
}

.wizard-page.active {
  display: block;
}

.review-grid,
.launch-team,
.generated-tasks,
.finance-preview {
  display: grid;
  gap: 12px;
}

.launch-employee {
  display: grid;
  grid-template-columns: 32px minmax(160px, 1fr) minmax(220px, 1.2fr);
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #faf7f0;
}

.launch-employee input[type="checkbox"] {
  width: 20px;
  min-height: 20px;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .metric-grid,
  .project-grid,
  .team-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-layout,
  .task-columns {
    grid-template-columns: 1fr;
  }

  .dashboard-side {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .timeline,
  .presentation-cards,
  .labor-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 780px) {
  .v2-mode:not(.authenticated) .auth-gate {
    align-content: start;
    padding-top: 52px;
  }

  .auth-brand img {
    width: 80px;
  }

  .auth-form {
    padding: 22px;
  }

  .auth-form h1 {
    font-size: 24px;
  }

  .session-identity {
    width: 100%;
  }

  .sync-conflict {
    margin: 0 16px 14px;
    align-items: stretch;
    flex-direction: column;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .app-shell.sidebar-collapsed .sidebar {
    padding: 16px;
  }

  .sidebar-toggle {
    display: none;
  }

  .app-shell.sidebar-collapsed .brand {
    justify-content: flex-start;
  }

  .app-shell.sidebar-collapsed .brand-logo {
    width: 78px;
  }

  .app-shell.sidebar-collapsed .brand div,
  .app-shell.sidebar-collapsed .sidebar-card {
    display: block;
  }

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

  .app-shell.sidebar-collapsed .nav-item {
    display: block;
    padding: 12px 14px;
    font-size: inherit;
    text-align: left;
  }

  .app-shell.sidebar-collapsed .nav-item::after {
    content: "";
  }

  .workspace {
    padding: 16px;
  }

  .topbar,
  .active-context,
  .reference-intro,
  .presentation-actions,
  .full-card-toolbar,
  .brief-save-bar,
  .panel-header,
  .modal-header,
  .modal-actions {
    flex-direction: column;
  }

  .topbar-actions,
  .approve-action,
  .context-actions,
  .presentation-actions,
  .topbar-actions button,
  .full-card-toolbar button,
  .brief-save-actions,
  .brief-save-actions button,
  .approve-context,
  .context-actions button,
  .presentation-actions button,
  .modal-actions button {
    width: 100%;
  }

  .approve-action {
    justify-items: stretch;
  }

  .approve-context {
    max-width: none;
    text-align: left;
  }

  .metric-grid,
  .year-calendar,
  .active-context,
  .form-grid,
  .board-url-row,
  .budget-summary-grid,
  .budget-row,
  .card-form-grid,
  .card-add-item-bar,
  .labor-summary,
  .timeline,
  .presentation-cards,
  .project-grid,
  .team-grid,
  .wizard-steps {
    grid-template-columns: 1fr;
  }

  .team-summary,
  .team-toolbar,
  .team-option-grid,
  .custom-function-row {
    grid-template-columns: 1fr;
  }

  .team-summary div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .employee-card-header,
  .employee-card-footer {
    align-items: stretch;
    flex-direction: column;
  }

  #employeeDialog .modal-header {
    align-items: flex-start;
    flex-direction: row;
  }

  #employeeDialog .modal-header .icon-button {
    width: 40px;
    flex: 0 0 40px;
  }

  .block-header {
    grid-template-columns: 1fr;
  }

  .block-meta {
    justify-items: start;
  }

  .block-meta strong {
    text-align: left;
  }

  .block-actions,
  .block-actions button {
    width: 100%;
  }

  .item-grid {
    grid-template-columns: 1fr;
  }

  .launch-employee {
    grid-template-columns: 28px 1fr;
  }

  .launch-employee label {
    grid-column: 1 / -1;
  }

  .entity-card {
    grid-template-columns: 1fr;
  }

  .url-meta {
    align-items: stretch;
    flex-direction: column;
  }
}
