:root {
  --surface: rgba(255, 255, 255, 0.78);
  --line: rgba(15, 23, 42, 0.09);
  --text: #172033;
  --muted: #62708b;
  --primary: #2563eb; /* blue */
  --primary-deep: #1d4ed8; /* deeper blue */
  --accent-orange: #f59e0b;
  --accent-red: #ef4444;
  --success: #0f9f67;
  --shadow: 0 24px 60px rgba(19, 31, 56, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", sans-serif;
  background:
    url('/images/background.png') center/cover no-repeat fixed,
    linear-gradient(180deg, #f8fafc 0%, #edf2f8 100%);
  color: var(--text);
  overflow-x: hidden;
}

body[data-page="login"] {
  height: 100vh;
  overflow: hidden;
}

button, input, select, textarea { font: inherit; }

.background-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(10px);
  pointer-events: none;
}

.orb-one { top: 40px; left: 30px; width: 220px; height: 220px; background: rgba(242, 185, 93, 0.2); }
.orb-two { right: 40px; bottom: 40px; width: 280px; height: 280px; background: rgba(15, 123, 108, 0.15); }

.app-shell { width: min(1220px, calc(100% - 32px)); margin: 28px auto; }

body[data-page="login"] .app-shell {
  width: min(100%, 500px);
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px 24px 100px;
  gap: 20px;
}

/* Login Bottom Navigation */
.login-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 12px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 20px;
  border-radius: 14px;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.login-nav-item:hover {
  background: rgba(15, 123, 108, 0.08);
  color: var(--primary);
}

.login-nav-item svg {
  width: 22px;
  height: 22px;
}

.login-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  background: linear-gradient(to top, rgba(248, 250, 252, 0.95), transparent);
}

@media (max-width: 480px) {
  .login-nav {
    gap: 4px;
    padding: 10px 8px;
  }
  
  .login-nav-item {
    padding: 10px 14px;
    font-size: 0.7rem;
  }
  
  .login-nav-item svg {
    width: 20px;
    height: 20px;
  }
}

.login-panel, .portal {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.login-panel {
  max-width: 100%;
  margin: 0;
  padding: 34px 32px 28px;
  border-radius: 26px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.8)),
    linear-gradient(135deg, rgba(15, 123, 108, 0.08), rgba(242, 185, 93, 0.08));
}

.portal {
  display: grid;
  grid-template-columns: 280px 1fr;
  border-radius: 32px;
  min-height: calc(100vh - 56px);
  overflow: hidden;
}

body[data-page]:not([data-page="login"]) .app-shell {
  width: 100%;
  margin: 0;
}

body[data-page]:not([data-page="login"]) .portal {
  width: 100%;
  min-height: 100vh;
  border-radius: 0;
}

body.menu-open {
  overflow: hidden;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.55)),
    linear-gradient(180deg, rgba(15, 123, 108, 0.08), transparent 60%);
  border-right: 1px solid var(--line);
}

.menu-toggle,
.sidebar-overlay {
  display: none;
}

.main-content { padding: 28px; }
.page-section { animation: fadeUp 0.3s ease; }

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--primary), var(--accent-orange));
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.brand-block { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand-block h2 { margin: 0; font-size: 1.05rem; }

.login-brand {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.login-header {
  display: block;
  margin-bottom: 24px;
}

.login-title {
  margin: 0;
  font-size: 1.75rem;
  line-height: 1.05;
}

.login-subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.eyebrow {
  margin: 18px 0 8px;
  color: var(--accent-orange);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3, h4, p { margin-top: 0; }
.panel-copy { color: var(--muted); line-height: 1.65; margin-bottom: 22px; }

.login-form, .payment-form, .profile-form { display: grid; gap: 16px; }
label span { display: block; margin-bottom: 8px; font-size: 0.95rem; font-weight: 700; }

.profile-card {
  max-width: 760px;
}

input, select, textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[readonly] {
  background: rgba(247, 249, 252, 0.95);
  color: #324054;
  cursor: default;
}

input:focus, select:focus, textarea:focus {
  border-color: rgba(15, 123, 108, 0.5);
  box-shadow: 0 0 0 4px rgba(15, 123, 108, 0.08);
}

.primary-btn, .ghost-btn, .nav-link, .table-btn {
  border: 0;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.primary-btn {
  padding: 14px 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent-orange));
  color: #fff;
  font-weight: 800;
}

.ghost-btn {
  width: 100%;
  padding: 13px 16px;
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.05);
  color: var(--text);
  font-weight: 700;
}

.nav-menu { display: grid; gap: 8px; }

.nav-link {
  display: block;
  padding: 13px 16px;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  text-decoration: none;
  font-weight: 700;
}

.nav-link.active {
  background: linear-gradient(135deg, rgba(15, 123, 108, 0.16), rgba(15, 123, 108, 0.07));
  color: var(--text);
}

.primary-btn:hover, .ghost-btn:hover, .nav-link:hover, .table-btn:hover { transform: translateY(-1px); }

.panel-card, .stat-card {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.78);
  border-radius: var(--radius-lg);
}

.status-message { min-height: 24px; margin: 16px 0 0; color: var(--primary-deep); font-weight: 700; padding: 12px 16px; border-radius: 12px; }
.status-message.success { background: rgba(15, 159, 103, 0.1); color: #047857; border: 1px solid rgba(15, 159, 103, 0.2); }
  background: rgba(239, 68, 68, 0.1); color: var(--accent-red); border: 1px solid rgba(239, 68, 68, 0.2); }

body[data-page="login"] .login-form {
  gap: 14px;
}

body[data-page="login"] label span {
  font-size: 0.9rem;
}

body[data-page="login"] input {
  padding: 15px 16px;
  border-radius: 16px;
}

body[data-page="login"] .primary-btn {
  margin-top: 6px;
  padding: 15px 18px;
  border-radius: 16px;
}

.login-footnote {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
}

.topbar, .section-heading, .card-head, .detail-list div, .ticket-item, .support-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar { margin-bottom: 26px; }

.customer-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  color: var(--muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(15, 159, 103, 0.12);
}

.customer-summary strong {
  font-size: 0.92rem;
  color: var(--text);
}

.customer-summary span[id="customerPlan"] {
  font-size: 0.84rem;
  line-height: 1.25;
}

.summary-separator {
  color: rgba(98, 112, 139, 0.55);
}

.stat-grid, .grid-two { display: grid; gap: 18px; }
.stat-grid { grid-template-columns: repeat(4, 1fr); margin-bottom: 18px; }
.grid-two { grid-template-columns: 1.1fr 0.9fr; }
.stat-card, .panel-card { padding: 22px; }

.stat-card span, .detail-list span, .invoice-detail-card span, .ticket-item span, .support-summary-item span {
  color: var(--muted);
  font-size: 0.92rem;
}

.stat-card h4 { margin: 12px 0 8px; font-size: 1.25rem; }
 .stat-card.accent { background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(37, 99, 235, 0.10), rgba(255, 255, 255, 0.85)); }
.detail-list, .timeline { display: grid; gap: 14px; }
.timeline { list-style: none; padding: 0; margin: 0; }

.timeline li, .ticket-item, .support-summary-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.timeline li:last-child, .ticket-item:last-child, .support-summary-item:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.timeline strong, .ticket-item strong { display: block; margin-bottom: 4px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }

th, td {
  padding: 14px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.table-btn {
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(15, 123, 108, 0.11);
  color: var(--primary-deep);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 7px 11px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 800;
}

.badge.paid, .badge.completed, .badge.open { background: rgba(15, 159, 103, 0.12); color: #0b7b51; }
.badge.pending { background: rgba(245, 158, 11, 0.2); color: var(--accent-orange); }
.badge.closed { background: rgba(37, 99, 235, 0.08); color: var(--primary); }

.invoice-viewer { margin-top: 18px; }
.invoice-detail-card { display: grid; gap: 16px; }

.invoice-detail-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.invoice-detail-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.empty-state { color: var(--muted); }
textarea { resize: vertical; }

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1120px) {
  .portal { grid-template-columns: 1fr; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  body[data-page]:not([data-page="login"]) .portal {
    min-height: 100vh;
  }

  .sidebar {
    gap: 18px;
    padding: 20px 16px 16px;
  }

  .brand-block {
    margin-bottom: 0;
  }

  .ghost-btn {
    width: fit-content;
    min-width: 110px;
  }

  .main-content {
    padding: 20px 16px 24px;
  }

  .menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 46px;
    height: 46px;
    margin-bottom: 14px;
    padding: 0 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(19, 31, 56, 0.08);
    position: sticky;
    top: 12px;
    z-index: 8;
  }

  .menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    border-radius: 999px;
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.36);
    z-index: 19;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(290px, calc(100vw - 52px));
    z-index: 20;
    border-right: 1px solid var(--line);
    border-bottom: 0;
    transform: translateX(-100%);
    transition: transform 0.28s ease;
    overflow-y: auto;
  }

  .nav-menu {
    display: grid;
    gap: 8px;
    overflow: visible;
    padding-bottom: 0;
  }

  .nav-link {
    white-space: normal;
    padding: 12px 14px;
    font-size: 0.92rem;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  body.menu-open .sidebar-overlay {
    display: block;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
  }

  .topbar h1 {
    font-size: 1.7rem;
  }

  .section-heading h3 {
    font-size: 1.3rem;
  }

  .panel-card,
  .stat-card {
    padding: 18px;
  }
}

@media (max-width: 760px) {
  .app-shell { width: min(100% - 18px, 1220px); margin: 10px auto; }
  .login-panel, .main-content { padding: 20px; }
  .topbar, .section-heading, .card-head, .detail-list div, .ticket-item, .support-summary-item, .invoice-detail-header {
    align-items: flex-start;
    flex-direction: column;
  }
  .stat-grid, .grid-two, .invoice-detail-body { grid-template-columns: 1fr; }
  .customer-summary { width: 100%; flex-wrap: wrap; gap: 8px; }

  .brand-mark {
    width: 46px;
    height: 46px;
  }

  .brand-block h2 {
    font-size: 1rem;
  }

  .eyebrow {
    margin-top: 0;
  }

  th, td {
    padding: 12px 8px;
    font-size: 0.9rem;
  }

  th {
    font-size: 0.74rem;
  }

  .table-btn {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  input,
  select,
  textarea {
    padding: 13px 14px;
  }

  .responsive-table thead {
    display: none;
  }

  .responsive-table,
  .responsive-table tbody,
  .responsive-table tr,
  .responsive-table td {
    display: block;
    width: 100%;
  }

  .responsive-table tr {
    padding: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
  }

  .responsive-table td {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    text-align: right;
  }

  .responsive-table td:last-child {
    border-bottom: 0;
    padding-bottom: 0;
  }

  .responsive-table td::before {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-align: left;
  }

  .invoices-table td:nth-child(1)::before { content: "Invoice"; }
  .invoices-table td:nth-child(2)::before { content: "Date"; }
  .invoices-table td:nth-child(3)::before { content: "Amount"; }
  .invoices-table td:nth-child(4)::before { content: "Status"; }
  .invoices-table td:nth-child(5)::before { content: "Action"; }

  .payments-table td:nth-child(1)::before { content: "Reference"; }
  .payments-table td:nth-child(2)::before { content: "Date"; }
  .payments-table td:nth-child(3)::before { content: "Method"; }
  .payments-table td:nth-child(4)::before { content: "Amount"; }
  .payments-table td:nth-child(5)::before { content: "Status"; }

  .responsive-table td:last-child {
    flex-wrap: wrap;
    justify-content: flex-start;
    text-align: left;
  }

  .responsive-table td:last-child .table-btn {
    min-width: 92px;
  }
}

@media (max-width: 760px) {
  body[data-page="login"] {
    height: auto;
    overflow: auto;
  }

  body[data-page="login"] .app-shell {
    min-height: 100vh;
    padding: 20px;
  }

  body[data-page="login"] .login-panel {
    padding: 26px 22px 22px;
  }

  .login-title {
    font-size: 1.45rem;
  }
}

@media (max-width: 520px) {
  .background-orb {
    opacity: 0.6;
  }

  .orb-one {
    top: 14px;
    left: -36px;
    width: 140px;
    height: 140px;
  }

  .orb-two {
    right: -42px;
    bottom: 10px;
    width: 170px;
    height: 170px;
  }

  body[data-page]:not([data-page="login"]) .portal {
    min-height: 100dvh;
  }

  .sidebar {
    padding: 14px 12px 12px;
  }

  .main-content {
    padding: 16px 12px 20px;
  }

  .menu-toggle {
    width: 42px;
    height: 42px;
    top: 8px;
    margin-bottom: 10px;
  }

  .topbar h1 {
    font-size: 1.45rem;
  }

  .section-heading h3 {
    font-size: 1.15rem;
  }

  .panel-card,
  .stat-card,
  .login-panel {
    padding: 16px;
    border-radius: 16px;
  }

  .login-subtitle,
  .login-footnote,
  .customer-summary span[id="customerPlan"] {
    font-size: 0.8rem;
  }

  .customer-summary {
    gap: 6px;
  }

  .nav-link {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
  }

  .ghost-btn,
  .primary-btn {
    width: 100%;
  }
}
