@import url('https://fonts.googleapis.com/css2?family=Niramit:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; }

body, button, input, select, textarea {
  font-family: 'Niramit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, Arial, sans-serif;
}

body {
  margin: 0;
  background: #f6f7fb;
  color: #1f2937;
  line-height: 1.55;
  font-weight: 400;
}

a { color: #0f766e; }

/* Top bar */
.topbar {
  background: #115e59;
  color: #fff;
  padding: 12px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.topbar.topbar-home { padding: 16px 22px; }
.topbar h1, .topbar .brand a {
  margin: 0;
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  text-decoration: none;
}
.topbar .ctx       { color: #ccfbf1; font-size: 14px; }
.topbar .ctx-id    { background: rgba(255,255,255,0.15); padding: 2px 8px; border-radius: 999px; margin-right: 6px; font-weight: 600; font-size: 12px; }

.topnav { margin-left: auto; display: flex; gap: 4px; flex-wrap: wrap; }
.topnav a {
  color: #ccfbf1; text-decoration: none; font-size: 14px;
  padding: 4px 10px; border-radius: 4px;
}
.topnav a:hover { background: rgba(255,255,255,.18); color: #fff; }
.topnav a.switch { color: #fde68a; }

.btn-sync {
  margin-left: auto;
  background: #fff; color: #115e59;
  padding: 7px 14px; border-radius: 5px;
  text-decoration: none; font-weight: 600; font-size: 14px;
}
.btn-sync:hover { background: #ccfbf1; }

/* Layout */
.container { max-width: 1140px; margin: 24px auto; padding: 0 20px; }
h2, h3 { color: #115e59; margin-top: 28px; }
h2:first-child, h3:first-child { margin-top: 0; }
.muted { color: #6b7280; font-size: 13px; }

/* Leader cards */
.leader-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.leader-card {
  background: #fff; padding: 22px;
  border-radius: 10px; text-decoration: none;
  color: #1f2937; border: 2px solid #e5e7eb;
  transition: all .18s;
  display: block;
}
.leader-card:hover { border-color: #115e59; transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.06); }
.leader-id   { font-weight: 700; color: #115e59; font-size: 13px; letter-spacing: .5px; }
.leader-name { font-size: 16px; margin-top: 6px; font-weight: 600; }
.leader-sub  { font-size: 13px; color: #6b7280; margin-top: 4px; }

/* Dashboard cards */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.card { background: #fff; padding: 22px; border-radius: 10px; border: 1px solid #e5e7eb; }
.card-num   { font-size: 30px; font-weight: 700; color: #115e59; line-height: 1; }
.card-label { color: #4b5563; margin: 8px 0 12px; font-size: 14px; }
.card a     { text-decoration: none; font-size: 14px; font-weight: 600; }

/* Two-column layout */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.member-list {
  list-style: none; padding: 0; margin: 0;
  max-height: 560px; overflow-y: auto;
  border: 1px solid #e5e7eb; border-radius: 8px; background: #fff;
}
.member-list li {
  padding: 10px 14px; display: flex;
  justify-content: space-between; align-items: center;
  border-bottom: 1px solid #f3f4f6; gap: 10px;
}
.member-list li:last-child { border-bottom: none; }
.member-list form { margin: 0; }

.search {
  width: 100%; padding: 9px 12px;
  margin-bottom: 8px; border: 1px solid #d1d5db;
  border-radius: 6px; font-size: 14px;
}

/* Buttons */
.btn-primary, .btn-danger, .btn-sm {
  padding: 8px 16px; border: none; border-radius: 5px;
  font-weight: 600; cursor: pointer; font-size: 14px;
}
.btn-primary { background: #115e59; color: #fff; }
.btn-primary:hover { background: #0f766e; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* Flash messages */
.flash       { background: #d1fae5; color: #065f46; padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.flash-warn  { background: #fef3c7; color: #92400e; }
.flash-err   { background: #fee2e2; color: #991b1b; }

/* Tables */
.data-table {
  width: 100%; border-collapse: collapse;
  background: #fff; border-radius: 8px;
  overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05);
  margin-bottom: 14px;
}
.data-table th, .data-table td {
  padding: 10px 14px; text-align: left;
  border-bottom: 1px solid #f3f4f6;
  font-size: 14px; vertical-align: top;
}
.data-table th { background: #f9fafb; color: #374151; font-weight: 600; }
.data-table tr:last-child td { border-bottom: none; }
.data-table input[type=text],
.data-table input[type=number],
.data-table select {
  padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px;
}
.score-in { width: 70px; }
.note-in  { width: calc(100% - 80px); margin-left: 6px; }

/* Week / filter bars */
.week-nav, .filter-bar {
  display: flex; gap: 14px; align-items: center;
  margin: 18px 0; flex-wrap: wrap;
}
.week-nav a, .filter-bar a { color: #115e59; text-decoration: none; font-weight: 600; }
.week-nav input[type=date], .filter-bar input[type=date] {
  padding: 6px 8px; border: 1px solid #d1d5db; border-radius: 4px;
}
.link-right { margin-left: auto; }
.filter-bar label { display: flex; gap: 6px; align-items: center; font-size: 14px; color: #4b5563; }

/* Percentage badges */
.pct          { font-weight: 700; padding: 2px 8px; border-radius: 999px; font-size: 13px; }
.pct-good     { background: #d1fae5; color: #065f46; }
.pct-mid      { background: #fef3c7; color: #92400e; }
.pct-bad      { background: #fee2e2; color: #991b1b; }

/* Admin / category forms */
.card-form {
  background: #fff; padding: 14px;
  border-radius: 8px; border: 1px solid #e5e7eb;
  margin-bottom: 12px;
  display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end;
}
.card-form label {
  display: flex; flex-direction: column;
  font-size: 13px; color: #4b5563; gap: 4px;
}
.card-form input {
  padding: 7px 10px; border: 1px solid #d1d5db;
  border-radius: 4px; font-size: 14px;
}
.card-form .checkbox { flex-direction: row; align-items: center; gap: 6px; padding-bottom: 4px; }
.row-form { background: #f9fafb; }

.footer-link { margin-top: 30px; }
.footer-link a { color: #6b7280; font-size: 13px; }

/* Language toggle pill */
.lang-toggle {
  display: inline-flex;
  border: 1px solid rgba(255,255,255,0.4);
  border-radius: 999px;
  overflow: hidden;
  font-size: 12px;
  margin-left: 8px;
  flex-shrink: 0;
  background: rgba(0,0,0,0.12);
}
.lang-toggle a {
  padding: 5px 14px;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.3px;
  transition: all .15s;
}
.lang-toggle a:hover { color: #fff; }
.lang-toggle a.active {
  background: #fff;
  color: #115e59;
  font-weight: 700;
}
.lang-toggle a + a { border-left: 1px solid rgba(255,255,255,0.25); }
.lang-toggle a.active + a, .lang-toggle a + a.active { border-left: none; }

@media (max-width: 720px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .topnav { order: 99; flex-basis: 100%; margin-left: 0; }
  .lang-toggle { margin-left: auto; }
}

/* Print */
@media print {
  .topbar, .topnav, .week-nav, .filter-bar, .btn-primary, .btn-sync, .lang-toggle { display: none !important; }
  body { background: #fff; }
  .data-table { box-shadow: none; }
}
