:root {
  --primary: #1b4965;
  --primary-dark: #123246;
  --accent: #5fa8d3;
  --bg: #f5f7f9;
  --card-bg: #ffffff;
  --border: #dde3e8;
  --text: #22303c;
  --muted: #6b7c8c;
  --success: #1e7d34;
  --danger: #b3261e;
  --warning: #8a5b00;
  --info: #1b4965;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  position: relative;
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* Fundal cu sigla companiei, pe toate paginile aplicatiei */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("logo-watermark.png");
  background-repeat: no-repeat;
  background-position: center 40vh;
  background-size: min(760px, 85vw) auto;
  opacity: 0.11;
  pointer-events: none;
  z-index: 0;
}

.app-shell, .container {
  position: relative;
  z-index: 1;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.app-shell {
  display: flex;
  align-items: stretch;
  min-height: 100vh;
}

/* --- Sidebar de navigare (partea stanga) --- */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: #101820;
  color: #c7d2db;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.2rem 1.1rem 1rem;
}
.sidebar-logo-badge {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}
.sidebar-logo-badge img { width: 100%; height: 100%; object-fit: contain; padding: 4px; }
.sidebar-brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sidebar-brand-name {
  color: white;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-clock {
  font-size: 0.74rem;
  color: #7f92a3;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  margin-top: 0.15rem;
}
.sidebar-nav {
  flex: 1;
  padding: 0.5rem 0 1rem;
}
.sidebar-nav-group { margin-top: 0.9rem; }
.sidebar-nav-group-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #57697a;
  font-weight: 700;
  padding: 0 1.1rem;
  margin-bottom: 0.35rem;
}
.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 1.1rem;
  color: #c7d2db;
  font-size: 0.9rem;
  border-left: 3px solid transparent;
}
.sidebar-nav-link:hover {
  background: rgba(255, 255, 255, 0.05);
  color: white;
  text-decoration: none;
}
.sidebar-nav-link.active {
  background: rgba(95, 168, 211, 0.16);
  color: white;
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
.sidebar-footer {
  padding: 1rem 1.1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user {
  font-size: 0.8rem;
  color: #9fb0bf;
  margin-bottom: 0.6rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user small { color: #718293; }
.sidebar-logout {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: #e6b3ac;
  font-size: 0.88rem;
}
.sidebar-logout:hover { color: white; text-decoration: none; }
.sidebar-logout svg { width: 17px; height: 17px; flex-shrink: 0; }

@media (max-width: 880px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: relative;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 0.5rem 0.75rem;
  }
  .sidebar-brand { padding: 0.4rem 0.4rem; flex-shrink: 0; }
  .sidebar-clock { display: none; }
  .sidebar-nav { display: flex; flex: 1; flex-wrap: wrap; padding: 0; }
  .sidebar-nav-group { display: flex; align-items: center; margin-top: 0; }
  .sidebar-nav-group-title { display: none; }
  .sidebar-nav-link { padding: 0.5rem 0.6rem; border-left: none; border-bottom: 3px solid transparent; }
  .sidebar-nav-link.active { border-left-color: transparent; border-bottom-color: var(--accent); }
  .sidebar-nav-link span { display: none; }
  .sidebar-footer { border-top: none; padding: 0.4rem; margin-left: auto; display: flex; align-items: center; }
  .sidebar-user { display: none; }
}

.main-content {
  flex: 1;
  min-width: 0;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.flash-stack { margin-bottom: 1rem; display: flex; flex-direction: column; gap: 0.5rem; }
.flash {
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  border: 1px solid transparent;
}
.flash-success { background: #e6f4ea; color: var(--success); border-color: #bfe3c8; }
.flash-danger { background: #fbe9e7; color: var(--danger); border-color: #f2c2bd; }
.flash-warning { background: #fff4e0; color: var(--warning); border-color: #f0dca6; }
.flash-info { background: #e7f1f7; color: var(--info); border-color: #c6dced; }

h1 { font-size: 1.5rem; margin-bottom: 1rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat-tile {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-tile .value { font-size: 1.8rem; font-weight: 700; color: var(--primary); }
.stat-tile .label { font-size: 0.85rem; color: var(--muted); margin-top: 0.25rem; }
.stat-tile.warning .value { color: var(--warning); }

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
th { background: #eef2f5; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafcfd; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #e4eaee; color: var(--text); }
.btn-secondary:hover { background: #d5dee4; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8c1f18; }
.btn-sm { padding: 0.3rem 0.6rem; font-size: 0.82rem; }

form.inline { display: inline; }

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.3rem; margin-top: 0.8rem; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=tel], select, textarea {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.92rem;
  font-family: inherit;
}
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.5rem; }
.form-actions { margin-top: 1.5rem; display: flex; gap: 0.75rem; }

input[type=file] {
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: 1px dashed var(--border);
  border-radius: 6px;
  font-size: 0.88rem;
  background: var(--bg);
}
.logo-current {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 0.4rem;
}
.logo-preview {
  max-width: 100px;
  max-height: 100px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  padding: 4px;
  object-fit: contain;
}
.logo-remove-check {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text);
  margin: 0;
}
.client-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.logo-inline {
  max-width: 42px;
  max-height: 42px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: white;
  padding: 2px;
  object-fit: contain;
  vertical-align: middle;
}
.logo-thumb {
  max-width: 30px;
  max-height: 30px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: white;
  padding: 2px;
  object-fit: contain;
  display: block;
}

.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-ciorna { background: #eee; color: #555; }
.badge-emisa { background: #e7f1f7; color: var(--primary); }
.badge-trimisa { background: #e6f4ea; color: var(--success); }
.badge-anulata { background: #fbe9e7; color: var(--danger); }
.badge-matched { background: #e6f4ea; color: var(--success); }
.badge-unmatched { background: #fff4e0; color: var(--warning); }

.login-wrap {
  max-width: 380px;
  margin: 4rem auto;
}
.login-wrap .card { padding: 2rem; }
.login-wrap h1 { text-align: center; }

.muted { color: var(--muted); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }

.trip-picker {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 0.5rem;
}
.trip-picker table { border: none; border-radius: 0; }
.trip-picker .trip-row-disabled { opacity: 0.55; }
.trip-picker input[type=checkbox] { width: auto; }
.trip-picker input[type=number] {
  width: 90px;
  padding: 0.3rem 0.4rem;
}
.trip-picker-empty {
  padding: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}
.order-total {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: right;
  padding: 0.75rem 1rem;
  background: #eef2f5;
}
.badge-partial { background: #fff4e0; color: var(--warning); }

.legal-note p {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.5;
}
.legal-note h2 {
  font-size: 1rem;
}

.dashboard-columns {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1.25rem;
  align-items: start;
}
@media (max-width: 820px) {
  .dashboard-columns { grid-template-columns: 1fr; }
}

.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.chart-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 110px;
  align-items: center;
  gap: 0.75rem;
}
.chart-bar-label {
  font-size: 0.88rem;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-bar-track {
  background: #eef2f5;
  border-radius: 999px;
  height: 16px;
  overflow: hidden;
}
.chart-bar-fill {
  height: 100%;
  min-width: 3px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  border-radius: 999px;
}
.chart-bar-value {
  font-size: 0.85rem;
  font-weight: 600;
  text-align: right;
  white-space: nowrap;
}
.chart-bar-value-extra {
  font-weight: 400;
  color: var(--muted);
  font-size: 0.78rem;
}

.client-chart-scroll {
  overflow-x: auto;
  padding-bottom: 0.25rem;
}
.client-chart-svg {
  display: block;
}
.client-chart-grid {
  stroke: var(--border);
  stroke-width: 1;
}
.client-chart-bar {
  fill: var(--primary);
  transition: fill 0.15s ease;
}
.client-chart-bar:hover {
  fill: var(--primary-dark);
}
.client-chart-value {
  font-size: 10.5px;
  font-weight: 600;
  fill: var(--text);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
.client-chart-label {
  font-size: 10.5px;
  fill: var(--muted);
  font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  cursor: default;
}
