/* ==========================================================
   material.css - dodatki k skupnemu style.css (iz Terenskih ekip)
   ========================================================== */

/* GLAVNA BARVA - GRAFIT (prepiše modro iz skupnega style.css) */
:root {
  --accent: #111827;
  --accent-2: #475569;
  --hero-from: #475569;
  --hero-to: #111827;
}
:root[data-theme="dark"] {
  --accent: #94a3b8;     /* besedilo/obrobe na temni podlagi morajo ostati berljive */
  --accent-2: #64748b;
  --hero-from: #475569;
  --hero-to: #1e293b;
}
body {
  background-image: linear-gradient(160deg, rgba(71, 85, 105, 0.14) 0%, rgba(71, 85, 105, 0) 50%);
}
:root[data-theme="dark"] body {
  background-image: linear-gradient(160deg, rgba(148, 163, 184, 0.12) 0%, rgba(148, 163, 184, 0) 50%);
}
/* polne (temne) ploskve vedno v grafitu z belim besedilom - tudi v temnem načinu */
.topbar-hero,
.week-strip-btn.active,
.tile-icon {
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to) 130%);
}
.toast { background: var(--hero-to); }
:root[data-theme="dark"] .toast { background: #334155; }
:root[data-theme="dark"] .btn-primary,
:root[data-theme="dark"] .btn-primary:hover,
:root[data-theme="dark"] .mode-toggle button.active,
:root[data-theme="dark"] .group-count,
:root[data-theme="dark"] .tile-badge { background: #475569; border-color: #475569; color: #fff; }
:root[data-theme="dark"] .team-history-period button.active { background: #475569; border-color: #475569; color: #fff; }

.view-tabs {
  display: flex;
  justify-content: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.view-tabs::-webkit-scrollbar { display: none; }
.view-tabs .week-strip-btn.active { cursor: pointer; }

.mat-main {
  max-width: 760px;
  margin: 0 auto;
  padding: 4px 16px 40px;
}
.mat-view { display: flex; flex-direction: column; gap: 14px; }

.mat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mat-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.mat-row-fields { display: flex; gap: 12px; flex-wrap: wrap; }
.mat-row-fields .field { min-width: 160px; }

.mat-items-head {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: -6px;
}
.items-form { display: flex; flex-direction: column; gap: 8px; }
.item-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.item-row.has-qty {
  border-color: var(--accent-2);
  background: var(--surface);
  box-shadow: inset 3px 0 0 var(--accent-2);
}
.item-name { font-size: 15px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.item-unit {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.stepper { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.step-btn {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.1s ease;
}
.step-btn:hover { background: var(--surface-2); }
.step-btn:active { transform: scale(0.92); }
.qty-input {
  width: 64px;
  height: 42px;
  text-align: center;
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-input:focus { outline: none; border-color: var(--accent-2); }

.mat-save-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.form-summary { font-size: 13px; color: var(--text-muted); flex: 1; min-width: 0; }
.btn-big { padding: 12px 22px; font-size: 15px; font-weight: 700; border-radius: 10px; }
.btn-primary:hover { background: var(--accent-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn:disabled:hover { filter: none; }
.btn-small { padding: 6px 12px; font-size: 13px; }

.edit-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--today-bg);
  border: 1px solid var(--warn);
  font-size: 13px;
  font-weight: 600;
}

/* Seznam prevzemov */
.withdrawal-list { display: flex; flex-direction: column; gap: 8px; }
.withdrawal {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.withdrawal.editing { border-color: var(--warn); background: var(--today-bg); }
.w-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.w-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13px; }
.w-date { font-weight: 700; }
.w-person { color: var(--accent-2); font-weight: 600; }
.w-by { color: var(--text-muted); font-size: 12px; }
.w-lines { display: flex; flex-wrap: wrap; gap: 6px; }
.w-chip {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
}
.w-note { font-size: 13px; color: var(--text-muted); white-space: pre-wrap; overflow-wrap: anywhere; }
.w-actions { display: flex; gap: 2px; flex-shrink: 0; }
.w-actions .icon-btn { font-size: 15px; }

.list-summary { font-size: 13px; color: var(--text-muted); }

/* Filtri */
.mat-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.mat-filters .team-history-period { flex-wrap: wrap; }
.filter-selects { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-selects select {
  font-family: inherit;
  font-size: 14px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  max-width: 100%;
}
.stats-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* Statistika - vodoravni stolpci */
.stats-bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 230px) 1fr auto;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 14px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--hero-from), var(--hero-to) 160%);
  border-radius: 0 4px 4px 0;
  min-width: 2px;
}
.bar-value { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-value strong { font-size: 15px; }

.stats-table th.num, .stats-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.stats-table .total-row td { font-weight: 700; border-top: 2px solid var(--border); }

/* Urejanje materiala */
.modal-hint { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.4; }
.admin-group-head {
  margin: 8px 0 -2px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.admin-group-head:first-child { margin-top: 0; }
.item-admin-row { flex-direction: column; align-items: stretch; gap: 6px; }
.admin-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.item-admin-row input[type="text"], .item-admin-row input[type="number"] {
  font-family: inherit;
  font-size: 14px;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  min-width: 0;
}
.item-admin-row .admin-line input[data-k="name"] { flex: 1 1 160px; font-weight: 600; }
.item-admin-row .admin-line input[data-k="detail"] { flex: 2 1 160px; }
.item-admin-row input.group-input[type="text"] { flex: 1 1 130px; }
.item-admin-row input.unit-input[type="text"] { flex: 0 0 64px; width: 64px; }
.item-admin-row input.pack-input { width: 64px; text-align: right; }
.item-admin-row input.code-input[type="text"] { flex: 0 1 110px; }
.import-btn { align-self: flex-start; }
.pack-label { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; }
.admin-move { display: inline-flex; margin-left: auto; }
.item-admin-row.inactive input[data-k="name"] { text-decoration: line-through; opacity: 0.6; }
.active-toggle { font-size: 12px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.item-add-row { display: flex; gap: 8px; flex-wrap: wrap; }
.item-add-row input {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
}
.item-add-row #newItemName { flex: 2 1 180px; }
.item-add-row #newItemGroup { flex: 1 1 130px; }

/* Ploščice osnovnih skupin na prvi strani */
.group-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.group-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px;
  min-height: 108px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease, background 0.15s ease;
}
.group-tile:hover { border-color: var(--accent-2); }
.group-tile:active { transform: scale(0.98); }
.group-tile.has-qty { border-color: var(--accent-2); background: var(--surface); box-shadow: inset 0 0 0 1px var(--accent-2); }
.tile-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--hero-from), var(--hero-to) 130%);
  color: #fff;
}
.tile-name { font-size: 15px; font-weight: 700; line-height: 1.2; }
.tile-sub { font-size: 12px; color: var(--text-muted); }
.group-tile.has-qty .tile-sub { color: var(--accent-2); font-weight: 600; }
.tile-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Izbrano (pod ploščicami) */
.selected-list { display: flex; flex-direction: column; gap: 6px; }
.sel-item {
  display: flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 10px;
  padding: 2px 4px 2px 0;
}
.sel-open {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: none;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.sel-name { min-width: 0; overflow-wrap: anywhere; }
.sel-qty { font-weight: 700; white-space: nowrap; }
.sel-remove { color: var(--text-muted); font-size: 20px; }

/* Okno skupine */
.sheet { max-width: 560px; height: min(90vh, 760px); }
.sheet .modal-body { flex: 1; }
.sheet .modal-footer .form-summary { flex: 1; }
.group-sheet-body { display: flex; flex-direction: column; gap: 16px; }
.sub-section { display: flex; flex-direction: column; gap: 6px; }
.sub-head {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding: 0 2px;
}

.item-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.item-detail { font-size: 12px; color: var(--text-muted); }
.item-hint { font-size: 12px; color: var(--accent-2); }
.item-hint:empty { display: none; }
.item-controls { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.mode-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  height: 42px;
}
.mode-toggle button {
  border: none;
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 0 10px;
  cursor: pointer;
}
.mode-toggle button + button { border-left: 1px solid var(--border); }
.mode-toggle button.active { background: var(--accent-2); color: #fff; }

.bar-group-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 4px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.bar-group-head:first-child { margin-top: 0; }
.bar-group-head strong { color: var(--text); }
.bar-packs { display: block; font-size: 11px; color: var(--text-muted); text-align: right; }

@media (max-width: 720px) {
  .mat-main { padding: 0 10px 32px; }
  .mat-card { padding: 14px 12px; border-radius: 12px; }
  .view-tabs { justify-content: flex-start; }
  .view-tabs .week-strip-btn { padding: 7px 10px; font-size: 13px; flex-shrink: 0; }
  .view-tabs { gap: 2px; }
  .btn-big { width: 100%; }
  .bar-row { grid-template-columns: minmax(90px, 130px) 1fr auto; gap: 8px; }
  .item-row { flex-wrap: wrap; padding: 10px; }
  .group-tiles { grid-template-columns: 1fr 1fr; }
  .group-tile { min-height: 100px; padding: 12px; }
  /* okno skupine kot spodnji list čez cel zaslon */
  .sheet-overlay { padding: 0; align-items: flex-end; }
  .sheet { max-width: none; height: 94vh; height: 94dvh; max-height: none; border-radius: 16px 16px 0 0; }
  .sheet .btn-big { width: auto; }
  .item-info { flex: 1 1 100%; }
  .item-controls { flex: 1 1 100%; justify-content: flex-end; }
  .team-history-daterange { width: 100%; }
  .team-history-daterange input[type="date"] { flex: 1; min-width: 0; }
}

/* ZALOGA */
.stock-ok { color: var(--success); }
.stock-low { color: var(--warn); font-weight: 600; }
.stock-out { color: var(--danger); font-weight: 600; }
.stock-unknown { color: var(--text-muted); }
.stock-warn { color: var(--danger); font-weight: 600; }
.stock-warn-box {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}
.stock-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.stock-actions { display: flex; gap: 8px; }
.low-card { border-color: var(--warn); }
.low-list { display: flex; flex-direction: column; gap: 6px; }
.low-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-size: 14px;
}
.low-name { flex: 1 1 160px; font-weight: 600; }
.low-need { font-size: 12px; color: var(--text-muted); }
.stock-table td { white-space: normal; vertical-align: top; }
.stock-table td.num { white-space: nowrap; }
.stock-group-row th {
  padding-top: 16px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stock-table tbody:first-child .stock-group-row th { padding-top: 6px; }
.st-name { font-weight: 600; }
.log-type {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.log-dobava { color: var(--success); }
.log-inventura { color: var(--accent-2); }
.stock-entry-group { display: flex; flex-direction: column; gap: 10px; }
.stock-entry-head { font-size: 15px; font-weight: 800; padding-top: 4px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }

/* Uvoz iz Excela */
.import-summary { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.import-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.import-missing {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 12px; border-radius: 8px;
  background: var(--today-bg); border: 1px solid var(--warn);
  font-size: 13px; cursor: pointer;
}
.import-missing input { margin-top: 2px; }
.import-table td { white-space: normal; vertical-align: top; }
.import-table td.num { white-space: nowrap; }
.code-cell { font-family: ui-monospace, Consolas, monospace; font-size: 12px; white-space: nowrap !important; }
.stock-actions { flex-wrap: wrap; }

/* Telefon: material brez izbire kos/paket ostane v eni vrstici */
@media (max-width: 720px) {
  .item-row:not(:has(.mode-toggle)) { flex-wrap: nowrap; }
  .item-row:not(:has(.mode-toggle)) .item-info { flex: 1 1 auto; }
  .item-row:not(:has(.mode-toggle)) .item-controls { flex: 0 0 auto; }
}
