/* TPA Datawarehouse — Mobile-first responsive CSS */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #1A4F8A;
  color: white;
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

@media (min-width: 600px) {
  header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
  }
  header nav {
    justify-self: end;
  }
}

header .logo {
  font-size: 1.25rem;
  font-weight: bold;
}

header nav {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

header nav a {
  color: white;
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  transition: background 0.2s;
}

header nav a:hover {
  background: rgba(255, 255, 255, 0.1);
}

header nav button {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

header nav button:hover {
  background: rgba(255, 255, 255, 0.3);
}

main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1rem;
}

h1, h2, h3 {
  margin-bottom: 1rem;
  color: #1A4F8A;
}

section {
  background: white;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

label {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

input[type="file"] {
  padding: 0.5rem 0;
  width: 100%;
  cursor: pointer;
}

input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
  padding: 0.75rem;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 1rem;
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: #1A4F8A;
}

button[type="submit"],
.btn {
  background: #1A4F8A;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

button[type="submit"]:hover,
.btn:hover {
  background: #143d6d;
}

table {
  width: 100%;
  border-collapse: collapse;
  overflow-x: auto;
  display: block;
}

@media (min-width: 768px) {
  table {
    display: table;
  }
}

thead {
  background: #f0f0f0;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

th {
  font-weight: 600;
}

.flash {
  padding: 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}

.flash.error {
  background: #fee;
  color: #c33;
  border: 1px solid #fcc;
}

.flash.success {
  background: #efe;
  color: #3c3;
  border: 1px solid #cfc;
}

a {
  color: #1A4F8A;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.staff-nav {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.staff-card {
  background: white;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  padding: 1.5rem 1rem;
  text-align: center;
  color: #1A4F8A;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  display: block;
}
.staff-card:hover {
  border-color: #1A4F8A;
  box-shadow: 0 2px 8px rgba(26, 79, 138, 0.15);
  text-decoration: none;
}

.back-link {
  color: #666;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  display: inline-block;
}
.back-link:hover { text-decoration: underline; }

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.section-header h1 { margin-bottom: 0; }

.count { color: #888; font-size: 0.8em; font-weight: normal; }

.reveal-pwd { color: #1A4F8A; }
.reveal-pwd.revealed { color: #c33; font-family: monospace; font-size: 0.9rem; }

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}
.header-brand:hover { text-decoration: none; }
.logo-img { height: 36px; display: block; }
.brand-name { color: white; font-weight: 400; font-size: 0.95rem; }
.header-title { color: white; font-weight: 700; font-size: 1.4rem; letter-spacing: 0.12em; text-align: center; }
.user-name { color: white; text-decoration: none; }
.user-name:hover { text-decoration: underline; }

.badge-enabled { color: #2a7a2a; font-weight: 600; }
.badge-disabled { color: #c33; font-weight: 600; }

.btn-small {
  background: #1A4F8A;
  color: white;
  border: none;
  padding: 0.35rem 0.75rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}
.btn-small:hover { background: #143d6d; }

.btn-icon {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
}
.btn-icon:hover { background: #f0f0f0; }

.btn-cancel {
  background: #888;
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1rem;
}
.btn-cancel:hover { background: #666; }

.dialog-buttons {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

footer {
  text-align: center;
  padding: 1.5rem 1rem;
  margin-top: 3rem;
  border-top: 1px solid #e0e0e0;
  color: #aaa;
  font-size: 0.8rem;
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
footer a { color: #aaa; }
footer a:hover { color: #666; }

.bonus-groups { display: flex; flex-direction: column; gap: 0.5rem; }

.bonus-period {
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
}

.bonus-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8f8f8;
  cursor: pointer;
  list-style: none;
  gap: 1rem;
  flex-wrap: wrap;
}
.bonus-summary::-webkit-details-marker { display: none; }
.bonus-period[open] .bonus-summary { background: #eef3fa; border-bottom: 1px solid #d0d8e8; }

.period-label { font-weight: 600; color: #1A4F8A; }
.period-totals { font-size: 0.9rem; color: #555; }

.bonus-grand-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #1A4F8A;
  color: white;
  border-radius: 0 0 6px 6px;
  flex-wrap: wrap;
  gap: 1rem;
}
.bonus-grand-total .period-label { color: white; font-weight: 700; }
.bonus-grand-total .period-totals { color: white; }
.bonus-grand-total strong { color: white; }

.bonus-table { margin: 0; border-radius: 0; }
.bonus-table th, .bonus-table td { padding: 0.5rem 1rem; font-size: 0.85rem; vertical-align: top; }
.bonus-table tbody tr { border-top: 1px solid #f0f0f0; }
.record-type { color: #666; font-size: 0.78rem; }
.record-date { display: block; font-size: 0.72rem; color: #aaa; margin-bottom: 0.15rem; }
.ind-green  { color: #00cc44; margin-right: 0.3rem; }
.ind-red    { color: #ff2222; margin-right: 0.3rem; }
.ind-yellow { color: #ffcc00; margin-right: 0.3rem; }
.record-desc { max-width: 400px; white-space: pre-wrap; font-size: 0.82rem; }
.record-value { text-align: right; white-space: nowrap; }

.doc-list { padding-left: 1.2rem; }
.doc-list li { margin-bottom: 0.4rem; }

dialog {
  border: none;
  border-radius: 8px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25);
  padding: 2rem;
  width: min(420px, 90vw);
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
}
dialog::backdrop { background: rgba(0,0,0,0.45); }
dialog h3 { margin-bottom: 0.5rem; }

.perm-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 1rem 0;
}
.perm-list label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: normal;
  cursor: pointer;
}

.nav-divider {
  grid-column: 1 / -1;
  border-top: 1px solid #e0e0e0;
  margin: 0.25rem 0;
}

.news-list { display: flex; flex-direction: column; gap: 1rem; }

.news-card {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0.75rem 0;
  border-bottom: 1px solid #f0f0f0;
}
.news-card:last-child { border-bottom: none; }

.news-thumb {
  flex-shrink: 0;
  width: 72px;
  height: 4.8rem;
  overflow: hidden;
  border-radius: 4px;
}
.news-thumb img { width: 100%; height: 100%; object-fit: cover; }

.news-body { flex: 1; min-width: 0; }

.news-title { font-weight: 600; color: #1A4F8A; margin-bottom: 0.2rem; font-size: 0.95rem; }

.news-preview {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-size: 0.88rem;
  color: #444;
  line-height: 1.5;
}

.news-read-more {
  background: none;
  border: none;
  color: #1A4F8A;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0;
  margin-top: 0.35rem;
  text-decoration: underline;
}

.news-full-img {
  width: 100%;
  max-height: 12rem;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 1rem;
  display: block;
}
