:root {
  --brand: #1d6f42;
  --brand-dark: #145333;
  --brand-soft: #e8f3ed;
  --line: #dfe5eb;
  --bg: #f4f7f5;
}

body {
  font-family: "Source Sans 3", "Segoe UI", sans-serif;
  background: var(--bg);
  color: #1d2a35;
}

.app-authenticated .main-header.navbar {
  border-bottom: 1px solid #d9e1e8;
}

.app-authenticated .main-sidebar {
  background: linear-gradient(180deg, #2c3e50 0%, #223344 100%);
}

.app-authenticated .brand-link {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-authenticated .brand-link .brand-text {
  color: #ffffff;
}

.app-authenticated .nav-sidebar .nav-link {
  border-radius: 0.5rem;
  margin: 0 0.35rem 0.2rem;
  font-weight: 600;
}

.app-authenticated .nav-sidebar .nav-link p {
  font-size: 0.92rem;
}

.app-authenticated .nav-sidebar .nav-link.active {
  background: var(--brand);
  color: #ffffff;
}

.app-authenticated .nav-sidebar .nav-link:hover:not(.active) {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.app-content-wrapper {
  background: var(--bg);
}

.nav-user-label {
  color: #4f5d6b;
  font-weight: 600;
  margin-right: 0.75rem;
}

.logout-form-inline {
  margin: 0;
}

.main-footer {
  border-top: 1px solid #d9e1e8;
  background: #ffffff;
}

.panel,
.stat-card,
.login-card,
.hero-card,
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 0.65rem;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.06);
}

.panel,
.hero-card {
  padding: 1rem;
}

.split {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 1rem;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--brand);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

.muted {
  color: #6c757d;
}

.form-grid {
  display: grid;
  gap: 0.7rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.8rem;
}

.filter-grid label,
.form-grid label {
  margin: 0;
}

label span {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  color: #5a6773;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #ced4da;
  border-radius: 0.35rem;
  padding: 0.45rem 0.6rem;
  background: #fff;
  min-height: calc(1.5em + 0.9rem + 2px);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #85b49a;
  box-shadow: 0 0 0 0.15rem rgba(29, 111, 66, 0.15);
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.92rem;
}

.check input {
  width: auto;
  min-height: auto;
}

.btn {
  border-radius: 0.4rem;
  font-weight: 600;
}

.btn:not(.btn-light):not(.btn-danger):not(.btn-dark):not(.btn-outline-danger):not(.btn-outline-secondary) {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn:not(.btn-light):not(.btn-danger):not(.btn-dark):not(.btn-outline-danger):not(.btn-outline-secondary):hover,
.btn:not(.btn-light):not(.btn-danger):not(.btn-dark):not(.btn-outline-danger):not(.btn-outline-secondary):focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.btn.active {
  box-shadow: inset 0 0 0 1px rgba(17, 37, 25, 0.15);
}

.table-wrap {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  margin-bottom: 0;
}

.table th,
.table td {
  padding: 0.6rem;
  border-bottom: 1px solid #edf0f3;
  vertical-align: top;
  white-space: nowrap;
}

.table th {
  font-size: 0.78rem;
  color: #677483;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.table-admin-wrap {
  border: 1px solid #dbe3ec;
  border-radius: 0.55rem;
  background: #ffffff;
}

.table-admin th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f7fafd;
  border-bottom: 1px solid #dbe3ec;
}

.table-admin td {
  white-space: normal;
  line-height: 1.35;
}

.table-admin tbody tr:hover {
  background: #f8fbff;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
}

.badge-completed {
  background: #d9f3e4;
  color: #0f6b3b;
}

.badge-inbound {
  background: #fff1d8;
  color: #9a6608;
}

.flash-stack {
  margin-bottom: 0.75rem;
}

.flash {
  border-radius: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid transparent;
}

.flash-success {
  color: #0f5132;
  background: #d1e7dd;
  border-color: #badbcc;
}

.flash-error {
  color: #842029;
  background: #f8d7da;
  border-color: #f5c2c7;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
}

.detail-item {
  border: 1px solid #e9ecef;
  border-radius: 0.4rem;
  padding: 0.7rem;
  background: #fbfcfd;
}

.detail-item strong {
  display: block;
  font-size: 0.78rem;
  color: #66707a;
  margin-bottom: 0.25rem;
}

.petani-slip-panel {
  border-radius: 0.9rem;
  padding: 1.25rem;
}

.petani-slip-grid {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.45rem;
}

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

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

.petani-slip-cell {
  border: 2px solid #1c1f24;
  border-radius: 0.35rem;
  background: #fff;
  padding: 0.6rem 0.8rem;
  min-height: 70px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.petani-slip-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #111827;
  text-transform: uppercase;
  line-height: 1.15;
}

.petani-slip-sub {
  margin-top: 0.22rem;
  font-size: 0.62rem;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
}

.petani-slip-value {
  margin-top: 0.3rem;
  font-size: 1rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
}

.petani-slip-spacer {
  min-height: 70px;
}

.petani-slip-actions {
  margin-top: 0.8rem;
  display: flex;
  justify-content: flex-start;
}

.petani-print-panel {
  border-radius: 0.9rem;
  padding: 1.25rem;
}

.petani-print-sheet {
  border: 2px solid #111827;
  border-radius: 0.4rem;
  background: #fff;
  color: #111827;
  padding: 1rem;
  font-family: "Courier New", monospace;
}

.petani-print-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid #111827;
  padding-bottom: 0.7rem;
  margin-bottom: 0.65rem;
}

.petani-print-header-left h2 {
  margin: 0;
  font-size: 2.3rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.petani-print-header-left p {
  margin: 0.1rem 0;
  font-size: 1rem;
  font-weight: 800;
}

.petani-print-header-left .petani-print-header-sub {
  font-size: 0.9rem;
  font-weight: 700;
}

.petani-print-header-right {
  min-width: 360px;
}

.petani-print-header-right p {
  margin: 0.12rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.petani-print-header-right p span {
  min-width: 145px;
}

.petani-print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.7rem;
  font-size: 0.92rem;
}

.petani-print-table th,
.petani-print-table td {
  border: 2px solid #111827;
  padding: 0.35rem 0.45rem;
  vertical-align: middle;
}

.petani-print-table th {
  text-align: left;
  font-size: 0.9rem;
  font-weight: 900;
}

.petani-print-net-row td {
  font-weight: 900;
}

.petani-print-summary {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.7rem;
  font-size: 0.95rem;
}

.petani-print-summary th,
.petani-print-summary td {
  border: 2px solid #111827;
  padding: 0.45rem 0.6rem;
  font-weight: 800;
}

.petani-print-summary th {
  text-align: left;
}

.petani-print-summary td {
  text-align: right;
}

.petani-print-payable {
  border: 2px solid #111827;
  border-radius: 0.2rem;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.6rem;
}

.petani-print-payable p {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 900;
}

.petani-print-payable h3 {
  margin: 0;
  font-size: 2.35rem;
  font-weight: 900;
  line-height: 1.1;
}

.petani-print-footer {
  border-top: 2px solid #111827;
  padding-top: 0.35rem;
  font-size: 0.9rem;
  font-weight: 800;
}

.timbangan-print-panel {
  border-radius: 0.9rem;
  padding: 1.25rem;
}

.timbangan-print-sheet {
  border: 2px solid #111827;
  border-radius: 0.4rem;
  background: #fff;
  color: #111827;
  padding: 1rem;
  font-family: "Courier New", monospace;
}

.timbangan-print-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid #111827;
  padding-bottom: 0.7rem;
  margin-bottom: 0.65rem;
}

.timbangan-print-header-left h2 {
  margin: 0;
  font-size: 2.3rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.timbangan-print-header-left p {
  margin: 0.1rem 0;
  font-size: 1rem;
  font-weight: 800;
}

.timbangan-print-header-left .timbangan-print-header-sub {
  font-size: 0.9rem;
  font-weight: 700;
}

.timbangan-print-header-right {
  min-width: 360px;
}

.timbangan-print-header-right p {
  margin: 0.12rem 0;
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.timbangan-print-header-right p span {
  min-width: 145px;
}

.timbangan-print-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.7rem;
  font-size: 0.92rem;
}

.timbangan-print-table th,
.timbangan-print-table td {
  border: 2px solid #111827;
  padding: 0.35rem 0.45rem;
  vertical-align: middle;
}

.timbangan-print-table th {
  text-align: center;
  font-size: 0.9rem;
  font-weight: 900;
}

.timbangan-print-net-row td {
  font-weight: 900;
}

.timbangan-print-compact td,
.timbangan-print-compact th {
  padding: 0.34rem 0.45rem;
}

.timbangan-print-section-title {
  margin: 0.75rem 0 0.3rem;
  font-size: 1.4rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.timbangan-print-barcode {
  border: 2px solid #111827;
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.6rem;
}

.timbangan-print-barcode h4 {
  margin: 0 0 0.45rem;
  font-size: 1.08rem;
  font-weight: 900;
}

.timbangan-print-barcode-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.timbangan-print-barcode-box {
  width: 230px;
  min-height: 120px;
  border: 2px solid #111827;
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  font-weight: 900;
}

.timbangan-print-barcode-content p {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 800;
  line-height: 1.35;
}

.timbangan-print-footer {
  border-top: 2px solid #111827;
  padding-top: 0.35rem;
  font-size: 0.9rem;
  font-weight: 800;
}

.timbangan-print-subheader {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 2px solid #111827;
  margin-bottom: 0.65rem;
  padding-bottom: 0.4rem;
}

.timbangan-print-subheader h3 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 900;
}

.timbangan-print-subheader p {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
}

.timbangan-print-summary {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0.1rem;
  font-size: 0.95rem;
}

.timbangan-print-summary th,
.timbangan-print-summary td {
  border: 2px solid #111827;
  padding: 0.45rem 0.6rem;
  font-weight: 800;
}

.timbangan-print-summary th {
  text-align: left;
  width: 42%;
}

.timbangan-slip-panel {
  border-radius: 0.9rem;
  padding: 1.25rem;
}

.timbangan-slip-card {
  border: 2px solid #1c1f24;
  border-radius: 0.35rem;
  background: #fff;
  padding: 0.7rem;
  margin-bottom: 1rem;
}

.timbangan-slip-title {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #111827;
}

.timbangan-slip-grid {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
}

.timbangan-slip-grid-1 {
  grid-template-columns: 1fr;
}

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

.timbangan-slip-grid-3 {
  grid-template-columns: 0.8fr 1fr 1fr;
}

.timbangan-slip-cell {
  border: 2px solid #1c1f24;
  border-radius: 0.2rem;
  background: #fff;
  min-height: 52px;
  padding: 0.35rem 0.55rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.timbangan-slip-cell-head {
  justify-content: flex-start;
}

.timbangan-slip-label {
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  color: #111827;
  text-transform: uppercase;
  line-height: 1.1;
}

.timbangan-slip-sub {
  margin-top: 0.15rem;
  font-size: 0.6rem;
  font-weight: 700;
  color: #4b5563;
  text-transform: uppercase;
}

.timbangan-slip-value {
  margin-top: 0.22rem;
  font-size: 0.96rem;
  font-weight: 800;
  color: #111827;
  line-height: 1.2;
}

.timbangan-slip-spacer {
  min-height: 52px;
}

.timbangan-slip-actions {
  margin-top: 0.8rem;
  display: flex;
  justify-content: flex-start;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 10% 10%, #ecf3ef, #f7f9fc 45%, #eef3f8 100%);
}

.content-full {
  width: min(920px, 96vw);
}

.login-card {
  padding: 1.2rem;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}

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

.stat-card,
.kpi {
  padding: 0.8rem;
}

.stat-card span {
  color: #6c757d;
  font-size: 0.83rem;
}

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

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.spb-admin-panel {
  border-radius: 0.75rem;
}

.spb-filter-grid {
  margin-bottom: 1rem;
}

.spb-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.spb-kpi-card {
  border: 1px solid #e4e9ef;
  border-radius: 0.6rem;
  background: linear-gradient(180deg, #ffffff 0%, #f9fbfd 100%);
}

.spb-kpi-card span {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.spb-kpi-card strong {
  display: block;
  margin-top: 0.35rem;
  color: #0f172a;
  font-size: 1.12rem;
}

.spb-table td {
  vertical-align: middle;
}

.spb-table td small {
  display: block;
  margin-top: 0.15rem;
}

.driver-slip-sheet {
  border: 2px solid #111827;
  border-radius: 0.4rem;
  background: #fff;
  color: #111827;
  padding: 1rem;
  font-family: "Courier New", monospace;
}

.driver-slip-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 2px solid #111827;
  padding-bottom: 0.65rem;
  margin-bottom: 0.65rem;
}

.driver-slip-header h2 {
  margin: 0 0 0.2rem;
  font-size: 1.5rem;
  font-weight: 900;
}

.driver-slip-header p {
  margin: 0.1rem 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.driver-slip-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.driver-slip-table th,
.driver-slip-table td {
  border: 2px solid #111827;
  padding: 0.35rem 0.45rem;
  vertical-align: top;
}

.driver-slip-table th {
  text-align: center;
  font-weight: 900;
}

.driver-slip-table tfoot th {
  text-align: right;
}

@media print {
  .no-print,
  .main-header,
  .main-sidebar,
  .main-footer,
  .content-header {
    display: none !important;
  }

  .app-content-wrapper,
  .content-wrapper {
    margin-left: 0 !important;
    padding: 0 !important;
    min-height: auto !important;
  }

  .content {
    padding: 0 !important;
  }

  .panel {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 0 !important;
  }
}

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

@media (max-width: 991.98px) {
  .main-sidebar {
    min-height: 100vh;
  }

  .split,
  .detail-grid,
  .login-card,
  .kpi-grid,
  .stat-grid {
    grid-template-columns: 1fr;
  }

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

  .petani-slip-grid-2,
  .petani-slip-grid-3,
  .timbangan-slip-grid-2,
  .timbangan-slip-grid-3 {
    grid-template-columns: 1fr;
  }

  .petani-print-header {
    flex-direction: column;
  }

  .driver-slip-header {
    flex-direction: column;
  }

  .timbangan-print-header {
    flex-direction: column;
  }

  .petani-print-header-right {
    min-width: 0;
  }

  .timbangan-print-header-right {
    min-width: 0;
  }

  .timbangan-print-barcode-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .timbangan-print-barcode-box {
    width: 100%;
  }

  .petani-slip-spacer,
  .timbangan-slip-spacer {
    display: none;
  }
}

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

  .spb-kpi-grid {
    grid-template-columns: 1fr;
  }
}
