/* ==========================================================================
   Lingier Design System — unified dashboard tokens & components
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --color-primary: #2D5A4E;
  --color-primary-light: #8BAF9E;
  --color-bg: #FAFAF8;
  --color-surface: #FFFFFF;
  --color-text: #1A1A1A;
  --color-text-muted: #6B7280;
  --color-border: #E5E7EB;
  --color-warning: #8B5E3C;
  --color-success: #2D5A4E;
  --radius-card: 12px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);

  --sidebar-width: 200px;
  --topbar-height: 60px;
  --color-sidebar-hover: #EEF4F1;
  --color-badge-pending-bg: #FEF3E2;
  --color-badge-pending-text: #8B5E3C;
  --color-badge-sent-bg: #E8F3EF;
  --color-badge-sent-text: #2D5A4E;
  --color-badge-concept-bg: #F3F4F6;
  --color-badge-concept-text: #6B7280;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Page layout
   -------------------------------------------------------------------------- */

.page-layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  padding: 32px;
  padding-top: 0;
  background: var(--color-bg);
  min-height: 100vh;
}

.main-content > .app-topbar {
  margin-bottom: 32px;
  margin-left: -32px;
  margin-right: -32px;
}

/* --------------------------------------------------------------------------
   Sidebar (see includes/sidebar.php)
   -------------------------------------------------------------------------- */

.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  z-index: 200;
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.sidebar-brand {
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
}

.sidebar-brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-brand-logo--image {
  background: transparent;
}

.sidebar-brand-logo img {
  width: 40px;
  height: 40px;
  object-fit: contain;
  display: block;
}

.sidebar-brand-text {
  min-width: 0;
}

.sidebar-brand-name {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.2;
}

.sidebar-brand-tagline {
  display: block;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.sidebar-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-nav-list--icons {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 6px 10px;
}

.sidebar-nav-list--icons .sidebar-nav-item {
  margin-bottom: 0;
}

.sidebar-link--icon-only {
  width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  gap: 0;
}

.sidebar-link--icon-only .sidebar-icon i {
  font-size: 16px;
}

.sidebar-nav-item {
  margin-bottom: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-link:hover,
.sidebar-link:focus,
.sidebar-link:active {
  text-decoration: none;
}

.sidebar-link-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-link:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text);
}

.sidebar-link.is-active {
  background: var(--color-primary);
  color: #fff;
}

.sidebar-link.is-active .sidebar-icon {
  color: #fff;
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sidebar-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-icon i {
  font-size: 15px;
  width: 18px;
  text-align: center;
  line-height: 1;
}

.sidebar-section {
  margin-bottom: 4px;
}

.sidebar-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  margin: 0;
  padding: 10px 10px 6px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-section:first-child .sidebar-section-toggle {
  padding-top: 4px;
}

.sidebar-section-toggle:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text);
}

.sidebar-section-toggle__label {
  min-width: 0;
  text-align: left;
}

.sidebar-section-toggle__chevron {
  flex-shrink: 0;
  font-size: 10px;
  opacity: 0.65;
  transition: transform 0.2s ease;
}

.sidebar-section.is-open .sidebar-section-toggle__chevron {
  transform: rotate(0deg);
}

.sidebar-section:not(.is-open) .sidebar-section-toggle__chevron {
  transform: rotate(-90deg);
}

.sidebar-section-panel {
  padding-bottom: 4px;
}

.sidebar-section-panel[hidden] {
  display: none;
}

.sidebar-group-label {
  padding: 14px 10px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
}

.sidebar-group-label:first-child {
  padding-top: 4px;
}

.sidebar-link--logout:hover {
  background: #fef2f2;
  color: #b91c1c;
}

.sidebar-footer {
  padding: 12px 8px 16px;
  border-top: 1px solid var(--color-border);
}

.sidebar-tools {
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--color-border);
}

/* Magazijn / picking: brede sidebar met digitale klok */
.page-layout--warehouse {
  --sidebar-width: 220px;
}

.app-sidebar--warehouse {
  justify-content: space-between;
}

.app-sidebar--warehouse .sidebar-nav[hidden] {
  display: none;
}

.sidebar-warehouse-clock {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  text-align: center;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #f8fafc;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sidebar-warehouse-clock__time {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 2.35rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.1;
  font-family: 'Inter', ui-monospace, monospace;
}

.sidebar-warehouse-clock__date {
  display: block;
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  color: #94a3b8;
  text-transform: capitalize;
  line-height: 1.35;
}

.app-sidebar--warehouse .sidebar-footer {
  margin-top: auto;
}

.page-layout--warehouse .app-topbar {
  padding-left: 24px;
  padding-right: 24px;
}

/* --------------------------------------------------------------------------
   Topbar (see includes/topbar.php)
   -------------------------------------------------------------------------- */

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--topbar-height);
  min-height: var(--topbar-height);
  padding: 0 32px;
  background: var(--color-surface);
  border-bottom: 1px solid #EEEEEE;
}

.topbar-heading {
  flex-shrink: 1;
  min-width: 0;
  max-width: min(420px, 38vw);
}

.topbar-title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.25;
}

.topbar-subtitle {
  margin: 2px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  line-height: 1.35;
}

.app-topbar--subtitle {
  height: auto;
  min-height: var(--topbar-height);
  padding-top: 10px;
  padding-bottom: 10px;
  align-items: center;
}

.topbar-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--color-text-muted);
}

.topbar-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.topbar-stat i {
  color: var(--color-primary);
  font-size: 12px;
}

.topbar-stat-value {
  font-weight: 600;
  color: var(--color-text);
}

.topbar-stat--link {
  text-decoration: none;
  color: inherit;
  border-radius: 999px;
  padding: 4px 10px;
  transition: background 0.15s ease, color 0.15s ease;
}

.topbar-stat--link:hover {
  background: var(--color-sidebar-hover);
  color: var(--color-text);
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.app-topbar--stats {
  gap: 12px;
}

.app-topbar--tools {
  gap: 12px;
}

.app-topbar--stats .topbar-search-wrap {
  max-width: 360px;
}

.app-topbar--stats .topbar-heading {
  max-width: 200px;
}

.topbar-search-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 480px;
  margin: 0 auto;
}

.topbar-search {
  width: 100%;
  max-width: 420px;
  position: relative;
}

.topbar-search input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 40px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.topbar-search input::placeholder {
  color: var(--color-text-muted);
}

.topbar-search input:focus {
  outline: none;
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(139, 175, 158, 0.25);
}

.topbar-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--color-text-muted);
  pointer-events: none;
}

.topbar-search-icon svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-user-info {
  text-align: right;
  line-height: 1.25;
}

.topbar-user-name {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}

.topbar-user-role {
  display: block;
  font-size: 12px;
  color: var(--color-text-muted);
}

.topbar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.topbar-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* --------------------------------------------------------------------------
   Cards
   -------------------------------------------------------------------------- */

.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  padding: 24px;
}

.card-body {
  padding: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text);
}

/* --------------------------------------------------------------------------
   KPI grid
   -------------------------------------------------------------------------- */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

@media (max-width: 1200px) {
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
}

.kpi-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.kpi-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.kpi-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--color-sidebar-hover);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.kpi-card-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.kpi-trend {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
}

.kpi-trend--up {
  background: var(--color-badge-sent-bg);
  color: var(--color-success);
}

.kpi-trend--down {
  background: #FEE2E2;
  color: #B91C1C;
}

.kpi-trend--warn {
  background: var(--color-badge-pending-bg);
  color: var(--color-warning);
}

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-text);
  line-height: 1.2;
}

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

.badge-sent,
.badge-pending,
.badge-concept {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  line-height: 1.2;
  white-space: nowrap;
}

.badge-sent {
  background: var(--color-badge-sent-bg);
  color: var(--color-badge-sent-text);
}

.badge-pending {
  background: var(--color-badge-pending-bg);
  color: var(--color-badge-pending-text);
}

.badge-concept {
  background: var(--color-badge-concept-bg);
  color: var(--color-badge-concept-text);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  text-decoration: none;
  line-height: 1.2;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  text-decoration: none;
  line-height: 1.2;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: #244a40;
  color: #fff;
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg);
  border-color: var(--color-primary-light);
}

.btn-primary--sm,
.btn-secondary--sm,
.btn-primary.btn-sm,
.btn-secondary.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

/* --------------------------------------------------------------------------
   Data table
   -------------------------------------------------------------------------- */

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
}

.data-table thead th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.data-table tbody td {
  padding: 14px 16px;
  border-bottom: none;
  color: var(--color-text);
  vertical-align: middle;
}

.data-table tbody tr {
  transition: background 0.12s ease;
}

.data-table tbody tr:nth-child(even) {
  background: rgba(250, 250, 248, 0.8);
}

.data-table tbody tr:hover {
  background: var(--color-sidebar-hover);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* --------------------------------------------------------------------------
   Utilities
   -------------------------------------------------------------------------- */

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Mobile shell: see assets/css/mobile-layout.css */

.topbar-menu-btn,
.sidebar-close-btn {
  display: none;
}
