:root {
  --sage-700: #667d69;
  --sage-600: #7e947f;
  --sage-500: #9bad99;
  --sand-25: #fbf8f3;
  --sand-50: #f6f1ea;
  --sand-100: #eee7dd;
  --sand-200: #ddd5ca;
  --panel-border: #e2dbd0;
  --panel-bg: rgba(255, 255, 255, 0.88);
  --panel-soft: #f8f4ed;
  --text-900: #2f322d;
  --text-700: #666d64;
  --text-500: #969b93;
  --action-700: #708cad;
  --action-600: #86a0bf;
  --success: #2f8d5a;
  --warning: #cf7d2f;
  --danger: #c7524d;
  --purple: #8a78b1;
  --cyan: #6d96bb;
  --shadow: 0 20px 50px rgba(77, 74, 60, 0.1);
  --shadow-soft: 0 10px 30px rgba(77, 74, 60, 0.08);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
}

html {
  font-size: 14px;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text-900);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(162, 181, 160, 0.24), transparent 26%),
    radial-gradient(circle at top right, rgba(141, 164, 190, 0.18), transparent 22%),
    linear-gradient(180deg, #f8f4ee 0%, #f5efe7 52%, #f8f5ef 100%);
}

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

.app-shell {
  display: flex;
  flex-direction: column;
}

.brand-image {
  display: block;
  max-width: 100%;
}

.brand-image--header {
  height: 34px;
  width: auto;
}

.brand-image--public {
  height: 42px;
  width: auto;
}

.brand-image--sidebar {
  width: 100%;
  max-width: 180px;
  height: auto;
}

.brand-image--mark {
  width: 64px;
  height: 64px;
  object-fit: contain;
}

.brand-image-link {
  display: inline-flex;
  align-items: center;
}

.brand-image-link--framed {
  padding: 0.72rem 1rem;
  border: 1px solid rgba(225, 217, 206, 0.9);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
}

.brand-image-link--sidebar {
  justify-content: center;
  margin-bottom: 0.4rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(246, 241, 234, 0.82);
  border-bottom: 1px solid rgba(222, 214, 201, 0.82);
  backdrop-filter: blur(16px);
}

.topbar-inner,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.main-nav,
.user-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.main-nav a,
.welcome-copy {
  color: var(--text-700);
}

.main-nav a {
  font-weight: 600;
}

.main-nav a:hover {
  color: var(--sage-700);
}

.page-content {
  flex: 1;
  padding: 2.75rem 0 3rem;
}

.footer-shell {
  margin-top: auto;
  background: rgba(239, 232, 222, 0.88);
  border-top: 1px solid var(--panel-border);
  color: var(--text-700);
  font-size: 0.92rem;
}

.dashboard-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 78px;
  padding: 0.95rem 1.5rem;
  background: rgba(247, 242, 235, 0.92);
  border-bottom: 1px solid rgba(222, 214, 201, 0.94);
  backdrop-filter: blur(14px);
}

.dashboard-topbar__brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}

.dashboard-topbar__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.dashboard-menu-btn {
  display: none;
  min-width: 72px;
}

.user-summary {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-900);
}

.user-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--sage-700), var(--sage-500));
  color: #fff;
  font-weight: 700;
}

.user-name {
  font-weight: 600;
}

.btn-logout {
  color: var(--sage-700);
  background: rgba(255, 255, 255, 0.78);
  border-color: var(--panel-border);
}

.dashboard-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: calc(100vh - 78px);
}

.sidebar-shell {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  padding: 1.5rem 1rem;
  background:
    linear-gradient(180deg, rgba(250, 246, 240, 0.92) 0%, rgba(244, 237, 228, 0.95) 100%);
  border-right: 1px solid rgba(222, 214, 201, 0.92);
}

.sidebar-nav {
  display: grid;
  gap: 0.65rem;
}

.sidebar-nav--mobile {
  gap: 0.75rem;
}

.mobile-nav {
  max-width: 320px;
  background: #f8f4ee;
}

.sidebar-link {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 0 1rem;
  border-radius: 14px;
  color: var(--text-700);
  font-weight: 600;
  border: 1px solid transparent;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.sidebar-link:hover,
.sidebar-link.active {
  background: linear-gradient(135deg, rgba(110, 132, 111, 0.14), rgba(137, 159, 184, 0.14));
  color: var(--text-900);
  border-color: rgba(132, 153, 134, 0.32);
  box-shadow: var(--shadow-soft);
  transform: translateY(-1px);
}

.sidebar-footer {
  margin-top: auto;
  padding: 1rem 0.75rem 0;
  border-top: 1px solid var(--panel-border);
  color: var(--text-700);
}

.sidebar-footer span,
.sidebar-footer small {
  display: block;
}

.dashboard-content {
  padding: 2rem 2rem 2.5rem;
  background: transparent;
}

.alert {
  margin-bottom: 1.25rem;
  border-radius: 14px;
  border: 1px solid var(--panel-border);
}

.hero-grid,
.content-grid,
.auth-shell {
  display: grid;
  gap: 1.5rem;
}

.hero-grid,
.auth-shell {
  grid-template-columns: 1.1fr 0.9fr;
  align-items: stretch;
}

.auth-shell--single {
  grid-template-columns: minmax(0, 520px);
  justify-content: center;
}

.content-grid {
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  align-items: start;
}

.hero-copy,
.hero-panel,
.auth-card,
.panel-card,
.stat-card {
  background: var(--panel-bg);
  border: 1px solid rgba(226, 219, 208, 0.92);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hero-copy,
.hero-panel,
.auth-copy,
.auth-card,
.panel-card {
  padding: 1.75rem;
}

.eyebrow {
  display: inline-block;
  margin-bottom: 0.9rem;
  color: var(--sage-700);
  text-transform: uppercase;
  letter-spacing: 0.11rem;
  font-size: 0.79rem;
  font-weight: 700;
}

h1,
h2 {
  margin: 0 0 0.7rem;
  line-height: 1.08;
  color: var(--text-900);
}

h1 {
  font-size: clamp(2.2rem, 4vw, 3.5rem);
}

h2 {
  font-size: 1.35rem;
}

p,
small,
.muted-line {
  color: var(--text-700);
}

.page-header {
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: clamp(2rem, 3vw, 2.45rem);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1.5rem 0;
}

.credentials-card {
  margin-top: 2rem;
  padding: 1rem 1.1rem;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(162, 181, 160, 0.14), rgba(255, 255, 255, 0.65));
  border: 1px solid rgba(162, 181, 160, 0.3);
}

.hero-panel {
  display: grid;
  gap: 1rem;
  align-content: start;
}

.metric-card {
  padding: 1.25rem;
  border-radius: 18px;
  border: 1px solid rgba(226, 219, 208, 0.92);
}

.metric-card:first-child {
  background: linear-gradient(135deg, rgba(162, 181, 160, 0.18), rgba(255, 255, 255, 0.9));
}

.metric-card.accent {
  background: linear-gradient(135deg, rgba(137, 159, 184, 0.2), rgba(255, 255, 255, 0.9));
}

.metric-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 2rem;
  color: var(--sage-700);
}

.feature-list {
  display: grid;
  gap: 1rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1.4rem;
}

.stat-card {
  padding: 1rem 1.1rem;
  border-radius: 18px;
}

.stat-card:nth-child(1) {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(240, 234, 224, 0.95));
}

.stat-card:nth-child(2) {
  background: linear-gradient(135deg, rgba(243, 240, 235, 0.96), rgba(231, 225, 216, 0.96));
}

.stat-card:nth-child(3) {
  background: linear-gradient(135deg, rgba(223, 236, 223, 0.92), rgba(243, 249, 241, 0.98));
}

.stat-card:nth-child(4) {
  background: linear-gradient(135deg, rgba(233, 239, 245, 0.96), rgba(246, 248, 250, 0.96));
}

.stat-card strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 2rem;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.material-list {
  display: grid;
  gap: 0.8rem;
}

.material-list-expanded {
  max-height: 620px;
  overflow: auto;
}

.material-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid rgba(226, 219, 208, 0.92);
  background: linear-gradient(180deg, rgba(251, 248, 243, 0.96) 0%, rgba(247, 242, 235, 0.96) 100%);
}

.material-item-block {
  align-items: flex-start;
}

.material-item__body,
.material-item__meta {
  min-width: 0;
}

.material-actions {
  min-width: 150px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 0.48rem 0.9rem;
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.18);
}

.status-pill.recebido {
  background: var(--cyan);
}

.status-pill.emanalise,
.status-pill.emedicao {
  background: var(--warning);
}

.status-pill.emaprovacao {
  background: var(--purple);
}

.status-pill.concluido {
  background: var(--success);
}

.status-pill.delivery-pendente,
.status-pill.paymentareceber,
.status-pill.payment-areceber {
  background: var(--danger);
}

.status-pill.delivery-materialfaltante {
  background: #ef2b2d;
}

.status-pill.delivery-naoiniciado {
  background: #b00000;
}

.status-pill.delivery-emdownload {
  background: #7a4308;
}

.status-pill.delivery-emfilaparaedicao {
  background: #ffc84d;
  color: #4c3910;
}

.status-pill.delivery-edicaoselecao {
  background: #d5bbe7;
  color: #4b3358;
}

.status-pill.delivery-editado {
  background: #1f63b5;
}

.status-pill.delivery-emrevisaonolight {
  background: #3e3e40;
}

.status-pill.delivery-exportandoarquivos {
  background: #197f59;
}

.status-pill.delivery-emupload {
  background: #f5c3bd;
  color: #6f3f39;
}

.status-pill.delivery-prontoparadownload {
  background: #94cae9;
  color: #1e506b;
}

.status-pill.delivery-concluido,
.status-pill.paymentrecebido,
.status-pill.payment-recebido {
  background: #96d694;
  color: #21552a;
}

.material-item__badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.5rem;
}

.material-item__meta--client {
  display: grid;
  gap: 0.65rem;
  min-width: min(100%, 260px);
}

.material-item__line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.stat-card--warning {
  background: linear-gradient(180deg, #f4efe5 0%, #ece3d4 100%);
  border-color: #d9cab0;
}

.auth-copy {
  padding: 2rem 0.5rem;
  align-self: center;
}

.auth-card {
  max-width: 520px;
  justify-self: end;
}

.auth-shell--single .auth-card {
  justify-self: center;
  width: 100%;
}

.auth-links {
  margin-top: 1rem;
  text-align: center;
}

.auth-links a {
  color: var(--sage-700);
  font-weight: 600;
}

.btn {
  border-radius: 12px;
  font-weight: 600;
}

.btn-primary {
  background: linear-gradient(135deg, var(--sage-700), var(--sage-600));
  border-color: transparent;
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(135deg, #5e755f, #748977);
  border-color: transparent;
}

.btn-outline-primary {
  color: var(--sage-700);
  border-color: rgba(126, 148, 127, 0.38);
}

.btn-outline-primary:hover {
  background: var(--sage-700);
  border-color: var(--sage-700);
}

.btn-outline-secondary {
  color: var(--text-700);
  border-color: var(--panel-border);
}

.btn-outline-secondary:hover {
  background: #f3ede5;
  border-color: #d7cec2;
  color: var(--text-900);
}

.form-control,
.form-select {
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border-color: #d7cec2;
  background: rgba(255, 255, 255, 0.92);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--sage-500);
  box-shadow: 0 0 0 0.2rem rgba(126, 148, 127, 0.14);
}

.table {
  margin-bottom: 0;
}

.table > :not(caption) > * > * {
  padding-top: 0.95rem;
  padding-bottom: 0.95rem;
  background: transparent;
  border-color: #ebe3d7;
}

.table thead th {
  color: var(--text-700);
  font-weight: 700;
  background: #f7f2eb;
}

.bulk-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(250, 246, 240, 0.96) 0%, rgba(244, 237, 228, 0.96) 100%);
}

.bulk-toolbar__check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-900);
  font-weight: 600;
}

.bulk-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.bulk-toolbar__actions .form-select {
  min-width: 220px;
}

.bulk-toolbar--stacked {
  align-items: flex-start;
}

.bulk-toolbar__actions--triple {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-toolbar {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1rem;
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(250, 246, 240, 0.98) 0%, rgba(244, 238, 230, 0.98) 100%);
}

.filter-toolbar__grid {
  display: grid;
  grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(160px, 1fr));
  gap: 0.9rem;
}

.filter-toolbar__grid--clients {
  grid-template-columns: minmax(280px, 1fr) 180px;
}

.filter-toolbar__grid--portal {
  grid-template-columns: minmax(240px, 2fr) repeat(3, minmax(160px, 1fr));
}

.filter-drawer {
  display: block;
}

.filter-drawer__summary {
  display: none;
}

.portal-heading-mobile {
  display: none;
}

.filter-toolbar__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
}

.filter-toolbar__actions--wrap {
  flex-wrap: wrap;
}

.filter-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text-900);
  font-weight: 600;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e9e1d6;
}

.pagination-summary {
  color: var(--text-700);
  font-weight: 600;
}

.pagination-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.table-empty {
  padding: 1.25rem;
  color: var(--text-700);
  text-align: center;
}

.material-hint {
  margin-top: 0.85rem;
}

.bulk-table__check {
  width: 48px;
  text-align: center;
}

.bulk-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

@media (max-width: 1100px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .content-grid,
  .hero-grid,
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-card {
    justify-self: stretch;
    max-width: none;
  }
}

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

  .dashboard-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .sidebar-shell {
    display: none;
  }

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

  .dashboard-topbar {
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
  }

  .dashboard-topbar__actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .bulk-toolbar,
  .bulk-toolbar__actions,
  .filter-toolbar__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-toolbar__grid,
  .filter-toolbar__grid--clients,
  .filter-toolbar__grid--portal {
    grid-template-columns: 1fr;
  }

  .pagination-bar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 640px) {
  .topbar-inner,
  .footer-inner,
  .main-nav,
  .user-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .stats-grid,
  .sidebar-nav {
    grid-template-columns: 1fr;
  }

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

  .dashboard-content {
    padding: 1rem;
  }

  .dashboard-topbar {
    align-items: flex-start;
  }

  .dashboard-topbar__actions,
  .user-summary {
    width: 100%;
  }

  .dashboard-topbar__actions {
    gap: 0.75rem;
    justify-content: stretch;
    align-items: stretch;
  }

  .dashboard-topbar__brand .brand-image-link--framed,
  .user-summary {
    display: none;
  }

  .welcome-copy {
    display: block;
    width: 100%;
    font-weight: 600;
  }

  .dashboard-topbar .btn-logout {
    width: 100%;
  }

  .page-header--portal .portal-heading-desktop,
  .page-header--portal .portal-contact-line {
    display: none;
  }

  .portal-heading-mobile {
    display: inline;
  }

  .filter-drawer {
    margin-bottom: 1rem;
    border: 1px solid var(--panel-border);
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(250, 246, 240, 0.98) 0%, rgba(244, 238, 230, 0.98) 100%);
    overflow: hidden;
  }

  .filter-drawer__summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.95rem 1rem;
    cursor: pointer;
    font-weight: 700;
    color: var(--text-900);
    list-style: none;
  }

  .filter-drawer__summary::-webkit-details-marker {
    display: none;
  }

  .filter-drawer__summary::after {
    content: "+";
    font-size: 1.2rem;
    line-height: 1;
    color: var(--sage-700);
  }

  .filter-drawer[open] .filter-drawer__summary::after {
    content: "-";
  }

  .filter-toolbar--portal {
    margin-bottom: 0;
    border: 0;
    border-top: 1px solid var(--panel-border);
    border-radius: 0;
    background: transparent;
  }

  .panel-card,
  .auth-card,
  .hero-copy,
  .hero-panel {
    padding: 1.15rem;
  }

  .page-header {
    margin-bottom: 1.1rem;
  }

  .hero-actions,
  .pagination-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .material-item,
  .material-item-block {
    flex-direction: column;
  }

  .material-item__meta,
  .text-end {
    width: 100%;
    text-align: left !important;
  }

  .status-pill {
    min-width: 0;
  }

  .table-responsive {
    overflow: visible;
  }

  .table thead {
    display: none;
  }

  .table,
  .table tbody,
  .table tr,
  .table td {
    display: block;
    width: 100%;
  }

  .table tbody {
    display: grid;
    gap: 0.9rem;
  }

  .table tr {
    padding: 0.9rem;
    border: 1px solid #e8e0d4;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow-soft);
  }

  .table > :not(caption) > * > * {
    padding: 0.45rem 0;
    border: 0;
  }

  .table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 0.2rem;
    color: var(--text-500);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04rem;
  }

  .bulk-table__check {
    width: 100%;
    text-align: left;
  }

  .bulk-table__check input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }

  .table td.text-end {
    text-align: left !important;
  }

  .table td.text-end .btn,
  .bulk-toolbar__actions .btn,
  .bulk-toolbar__actions .form-select,
  .filter-toolbar .btn,
  .filter-toolbar .form-select,
  .filter-toolbar .form-control,
  .auth-card .btn {
    width: 100%;
  }

  .credentials-card {
    overflow-wrap: anywhere;
  }

  .brand-image--header,
  .brand-image--public,
  .brand-image--sidebar {
    max-width: 100%;
    height: auto;
  }

  .brand-image-link--framed {
    width: 100%;
    justify-content: center;
  }

  .topbar-inner,
  .footer-inner {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}
