:root {
  --navy: #102234;
  --ink: #182330;
  --slate: #607080;
  --line: #dce4ea;
  --paper: #f6f8fa;
  --white: #ffffff;
  --accent: #2d8f7b;
  --accent-strong: #1e765f;
  --warn: #b65f22;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(16, 34, 52, 0.12);
  --page-pad: clamp(20px, 3vw, 42px);
  --card-pad: clamp(14px, 1.4vw, 18px);
  --sidebar-width: clamp(248px, 17vw, 292px);
  --text-sm: clamp(0.74rem, 0.72rem + 0.12vw, 0.84rem);
  --text-base: clamp(0.84rem, 0.82rem + 0.14vw, 0.96rem);
  --text-heading: clamp(1.24rem, 1.04rem + 0.72vw, 1.82rem);
  --text-metric: clamp(1.24rem, 1.02rem + 0.88vw, 1.9rem);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: var(--text-base);
}

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

button {
  cursor: pointer;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(320px, 480px) minmax(0, 1fr);
  min-height: 100vh;
  background: linear-gradient(135deg, #f7fafb 0%, #edf3f1 100%);
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(28px, 6vw, 72px);
  background: var(--white);
}

.login-panel h1 {
  margin: 48px 0 10px;
  font-size: clamp(2rem, 5vw, 3.5rem);
  line-height: 1;
  color: var(--navy);
}

.login-aside {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: flex-end;
  gap: 22px;
  padding: clamp(28px, 7vw, 88px);
  color: var(--white);
  background:
    linear-gradient(160deg, rgba(16, 34, 52, 0.82), rgba(21, 50, 72, 0.58) 54%, rgba(45, 143, 123, 0.28)),
    url("/assets/login-construction-project.png") center / cover;
}

.login-aside h2 {
  max-width: 640px;
  margin: 0;
  font-size: clamp(1.8rem, 3.7vw, 3.35rem);
  line-height: 1.06;
  font-weight: 800;
}

.login-label {
  display: block;
  max-width: 640px;
  margin-left: 4px;
}

.activity-list {
  display: flex;
  max-width: 700px;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.activity-list li,
.status-pill {
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 999px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.12);
  color: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.brand-mark {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--navy);
}

.brand-mark img {
  display: block;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: var(--navy);
  object-fit: cover;
}

.brand-mark small {
  display: block;
  color: var(--slate);
}

.brand-mark.compact {
  color: var(--white);
  padding: 20px;
}

.brand-mark.compact img {
  background: #2f5e68;
}

.brand-mark.compact small {
  color: rgba(255, 255, 255, 0.64);
}

.form-stack {
  display: grid;
  gap: 18px;
  margin-top: 28px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--slate);
  font-weight: 700;
  font-size: 0.88rem;
}

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

textarea {
  resize: vertical;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 42px;
  border-radius: 8px;
  border: 0;
  padding: 0 16px;
  font-weight: 800;
}

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

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button,
.icon-button {
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
}

.icon-button {
  display: none;
  width: 44px;
  padding: 0;
}

.muted,
.kicker,
.empty-state {
  color: var(--slate);
}

.error-text {
  min-height: 22px;
  color: var(--danger);
  font-weight: 700;
}

.demo-users {
  margin-top: 24px;
  color: var(--slate);
  font-size: 0.9rem;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  background: var(--navy);
  color: var(--white);
}

.nav-list {
  display: grid;
  gap: 4px;
  padding: 8px 12px 24px;
}

.nav-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  padding: 0 12px;
  color: rgba(255, 255, 255, 0.74);
  background: transparent;
  text-align: left;
  font-size: 0.92rem;
}

.nav-list button.active,
.nav-list button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--white);
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 86px;
  padding: 16px var(--page-pad);
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 250, 0.92);
  backdrop-filter: blur(12px);
}

.topbar h1,
.kicker {
  margin: 0;
}

.topbar h1 {
  font-size: var(--text-heading);
  line-height: 1.15;
}

.kicker,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0;
  font-size: var(--text-sm);
  font-weight: 900;
}

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

.user-chip > span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: var(--navy);
  color: var(--white);
  font-weight: 900;
}

.user-chip small {
  display: block;
  color: var(--slate);
}

.content {
  display: grid;
  gap: clamp(16px, 2vw, 22px);
  padding: var(--page-pad);
}

.content > *,
.grid > *,
.workspace,
.table-card {
  min-width: 0;
}

.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-header.compact {
  margin-bottom: 10px;
}

.grid {
  display: grid;
  gap: 16px;
}

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

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

.project-status-block {
  display: grid;
  gap: 10px;
}

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

.project-status-card {
  display: grid;
  min-height: 118px;
  align-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--white);
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.project-status-card:hover {
  border-color: rgba(45, 143, 123, 0.68);
  background: #f5fbf9;
  transform: translateY(-1px);
}

.project-status-card span {
  color: var(--slate);
  font-size: var(--text-sm);
  font-weight: 800;
  line-height: 1.25;
}

.project-status-card strong {
  color: var(--navy);
  font-size: 1.85rem;
  line-height: 1;
}

.project-status-card small {
  color: var(--slate);
  font-weight: 650;
  line-height: 1.3;
}

.filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid rgba(45, 143, 123, 0.24);
  border-radius: 8px;
  padding: 14px;
  background: #eef7f4;
}

.filter-banner span,
.filter-banner strong {
  display: block;
}

.filter-banner span {
  color: var(--slate);
  font-size: var(--text-sm);
  font-weight: 750;
}

.filter-banner strong {
  color: var(--navy);
  margin-top: 3px;
}

.two-column {
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
}

.card,
.table-card,
.form-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.card {
  padding: var(--card-pad);
}

.card h3,
.form-card h3 {
  margin: 0 0 10px;
  font-size: 0.96rem;
}

.metric {
  margin: 0;
  color: var(--navy);
  font-size: var(--text-metric);
  font-weight: 900;
  line-height: 1.12;
}

.card small {
  color: var(--slate);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: min(980px, 92vw);
  border-collapse: collapse;
}

th,
td {
  padding: clamp(10px, 1.2vw, 14px) clamp(10px, 1.3vw, 16px);
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--slate);
  font-size: var(--text-sm);
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #e8f4ef;
  color: var(--accent-strong);
  font-weight: 800;
  font-size: 0.74rem;
}

.pill.warn {
  background: #fff1e8;
  color: var(--warn);
}

.pill.danger {
  background: #fff0ee;
  color: var(--danger);
}

.form-card {
  padding: var(--card-pad);
}

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

.form-heading h3,
.form-heading p {
  margin: 0;
}

.form-heading .pill {
  flex: 0 0 auto;
}

.info-list {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 14px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbfc;
  font-size: var(--text-sm);
}

.info-list span {
  color: var(--slate);
  font-weight: 800;
}

.info-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.help-text,
.status-message {
  margin: 10px 0 0;
  color: var(--slate);
  font-size: var(--text-sm);
  line-height: 1.45;
}

.settings-stack {
  display: grid;
  align-content: start;
  gap: 16px;
}

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

.span-2 {
  grid-column: span 2;
}

.field-label {
  display: block;
  margin-bottom: 4px;
  color: var(--slate);
  font-size: 0.88rem;
  font-weight: 700;
}

.field-hint {
  margin: 0 0 10px;
  color: var(--slate);
  font-size: 0.78rem;
  line-height: 1.35;
}

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

.company-choice {
  display: flex;
  min-height: 92px;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  font-size: var(--text-sm);
  line-height: 1.25;
}

.company-choice:has(input:checked) {
  border-color: rgba(45, 143, 123, 0.65);
  background: #eef7f4;
}

.company-choice input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
  accent-color: var(--accent);
}

.company-choice span {
  min-width: 0;
}

.company-choice strong,
.company-choice small {
  display: block;
}

.company-choice strong {
  font-size: 0.95rem;
  line-height: 1.18;
}

.company-choice small {
  margin-top: 6px;
  color: var(--slate);
  font-weight: 600;
  line-height: 1.3;
}

.lexware-box {
  display: grid;
  gap: 8px;
  padding: 18px;
  border-left: 4px solid var(--accent);
  background: #eef7f4;
}

.side-stack {
  display: grid;
  align-content: start;
  gap: 16px;
}

.action-panel {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: var(--shadow);
}

.action-panel button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #f9fbfc;
  color: var(--ink);
  font-weight: 800;
  text-align: left;
}

.action-panel button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.check-list {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding-left: 20px;
  color: var(--slate);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.button-row .primary-button,
.button-row .ghost-button {
  flex: 1 1 180px;
}

.table-action {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.78rem;
}

@media (min-width: 1440px) {
  :root {
    --page-pad: 42px;
    --sidebar-width: 292px;
  }

  .content {
    max-width: 1680px;
  }
}

@media (max-width: 1320px) {
  :root {
    --page-pad: 24px;
    --card-pad: 14px;
    --sidebar-width: 248px;
    --text-base: 0.88rem;
    --text-heading: 1.48rem;
    --text-metric: 1.42rem;
  }

  .brand-mark.compact {
    padding: 18px 16px;
  }

  .nav-list {
    padding-inline: 10px;
  }

  .nav-list button {
    min-height: 38px;
    font-size: 0.86rem;
  }

  .topbar {
    min-height: 76px;
  }

  th,
  td {
    padding: 10px 12px;
  }
}

@media (max-width: 1180px) {
  :root {
    --page-pad: 22px;
    --sidebar-width: 236px;
    --text-base: 0.86rem;
    --text-heading: 1.38rem;
    --text-metric: 1.34rem;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 860px;
  }
}

@media (max-width: 820px) {
  :root {
    --page-pad: 20px;
  }

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

  .login-aside {
    min-height: 360px;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 10;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 180ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .icon-button {
    display: inline-grid;
    place-items: center;
  }

  .topbar {
    align-items: flex-start;
    min-height: auto;
    gap: 14px;
  }

  .user-chip {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .content {
    gap: 16px;
  }

  .section-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .filter-banner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  :root {
    --page-pad: 16px;
    --card-pad: 14px;
  }

  .login-panel,
  .content {
    padding: var(--page-pad);
  }

  .kpi-grid,
  .module-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: auto;
  }

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

  .user-chip div {
    display: none;
  }

  .topbar {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    padding: 12px var(--page-pad);
  }

  .topbar h1 {
    font-size: 1.25rem;
  }

  .user-chip {
    gap: 6px;
  }

  .user-chip > span {
    width: 36px;
    height: 36px;
  }

  .ghost-button,
  .primary-button {
    min-height: 40px;
    padding: 0 12px;
  }

  .form-heading {
    display: grid;
  }

  .button-row .primary-button,
  .button-row .ghost-button {
    flex-basis: 100%;
  }

  .card,
  .form-card {
    box-shadow: 0 10px 28px rgba(16, 34, 52, 0.1);
  }

  table {
    min-width: 760px;
  }

}

@media (max-width: 420px) {
  .topbar {
    grid-template-columns: 44px minmax(0, 1fr);
  }

  .user-chip {
    grid-column: 1 / -1;
    justify-content: space-between;
  }

  .login-aside h2 {
    font-size: 1.7rem;
  }

  .activity-list {
    gap: 8px;
  }

  .activity-list li {
    font-size: 0.78rem;
    padding: 7px 10px;
  }
}
