.page-sidenav {
  width: 16rem;
  border-right: 1px solid #e9e9e9;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  background: #fff;
  overflow-y: auto;
  transition: width 0.2s;
}
.page-sidenav::-webkit-scrollbar { width: 6px; }
.page-sidenav::-webkit-scrollbar-track { background: #f1f1f1; }
.page-sidenav::-webkit-scrollbar-thumb { background: #c0bebe; border-radius: 3px; }
.sidenav { padding: 0.5rem 0.75rem 2rem; }
.org-name {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 900;
  font-size: 1.1rem;
  padding: 0.6rem 0.5rem 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.org-name img { margin-right: 0.3rem; vertical-align: sub; }
.sidenav .sector-label {
  font-size: 0.75rem;
  color: #00185E;
  font-weight: 700;
  padding: 0 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #e9e9e9;
}
.sidenav .nav-header {
  font-weight: 400 !important;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.0625rem;
  color: gray;
  padding: 0.75rem 0.5rem 0.25rem;
  list-style: none;
}
.sidenav .nav { list-style: none; padding: 0; margin: 0; }
.sidenav .nav > li { margin-bottom: 0; list-style: none; }
.sidenav .nav > li > a {
  padding: 0.35rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #333;
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.1s;
}
.sidenav .nav > li > a:hover { background: #f9f9f9; }
.sidenav .nav > li > a.active {
  color: #00185E;
  background-color: rgba(19, 126, 255, 0.05);
  font-weight: 700;
}
.sidenav .nav li i { font-size: 1.2rem; }

.layout-row { display: flex; }
.layout-column {
  flex: 1;
  margin-left: 16rem;
  min-height: 100vh;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: #fff;
  border-bottom: 1px solid #e9e9e9;
  position: sticky;
  top: 0;
  z-index: 50;
  min-height: 3.5rem;
}
.page-header h1 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #1a1a1a;
  margin: 0;
  line-height: 1.5rem;
}
.page-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.page-container {
  max-width: 1290px;
  margin: 0 auto;
}
.page-spacing {
  padding: 1rem 1.5rem 5rem;
}

.card {
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 -1px 0 rgba(0, 0, 0, 0.016);
  margin-bottom: 1.5rem;
}
.card-header { padding: 1rem; font-weight: 700; }
.card-body { padding: 1rem; }
.card-body-x { padding: 0 1rem; }
.card-body-y { padding: 1rem 0; }

.card-list-header {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 1rem;
  margin-top: 0;
  font-size: 0.75rem;
  color: #6c757d;
  font-weight: 600;
  border-bottom: 1px solid #e9e9e9;
  background: #f9f9f9;
}
.row-list-item {
  display: flex;
  padding: 0.65rem 1rem;
  align-items: center;
  cursor: pointer;
  transition: background 0.1s;
  text-decoration: none;
  color: #333;
  gap: 1rem;
}
.row-list-item:not(:last-child) {
  border-bottom: 1px solid rgba(18, 18, 18, 0.1);
}
.row-list-item:hover {
  background: #f9f9f9;
}
.row-list-item__active {
  color: #00185E;
  background-color: rgba(19, 126, 255, 0.05);
  font-weight: 700;
}
.row-list-item .col {
  flex: 1;
  min-width: 0;
}
.row-list-item .col--shrink {
  flex: 0 0 auto;
}

.button, .button:link, .button:visited, button, button:link, button:visited {
  padding: 0.5em 1rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  border-radius: 0.375rem;
  font-weight: 700;
  line-height: 1.25rem;
  width: max-content;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 0.875rem;
}
.button:active, button:active {
  outline: none;
  transform: translateY(-1px);
}
.button--primary {
  background: #00185E;
  color: #fff;
  border: 1px solid #00185E;
}
.button--primary:hover {
  color: #fff;
  background-color: #1874ff;
  box-shadow: 0 4px 8px rgba(29, 119, 255, 0.25);
}
.button--primary.button--outline {
  color: #00185E;
  border: 2px solid rgba(29, 119, 255, 0.5);
  background: transparent;
  box-shadow: none;
}
.button--primary.button--outline:hover {
  color: #fff;
  background-color: #00185E;
  box-shadow: 0 6px 8px rgba(29, 119, 255, 0.15);
}
.button--danger {
  background: #ff0230;
  color: #fff;
  border: 1px solid #ff0230;
}
.button--danger:hover {
  color: #fff;
  background-color: #b10928;
  box-shadow: 0 4px 8px rgba(182, 9, 41, 0.25);
}
.button--gray {
  background: #5d576b;
  color: #fff;
  border: 1px solid #5d576b;
}
.button--gray.button--outline {
  border: 2px solid rgba(93, 87, 107, 0.26);
  color: #5d576b;
  background: transparent;
  box-shadow: none;
}
.button--gray.button--outline:hover {
  color: #fff;
  background-color: #5d576b;
}
.button--small {
  height: 2rem;
  padding: 0 0.75rem;
  font-size: 0.75rem;
  line-height: 1rem;
}
.button--icon {
  display: flex;
  width: 2rem;
  height: 2rem;
  padding: 0;
  justify-content: center;
  align-items: center;
  border-radius: 0.3125rem;
}

.form-input {
  display: flex;
  align-self: stretch;
  line-height: 1.5rem;
  padding: 0.15rem 0.75rem;
  gap: 0.5rem;
  width: 100%;
  min-height: 2.5rem;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.25rem;
  border: 1px solid #b3b3b3;
  background: #fff;
  color: #333;
  transition: border-color 0.15s;
}
.form-input:focus, .form-input:focus-visible {
  outline: 0;
  border-color: #00185E;
  box-shadow: 0 0 0 3px rgba(29, 119, 255, 0.1);
}
.form-input--error {
  border-color: #ff0230;
}
.form-input--error:focus {
  box-shadow: 0 0 0 3px rgba(255, 2, 48, 0.1);
}
.form-input::placeholder {
  color: rgba(0, 0, 0, 0.25);
  font-size: 0.875rem;
}
.form-input:disabled {
  background: #f9f9f9;
}
.form__group {
  align-items: flex-start;
  gap: 0.5rem;
  align-self: stretch;
  margin-bottom: 1rem;
}
.form__group label {
  flex: 1 0 0;
  color: #1a1a1a;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
  display: block;
}
.form__error {
  font-size: 0.75rem;
  color: #ff0230;
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 3.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2rem;
}
.badge--success { background: #d4edda; color: #155724; }
.badge--warning { background: #fff3cd; color: #856404; }
.badge--danger { background: #f8d7da; color: #721c24; }
.badge--info { background: #d1ecf1; color: #0c5460; }
.badge--default { background: #e9ecef; color: #495057; }

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: #adb5bd;
  gap: 0.5rem;
  text-align: center;
}
.empty-state__icon { font-size: 2rem; }
.empty-state__text { font-size: 0.875rem; }

.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 3.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.status-badge--active, .status-badge--completed, .status-badge--paid,
.status-badge--approved, .status-badge--in_stock { background: #d4edda; color: #155724; }
.status-badge--pending, .status-badge--draft, .status-badge--processing { background: #fff3cd; color: #856404; }
.status-badge--inactive, .status-badge--cancelled, .status-badge--out_of_stock,
.status-badge--overdue { background: #f8d7da; color: #721c24; }
.status-badge--growing, .status-badge--in_progress, .status-badge--partial { background: #fff3cd; color: #856404; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  font-size: 0.8125rem;
  color: #6c757d;
}
.pagination__controls { display: flex; align-items: center; gap: 0.25rem; }
.pagination__btn {
  padding: 0.25rem 0.5rem;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  background: #fff;
  color: #495057;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.15s;
}
.pagination__btn:hover:not(:disabled) { background: #f5f5f5; }
.pagination__btn:disabled { opacity: 0.4; cursor: default; }
.pagination__btn--active {
  background: #00185E;
  color: #fff;
  border-color: #00185E;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.15rem 0.75rem;
  border: 1px solid #fafafa;
  background: #fafafa;
  border-radius: 4px;
  min-height: 2.5rem;
  transition: border-color 0.15s;
}
.search-bar:focus-within {
  border-color: #00185E;
}
.search-bar__input {
  border: none;
  outline: none;
  flex: 1;
  font-size: 0.875rem;
  background: transparent;
  color: #333;
  font-family: inherit;
  min-width: 0;
}
.search-bar__input::placeholder { color: rgba(0, 0, 0, 0.25); }
.search-bar__icon { color: #adb5bd; flex-shrink: 0; font-size: 1rem; }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid #e9ecef;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
}

.dashboard__kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.metric-card {
  background: #fff;
  border-radius: 4px;
  padding: 1rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05), 0 -1px 0 rgba(0, 0, 0, 0.016);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.metric-card__icon {
  width: 36px;
  height: 36px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}
.metric-card__value {
  font-size: 1.375rem;
  font-weight: 800;
  color: #1a1a1a;
  line-height: 1.2;
}
.metric-card__label {
  font-size: 0.75rem;
  color: #6c757d;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.dashboard__grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
}
@media (max-width: 1024px) {
  .dashboard__grid { grid-template-columns: 1fr; }
}
.chart-container { position: relative; width: 100%; height: 250px; }

.activity-feed { display: flex; flex-direction: column; }
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.activity-item:last-child { border-bottom: none; }
.activity-item__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00185E;
  margin-top: 6px;
  flex-shrink: 0;
}
.activity-item__body { flex: 1; min-width: 0; }
.activity-item__text { font-size: 0.875rem; color: #333; }
.activity-item__time { font-size: 0.75rem; color: #adb5bd; margin-top: 2px; }

.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.quick-actions__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  color: #333;
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  text-align: center;
}
.quick-actions__btn:hover {
  border-color: #00185E;
  color: #00185E;
  text-decoration: none;
}
.quick-actions__btn-icon { font-size: 1.25rem; }

.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}
.sector-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.75rem;
  padding: 1.5rem;
  background: #fff;
  border: 1px solid #e9ecef;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
}
.sector-card:hover {
  border-color: #00185E;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  text-decoration: none;
}
.sector-card__icon {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}
.sector-card__name { font-size: 0.875rem; font-weight: 700; color: #1a1a1a; }

.detail-table { width: 100%; border-collapse: collapse; }
.detail-table td {
  padding: 0.6rem 0.75rem;
  font-size: 0.875rem;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
}
.detail-table td:first-child {
  font-weight: 600;
  color: #6c757d;
  width: 160px;
  white-space: nowrap;
}
.detail-table tr:last-child td { border-bottom: none; }

.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-radius: 4px;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  animation: toastIn 0.2s ease-out;
  min-width: 260px;
  max-width: 380px;
  pointer-events: auto;
  line-height: 1.35rem;
}
.toast--success { background: #28b485; }
.toast--error { background: #ff0230; }
.toast--info { background: #5d576b; }
.toast__close {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  margin-left: auto;
  padding: 2px;
  opacity: 0.8;
  font-size: 1rem;
  flex-shrink: 0;
  line-height: 1;
}
.toast__close:hover { opacity: 1; }
@keyframes toastIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.dialog {
  background: #fff;
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #e9ecef;
}
.dialog__title { font-size: 1rem; font-weight: 700; }
.dialog__close {
  border: none; background: none; cursor: pointer;
  color: #adb5bd; padding: 4px; font-size: 1.25rem;
  transition: color 0.15s;
}
.dialog__close:hover { color: #333; }
.dialog__body { padding: 1.25rem; overflow-y: auto; flex: 1; }
.dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid #e9ecef;
}

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-flex; }
.htmx-request.htmx-indicator { display: inline-flex; }

.spinner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: #6c757d;
}
.spinner__icon {
  width: 16px;
  height: 16px;
  border: 2px solid #dee2e6;
  border-top-color: #00185E;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner--overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
}
.htmx-request .spinner--overlay,
.htmx-request.spinner--overlay { display: flex; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 99;
}

@keyframes shimmer {
  0% { background-position: -200px 0; }
  100% { background-position: calc(200px + 100%) 0; }
}
.skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}
.skeleton--row { height: 20px; margin: 12px; }

@media (max-width: 768px) {
  .page-sidenav {
    transform: translateX(-100%);
    width: 16rem;
    z-index: 101;
  }
  .page-sidenav.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .layout-column { margin-left: 0; }
  .page-spacing { padding: 0.75rem; }
  .page-header { padding: 0.5rem 0.75rem; flex-wrap: wrap; }
  .page-header h1 { font-size: 1rem; }
  .dashboard__kpis { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .sector-grid { grid-template-columns: 1fr 1fr; }
  .row-list-item { flex-wrap: wrap; }
  .row-list-item .col { flex-basis: 50%; }
  .card-list-header { overflow-x: auto; white-space: nowrap; }
  .form-row { grid-template-columns: 1fr; }
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table thead {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 1rem;
  font-size: 0.75rem;
  color: #6c757d;
  font-weight: 600;
  border-bottom: 1px solid #e9e9e9;
  background: #f9f9f9;
}
.data-table thead tr {
  display: flex;
  width: 100%;
  gap: 1rem;
}
.data-table thead th {
  flex: 1;
  text-align: left;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  font-size: 0.75rem;
  min-width: 0;
}
.data-table tbody tr {
  display: flex;
  padding: 0.65rem 1rem;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid rgba(18, 18, 18, 0.1);
  transition: background 0.1s;
}
.data-table tbody tr:hover {
  background: #f9f9f9;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody td {
  flex: 1;
  min-width: 0;
  font-size: 0.875rem;
  color: #333;
}

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-gray { color: #6c757d; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
