/* ── Reset & Base ── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  font-size: 16px;
  color: #333;
  background-color: #f4f6f9;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  min-height: 100vh;
}

a {
  color: #2a6ebb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ── Header ── */
header {
  background-color: #1a3d6e;
  color: white;
  padding: 1rem 2rem;
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-area img {
  height: 50px;
  width: auto;
}

.company-name {
  font-size: 1.4rem;
  font-weight: bold;
  color: white;
}

.logout-link {
  color: #1a3d6e;
  font-size: 0.9rem;
  border: 1px solid white;
  padding: 0.3rem 0.8rem;
  border-radius: 4px;
  background-color: white;
  cursor: pointer;
}

.logout-link:hover {
  background-color: #cccccc;
  color: #1a3d6e;
  text-decoration: none;
}

/* ── Navigation ── */
nav {
  background-color: #2a6ebb;
  padding: 0 2rem;
}

nav ul {
  display: flex;
  list-style: none;
  max-width: 1200px;
  margin: 0 auto;
}

nav ul li a {
  display: block;
  color: white;
  padding: 1rem 1.2rem;
  font-size: 0.95rem;
}

nav ul li a:hover {
  background-color: #1a3d6e;
  text-decoration: none;
}

/* ── Main Content ── */
main {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 2rem;
  width: 100%;
}

/* ── Footer ── */
footer {
  background-color: #1a3d6e;
  color: white;
  text-align: center;
  padding: 1rem;
  font-size: 0.85rem;
}

/* ── Page Header ── */
.page-header {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  margin-bottom: 1.5rem;
}

.page-header h1 {
  font-size: 1.8rem;
  color: #1a3d6e;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  background-color: #2a6ebb;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
}

.btn:hover {
  background-color: #1a3d6e;
  text-decoration: none;
  color: white;
}

.btn-small {
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
}

.btn-danger {
  background-color: #c0392b;
}

.btn-danger:hover {
  background-color: #922b21;
}

.btn-secondary {
  background-color: #666;
}

.btn-secondary:hover {
  background-color: #444;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
}

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  background-color: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

th {
  background-color: #1a3d6e;
  color: white;
  padding: 0.8rem 1rem;
  text-align: left;
  font-size: 0.9rem;
  white-space: nowrap;
}

td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

td .btn-small {
  display: inline-block;
  margin: 0.1rem;
}

.action-cell {
  white-space: nowrap;
}

tr:last-child td {
  border-bottom: none;
}

tr:hover td {
  background-color: #f0f4f9;
}

/* ── Detail Card ── */
.detail-card {
  background-color: white;
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  margin-bottom: 2rem;
}

.detail-card h2 {
  color: #1a3d6e;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.detail-table th {
  background-color: #f4f6f9;
  color: #333;
  width: 200px;
}

/* ── Related Section ── */
.related-section {
  margin-top: 2rem;
}

.related-section h2 {
  color: #1a3d6e;
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

/* ── Client Detail Referrals Table ── */
.related-section th {
  white-space: nowrap;
  min-width: 100px;
}

/* ── Forms ── */
.form-container {
  background-color: white;
  border-radius: 6px;
  padding: 2rem;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
  max-width: 700px;
}

.form-group {
  display: grid;
  grid-template-columns: 200px 1fr;
  align-items: start;
  gap: 0.5rem;
  margin-bottom: 1.2rem;
}

.form-group label {
  font-weight: bold;
  padding-top: 0.4rem;
  font-size: 0.9rem;
  color: #444;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  font-family: inherit;
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2a6ebb;
  box-shadow: 0 0 0 2px rgba(42, 110, 187, 0.2);
}

.field-error p {
  color: #c0392b;
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

.help-text {
  color: #666;
  font-size: 0.8rem;
  margin-top: 0.2rem;
}

.warning-text {
  color: #c0392b;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

/* ── Home Page ── */
.home-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  align-items: center;
}

.welcome-text h1 {
  color: #1a3d6e;
  font-size: 1.8rem;
  margin-bottom: 1rem;
}

.welcome-text p {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: #555;
}

.home-image img {
  width: 100%;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ── Back Link ── */
.back-link {
  margin-top: 1.5rem;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  height: 6px;
  width: 6px;
}

::-webkit-scrollbar-track {
  background-color: #e0e0e0;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb {
  background-color: #2a6ebb;
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #1a3d6e;
}

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: #2a6ebb transparent;
}


/* ── Responsive ── */
@media (max-width: 768px) {
  .home-container {
    grid-template-columns: 1fr;
  }

  .form-group {
    grid-template-columns: 1fr;
  }

  .page-header {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  nav ul {
    flex-wrap: wrap;
  }

  .header-inner {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }
}