:root {
  color-scheme: light;
  --ink: #232323;
  --muted: #6e746c;
  --line: #e1e6df;
  --field: #f8faf7;
  --paper: #ffffff;
  --band: #f3f7f1;
  --accent: #18a84a;
  --accent-dark: #0c7c35;
  --danger: #9d3329;
  --gold: #b8a15a;
  --deep: #07180e;
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #f6f7f4;
  max-width: 100%;
}

button, input, select { font: inherit; }

button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 0.65rem 0.9rem;
  cursor: pointer;
}

button:hover { background: var(--accent-dark); }

button.secondary {
  background: var(--paper);
  color: var(--accent-dark);
}

button.secondary:hover { background: var(--band); }

button.danger {
  border-color: var(--danger);
  background: #fff;
  color: var(--danger);
}

button.small { padding: 0.45rem 0.6rem; }
.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  padding: 0.8rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.92);
  color: #fff;
  box-shadow: 0 2px 18px rgba(0, 0, 0, 0.15);
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(1.35rem, 4vw, 2.6rem); }
h2 { margin-bottom: 0.75rem; }
h3 { margin-bottom: 0.8rem; }

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-lockup img {
  width: 146px;
  max-width: 32vw;
  height: auto;
  display: block;
}

.eyebrow {
  margin-bottom: 0.3rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.auth-panel, .button-row, .panel-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.auth-panel, .panel-title { justify-content: space-between; }

main {
  display: grid;
  gap: 1.25rem;
  padding: 1.25rem clamp(1rem, 4vw, 3rem) 3rem;
}

.login-view {
  min-height: calc(100vh - 86px);
  padding: 0;
}

.login-hero, .results-band, .panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 1rem;
}

.login-hero {
  min-height: calc(100vh - 86px);
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: clamp(1rem, 4vw, 3rem);
  align-items: center;
  border: 0;
  border-radius: 0;
  padding: clamp(1.5rem, 6vw, 5rem);
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.82), rgba(0, 0, 0, 0.45)),
    url("https://www.herbania.ro/assets/img/hero-carousel/1.jpg");
  background-size: cover;
  background-position: center;
}

.intro-copy { max-width: 760px; }
.intro-copy p, .login-form p, .status-line { color: var(--muted); }
.help-text {
  margin: 0.8rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}
.login-copy {
  color: #fff;
}

.login-copy p {
  color: rgba(255, 255, 255, 0.84);
  font-size: 1.05rem;
  line-height: 1.7;
}

.login-copy h2 {
  max-width: 720px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.08;
}

.login-logo {
  display: block;
  width: 210px;
  max-width: 56vw;
  margin-bottom: 1.5rem;
}

.login-form {
  display: grid;
  gap: 0.75rem;
  border-top: 4px solid var(--accent);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 1.25rem;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.25);
}
.data-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
/* Prevent grid items from expanding the page beyond the viewport */
.panel, .results-band, .shipment-panel { min-width: 0; }
.field-grid { display: grid; gap: 0.8rem; }
.field-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

label {
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.9rem;
}

input, select {
  width: 100%;
  min-height: 2.55rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  padding: 0.55rem 0.65rem;
}

input:disabled,
select:disabled {
  color: var(--muted);
  background: #ecefeb;
  cursor: not-allowed;
}

.field-button {
  min-height: 2.55rem;
  width: 100%;
}

.modal {
  width: min(720px, calc(100vw - 2rem));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.58);
}

.modal form {
  display: grid;
  gap: 1rem;
  padding: 1rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.bottom-actions {
  display: flex;
  justify-content: flex-end;
}

.table-wrap { width: 100%; overflow-x: auto; }

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem;
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.shipment-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 1rem;
}

.line-list { display: grid; gap: 0.75rem; }

.shipment-line {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(160px, 1fr) minmax(110px, 0.55fr) auto;
  gap: 0.75rem;
  align-items: end;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 1rem 0;
}

.shipment-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.summary-box {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  background: var(--field);
  padding: 0.85rem;
}

.summary-box span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.shipment-meta div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  padding: 0.75rem;
}

.shipment-meta span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.shipment-meta strong {
  display: block;
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}

.summary-box strong {
  display: block;
  margin-top: 0.3rem;
  font-size: 1.15rem;
}

.status-line {
  min-height: 1.2rem;
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .topbar, .login-hero, .shipment-layout { grid-template-columns: 1fr; }
  .topbar { display: grid; }
  .auth-panel, .panel-title { align-items: flex-start; }
  .summary-grid, .shipment-meta, .field-grid.two { grid-template-columns: 1fr; }
  .shipment-line { grid-template-columns: 1fr; }
  .brand-lockup { align-items: flex-start; }
}

@media (max-width: 640px) {
  .topbar {
    gap: 1rem;
    padding: 0.8rem 1rem;
  }

  .brand-lockup {
    display: grid;
    gap: 0.7rem;
  }

  .brand-lockup img {
    width: 132px;
    max-width: 70vw;
  }

  .auth-panel,
  .button-row,
  .panel-title,
  .dialog-actions,
  .bottom-actions {
    display: grid;
    width: 100%;
  }

  .auth-panel button,
  .button-row button,
  .dialog-actions button,
  .bottom-actions button {
    width: 100%;
  }

  main {
    padding: 0.9rem 0.75rem 2rem;
  }

  .login-view {
    padding: 0;
  }

  .login-hero {
    min-height: auto;
    padding: 1.25rem 0.85rem 2rem;
    align-content: start;
  }

  .login-logo {
    width: 170px;
  }

  .login-copy h2 {
    font-size: 2rem;
  }

  .panel,
  .results-band {
    padding: 0.85rem;
  }

  .modal {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
    overflow-y: auto;
  }

  .modal form {
    padding: 0.85rem;
  }

  .shipment-line {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.75rem;
    background: var(--field);
  }

  .table-wrap {
    overflow: visible;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  tr {
    margin-bottom: 0.8rem;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--paper);
    padding: 0.65rem;
  }

  td {
    display: grid;
    grid-template-columns: minmax(105px, 0.8fr) minmax(0, 1.2fr);
    gap: 0.6rem;
    align-items: center;
    border-bottom: 1px solid var(--line);
    padding: 0.55rem 0;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 700;
  }

  td:empty {
    display: none;
  }
}
