/* ============================================
   AMH Mailer — Brand Stylesheet
   Primary:  #016134 (Dark Green)
   Accent:   #00A85A (Leaf Green)
   ============================================ */

:root {
  --primary: #016134;
  --primary-light: #0a7a45;
  --primary-dark: #01452a;
  --accent: #00A85A;
  --accent-soft: #e6f7ee;
  --bg: #f6f8f7;
  --card: #ffffff;
  --text: #1c2b26;
  --text-muted: #6b7c76;
  --border: #e2e8e5;
  --danger: #d64545;
  --warning: #e0a800;
  --radius: 10px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.05);
  --shadow-md: 0 4px 16px rgba(1, 97, 52, .08);
  --shadow-lg: 0 12px 32px rgba(1, 97, 52, .12);
  --transition: all .18s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary); }

/* ---------- App Layout (Sidebar + Main Content) ---------- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: 260px;
    background: var(--primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
}

.sidebar-brand {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand img {
    height: 38px;
}

.sidebar-nav {
    padding: 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    overflow-y: auto;
    
    /* Hide scrollbar */
    scrollbar-width: none; 
    -ms-overflow-style: none; 
}
.sidebar-nav::-webkit-scrollbar { 
    display: none; 
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.75);
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13.5px;
    text-decoration: none;
    transition: all 0.2s;
}

.sidebar-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.sidebar-link.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(0,168,90,0.3);
}

.sidebar-divider {
    height: 1px;
    background: rgba(255,255,255,0.1);
    margin: 8px 0;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: var(--primary);
}

.sidebar-footer .user-info {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 12px;
    display: block;
}

.sidebar-footer a.logout-btn {
    display: block;
    text-align: center;
    background: rgba(255,255,255,0.1);
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s;
}

.sidebar-footer a.logout-btn:hover {
    background: #d64545;
}

/* ---------- Main Content Area ---------- */
.main-content {
    flex: 1;
    margin-left: 260px; /* Matches sidebar width */
    padding: 30px 40px;
    background: var(--bg);
    min-height: 100vh;
}

/* Container (kept for login pages, removed from main app) */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ---------- Page Headings ---------- */
h3 {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 20px;
  letter-spacing: -.2px;
}

h4 {
  font-size: 17px;
  font-weight: 600;
  color: var(--primary);
  margin: 28px 0 14px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 4px;
  background: var(--accent);
}
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat .label {
  color: var(--text-muted);
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .8px;
  font-weight: 600;
}
.stat .value {
  font-size: 30px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 6px;
  line-height: 1;
}
.stat.accent::before { background: var(--accent); }
.stat.primary::before { background: var(--primary); }

/* ---------- Forms ---------- */
label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  transition: var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0,168,90,.12);
}

textarea {
  resize: vertical;
  min-height: 200px;
  line-height: 1.6;
}

select[multiple] {
  padding: 6px;
  min-height: 200px;
}
select[multiple] option {
  padding: 8px 10px;
  border-radius: 6px;
  margin-bottom: 2px;
}
select[multiple] option:checked {
  background: var(--accent) linear-gradient(0deg, var(--accent), var(--accent));
  color: #fff;
}

.form-group { margin-bottom: 18px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 22px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: .2px;
  border: none;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-light);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover {
  background: #00934e;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0,168,90,.3);
}

.btn-secondary {
  background: #eef2f0;
  color: var(--primary);
}
.btn-secondary:hover {
  background: #e0e8e4;
  color: var(--primary-dark);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--primary);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.btn-danger {
  background: #fdecec;
  color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-block { width: 100%; }

/* ---------- Tables ---------- */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.table th {
  background: #f3f7f5;
  color: var(--primary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 700;
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text);
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr { transition: var(--transition); }
.table tbody tr:hover { background: #fafcfb; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 20px;
  letter-spacing: .3px;
  text-transform: capitalize;
}

.badge-success { background: var(--accent-soft); color: var(--primary); }
.badge-danger  { background: #fdecec; color: var(--danger); }
.badge-warning { background: #fff3cd; color: #856404; }
.badge-staff   { background: #e6f0ff; color: #1a5fb4; }
.badge-vendor  { background: #fff4e0; color: #a06a00; }
.badge-secondary { background: #eef2f0; color: var(--text-muted); }

/* ---------- Alerts ---------- */
.alert {
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13.5px;
  border-left: 4px solid;
  background: #fff;
}
.alert-info    { background: var(--accent-soft); border-color: var(--accent); color: var(--primary); }
.alert-danger  { background: #fdecec; border-color: var(--danger); color: #8b2a2a; }
.alert-success { background: var(--accent-soft); border-color: var(--accent); color: var(--primary); }
.alert-secondary { background: #f3f7f5; border-color: var(--border); color: var(--text-muted); }

.alert code {
  background: rgba(0,0,0,.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12.5px;
}

/* ---------- Login Page ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.login-wrapper::before {
  content: '';
  position: absolute;
  top: -100px; right: -100px;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(0,168,90,.35) 0%, transparent 70%);
  border-radius: 50%;
}
.login-wrapper::after {
  content: '';
  position: absolute;
  bottom: -150px; left: -100px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(0,168,90,.2) 0%, transparent 70%);
  border-radius: 50%;
}

.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 42px 38px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 60px rgba(0,0,0,.25);
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo img {
  height: 54px;
  width: auto;
}
.login-card h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  margin: 0 0 6px;
  text-align: center;
}
.login-card p.subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 26px;
}

/* ---------- Archive view ---------- */
.mail-body-preview {
  background: #fafcfb;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  margin-top: 12px;
  line-height: 1.7;
  color: var(--text);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin-top: 20px;
}
.pagination a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--primary);
  font-weight: 600;
  font-size: 13px;
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination a.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ---------- Utility ---------- */
.text-muted { color: var(--text-muted); }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.row { display: grid; gap: 14px; }
.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: 2fr 1fr; }
td form { display: inline-block; margin: 0 2px; }

/* Mobile Responsive */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
}
@media (max-width: 640px) {
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .container { padding: 20px 16px 48px; }
}