/* ===========================================================
   Panou Suport — identitate vizuală
   Paletă: charcoal-navy de fundal + accent semnal-chihlimbar.
   Mono (IBM Plex Mono) pentru ID-uri/date, Inter pentru UI.
   =========================================================== */

:root {
  --bg: #0a0d13;
  --surface: #12161e;
  --surface-raised: #1a1f2a;
  --surface-hover: #212836;
  --border: #232a37;
  --border-light: #323b4a;
  --text: #eef0f4;
  --text-secondary: #8d96a6;
  --text-dim: #5f6878;
  --accent: #2f6fed;
  --accent-dim: #0f2138;
  --accent-text: #ffffff;
  --accent-glow: rgba(47,111,237,0.10);

  --status-open: #e8a33d;
  --status-in_progress: #4c8fe8;
  --status-waiting: #9b7fe8;
  --status-resolved: #4caf7d;
  --status-closed: #5a6472;

  --priority-urgent: #e85c4c;
  --priority-high: #e8a33d;
  --priority-medium: #4c8fe8;
  --priority-low: #5a6472;

  --font-ui: 'Inter', system-ui, sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, monospace;

  --radius: 10px;
  --sidebar-w: 232px;
}

* { box-sizing: border-box; }
html, body { height: 100%; overflow-x: hidden; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

#app { display: flex; min-height: 100vh; }

/* ---------------- Autentificare ---------------- */

.auth-screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 20% 20%, rgba(47,111,237,0.08), transparent 40%),
    var(--bg);
}

.auth-card {
  width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.auth-brand .mark {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
}

.auth-brand .name {
  font-weight: 600;
  font-size: 15px;
}

.auth-card h1 {
  font-size: 19px;
  margin: 0 0 4px;
}
.auth-card .sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin: 0 0 24px;
}

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  font-weight: 500;
}
.field select, .field input, .field textarea {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
}
.field select:focus, .field input:focus, .field textarea:focus {
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 80px; }
.field .hint { font-size: 11px; color: var(--text-dim); margin-top: 4px; }

.field-compact { margin-bottom: 10px; }
.field-compact label { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.field-compact select, .field-compact input {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13px;
  color: var(--text);
}
.field-compact select:focus, .field-compact input:focus { border-color: var(--accent); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
  font-weight: 500;
  font-size: 13px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: var(--surface-hover); border-color: var(--border-light); }

.btn-outline-green { background: transparent; border-color: rgba(76,175,125,0.45); color: var(--status-resolved); }
.btn-outline-green:hover { background: rgba(76,175,125,0.12); border-color: var(--status-resolved); }
.btn-outline-red { background: transparent; border-color: rgba(232,92,76,0.45); color: var(--priority-urgent); }
.btn-outline-red:hover { background: rgba(232,92,76,0.12); border-color: var(--priority-urgent); }
.btn-outline-blue { background: transparent; border-color: rgba(76,143,232,0.45); color: var(--status-in_progress); }
.btn-outline-blue:hover { background: rgba(76,143,232,0.12); border-color: var(--status-in_progress); }
.btn-outline-amber { background: transparent; border-color: rgba(232,163,61,0.45); color: var(--status-open); }
.btn-outline-amber:hover { background: rgba(232,163,61,0.12); border-color: var(--status-open); }
.btn-solid-green { background: rgba(76,175,125,0.16); border-color: rgba(76,175,125,0.4); color: var(--status-resolved); font-weight: 600; }
.btn-solid-green:hover { background: rgba(76,175,125,0.26); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-sm { padding: 6px 10px; font-size: 12px; }

.error-msg {
  background: rgba(232, 92, 76, 0.12);
  border: 1px solid rgba(232, 92, 76, 0.4);
  color: #f2a89e;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  margin-bottom: 16px;
}

/* ---------------- Layout principal ---------------- */

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 4px 8px 0;
  margin-bottom: 26px;
}
.brand .eyebrow {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 5px;
}
.brand .name { font-weight: 700; font-size: 17px; color: var(--text); letter-spacing: -0.01em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
}
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active {
  background: var(--accent);
  color: var(--accent-text);
  border-color: var(--accent);
  font-weight: 600;
}
.nav-item .nav-icon { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.nav-item.active .nav-icon { opacity: 1; }
.page-header .nav-icon { width: 26px; height: 26px; flex-shrink: 0; }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-dim); }
.nav-item.active .dot { background: var(--accent-text); }

.nav-new {
  margin-top: 12px;
}

.sidebar-spacer { flex: 1; }

.agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 12px;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
.agent-card .info { flex: 1; min-width: 0; }
.agent-card .agent-name { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-card .agent-role { font-size: 11px; color: var(--text-secondary); text-transform: capitalize; }
.agent-card .logout-btn {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 4px; border-radius: 4px; font-size: 15px; line-height: 1;
}
.agent-card .logout-btn:hover { color: var(--priority-urgent); background: var(--surface-hover); }

.main {
  flex: 1;
  min-width: 0;
  padding: 28px 36px 60px;
}

.page-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 22px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header h1 {
  font-size: 20px;
  margin: 0;
  font-weight: 700;
}
.page-header .sub {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 4px;
}

/* ---------------- Dashboard ---------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat-tile {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  overflow: hidden;
}
.stat-tile.accented {
  background:
    radial-gradient(circle at 88% 92%, var(--accent-glow), transparent 55%),
    var(--surface);
  border-color: var(--border-light);
}
.stat-tile .label {
  font-size: 11.5px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
  font-weight: 600;
}
.stat-tile .value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
}
.stat-tile.accented .value { color: var(--accent); }
.stat-tile .sub-line {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 6px;
  font-weight: 500;
}
.stat-tile .corner-dot {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.glow-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--status-resolved);
  box-shadow: 0 0 6px 1.5px rgba(76, 175, 125, 0.75);
  flex-shrink: 0;
}
.stat-tile .corner-dot.glow-dot {
  width: 8px;
  height: 8px;
}

.dash-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 16px;
}
@media (max-width: 980px) {
  .dash-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.panel h2 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 0 0 14px;
  font-weight: 600;
}
.panel .empty { color: var(--text-dim); font-size: 13px; padding: 12px 0; }

.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12.5px; }
.bar-row .bar-label { width: 150px; flex-shrink: 0; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { flex: 1; height: 8px; background: var(--surface-raised); border-radius: 4px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 4px; }
.bar-row .bar-count { width: 24px; text-align: right; font-family: var(--font-mono); color: var(--text-secondary); }

.queue-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  cursor: pointer;
  border-left: 3px solid transparent;
}
.queue-item:hover { background: var(--surface-hover); }
.queue-item .qid { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); flex-shrink: 0; }
.queue-item .qsubject { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- Badges ---------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-status-open { background: rgba(232,163,61,0.14); color: var(--status-open); }
.badge-status-in_progress { background: rgba(76,143,232,0.14); color: var(--status-in_progress); }
.badge-status-waiting { background: rgba(155,127,232,0.14); color: var(--status-waiting); }
.badge-status-resolved { background: rgba(76,175,125,0.14); color: var(--status-resolved); }
.badge-status-closed { background: rgba(90,100,114,0.18); color: #a5adb9; }

.badge-priority-urgent { background: rgba(232,92,76,0.14); color: var(--priority-urgent); }
.badge-priority-high { background: rgba(232,163,61,0.14); color: var(--priority-high); }
.badge-priority-medium { background: rgba(76,143,232,0.14); color: var(--priority-medium); }
.badge-priority-low { background: rgba(90,100,114,0.18); color: #a5adb9; }

/* ---------------- Listă tichete ---------------- */

.status-pills-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 8px;
}

.status-pills {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border-radius: 999px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}
.status-pill:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-light);
}
.status-pill.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--text);
}
.status-pill-filled-green {
  background: rgba(76,175,125,0.16) !important;
  border-color: rgba(76,175,125,0.4) !important;
  color: var(--status-resolved) !important;
  font-weight: 600;
}
.status-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-pill-count {
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 5px;
  line-height: 1.5;
}
.status-pill.active .status-pill-count {
  background: rgba(47,111,237,0.18);
  color: var(--accent);
}

/* Segmented control -- grup vizual compact (selector de perioadă) */
.segmented-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
}
.segmented-group .status-pill {
  border: none;
  padding: 6px 12px;
  border-radius: 999px;
}
.segmented-group .status-pill.active {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.04) inset;
}
.segmented-group .status-pill:hover:not(.active) { background: var(--surface-hover); }

.filters-search-row {
  margin-bottom: 18px;
}
.filters-search-row input[type="text"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12.5px;
  color: var(--text);
  width: 100%;
  max-width: 360px;
}
.filters-search-row input[type="text"]:focus { border-color: var(--accent); }

.status-pills-label:not(:first-of-type) {
  margin-top: 6px;
}

#periodPickerContainer {
  margin-bottom: 18px;
}

.period-custom-inputs {
  align-items: center;
  gap: 8px;
  margin: -6px 0 18px;
}
.period-custom-inputs input[type="date"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--text);
  font-family: var(--font-ui);
}
.period-custom-inputs input[type="date"]:focus { border-color: var(--accent); }
.period-arrow { color: var(--text-dim); font-size: 12px; }

.filters-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filters-bar select, .filters-bar input[type="text"] {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--text);
}
.filters-bar input[type="text"] { min-width: 220px; }
.filters-bar select:focus, .filters-bar input:focus { border-color: var(--accent); }

.ticket-table {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.ticket-row {
  display: grid;
  grid-template-columns: 3px 90px 1fr 140px 130px 150px 90px;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.ticket-row:last-child { border-bottom: none; }
.ticket-row:hover { background: var(--surface-hover); }
.ticket-row.header {
  cursor: default;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  font-weight: 600;
  padding-top: 11px;
  padding-bottom: 11px;
}
.ticket-row.header:hover { background: transparent; }

.priority-stripe { width: 3px; align-self: stretch; border-radius: 2px; }
.priority-stripe.urgent { background: var(--priority-urgent); }
.priority-stripe.high { background: var(--priority-high); }
.priority-stripe.medium { background: var(--priority-medium); }
.priority-stripe.low { background: var(--priority-low); }

.ticket-id { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); }
.ticket-subject { min-width: 0; }
.ticket-subject .t-title, .order-client .t-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-subject .t-requester, .order-client .t-requester { font-size: 11.5px; color: var(--text-dim); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-cat { color: var(--text-secondary); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ticket-assignee { font-size: 12.5px; color: var(--text-secondary); }
.ticket-date { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); }

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-dim);
}
.empty-state .big { font-size: 32px; margin-bottom: 8px; }

/* ---------------- Detaliu tichet ---------------- */

.ticket-detail-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .ticket-detail-grid { grid-template-columns: 1fr; }
}

/* ---------------- Detaliu comanda (v2) ---------------- */

.order-header-v2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
}
.order-header-v2 h1 {
  font-size: 26px;
  font-weight: 700;
  margin: 2px 0 0;
}

.order-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
  margin-bottom: 20px;
}
@media (max-width: 900px) {
  .order-two-col { grid-template-columns: 1fr; }
}
.order-col-left, .order-col-right { min-width: 0; }

.activity-feed { display: flex; flex-direction: column; }
.activity-date-sep {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  font-weight: 600;
  padding: 14px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.activity-date-sep:first-child { padding-top: 0; }
.activity-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.activity-row:last-child { border-bottom: none; }
.activity-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-raised);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
}
.activity-body { flex: 1; min-width: 0; }
.activity-label { font-size: 13.5px; color: var(--text); word-break: break-word; }
.activity-by { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.activity-time { font-size: 12px; color: var(--text-dim); white-space: nowrap; flex-shrink: 0; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12.5px;
  margin-bottom: 14px;
  cursor: pointer;
}
.back-link:hover { color: var(--text); }

.ticket-header-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
}
.ticket-header-card .t-id { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-dim); margin-bottom: 6px; }
.ticket-header-card h1 { font-size: 18px; margin: 0 0 10px; }
.ticket-header-card .badges-row { display: flex; gap: 8px; margin-bottom: 14px; }
.ticket-header-card .description { color: var(--text-secondary); font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; }
.meta-row { display: flex; gap: 22px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.meta-row .meta-item { font-size: 12.5px; }
.meta-row .meta-label { color: var(--text-dim); margin-bottom: 3px; }
.meta-row .meta-value { color: var(--text); font-weight: 500; }

.comments-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.comment {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-of-type { border-bottom: none; }
.comment-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.comment-head .c-author { font-weight: 600; }
.comment-head .c-time { color: var(--text-dim); font-family: var(--font-mono); font-size: 11px; }
.comment-head .internal-tag {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.03em;
  background: rgba(155,127,232,0.16); color: var(--status-waiting);
  padding: 2px 6px; border-radius: 4px; font-weight: 600;
}
.comment-body { font-size: 13px; color: var(--text-secondary); line-height: 1.55; white-space: pre-wrap; }

.comment-form { margin-top: 16px; }
.comment-form textarea {
  width: 100%;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  min-height: 70px;
  resize: vertical;
}
.comment-form-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; }

.photo-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.photo-thumb-wrap {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.photo-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
}
.photo-thumb-remove:hover { background: var(--priority-urgent); }

.side-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.side-panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); margin: 0 0 14px; }
.side-field { margin-bottom: 14px; }
.side-field label { display: block; font-size: 11.5px; color: var(--text-dim); margin-bottom: 5px; }
.side-field select { width: 100%; background: var(--surface-raised); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }

/* ---------------- Formular tichet nou ---------------- */

.form-card {
  max-width: 620px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row > * { min-width: 0; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--surface-raised);
  border: 1px solid var(--border-light);
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  z-index: 50;
  animation: toast-in 0.18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 720px) {
  .sidebar { position: fixed; z-index: 40; transform: translateX(-100%); transition: transform 0.2s ease; }
  .sidebar.open { transform: translateX(0); }
  .main { padding: 20px; }
  .ticket-row { grid-template-columns: 3px 1fr; }
  .ticket-row > *:not(.priority-stripe):not(.ticket-subject) { display: none; }
}

/* ---------------- Administrare ---------------- */

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.admin-tab {
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--text); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.admin-inline-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.admin-inline-form input, .admin-inline-form select {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--text);
}
.admin-inline-form input[type="text"], .admin-inline-form input[type="email"], .admin-inline-form input[type="password"] {
  min-width: 160px;
  flex: 1;
}

.admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.admin-row:last-child { border-bottom: none; }
.admin-row-name { font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.admin-row-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.admin-edit-panel {
  padding: 12px 4px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
  border-radius: 8px;
  margin: -1px 0 8px;
  padding: 14px;
}

/* ---------------- Jurnal de activitate (in cronologia tichetului) ---------------- */

.history-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 12.5px;
  color: var(--text-dim);
}
.history-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.history-text { flex: 1; }

/* ---------------- Comenzi (MerchantPro) ---------------- */

.service-row {
  display: grid;
  grid-template-columns: 55px 95px 175px 155px 80px 1fr 1.1fr 90px;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.service-row > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.service-row .status-pill { max-width: 100%; overflow: hidden; text-overflow: ellipsis; display: inline-flex; white-space: nowrap; }
.service-row:last-child { border-bottom: none; }
.service-row:hover { background: var(--surface-hover); }
.service-row.header {
  cursor: default;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  font-weight: 600;
}
.service-row.header:hover { background: transparent; }
.service-cod { font-family: var(--font-mono); font-weight: 700; color: var(--text); }

.order-row {
  display: grid;
  grid-template-columns: 105px 85px 1.1fr 90px 100px 130px 155px 145px 90px;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 13px;
}
.order-row > * {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-row:last-child { border-bottom: none; }
.order-row:hover { background: var(--surface-hover); }
.order-row.header {
  cursor: default;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  font-weight: 600;
}
.order-row.header:hover { background: transparent; }

.order-id { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.order-client { min-width: 0; }
.order-total { font-family: var(--font-mono); font-size: 13px; font-weight: 600; text-align: right; }
.order-awb { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.order-invoice { color: var(--text-dim); overflow: hidden; }

.order-awb-status { min-width: 0; overflow: hidden; }
.awb-status-line {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.awb-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}
.awb-status-dot.has-awb { background: var(--accent); }
.awb-status-sub {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.invoice-badge {
  display: inline-block;
  max-width: 100%;
  padding: 3px 9px;
  border-radius: 8px;
  background: rgba(76,175,125,0.12);
  border: 1px solid rgba(76,175,125,0.35);
  color: var(--status-resolved);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-sizing: border-box;
}

.order-platform {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.platform-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

.order-thumbs {
  display: flex;
  align-items: center;
}
.order-thumb-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  margin-left: -8px;
}
.order-thumb-wrap:first-child { margin-left: 0; }

.order-thumb {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--surface);
  background: var(--surface-raised);
  flex-shrink: 0;
}

.thumb-qty-badge {
  position: absolute;
  bottom: -3px;
  right: -3px;
  background: var(--status-waiting);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  padding: 2.5px 4px;
  border-radius: 999px;
  border: 1.5px solid var(--surface);
  min-width: 14px;
  text-align: center;
}
.order-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
}
.order-thumb-more {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 10.5px;
  font-weight: 600;
  font-family: var(--font-mono);
  margin-left: -8px;
}

.line-items-list { display: flex; flex-direction: column; gap: 2px; }
.line-item-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.line-item-row:last-child { border-bottom: none; }
.li-name { flex: 1; min-width: 0; }
.li-qty { color: var(--text-secondary); font-family: var(--font-mono); font-size: 12px; flex-shrink: 0; }
.li-price { font-family: var(--font-mono); font-size: 12.5px; flex-shrink: 0; width: 90px; text-align: right; }
.li-thumb {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
}
.li-thumb-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 16px;
}

@media (max-width: 900px) {
  .order-row { grid-template-columns: 1fr auto; }
  .order-row > *:not(.order-client):not(.order-total) { display: none; }
  .order-row > .order-client { display: block; }
  .order-row > .order-total { display: block; text-align: right; }
}

/* ---------------- Panou lateral (drawer) ---------------- */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 200;
  display: flex;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
  padding: 20px;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: 12px;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.18s ease;
}
.modal-overlay.open .modal-box {
  transform: translateY(0) scale(1);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
}
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
}
.modal-close-btn:hover { background: var(--surface-hover); color: var(--text); }
.modal-body { padding: 16px 24px 24px; }

.drawer-panel {
  width: min(920px, 96vw);
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -12px 0 32px rgba(0, 0, 0, 0.45);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 28px 32px 60px;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer-overlay.open .drawer-panel {
  transform: translateX(0);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}
.btn-row > .btn {
  flex: 1 1 140px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-close-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: flex-end;
  padding-bottom: 10px;
  margin-bottom: 6px;
  background: var(--bg);
}
.drawer-close-btn {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.drawer-close-btn:hover {
  color: var(--text);
  background: var(--surface-hover);
}

@media (max-width: 720px) {
  .drawer-panel { width: 100vw; padding: 20px; }
}
