:root {
  --bg: #f3f4f1;
  --panel: #ffffff;
  --ink: #1f2a24;
  --muted: #6b7570;
  --line: #e2e5e0;
  --primary: #2f6e4e;
  --primary-dark: #244f39;
  --danger: #a13d3d;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 24px; }

.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card p.sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }

label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
input[type=text], input[type=password] {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 16px;
  background: #fff;
}
input:focus { outline: 2px solid var(--primary); outline-offset: 1px; }

button, .btn {
  cursor: pointer;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  background: var(--primary);
  color: white;
}
button:hover, .btn:hover { background: var(--primary-dark); }
button.secondary, .btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button.danger { background: var(--danger); }
button:disabled { opacity: .6; cursor: not-allowed; }

.error { color: var(--danger); font-size: 13px; margin: -8px 0 14px; min-height: 16px; }

header.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: var(--panel); border-bottom: 1px solid var(--line);
}
header.topbar .brand { font-weight: 700; font-size: 18px; letter-spacing: .3px; }
header.topbar .user-info { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }

.grid-modules {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 24px;
}
.module-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  text-decoration: none;
  color: var(--ink);
  display: block;
}
.module-card h3 { margin: 8px 0 4px; font-size: 16px; }
.module-card p { margin: 0; font-size: 13px; color: var(--muted); }
.module-card .icon { font-size: 26px; }
.module-card.disabled { opacity: .45; pointer-events: none; }

table { width: 100%; border-collapse: collapse; margin-top: 16px; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
th { background: #eef0ec; font-weight: 700; color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .04em; }
tr:last-child td { border-bottom: none; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge.admin { background: #e7f3ec; color: var(--primary-dark); }
.badge.staff { background: #eef0ec; color: var(--ink); }
.badge.viewer { background: #f1f1ee; color: var(--muted); }
.badge.off { background: #fbeaea; color: var(--danger); }

.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal { background: var(--panel); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 420px; max-height: 90vh; overflow-y: auto; }
.modal h2 { margin-top: 0; font-size: 17px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 14px; }
.checkbox-row input { width: auto; margin: 0; }
.actions-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; }
.hint { font-size: 12px; color: var(--muted); margin-top: -10px; margin-bottom: 16px; }
