:root {
  --sidebar-bg: #132b40;
  --accent: #FE5F55;
  --accent-dark: #e0483e;
  --text-dark: #2c3a45;
  --text-muted: #577399;
  --border: #d7e3ee;
  --bg: #F7F7FF;
  --danger: #c94a42;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text-dark);
}

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

/* Sidebar */
.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  color: white;
  padding: 24px 0;
  flex-shrink: 0;
}

.sidebar .brand {
  padding: 8px 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  margin-bottom: 16px;
}

.sidebar a {
  display: block;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  padding: 12px 24px;
  font-size: 14px;
}

.sidebar a:hover, .sidebar a.active {
  background: rgba(255,255,255,0.08);
  color: white;
}

.sidebar .logout {
  margin-top: 24px;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 16px;
}

/* Main content */
.main {
  flex: 1;
  padding: 32px 40px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 22px;
  margin: 0;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: white; color: var(--text-dark); border: 1px solid var(--border); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Cards */
.card {
  background: white;
  border-radius: 10px;
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(19, 43, 64, 0.08);
  overflow: hidden;
  margin-bottom: 24px;
}

.card-header {
  background: var(--sidebar-bg);
  color: white;
  padding: 16px 20px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-body { padding: 20px; }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 14px; }
th { color: var(--text-muted); text-transform: uppercase; font-size: 12px; letter-spacing: 0.03em; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfb; }

a.row-link { color: var(--text-dark); text-decoration: none; font-weight: 600; }
a.row-link:hover { color: var(--accent-dark); }

/* Status badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.badge-active { background: #e1f5e6; color: #227a3e; }
.badge-inactive { background: #fbe4e4; color: #a12f2f; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-group { margin-bottom: 4px; }
.form-group.full { grid-column: 1 / -1; }
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--text-muted); }
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
.form-actions { margin-top: 20px; display: flex; gap: 12px; }

/* Filters bar */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filters select, .filters input {
  width: auto;
  min-width: 160px;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tabs a {
  padding: 10px 18px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  border-bottom: 2px solid transparent;
}
.tabs a.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

/* Dashboard hero band */
.dashboard-hero {
  background: linear-gradient(180deg, #146276 0%, #0b4e67 50%, #003a59 100%);
  color: white;
  margin: -32px -40px 28px;
  padding: 32px 40px 36px;
  border-radius: 0 0 20px 20px;
}
.dashboard-hero h1 { color: white; }
.dashboard-hero .card {
  background: transparent;
  border: none;
  box-shadow: none;
}

/* White header band (icon/title/subtitle/tabs sit on white, page content below is light gray) */
.header-white-band {
  background: white;
  margin: -32px -40px 24px;
  padding: 32px 40px 0;
}

/* Section header (icon + light title + bold subtitle) */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.section-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-header svg { color: var(--accent); flex-shrink: 0; }
.section-header h1 {
  font-weight: 300;
  font-size: 34px;
  color: #555;
  margin: 0;
}
.section-subtitle {
  font-weight: 700;
  font-size: 14px;
  color: #1a1a1a;
  margin: 2px 0 20px 0;
}

/* Section tab bar (Members / Documents / Growth style) */
.section-tabs {
  display: flex;
  gap: 32px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.section-tabs a {
  padding: 0 0 12px;
  text-decoration: none;
  color: #8a8a8a;
  font-weight: 500;
  font-size: 15px;
  border-bottom: 2px solid transparent;
}
.section-tabs a.active {
  color: #00c3ac;
  font-weight: 600;
  border-bottom-color: #00c3ac;
}

/* Collapsible sections */
details summary::-webkit-details-marker { display: none; }
details[open] summary .collapse-arrow { transform: rotate(90deg); display: inline-block; }
details summary .collapse-arrow { display: inline-block; transition: transform 0.15s; }

/* Login page */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
}
.login-box {
  background: white;
  padding: 40px;
  border-radius: 10px;
  width: 360px;
}
.login-box h1 { font-size: 20px; margin-bottom: 24px; text-align: center; }
.error-msg { background: #fbe4e4; color: #a12f2f; padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }

/* Member profile header */
.member-profile-header {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}
.member-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
}
.member-meta { color: var(--text-muted); font-size: 14px; }
