:root {
  --brand-dark: #1e293b;
  --brand-accent: #0f766e;
  --brand-accent-light: #14b8a6;
  --brand-bg-light: #f0fdfa;
  --grey: #64748b;
  --line-grey: #e2e8f0;
  --danger: #dc2626;
  --success: #16a34a;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  font-family: "Hind Siliguri", "Nirmala UI", "Segoe UI", Arial, sans-serif;
  background: #f8fafc;
  color: #1e293b;
  margin: 0;
  line-height: 1.6;
}

a { color: var(--brand-accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Top bar ---------- */
.topbar {
  background: var(--brand-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  position: relative;
  z-index: 20;
}
.topbar .brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}
.brand-link {
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
}
.brand-link:hover { text-decoration: none; }
.brand-link span { color: var(--brand-accent-light); }
.brand-sub { font-size: 13px; color: #cbd5e1; font-weight: 500; white-space: nowrap; }

.nav-desktop { display: flex; align-items: center; }
.nav-desktop a { color: #e2e8f0; margin-left: 18px; font-size: 15px; text-decoration: none; }
.nav-desktop a:hover { color: #fff; text-decoration: none; }
.inline-form { display: inline; }

/* Hamburger button — hidden on desktop, shown on mobile */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.hamburger-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
  transition: transform .2s ease, opacity .2s ease;
}
.hamburger-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Overlay behind the slide-in menu */
.menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  z-index: 30;
  opacity: 0;
  transition: opacity .2s ease;
}
.menu-overlay.open { display: block; opacity: 1; }

/* Slide-in menu panel — opens from the right */
.mobile-menu {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 80%;
  max-width: 320px;
  background: #fff;
  z-index: 40;
  transform: translateX(100%);
  transition: transform .25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 30px rgba(0,0,0,.2);
  overflow-y: auto;
}
.mobile-menu.open { transform: translateX(0); }
.mobile-menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line-grey);
}
.mobile-menu-header .brand-sub { color: var(--brand-dark); font-weight: 700; font-size: 15px; }
.menu-close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--grey);
  cursor: pointer;
  line-height: 1;
  padding: 6px 8px;
}
.mobile-menu a {
  padding: 15px 20px;
  color: var(--brand-dark);
  font-size: 16px;
  border-bottom: 1px solid var(--line-grey);
  text-decoration: none;
}
.mobile-menu a:active,
.mobile-menu a:hover { background: var(--brand-bg-light); text-decoration: none; }
body.menu-open { overflow: hidden; }

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 20px 60px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 9px 18px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  font-size: 15px;
  font-family: inherit;
  text-decoration: none;
  transition: filter .15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(0.93); }
.btn-primary { background: var(--brand-accent); color: #fff; }
.btn-secondary { background: #fff; color: var(--brand-dark); border-color: var(--line-grey); }
.btn-danger { background: #fff; color: var(--danger); border-color: #fecaca; }
.btn-outline { background: transparent; color: var(--brand-accent); border-color: var(--brand-accent); }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ---------- Cards / panels ---------- */
.card {
  background: #fff;
  border: 1px solid var(--line-grey);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 22px;
}
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
  flex-wrap: wrap;
  gap: 10px;
}
.page-header h1 { font-size: 24px; margin: 0; color: var(--brand-dark); }

/* ---------- Alerts ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 18px; }
.messages li {
  padding: 10px 16px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  font-size: 15px;
}
.messages .success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.messages .error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }

/* ---------- Table ---------- */
table.list-table { width: 100%; border-collapse: collapse; }
table.list-table th, table.list-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line-grey);
  text-align: left;
  font-size: 15px;
}
table.list-table th { color: var(--grey); font-weight: 600; font-size: 13px; }
table.list-table tr:hover { background: var(--brand-bg-light); }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.badge-draft { background: #f1f5f9; color: #475569; }
.badge-active { background: #ecfdf5; color: #047857; }
.badge-completed { background: #eff6ff; color: #1d4ed8; }
.badge-cancelled { background: #fef2f2; color: #b91c1c; }

.search-box input {
  padding: 9px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line-grey);
  font-size: 15px;
  min-width: 240px;
}

/* ---------- Forms ---------- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.form-grid .full { grid-column: 1 / -1; }
.form-group label {
  display: block;
  margin-bottom: 5px;
  font-size: 14px;
  font-weight: 600;
  color: var(--brand-dark);
}
.form-group .help { font-size: 12.5px; color: var(--grey); margin-top: 4px; }
.form-control, .form-select {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--line-grey);
  font-size: 15px;
  font-family: inherit;
  background: #fff;
}
.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(15,118,110,0.12);
}
textarea.form-control { resize: vertical; }
.errorlist { color: var(--danger); font-size: 13px; padding-left: 16px; margin: 4px 0; }
fieldset.section {
  border: 1px solid var(--line-grey);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}
fieldset.section legend {
  font-weight: 700;
  color: var(--brand-accent);
  padding: 0 8px;
  font-size: 16px;
}

/* ---------- Module price table (contract form) ---------- */
table.module-table {
  width: 100%;
  border-collapse: collapse;
}
table.module-table th {
  text-align: left;
  font-size: 13px;
  color: var(--grey);
  font-weight: 600;
  padding: 6px 8px;
  border-bottom: 2px solid var(--line-grey);
}
table.module-table td {
  padding: 6px 8px;
  vertical-align: top;
}
table.module-table tbody tr {
  border-bottom: 1px solid var(--line-grey);
}
table.module-table tfoot td {
  padding: 10px 8px;
  border-top: 2px solid var(--line-grey);
  font-size: 15px;
}
table.module-table input.form-control {
  padding: 7px 10px;
  font-size: 14.5px;
}
table.module-table th.col-price,
table.module-table td:nth-child(2) { width: 170px; }
table.module-table th.col-action,
table.module-table td.col-action { width: 50px; text-align: center; }

/* ---------- Login page ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f766e 0%, #1e293b 100%);
}
.login-card {
  background: #fff;
  padding: 40px 36px;
  border-radius: 14px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.login-card h1 { text-align: center; font-size: 22px; margin: 0 0 4px; color: var(--brand-dark); }
.login-card .subtitle { text-align: center; color: var(--grey); font-size: 14px; margin-bottom: 24px; }
.login-card .btn { width: 100%; text-align: center; margin-top: 10px; }

/* ---------- Contract document (letterhead) ---------- */
.doc-page {
  background: #fff;
  border: 1px solid var(--line-grey);
  border-radius: var(--radius);
  padding: 40px 48px;
}
.doc-letterhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid var(--brand-accent);
  padding-bottom: 14px;
  margin-bottom: 20px;
}
.doc-letterhead .company-name { font-size: 26px; font-weight: 700; color: var(--brand-dark); }
.doc-letterhead .company-name span { color: var(--brand-accent); }
.doc-letterhead .tagline { font-size: 13px; color: var(--grey); font-style: italic; }
.doc-letterhead .company-contact { text-align: right; font-size: 13px; color: var(--grey); line-height: 1.5; }
.doc-title { text-align: center; margin: 10px 0 22px; }
.doc-title h2 { font-size: 26px; color: var(--brand-dark); margin: 0 0 4px; }
.doc-title .en { font-size: 14px; color: var(--grey); font-style: italic; }

.doc-info-table, .doc-terms-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}
.doc-info-table td, .doc-terms-table th, .doc-terms-table td {
  border: 1px solid var(--line-grey);
  padding: 8px 12px;
  font-size: 14.5px;
}
.doc-info-table td:first-child { background: var(--brand-bg-light); font-weight: 600; width: 32%; }
.doc-terms-table th { background: var(--brand-bg-light); font-weight: 600; }

.doc-section-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--brand-dark);
  border-bottom: 2px solid var(--brand-accent);
  padding-bottom: 4px;
  margin: 22px 0 10px;
}
.doc-section-title .num { color: var(--brand-accent); margin-right: 4px; }
.doc-body p { font-size: 14.5px; margin: 0 0 8px; }
.doc-body ul { margin: 0 0 8px; padding-left: 22px; }
.doc-body li { font-size: 14.5px; margin-bottom: 5px; }
.doc-body .en { display: block; color: #64748b; font-style: italic; font-size: 13px; margin-top: 3px; }
.doc-section-title .en-title { color: #64748b; font-weight: 500; font-size: 14px; font-style: italic; }

.doc-sign-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30px;
  margin-top: 40px;
}
.doc-sign-grid .box { border-top: 2px solid var(--brand-dark); padding-top: 10px; font-size: 14.5px; }
.doc-sign-grid .box strong { display: block; margin-bottom: 6px; color: var(--brand-dark); }
.blank-line { border-bottom: 1px solid #94a3b8; display: inline-block; min-width: 160px; }

.doc-actions { margin-bottom: 18px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .nav-desktop { display: none; }
  .hamburger-btn { display: flex; }

  .topbar { padding: 12px 16px; }
  .brand-sub { display: none; }

  .container { padding: 18px 14px 50px; }
  .card { padding: 16px; }
  .page-header h1 { font-size: 20px; }
  .page-header { align-items: flex-start; }

  fieldset.section { padding: 14px 16px; }

  .form-grid { grid-template-columns: 1fr; gap: 14px; }

  .search-box { display: flex; flex-wrap: wrap; gap: 8px; }
  .search-box input { min-width: 0; flex: 1 1 180px; }

  /* Wide data tables scroll horizontally instead of squeezing/wrapping */
  table.list-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
  }

  .doc-page { padding: 24px 16px; }
  .doc-letterhead { flex-direction: column; align-items: flex-start; gap: 10px; }
  .doc-letterhead .company-contact { text-align: left; }
  .doc-title h2 { font-size: 21px; }
  .doc-info-table td, .doc-terms-table th, .doc-terms-table td { padding: 7px 9px; font-size: 13.5px; }
  .doc-sign-grid { grid-template-columns: 1fr; gap: 26px; }
  .doc-actions .btn { flex: 1 1 auto; text-align: center; }

  table.module-table th.col-price,
  table.module-table td:nth-child(2) { width: 110px; }
}

@media (max-width: 480px) {
  .login-card { padding: 26px 20px; max-width: 100%; }
  .btn { padding: 8px 14px; font-size: 14px; }
  .btn-sm { padding: 5px 10px; font-size: 12.5px; }
  .page-header h1 { font-size: 18px; }
  .doc-title h2 { font-size: 18px; }
  .doc-letterhead .company-name { font-size: 21px; }
  table.module-table th.col-price,
  table.module-table td:nth-child(2) { width: 90px; }
}

/* ---------- Print ---------- */
@media print {
  .topbar, .doc-actions, .no-print, .mobile-menu, .menu-overlay { display: none !important; }
  body { background: #fff; }
  .container { max-width: none; padding: 0; }
  .doc-page { border: none; padding: 0; }
}
