/* Decision center interface */
:root {
  --bg: #f1f4f5;
  --panel: #ffffff;
  --panel-2: #edf1f2;
  --ink: #182229;
  --muted: #66727b;
  --line: #d9e0e4;
  --brand: #22323b;
  --brand-2: #27735c;
  --accent: #b24f3c;
  --ok: #27735c;
  --bad: #b24f3c;
  --warn: #a36e1d;
}

textarea {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

textarea:focus {
  outline: 2px solid rgba(39, 115, 92, 0.2);
  border-color: var(--brand-2);
}

.shell {
  grid-template-columns: 238px minmax(0, 1fr);
}

.sidebar {
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: start;
  background: var(--brand);
  color: #fff;
  padding: 22px 14px;
  border: 0;
}

.side-brand {
  padding: 0 8px;
  font-size: 17px;
}

.side-brand .brand-mark {
  width: 38px;
  height: 38px;
  flex-basis: 38px;
  background: #fff;
  color: var(--brand);
}

.nav {
  gap: 3px;
}

.nav button {
  min-height: 43px;
  padding: 0 12px;
  color: #c7d1d6;
  font-size: 13px;
}

.nav button.active,
.nav button:hover {
  background: #fff;
  color: var(--brand);
}

.side-footer {
  border-top-color: rgba(255, 255, 255, 0.14);
}

.side-user span,
.side-footer .notification-button {
  color: #aebbc1;
}

.side-footer .notification-button,
.sidebar .logout-action {
  border-color: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.side-footer .notification-button {
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.notification-button-main {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.notification-bell {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notification-popover {
  position: fixed;
  z-index: 6000;
  top: auto;
  right: auto;
  bottom: 76px;
  left: 14px;
}

.sidebar:has(.notification-center.open) {
  z-index: 5999;
  overflow: visible;
}

.main {
  padding: 27px 32px 36px;
}

.topbar {
  align-items: flex-end;
  margin-bottom: 18px;
}

.topbar h1 {
  font-size: 30px;
}

.panel,
.metric {
  box-shadow: none;
}

.panel-head {
  min-height: 56px;
  padding: 11px 16px;
}

.panel-head h2,
.panel-head h3 {
  font-size: 16px;
}

.panel-body.flush {
  padding: 0;
}

.link-btn {
  border: 0;
  background: transparent;
  color: var(--brand-2);
  font-weight: 800;
}

.decision-metrics,
.task-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 17px;
}

.decision-metrics > div,
.task-summary > div {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.decision-metrics span,
.task-summary span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.decision-metrics strong,
.task-summary strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 21px;
  line-height: 1.15;
}

.decision-metrics .warning {
  background: #f8efdd;
  border-color: #eadcbd;
}

.decision-metrics .warning strong {
  color: var(--warn);
}

.decision-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(310px, 0.75fr);
  gap: 16px;
  align-items: start;
}

.decision-layout > div,
.decision-aside {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.task-list {
  min-width: 0;
}

.task-row {
  position: relative;
  min-width: 0;
  min-height: 72px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) minmax(118px, auto) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 15px;
  border-bottom: 1px solid #edf0f2;
}

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

.task-row::before {
  content: "";
  position: absolute;
  inset: 10px auto 10px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: transparent;
}

.task-row.priority-high::before,
.task-row.overdue::before {
  background: var(--bad);
}

.task-row.priority-normal:not(.overdue)::before {
  background: #d8a446;
}

.task-row.status-done {
  opacity: 0.62;
}

.task-row.status-done .task-copy strong {
  text-decoration: line-through;
}

.task-check {
  width: 24px;
  height: 24px;
  padding: 0;
  border: 2px solid #b7c1c6;
  border-radius: 6px;
  background: #fff;
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.status-done .task-check {
  border-color: var(--brand-2);
  background: var(--brand-2);
}

.task-check:disabled {
  cursor: default;
}

.task-copy {
  min-width: 0;
}

.task-title-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.task-title-line strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  white-space: nowrap;
}

.task-copy > span,
.task-copy p,
.task-due span {
  color: var(--muted);
  font-size: 11px;
}

.task-copy p {
  margin: 5px 0 0;
  line-height: 1.4;
}

.task-badge {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 5px;
  background: #edf1f2;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.task-badge.danger {
  background: #f7e9e5;
  color: var(--bad);
}

.task-due {
  min-width: 118px;
  text-align: right;
}

.task-due strong,
.task-due span {
  display: block;
}

.task-due strong {
  font-size: 11px;
}

.task-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
}

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

.task-form-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.task-board,
.completed-tasks,
.project-task-panel {
  margin-bottom: 16px;
}

.completed-tasks > summary {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
}

.decision-projects .object-card {
  border-left: 0;
  border-right: 0;
  border-top: 0;
  border-radius: 0;
}

.today-row,
.foreman-work-list > div {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf0f2;
}

.today-row:last-child,
.foreman-work-list > div:last-child {
  border-bottom: 0;
}

.foreman-context {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.foreman-context > div:first-child {
  min-width: 0;
  flex: 1;
}

.foreman-context span,
.foreman-balance span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.context-project-picker {
  min-height: 47px;
  max-width: 620px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 28px;
  font-weight: 850;
}

.foreman-context p {
  margin: 2px 0 0;
  color: var(--muted);
}

.foreman-balance {
  min-width: 220px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: right;
}

.foreman-balance strong {
  font-size: 22px;
}

.foreman-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.foreman-actions button {
  min-height: 70px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 11px 16px;
  border-radius: 8px;
  color: #fff;
  text-align: left;
}

.foreman-actions strong {
  font-size: 15px;
}

.foreman-actions span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 11px;
}

.foreman-actions .expense {
  background: var(--bad);
}

.foreman-actions .income {
  background: var(--brand-2);
}

.foreman-actions .photo {
  background: var(--brand);
}

.foreman-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.foreman-home-grid > div {
  min-width: 0;
  display: grid;
  gap: 16px;
}

.operation-feed {
  min-width: 0;
  padding: 0 15px;
}

.operation-row {
  min-width: 0;
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f2;
}

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

.operation-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.operation-copy strong {
  min-width: 0;
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.operation-copy span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.operation-amount {
  min-width: 104px;
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.operation-row.expense .operation-amount {
  color: var(--bad);
}

.operation-row.fund .operation-amount {
  color: var(--ok);
}

.foreman-work-list span {
  color: var(--muted);
  font-size: 11px;
}

@media (max-width: 1080px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: 0;
    position: sticky;
    padding: 10px 14px;
    background: var(--brand);
    border-bottom: 0;
  }

  .sidebar .nav button {
    background: rgba(255, 255, 255, 0.08);
  }

  .sidebar .nav button.active {
    background: #fff;
  }

  .notification-popover {
    top: 64px;
    right: 14px;
    bottom: auto;
    left: auto;
    max-height: calc(100dvh - 78px);
  }

  .decision-layout,
  .foreman-home-grid {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 760px) {
  .main {
    padding: 14px 10px 82px;
  }

  .sidebar {
    min-height: 55px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    padding: 8px 10px;
  }

  .side-brand {
    padding: 0;
  }

  .side-footer {
    margin: 0;
    padding: 0;
    border: 0;
  }

  .side-user,
  .sidebar .logout-action {
    display: none;
  }

  .notification-label {
    display: none;
  }

  .notification-button {
    min-width: 36px;
    width: 36px;
    justify-content: center;
    padding: 8px;
  }

  .notification-button strong {
    position: absolute;
    top: -4px;
    right: -5px;
    min-width: 18px;
    width: auto;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
  }

  .notification-popover {
    top: 64px;
    right: 10px;
    bottom: auto;
    left: auto;
    width: min(380px, calc(100vw - 20px));
    max-height: calc(100dvh - 76px);
  }

  .bottom-nav {
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
    padding: 6px 5px 8px;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
    box-shadow: 0 -8px 26px rgba(20, 30, 40, 0.08);
  }

  .bottom-nav button {
    font-size: 10px;
  }

  .decision-metrics,
  .task-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-bottom: 11px;
  }

  .decision-metrics > div,
  .task-summary > div {
    padding: 10px 11px;
  }

  .decision-metrics strong,
  .task-summary strong {
    font-size: 16px;
  }

  .decision-layout,
  .decision-layout > div,
  .decision-aside,
  .foreman-home-grid,
  .foreman-home-grid > div {
    gap: 11px;
  }

  .decision-aside {
    grid-template-columns: 1fr;
  }

  .task-row {
    grid-template-columns: 24px minmax(0, 1fr) auto;
    gap: 9px;
    padding: 10px 11px;
  }

  .task-title-line {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .task-title-line strong {
    max-width: 100%;
    white-space: normal;
  }

  .task-copy > span {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
  }

  .task-due {
    min-width: 0;
    align-self: start;
  }

  .task-due strong {
    max-width: 86px;
  }

  .task-due span,
  .task-copy p,
  .task-actions {
    display: none;
  }

  .task-form {
    grid-template-columns: 1fr;
  }

  .task-form .full {
    grid-column: auto;
  }

  .foreman-context {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .context-project-picker {
    width: 100%;
    max-width: 100%;
    min-height: 40px;
    font-size: 21px;
  }

  .foreman-balance {
    min-width: 0;
    width: 100%;
    text-align: left;
  }

  .foreman-actions {
    gap: 7px;
  }

  .foreman-actions button {
    min-width: 0;
    min-height: 62px;
    padding: 9px 8px;
    text-align: center;
  }

  .foreman-actions strong {
    font-size: 12px;
  }

  .foreman-actions span {
    display: none;
  }

  .operation-feed {
    padding: 0 11px;
  }

  .operation-row {
    min-height: 58px;
    gap: 8px;
    padding: 9px 0;
  }

  .operation-copy strong {
    font-size: 12px;
  }

  .operation-copy span {
    font-size: 10px;
  }

  .operation-amount {
    min-width: 82px;
    font-size: 12px;
  }

  .topbar h1 {
    font-size: 22px;
  }
}

.role-client {
  grid-template-columns: 1fr;
}

.role-client .sidebar {
  min-height: 67px;
  position: static;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 10px 32px;
  background: #fff;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}

.role-client .side-brand .brand-mark {
  background: var(--brand);
  color: #fff;
}

.role-client .nav {
  display: none;
}

.role-client .side-footer {
  width: auto;
  margin: 0;
  padding: 0;
  flex-direction: row;
  align-items: center;
  border: 0;
}

.role-client .side-user {
  text-align: right;
}

.role-client .side-user span {
  color: var(--muted);
}

.role-client .notification-button {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.role-client .notification-popover {
  top: 76px;
  right: 32px;
  bottom: auto;
  left: auto;
}

.role-client .logout-action {
  width: auto;
  margin: 0;
  color: var(--ink);
  border-color: var(--line);
}

.client-home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}

.client-object-list {
  display: grid;
  gap: 10px;
}

.client-object-card {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, auto) auto;
  gap: 18px;
  align-items: center;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.client-object-card h3 {
  margin: 6px 0 3px;
}

.client-object-card p,
.client-approved-note p {
  margin: 0;
  color: var(--muted);
}

.client-object-numbers {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 16px;
}

.client-object-numbers span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.client-object-numbers strong {
  display: block;
  margin-top: 4px;
  white-space: nowrap;
}

.client-progress-line {
  display: none;
  height: 6px;
  overflow: hidden;
  border-radius: 4px;
  background: #e7ecee;
}

.client-progress-line span {
  display: block;
  height: 100%;
  background: var(--brand-2);
}

.client-approved-note {
  background: #e6f0ec;
  border-color: #cfe1da;
}

@media (max-width: 1080px) {
  .client-home-grid {
    grid-template-columns: 1fr;
  }

  .client-object-card {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .client-object-numbers {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .role-client .sidebar {
    min-height: 55px;
    padding: 8px 10px;
  }

  .role-client .side-footer {
    display: flex;
  }

  .role-client .side-user,
  .role-client .logout-action {
    display: none;
  }

  .role-client .notification-popover {
    top: 64px;
    right: 10px;
  }

  .client-object-card {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .client-object-numbers {
    grid-column: auto;
    gap: 8px;
  }

  .client-object-numbers strong {
    white-space: normal;
  }

  .client-progress-line {
    display: block;
  }

  .client-object-card .btn {
    width: 100%;
  }
}
