:root {
 --pde-bg: #f6f7fb;
 --pde-surface: #ffffff;
 --pde-ink: #1f2937;
 --pde-muted: #6b7280;
 --pde-border: #e5e7eb;
 --pde-primary: #2563eb;
 --pde-primary-dark: #1d4ed8;
 --pde-teal: #0f766e;
 --pde-amber: #b45309;
 --pde-sidebar: #111827;
 --pde-sidebar-soft: #1f2937;
 --pde-radius: 8px;
 --pde-shadow: 0 10px 28px rgba(17, 24, 39, .08);
}

body {
 background: var(--pde-bg);
 color: var(--pde-ink);
 font-size: .94rem;
}

.app-wrapper {
 background:
  radial-gradient(circle at top left, rgba(37, 99, 235, .08), transparent 28rem),
  linear-gradient(180deg, #fbfcff 0, var(--pde-bg) 22rem);
}

.app-header.navbar {
 min-height: 64px;
 border-bottom: 1px solid rgba(229, 231, 235, .86);
 background: rgba(255, 255, 255, .86) !important;
 backdrop-filter: blur(14px);
}

.app-header .nav-link {
 width: 38px;
 height: 38px;
 display: inline-flex;
 align-items: center;
 justify-content: center;
 border-radius: var(--pde-radius);
 color: var(--pde-ink);
}

.app-header .nav-link:hover {
 background: #eef2ff;
 color: var(--pde-primary);
}

.topbar-user {
 color: var(--pde-muted);
 font-weight: 600;
}

.context-form {
 min-width: 780px;
}

.context-contract-select {
 width: 250px;
}

.context-program-select {
 width: 250px;
}

.context-revision-select {
 width: 240px;
}

.app-sidebar {
 background: linear-gradient(180deg, var(--pde-sidebar) 0%, #171717 100%) !important;
 border-right: 0;
}

.sidebar-brand {
 min-height: 64px;
 border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.brand-link {
 text-decoration: none;
 color: #fff;
 font-weight: 700;
 letter-spacing: 0;
}

.brand-mark {
 width: 34px;
 height: 34px;
 display: inline-flex;
 align-items: center;
 justify-content: center;
 border-radius: var(--pde-radius);
 background: linear-gradient(135deg, var(--pde-primary), var(--pde-teal));
 margin-right: .65rem;
}

.sidebar-menu .nav-link {
 margin: .16rem .75rem;
 border-radius: var(--pde-radius);
 color: rgba(255, 255, 255, .72);
}

.sidebar-menu .nav-link:hover,
.sidebar-menu .nav-link.active {
 background: rgba(255, 255, 255, .1);
 color: #fff;
}

.sidebar-menu .nav-icon {
 color: rgba(255, 255, 255, .62);
}

.sidebar-menu .nav-link.active .nav-icon,
.sidebar-menu .nav-link:hover .nav-icon {
 color: #fff;
}

.app-content-header {
 padding: 1.35rem 1.25rem .75rem;
}

.app-content-header h3 {
 font-size: 1.35rem;
 font-weight: 750;
 letter-spacing: 0;
}

.app-content {
 padding: 0 1.25rem 2rem;
}

.card {
 border: 1px solid rgba(229, 231, 235, .9);
 border-radius: var(--pde-radius);
 box-shadow: var(--pde-shadow);
 overflow: hidden;
}

.card-header,
.card-footer {
 background: #fff;
 border-color: var(--pde-border);
}

.form-control,
.form-select {
 border-color: #d7dce5;
 border-radius: var(--pde-radius);
 min-height: 40px;
}

.form-control:focus,
.form-select:focus {
 border-color: var(--pde-primary);
 box-shadow: 0 0 0 .2rem rgba(37, 99, 235, .12);
}

label {
 margin-bottom: .35rem;
 color: var(--pde-muted);
 font-weight: 650;
 font-size: .82rem;
}

.btn {
 border-radius: var(--pde-radius);
 font-weight: 650;
 min-height: 38px;
}

.btn-sm {
 min-height: 30px;
}

.btn-primary {
 background: var(--pde-primary);
 border-color: var(--pde-primary);
}

.btn-primary:hover {
 background: var(--pde-primary-dark);
 border-color: var(--pde-primary-dark);
}

.btn-success {
 background: var(--pde-teal);
 border-color: var(--pde-teal);
}

.table {
 --bs-table-bg: transparent;
 margin-bottom: 0;
}

.table thead th {
 background: #f9fafb;
 color: #4b5563;
 border-bottom: 1px solid var(--pde-border);
 font-size: .78rem;
 font-weight: 750;
 text-transform: uppercase;
 letter-spacing: 0;
}

.table thead th.sortable-column {
 cursor: pointer;
 user-select: none;
 white-space: nowrap;
}

.table thead th.sortable-column:hover {
 color: var(--pde-primary);
 background: #f3f6ff;
}

.table thead th.sortable-column::after {
 content: "↕";
 margin-left: .35rem;
 color: #9ca3af;
 font-size: .72rem;
}

.table thead th.sortable-column[data-sort-direction="asc"]::after {
 content: "↑";
 color: var(--pde-primary);
}

.table thead th.sortable-column[data-sort-direction="desc"]::after {
 content: "↓";
 color: var(--pde-primary);
}

.table tbody td {
 vertical-align: middle;
 border-color: #eef0f4;
}

.table tfoot td {
 background: #f8fafc;
 border-top: 1px solid #d8dee8;
 color: var(--pde-ink);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
 --bs-table-bg-type: rgba(249, 250, 251, .7);
}

.timetable-table {
 min-width: 1100px;
 border-collapse: separate;
 border-spacing: 0;
}

.timetable-section + .timetable-section {
 margin-top: 1.5rem;
 padding-top: 1.5rem;
 border-top: 1px solid var(--pde-border);
}

.timetable-table thead th {
 position: sticky;
 top: 0;
 z-index: 2;
 background: #f9fafb;
}

.timetable-table tbody td:first-child,
.timetable-table thead th:first-child {
 position: sticky;
 left: 0;
 z-index: 1;
 background: #fff;
}

.timetable-table thead th:first-child {
 z-index: 3;
 background: #f9fafb;
}

.timetable-table .timetable-stop-col {
 min-width: 280px;
}

.timetable-table .timetable-km-col {
 width: 78px;
}

.timetable-table .timetable-trip-col {
 width: 158px;
 min-width: 158px;
 max-width: 158px;
 white-space: normal;
 vertical-align: top;
}

.timetable-table .timetable-idc {
 color: var(--pde-ink);
 font-size: .84rem;
 font-weight: 800;
 line-height: 1.1;
 margin-bottom: .15rem;
 padding: 0;
 text-decoration: none;
}

.timetable-table .timetable-frequency {
 display: block;
 margin-top: .25rem;
 padding: .18rem .28rem;
 border: 1px solid #d8dee8;
 border-radius: 4px;
 background: #fff;
 color: #334155;
 font-size: .64rem;
 font-weight: 700;
 line-height: 1.15;
 overflow-wrap: anywhere;
}

.timetable-table .timetable-time-cell {
 width: 158px;
 min-width: 158px;
}

.timetable-time-form {
 display: flex;
 align-items: center;
 justify-content: center;
 gap: .25rem;
}

.timetable-time-input {
 width: 82px;
 min-width: 82px;
 padding-left: .35rem;
 padding-right: .35rem;
 text-align: center;
}

.timetable-time-save {
 padding-left: .4rem;
 padding-right: .4rem;
}

.stop-time-input {
 width: 92px;
}

.stop-km-input {
 width: 110px;
}

.line-stop-km-form {
 display: inline-flex;
 align-items: center;
 justify-content: flex-end;
 gap: .35rem;
 min-width: 110px;
}

.stop-sequence-input {
 width: 72px;
}

.compare-table {
 border-collapse: separate;
 border-spacing: 0;
 font-size: .78rem;
 line-height: 1.25;
 table-layout: fixed;
 min-width: 1760px;
 white-space: normal;
}

.compare-table .compare-col-progressive { width: 44px; }
.compare-table .compare-col-company { width: 132px; }
.compare-table .compare-col-line { width: 64px; }
.compare-table .compare-col-idc { width: 74px; }
.compare-table .compare-col-status { width: 98px; }
.compare-table .compare-col-revision { width: 46px; }
.compare-table .compare-col-place { width: 150px; }
.compare-table .compare-col-band { width: 100px; }
.compare-table .compare-col-frequency { width: 150px; }
.compare-table .compare-col-number { width: 88px; }
.compare-table .compare-col-days { width: 68px; }
.compare-table .compare-col-justification { width: 190px; }
.compare-table .compare-col-codes { width: 230px; }
.compare-table .compare-col-notes { width: 160px; }

.compare-table thead th {
 font-size: .68rem;
 padding: .38rem .42rem;
 white-space: normal;
 overflow-wrap: anywhere;
 word-break: normal;
}

.compare-table tbody td {
 border-bottom-color: #d7deea;
 padding: .34rem .42rem;
 white-space: normal;
 overflow-wrap: anywhere;
 word-break: normal;
}

.compare-table .compare-company-col {
 width: 132px;
 min-width: 132px;
 max-width: 132px;
}

.compare-table .compare-frequency-col {
 width: 150px;
 min-width: 150px;
 max-width: 150px;
}

.compare-table .compare-justification-col {
 width: 190px;
 min-width: 190px;
 max-width: 190px;
}

.compare-table .compare-company-text {
 display: block;
 width: 132px;
 max-width: 132px;
 white-space: normal;
 overflow-wrap: anywhere;
 word-break: normal;
 line-height: 1.2;
}

.compare-table .compare-frequency-text {
 display: block;
 width: 150px;
 max-width: 150px;
 white-space: normal;
 overflow-wrap: anywhere;
 word-break: normal;
 line-height: 1.2;
}

.compare-table .compare-justification-text {
 display: block;
 width: 190px;
 max-width: 190px;
 white-space: normal;
 overflow-wrap: anywhere;
 word-break: normal;
 line-height: 1.2;
}

.compare-table .badge {
 font-size: .68rem;
 padding: .28em .48em;
 white-space: nowrap;
}

.compare-idc-link {
 font-weight: 750;
 line-height: 1.1;
 text-decoration: none;
}

.compare-idc-link:hover {
 text-decoration: underline;
}

.compare-table .form-check {
 min-height: auto;
}

.compare-table .form-check-input {
 width: .9rem;
 height: .9rem;
 margin-top: .18rem;
}

.compare-table .form-check-label {
 font-size: .76rem;
 line-height: 1.2;
}

.compare-table textarea.form-control {
 min-height: 54px;
 font-size: .76rem;
 padding: .32rem .42rem;
}

.compare-table .compare-block-start > td {
 border-top: 2px solid #64748b;
}

.compare-table .compare-block-end > td {
 border-bottom: 2px solid #94a3b8;
}

.compare-table .compare-block-row > td:first-child {
 border-left: 3px solid #64748b;
}

.compare-table .compare-block-row > td:last-child {
 border-right: 1px solid #cbd5e1;
}

.compare-table .compare-block-even > td {
 background: #f8fafc;
}

.compare-table .compare-block-odd > td {
 background: #eef6ff;
}

.compare-table .compare-block-start.compare-block-even > td {
 background: #f1f5f9;
}

.compare-table .compare-block-start.compare-block-odd > td {
 background: #e0f2fe;
}

.compare-revision-badge {
 min-width: 1.8rem;
 border-radius: 6px;
 border: 1px solid transparent;
 color: #0f172a;
}

.compare-revision-a {
 background: #e2e8f0;
 border-color: #94a3b8;
}

.compare-revision-b {
 background: #dbeafe;
 border-color: #60a5fa;
}

.badge {
 border-radius: 999px;
 padding: .42em .68em;
 font-weight: 700;
}

.text-end .btn,
.text-end form {
 margin-left: .25rem;
}

.alert {
 border: 0;
 border-radius: var(--pde-radius);
 box-shadow: 0 8px 22px rgba(17, 24, 39, .05);
}

.bulk-action-overlay {
 position: fixed;
 inset: 0;
 z-index: 2000;
 display: flex;
 align-items: center;
 justify-content: center;
 background: rgba(17, 24, 39, .42);
 backdrop-filter: blur(3px);
}

.bulk-action-overlay[hidden] {
 display: none;
}

.bulk-action-panel {
 display: flex;
 align-items: center;
 gap: 1rem;
 min-width: min(92vw, 380px);
 padding: 1.25rem 1.35rem;
 border-radius: var(--pde-radius);
 background: #fff;
 box-shadow: 0 22px 60px rgba(17, 24, 39, .24);
}

.bulk-action-title {
 font-weight: 750;
 color: var(--pde-ink);
}

.bulk-action-text {
 color: var(--pde-muted);
 font-size: .9rem;
}

.metric-card {
 position: relative;
 min-height: 150px;
 border: 0;
}

.metric-card .metric {
 font-size: 1.9rem;
 font-weight: 800;
 letter-spacing: 0;
}

.metric-icon {
 width: 46px;
 height: 46px;
 display: inline-flex;
 align-items: center;
 justify-content: center;
 border-radius: var(--pde-radius);
 background: #eef2ff;
 color: var(--pde-primary);
 font-size: 1.35rem;
}

.metric-card.metric-teal .metric-icon {
 background: #ccfbf1;
 color: var(--pde-teal);
}

.metric-card.metric-amber .metric-icon {
 background: #fef3c7;
 color: var(--pde-amber);
}

.compare-kpi-grid {
 display: grid;
 gap: .5rem;
}

.compare-metric-card {
 min-height: 108px;
}

.compare-metric-card .card-body {
 padding: .9rem 1rem;
}

.compare-metric-card h5 {
 font-size: .95rem;
}

.compare-metric-card .metric {
 font-size: 1.45rem;
 line-height: 1.15;
}

.compare-metric-card .metric-icon {
 width: 34px;
 height: 34px;
 font-size: 1rem;
}

.compare-status-card {
 min-height: 76px;
 border: 1px solid rgba(229, 231, 235, .9);
 box-shadow: var(--pde-shadow);
}

.compare-status-card .card-body {
 padding: .65rem .85rem;
}

.compare-status-label {
 color: var(--pde-muted);
 font-size: .72rem;
 font-weight: 750;
 line-height: 1.1;
 text-transform: uppercase;
}

.compare-status-value {
 color: var(--pde-ink);
 font-size: 1.05rem;
 font-weight: 800;
 line-height: 1.15;
 margin-top: .2rem;
}

.compare-status-meta {
 color: var(--pde-muted);
 font-size: .75rem;
 margin-top: .15rem;
}

.compare-subnav {
 display: flex;
 flex-wrap: wrap;
 gap: .5rem;
}

.compare-line-km-card h2 {
 color: var(--pde-ink);
 font-weight: 800;
}

.compare-line-km-table {
 min-width: 560px;
}

.compare-line-km-table th {
 color: var(--pde-muted);
 font-size: .74rem;
 font-weight: 800;
 text-transform: uppercase;
}

.compare-line-km-table td {
 vertical-align: middle;
}

.compare-line-km-drill {
 color: var(--pde-primary);
 font-weight: 800;
 text-decoration: none;
}

.compare-line-km-drill:hover {
 text-decoration: underline;
}

.compare-line-km-total td {
 border-top: 2px solid rgba(15, 23, 42, .16);
 font-weight: 800;
}

.login-shell {
 min-height: 100vh;
 display: grid;
 place-items: center;
 padding: 2rem 1rem;
 background:
  linear-gradient(135deg, rgba(37, 99, 235, .12), transparent 32rem),
  linear-gradient(315deg, rgba(15, 118, 110, .12), transparent 28rem),
  var(--pde-bg);
}

.login-card {
 width: min(100%, 430px);
}

.login-logo {
 width: 48px;
 height: 48px;
 display: inline-flex;
 align-items: center;
 justify-content: center;
 border-radius: var(--pde-radius);
 color: #fff;
 background: linear-gradient(135deg, var(--pde-primary), var(--pde-teal));
 font-weight: 800;
}

@media (max-width: 767.98px) {
 .app-content-header,
 .app-content {
  padding-left: .8rem;
  padding-right: .8rem;
 }

 .table {
  min-width: 760px;
 }
}
