:root {
  --tw-orange: #f47721;
  --tw-dark: #1f2933;
  --tw-border: #dadada;
  --tw-bg: #f5f6f8;
  --tw-muted: #6b7280;
}

.tw-app {
  direction: rtl;
  font-family: 'Rubik', sans-serif;
  border-radius: 18px;
  padding: 28px;
  color: var(--tw-dark);
  position: relative;
}

.tw-page-wrap {
  max-width: 1600px;
  margin: 0 auto;
}

.tw-app-wrap {
  border-radius: 4px;
  box-shadow: 0 107px 144px -73px rgba(0, 21, 42, 0.35);
  padding: 1rem;
  background-color: #fff;
}

.tw-header {
  text-align: center;
  margin-bottom: 18px;
  position: relative;
}

.tw-header-actions {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}

.tw-btn-classic-side {
  position: absolute;
  inset-inline-end: 0;
  top: 2px;
  z-index: 5;
  background: #F47721;
  color: #ffffff;
  border: 1px solid #F47721;
  box-shadow: 0 10px 18px -8px rgba(250, 170, 87, 0.35);
  border-radius: 8px;
  font-weight: 700;
  padding: 9px 12px;
  writing-mode: horizontal-tb;
  text-orientation: mixed;
  letter-spacing: 0;
  font-size: 14px;
  line-height: 1.2;
}

.tw-btn-classic-side:hover {
  color: #ffffff;
  background: #de6a1c;
  border-color: #de6a1c;
}

.tw-title {
  font-size: 32px;
  font-weight: 700;
  margin: 0;
}

.tw-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  background: #ffffff;
  border: 1px solid var(--tw-border);
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  padding: 8px;
  justify-content: center;
}

.tw-tab {
  border: 1px solid #e1e1e1;
  background: #f7f7f7;
  padding: 6px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--tw-dark);
}

.tw-tab.is-active {
  background: var(--tw-orange);
  color: #ffffff;
}

.tw-tab.is-active .tw-tab-icon {
  color: #ffffff;
  border-color: #ffffff;
}

.tw-tab-label {
  display: inline-flex;
  align-items: center;
}

.tw-tab-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 2px solid currentColor;
  border-radius: 4px;
  color: #3d5aa7;
}

.tw-tab-icon-circle {
  border-radius: 50%;
}

.tw-tab-icon-rect {
  width: 20px;
  height: 12px;
  border-radius: 3px;
}

.tw-tab-icon-solid {
  border-radius: 50%;
  background: currentColor;
}

.tw-tab-icon-flat {
  width: 22px;
  height: 8px;
  border-radius: 3px;
  background: currentColor;
}

.tw-tab-icon-plate {
  width: 22px;
  height: 14px;
  border-radius: 3px;
  background: currentColor;
}

.tw-tab-icon-sheet {
  width: 20px;
  height: 14px;
  border-radius: 2px;
  position: relative;
  background: transparent;
}

.tw-tab-icon-sheet::after {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1px solid currentColor;
  border-radius: 2px;
  transform: translate(3px, -3px);
}

.tw-tab-icon-i::before {
  content: 'I';
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.tw-tab-icon-ipe::before,
.tw-tab-icon-ipn::before,
.tw-tab-icon-hea::before,
.tw-tab-icon-heb::before {
  content: 'I';
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.tw-tab-icon-hea,
.tw-tab-icon-heb {
  font-weight: 700;
}

.tw-tab-icon-heb {
  border-width: 3px;
}

.tw-tab-icon-ipn::before {
  content: 'I';
  font-style: italic;
}

.tw-tab-icon-angle {
  border-top: 0;
  border-left: 0;
  width: 16px;
  height: 16px;
}

.tw-tab-icon-u {
  border-top: 0;
  border-radius: 3px;
}

.tw-tab-icon-t::before {
  content: 'T';
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.tw-tab-icon-sheet {
  border-radius: 2px;
}

.tw-mode-toggle {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}

.tw-mode-btn {
  border: 0;
  padding: 10px 24px;
  border-radius: 4px;
  background: #EFEFEF;
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
  width: 164px;
}

.tw-mode-btn.is-active {
  background: var(--tw-orange);
  color: #ffffff;
  border-color: var(--tw-orange);
}

.tw-content {
  display: grid;
  gap: 24px;
}

.tw-calc-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 18px;
}

.tw-calc-panel {
  order: 1;
}

.tw-cut-panel {
  order: 2;
}

.tw-calc-panel,
.tw-cut-panel,
.tw-filters,
.tw-table {
  background: #ffffff;
  border: 1px solid var(--tw-border);
  border-radius: 4px;
  padding: 16px;
}

.tw-filters {
  border-radius: 0 0 4px 0;

}

.tw-input {
  width: 100%;
  border-radius: 4px;
  background: #EFEFEF;
  border: none;
  padding: 10px 12px;
  font-size: 14px;
  margin-bottom: 10px;
}

.tw-suggestions {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.tw-suggestion {
  border: 1px solid #e5e5e5;
  background: #f9fafb;
  border-radius: 8px;
  padding: 8px 10px;
  text-align: right;
  cursor: pointer;
}

.tw-unit-toggles {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.tw-unit-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

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

.tw-toggle {
  display: inline-flex;
  gap: 6px;
  background: #f3f4f6;
  padding: 4px;
  border-radius: 999px;
}

.tw-toggle button {
  border: none;
  background: transparent;
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 12px;
}

.tw-toggle button.is-active {
  background: #ffffff;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

.tw-calc-details {
  border-top: 1px solid #f0f0f0;
  padding-top: 12px;
  margin-bottom: 12px;
}

.tw-calc-title {
  margin: 0 0 10px;
}

.tw-calc-meta {
  display: grid;
  gap: 8px;
}

.tw-calc-meta-item {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.tw-calc-meta-label {
  color: var(--tw-muted);
}

.tw-calc-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.tw-input-group label {
  display: block;
  font-size: 12px;
  color: var(--tw-muted);
  margin-bottom: 6px;
}

.tw-toggle-pill {
  border: 1px solid var(--tw-border);
  padding: 8px 12px;
  border-radius: 999px;
  background: #f9fafb;
  cursor: pointer;
}

.tw-calc-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.tw-result-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 6px;
}

.tw-btn {
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tw-btn-cta {
  background: var(--tw-orange);
  border: none;
  color: #ffffff;
}

.tw-btn-ghost {
  border: 1px solid var(--tw-border);
  background: #f3f4f6;
  color: var(--tw-dark);
}

.tw-btn-small {
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid var(--tw-border);
  background: #ffffff;
}

.tw-cut-header h3 {
  margin: 0 0 12px;
}

.tw-cut-list {
  display: grid;
  gap: 10px;
}

.tw-quote-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.tw-quote-meta .tw-input {
  margin-bottom: 0;
}

.tw-textarea {
  resize: vertical;
  min-height: 74px;
}

.tw-quote-meta .tw-input-group:last-child {
  grid-column: 1 / -1;
}

.tw-cut-item {
  border: 1px solid #e5e5e5;
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.tw-cut-title {
  font-weight: 600;
}

.tw-cut-inputs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.tw-cut-total {
  font-weight: 700;
  color: var(--tw-orange);
}

.tw-cut-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.tw-cut-summary {
  margin-top: 8px;
  font-weight: 600;
}

.tw-table-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
}

.tw-filter-list {
  display: grid;
  gap: 12px;
}

.tw-filter {
  border: 1px solid var(--tw-border);
  border-radius: 4px;
  padding: 8px;
  background: #fafafa;
}

.tw-filter-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
}

.tw-filter-values {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  margin-bottom: 8px;
}

.tw-filter-value {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  padding: 4px 8px;
  border-radius: 6px;
  min-width: 52px;
  text-align: center;
}

.tw-filter-divider {
  width: 8px;
  height: 2px;
  background: #9ca3af;
  display: inline-block;
}

.tw-filter-unit {
  color: var(--tw-muted);
  margin-inline-start: auto;
}

.tw-filter-range {
  display: grid;
  gap: 6px;
}

.tw-filter-input {
  width: 100%;
}

.tw-table {
  display: grid;
  gap: 8px;
  border-radius: 0 0 0 4px;
  border-right: none;
}

.tw-table-header {
  position: sticky;
  top: 0;
  z-index: 2;
  overflow: hidden;
}

.tw-row {
  display: grid;
  grid-template-columns: var(--tw-columns, 46px 60px repeat(4, minmax(120px, 1fr)) 150px);
  gap: 8px;
  align-items: center;
  background: #ffffff;
  border: 1px solid #f0f0f0;
  border-radius: 10px;
  padding: 6px 10px;
  min-height: 48px;
  min-width: var(--tw-min-width, 900px);
}

.tw-row-head {
  background: #f3f4f6;
  font-size: 12px;
  font-weight: 600;
}

.tw-cell {
  text-align: center;
  font-size: 13px;
  color: var(--tw-dark);
}

.tw-cell-head {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.tw-cell-head.is-sorted::after {
  content: attr(data-dir);
  font-size: 10px;
  color: var(--tw-muted);
  margin-inline-start: 4px;
}

.tw-table-viewport {
  height: 420px;
  overflow: auto;
  position: relative;
  background: #f9fafb;
  border-radius: 12px;
  padding: 6px;
}

.tw-table-spacer {
  width: 100%;
}

.tw-table-rows {
  position: absolute;
  inset-inline-start: 0;
  inset-inline-end: 0;
  top: 0;
  display: grid;
  gap: 8px;
}

.tw-shape {
  display: inline-flex;
  width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border: 2px solid #3d5aa7;
  color: #3d5aa7;
  border-radius: 4px;
}

.tw-shape-circle {
  border-radius: 50%;
}

.tw-shape-rect {
  width: 20px;
  height: 12px;
  border-radius: 3px;
}

.tw-shape-i::before {
  content: 'I';
  font-size: 12px;
  font-weight: 700;
}

.tw-shape-angle {
  border-top: 0;
  border-left: 0;
  width: 16px;
  height: 16px;
}

.tw-shape-u {
  border-radius: 3px;
}

.tw-shape-t {
  border-radius: 3px;
}

.tw-empty {
  color: var(--tw-muted);
  font-size: 13px;
}

.tw-footnote {
  color: #121212;
  font-family: Rubik;
  font-size: 14px;
  opacity: 0.7;
  font-style: normal;
  font-weight: 400;
  line-height: 20px;
  margin: auto;
  max-width: 1150px;
}

@media (max-width: 1100px) {
  .tw-calc-grid {
    grid-template-columns: 1fr;
  }

  .tw-quote-meta {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 980px) {
  .tw-table-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .tw-app {
    padding: 16px;
  }

  .tw-calc-inputs,
  .tw-calc-results {
    grid-template-columns: 1fr;
  }

  .tw-table-viewport {
    height: 360px;
  }

  .tw-cut-actions {
    flex-direction: column;
  }

  .tw-btn-classic-side {
    position: static;
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    margin-bottom: 10px;
  }
}
