:root {
  color-scheme: light;
  --navy-950: #061f35;
  --navy-900: #092a46;
  --navy-800: #0d3c60;
  --blue-700: #0b5f91;
  --blue-600: #1476ad;
  --blue-100: #e6f1f7;
  --blue-50: #f2f8fb;
  --slate-950: #18212c;
  --slate-800: #2b3644;
  --slate-700: #435064;
  --slate-600: #647184;
  --slate-500: #7d8897;
  --slate-300: #cbd3dd;
  --slate-200: #dce2e9;
  --slate-100: #e9edf2;
  --slate-50: #f6f8fa;
  --surface: #ffffff;
  --canvas: #f2f4f7;
  --amber-700: #975b00;
  --amber-100: #fff1cf;
  --red-700: #a7251b;
  --red-100: #fde8e6;
  --purple-700: #5b55a5;
  --purple-100: #efeffb;
  --radius-sm: 4px;
  --radius-md: 6px;
  --shadow-panel: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-login: 0 24px 64px rgba(6, 31, 53, 0.18);
}

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

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--canvas);
  color: var(--slate-950);
  font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  letter-spacing: 0;
}

[hidden] {
  display: none !important;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0 14px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    box-shadow 140ms ease;
}

button.primary {
  border-color: var(--blue-700);
  background: var(--blue-700);
  color: #ffffff;
}

button.primary:hover {
  border-color: var(--navy-800);
  background: var(--navy-800);
}

button.secondary {
  border-color: var(--slate-300);
  background: var(--surface);
  color: var(--slate-800);
}

button.secondary:hover {
  border-color: #aeb9c7;
  background: var(--slate-50);
  color: var(--slate-950);
}

button.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--slate-600);
}

button.ghost:hover {
  border-color: var(--slate-200);
  background: var(--slate-50);
  color: var(--slate-950);
}

button.danger {
  border-color: var(--red-700);
  background: var(--red-700);
  color: #ffffff;
}

button.danger:hover {
  border-color: #831b14;
  background: #831b14;
}

button.danger.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--red-700);
}

button.danger.ghost:hover {
  border-color: #f2c8c4;
  background: #fff5f4;
  color: #831b14;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0;
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(20, 118, 173, 0.14);
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-sm);
  background-color: var(--surface);
  color: var(--slate-950);
}

input,
select {
  padding: 0 11px;
}

textarea {
  padding: 9px 11px;
}

input::placeholder,
textarea::placeholder {
  color: #929cab;
  opacity: 1;
}

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

h1,
h2,
h3,
h4,
strong {
  letter-spacing: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--blue-700);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow-light {
  color: #9fc8df;
}

.icon-text-button .bi {
  font-size: 14px;
}

.field-label {
  display: grid;
  gap: 6px;
  margin: 0;
  color: var(--slate-700);
  font-size: 12px;
  font-weight: 600;
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  background:
    linear-gradient(rgba(13, 60, 96, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(13, 60, 96, 0.04) 1px, transparent 1px),
    #edf1f5;
  background-size: 32px 32px;
}

.login-shell {
  width: min(880px, 100%);
  min-height: 520px;
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(380px, 1.1fr);
  overflow: hidden;
  border: 1px solid #d3dae3;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-login);
}

.login-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 38px;
  background: var(--navy-950);
  color: #ffffff;
}

.brand-lockup,
.product-brand {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 13px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-sm);
  background: #062a48;
}

.brand-mark img {
  width: 30px;
  height: 34px;
  display: block;
  object-fit: contain;
}

.brand-name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.login-brand-panel h2 {
  max-width: 280px;
  font-size: 30px;
  line-height: 1.16;
}

.login-brand-panel p {
  max-width: 300px;
  margin-top: 14px;
  color: #b8cad9;
  font-size: 14px;
  line-height: 1.65;
}

.login-brand-panel small {
  color: #8fa9bc;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.login-card {
  align-self: center;
  display: grid;
  gap: 18px;
  padding: 52px;
}

.login-form-head {
  margin-bottom: 8px;
}

.login-card h1 {
  color: var(--slate-950);
  font-size: 28px;
  line-height: 1.2;
}

.login-form-head p {
  margin-top: 8px;
  color: var(--slate-600);
}

.input-with-icon {
  position: relative;
  display: block;
}

.input-with-icon .bi {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  color: var(--slate-500);
  transform: translateY(-50%);
}

.input-with-icon input {
  height: 44px;
  padding-left: 37px;
}

.login-submit {
  min-height: 44px;
  justify-content: space-between;
  margin-top: 2px;
}

.error {
  min-height: 20px;
  color: var(--red-700);
  font-size: 12px;
}

.app {
  width: 100%;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: 64px;
  border-bottom: 1px solid #153e5e;
  background: var(--navy-950);
  color: #ffffff;
}

.topbar-inner {
  width: min(1480px, calc(100% - 40px));
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto;
}

.product-brand {
  gap: 11px;
}

.product-brand .brand-mark {
  width: 34px;
  height: 34px;
}

.product-brand .brand-mark img {
  width: 27px;
  height: 30px;
}

.product-name {
  display: grid;
  line-height: 1.15;
}

.product-name strong {
  font-size: 15px;
  letter-spacing: 0.08em;
}

.product-name small {
  margin-top: 3px;
  color: #adc2d1;
  font-size: 11px;
}

.session-box {
  display: flex;
  align-items: center;
  gap: 9px;
}

.session-avatar,
.user-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
}

.session-avatar {
  width: 32px;
  height: 32px;
  background: #164a70;
  color: #d9e9f3;
}

.session-user {
  display: grid;
  min-width: 100px;
  line-height: 1.15;
}

.session-user strong {
  font-size: 12px;
}

.session-user span {
  margin-top: 3px;
  color: #a9bfce;
  font-size: 10px;
}

.topbar button.ghost {
  min-height: 34px;
  margin-left: 7px;
  color: #dbe7ef;
}

.topbar button.ghost:hover {
  border-color: #315773;
  background: #103a5a;
  color: #ffffff;
}

.workspace {
  width: min(1480px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.page-heading h1 {
  font-size: 26px;
  line-height: 1.2;
}

.page-heading p {
  margin-top: 7px;
  color: var(--slate-600);
  font-size: 13px;
}

.realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  background: var(--surface);
  padding: 7px 11px;
  color: var(--slate-600);
  font-size: 11px;
  font-weight: 600;
  box-shadow: var(--shadow-panel);
}

.realtime-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue-600);
  box-shadow: 0 0 0 3px rgba(20, 118, 173, 0.12);
}

.panel,
.companies-board-wrap {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-panel);
}

.panel {
  padding: 20px;
}

.panel + .panel,
.panel + .companies-board-wrap,
.companies-board-wrap + .panel {
  margin-top: 16px;
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 18px;
}

.section-heading-actions {
  align-items: flex-start;
}

.section-heading-copy {
  min-width: 180px;
}

.section-heading h2,
.board-heading h2 {
  color: var(--slate-950);
  font-size: 16px;
  line-height: 1.25;
}

.section-heading p,
.board-heading p {
  margin-top: 4px;
  color: var(--slate-600);
  font-size: 12px;
}

.section-icon {
  width: 34px;
  height: 34px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 16px;
}

.company-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(260px, 1.5fr) 190px 150px auto;
  gap: 12px;
  align-items: end;
}

.form-submit {
  min-height: 38px;
}

.picker-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}

.filter-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--slate-50);
}

.search-field {
  position: relative;
  display: block;
}

.search-field .bi {
  position: absolute;
  top: 50%;
  left: 12px;
  z-index: 1;
  color: var(--slate-500);
  transform: translateY(-50%);
}

.search-field input {
  padding-left: 37px;
}

.date-filter {
  display: grid;
  grid-template-columns: 230px auto;
  gap: 8px;
}

.company-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  max-height: 220px;
  overflow: auto;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.company-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 17px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0;
  border-right: 1px solid var(--slate-100);
  border-bottom: 1px solid var(--slate-100);
  padding: 9px 11px;
  color: var(--slate-700);
  cursor: pointer;
}

.company-option:hover {
  background: var(--slate-50);
  color: var(--slate-950);
}

.company-option.selected {
  background: var(--blue-50);
  color: var(--navy-800);
}

.company-option input {
  width: 15px;
  height: 15px;
  min-height: 0;
  margin: 0;
  border-color: var(--slate-300);
  accent-color: var(--blue-700);
}

.company-option strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-panel {
  margin-top: 16px;
}

.user-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 180px 190px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--slate-200);
}

.list-caption,
.user-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px 150px;
  gap: 16px;
  align-items: center;
}

.list-caption {
  padding: 7px 12px;
  border-bottom: 1px solid var(--slate-300);
  background: var(--slate-50);
  color: var(--slate-600);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.users-list {
  border: 1px solid var(--slate-200);
  border-top: 0;
}

.user-row {
  min-height: 50px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--slate-100);
}

.user-row:last-child {
  border-bottom: 0;
}

.user-row:hover {
  background: var(--slate-50);
}

.user-identity {
  display: flex;
  align-items: center;
  gap: 9px;
}

.user-avatar {
  width: 28px;
  height: 28px;
  background: var(--blue-100);
  color: var(--blue-700);
}

.user-identity strong {
  font-size: 13px;
}

.role-badge {
  width: max-content;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--slate-300);
  border-radius: 999px;
  background: var(--slate-50);
  padding: 4px 8px;
  color: var(--slate-600);
  font-size: 10px;
  font-weight: 700;
}

.role-badge.admin {
  border-color: #b7d2e2;
  background: var(--blue-50);
  color: var(--blue-700);
}

.user-action {
  display: flex;
  justify-content: flex-end;
  color: var(--slate-500);
  font-size: 11px;
}

.user-action button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 11px;
}

.companies-board-wrap {
  overflow: visible;
  margin-top: 16px;
  padding: 0;
}

.board-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 70px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--slate-200);
}

.companies-board {
  display: grid;
}

.company-card {
  position: relative;
  border-bottom: 1px solid var(--slate-200);
  background: var(--surface);
}

.company-card:last-child {
  border-bottom: 0;
}

.company-card-head {
  width: 100%;
  min-height: 82px;
  display: grid;
  grid-template-columns: minmax(190px, 1fr) minmax(300px, 1.6fr) minmax(190px, 0.65fr) 28px;
  gap: 22px;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  padding: 14px 20px;
  color: var(--slate-950);
  text-align: left;
  white-space: normal;
}

.company-card-head:hover {
  background: var(--slate-50);
}

.company-card.open .company-card-head {
  position: sticky;
  top: 64px;
  z-index: 20;
  border-bottom: 1px solid #bfd2df;
  background: var(--blue-50);
  box-shadow: 0 2px 4px rgba(16, 24, 40, 0.05);
}

.company-identity,
.company-reference,
.company-progress {
  min-width: 0;
}

.company-identity {
  display: grid;
  gap: 5px;
}

.company-nickname {
  overflow: hidden;
  color: var(--navy-900);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-detail {
  overflow: hidden;
  color: var(--slate-600);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-reference {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(80px, 0.35fr);
  gap: 22px;
}

.company-reference span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.company-reference small {
  color: var(--slate-500);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.company-reference strong {
  overflow: hidden;
  color: var(--slate-700);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-progress {
  display: grid;
  gap: 8px;
}

.company-progress > span:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.company-progress strong {
  color: var(--blue-700);
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}

.company-progress small {
  color: var(--slate-600);
  font-size: 10px;
}

.progress-track {
  height: 5px;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: var(--slate-200);
}

.progress-fill {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--blue-600);
}

.chevron {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--slate-200);
  border-radius: 50%;
  color: var(--slate-600);
  font-size: 12px;
}

.company-card.open .chevron {
  border-color: #aac7d9;
  background: var(--surface);
  color: var(--blue-700);
}

.company-card-body {
  display: none;
  background: #f8fafc;
}

.company-card.open .company-card-body {
  display: grid;
}

.company-body-section,
.branches-section {
  padding: 20px;
  border-bottom: 1px solid var(--slate-200);
}

.company-card-body > :last-child {
  border-bottom: 0;
}

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

.subsection-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--slate-800);
}

.subsection-title .bi {
  color: var(--blue-700);
}

.company-section-head h3 {
  font-size: 14px;
  line-height: 1.2;
}

.small-action {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
}

.implementation-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  gap: 12px;
}

.implementation-fields label {
  display: grid;
  gap: 5px;
  color: var(--slate-600);
  font-size: 10px;
  font-weight: 700;
}

.implementation-fields input,
.implementation-fields select {
  min-height: 36px;
  font-size: 12px;
}

.date-mask {
  font-variant-numeric: tabular-nums;
}

.implementation-readonly {
  display: grid;
  grid-template-columns: repeat(4, minmax(145px, 1fr));
  border: 1px solid var(--slate-200);
  background: var(--surface);
}

.implementation-readonly span {
  min-height: 44px;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border-right: 1px solid var(--slate-100);
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
  font-size: 11px;
}

.implementation-readonly strong {
  color: var(--slate-500);
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.branches-list {
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.branch-list-head,
.branch-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 0.7fr) minmax(180px, 1fr) 54px;
  gap: 14px;
  align-items: center;
}

.branch-list-head {
  min-height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid var(--slate-300);
  background: var(--slate-50);
  color: var(--slate-600);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.branch-list-head span:last-child {
  text-align: right;
}

.branch-row {
  min-height: 46px;
  padding: 7px 12px;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
  font-size: 12px;
}

.branch-row:last-child {
  border-bottom: 0;
}

.branch-row:hover {
  background: var(--slate-50);
}

.icon-action {
  width: 30px;
  min-height: 30px;
  justify-self: end;
  padding: 0;
}

.branch-form,
.branch-edit-form {
  display: none;
  grid-template-columns: minmax(180px, 1fr) minmax(130px, 0.65fr) minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.branch-form {
  grid-template-columns: minmax(180px, 1fr) minmax(130px, 0.65fr) minmax(180px, 1fr) auto;
}

.branch-form.open,
.branch-edit-form {
  display: grid;
}

.branch-form input,
.branch-edit-form input {
  min-height: 36px;
  font-size: 12px;
}

.branch-form button,
.branch-edit-form button {
  min-height: 36px;
  font-size: 11px;
}

.macro-phases {
  overflow: hidden;
  border: 1px solid var(--slate-200);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.macro-phase {
  border-bottom: 1px solid var(--slate-200);
}

.macro-phase:last-child {
  border-bottom: 0;
}

.macro-phase-head {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(330px, 0.8fr);
  gap: 20px;
  align-items: center;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  padding: 10px 14px;
  color: var(--slate-950);
  text-align: left;
  white-space: normal;
}

.macro-phase-head:hover {
  background: var(--slate-50);
}

.macro-phase.open .macro-phase-head {
  border-bottom: 1px solid var(--slate-200);
  background: var(--blue-50);
}

.macro-phase-title,
.macro-phase-summary {
  display: flex;
  align-items: center;
}

.macro-phase-title {
  min-width: 0;
  gap: 10px;
}

.macro-phase-title h4 {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.macro-phase-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--blue-100);
  color: var(--blue-700);
}

.macro-phase:nth-child(2) .macro-phase-icon {
  background: #e9f1fb;
  color: #2f6fb0;
}

.macro-phase:nth-child(3) .macro-phase-icon {
  background: var(--purple-100);
  color: var(--purple-700);
}

.macro-phase:nth-child(4) .macro-phase-icon {
  background: var(--amber-100);
  color: var(--amber-700);
}

.macro-phase:nth-child(5) .macro-phase-icon {
  background: #f7e9ed;
  color: #9b3d50;
}

.macro-phase-summary {
  justify-content: flex-end;
  gap: 12px;
}

.macro-phase-count {
  color: var(--slate-600);
  font-size: 11px;
}

.macro-phase-summary .progress-track {
  width: 120px;
}

.macro-phase-summary strong {
  width: 38px;
  color: var(--blue-700);
  font-size: 12px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.macro-phase-summary > .bi {
  width: 16px;
  color: var(--slate-600);
  text-align: center;
}

.stages-list {
  display: none;
  background: #fbfcfd;
}

.macro-phase.open .stages-list {
  display: block;
}

.stages-list-head,
.stage-field {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 170px minmax(260px, 1fr);
  gap: 12px;
  align-items: center;
}

.stages-list-head {
  min-height: 34px;
  padding: 0 14px;
  border-bottom: 1px solid var(--slate-200);
  color: var(--slate-500);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.stage-field {
  min-height: 58px;
  margin: 0;
  padding: 9px 14px;
  border-bottom: 1px solid var(--slate-100);
  background: var(--surface);
}

.stage-field:last-child {
  border-bottom: 0;
}

.stage-field:hover {
  background: var(--slate-50);
}

.stage-title {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--slate-700);
  font-size: 12px;
  line-height: 1.35;
}

.stage-title strong {
  font-weight: 600;
}

.stage-status-mark {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 4px;
  border: 1px solid var(--slate-300);
  border-radius: 50%;
  background: var(--slate-100);
}

.stage-title.em_andamento .stage-status-mark {
  border-color: #d9a43c;
  background: #e7ad3d;
}

.stage-title.concluido .stage-status-mark {
  border-color: var(--blue-600);
  background: var(--blue-600);
}

.stage-title.bloqueado .stage-status-mark {
  border-color: var(--red-700);
  background: var(--red-700);
}

.stage-controls {
  display: contents;
}

.status {
  width: 100%;
  min-height: 36px;
  font-size: 11px;
  font-weight: 600;
}

.status.nao_iniciado {
  border-color: var(--slate-300);
  background-color: var(--slate-50);
  color: var(--slate-600);
}

.status.em_andamento {
  border-color: #e1b557;
  background-color: #fff8e8;
  color: var(--amber-700);
}

.status.concluido {
  border-color: #9fc6dc;
  background-color: var(--blue-50);
  color: var(--blue-700);
}

.status.bloqueado {
  border-color: #e9a7a1;
  background-color: #fff3f2;
  color: var(--red-700);
}

.stage-comment {
  width: 100%;
  min-height: 38px;
  max-height: 120px;
  resize: vertical;
  border-color: var(--slate-300);
  background: var(--surface);
  font-size: 15px;
  line-height: 1.35;
}

.empty {
  display: none;
  margin: 0;
  padding: 28px 20px;
  color: var(--slate-600);
  font-size: 13px;
  text-align: center;
}

.empty-history {
  margin: 0;
  padding: 14px 12px;
  color: var(--slate-600);
  font-size: 12px;
}

.history {
  padding-bottom: 0;
}

.history-head,
.history-item {
  display: grid;
  grid-template-columns: minmax(170px, 0.65fr) minmax(280px, 1.5fr) minmax(190px, 0.7fr);
  gap: 18px;
  align-items: center;
}

.history-head {
  min-height: 34px;
  margin: 0 -20px;
  padding: 0 20px;
  border-top: 1px solid var(--slate-200);
  border-bottom: 1px solid var(--slate-300);
  background: var(--slate-50);
  color: var(--slate-600);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.history-list {
  max-height: 320px;
  overflow: auto;
  margin: 0 -20px;
}

.history-item {
  min-height: 58px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--slate-100);
}

.history-item:hover {
  background: var(--slate-50);
}

.history-action {
  color: var(--slate-800);
  font-size: 12px;
  font-weight: 700;
}

.history-details {
  color: var(--slate-700);
  font-size: 12px;
}

.history-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  color: var(--slate-600);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.history-meta .bi {
  color: var(--blue-700);
}

.history-meta small {
  flex-basis: 100%;
  margin-left: 19px;
  color: var(--slate-500);
}

@media (max-width: 1120px) {
  .company-form {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .company-form .form-submit {
    width: max-content;
  }

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

  .user-form {
    grid-template-columns: repeat(3, minmax(170px, 1fr));
  }

  .user-form .form-submit {
    width: max-content;
  }

  .company-card-head {
    grid-template-columns: minmax(180px, 0.8fr) minmax(280px, 1.2fr) minmax(170px, 0.6fr) 28px;
    gap: 16px;
  }

  .implementation-fields,
  .implementation-readonly {
    grid-template-columns: repeat(3, minmax(145px, 1fr));
  }
}

@media (max-width: 820px) {
  .login-view {
    padding: 18px;
  }

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

  .login-brand-panel {
    min-height: 190px;
    gap: 22px;
    padding: 28px;
  }

  .login-brand-panel h2 {
    font-size: 23px;
  }

  .login-brand-panel p {
    margin-top: 8px;
  }

  .login-brand-panel small {
    display: none;
  }

  .login-card {
    padding: 32px 28px;
  }

  .topbar-inner,
  .workspace {
    width: min(100% - 24px, 1480px);
  }

  .session-avatar {
    display: none;
  }

  .session-user {
    min-width: 0;
  }

  .page-heading,
  .section-heading-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .page-heading {
    display: flex;
  }

  .picker-actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .filter-toolbar {
    grid-template-columns: 1fr;
  }

  .date-filter {
    grid-template-columns: minmax(180px, 1fr) auto;
  }

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

  .user-form {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .list-caption {
    display: none;
  }

  .users-list {
    border-top: 1px solid var(--slate-200);
  }

  .user-row {
    grid-template-columns: minmax(160px, 1fr) auto;
  }

  .user-action {
    grid-column: 2;
  }

  .company-card-head {
    grid-template-columns: minmax(180px, 1fr) minmax(170px, 0.7fr) 28px;
  }

  .company-reference {
    display: none;
  }

  .implementation-fields,
  .implementation-readonly {
    grid-template-columns: repeat(2, minmax(145px, 1fr));
  }

  .branch-list-head {
    display: none;
  }

  .branch-row {
    grid-template-columns: repeat(2, minmax(140px, 1fr)) 34px;
  }

  .branch-row span:nth-child(3) {
    grid-column: 1 / 3;
  }

  .branch-row span::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 2px;
    color: var(--slate-500);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
  }

  .branch-row .icon-action {
    grid-column: 3;
    grid-row: 1 / 3;
  }

  .branch-form,
  .branch-edit-form {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .macro-phase-head {
    grid-template-columns: minmax(180px, 1fr) auto;
  }

  .macro-phase-count,
  .macro-phase-summary .progress-track {
    display: none;
  }

  .stages-list-head {
    display: none;
  }

  .stage-field {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 14px;
  }

  .stage-controls {
    display: grid;
    grid-template-columns: 160px minmax(200px, 1fr);
    gap: 8px;
  }

  .history-head {
    display: none;
  }

  .history-list {
    border-top: 1px solid var(--slate-200);
  }

  .history-item {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .history-meta small {
    flex-basis: auto;
    margin-left: 0;
  }
}

@media (max-width: 560px) {
  .workspace {
    padding-top: 20px;
  }

  .product-name small,
  .session-role {
    display: none;
  }

  .session-user span {
    display: none;
  }

  .topbar button.ghost {
    width: 34px;
    padding: 0;
    font-size: 0;
  }

  .topbar button.ghost .bi {
    font-size: 15px;
  }

  .page-heading {
    align-items: flex-start;
  }

  .page-heading h1 {
    font-size: 22px;
  }

  .realtime-badge {
    align-self: flex-start;
  }

  .panel {
    padding: 16px;
  }

  .company-form,
  .user-form,
  .date-filter {
    grid-template-columns: 1fr;
  }

  .company-form .form-submit,
  .user-form .form-submit,
  .date-filter button {
    width: 100%;
  }

  .picker-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .picker-actions button:first-child {
    grid-column: 1 / -1;
  }

  .company-options {
    grid-template-columns: 1fr;
  }

  .user-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .user-action {
    grid-column: 1;
    justify-content: flex-start;
  }

  .board-heading {
    padding: 15px 16px;
  }

  .company-card-head {
    grid-template-columns: minmax(0, 1fr) 28px;
    gap: 12px;
    padding: 13px 16px;
  }

  .company-progress {
    grid-column: 1;
  }

  .chevron {
    grid-column: 2;
    grid-row: 1 / 3;
  }

  .company-body-section,
  .branches-section {
    padding: 16px;
  }

  .company-section-head {
    align-items: flex-start;
  }

  .implementation-fields,
  .implementation-readonly {
    grid-template-columns: 1fr;
  }

  .branch-row {
    grid-template-columns: 1fr 34px;
  }

  .branch-row span:nth-child(3) {
    grid-column: 1;
  }

  .branch-row .icon-action {
    grid-column: 2;
    grid-row: 1 / 4;
  }

  .branch-form,
  .branch-edit-form {
    grid-template-columns: 1fr;
  }

  .macro-phase-head {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .macro-phase-title h4 {
    white-space: normal;
  }

  .macro-phase-summary {
    gap: 6px;
  }

  .stage-controls {
    grid-template-columns: 1fr;
  }

  .history-head,
  .history-list {
    margin-right: -16px;
    margin-left: -16px;
  }

  .history-item {
    padding-right: 16px;
    padding-left: 16px;
  }
}
