:root {
  --navy: #073f62;
  --navy-dark: #062f4a;
  --navy-deep: #052740;
  --blue: #10a5df;
  --panel: #ffffff;
  --bg: #f2f4f6;
  --text: #1f2937;
  --muted: #687789;
  --line: #d9e0e7;
  --gold: #d7b437;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  margin: 0;
}

a {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.admin-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  background: #073f62;
  color: #ffffff;
  flex: 0 0 197px;
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
  position: sticky;
  top: 0;
}

.sidebar-brand {
  align-items: center;
  background: #062f4a;
  display: flex;
  justify-content: center;
  min-height: 78px;
  padding: 8px 12px;
}

.sidebar-logo {
  display: block;
  height: auto;
  max-height: 60px;
  max-width: 100%;
  object-fit: contain;
}

.sidebar-nav {
  display: grid;
  max-height: calc(100vh - 148px);
  overflow-y: auto;
  padding: 0;
  scrollbar-width: thin;
}

.nav-link {
  align-items: center;
  color: #ffffff;
  display: grid;
  gap: 10px;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  min-height: 31px;
  padding: 6px 13px;
}

.nav-link:hover,
.nav-link.is-active {
  background: #1aa9da;
  color: #ffffff;
}

.nav-icon {
  align-items: center;
  display: inline-flex;
  font-size: 12px;
  font-weight: 900;
  height: 18px;
  justify-content: center;
  width: 18px;
}

.nav-link > span:nth-child(2) {
  font-size: 13px;
  font-weight: 900;
  line-height: 1.05;
}

.nav-count {
  border-radius: 999px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  line-height: 1;
  min-width: 20px;
  padding: 4px 6px;
  text-align: center;
}

.count-red {
  background: #dc2626;
}

.count-gold {
  background: #f59e0b;
}

.count-green {
  background: #22c55e;
}

.sidebar-footer {
  bottom: 0;
  background: #073f62;
  display: grid;
  gap: 6px;
  padding: 10px 12px 12px;
  position: absolute;
  width: 100%;
}

.sidebar-footer span,
.sidebar-footer a:first-child {
  color: rgba(255, 255, 255, 0.76);
  font-weight: 700;
}

.sidebar-footer a {
  color: #ffffff;
}

.mobile-only {
  display: none;
}

.main-area {
  flex: 1;
  min-width: 0;
}

.utilitybar {
  align-items: center;
  background: linear-gradient(#4f4f4f, #1f1f1f);
  color: #ffffff;
  display: flex;
  height: 24px;
  justify-content: space-between;
  padding: 0 12px;
}

.search-form {
  align-items: center;
  display: flex;
  gap: 6px;
  margin: 0 auto;
}

.search-form label {
  font-size: 11px;
  font-weight: 800;
}

.search-form input {
  background: transparent;
  border: 0;
  color: #ffffff;
  font: inherit;
  height: 20px;
  width: 120px;
}

.search-form input::placeholder {
  color: #ffffff;
}

.utility-actions {
  align-items: center;
  display: flex;
  font-size: 11px;
  gap: 10px;
  margin-left: auto;
}

.topbar {
  align-items: center;
  background: #f7f7f7;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
}

.date-filter,
.dashboard-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.topbar label {
  color: #1f2a37;
  font-size: 11px;
  font-weight: 800;
}

.topbar select,
.dashboard-tools button {
  background: #ffffff;
  border: 1px solid #cfd7df;
  border-radius: 2px;
  color: #2c3846;
  font: inherit;
  height: 26px;
}

.dashboard-tools button {
  cursor: pointer;
  font-weight: 900;
  width: 26px;
}

.dashboard {
  max-width: 980px;
  padding: 10px 18px 34px;
}

.stats-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(130px, 1fr));
  margin-bottom: 10px;
}

.stat-card {
  background: var(--navy) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  color: #ffffff !important;
  min-height: 74px;
  padding: 8px 10px 12px;
}

.stat-card div {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.stat-card span,
.stat-card a {
  font-size: 11px;
  font-weight: 800;
}

.stat-card a {
  color: #bfe7fb;
}

.stat-card strong {
  color: #a8d4df;
  display: block;
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  margin-top: 18px;
  text-align: center;
}

.panel-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
}

.panel {
  background: var(--panel);
  border-radius: 0 !important;
  border: 1px solid #cfd7df;
  box-shadow: none !important;
  overflow: hidden;
}

.panel-heading {
  align-items: center;
  background: var(--navy) !important;
  color: #ffffff !important;
  display: flex;
  justify-content: space-between;
  min-height: 22px;
  padding: 4px 8px;
}

.panel-heading h2 {
  font-size: 12px;
  margin: 0;
}

.panel-heading a {
  color: #bfe7fb;
  font-size: 11px;
}

.chart-panel {
  min-height: 190px;
}

.bar-chart {
  align-items: end;
  display: grid !important;
  gap: 22px;
  grid-template-columns: repeat(4, 1fr);
  min-height: 160px;
  padding: 18px 20px 12px;
}

.bar-item {
  align-items: center;
  display: grid !important;
  gap: 6px;
  grid-template-rows: 1fr auto auto;
  height: 128px;
}

.bar-item::before {
  align-self: end;
  background: var(--navy);
  content: "";
  display: block !important;
  height: var(--value);
  width: 100%;
}

.bar-item span,
.bar-item strong {
  color: #536273;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}

.horizontal-bars {
  display: grid !important;
  gap: 14px;
  padding: 26px 20px 20px;
}

.hbar {
  align-items: center;
  display: grid !important;
  gap: 10px;
  grid-template-columns: 110px 1fr 28px;
}

.hbar::before {
  background: var(--navy);
  content: "";
  display: block !important;
  grid-column: 2;
  height: 26px;
  width: var(--value);
}

.hbar span {
  color: #667085;
  font-size: 11px;
  grid-column: 1;
  grid-row: 1;
}

.hbar strong {
  color: #667085;
  font-size: 11px;
  grid-column: 3;
  grid-row: 1;
}

.compact-chart {
  min-height: 180px;
}

.donut-wrap {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: center;
  min-height: 150px;
}

.donut {
  background: conic-gradient(#285d91 0 50%, #b8dcf2 50% 100%);
  border-radius: 50%;
  height: 100px;
  position: relative;
  width: 100px;
}

.donut::after {
  background: #ffffff;
  border-radius: 50%;
  content: "";
  inset: 28px;
  position: absolute;
}

.donut-alt {
  background: conic-gradient(#285d91 0 28%, #6aa8d3 28% 76%, #d5edf9 76% 100%);
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid #e5e9ee;
  padding: 9px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f7f9fb;
  color: #59677b;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  font-size: 12px;
}

td a {
  color: var(--navy);
}

.badge {
  background: #e8f5fb;
  border-radius: 999px;
  color: var(--navy);
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 9px;
  text-transform: capitalize;
}

.empty {
  color: var(--muted);
  text-align: center;
}

.notice {
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  color: #166534;
  font-weight: 800;
  margin-bottom: 10px;
  padding: 10px 12px;
}

.notice a {
  color: #073f62;
  text-decoration: underline;
}

.form-panel {
  margin-bottom: 10px;
}

.collapsible-form {
  border: 0;
}

.collapsible-form summary {
  background: var(--navy);
  color: #ffffff;
  cursor: pointer;
  display: block;
  font-size: 13px;
  font-weight: 900;
  list-style: none;
  padding: 10px 12px;
  text-align: center;
}

.collapsible-form summary::-webkit-details-marker {
  display: none;
}

.collapsible-form[open] summary {
  background: #1aa9da;
  text-align: left;
}

.admin-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
}

.admin-form label {
  color: var(--navy-deep);
  display: grid;
  font-size: 12px;
  font-weight: 800;
  gap: 5px;
}

.admin-form input,
.admin-form select,
.admin-form textarea {
  border: 1px solid #cfd7df;
  border-radius: 2px;
  font: inherit;
  min-height: 30px;
  padding: 6px 8px;
}

.admin-form textarea {
  resize: vertical;
}

.admin-form .span-2 {
  grid-column: 1 / -1;
}

.form-section-title {
  border-bottom: 1px solid #d9e0e7;
  color: var(--navy);
  font-size: 12px;
  grid-column: 1 / -1;
  margin: 4px 0 0;
  padding-bottom: 6px;
  text-transform: uppercase;
}

.admin-form button {
  background: var(--navy);
  border: 0;
  color: #ffffff;
  cursor: pointer;
  font-weight: 900;
  min-height: 32px;
  padding: 8px 12px;
}

.status-pill {
  border-radius: 999px;
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  padding: 4px 9px;
}

.row-actions {
  white-space: nowrap;
}

.row-actions a,
.tool-link {
  background: var(--navy);
  color: #ffffff;
  display: inline-block;
  font-size: 11px;
  font-weight: 900;
  margin-right: 5px;
  padding: 6px 9px;
}

.detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 14px;
}

.detail-grid div {
  border-bottom: 1px solid #e5e9ee;
  padding-bottom: 10px;
}

.detail-grid span {
  color: var(--muted);
  display: block;
  font-size: 11px;
  font-weight: 900;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.detail-grid strong,
.detail-grid p {
  color: var(--navy-deep);
  font-size: 14px;
  font-weight: 800;
  margin: 0;
}

.detail-grid .span-2 {
  grid-column: 1 / -1;
}

.inline-status-form {
  align-items: center;
  display: flex;
  gap: 6px;
}

.inline-status-form select,
.inline-status-form button {
  border: 1px solid #cfd7df;
  border-radius: 2px;
  font: inherit;
  height: 26px;
}

.inline-status-form button {
  background: var(--navy);
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  padding: 0 9px;
}

.inline-status-form .status-save {
  border: 0;
  min-width: 78px;
}

.status-new {
  background: #dc2626 !important;
  color: #ffffff !important;
}

.status-contacted {
  background: #0ea5e9 !important;
  color: #ffffff !important;
}

.status-closed {
  background: #16a34a !important;
  color: #ffffff !important;
}

.status-pending {
  background: #f59e0b !important;
  color: #111827 !important;
}

.status-unpaid,
.status-overdue {
  background: #dc2626 !important;
  color: #ffffff !important;
}

.status-partial {
  background: #f59e0b !important;
  color: #111827 !important;
}

.status-paid {
  background: #16a34a !important;
  color: #ffffff !important;
}

.status-confirmed {
  background: #16a34a !important;
  color: #ffffff !important;
}

.status-cancelled {
  background: #6b7280 !important;
  color: #ffffff !important;
}

.status-active,
.status-open,
.status-scheduled {
  background: #16a34a !important;
  color: #ffffff !important;
}

.status-inactive,
.status-completed {
  background: #6b7280 !important;
  color: #ffffff !important;
}

.login-page {
  align-items: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-dark));
  display: flex;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: 0 12px 35px rgba(10, 37, 64, 0.12);
  margin: 0 auto;
  max-width: 420px;
  padding: 34px;
  width: 100%;
}

.login-card h1 {
  color: var(--navy);
  margin: 0 0 8px;
}

.login-card p {
  color: var(--muted);
  margin: 0 0 24px;
}

.form {
  display: grid;
  gap: 16px;
}

.form label {
  color: var(--navy);
  display: grid;
  font-size: 14px;
  font-weight: 800;
  gap: 8px;
}

.form input {
  border: 1px solid var(--line);
  border-radius: 4px;
  font: inherit;
  padding: 12px 14px;
}

.form input:focus {
  border-color: var(--blue);
  outline: 3px solid rgba(16, 165, 223, 0.18);
}

.form button {
  background: var(--blue);
  border: 0;
  border-radius: 4px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  padding: 11px 16px;
}

.alert {
  background: #fff2f2;
  border: 1px solid #ffd0d0;
  border-radius: 4px;
  color: #9f1d1d;
  margin-bottom: 18px;
  padding: 12px 14px;
}

@media (max-width: 900px) {
  .admin-shell {
    display: block;
  }

  .sidebar {
    min-height: 0;
    position: static;
  }

  .sidebar-nav {
    display: flex;
    overflow-x: auto;
  }

  .nav-link {
    flex: 0 0 auto;
  }

  .sidebar-footer {
    display: none;
  }

  .mobile-only {
    display: grid;
  }

  .dashboard {
    max-width: none;
  }
}

@media (max-width: 680px) {
  .utilitybar,
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    height: auto;
    gap: 8px;
    padding: 10px;
  }

  .stats-grid,
  .panel-grid,
  .admin-form,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .admin-form .span-2,
  .detail-grid .span-2 {
    grid-column: auto;
  }

  .dashboard {
    padding: 10px;
  }
}
