/* WS Oferta Builder v1.4 */
*, *::before, *::after { box-sizing: border-box; }

#wsob-wrap {
  max-width: 1060px;
  margin: 0 auto;
  padding: 20px 14px 60px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  color: #1a1a1a;
}

/* ---- HEADER ---- */
#wsob-company-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 18px;
  background: #fff;
  border: 2px solid #e8e8e8;
  border-radius: 10px;
  margin-bottom: 18px;
}
#wsob-header-logo { flex: 0 0 auto; }
#wsob-logo { max-height: 70px; max-width: 170px; object-fit: contain; display: block; }
#wsob-no-logo {
  width:100px; height:60px; border:2px dashed #ccc; border-radius:6px;
  display:flex; align-items:center; justify-content:center;
  text-align:center; font-size:11px; color:#aaa; line-height:1.4;
}
#wsob-header-info {
  text-align: right;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.7;
}
#wsob-header-info strong { font-size: 15px; display: block; margin-bottom: 1px; }
#wsob-header-info span   { font-size: 13px; color: #444; display: block; }

/* ---- META ---- */
#wsob-meta { margin-bottom: 16px; }
.wsob-meta-row { display: flex; gap: 12px; flex-wrap: wrap; }
.wsob-meta-field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 150px; }
.wsob-meta-wide  { flex: 2; min-width: 220px; }
.wsob-meta-tiny  { flex: 0 0 auto; width: 110px; min-width: 110px; }
.wsob-meta-field label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .4px; color: #666;
}
.wsob-meta-field input {
  padding: 8px 10px;
  border: 1.5px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  transition: border-color .15s;
  width: 100%;
}
.wsob-meta-field input:focus { outline: none; border-color: #f5a623; box-shadow: 0 0 0 3px rgba(245,166,35,.12); }

/* ---- TABLE ---- */
#wsob-table-wrap {
  overflow-x: auto;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 0;
}
#wsob-table { width: 100%; border-collapse: collapse; min-width: 660px; table-layout: fixed; }
#wsob-table thead tr { background: #FFD700; }
#wsob-table thead th {
  padding: 9px 6px; font-size: 11px; font-weight: 700;
  text-align: center; border-bottom: 2px solid #ccc;
  border-right: 1px solid #ccc; line-height: 1.3;
}
#wsob-table thead th:last-child { border-right: none; }
#wsob-table thead th small { font-weight: 400; font-size: 10px; }

#wsob-table tbody tr:nth-child(even) { background: #fafafa; }
#wsob-table tbody tr:hover { background: #fff8e1; }
#wsob-table tr.wsob-spacer-row td { background:#f0f0f0; height:7px; padding:0; border-bottom:1px solid #ddd; }

#wsob-table td { border-bottom:1px solid #e8e8e8; border-right:1px solid #e8e8e8; padding:0; }
#wsob-table td:last-child { border-right:none; }

#wsob-table td input,
#wsob-table td textarea {
  width: 100%; border: none; background: transparent;
  padding: 8px 8px; font-size: 13px; font-family: inherit;
  color: #1a1a1a; min-height: 38px;
  word-break: break-word; overflow-wrap: break-word; white-space: pre-wrap;
  resize: none; overflow: hidden; display: block; box-sizing: border-box;
  line-height: 1.45;
}
#wsob-table td input:focus,
#wsob-table td textarea:focus { outline: none; background: #fffff0; }
#wsob-table td input[type=number] { text-align: right; white-space: nowrap; overflow: visible; }
/* Celulele tabelului nu depasesc niciodata coloana lor */
#wsob-table td { overflow: hidden; }


.col-nr   { width: 34px; }
.col-nr span { display:block; text-align:center; padding:9px 4px; color:#999; font-size:12px; }
.col-cant { width: 70px; }
.col-pu   { width: 108px; }
.col-pt   { width: 108px; }
.col-ptva { width: 108px; }
.col-obs  { width: 110px; }
.col-del  { width: 32px; text-align:center; }

.readonly-cell {
  padding: 8px 8px; text-align: right; font-size: 13px;
  color: #333; background: #f9f9f9; white-space: nowrap;
}
.wsob-del-btn {
  background:none; border:none; cursor:pointer; color:#cc0000;
  font-size:15px; padding:6px 8px; opacity:.5; transition:opacity .15s; line-height:1;
}
.wsob-del-btn:hover { opacity:1; }

/* tfoot */
#wsob-table tfoot td { border-top:2px solid #ccc; padding:9px 10px; font-weight:700; font-size:13px; }
#wsob-table .tfoot-fara { background:#fffbdc; }
#wsob-table .tfoot-cu   { background:#FFD700; }
.total-label { text-align:right; padding-right:12px !important; }
.total-val   { text-align:right; font-size:15px !important; white-space:nowrap; }

/* ---- ROW ACTIONS ---- */
#wsob-row-actions {
  display: flex; gap: 10px; margin: 10px 0 16px; flex-wrap: wrap;
}
#wsob-row-actions button {
  padding: 7px 14px; border-radius: 6px; cursor: pointer;
  font-size: 13px; transition: all .15s; background:#fff; border:1.5px solid #f5a623; color:#b07d00;
}
#wsob-row-actions button:hover { background: #fff8e1; }
#wsob-row-actions .btn-sep { border-color:#ccc; color:#666; }
#wsob-row-actions .btn-sep:hover { background:#f5f5f5; }

/* ---- NOTES ---- */
#wsob-footer-notes-wrap { margin-bottom: 18px; }
#wsob-footer-notes-wrap label {
  display:block; font-size:11px; font-weight:600;
  text-transform:uppercase; letter-spacing:.4px; color:#666; margin-bottom:6px;
}
#wsob-notes {
  width:100%; padding:10px 12px; border:1.5px solid #d0d0d0;
  border-radius:6px; font-size:13px; font-family:inherit;
  line-height:1.6; resize:vertical;
}
#wsob-notes:focus { outline:none; border-color:#f5a623; }

/* ---- ACTIONS ---- */
#wsob-actions { display:flex; gap:10px; flex-wrap:wrap; margin-bottom:12px; }
#wsob-actions button {
  padding: 10px 18px; border-radius:7px; border:none;
  cursor:pointer; font-size:14px; font-weight:600; transition:all .15s;
}
#btn-preview   { background:#2563eb; color:#fff; }
#btn-preview:hover   { background:#1d4ed8; }
#btn-save      { background:#16a34a; color:#fff; }
#btn-save:hover      { background:#15803d; }
#btn-pdf       { background:#dc2626; color:#fff; }
#btn-pdf:hover       { background:#b91c1c; }
#btn-new, #btn-load-list { background:#f0f0f0; color:#333; }
#btn-new:hover, #btn-load-list:hover { background:#e0e0e0; }

#wsob-status { min-height:26px; font-size:13px; padding:4px 0; }
#wsob-status.ok      { color:#16a34a; font-weight:600; }
#wsob-status.err     { color:#dc2626; font-weight:600; }
#wsob-status.loading { color:#666; }

/* ---- SAVED LIST ---- */
#wsob-saved-list {
  margin-top:18px; border:1.5px solid #e0e0e0;
  border-radius:8px; padding:16px; background:#fafafa;
}
#wsob-saved-list h3 { margin-bottom:12px; font-size:15px; }
#wsob-list-content table { width:100%; border-collapse:collapse; font-size:13px; }
#wsob-list-content th {
  background:#f0f0f0; padding:7px 10px; text-align:left;
  border-bottom:1px solid #ddd; font-size:11px; text-transform:uppercase;
}
#wsob-list-content td { padding:8px 10px; border-bottom:1px solid #eee; }
#wsob-list-content tr:hover td { background:#fff8e1; }
#wsob-list-content a { color:#2563eb; text-decoration:none; cursor:pointer; }

/* ---- PREVIEW MODAL ---- */
#wsob-modal-overlay {
  position:fixed; inset:0; background:rgba(0,0,0,.6);
  z-index:99999; display:flex; align-items:flex-start;
  justify-content:center; padding:20px; overflow-y:auto;
}
#wsob-modal {
  background:#fff; border-radius:10px; width:100%; max-width:820px;
  box-shadow:0 20px 60px rgba(0,0,0,.3); overflow:hidden; margin:auto;
}
#wsob-modal-header {
  background:#1a1a1a; color:#fff; padding:13px 18px;
  display:flex; align-items:center; justify-content:space-between;
  font-weight:600; font-size:15px;
}
.btn-modal-dl {
  background:#dc2626; color:#fff; border:none; border-radius:6px;
  padding:6px 13px; cursor:pointer; font-size:13px; margin-right:8px;
}
.btn-modal-dl:hover { background:#b91c1c; }
.btn-modal-close {
  background:none; border:none; color:#fff; font-size:20px; cursor:pointer; line-height:1;
}
#wsob-modal-body { padding:22px; overflow-x:auto; }

/* ---- PREVIEW INNER ---- */
.pv-header { display:flex; align-items:center; justify-content:space-between; gap:14px; padding-bottom:10px; margin-bottom:12px; border-bottom:2px solid #eee; }
.pv-logo img { max-height:65px; max-width:165px; object-fit:contain; }
.pv-info { text-align:right; line-height:1.7; }
.pv-info strong { font-size:15px; display:block; }
.pv-info span   { font-size:12px; color:#444; display:block; }
.pv-client { font-size:12px; color:#555; margin-bottom:6px; text-align:right; }
.pv-title  { background:#FFD700; text-align:center; font-weight:700; font-size:13px; padding:7px 10px; border:2px solid #000; }

.pv-table  { width:100%; border-collapse:collapse; font-size:12px; table-layout:fixed; }
.pv-table th { background:#FFD700; border:1px solid #000; padding:5px 5px; text-align:center; font-size:10.5px; line-height:1.3; }
.pv-table td { border:1px solid #888; padding:4px 5px; vertical-align:middle; word-break:break-word; overflow-wrap:break-word; overflow:hidden; }
.pv-table td.nr  { text-align:center; width:26px; }
.pv-table td.num { text-align:right; white-space:nowrap; }
.pv-table tr.sep td { background:#f0f0f0; height:5px; padding:0; }
.pv-tot-fara td { background:#fffacd; font-weight:700; border:1.5px solid #000; padding:5px 7px; }
.pv-tot-cu   td { background:#FFD700; font-weight:700; border:1.5px solid #000; padding:5px 7px; font-size:13px; }
.pv-tot-fara td.lbl,.pv-tot-cu td.lbl { text-align:right; padding-right:10px; }
.pv-tot-fara td.val,.pv-tot-cu td.val { text-align:right; }

.pv-footer { margin-top:12px; font-size:12px; line-height:1.8; }
.pv-footer p { margin:0; font-weight:700; }

.pv-stamp-row { display:flex; align-items:flex-end; justify-content:space-between; margin-top:10px; }
.pv-stamp-date { font-size:12px; font-weight:700; }
.pv-stamp-img  { text-align:right; }
.pv-stamp-img img { max-height:80px; max-width:170px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 680px) {
  #wsob-company-header { flex-direction:column; text-align:center; }
  #wsob-header-info { align-items:center; text-align:center; }
  .wsob-meta-row { flex-direction:column; }
  .wsob-meta-wide, .wsob-meta-tiny, .wsob-meta-field { width:100%; flex:1 1 100%; }
  #wsob-actions { flex-direction:column; }
  #wsob-actions button { width:100%; text-align:center; }
  #wsob-row-actions { flex-direction:column; }
  #wsob-row-actions button { width:100%; }
  #wsob-table-wrap { border-radius:4px; }
  .col-obs { display:none; }
  .col-ptva { display:none; }
}
