:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --line: #dfe6ef;
  --text: #1f2937;
  --muted: #6b7280;
  --primary: #1765d8;
  --primary-dark: #0f4fad;
  --secondary: #eef3f9;
  --danger: #c73636;
  --danger-dark: #a52323;
  --success: #177245;
  --warning: #bf7a06;
  --purple: #6d28d9;
  --shadow: 0 12px 30px rgba(17, 24, 39, 0.08);
  --shadow-soft: 0 8px 22px rgba(17, 24, 39, 0.05);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.hidden {
  display: none !important;
}
.mt-12 {
  margin-top: 12px;
}

.mt-14 {
  margin-top: 14px;
}

.mb-16 {
  margin-bottom: 16px;
}

.grid-span-full {
  grid-column: 1 / -1;
}
.muted {
  color: var(--muted);
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(23, 101, 216, 0.12), transparent 32%),
    radial-gradient(circle at bottom right, rgba(33, 150, 83, 0.10), transparent 30%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 460px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 0 0 8px;
}

.message {
  min-height: 20px;
  margin-top: 12px;
  color: var(--danger);
  font-weight: 700;
}

.login-help {
  margin-top: 18px;
  padding: 14px;
  border: 1px dashed #cbd5e1;
  border-radius: 14px;
  background: #fafcff;
  font-size: 14px;
  line-height: 1.7;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  min-height: 100vh;
}

.sidebar {
  padding: 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #f6f9fd 0%, #eef3f8 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.main-content {
  padding: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.soft-panel {
  background: #fafcff;
}

.panel-title {
  margin: 0;
  font-size: 20px;
}

.small-title {
  font-size: 16px;
}

.panel-row,
.dashboard-head-row,
.table-header,
.modal-header,
.modal-footer,
.btn-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wide-btn {
  width: 100%;
}

.small-btn {
  padding-inline: 12px;
}

.user-panel {
  padding: 12px 16px;
}

.current-user {
  line-height: 1.6;
  font-size: 14px;
}

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

.nav-btn {
  background: #f8fbff;
  border: 1px solid var(--line);
  text-align: left;
  font-weight: 700;
}

.nav-btn.active {
  background: #eaf2ff;
  border-color: #b9d3ff;
  color: #0f4fad;
}

.customer-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.customer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 380px;
  overflow-y: auto;
  margin-top: 14px;
}

.customer-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  transition: 0.15s ease;
  font-weight: 700;
}

.customer-item:hover {
  background: #f5f9ff;
  border-color: #b4ceef;
}

.customer-item.active {
  background: #eaf2ff;
  border-color: #91b8ea;
}

.search-box {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

.document-upload-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: flex-start;
}

.document-upload-main {
  flex: 1 1 340px;
  min-width: 280px;
}

.document-upload-preview {
  flex: 0 0 360px;
  width: 100%;
  max-width: 360px;
  margin-top: 0;
}

.document-upload-preview .doc-preview-img {
  width: 100%;
  max-width: 360px;
  max-height: 520px;
  object-fit: contain;
  border-radius: 12px;
}

.view-section {
  display: grid;
  gap: 16px;
}

.welcome-panel {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.summary-grid {
  display: grid;
  gap: 16px;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.exec-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

.summary-card {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  overflow: hidden;
}

.summary-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
  line-height: 1.2;
}

.summary-card strong {
  display: block;
  font-size: clamp(24px, 2.2vw, 38px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.customer-header-panel {
  display: grid;
  gap: 14px;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.alert-box {
  padding: 14px;
  border-radius: 12px;
  background: #fff5db;
  border: 1px solid #f1cf7a;
  color: #7a5200;
  font-weight: 700;
  line-height: 1.5;
}

.info-box {
  padding: 14px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #dce9fb;
  color: #254466;
  line-height: 1.5;
}

.contact-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fbfdff;
  margin-bottom: 10px;
}

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

.records-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

.records-table th,
.records-table td {
  padding: 12px 10px;
  border-bottom: 1px solid #e5ebf2;
  text-align: left;
  vertical-align: top;
}

.records-table th {
  background: #f8fafc;
  font-size: 13px;
  color: #475569;
}

.clickable {
  color: var(--primary);
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.status-pill,
.notice-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-paid {
  background: #e7f7ef;
  color: var(--success);
}

.status-partial {
  background: #fff5df;
  color: var(--warning);
}

.status-unpaid {
  background: #fdecec;
  color: var(--danger);
}

.notice-postdated {
  background: #efe6ff;
  color: var(--purple);
}

.notice-pending {
  background: #e8f5ff;
  color: #0d63af;
}

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

.btn,
input,
select {
  font: inherit;
}

.btn {
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

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

.btn-secondary {
  background: var(--secondary);
  color: var(--text);
}

.btn-secondary:hover,
.btn-light:hover,
.nav-btn:hover {
  background: #e9eff7;
}

.btn-light {
  background: #f4f7fb;
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-dark);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #ccd6e2;
  border-radius: 12px;
  padding: 8px 12px;
  background: #fff;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #90b6eb;
  box-shadow: 0 0 0 3px rgba(23, 101, 216, 0.1);
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid.one-col {
  grid-template-columns: 1fr;
}

.form-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: auto;
  min-height: auto;
}

textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid #ccd6e2;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
  outline: none;
  font: inherit;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1000;
}

.modal-content {
  width: 100%;
  max-width: 760px;
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 22px;
  padding: 18px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.24);
}

.medium-modal {
  max-width: 560px;
}

.large-modal {
  max-width: 1080px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  background: #f1f5f9;
  font-size: 28px;
  line-height: 1;
}

.line-items-labels,
.line-item {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) 100px 100px 100px 110px 44px;
  gap: 10px;
  align-items: center;
}

.line-product,
.line-qty,
.line-price,
.line-discount-per-qty {
  width: 100%;
  min-width: 0;
}

.line-total-box {
  width: 100%;
  min-width: 0;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
  border: 1px solid #d6e0ec;
  border-radius: 12px;
  background: #f8fbff;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.delete-line-btn {
  width: 40px;
  height: 40px;
  justify-self: end;
  margin: 0;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: #feecec;
  color: #c73636;
  font-size: 20px;
  line-height: 1;
}

@media (max-width: 980px) {
  .line-items-labels,
  .line-item {
    grid-template-columns: minmax(0, 1.2fr) 90px 90px 90px 100px 40px;
  }
}

@media (max-width: 700px) {
  .line-items-labels {
    display: none;
  }

  .line-item {
    grid-template-columns: 1fr;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfdff;
  }

  .line-total-box,
  .delete-line-btn {
    width: 100%;
    justify-self: stretch;
  }
}

.delete-line-btn {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  background: #feecec;
  color: var(--danger);
  font-size: 20px;
}

.total-box {
  font-size: 18px;
  font-weight: 700;
}

.selection-list {
  display: grid;
  gap: 10px;
}

.selection-item {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbfdff;
}

.selection-item small {
  color: var(--muted);
  display: block;
  margin-top: 4px;
}

.payment-choice-grid {
  display: grid;
  gap: 14px;
}

.payment-choice-btn {
  border: 1px solid #d6e2ef;
  border-radius: 16px;
  padding: 18px;
  background: #fbfdff;
  cursor: pointer;
  text-align: left;
}

.payment-choice-btn:hover {
  background: #f2f8ff;
  border-color: #a8c7ef;
}

.payment-choice-btn strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.invoice-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.invoice-meta-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fafcff;
}

.invoice-meta-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 4px;
}

.aky-brand {
  display: flex;
  justify-content: flex-start;
}

.login-brand {
  justify-content: center;
  margin-bottom: 16px;
}
.report-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-actions {
  margin-top: 14px;
}
#reportsView .report-table-scroll {
  max-height: min(420px, 65vh);
  overflow: auto;
  border-radius: 14px;
}

#reportsView .report-table-scroll .records-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
}
/* EXECUTIVE VIEW IMPROVEMENTS */
.exec-filters {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
}

.exec-filters input {
  min-width: 180px;
  max-width: 220px;
}

.exec-grid .summary-card {
  min-height: 126px;
  padding: 18px;
  position: relative;
  isolation: isolate;
}

.exec-grid .summary-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.exec-grid .summary-label {
  font-size: 13px;
  margin-bottom: 2px;
}

.exec-grid .summary-card strong {
  font-size: clamp(22px, 1.9vw, 34px);
  line-height: 1.02;
  letter-spacing: -0.045em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

#executiveView .panel:first-child {
  padding: 20px;
}

#executiveView .panel:first-child .panel-row {
  align-items: flex-start;
}

#executiveView .panel:first-child .panel-title {
  margin-bottom: 6px;
}

#executiveView .muted {
  font-size: 15px;
}

#executiveView .records-table th,
#executiveView .records-table td {
  white-space: nowrap;
}

#executiveView .table-wrap {
  border-radius: 14px;
  overflow: auto;
}

#executiveView .records-table {
  min-width: 920px;
}

@media (max-width: 1350px) {
  .exec-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .exec-grid .summary-card strong {
    font-size: clamp(24px, 2vw, 34px);
  }
}

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

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

  .exec-filters {
    justify-content: flex-start;
  }

  .exec-filters input {
    min-width: 160px;
    max-width: 100%;
  }
}

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

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .form-grid.two-col {
    grid-template-columns: 1fr;
  }

  .line-items-labels,
  .line-item {
    grid-template-columns: 1.3fr 100px 120px 120px 44px;
  }

  .exec-layout {
    grid-template-columns: 1fr;
  }

  .report-grid {
    grid-template-columns: 1fr;
  }

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

  .exec-filters {
    width: 100%;
  }

  .exec-filters input,
  .exec-filters button {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 700px) {
  .summary-grid,
  .exec-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-head-row,
  .modal-footer,
  .panel-row {
    flex-direction: column;
    align-items: stretch;
  }

  .dashboard-actions {
    flex-direction: column;
  }

  .invoice-meta-grid {
    grid-template-columns: 1fr;
  }
.hidden-slot {
  visibility: hidden;
  pointer-events: none;
}

.line-items-labels,
.line-item {
  display: grid;
  grid-template-columns: 2fr 110px 140px 140px 150px 54px;
  gap: 10px;
  align-items: center;
}

@media (max-width: 980px) {
  .line-items-labels,
  .line-item {
    grid-template-columns: 1.2fr 90px 110px 110px 120px 44px;
  }
}

@media (max-width: 700px) {
  .line-items-labels {
    display: none;
  }

  .line-item {
    grid-template-columns: 1fr;
  }

  .hidden-slot {
    visibility: visible;
    pointer-events: auto;
  }
}
  .line-items-labels {
    display: none;
  }

  .line-item {
    grid-template-columns: 1fr;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fbfdff;
  }

  .line-total-box,
  .delete-line-btn {
    width: 100%;
  }

  .summary-card strong,
  .exec-grid .summary-card strong {
    font-size: clamp(22px, 8vw, 30px);
  }

  #executiveView .panel:first-child .panel-row {
    align-items: stretch;
  }

  .exec-filters {
    flex-direction: column;
    align-items: stretch;
  }
}
/* ===== PASS 1 UI IMPROVEMENTS ===== */

.customer-search-box {
  margin-top: 14px;
  margin-bottom: 14px;
}
.customer-item-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.customer-discount-star {
  color: #c08a00;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
}

.discount-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #fff6d8;
  color: #8a5b00;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid #efd28a;
}
.search-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.customer-table-scroll {
  max-height: 360px;
  overflow: auto;
  border-radius: 14px;
}

.notifications-table-scroll {
  max-height: 300px;
  overflow: auto;
  border-radius: 14px;
}

.customer-table-scroll .records-table thead th,
.notifications-table-scroll .records-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
}

.customer-contacts-layout {
  width: 100%;
}

.contacts-split {
  display: grid;
  grid-template-columns: 1.1fr 1.4fr;
  gap: 16px;
}

.contact-column {
  display: grid;
  gap: 12px;
}

.contact-column-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.primary-contact-card {
  min-height: 100%;
}

@media (max-width: 1100px) {
  .contacts-split {
    grid-template-columns: 1fr;
  }

  .contact-grid {
    grid-template-columns: 1fr;
  }
}
.aky-logo-img {
  display: block;
  width: 180px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.login-brand .aky-logo-img {
  width: 220px;
}
.aky-logo-img {
  display: block;
  width: 180px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.login-brand .aky-logo-img {
  width: 220px;
}
.doc-upload-btn {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.doc-paste-zone {
  margin-top: 12px;
  min-height: 78px;
  border: 2px dashed #c7d2fe;
  border-radius: 12px;
  padding: 16px;
  background: #f8fbff;
  color: #4b5563;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  outline: none;
}

.doc-paste-zone:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 101, 216, 0.12);
}

.doc-preview-wrap {
  margin-top: 12px;
}

.doc-preview-img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-soft);
}

.doc-action-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.doc-status-error {
  color: #c73636;
}

.doc-status-success {
  color: #166534;
}
