:root {
  --teal: #028eb9;
  --teal-dark: #015f7b;
  --deep: #012f3e;
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #26262e;
  --muted: #687080;
  --border: #d9e0e8;
  --ok: #407c51;
  --warn: #ed5829;
  --danger: #ed1c24;
  --shadow: 0 8px 24px rgba(1, 47, 62, .08);
}

* { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
body { margin: 0; font-family: Arial, sans-serif; color: var(--text); background: var(--bg); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
.hidden { display: none !important; }
.muted { color: var(--muted); line-height: 1.55; }
.error { color: var(--danger); min-height: 1.2em; font-size: 13px; }
.eyebrow { color: var(--teal-dark); font-size: 11px; font-weight: 700; letter-spacing: .16em; margin: 0 0 8px; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg); }
.login-card { width: 360px; max-width: 100%; padding: 34px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); }
.login-card label { display: block; font-size: 12px; font-weight: 700; margin: 16px 0; }
.login-card input { width: 100%; padding: 11px 12px; margin-top: 6px; border: 1px solid var(--border); border-radius: 6px; outline: none; }
.login-card input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(2, 142, 185, .1); }
.brand-block, .top-actions { display: flex; align-items: center; gap: 11px; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { color: white; font-size: 14px; }
.brand-text small { color: #9bd6e8; font-size: 11px; margin-top: 2px; }
.login-brand .brand-text strong { color: var(--deep); }
.login-brand .brand-text small { color: var(--teal); }
.login-subtitle { color: var(--muted); font-size: 12px; margin: 18px 0 4px; }

.topbar { height: 62px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; background: var(--deep); }
.topbar .ghost { color: white; border: 1px solid rgba(255,255,255,.42); padding: 6px 11px; }
.safe-badge { padding: 5px 9px; color: #dcebf0; border: 1px solid rgba(255,255,255,.25); border-radius: 5px; font-size: 11px; font-weight: 700; }
main { width: 100%; min-width: 0; max-width: none; margin: 0; padding: 18px 18px 48px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin: 0 28px 18px; }
.breadcrumb { color: var(--muted); font-size: 11px; margin: 0 0 10px; }
.breadcrumb span { padding: 0 5px; }
.page-heading h1 { color: #162033; font-size: 25px; margin: 0 0 5px; }
.page-heading p:last-child { color: var(--muted); font-size: 12px; margin: 0; }
.product-total { text-align: right; color: var(--teal-dark); }
.product-total strong { font-size: 26px; margin-right: 5px; }
.product-total span { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.view-strip { display: flex; gap: 10px; padding: 0 28px 16px; overflow-x: auto; }
.view-card { min-width: 190px; padding: 11px 13px; text-align: left; background: white; border: 1px solid var(--border); border-radius: 6px; color: var(--text); }
.view-card strong, .view-card small { display: block; }
.view-card strong { font-size: 12px; }
.view-card small { color: var(--muted); font-size: 10px; margin-top: 3px; }
.view-card.active { border: 2px solid #116dff; padding: 10px 12px; }
.workspace { width: 100%; min-width: 0; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 12px; }
.panel, .content-panel { background: white; border: 1px solid var(--border); border-radius: 7px; }
.import-panel { padding: 18px; align-self: start; }
.import-panel h2, .toolbar h2 { margin: 0; }
.dropzone { min-height: 90px; margin: 16px 0 10px; padding: 14px; display: grid; place-items: center; text-align: center; border: 1px dashed var(--teal); border-radius: 6px; background: #f2fafc; color: var(--teal-dark); cursor: pointer; }
.dropzone span { display: block; color: var(--muted); font-size: 12px; font-weight: 400; overflow-wrap: anywhere; }
.source-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 16px 0 10px; padding: 3px; background: #eef2f6; border-radius: 6px; }
.source-tab { padding: 7px 6px; border: 0; border-radius: 4px; color: var(--muted); background: transparent; font-size: 11px; }
.source-tab.active { color: var(--deep); background: white; box-shadow: 0 1px 3px rgba(22,32,51,.12); font-weight: 700; }
.sheet-label { display: block; margin: 14px 0 6px; font-size: 11px; font-weight: 700; }
.sheet-input { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 5px; font-size: 11px; }
.sheet-input:focus { border-color: #116dff; outline: 0; box-shadow: 0 0 0 2px rgba(17,109,255,.12); }
.source-help { color: var(--muted); font-size: 10px; line-height: 1.45; }
.primary, .secondary, .ghost, .publish-disabled { border-radius: 5px; padding: 8px 11px; border: 0; font-size: 11px; font-weight: 700; }
.primary { background: var(--teal); color: white; }
.secondary { border: 1px solid var(--teal); color: var(--teal-dark); background: white; }
.ghost { background: transparent; color: var(--muted); }
.publish-disabled { background: #ecebea; color: #777; }
.full { width: 100%; }
.divider { margin: 18px 0; display: flex; align-items: center; color: #aaa; font-size: 11px; }
.divider::before, .divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.divider span { padding: 0 9px; }
.history { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border); }
.history h3 { font-size: 13px; }
.history #import-list { max-height: 360px; overflow-y: auto; padding-right: 3px; }
.import-row { display: grid; grid-template-columns: minmax(0, 1fr) 34px; gap: 5px; margin: 5px 0; }
.import-item { width: 100%; min-width: 0; padding: 10px; text-align: left; background: #fafafa; border: 1px solid var(--border); border-radius: 7px; }
.import-item strong, .import-item small { display: block; overflow: hidden; text-overflow: ellipsis; }
.import-item small { color: var(--muted); margin-top: 4px; }
.import-delete { align-self: stretch; border: 1px solid #f0c8c6; border-radius: 7px; background: #fff7f6; color: var(--danger); font-size: 16px; }
.import-delete:hover { background: #fff0ef; }
.content-panel { width: 100%; min-width: 0; overflow: hidden; }
.toolbar { min-height: 62px; padding: 12px 14px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; border-bottom: 1px solid var(--border); }
.toolbar > div:first-child { display: flex; align-items: center; gap: 10px; }
.table-view-title { color: #162033; font-size: 14px; }
.table-mode { padding: 5px 9px; border: 1px solid var(--border); border-radius: 14px; color: var(--muted); font-size: 10px; }
.toolbar-actions { display: flex; align-items: center; gap: 7px; }
.search-box { width: 190px; display: flex; align-items: center; gap: 6px; padding: 6px 9px; border: 1px solid var(--border); border-radius: 16px; color: var(--muted); background: white; }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; font-size: 11px; }
.empty-state { padding: 80px 30px; text-align: center; color: var(--muted); }
.empty-icon { color: var(--teal); font-size: 42px; }
.empty-state h3 { color: var(--text); }
.status-banner { margin: 18px 24px 0; padding: 13px 16px; border-radius: 8px; background: #eef8fb; color: var(--teal-dark); overflow-wrap: anywhere; }
.product-table-wrap { width: 100%; max-width: 100%; overflow: auto; overscroll-behavior-inline: contain; scrollbar-gutter: stable; }
.product-table { width: 100%; min-width: 1080px; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: 11px; }
.product-table th { width: 180px; padding: 8px 10px; background: #eaf3ff; color: #263448; border-right: 1px solid #bad1ec; border-bottom: 1px solid #bad1ec; text-align: left; font-size: 10px; font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.product-table th:first-child, .product-summary td:first-child { width: 112px; position: sticky; left: 0; z-index: 2; }
.product-table th:nth-child(2), .product-summary td:nth-child(2) { width: 125px; position: sticky; left: 112px; z-index: 2; }
.product-table th:first-child, .product-table th:nth-child(2) { z-index: 3; }
.product-table th:nth-last-child(2) { width: 230px; }
.product-table th:last-child { width: 125px; }
.product-summary td { min-width: 0; padding: 8px 10px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); vertical-align: top; background: white; overflow: hidden; }
.product-summary:hover td { background: #f5f9ff; }
.cell-text, .proposal-cell { display: -webkit-box; max-width: 100%; overflow: hidden; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.cell-strong { color: #1f2937; }
.cell-empty { color: #9aa3af; font-style: italic; }
.cms-status { display: inline-block; padding: 3px 8px; border-radius: 2px; background: #e9eef5; color: #4b5563; font-size: 10px; text-transform: capitalize; white-space: nowrap; }
.status-pronto, .status-revisionato { color: white; background: #20a85a; }
.status-da_revisionare { color: #754d00; background: #fff0b8; }
.cms-tag { display: inline-block; max-width: 100%; margin: 1px 3px 1px 0; padding: 3px 8px; border-radius: 12px; color: #32445c; background: #dfebfa; overflow: hidden; overflow-wrap: anywhere; white-space: normal; vertical-align: middle; }
.tag-list { display: flex; max-width: 100%; max-height: 86px; flex-wrap: wrap; overflow: auto; }
.cms-issue { color: var(--ok); white-space: nowrap; }
.cms-issue.has-blocker { color: var(--danger); }
.proposal-cell.decision-approvato { color: var(--ok); }
.proposal-cell.decision-rifiutato { color: var(--danger); text-decoration: line-through; }
.decision-summary { white-space: nowrap; }
.no-results { padding: 34px !important; text-align: center; color: var(--muted); }
.row-actions { white-space: nowrap; }
.row-actions button + button { margin-left: 5px; }
.product-detail-row td { padding: 0; border: 1px solid var(--border); border-top: 2px solid var(--teal); }
.product-detail { width: 100%; min-width: 0; padding: 18px; background: #f8fbff; overflow-wrap: anywhere; }
.source-data { margin-bottom: 18px; }
.source-data h4 { margin: 0 0 10px; font-size: 13px; }
.source-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.source-field { min-width: 0; padding: 10px; border: 1px solid var(--border); border-radius: 6px; background: white; }
.source-field strong { display: block; margin-bottom: 5px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.source-field span { display: block; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.source-field.source-long { grid-column: span 2; }
.validation-box { margin-bottom: 16px; }
.validation-item { padding: 8px 10px; margin: 5px 0; border-left: 3px solid var(--warn); background: white; font-size: 12px; }
.validation-item.blocker { border-color: var(--danger); }
.proposal { display: grid; grid-template-columns: 175px minmax(0, 1fr) auto; gap: 15px; padding: 16px 0; border-top: 1px solid var(--border); }
.proposal:first-child { border-top: 0; }
.proposal-label strong { display: block; }
.proposal-label small { display: block; margin-top: 6px; color: var(--muted); }
.proposal-value { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; line-height: 1.55; }
.proposal-actions { display: flex; gap: 7px; align-items: start; }
.proposal-actions button { padding: 7px 9px; border-radius: 6px; border: 1px solid var(--border); background: white; }
.proposal-actions .selected { border-color: var(--ok); color: var(--ok); background: #edf6ef; }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 1fr; }
  .product-table { min-width: 1100px; }
}
@media (max-width: 700px) {
  main { padding: 10px; }
  .topbar { padding: 0 10px; }
  .brand-logo { width: 32px; height: 32px; }
  .brand-text strong { font-size: 12px; }
  .brand-text small, .safe-badge { display: none; }
  .page-heading { align-items: start; margin: 0 0 16px; }
  .product-total { display: none; }
  .view-strip { padding: 0 0 14px; }
  .toolbar { align-items: start; flex-direction: column; }
  .toolbar-actions { width: 100%; flex-wrap: wrap; }
  .search-box { width: 100%; }
  .proposal { grid-template-columns: 1fr; }
  .source-field.source-long { grid-column: span 1; }
}
