/*
 * AVProces — Lightbox Editorial
 *
 * Shared visual layer for the approved moodboard direction.  This file loads
 * after page-level styles so theme geometry and responsive behavior stay
 * consistent without duplicating product templates or business logic.
 */

:root {
  --editorial-card-radius: 22px;
  --editorial-control-radius: 11px;
  --editorial-page-gutter: clamp(18px, 3vw, 44px);
  --editorial-card-padding: clamp(18px, 2.2vw, 28px);
  --editorial-content-max: 1560px;
  --editorial-rule: rgba(171, 118, 47, 0.42);
  --editorial-nav-active: var(--accent-soft);
  --editorial-focus: 0 0 0 3px var(--accent-soft);
  --editorial-layer-grain: 8000;
  --editorial-layer-filmstrip: 8200;
  --editorial-layer-mobile-nav: 9000;
  --editorial-layer-modal: 9100;
}

:root[data-theme="dark"] {
  --bg-page: #080908;
  --bg-page-alt: #0d0e0d;
  --bg-surface: #111210;
  --bg-elevated: #181916;
  --bg-sidebar: #0c0d0c;
  --bg-input: #0e0f0e;
  --border-subtle: rgba(238, 226, 205, 0.065);
  --border-default: rgba(238, 226, 205, 0.12);
  --border-strong: rgba(221, 181, 119, 0.34);
  --text-primary: #f1eadf;
  --text-secondary: #d4cabe;
  --text-muted: #a69c8f;
  --text-faint: #787167;
  --accent: #d1843d;
  --accent-soft: rgba(209, 132, 61, 0.13);
  --chart-primary: #d1843d;
  --chart-secondary: #8b9896;
  --track: #29251f;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.2);
  --editorial-rule: rgba(209, 132, 61, 0.45);
  --editorial-nav-active: rgba(91, 67, 89, 0.38);
}

:root[data-theme="light"] {
  --bg-page: #eeeae1;
  --bg-page-alt: #e7e1d6;
  --bg-surface: #faf8f2;
  --bg-elevated: #fffdf8;
  --bg-sidebar: #e6e0d5;
  --bg-input: #f6f2e9;
  --border-subtle: rgba(54, 48, 39, 0.075);
  --border-default: rgba(54, 48, 39, 0.14);
  --border-strong: rgba(150, 99, 37, 0.34);
  --text-primary: #292720;
  --text-secondary: #4d4941;
  --text-muted: #716b61;
  --text-faint: #948c80;
  --accent: #ad762f;
  --accent-soft: rgba(173, 118, 47, 0.105);
  --chart-primary: #ad762f;
  --chart-secondary: #6f7e7d;
  --track: #e5ded1;
  --shadow-soft: 0 16px 40px rgba(73, 62, 47, 0.065);
  --editorial-rule: rgba(173, 118, 47, 0.42);
  --editorial-nav-active: var(--accent-soft);
}

html {
  background: var(--bg-page);
}

body {
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 28%),
    linear-gradient(180deg, var(--bg-page), var(--bg-page-alt));
  color: var(--text-primary);
  letter-spacing: 0.005em;
}

body::after {
  opacity: 0.018;
  z-index: var(--editorial-layer-grain);
}

body.modal-open {
  overflow: hidden;
}

.filmstrip {
  z-index: var(--editorial-layer-filmstrip);
}

:root[data-theme="dark"] body {
  background:
    linear-gradient(135deg, var(--accent-soft), transparent 28%),
    linear-gradient(180deg, var(--bg-page), var(--bg-page-alt));
}

:root[data-theme="dark"] .main {
  background: transparent;
}

/* Shell */

.sidebar {
  width: 226px;
  min-width: 226px;
  top: 28px;
  height: calc(100vh - 56px);
  background: color-mix(in srgb, var(--bg-sidebar) 94%, transparent);
  border-right-color: var(--border-default);
  box-shadow: none;
  backdrop-filter: blur(18px);
}

.sidebar-header {
  min-height: 92px;
  justify-content: center;
  padding: 22px 20px;
}

.sidebar-logo {
  width: 148px;
}

.sidebar-nav {
  padding: 18px 10px;
}

.sidebar-nav a,
.sidebar-footer-link {
  min-height: 44px;
  margin: 0 0 5px;
  padding: 10px 12px;
  border-radius: var(--editorial-control-radius);
  font-size: 12px;
  letter-spacing: 0.055em;
}

.sidebar-nav a:hover,
.sidebar-footer-link:hover {
  transform: none;
  background: var(--accent-soft);
}

.sidebar-nav a.active,
.sidebar-footer-link.active {
  border-color: var(--border-default);
  background:
    linear-gradient(90deg, var(--editorial-nav-active), transparent 86%),
    var(--bg-elevated);
  box-shadow: inset 2px 0 0 var(--accent);
}

.sidebar-footer {
  padding: 12px;
}

.main {
  padding:
    clamp(28px, 4vw, 52px)
    var(--editorial-page-gutter)
    clamp(56px, 6vw, 88px);
  background: transparent;
}

.main > * {
  width: min(100%, var(--editorial-content-max));
  margin-left: auto;
  margin-right: auto;
}

.page-header {
  align-items: flex-end;
  margin-bottom: clamp(22px, 3vw, 34px);
  padding-bottom: 18px;
  border-bottom-color: var(--border-default);
}

.page-header::before {
  content: "";
  width: 30px;
  height: 2px;
  align-self: center;
  order: -1;
  margin-right: -2px;
  background: var(--accent);
}

.page-header h2 {
  margin-right: auto;
  font-size: clamp(28px, 3vw, 40px);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.025em;
  text-transform: none;
}

/* Surfaces and controls */

.card,
.analytics-card,
.pref-section,
.inline-card,
.modal,
.login-box {
  border-color: var(--border-default);
  border-radius: var(--editorial-card-radius);
  background: var(--bg-surface);
  box-shadow: var(--shadow-soft);
}

.kanban-column,
.invoice-list-card {
  border-color: var(--border-default);
  background: var(--bg-surface);
  box-shadow: var(--shadow-soft);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.card {
  padding: var(--editorial-card-padding);
  margin-bottom: 18px;
}

.card h3,
.analytics-card h3,
.pref-section h3,
.dashboard-chart-heading,
.customer-orders-header h3 {
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.btn,
.toolbar-action,
.pagination-link,
.analytics-tab {
  min-height: 40px;
  border-radius: var(--editorial-control-radius);
  box-shadow: none;
}

.btn-primary,
.btn-login {
  color: #fffaf1;
  background: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 72%, var(--text-primary));
  box-shadow: 0 10px 24px color-mix(in srgb, var(--accent) 18%, transparent);
}

.btn-primary:hover,
.btn-login:hover {
  color: #fff;
  background: color-mix(in srgb, var(--accent) 88%, var(--text-primary));
  border-color: var(--accent);
}

.btn-outline,
.period-tab {
  background: transparent;
}

.form-group input,
.form-group select,
.form-group textarea,
[data-live-search] input[type="search"],
.select-filter,
.modal-date {
  border-color: var(--border-default) !important;
  border-radius: var(--editorial-control-radius) !important;
  background: var(--bg-input) !important;
  color: var(--text-primary) !important;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
[data-live-search] input[type="search"]:focus,
.select-filter:focus {
  border-color: var(--accent) !important;
  box-shadow: var(--editorial-focus);
}

.table-wrap {
  border-radius: calc(var(--editorial-card-radius) - 4px);
}

.table th {
  padding: 12px 14px;
  border-bottom-color: var(--border-default);
  color: var(--text-muted);
  font-size: 9px;
  letter-spacing: 0.12em;
}

.table td {
  padding: 14px;
}

.table tr:hover td {
  background: color-mix(in srgb, var(--accent-soft) 70%, transparent);
}

.invoice-list-card {
  padding: 0;
  overflow: hidden;
}

.invoice-table {
  min-width: 960px;
  table-layout: fixed;
}

.invoice-table th,
.invoice-table td {
  line-height: 1.45;
}

.invoice-table td {
  color: var(--text-secondary);
}

.invoice-table td:first-child,
.invoice-table td:nth-child(4),
.invoice-table td:first-child a {
  color: var(--text-primary);
}

.invoice-table .btn-outline {
  color: var(--text-secondary);
}

.invoice-table .btn-primary {
  color: #fffaf1;
}

.invoice-table .inv-row-actions {
  flex-wrap: wrap;
}

.invoice-table .btn-equal {
  flex: 1 1 96px;
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
}

.invoice-table .inv-row-actions > form .btn-equal {
  width: 100%;
}

.invoice-lines-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

.line-item-modal {
  width: min(92vw, 680px);
  max-width: 680px;
}

.line-item-modal .line-form {
  margin-top: 18px;
}

.badge {
  border-radius: 8px;
  font-weight: 650;
}

/* Dashboard */

.rec-actions-section {
  margin-bottom: 32px;
}

.dashboard-action-grid {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.dashboard-action-card {
  min-height: 110px;
  border-left-width: 1px;
  box-shadow: inset 2px 0 0 var(--accent), var(--shadow-soft);
}

.dashboard-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.dashboard-metric-card {
  min-height: 142px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dashboard-metric-value,
.dashboard-pipeline-value,
.analytics-kpi-value,
.customer-stat-value {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.035em;
}

.dashboard-metric-value {
  font-size: clamp(28px, 3vw, 42px);
}

.dashboard-pipeline-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 30px;
}

.dashboard-pipeline-card {
  min-height: 138px;
  border-left-color: var(--accent);
}

.dashboard-calendar-summary-value {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 3vw, 44px);
  letter-spacing: -0.04em;
}

/* Analytics and settings */

.analytics-shell {
  gap: 20px;
}

.analytics-toolbar {
  padding: 10px;
  border-radius: 16px;
  box-shadow: none;
}

.analytics-tab {
  padding: 9px 13px;
}

.analytics-tab.is-active {
  color: #fffaf1;
}

.analytics-card {
  padding: var(--editorial-card-padding);
}

.analytics-card h3 {
  margin-bottom: 16px;
}

.line-chart {
  border-top: 1px solid var(--border-subtle);
  padding-top: 12px;
}

.line-chart-svg {
  max-width: none;
}

.line-chart-series {
  stroke-width: 3;
}

.line-chart-point {
  stroke-width: 2.5;
}

.tab-bar {
  gap: 4px;
  border-bottom-color: var(--border-default);
}

.tab-bar a {
  padding: 11px 16px;
  border-radius: 9px 9px 0 0;
}

.tab-bar a.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
  background: var(--accent-soft);
}

.settings-nav a {
  background: var(--bg-input);
  border-color: var(--border-default);
}

.tab-content {
  max-width: 920px;
}

.pref-section {
  padding: var(--editorial-card-padding);
  margin-bottom: 20px;
}

.pref-section h3::before {
  color: var(--accent);
}

.theme-options label,
.connector-card,
.account-info,
.inv-preview {
  background: var(--bg-input);
}

/* Customer detail */

.customer-stat-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.customer-stat-card {
  min-height: 126px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-bottom: 0;
  padding: 18px 14px;
  text-align: center;
}

.customer-stat-value {
  color: var(--text-primary);
  font-size: clamp(23px, 2.2vw, 32px);
}

.customer-stat-value--muted,
.customer-stat-meta {
  color: var(--text-faint);
}

.customer-stat-label,
.customer-stat-meta {
  margin-top: 7px;
  font-size: 9px;
  letter-spacing: 0.1em;
}

.customer-stat-label {
  color: var(--text-muted);
  text-transform: uppercase;
}

.customer-profile-card {
  margin-bottom: 24px;
}

.customer-profile-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(24px, 4vw, 52px);
}

.customer-section-title {
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.customer-field {
  margin-bottom: 13px;
}

.customer-field-label {
  margin-bottom: 3px;
  color: var(--text-faint);
  font-size: 10px;
}

.customer-field-value {
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.55;
}

.customer-notes {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.customer-notes p {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

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

.customer-orders-header h3 {
  margin: 0;
}

.customer-orders-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Orders and shared action groups */

.orders-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.page-header-actions,
.kanban-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.kanban-card-actions {
  margin-top: 10px;
  gap: 6px;
}

.kanban-card-actions form {
  display: flex;
  min-width: 0;
}

/* Login */

.login-container {
  max-width: 430px;
}

.login-header h1 {
  font-size: clamp(34px, 5vw, 46px);
  letter-spacing: 0.04em;
}

.login-box {
  padding: clamp(26px, 4vw, 38px);
}

.locale-switcher a {
  box-shadow: none;
}

.mobile-shell-bar,
.mobile-bottom-nav {
  display: none;
}

/* Responsive translation */

@media (max-width: 1180px) {
  .dashboard-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .customer-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .dashboard-pipeline-grid {
    grid-template-columns: 1fr;
  }

  .orders-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analytics-subgrid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main {
    width: 100%;
    min-height: calc(100vh - 56px);
    padding: 20px 16px 112px;
  }

  .mobile-shell-bar {
    display: flex;
    min-height: 42px;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    padding: 0 4px 10px;
    border-bottom: 1px solid var(--border-subtle);
  }

  .mobile-shell-bar img {
    width: 112px;
    height: 28px;
    object-fit: contain;
    object-position: left center;
  }

  .mobile-shell-bar a {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border: 1px solid var(--border-default);
    border-radius: 50%;
    color: var(--text-secondary);
    background: var(--bg-elevated);
    text-decoration: none;
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: var(--editorial-layer-mobile-nav);
    right: 10px;
    bottom: 36px;
    left: 10px;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: 62px;
    overflow: hidden;
    border: 1px solid var(--border-default);
    border-radius: 18px;
    background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.18);
    backdrop-filter: blur(18px);
  }

  .mobile-bottom-nav a {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 7px 2px;
    color: var(--text-faint);
    font-size: 9px;
    line-height: 1;
    text-decoration: none;
  }

  .mobile-bottom-nav a.active {
    color: var(--text-primary);
    background: var(--accent-soft);
    box-shadow: inset 0 2px 0 var(--accent);
  }

  .mobile-nav-icon {
    color: currentColor;
    font-size: 17px;
  }

  .page-header {
    align-items: flex-start;
  }

  .page-header-actions {
    width: 100%;
  }

  .page-header-actions .btn {
    flex: 1 1 180px;
    margin: 0 !important;
    text-align: center;
  }

  .invoice-list-card,
  .invoice-list-card .table-wrap {
    overflow: visible;
  }

  .invoice-table {
    display: block;
    min-width: 0;
    table-layout: auto;
  }

  .invoice-table colgroup,
  .invoice-table thead {
    display: none;
  }

  .invoice-table tbody {
    display: grid;
    gap: 12px;
  }

  .invoice-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, auto);
    grid-template-areas:
      "number amount"
      "customer status"
      "package package"
      "issued due"
      "actions actions";
    gap: 10px 14px;
    padding: 16px;
    border: 1px solid var(--border-default);
    border-radius: 16px;
    background: var(--bg-surface);
    box-shadow: var(--shadow-soft);
  }

  .invoice-table td {
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    font-size: 12px;
    line-height: 1.35;
  }

  .invoice-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: var(--text-faint);
    font-size: 8px;
    font-weight: 650;
    letter-spacing: 0.11em;
    line-height: 1.2;
    text-transform: uppercase;
  }

  .invoice-cell-number {
    grid-area: number;
    font-size: 14px !important;
    font-weight: 650;
  }

  .invoice-cell-customer {
    grid-area: customer;
  }

  .invoice-cell-package {
    grid-area: package;
    color: var(--text-muted) !important;
  }

  .invoice-cell-amount {
    grid-area: amount;
    color: var(--text-primary) !important;
    font-size: 14px !important;
    font-weight: 650;
    text-align: right;
  }

  .invoice-cell-status {
    grid-area: status;
    text-align: right;
  }

  .invoice-cell-issued {
    grid-area: issued;
  }

  .invoice-cell-due {
    grid-area: due;
    text-align: right;
  }

  .invoice-cell-amount::before,
  .invoice-cell-status::before,
  .invoice-cell-due::before {
    text-align: right;
  }

  .invoice-cell-actions {
    grid-area: actions;
    padding-top: 10px !important;
    border-top: 1px solid var(--border-subtle) !important;
  }

  .invoice-cell-actions::before {
    display: none !important;
  }

  .invoice-cell-actions .inv-row-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 6px;
  }

  .invoice-cell-actions .inv-row-actions > form,
  .invoice-cell-actions .btn-equal {
    width: 100%;
    min-height: 36px;
  }

  .invoice-paid-date {
    max-width: 150px;
    margin-left: auto;
  }

  .inv-doc {
    min-width: 0;
    padding: clamp(16px, 5vw, 26px);
  }

  .line-item-grid {
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "description description"
      "quantity price"
      "vat vat"
      "summary summary"
      "actions actions";
    gap: 12px;
  }

  .line-form-field--description {
    grid-area: description;
  }

  .line-form-field--quantity {
    grid-area: quantity;
  }

  .line-form-field--price {
    grid-area: price;
  }

  .line-form-field--vat {
    grid-area: vat;
  }

  .line-form-field,
  .line-form input,
  .line-edit-row input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .line-form input,
  .line-edit-row input {
    font-size: 16px;
  }

  .line-form-actions,
  .line-edit-actions {
    grid-area: actions;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .line-form-actions .btn,
  .line-edit-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .line-edit-row {
    padding: 14px;
  }

  .line-edit-summary {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .page-header::before {
    align-self: flex-start;
    margin-top: 13px;
  }

  .page-header h2 {
    font-size: clamp(27px, 9vw, 36px);
  }

  .dashboard-stat-grid,
  .customer-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-metric-card,
  .customer-stat-card {
    min-height: 118px;
  }

  .customer-orders-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .customer-orders-controls {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 3px;
  }

  .customer-profile-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .analytics-toolbar,
  .tab-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .analytics-tab,
  .tab-bar a {
    flex: 0 0 auto;
  }

  .line-chart-svg {
    height: auto;
  }

  .form-grid-2,
  .form-grid-3,
  .pwd-grid,
  .connector-grid {
    grid-template-columns: 1fr;
  }

  .modal {
    width: min(94vw, 520px);
    min-width: 0;
    max-width: 94vw;
    max-height: calc(100dvh - 80px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .modal-overlay {
    z-index: var(--editorial-layer-modal);
    padding: 40px 12px;
    overflow-y: auto;
  }

  .modal-overlay.active {
    align-items: center;
  }
}

@media (max-width: 480px) {
  .main {
    padding-right: 12px;
    padding-left: 12px;
  }

  .card,
  .analytics-card,
  .pref-section {
    padding: 16px;
    border-radius: 18px;
  }

  .dashboard-stat-grid,
  .customer-stat-grid {
    gap: 9px;
  }

  .dashboard-action-grid {
    grid-template-columns: 1fr;
  }

  .orders-stat-grid {
    grid-template-columns: 1fr;
  }

  .page-header-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .page-header-actions .btn {
    width: 100%;
    flex-basis: auto;
  }

  .kanban-card-actions .btn {
    min-width: 38px;
  }

  .dashboard-metric-value {
    font-size: 29px;
  }

  .line-chart-svg {
    height: auto;
  }

  .mobile-bottom-nav {
    right: 6px;
    left: 6px;
  }

  .mobile-bottom-nav a {
    font-size: 8px;
  }

  .modal {
    width: calc(100vw - 20px);
    height: auto;
    max-height: calc(100dvh - 80px);
    margin: 10px;
    border-radius: 18px;
  }
}
