:root{
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: rgba(15,23,42,.65);
  --line: rgba(15,23,42,.12);
  --btn: #2b6cb0;
  --btn2: rgba(15,23,42,.06);
  --danger: #d9534f;

  --radius: 14px;
  --shadow: 0 10px 30px rgba(15,23,42,.12);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans";
}

*{ box-sizing:border-box; }
body{
  margin:0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.4;
}

a{ color: inherit; text-decoration: none; }
a:hover{ text-decoration: underline; }

.container{
  width: min(1300px, 92vw);
  margin: 18px auto 36px;
}

@media (max-width: 767px){
  .container{
    width: 100%;
    margin: 12px 0 24px;
  }

  input[type="text"],
  input[type="search"],
  input[type="number"],
  input[type="password"],
  input[type="datetime-local"],
  input[type="date"],
  input[type="time"],
  input[type="email"],
  input[type="tel"],
  input[type="url"],
  textarea,
  select{
    font-size: 16px;
  }

  .topbar__inner{
    width: 100%;
    padding: 10px 12px;
  }

  .brand{
    font-size: 20px;
    line-height: 1.2;
  }

  .page-title{
    padding: 0 12px;
  }

  .page-title h1{
    font-size: 18px;
  }

  .card, .block{
    padding: 12px;
  }

  .card > h2,
  .block > h2,
  .project-create-title{
    font-size: 18px !important;
    line-height: 1.2;
  }

  .warehouse-sep{
    display: none;
  }

  #warehouseSearch,
  #warehouse-period-form input[type="datetime-local"]{
    height: 42px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #warehouse-period-form .btn{
    height: 42px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  #warehouseTable{
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    table-layout: fixed;
  }

  #warehouseTable .col-details{
    display: none;
  }

  #warehouseTable th,
  #warehouseTable td{
    font-size: 13px;
    padding: 6px 6px;
  }

  #warehouseTable .col-name{
    width: 40%;
  }

  #warehouseTable .col-available{
    width: 20% !important;
    text-align: center;
  }

  #warehouseTable .col-qty{
    width: 20% !important;
  }

  #warehouseTable .col-total{
    width: 20% !important;
    text-align: center;
  }

  #warehouseTable .col-qty .qty{
    width: 100%;
    padding: 6px 6px;
    font-size: 16px;
    transform: scale(0.8125);
    transform-origin: left center;
  }

  .repair-active .form-row{
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
  }

  .repair-active .form-row .btn{
    width: 100%;
  }

  .repair-search{
    margin-bottom: 10px;
  }

  #repairSearch{
    height: 42px;
  }

  .repair-table,
  .repair-history-table{
    border: 0;
    background: transparent;
  }

  .repair-table tr:first-child,
  .repair-history-table tr:first-child{
    display: none;
  }

  .repair-table tr,
  .repair-history-table tr{
    display: block;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .repair-table tr:last-child,
  .repair-history-table tr:last-child{
    margin-bottom: 0;
  }

  .repair-table td,
  .repair-history-table td{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.25;
    text-align: right;
  }

  .repair-table td:last-child,
  .repair-history-table td:last-child{
    border-bottom: 0;
  }

  .repair-table td::before,
  .repair-history-table td::before{
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    text-align: left;
    flex-shrink: 0;
    margin-right: 8px;
  }

  .repair-table td[colspan],
  .repair-history-table td[colspan]{
    display: block;
    text-align: left;
  }

  .repair-table td[colspan]::before,
  .repair-history-table td[colspan]::before{
    content: "";
    display: none;
  }

  .repair-table input[type="checkbox"]{
    width: 18px;
    height: 18px;
    margin-top: 1px;
  }

  .equipment-detail-period-form{
    flex-direction: column;
    align-items: stretch !important;
    gap: 8px;
  }

  .equipment-detail-period-card{
    display: none;
  }

  .equipment-detail-period-form .form-group{
    width: 100%;
  }

  .equipment-detail-period-form input[type="datetime-local"]{
    width: 100%;
    height: 42px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .equipment-detail-table{
    border: 0;
    background: transparent;
  }

  .equipment-detail-table tr:first-child{
    display: none;
  }

  .equipment-detail-table tr{
    display: block;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .equipment-detail-table tr:last-child{
    margin-bottom: 0;
  }

  .equipment-detail-table td{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    border-bottom: 1px solid var(--line);
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.25;
    text-align: right;
  }

  .equipment-detail-table td:last-child{
    border-bottom: 0;
  }

  .equipment-detail-table td::before{
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    text-align: left;
    flex-shrink: 0;
    margin-right: 8px;
  }

  .equipment-detail-table td[colspan]{
    display: block;
    text-align: left;
  }

  .equipment-detail-table td[colspan]::before{
    content: "";
    display: none;
  }

  .warehouse-total-desktop{
    display: none !important;
  }

  .warehouse-total-mobile{
    display: inline !important;
  }
}

.warehouse-total-desktop{
  display: inline;
}

.warehouse-total-mobile{
  display: none;
}

.topbar{
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(245,247,251,.75);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar__inner{
  width: min(1300px, 92vw);
  margin: 0 auto;
  display:flex;
  align-items:center;
  gap: 16px;
  padding: 12px 0;
}

.brand{
  font-weight: 800;
  letter-spacing: .2px;
}

.nav{
  display:flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav__link{
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  border: none;
  font: inherit;
  cursor: pointer;
}
.nav__link:hover{
  background: var(--btn2);
  color: var(--text);
  text-decoration: none;
}
.nav__link--danger{
  color: rgba(217,83,79,.95);
}
.nav__link--danger:hover{
  background: rgba(217,83,79,.12);
  color: rgba(217,83,79,1);
}

.topbar__right{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap: 8px;
}

.topbar__desktop-nav{
  min-width: 0;
}

.mobile-menu{
  display: none;
}

@media (max-width: 768px){
  .topbar__inner{
    padding: 10px 0;
    gap: 10px;
  }

  .brand{
    margin-right: auto;
  }

  .topbar__desktop-nav,
  .topbar__right{
    display: none;
  }

  .mobile-menu{
    display: block;
    margin-left: auto;
    position: relative;
  }

  .mobile-menu__toggle{
    list-style: none;
    padding: 7px 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--muted);
    background: var(--card);
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    font-size: 13px;
  }

  .mobile-menu__toggle::-webkit-details-marker{
    display: none;
  }

  .mobile-menu[open] .mobile-menu__toggle{
    color: var(--text);
  }

  .mobile-menu__panel{
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    width: min(260px, 86vw);
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 120;
  }

  .mobile-menu__link{
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    white-space: nowrap;
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
  }

  .mobile-menu__link:hover{
    background: var(--btn2);
    color: var(--text);
    text-decoration: none;
  }

  .mobile-menu__link--danger{
    color: rgba(217,83,79,.95);
  }
}

.page-title h1{
  margin: 0 0 6px;
  font-size: 28px;
}

@media (max-width: 768px){
  .page-title h1{
    font-size: 20px;
  }
}

@media (max-width: 768px){
  #project-create-form > .block > h2{
    font-size: 20px;
    margin: 0 0 10px;
    line-height: 1.2;
  }

  #project-create-form > .block:first-of-type .form-grid-2{
    gap: 10px 13px;
  }

  #project-create-form > .block:first-of-type .field{
    gap: 5px;
  }

  #project-create-form > .block:first-of-type input[type="text"],
  #project-create-form > .block:first-of-type input[type="search"],
  #project-create-form > .block:first-of-type input[type="number"],
  #project-create-form > .block:first-of-type input[type="password"],
  #project-create-form > .block:first-of-type input[type="date"],
  #project-create-form > .block:first-of-type input[type="time"],
  #project-create-form > .block:first-of-type input[type="datetime-local"],
  #project-create-form > .block:first-of-type select,
  #project-create-form > .block:first-of-type textarea{
    width: 224px;
    padding: 8px 10px;
  }

  .project-create-form .project-create-title{
    font-size: 20px !important;
    line-height: 1.2;
  }

  .project-create-form .project-create-main .form-grid-2{
    gap: 10px 13px;
  }

  .project-create-form .project-create-main .field{
    gap: 5px;
  }

  .project-create-form .project-create-main input[type="text"],
  .project-create-form .project-create-main input[type="search"],
  .project-create-form .project-create-main input[type="number"],
  .project-create-form .project-create-main input[type="password"],
  .project-create-form .project-create-main input[type="date"],
  .project-create-form .project-create-main input[type="time"],
  .project-create-form .project-create-main input[type="datetime-local"],
  .project-create-form .project-create-main select,
  .project-create-form .project-create-main textarea{
    width: 224px;
    padding: 8px 10px;
  }
}

.page-title .meta{
  display:flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}

.project-detail .page-title .meta{
  font-size: 14px;
}

.sep{
  border: none;
  height: 1px;
  background: var(--line);
  margin: 16px 0;
}

.card, .block{
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.form-row{
  display:flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-group, .field{
  display:flex;
  flex-direction: column;
  gap: 6px;
}

label{
  font-size: 13px;
  color: var(--muted);
}

.hint-text{
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

input[type="text"],
input[type="search"],
input[type="number"],
input[type="password"],
input[type="datetime-local"],
input[type="date"],
input[type="time"],
select,
textarea{
  width: 280px;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: transparent;
  color: #000000;
  outline: none;
}

textarea{
  min-height: 110px;
  width: 100%;
}

input.small{ width: 220px; }

.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--btn);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
}
.btn:hover{ filter: brightness(1.06); text-decoration:none; }
.btn:active{ transform: translateY(1px); }

.btn-ghost{
  background: transparent;
  color: var(--text);
}

.btn-ok{
  background: #2f855a;
}

.error-text{
  margin-top: 6px;
  color: var(--danger);
  font-size: 12px;
}

.messages{
  display:flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.alert{
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-size: 14px;
  line-height: 1.4;
}

.alert-success{
  background: rgba(47, 133, 90, 0.12);
  border-color: rgba(47, 133, 90, 0.35);
  color: #2f855a;
}

.alert-error{
  background: rgba(217, 83, 79, 0.12);
  border-color: rgba(217, 83, 79, 0.35);
  color: #b23c38;
}

.alert-warning{
  background: rgba(237, 137, 54, 0.12);
  border-color: rgba(237, 137, 54, 0.35);
  color: #c05621;
}

.alert-info, .alert-debug{
  background: rgba(43, 108, 176, 0.12);
  border-color: rgba(43, 108, 176, 0.35);
  color: #2b6cb0;
}

.form-grid-2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}

.form-grid-2__full{
  grid-column: 1 / -1;
}

@media (max-width: 768px){
  .form-grid-2{
    grid-template-columns: 1fr;
  }
}

.equip-picker{
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--card);
}

.equip-picker__columns{
  display:flex;
  gap: 12px;
  align-items: stretch;
}

.equip-picker__tree,
.equip-picker__list,
.equip-picker__basket{
  min-height: 220px;
  max-height: 520px;
}

.equip-picker__tree,
.equip-picker__basket{
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.equip-picker__tree{
  width: 220px;
  border-right: 1px solid var(--line);
  padding-right: 10px;
}

.equip-picker__list{
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.equip-picker__basket{
  width: 240px;
  border-left: 1px solid var(--line);
  padding-left: 10px;
}

.equip-picker__section-title{
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

.equip-picker__header{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.equip-picker__breadcrumb{
  font-size: 13px;
  color: var(--muted);
}

.equip-picker__placeholder{
  color: var(--muted);
  font-size: 13px;
  padding: 8px 0;
}

.equip-picker__list-items{
  display:flex;
  flex-direction: column;
  gap: 6px;
}

.equip-picker__mobile,
.picker-mobile-cartbar,
.picker-mobile-sheet{
  display: none;
}

#picker-leaves{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

#picker-groups,
#picker-subgroups,
#picker-basket{
  scrollbar-gutter: stable;
}

@media (max-width: 1024px){
  .equip-picker__tree,
  .equip-picker__list,
  .equip-picker__basket{
    max-height: 420px;
  }
}

@media (max-width: 767px){
  .equip-picker{
    padding: 10px;
  }

  .equip-picker .equip-picker__columns{
    display: none;
  }

  .equip-picker .equip-picker__mobile{
    display: block;
    padding-bottom: 74px;
  }

  .equip-picker-mobile__top{
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
  }

  .picker-mobile-back{
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
    border-radius: 10px;
    padding: 8px 11px;
    font-size: 13px;
    line-height: 1;
  }

  .equip-picker-mobile__path{
    min-width: 0;
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .equip-picker-mobile__search{
    margin-bottom: 8px;
  }

  #picker-mobile-search{
    width: 100%;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: transparent;
    color: #000;
    font-size: 16px;
  }

  .equip-picker-mobile__stage{
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .picker-mobile-step-link{
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: transparent;
    color: var(--text);
    padding: 12px;
    text-align: left;
    font-size: 14px;
  }

  .picker-mobile-item{
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    padding: 8px 10px;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 8px;
  }

  .picker-mobile-item__name{
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
  }

  .picker-mobile-item__meta{
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
  }

  .picker-mobile-qty{
    display: grid;
    grid-template-columns: 32px 56px 32px;
    gap: 6px;
    align-items: center;
    justify-content: start;
  }

  .picker-mobile-qty__btn{
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--text);
    font-size: 18px;
    line-height: 1;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }

  .picker-mobile-qty__input{
    width: 100%;
    min-width: 0;
    text-align: center;
    padding: 6px 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 16px;
  }

  .equip-picker .picker-mobile-cartbar:not([hidden]){
    display: flex;
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 140;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    padding: 10px 12px;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    box-shadow: var(--shadow);
  }

  .picker-mobile-cartbar__text{
    font-size: 14px;
    font-weight: 600;
  }

  .picker-mobile-cartbar__cta{
    font-size: 13px;
    color: var(--muted);
  }

  .equip-picker .picker-mobile-sheet:not([hidden]){
    display: block;
    position: fixed;
    inset: 0;
    z-index: 160;
    pointer-events: none;
  }

  .picker-mobile-sheet__backdrop{
    position: absolute;
    inset: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.45);
    padding: 0;
    display: none;
    opacity: 0;
    transition: opacity .2s ease;
    z-index: 1;
    pointer-events: none;
  }

  .picker-mobile-sheet__panel{
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(72vh, 620px);
    background: var(--card);
    border-radius: 14px 14px 0 0;
    border: 1px solid var(--line);
    border-bottom: 0;
    transform: translateY(100%);
    transition: transform .2s ease;
    display: flex;
    flex-direction: column;
    z-index: 2;
    pointer-events: auto;
  }

  .picker-mobile-sheet.is-open .picker-mobile-sheet__panel{
    transform: translateY(0);
  }

  .picker-mobile-sheet.is-open{
    pointer-events: auto;
  }

  .picker-mobile-sheet.is-open .picker-mobile-sheet__backdrop{
    display: block;
    opacity: 1;
    pointer-events: auto;
  }

  .picker-mobile-sheet__head{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }

  .picker-mobile-sheet__title{
    font-size: 14px;
    font-weight: 600;
  }

  .picker-mobile-sheet__close{
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--card);
    color: var(--muted);
    padding: 7px 10px;
    font-size: 13px;
  }

  .picker-mobile-sheet__list{
    overflow-y: auto;
    padding: 10px 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .picker-mobile-cart-row{
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--card);
  }

  .picker-mobile-cart-row__name{
    font-size: 13px;
    line-height: 1.3;
  }
}

.picker-link{
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  border-radius: 10px;
  padding: 6px 8px;
  text-align: left;
  cursor: pointer;
}

.picker-link:hover{
  background: var(--btn2);
}

.basket-row{
  display:grid;
  grid-template-columns: 1fr 70px 28px;
  gap: 6px;
  align-items:center;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
}

.basket-row:last-child{
  border-bottom: none;
}

.basket-name{
  font-size: 13px;
}

.basket-qty{
  width: 70px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.qty-input{
  width: 56px !important;
  max-width: 56px !important;
  padding: 6px 8px;
}

.basket-remove{
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}

.tbl{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--card);
}

.tbl th, .tbl td{
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.tbl th{
  text-align: left;
  font-size: 13px;
  color: var(--muted);
  background: rgba(255,255,255,.03);
}

.tbl tr:last-child td{ border-bottom: none; }

.tbl .tbl-subhead td{
  font-weight: 700;
  background: rgba(255,255,255,.06);
}

.gantt-summary{
  display: flex;
  flex-wrap: wrap;
  gap: 14px 18px;
  margin-bottom: 14px;
}

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

.truss-calculator-toolbar{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.truss-calculator-toolbar__actions{
  display: flex;
  align-items: center;
  gap: 8px;
}

.truss-calculator-toolbar__status{
  font-size: 12px;
  color: var(--muted);
}

.truss-calculator-toolbar__status[data-state="saving"]{
  color: #2b6cb0;
}

.truss-calculator-toolbar__status[data-state="error"]{
  color: #b83232;
}

.truss-calculator-page{
  width: 100%;
}

.truss-calculator-form{
  width: 100%;
}

.truss-calculator-scroll{
  width: 100%;
  overflow-x: auto;
}

.truss-calculator-sheet{
  width: 100%;
  min-width: 1040px;
}

.truss-print-header{
  display: none;
}

.truss-sheet{
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  background: #fff;
}

.truss-sheet th,
.truss-sheet td{
  border: 1px solid #bcc7d5;
  padding: 2px 4px;
  height: 28px;
  vertical-align: middle;
  font-size: 12px;
  line-height: 1.2;
}

.truss-sheet__title-row th{
  background: #dbe7f4;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
  height: 30px;
}

.truss-sheet__period-row td{
  background: #eef3f8;
}

.truss-sheet__period-row th{
  background: #eef3f8;
  font-weight: 600;
}

.truss-sheet__period-label{
  text-align: left;
  white-space: nowrap;
}

.truss-sheet__period-input-cell{
  padding: 0;
}

.truss-sheet__family-row th,
.truss-sheet__family-row td{
  background: #eceff3;
  font-weight: 600;
}

.truss-sheet__family-row--top th{
  text-align: center;
}

.truss-sheet__family-row--elements th{
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  height: 24px;
}

.truss-sheet__group-head{
  text-align: center;
}

.truss-sheet__element-head.is-empty{
  background: #eceff3;
  color: transparent;
}

.truss-sheet__input-cell{
  padding: 0;
}

.truss-sheet input[type="text"],
.truss-sheet input[type="number"],
.truss-sheet input[type="datetime-local"]{
  width: 100%;
  height: 27px;
  padding: 2px 4px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  font: inherit;
}

.truss-sheet input:focus{
  background: #f5f9fd;
}

.truss-sheet__control-cell{
  padding: 0;
  text-align: center;
}

.truss-sheet__mini-btn{
  width: 100%;
  height: 27px;
  border: 0;
  border-radius: 0;
  background: #dfe8f3;
  color: #244868;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.truss-sheet__mini-btn--danger{
  background: #f6e6e6;
  color: #8f2d2d;
}

.truss-sheet__number-cell{
  text-align: center;
  font-variant-numeric: tabular-nums;
  background: #fbfdff;
}

.truss-sheet__placeholder-cell{
  background: #f2f2f2;
}

.truss-sheet__check-cell{
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  padding: 0 4px;
}

.truss-sheet__check-label{
  display: inline-block;
  vertical-align: middle;
}

.truss-sheet__recalc-btn{
  width: 18px;
  height: 18px;
  margin-left: 4px;
  padding: 0;
  border: 1px solid #bcc7d5;
  border-radius: 0;
  background: #fff;
  color: #334155;
  font-size: 11px;
  line-height: 1;
  vertical-align: middle;
  cursor: pointer;
}

.truss-sheet__check-cell.is-ok{
  background: #e4f1e6;
  color: #1d5e2e;
}

.truss-sheet__check-cell.is-bad{
  background: #f7e1e1;
  color: #8d2a2a;
}

.truss-sheet__check-cell.is-warn{
  background: #f6efde;
  color: #8a6614;
}

.truss-sheet__check-cell.is-empty{
  background: #fff;
  color: #6b7280;
}

.truss-sheet__family-spacer{
  background: #fff;
}

.truss-sheet__empty-row td{
  height: 20px;
}

.truss-sheet__empty-cell{
  background: #fff;
}

.truss-sheet__col-family{ width: 82px; }
.truss-sheet__col-control{ width: 26px; }
.truss-sheet__col-name{ width: 32%; }
.truss-sheet__col-length{ width: 9%; }
.truss-sheet__col-qty{ width: 7%; }
.truss-sheet__col-element{ width: 6.2%; }
.truss-sheet__col-check{ width: 8%; }

.truss-lower-block{
  display: grid;
  grid-template-columns: minmax(280px, 0.92fr) minmax(0, 1.68fr);
  align-items: stretch;
  margin-top: 8px;
  background: #fff;
}

.truss-lower-block__summary{
  display: flex;
}

.truss-summary{
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.truss-summary th,
.truss-summary td{
  border: 1px solid #bcc7d5;
  padding: 2px 4px;
  height: 28px;
  font-size: 12px;
  line-height: 1.2;
}

.truss-summary thead tr:first-child th{
  background: #dbe7f4;
  text-align: left;
}

.truss-summary thead tr:last-child th{
  background: #eceff3;
  text-align: left;
  font-weight: 600;
}

.truss-summary__placeholder,
.truss-summary__meters{
  font-variant-numeric: tabular-nums;
}

.truss-autopick{
  width: 100%;
  height: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.truss-autopick colgroup col:last-child{
  width: 13%;
}

.truss-autopick th,
.truss-autopick td{
  border: 1px solid #bcc7d5;
  padding: 2px 4px;
  font-size: 12px;
  line-height: 1.25;
}

.truss-autopick thead th{
  background: #dbe7f4;
  text-align: left;
}

.truss-autopick__head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.truss-autopick__action{
  height: 22px;
  padding: 0 8px;
  border: 1px solid #bcc7d5;
  border-radius: 0;
  background: #fff;
  font-size: 12px;
  cursor: pointer;
}

.truss-autopick__action:disabled{
  opacity: .55;
  cursor: default;
}

.truss-autopick tbody td{
  background: #f8fafc;
  vertical-align: top;
}

.truss-autopick__footer{
  background: #f8fafc;
}

.truss-autopick__meta{
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.truss-autopick__shortage-cell{
  background: #f7e1e1 !important;
  color: #8d2a2a;
  font-weight: 700;
}

@media (max-width: 767px){
  .truss-calculator-page{
    padding: 0 12px;
  }

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

  .truss-autopick{
    margin-top: -1px;
  }
}

@page{
  size: A4 portrait;
  margin: 10mm;
}

@media print{
  html, body{
    background: #fff;
  }

  .topbar,
  .messages,
  .truss-calculator-toolbar,
  .truss-lower-block,
  .truss-sheet__mini-btn,
  .truss-sheet__recalc-btn{
    display: none !important;
  }

  .container,
  .truss-calculator-page,
  .truss-calculator-form,
  .truss-calculator-scroll,
  .truss-calculator-sheet{
    width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  .truss-print-header{
    display: block;
    margin: 0 0 6mm;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.2;
  }

  .truss-sheet{
    width: 100%;
    table-layout: fixed;
    page-break-inside: avoid;
  }

  .truss-sheet th,
  .truss-sheet td{
    padding: 2px 3px;
    height: 24px;
    font-size: 10px;
  }

  .truss-sheet input[type="text"],
  .truss-sheet input[type="number"],
  .truss-sheet input[type="datetime-local"]{
    height: 23px;
    padding: 1px 3px;
  }
}

.gantt-summary__item strong{
  font-size: 16px;
}

.gantt-summary__item--muted strong,
.gantt-summary__item--muted .gantt-summary__label{
  color: var(--muted);
}

.gantt-summary__label{
  font-size: 13px;
  color: var(--muted);
}

.gantt-card{
  padding: 0;
  overflow: hidden;
}

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

.gantt-toolbar__actions{
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.gantt-toolbar__meta{
  font-size: 13px;
  color: var(--muted);
}

.gantt-note{
  padding: 12px 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.gantt-scroll{
  overflow: auto;
  max-height: calc(100vh - 220px);
  scrollbar-gutter: stable both-edges;
}

.gantt-table{
  --gantt-manager-width: 110px;
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
  background: var(--card);
}

.gantt-table th,
.gantt-table td{
  border-right: 1px solid rgba(15,23,42,.08);
  border-bottom: 1px solid rgba(15,23,42,.08);
}

.gantt-table thead th{
  position: sticky;
  top: 0;
  z-index: 4;
  background: #f8f6f2;
}

.gantt-table__manager-head,
.gantt-table__manager{
  position: sticky;
  left: 0;
  width: 1%;
  padding: 10px 8px;
  text-align: left;
  color: var(--muted);
  box-shadow: 1px 0 0 rgba(15,23,42,.08);
  white-space: nowrap;
}

.gantt-table__manager-head{
  z-index: 6 !important;
  font-size: calc(1em - 2px);
}

.gantt-table__manager{
  z-index: 3;
  background: #fcfbf8;
}

.gantt-table__project-head,
.gantt-table__project{
  position: sticky;
  left: var(--gantt-manager-width);
  width: 1%;
  padding: 10px 8px;
  text-align: left;
  box-shadow: 1px 0 0 rgba(15,23,42,.08);
  white-space: nowrap;
}

.gantt-table__project-head{
  z-index: 5 !important;
  background: #f8f6f2;
  color: var(--muted);
  font-size: calc(1em - 2px);
}

.gantt-table__day{
  min-width: 44px;
  width: 44px;
  padding: 7px 2px;
  text-align: center;
  white-space: nowrap;
}

.gantt-table__day span,
.gantt-table__day small{
  display: block;
}

.gantt-table__day span{
  font-size: 11px;
  color: var(--text);
}

.gantt-table__day small{
  margin-top: 2px;
  font-size: 10px;
  color: var(--muted);
}

.gantt-table__project{
  z-index: 3;
  background: #fcfbf8;
}

.gantt-table__manager{
  font-size: 13px;
}

.gantt-table__project{
  font-size: 13px;
}

.gantt-table__project-link{
  display: block;
  font-weight: 600;
  line-height: 1.25;
  font-size: 13px;
  white-space: nowrap;
}

.gantt-table__cell{
  position: relative;
  width: 44px;
  min-width: 44px;
  height: 42px;
  padding: 3px 1px;
  background: #fffdfa;
}

.gantt-table__fill{
  display: block;
  width: 100%;
  height: 100%;
  background: var(--gantt-fill);
  border-top: 1px solid rgba(15,23,42,.25);
  border-bottom: 1px solid rgba(15,23,42,.25);
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.12);
}

.gantt-table__cell.is-start .gantt-table__fill{
  border-left: 1px solid rgba(15,23,42,.28);
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.gantt-table__cell.is-end .gantt-table__fill{
  border-right: 1px solid rgba(15,23,42,.28);
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

.gantt-table__day.is-today,
.gantt-table__cell.is-today{
  background: rgba(193, 138, 107, 0.12);
}

.gantt-table__cell.is-today .gantt-table__fill{
  box-shadow: inset 0 0 0 1px rgba(15,23,42,.16);
}

@media (max-width: 768px){
  .gantt-summary{
    margin-left: 12px;
    margin-right: 12px;
  }

  .gantt-toolbar{
    margin-left: 12px;
    margin-right: 12px;
    flex-direction: column;
    align-items: flex-start;
  }

  .gantt-card{
    border-radius: 0;
    border-left: 0;
    border-right: 0;
  }

  .gantt-scroll{
    max-height: calc(100vh - 190px);
  }

  .gantt-table__manager-head,
  .gantt-table__manager{
    width: 1%;
  }

  .gantt-table__project-head,
  .gantt-table__project{
    left: var(--gantt-manager-width);
    width: 1%;
  }
}

.project-movements-table .pm-group-row td{
  padding-top: 2px;
  padding-bottom: 2px;
}

.project-movements-table .pm-group-head{
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-movements-table .pm-group-head__time{
  line-height: 1.2;
}

.project-movements-table .pm-group-head .pm-group-edit-btn{
  margin-left: auto;
}

.project-movements-table .pm-icon-btn,
.project-movements-table button.pm-icon-btn,
.project-movements-table a.pm-icon-btn{
  width: 32px !important;
  min-width: 32px !important;
  height: 32px !important;
  padding: 0 !important;
  line-height: 1 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 14px !important;
}

.project-movements-table .pm-group-edit-btn{
  text-decoration: none;
}

.project-movements-table .pm-group-row td > div{
  min-height: 0;
}

.pm-type{
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pm-type__icon{
  display: none;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
}

.pm-type--out .pm-type__icon{
  color: #2e7d32;
}

.pm-type--in .pm-type__icon{
  color: #c62828;
}

.pm-edit-dialog{
  width: min(420px, 92vw);
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  padding: 14px;
}

.pm-edit-dialog::backdrop{
  background: rgba(15, 23, 42, 0.35);
}

.pm-edit-dialog__title{
  margin: 0 0 10px;
  font-size: 18px;
}

.pm-edit-dialog__form .field{
  margin-bottom: 10px;
  width: 100%;
  min-width: 0;
}

.pm-edit-dialog__actions{
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.projects-filters .form-group{
  flex: 1 1 260px;
}

.projects-filters input[type="search"],
.projects-filters select{
  width: 100%;
}

.projects-table-wrap{
  width: 100%;
}

@media (max-width: 768px){
  .projects-table{
    border: 0;
    background: transparent;
  }

  .projects-table thead{
    display: none;
  }

  .projects-table tbody{
    display: block;
  }

  .projects-table tr{
    display: block;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    overflow: hidden;
  }

  .projects-table tr:last-child{
    margin-bottom: 0;
  }

  .projects-table td{
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    border-bottom: 1px solid var(--line);
    padding: 7px 12px;
    text-align: right;
    line-height: 1.25;
  }

  .projects-table td:last-child{
    border-bottom: 0;
  }

  .projects-table td::before{
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    text-align: left;
    flex-shrink: 0;
  }

  .projects-table td.pTitle{
    display: block;
    text-align: left;
    font-weight: 600;
  }

  .projects-table td.pTitle::before{
    display: none;
  }
}

/* --- LOGIN layout (только страница входа) --- */
.auth-page{
  min-height: calc(100vh - 110px);
  display:flex;
  align-items:center;
  justify-content:center;
}
.auth-card{
  width: min(620px, 92vw);
}
.auth-card input[type="text"],
.auth-card input[type="password"]{
  width: 100%;
}

@media (max-width: 767px){
  :root{
    --mobile-edge: 8px;
  }

  .pm-edit-dialog{
    width: calc(100vw - (var(--mobile-edge) * 2));
    max-width: none;
    margin: auto var(--mobile-edge) 10px;
    padding: 12px;
  }

  .pm-edit-dialog__title{
    font-size: 16px;
    padding-left: 0;
    padding-right: 0;
  }

  .pm-edit-dialog__form input[type="datetime-local"],
  .pm-edit-dialog__form input[type="number"]{
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    display: block;
    box-sizing: border-box;
    font-size: 16px;
    height: 44px;
    min-height: 44px;
    line-height: 1.2;
    padding: 0 12px;
    margin: 0;
    appearance: none;
    -webkit-appearance: none;
  }

  #pmEditMovementAt::-webkit-datetime-edit{
    padding: 0;
    display: flex;
    align-items: center;
    height: 100%;
  }

  #pmEditMovementAt::-webkit-datetime-edit-fields-wrapper{
    display: flex;
    align-items: center;
    height: 100%;
  }

  #pmEditMovementAt::-webkit-date-and-time-value{
    display: inline-flex;
    align-items: center;
    min-height: 100%;
    line-height: 1;
    text-align: left;
  }

  #pmEditMovementAt::-webkit-calendar-picker-indicator{
    margin: 0;
  }

  .project-movements-table th,
  .project-movements-table td{
    padding: 8px 10px;
  }

  .project-movements-table .pm-group-row td{
    padding-top: 1px;
    padding-bottom: 1px;
  }

  .project-movements-table .pm-group-head{
    gap: 6px;
  }

  .project-movements-table .pm-icon-btn,
  .project-movements-table button.pm-icon-btn,
  .project-movements-table a.pm-icon-btn{
    width: 28px !important;
    min-width: 28px !important;
    height: 28px !important;
    font-size: 13px !important;
  }

  .project-movements-table td{
    font-size: 14px;
    line-height: 1.2;
  }

  .project-movements-table .pm-type-cell{
    text-align: center;
    white-space: nowrap;
  }

  .project-movements-table .pm-type__icon{
    display: inline-block;
  }

  .project-movements-table .pm-type__label{
    display: none;
  }

  .topbar__inner{
    padding-left: 4px !important;
    padding-right: var(--mobile-edge) !important;
  }

  .page-title{
    padding-left: var(--mobile-edge) !important;
    padding-right: var(--mobile-edge) !important;
  }

  .container h1,
  .container h2,
  .container h3{
    padding-left: var(--mobile-edge);
    padding-right: var(--mobile-edge);
  }

  .card h1,
  .card h2,
  .card h3,
  .block h1,
  .block h2,
  .block h3{
    padding-left: 0;
    padding-right: 0;
  }
}
.check-row{
  display:flex;
  align-items:center;
  gap: 12px;
}
.check-row input[type="checkbox"]{
  width: 18px;
  height: 18px;
}
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

body {
  overflow-x: hidden;
}
