:root {
  --primary-blue: #1b365d;
  --primary-blue-light: #24457a;
  --accent-gold: #c59b27;
  --accent-gold-light: #e0c26a;
  --bg-light: #f4f6f9;
  --card-white: #ffffff;
  --text-dark: #2c3e50;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --success-green: #16a34a;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --danger-red: #dc2626;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--app-font-family, 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif);
}

body {
  background-color: var(--bg-light);
  color: var(--text-dark);
}

a {
  color: inherit;
  text-decoration: none;
}

/* ===== Layout ===== */
.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar-background, var(--primary-blue));
  color: white;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
}

.sidebar-header {
  padding: 20px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.1);
}

.sidebar-header .crest {
  color: var(--accent-gold);
}

.sidebar-header h2 {
  font-size: 14px;
  color: var(--accent-gold);
  letter-spacing: 0.5px;
  margin-top: 8px;
  text-transform: uppercase;
  line-height: 1.4;
}

.sidebar-header p {
  font-size: 9.5px;
  color: #9ca3af;
  margin-top: 4px;
  letter-spacing: 0.3px;
  line-height: 1.4;
}

.nav-menu {
  list-style: none;
  padding: 15px 0;
  flex-grow: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.nav-menu::-webkit-scrollbar {
  width: 5px;
}
.nav-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.nav-item {
  padding: 12px 25px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: #d1d5db;
  cursor: pointer;
  transition: all 0.15s;
  border-left: 4px solid transparent;
}

.nav-item:hover,
.nav-item.active {
  background-color: rgba(197, 155, 39, 0.2);
  color: white;
  border-left: 4px solid var(--accent-gold);
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-section-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #6b7fa3;
  padding: 16px 25px 6px;
}

/* ===== Main workspace ===== */
.main-workspace {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  background-color: #f8fafc;
  min-width: 0;
}

.top-bar {
  background-color: var(--card-white);
  padding: 14px 30px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
}

.liturgical-status {
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--success-bg);
  border: 1px solid var(--success-border);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 13px;
  color: #166534;
  font-weight: 600;
}

.status-dot {
  width: 9px;
  height: 9px;
  background-color: var(--success-green);
  border-radius: 50%;
}

.top-bar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.top-bar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
}

.top-bar-user a.logout-link {
  color: var(--text-muted);
  display: flex;
  align-items: center;
}
.top-bar-user a.logout-link:hover {
  color: var(--danger-red);
}

.page-content {
  padding: 30px;
}

.page-header {
  margin-bottom: 22px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.page-header h1 {
  font-size: 22px;
  color: var(--primary-blue);
}

.page-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Welcome banner (dashboard) ===== */
.hero-banner {
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  line-height: 0;
}

.hero-banner img {
  width: 100%;
  height: auto;
  display: block;
}

.welcome-banner {
  background: linear-gradient(135deg, #f4ecd8 0%, #ede0c0 100%);
  border-radius: 12px;
  padding: 28px 32px;
  margin-bottom: 26px;
  position: relative;
  overflow: hidden;
  border: 1px solid #e5d8b3;
}

.welcome-banner .crest-watermark {
  position: absolute;
  right: -20px;
  top: -30px;
  height: 220px;
  width: auto;
  opacity: 0.14;
  pointer-events: none;
}

.welcome-banner h1 {
  font-size: 24px;
  color: var(--primary-blue);
  margin-bottom: 6px;
}

.welcome-banner p {
  font-size: 14px;
  color: #5a4f36;
  max-width: 60%;
}

/* ===== Grid / cards ===== */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 26px;
}

@media (max-width: 1100px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
}

.metric-card {
  background: var(--card-white);
  padding: 18px 20px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.metric-card h3 {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  font-weight: 600;
}

.metric-card .value {
  font-size: 24px;
  font-weight: bold;
  color: var(--primary-blue);
}

.metric-card .subtext {
  font-size: 12px;
  color: var(--success-green);
  margin-top: 4px;
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .content-grid { grid-template-columns: 1fr; }
}


.card {
  background: var(--card-white);
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--border-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--primary-blue);
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border-color);
  font-size: 13px;
}
.list-item:last-child { border-bottom: none; }

.badge {
  background: #e0f2fe;
  color: #0369a1;
  padding: 3px 9px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

.badge-gold {
  background: #fdf3d9;
  color: #92700a;
}

.empty-state {
  color: var(--text-muted);
  font-size: 13px;
  padding: 20px 0;
  text-align: center;
}

/* ===== Tables ===== */
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border-color);
  padding: 10px 12px;
}

table.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border-color);
}

table.data-table tr:hover td {
  background: #fafbfc;
}

/* ===== Forms & buttons ===== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

input[type='text'],
input[type='password'],
input[type='number'],
input[type='date'],
input[type='tel'],
input[type='email'],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-dark);
  background: white;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-gold);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--primary-blue);
  color: white;
}
.btn-primary:hover { background: var(--primary-blue-light); }

.btn-gold {
  background: var(--accent-gold);
  color: white;
}
.btn-gold:hover { background: #b28a1f; }

.btn-outline {
  background: white;
  border: 1px solid var(--border-color);
  color: var(--text-dark);
}
.btn-outline:hover { border-color: var(--accent-gold); }

.card-form {
  max-width: 640px;
}

.error-banner {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger-red);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 18px;
}

/* ===== Login page ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-blue) 0%, #0f2038 100%);
}

.login-card {
  background: white;
  width: 380px;
  padding: 36px 32px;
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.login-card .crest {
  color: var(--accent-gold);
  margin-bottom: 10px;
}

.login-card h1 {
  font-size: 16px;
  color: var(--primary-blue);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.login-card p.subtitle {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

.login-card .form-group {
  text-align: left;
}

.login-card .btn-primary {
  width: 100%;
  justify-content: center;
  margin-top: 6px;
  padding: 12px;
}

.login-hint {
  margin-top: 18px;
  font-size: 11px;
  color: var(--text-muted);
  background: #f8fafc;
  border-radius: 6px;
  padding: 10px;
}

/* ===== Empty error page ===== */
.error-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  color: var(--text-dark);
}

/* ===== Mobile responsiveness (checkbox-hack sidebar, no JS dependency) ===== */
.sidebar-toggle-checkbox { display: none; }
.hamburger-btn { display: none; }
.sidebar-overlay { display: none; }

@media (max-width: 768px) {
  .app-shell { display: block; }

  .sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    height: 100vh;
    z-index: 300;
    transition: left 0.25s ease;
  }

  .sidebar-toggle-checkbox:checked ~ .sidebar {
    left: 0;
  }

  .hamburger-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 12px;
    left: 12px;
    width: 42px;
    height: 42px;
    background: var(--primary-blue);
    color: white;
    border-radius: 8px;
    z-index: 320;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 290;
  }

  .sidebar-toggle-checkbox:checked ~ .sidebar-overlay {
    display: block;
  }

  .main-workspace {
    width: 100%;
  }

  .top-bar {
    padding: 14px 16px 14px 62px;
    flex-wrap: wrap;
    gap: 8px;
    row-gap: 8px;
  }

  .liturgical-status {
    font-size: 11px;
    padding: 5px 10px;
  }

  .top-bar-user {
    font-size: 12px;
    flex-wrap: wrap;
  }

  .top-bar-user span {
    display: none; /* hide the verbose "Welcome, Name · Role" text on phones, avatar still shows */
  }

  .page-content {
    padding: 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header > div:last-child,
  .page-header > a,
  .page-header > button {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .metrics-grid {
    grid-template-columns: 1fr !important;
  }

  .card {
    padding: 14px;
    overflow-x: auto;
  }

  .welcome-banner {
    padding: 18px;
  }

  .welcome-banner h1 {
    font-size: 18px;
  }

  .welcome-banner p {
    max-width: 100%;
    font-size: 13px;
  }

  .hero-banner img {
    width: 100%;
    height: auto;
  }

  table.data-table {
    font-size: 12px;
    min-width: 480px; /* forces horizontal scroll within .card instead of squishing columns unreadably */
  }

  .login-card {
    width: 90%;
    padding: 28px 20px;
  }
}

/* ===== Help Center article pages ===== */
.help-article-wrap { max-width: 860px; }
.help-breadcrumb { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; }
.help-breadcrumb a { color: var(--primary-blue); }
.help-article-header { margin-bottom: 24px; }
.help-article-header h1 { font-size: 24px; color: var(--primary-blue); margin-bottom: 6px; }
.help-article-header p { font-size: 14px; color: var(--text-muted); }
.help-toc { background: var(--bg-light); border: 1px solid var(--border-color); border-radius: 8px; padding: 14px 18px; margin-bottom: 24px; }
.help-toc h4 { font-size: 12px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.help-toc ul { padding-left: 18px; font-size: 13px; }
.help-toc li { margin-bottom: 4px; }
.help-section { margin-bottom: 32px; }
.help-section h2 { font-size: 18px; color: var(--primary-blue); border-bottom: 2px solid var(--accent-gold); padding-bottom: 6px; margin-bottom: 12px; }
.help-section h3 { font-size: 15px; color: var(--primary-blue); margin: 16px 0 8px; }
.help-section p { font-size: 14px; line-height: 1.7; margin-bottom: 10px; color: var(--text-dark); }
.help-section ol, .help-section ul { padding-left: 22px; font-size: 14px; line-height: 1.8; margin-bottom: 12px; }
.help-section li { margin-bottom: 4px; }
.help-screenshot { border: 1px solid var(--border-color); border-radius: 8px; max-width: 100%; margin: 12px 0 18px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.help-screenshot-caption { font-size: 12px; color: var(--text-muted); font-style: italic; margin-top: -12px; margin-bottom: 18px; }
.help-tip { background: #fdf3d9; border-left: 4px solid var(--accent-gold); border-radius: 6px; padding: 10px 14px; font-size: 13px; margin: 14px 0; }
.help-tip strong { color: #7a5c00; }
.help-warning { background: #fef2f2; border-left: 4px solid var(--danger-red); border-radius: 6px; padding: 10px 14px; font-size: 13px; margin: 14px 0; color: #7f1d1d; }
.help-warning strong { color: #991b1b; }
.help-nav-footer { display: flex; justify-content: space-between; margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--border-color); }
.help-nav-footer a { font-size: 13px; }
.help-kbd { background: #f1f5f9; border: 1px solid var(--border-color); border-radius: 4px; padding: 1px 7px; font-family: monospace; font-size: 12px; }
