:root {
  --bg: #f5f8f7;
  --surface: #ffffff;
  --surface-soft: #eaf2ef;
  --text: #1b2725;
  --muted: #576967;
  --line: #d5e3df;
  --brand: #0a7f6f;
  --brand-strong: #05594f;
  --accent: #f2a541;
  --danger: #b43f3f;
  --radius: 16px;
  --shadow: 0 10px 28px rgba(11, 60, 53, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #def2ea 0%, transparent 45%), var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 999px;
  filter: blur(70px);
}

.bg-shape-a {
  width: 300px;
  height: 300px;
  background: rgba(10, 127, 111, 0.2);
  top: -80px;
  right: -50px;
}

.bg-shape-b {
  width: 240px;
  height: 240px;
  background: rgba(242, 165, 65, 0.22);
  bottom: -60px;
  left: -40px;
}

.wrap {
  width: min(1080px, 92vw);
  margin: 0 auto;
}

.topbar {
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
  background: rgba(245, 248, 247, 0.82);
  border-bottom: 1px solid var(--line);
  z-index: 4;
}

.topbar-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 68px;
}

.brand {
  font-weight: 800;
  letter-spacing: 0.3px;
  color: var(--brand-strong);
  text-decoration: none;
  font-size: 1.08rem;
}

.nav-links {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.nav-links a {
  text-decoration: none;
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
}

.nav-links a:hover {
  background: var(--surface-soft);
}

.menu-dropdown {
  position: relative;
}

.menu-dropdown summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 10px;
  user-select: none;
}

.menu-dropdown summary::-webkit-details-marker {
  display: none;
}

.menu-dropdown[open] summary,
.menu-dropdown summary:hover {
  background: var(--surface-soft);
}

.menu-dropdown-panel {
  position: absolute;
  left: 0;
  top: calc(100% + 4px);
  min-width: 230px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
  z-index: 50;
  display: grid;
  gap: 4px;
}

.menu-dropdown-panel a {
  display: block;
}

.menu-subdropdown summary {
  list-style: none;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: 8px;
}

.menu-subdropdown summary::-webkit-details-marker {
  display: none;
}

.menu-subdropdown[open] summary,
.menu-subdropdown summary:hover {
  background: #f2f7fa;
}

.menu-subpanel {
  padding-left: 10px;
  display: grid;
  gap: 4px;
}

main {
  padding: 24px 0 44px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

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

.dashboard-kpis article {
  background: #f6f8fa;
  border: 1px solid #dde3e8;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dashboard-kpis strong {
  color: #44555d;
}

.dashboard-kpis span {
  font-size: 1.25rem;
  font-weight: 800;
}

.ops-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 495px));
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ops-card {
  background: #fff;
  border: 1px solid #d8dee3;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 12px;
}

.ops-grid > .ops-card {
  width: min(100%, 495px);
  max-width: 495px;
  height: 333px;
}

.ops-head {
  min-height: 46px;
  padding: 8px 10px;
  border-bottom: 1px solid #d8dee3;
  background: #f3f5f7;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.ops-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.ops-head select {
  width: auto;
  min-width: 130px;
  border-radius: 8px;
  padding: 6px 8px;
}

.ops-body {
  padding: 10px;
}

.ops-body-fixed {
  height: 286px;
}

.ops-table-scroll {
  max-height: 265px;
  overflow: auto;
}

.ops-body canvas {
  display: block;
  width: 100%;
  max-width: 100%;
}

.ops-table th {
  background: #f5f7f9;
  font-size: 0.9rem;
}

.ops-table td {
  font-size: 0.92rem;
}

.ops-table .danger {
  color: #c0392b;
  font-weight: 700;
}

.ops-legend {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.9rem;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 5px;
}

.dot.overdue { background: #d64545; }
.dot.active { background: #5b84c4; }
.dot.done { background: #2eaf44; }

.hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

h1, h2, h3 {
  margin-top: 0;
  margin-bottom: 10px;
}

p {
  margin-top: 0;
}

.muted {
  color: var(--muted);
}

.btn {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 10px 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 600;
}

.btn:hover {
  background: var(--surface-soft);
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-strong));
  color: #fff;
  border: 1px solid var(--brand-strong);
}

.btn-primary:hover {
  filter: brightness(1.04);
}

.searchbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

input[type="checkbox"],
input[type="radio"] {
  width: auto;
  padding: 0;
}

label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  position: relative;
}

textarea {
  resize: vertical;
}

.card-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.card h3 a {
  color: inherit;
  text-decoration: none;
}

.row-between {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.meta-grid div {
  background: var(--surface-soft);
  padding: 8px;
  border-radius: 10px;
  display: grid;
}

.meta-grid strong {
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 2px;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-section {
  display: grid;
  gap: 10px;
}

.full-width {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  gap: 10px;
}

.stats-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.stat p {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.split-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 16px;
}

.table-wrap {
  overflow: auto;
  margin-bottom: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  font-size: 0.94rem;
}

.sheet-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.status {
  font-size: 0.78rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.status-draft {
  background: #dde8ff;
  color: #1b3d8a;
}

.status-in-progress {
  background: #fff1d8;
  color: #8d5700;
}

.status-ready {
  background: #d9f3e0;
  color: #0f6d34;
}

.status-delivered {
  background: #d7f4f0;
  color: #0e675f;
}

.report-filters {
  background: linear-gradient(180deg, #b6d5ef 0%, #9bc0e1 100%);
}

.report-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.report-filter-grid-5 {
  grid-template-columns: 1fr 1.2fr 1fr 0.8fr auto;
}

.report-filter-grid input[type="date"] {
  min-width: 0;
  max-width: 100%;
}

.column-picker {
  margin-top: 12px;
}

.column-picker summary {
  cursor: pointer;
  font-weight: 700;
  color: #173650;
}

.column-picker-grid {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.column-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid #b7cde2;
  border-radius: 999px;
  background: #e8f1fa;
  font-size: 0.9rem;
}

.report-table th {
  background: #9bc0e1;
  font-size: 0.96rem;
  white-space: nowrap;
}

.report-table td {
  font-size: 0.94rem;
  font-weight: 600;
  white-space: nowrap;
}

.job-link {
  color: #101010;
  text-decoration: underline;
}

.actions-cell {
  white-space: nowrap;
}

.report-nowrap td,
.report-nowrap th,
.report-nowrap .job-link {
  white-space: nowrap !important;
}

.report-table {
  table-layout: fixed;
  width: 100%;
  min-width: 1880px;
}

.report-table col.col-id { width: 86px; }
.report-table col.col-issue-date { width: 126px; }
.report-table col.col-title { width: 260px; }
.report-table col.col-client { width: 170px; }
.report-table col.col-tiraj { width: 86px; }
.report-table col.col-numar-pagini { width: 102px; }
.report-table col.col-nr-ex-per-coala { width: 118px; }
.report-table col.col-format { width: 220px; }
.report-table col.col-provenienta { width: 136px; }
.report-table col.col-machine { width: 110px; }
.report-table col.col-status { width: 132px; }
.report-table col.col-priority { width: 110px; }
.report-table col.col-delivery-date { width: 130px; }
.report-table col.col-actions { width: 150px; }

.cell {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions-cell {
  overflow: visible !important;
  white-space: nowrap !important;
  padding-right: 2px;
  text-overflow: clip !important;
}

.actions-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  text-decoration: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0 8px;
}

.deadline-overdue {
  color: #9f1f1f;
  font-weight: 800;
}

.deadline-today {
  color: #8b5500;
  font-weight: 800;
}

.autocomplete-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 2px);
  z-index: 20;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.08);
  max-height: 240px;
  overflow-y: auto;
}

.autocomplete-menu-floating {
  position: fixed;
  z-index: 9999;
}

.autocomplete-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  background: #fff;
  border: 0;
  border-bottom: 1px solid #e8eef2;
  font: inherit;
  cursor: pointer;
}

.autocomplete-item:hover {
  background: #f1f7fc;
}

.autocomplete-item:last-child {
  border-bottom: 0;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.btn-disabled {
  opacity: 0.45;
  pointer-events: none;
}

.legacy-create-form {
  gap: 14px;
}

.legacy-create-form .panel {
  border-radius: 14px;
  border-color: #cddced;
}

.legacy-create-form h2 {
  margin-bottom: 8px;
  color: #153a5f;
}

.order-form {
  display: grid;
  gap: 14px;
}

.order-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.order-card {
  border-radius: 14px;
  border-color: #cddced;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.order-card h2 {
  margin-bottom: 10px;
  color: #153a5f;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.field-grid {
  display: grid;
  gap: 10px;
}

.field-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-span-2 {
  grid-column: 1 / -1;
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 700;
}

.finishing-grid {
  display: grid;
  gap: 10px;
}

.finish-row {
  display: grid;
  grid-template-columns: 170px 1fr;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid #dce6f0;
  border-radius: 10px;
  background: #f8fbff;
}

.finish-row.with-options {
  grid-template-columns: 170px 180px 1fr;
}

.order-form.order-compact .panel {
  padding: 12px;
}

.order-form.order-compact .field-grid {
  gap: 7px;
}

.order-form.order-compact .finish-row {
  grid-template-columns: 145px 1fr;
  gap: 8px;
  padding: 7px 8px;
}

.order-form.order-compact .finish-row.with-options {
  grid-template-columns: 145px 160px 1fr;
}

.order-form.order-compact .legacy-inline {
  gap: 8px;
  padding: 6px 8px;
}

.order-form.order-compact label {
  gap: 4px;
}

.order-form.order-compact textarea {
  min-height: 92px;
}

.legacy-inline {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  background: #f4f8fc;
  border: 1px solid #d8e4f1;
  border-radius: 10px;
  padding: 8px 10px;
}

.legacy-inline label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: 600;
}

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

.legacy-matrix h2 {
  grid-column: 1 / -1;
}

.legacy-matrix > input[type="text"] {
  width: 100%;
}

.admin-users-list {
  display: grid;
  gap: 12px;
}

.admin-user-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fcfb;
  padding: 12px;
}

.admin-user-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.admin-user-title {
  display: grid;
  gap: 4px;
}

.admin-user-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-action-form {
  display: grid;
  gap: 8px;
}

.admin-action-form input {
  color: var(--text) !important;
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  background: #fff;
}

pre {
  overflow: auto;
  background: #111a19;
  color: #cff2ec;
  padding: 12px;
  border-radius: 12px;
}

@media (max-width: 900px) {
  .split-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .order-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-kpis {
    grid-template-columns: 1fr;
  }

  .ops-grid {
    grid-template-columns: 1fr;
  }

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

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

  .finish-row,
  .finish-row.with-options {
    grid-template-columns: 1fr;
  }

  .section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .sheet-form {
    grid-template-columns: 1fr;
  }

  .admin-user-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .wrap {
    width: min(1080px, 96vw);
  }

  .topbar-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-height: auto;
    padding: 8px 0;
  }

  .brand {
    font-size: 1rem;
  }

  .nav-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
    align-items: center;
    width: 100%;
  }

  .nav-links a {
    padding: 6px 8px;
    font-size: 0.95rem;
    text-align: center;
  }

  .nav-links .muted {
    display: none;
  }

  .nav-links form {
    grid-column: span 2;
  }

  .menu-dropdown-panel {
    position: static;
    min-width: 0;
    margin-top: 4px;
  }

  .nav-links form .btn {
    width: 100%;
    padding: 8px 10px;
  }

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

  .searchbar {
    grid-template-columns: 1fr;
  }

  .report-filter-grid {
    grid-template-columns: 1fr;
  }

  .report-filter-grid-5 {
    grid-template-columns: 1fr;
  }

  .legacy-matrix {
    grid-template-columns: 1fr;
  }

  .report-table {
    min-width: 1320px;
  }
}
