.page-heading {
  margin-bottom: 14px;
}

.page-title {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 800;
  color: #173956;
}

.page-subtitle {
  margin: 4px 0 0;
  color: #5f7592;
  font-size: 0.92rem;
}

.panel-breadcrumb {
  margin-bottom: 6px;
  font-size: 0.84rem;
}

.panel-breadcrumb .breadcrumb-item + .breadcrumb-item::before {
  color: #9aacbf;
}

.panel-breadcrumb a {
  color: #0f6d63;
  text-decoration: none;
}

.panel-breadcrumb a:hover {
  text-decoration: underline;
}

.metric-card[data-tone="total"] .metric-icon {
  background: linear-gradient(135deg, #f97316, #ef4444);
}

.metric-card[data-tone="pending"] .metric-icon {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.metric-card[data-tone="accepted"] .metric-icon {
  background: linear-gradient(135deg, #0ea5e9, #0369a1);
}

.metric-card[data-tone="processing"] .metric-icon {
  background: linear-gradient(135deg, #0ea5e9, #0369a1);
}

.metric-card[data-tone="completed"] .metric-icon {
  background: linear-gradient(135deg, #10b981, #0f766e);
}

.metric-card[data-tone="canceled"] .metric-icon {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.record-count {
  color: #4f6783;
  font-size: 0.9rem;
  font-weight: 600;
}

.filter-form .form-label {
  font-size: 0.82rem;
  color: #4f6783;
  font-weight: 700;
  margin-bottom: 6px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 10px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.order-table thead th {
  font-size: 0.8rem;
}

.order-table tbody td {
  white-space: normal;
  vertical-align: middle;
}

.customer-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.customer-block strong {
  font-size: 0.9rem;
  color: #173956;
}

.customer-block span {
  font-size: 0.84rem;
  color: #5f7592;
}

.service-text {
  font-size: 0.9rem;
  color: #28405d;
  min-width: 165px;
}

.panel-foot {
  border-top: 1px solid #e4ebf3;
  padding: 12px 16px;
}

.empty-hint {
  margin: 0;
  color: #6f8298;
  font-size: 0.86rem;
}

.order-detail-shell {
  display: grid;
  gap: 14px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 1fr));
  gap: 14px;
}

.detail-card {
  border: 1px solid #dce6f2;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(23, 43, 77, 0.05);
  overflow: hidden;
}

.detail-card-head {
  padding: 12px 14px;
  border-bottom: 1px solid #e4ebf3;
  background: #f6fafc;
}

.detail-card-head h3 {
  margin: 0;
  font-size: 1rem;
  color: #0f6d63;
  font-weight: 700;
}

.detail-card-body {
  padding: 14px;
}

.detail-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
}

.detail-field {
  display: grid;
  gap: 4px;
}

.detail-field span {
  font-size: 0.8rem;
  color: #6f8298;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-field b {
  font-size: 0.93rem;
  color: #1f2f46;
  font-weight: 700;
}

.detail-field-full {
  grid-column: 1 / -1;
}

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.timeline-item {
  border: 1px solid #dce6f2;
  border-radius: 12px;
  padding: 10px 12px;
  background: #f8fbfe;
}

.timeline-date {
  display: block;
  font-size: 0.79rem;
  color: #6f8298;
  margin-bottom: 4px;
}

.timeline-item strong {
  display: block;
  color: #173956;
  font-size: 0.92rem;
  margin-bottom: 2px;
}

.timeline-item p {
  margin: 0;
  color: #4f6783;
  font-size: 0.85rem;
}

.summary-list {
  display: grid;
  gap: 8px;
}

.summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #28405d;
  font-size: 0.9rem;
}

.summary-row.total {
  border-top: 1px dashed #cfdceb;
  margin-top: 4px;
  padding-top: 10px;
  color: #0f6d63;
  font-weight: 800;
  font-size: 1rem;
}

.not-found {
  text-align: center;
  padding: 24px 16px;
}

.not-found i {
  font-size: 2rem;
  color: #ef4444;
  margin-bottom: 8px;
}

.not-found h3 {
  margin: 0;
  color: #1f2f46;
  font-size: 1.2rem;
}

.not-found p {
  margin: 8px 0 0;
  color: #5f7592;
}

.btn-view-detail {
  white-space: nowrap;
}

.invoice-hero {
  border: 1px solid #65a7db;
  border-radius: 16px;
  padding: 14px;
  background: linear-gradient(to right, #5b86e5, #36d1dc);
  color: #f4f9ff;
  box-shadow: 0 16px 30px rgba(19, 64, 126, 0.24);
}

.invoice-hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.invoice-code-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.invoice-code {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1.05;
}

.invoice-service {
  margin: 6px 0 0;
  font-size: 1rem;
  color: #e9f4ff;
  font-weight: 600;
}

.invoice-service-meta {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 6px 18px;
}

.invoice-service-meta-col {
  display: grid;
  gap: 2px;
}

.invoice-service-meta-col-dates {
  border-left: 1px solid rgba(255, 255, 255, 0.28);
  padding-left: 12px;
}

.invoice-service-meta-item {
  margin: 0;
  font-size: 0.82rem;
  color: #dcefff;
  font-weight: 600;
}

.invoice-service-meta-item strong {
  color: #ffffff;
  font-weight: 800;
}

.invoice-status-chip {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 0.73rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: rgba(11, 27, 56, 0.28);
  color: #fff;
}

.invoice-status-chip.is-pending {
  background: rgba(162, 98, 10, 0.4);
}

.invoice-status-chip.is-processing {
  background: rgba(3, 105, 161, 0.4);
}

.invoice-status-chip.is-accepted {
  background: rgba(2, 132, 199, 0.42);
}

.invoice-status-chip.is-completed {
  background: rgba(6, 95, 70, 0.45);
}

.invoice-status-chip.is-canceled {
  background: rgba(153, 27, 27, 0.45);
}

.hero-progress {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hero-progress-ring {
  --progress: 0;
  width: 98px;
  height: 98px;
  border-radius: 50%;
  background: conic-gradient(
    #effaff calc(var(--progress) * 1%),
    rgba(255, 255, 255, 0.2) 0
  );
  display: grid;
  place-items: center;
  position: relative;
}

.hero-progress-ring::before {
  content: "";
  width: 75px;
  height: 75px;
  border-radius: 50%;
  position: absolute;
  background: rgba(13, 44, 78, 0.6);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.hero-progress-content {
  position: relative;
  z-index: 1;
  text-align: center;
}

.hero-progress-content strong {
  display: block;
  font-size: 1.45rem;
  line-height: 1;
  font-weight: 800;
}

.hero-progress-content small {
  display: block;
  font-size: 0.62rem;
  color: #e6f4ff;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.invoice-hero-kpis {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 10px;
}

.hero-kpi {
  background: rgba(10, 48, 87, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 12px;
  padding: 10px 12px;
}

.hero-kpi-label {
  margin: 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #cce8ff;
  font-weight: 700;
}

.hero-kpi-value {
  margin: 4px 0 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.15;
}

.hero-kpi-sub {
  margin: 3px 0 0;
  font-size: 0.79rem;
  color: #d9ecff;
  font-weight: 600;
}

.invoice-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.invoice-panel {
  border: 1px solid #d4e4f2;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.invoice-panel-head {
  background: #f3f8fd;
  border-bottom: 1px solid #d9e7f4;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.invoice-panel-title {
  margin: 0;
  color: #183652;
  font-size: 1.12rem;
  font-weight: 800;
}

.panel-chip {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  background: #e9f8ef;
  color: #18794e;
}

.panel-chip.warn {
  background: #fff4dd;
  color: #9a6505;
}

.invoice-panel-body {
  padding: 10px;
}

.task-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 6px;
}

.task-item {
  border: 1px solid #d9e7f4;
  border-radius: 9px;
  background: #f7fbff;
  padding: 7px 9px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.task-index {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #10b981;
  color: #fff;
  font-size: 0.72rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  flex: 0 0 auto;
  margin-top: 1px;
}

.task-text {
  margin: 0;
  font-size: 0.83rem;
  color: #1e3851;
  font-weight: 600;
}

.task-note-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.task-note-box {
  border: 1px solid #d8e6f3;
  border-radius: 8px;
  background: #f5f9fd;
  padding: 8px 9px;
}

.task-note-box p {
  margin: 0;
}

.task-note-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #637f9e;
  font-weight: 700;
}

.task-note-value {
  margin-top: 4px;
  font-size: 0.83rem;
  color: #243f5c;
  font-weight: 600;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: #486581;
  font-weight: 700;
}

.progress-track {
  margin-top: 6px;
  height: 9px;
  border-radius: 99px;
  background: #e7eff7;
  overflow: hidden;
}

.progress-fill {
  width: 0;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
}

.timeline-note {
  margin: 8px 0 0;
  font-size: 0.8rem;
  color: #6c83a0;
}

.status-line {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 0.84rem;
  color: #2f4762;
}

.status-line b {
  color: #b42318;
  font-size: 0.86rem;
}

.time-grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.time-box {
  border: 1px solid #d9e7f4;
  border-radius: 9px;
  background: #f9fcff;
  padding: 8px;
}

.time-box h4 {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #4a6582;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.time-item {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.time-item:last-child {
  margin-bottom: 0;
}

.time-item span {
  color: #5e7897;
  font-weight: 700;
}

.time-item b {
  color: #1e3851;
}

.day-note {
  margin-top: 8px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  color: #3e5672;
  border-top: 1px dashed #cad9e7;
  padding-top: 8px;
}

.identity-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.identity-card {
  border: 1px solid #d4e4f2;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.identity-head {
  border-bottom: 1px solid #d9e7f4;
  background: #f3f8fd;
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.identity-head h3 {
  margin: 0;
  font-size: 1.03rem;
  color: #183652;
  font-weight: 800;
}

.identity-body {
  padding: 12px;
}

.identity-main {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.avatar-badge {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  border: 2px solid #d7e6f3;
  background: linear-gradient(135deg, #f6e8cf, #cddff5);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #1e3851;
  font-size: 1rem;
  font-weight: 800;
  flex: 0 0 auto;
}

.avatar-badge.has-image {
  padding: 0;
  overflow: hidden;
  background: #dce8f3;
}

.avatar-badge .avatar-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.identity-name {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1;
  color: #173956;
  font-weight: 800;
}

.identity-contacts {
  margin: 6px 0 0;
  display: grid;
  gap: 3px;
}

.identity-contacts p {
  margin: 0;
  color: #2f4762;
  font-size: 0.84rem;
  font-weight: 600;
}

.identity-contacts i {
  width: 14px;
  color: #6b86a4;
  margin-right: 4px;
}

.identity-meta {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.identity-pill {
  background: #eff5fb;
  color: #4f6783;
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 0.76rem;
  font-weight: 700;
}

.review-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.review-card {
  border: 1px solid #d9e7f4;
  border-radius: 10px;
  overflow: hidden;
  background: #f9fcff;
}

.review-card-head {
  padding: 8px 9px;
  border-bottom: 1px solid #d9e7f4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.review-card-head h4 {
  margin: 0;
  font-size: 0.88rem;
  color: #1f3c58;
  font-weight: 800;
}

.review-card-body {
  padding: 9px;
}

.review-label {
  margin: 0;
  font-size: 0.71rem;
  text-transform: uppercase;
  color: #617c99;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.review-value {
  margin: 3px 0 7px;
  font-size: 0.84rem;
  color: #26415f;
  font-weight: 600;
}

.review-file {
  border: 1px solid #d9e7f4;
  border-radius: 7px;
  background: #edf4fb;
  color: #4f6783;
  font-size: 0.77rem;
  padding: 5px 7px;
  font-weight: 600;
}

.review-file.review-file-media {
  background: #f3f8ff;
}

.review-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
}

.review-media-item {
  display: block;
  border: 1px solid #d9e7f4;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.review-media-preview {
  width: 100%;
  height: 90px;
  object-fit: cover;
  display: block;
  background: #e9f1fb;
}

.review-editor {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.review-editor-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.review-editor-note {
  color: #617c99;
  font-size: 0.74rem;
}

.nav-item:focus-visible,
.logout-link:focus-visible,
.btn:focus-visible,
.logout-link:focus-visible,
.btn:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 2px;
}

/* ============================================================ 
   RESPONSIVE DESIGN SYSTEM (ULTIMATE FIX - ADAPTED FOR PANEL)
   ============================================================ */

/* --- Tablet & Small Desktop (Up to 991px) --- */
@media (max-width: 991.98px) {
  .filter-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .detail-grid,
  .detail-fields {
    grid-template-columns: 1fr;
  }

  .invoice-main-grid,
  .identity-grid,
  .review-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
  .invoice-hero-kpis {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Mobile (The Big Fix) --- */
@media (max-width: 767px) {
  .admin-shell {
    overflow-x: hidden;
  }

  .content-shell {
    padding: 0;
  }

  /* Adjust Page Heading on Mobile */
  .page-heading {
    padding: 10px 15px;
    text-align: center;
    justify-content: center !important;
  }
  .page-title {
    font-size: 1.2rem;
  }
  .page-heading .btn {
    width: 100%;
    margin-top: 5px;
  }

  /* Invoice Hero Mobile */
  .invoice-hero {
    margin: 0;
    border-radius: 0;
    border: none;
    padding: 25px 15px;
    width: 100%;
    text-align: center;
  }

  .invoice-code-line {
    justify-content: center;
    margin-bottom: 5px;
  }
  .invoice-code {
    font-size: 1.4rem;
  }
  .invoice-service {
    font-size: 1.1rem;
    margin-bottom: 15px;
  }

  /* Meta Data Mobile */
  .invoice-service-meta {
    grid-template-columns: 1fr;
    gap: 5px;
    background: rgba(0, 0, 0, 0.15);
    padding: 12px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: left;
  }
  .invoice-service-meta-col-dates {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 0 0;
    margin-top: 8px;
  }

  .invoice-hero-top {
    flex-direction: column;
    align-items: normal;
    gap: 12px;
}

  /* Buttons & Progress Ring Mobile */
  .hero-progress {
    width: 100%;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 10px;
  }
  .hero-progress-ring {
    width: 105px;
    height: 105px;
    margin: 0 auto;
  }

  /* KPI Rows Mobile */
  .invoice-hero-kpis {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 25px;
  }
  .hero-kpi {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
  }
  .hero-kpi-label {
    font-size: 0.72rem;
    white-space: nowrap;
  }
  .hero-kpi-value {
    font-size: 1.15rem;
    font-weight: 800;
    margin: 0;
    max-width: 65%;
    text-align: right;
  }
  .hero-kpi-sub {
    display: none;
  }

  /* Identity Cards Mobile */
  .identity-main {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .identity-name {
    font-size: 1.3rem;
    margin-top: 10px;
  }
  .identity-contacts {
    align-items: center;
  }

  .invoice-panel,
  .identity-card {
    border-radius: 0;
    border-left: none;
    border-right: none;
    margin: 0 0 15px;
  }
  
  /* Order Table Card Transform */
  .order-table, 
  .order-table thead, 
  .order-table tbody, 
  .order-table th, 
  .order-table td, 
  .order-table tr { 
    display: block; 
  }

  .order-table thead tr { 
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  .order-table tr {
    border: 1px solid #e2e8f0;
    margin-bottom: 15px;
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  }

  .order-table td { 
    border: none;
    border-bottom: 1px solid #f1f5f9; 
    position: relative;
    padding-left: 45% !important; 
    text-align: right;
    min-height: 45px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    font-size: 0.88rem;
  }

  /* Restore labels for all cells */
  .order-table td:before { 
    content: attr(data-label);
    position: absolute;
    left: 15px;
    width: 40%; 
    padding-right: 10px; 
    white-space: nowrap;
    text-align: left;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
  }

  .order-table td:last-child {
    border-bottom: none;
    background: #f8fafc;
    justify-content: center;
    padding: 15px !important; 
    display: flex;
    flex-direction: column; 
    gap: 8px; 
  }

  .order-table td:last-child:before {
    display: none; 
  }

  .order-table td:last-child .btn,
  .order-table td:last-child .d-flex {
    width: 100% !important; 
    justify-content: center;
    flex-wrap: wrap;
  }

  .customer-block {
    align-items: flex-end;
  }

  .service-text {
    min-width: unset;
  }

  .panel-foot {
    display: grid;
    gap: 10px;
  }
}

/* Interactive Enhancements */
.invoice-panel,
.identity-card,
.invoice-hero,
.detail-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

@media (min-width: 992px) {
  .invoice-panel:hover,
  .identity-card:hover,
  .detail-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.08);
  }
}
