:root {
  --bg: #f4f7f6;
  --sidebar: #0f3d3e;
  --sidebar-hover: #13504f;
  --primary: #0e7c66;
  --primary-dark: #0b5f4f;
  --accent: #2bbbad;
  --text: #1f2d2b;
  --muted: #6b7c7a;
  --border: #dfe8e6;
  --card: #ffffff;
  --success: #1f9d55;
  --danger: #d64545;
  --warning: #d97706;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", "Tahoma", "Arial", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
}

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 260px;
  background: var(--sidebar);
  color: #e6f0ef;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; }
.brand-logo {
  width: 90%; height: auto; background: #fff;
  border-radius: 8px; padding: 6px 8px;
  margin:auto;
}
.brand-mark {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent); color: #062c2a; font-weight: 700;
  display: grid; place-items: center; font-size: 20px;
}
.brand-name { font-size: 20px; font-weight: 700; color: #fff; }

.sidebar nav { flex: 1; padding: 8px 0; display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: block; padding: 12px 18px; color: #cfe4e1; text-decoration: none;
  border-right: 3px solid transparent; font-size: 15px;
}
.nav-link:hover { background: var(--sidebar-hover); color: #fff; }
.nav-link.active { background: var(--sidebar-hover); border-right-color: var(--accent); color: #fff; font-weight: 600; }
.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 14px 24px; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { margin: 0; font-size: 20px; }
.user-chip { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--primary); color: #fff; display: grid; place-items: center;
}
.content { padding: 24px; max-width: 1200px; flex: 1; width: 100%; }
.site-footer {
  padding: 18px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: #fff;
}
body.blank .site-footer { margin-top: 24px; border-top: none; background: transparent; padding: 0 16px 8px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; margin-bottom: 20px; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px;
}
.card-label { color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.card-value { font-size: 26px; font-weight: 700; color: var(--primary-dark); }

.panel {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px;
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.panel-title { margin: 0; font-size: 18px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); font-size: 14px; }
.table th { background: #f0f5f4; color: var(--muted); font-weight: 600; }
.table tr:hover td { background: #f8fbfa; }

.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; border: 1px solid transparent;
  font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e8f1ef; color: var(--primary-dark); }
.btn-secondary:hover { background: #d6e6e2; }
.btn-outline { background: #fff; color: var(--primary); border-color: var(--primary); }
.btn-outline:hover { background: #eef6f4; }
.btn-danger { background: #fdecec; color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px; }
input[type="text"], input[type="number"], input[type="date"], input[type="password"], input[type="file"], select, .form-group input, .form-group select {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.filter-bar input, .filter-bar select { flex: 1; min-width: 140px; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-success { background: #e6f6ee; color: var(--success); }
.badge-warning { background: #fdf3e3; color: var(--warning); }
.badge-danger { background: #fdecec; color: var(--danger); }
.badge-info { background: #e7f3f8; color: #0b6e99; }

.banner { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-weight: 600; }
.banner-success { background: #e6f6ee; color: var(--success); border: 1px solid #bfe8d1; }
.banner-error { background: #fdecec; color: var(--danger); border: 1px solid #f5c6c6; }
.banner-info { background: #e7f3f8; color: #0b6e99; border: 1px solid #c5e2ee; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.step {
  display: flex; align-items: center; gap: 12px; padding: 14px;
  border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text);
}
.step:hover { border-color: var(--accent); }
.step-num { width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }

.upload-box { text-align: center; padding: 20px; border: 2px dashed var(--border); border-radius: 10px; margin-bottom: 16px; }

.muted { color: var(--muted); font-size: 13px; }

.whatsapp-bubble { max-width: 480px; background: #e5ddd5; border-radius: 12px; overflow: hidden; margin-bottom: 20px; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.bubble-head { background: #075e54; color: #fff; padding: 10px 14px; font-weight: 600; font-size: 13px; }
.bubble-body { background: #dcf8c6; margin: 12px; padding: 12px 14px; border-radius: 10px; font-size: 14px; }
.bubble-body p { margin: 0 0 8px; }
.bubble-link { color: #0b6e99; word-break: break-all; direction: ltr; text-align: left; }

body.blank { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 100vh; padding: 24px; }
.auth-card {
  width: 100%; max-width: 440px; background: var(--card);
  border: 1px solid var(--border); border-radius: 16px; padding: 32px;
  box-shadow: 0 10px 30px rgba(0,0,0,.06);
}
.auth-card.pay-card { max-width: 500px; }
.brand-lg { justify-content: center; margin-bottom: 8px; }
.brand-lg .brand-logo { width: 100%; padding: 12px 18px; border-radius: 12px; }
.auth-title { margin: 8px 0 4px; font-size: 20px; text-align: center; }
.auth-sub { color: var(--muted); text-align: center; margin: 0 0 18px; }
.auth-form { display: flex; flex-direction: column; gap: 10px; }
.auth-note { text-align: center; color: var(--muted); font-size: 12px; margin-top: 16px; }

.invoice-summary { background: #f4f9f8; border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin: 16px 0; }
.summary-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.summary-row span { color: var(--muted); }

.paymob-brand { text-align: center; font-size: 22px; font-weight: 700; color: #13344e; margin-bottom: 8px; }
.paymob-brand small { font-weight: 400; font-size: 13px; color: var(--muted); }
.card-mock { background: linear-gradient(135deg, #13344e, #1d4f74); color: #fff; border-radius: 12px; padding: 20px; margin: 16px 0; }
.card-mock-label { font-size: 11px; opacity: .7; margin-bottom: 4px; }
.card-mock-value { font-size: 18px; letter-spacing: 1px; margin-bottom: 12px; }
.card-mock-row { display: flex; gap: 30px; }

.success-check {
  width: 64px; height: 64px; border-radius: 50%; background: #e6f6ee; color: var(--success);
  font-size: 32px; display: grid; place-items: center; margin: 0 auto 12px;
}

.chart { display: flex; align-items: flex-end; gap: 12px; height: 220px; padding: 10px 0; }
.chart-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.chart-bar { width: 100%; max-width: 46px; background: var(--accent); border-radius: 6px 6px 0 0; margin-top: auto; }
.chart-label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.chart-value { font-size: 11px; color: var(--muted); margin-bottom: 4px; }

/* ===== Responsive (mobile & tablet) ===== */
@media (max-width: 768px) {
  body { font-size: 14px; }

  /* app shell: sidebar becomes a compact top header */
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
  }
  .brand { justify-content: center; padding: 12px 16px 8px; }
  .brand-logo { width: 110px; padding: 4px 8px; }
  .sidebar nav {
    flex-direction: row;
    overflow-x: auto;
    padding: 4px 8px 8px;
    gap: 4px;
    scrollbar-width: none;
  }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-link {
    white-space: nowrap;
    padding: 8px 12px;
    border-right: none;
    border-bottom: 3px solid transparent;
    font-size: 14px;
  }
  .nav-link.active { border-right-color: transparent; border-bottom-color: var(--accent); }
  .sidebar-footer { padding: 0 8px 12px; border-top: none; text-align: center; }
  .sidebar-footer .nav-link {
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 999px;
    padding: 6px 14px;
  }

  /* topbar + content */
  .topbar { padding: 10px 14px; flex-wrap: wrap; gap: 4px 10px; }
  .topbar h1 { font-size: 17px; }
  .user-chip { font-size: 13px; }
  .avatar { width: 30px; height: 30px; font-size: 13px; }
  .content { padding: 16px; }

  /* panels & forms */
  .panel { padding: 16px; }
  .form-row { grid-template-columns: 1fr; }

  /* tables: allow horizontal scroll instead of squeezing */
  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
  }

  /* auth / pay pages */
  body.blank { padding: 16px; }
  .auth-card { padding: 24px 18px; }
  .brand-lg .brand-logo { padding: 10px 14px; }

  /* dashboard chart */
  .chart { gap: 8px; height: 180px; }
  .card-mock-row { gap: 16px; }
  .card-mock { padding: 16px; }
}

