﻿:root {
  --navy: #0d2d6a;
  --navy-dark: #0b1f47;
  --blue: #2a5dbb;
  --blue-light: #eaf1ff;
  --green: #38a152;
  --red: #d93a3a;
  --orange: #f06b3f;
  --gray: #f4f6fb;
  --text: #1f2a44;
  --surface: #ffffff;
  --surface-soft: #f5f8ff;
  --border: #d8e1f5;
  --shadow: 0 12px 30px rgba(13, 45, 106, 0.18);
}

* {
  box-sizing: border-box;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

body {
  margin: 0;
  background: radial-gradient(circle at top left, #e9f2ff, #f9fbff 60%, #eef3ff);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(circle at 15% 10%, rgba(42, 93, 187, 0.12), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(56, 161, 82, 0.12), transparent 45%),
    radial-gradient(circle at 20% 80%, rgba(240, 107, 63, 0.12), transparent 50%);
  z-index: -1;
}

.hidden {
  display: none !important;
}

.app {
  min-height: 100vh;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 16px;
}

.login-card {
  width: min(420px, 100%);
  background: white;
  border-radius: 24px;
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(13, 45, 106, 0.08);
  text-align: center;
}

.login-card .seal {
  width: 90px;
  height: 90px;
  margin-bottom: 12px;
}

.login-card h1 {
  margin: 8px 0 4px;
  color: var(--navy);
  letter-spacing: 0.5px;
}

.subtitle {
  margin: 0 0 24px;
  color: #355090;
}

.input-field {
  display: block;
  text-align: left;
  margin-bottom: 16px;
  color: #2e3b5f;
  font-weight: 600;
}

.input-field span {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.input-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f9fbff;
  outline: none;
}

.input-field input:focus {
  border-color: rgba(42, 93, 187, 0.6);
  box-shadow: 0 0 0 3px rgba(42, 93, 187, 0.12);
}

.password-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.primary-btn,
.green-btn {
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
  color: white;
  background: linear-gradient(120deg, #1f4fa6, #2a79ff);
  box-shadow: 0 10px 18px rgba(34, 95, 190, 0.22);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.green-btn {
  background: linear-gradient(120deg, #2f8a46, #3ab55a);
}

.primary-btn:hover,
.green-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.ghost-btn,
.link-btn {
  border: none;
  background: transparent;
  color: #2b4b84;
  font-weight: 600;
  cursor: pointer;
}

.link-btn {
  display: block;
  margin: 12px auto 0;
}

.footer {
  margin-top: 24px;
  font-size: 12px;
  color: #7a86a6;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: linear-gradient(120deg, var(--navy), var(--blue));
  color: white;
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 40;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand img {
  width: 58px;
  height: 58px;
  background: transparent;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.2);
}

.brand strong {
  display: block;
  font-size: 19px;
  line-height: 1.15;
  letter-spacing: 0.3px;
}

.brand span {
  font-size: 13px;
  opacity: 0.85;
}

.top-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.action-group {
  position: relative;
}

.icon-btn {
  border: none;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ff4d4d;
  color: white;
  font-size: 10px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid rgba(13, 45, 106, 0.85);
}

.dropdown-panel {
  position: absolute;
  top: 46px;
  right: 0;
  width: min(320px, 70vw);
  background: white;
  color: var(--text);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 12px;
  z-index: 30;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.ghost-btn.small {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 8px;
  background: #eef2ff;
}

.panel-list {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
}

.panel-item {
  background: #f4f7ff;
  border-radius: 10px;
  padding: 10px;
}

.panel-item.unread {
  border-left: 4px solid var(--blue);
  background: #eef4ff;
}

.panel-title {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 4px;
}

.panel-message {
  font-size: 12px;
  color: #3a4b70;
}

.panel-message + .panel-message {
  margin-top: 4px;
}

.panel-meta {
  font-size: 11px;
  color: #7a86a6;
  margin-top: 6px;
}

.panel-empty {
  font-size: 12px;
  color: #7a86a6;
  margin: 8px 0 0;
}

.primary-btn.compact {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 8px;
}

.ghost-btn.danger {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffecec;
  color: #b53131;
  font-weight: 700;
  margin-top: 10px;
}

.help-details {
  background: #f7f9ff;
  border-radius: 10px;
  padding: 10px;
  font-size: 12px;
  color: #3b4f7d;
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.tabs {
  display: flex;
  gap: 12px;
  padding: 12px 24px 0;
  background: #f3f6ff;
  border-bottom: 1px solid #e1e7f6;
  position: sticky;
  top: 72px;
  z-index: 30;
}

.tab-btn {
  border: none;
  background: transparent;
  padding: 10px 18px;
  border-radius: 10px 10px 0 0;
  font-weight: 700;
  color: #2b457a;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.tab-btn.active {
  background: white;
  box-shadow: 0 -4px 16px rgba(13, 45, 106, 0.12);
  color: var(--navy);
}

.content {
  padding: 24px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.stat-card {
  border-radius: 16px;
  padding: 18px;
  color: white;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.stat-card.clickable {
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.stat-card.clickable:hover {
  transform: translateY(-2px);
  filter: brightness(1.03);
}

.stat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0.2), transparent 45%);
  opacity: 0.6;
}

.stat-card strong {
  font-size: 32px;
  display: block;
  margin-top: 6px;
}

.stat-card.blue { background: linear-gradient(135deg, #1b4fa0, #2a7cff); }
.stat-card.green { background: linear-gradient(135deg, #2b8d46, #3fcb69); }
.stat-card.red { background: linear-gradient(135deg, #d32f2f, #ff5f5f); }
.stat-card.orange { background: linear-gradient(135deg, #e05b2d, #ff8a4c); }

.time-row {
  display: flex;
  gap: 16px;
  padding: 18px 4px 4px;
  font-weight: 600;
  color: #2b3f6d;
}

.card {
  background: white;
  padding: 18px;
  border-radius: 16px;
  box-shadow: var(--shadow);
  margin-top: 18px;
  border: 1px solid rgba(13, 45, 106, 0.06);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table tbody tr:nth-child(even) {
  background: #f8faff;
}

.data-table tbody tr:hover {
  background: #eef3ff;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf0f7;
  text-align: left;
}

.data-table th {
  color: #2d3f6f;
}

.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #e8ecf7;
}

.data-table td.status-present { color: #2f8f48; font-weight: 700; }
.data-table td.status-late { color: #d32f2f; font-weight: 700; }
.data-table td.status-absent { color: #f06b3f; font-weight: 700; }
.stat-loading td {
  text-align: center;
  color: #6673a0;
  font-style: italic;
  padding: 18px 12px;
}

.table-photo {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid #d6def2;
  background: #f0f4ff;
}

.table-location {
  font-size: 12px;
  color: #3a4b70;
}

.table-action-btn {
  padding: 6px 10px;
  border-radius: 8px;
  border: none;
  background: #1f4bb8;
  color: #fff;
  font-size: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.table-action-btn.ghost {
  background: #eef2ff;
  color: #1f4bb8;
  border: 1px solid #cdd7f5;
}

.table-action-btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.03);
}

.summary-cell {
  max-width: 260px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-row {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.search-row input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d8e1f5;
}

.filters {
  display: flex;
  gap: 10px;
}

.filters input {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #d8e1f5;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

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

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
}

.form-grid input,
.form-grid select {
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d8e1f5;
  background: #f9fbff;
}

.report-actions {
  margin-top: 16px;
  display: flex;
  gap: 12px;
}

.report-preview {
  margin-top: 18px;
  padding: 12px;
  background: #f6f8ff;
  border-radius: 12px;
  min-height: 80px;
}

.dtr-sheet {
  background: white;
  border: 1px solid #222;
  padding: 16px;
  font-family: "Times New Roman", serif;
  color: #1b1b1b;
}

.dtr-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.dtr-title {
  font-weight: 700;
  font-size: 18px;
}

.dtr-sub {
  font-size: 12px;
  margin-top: 2px;
}

.dtr-formno {
  font-size: 12px;
}

.dtr-meta {
  display: flex;
  gap: 18px;
  font-size: 11px;
  margin: 6px 0 10px;
}

.dtr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.dtr-table th,
.dtr-table td {
  border: 1px solid #222;
  padding: 4px;
}

.center {
  text-align: center;
}

.absent {
  font-weight: 700;
  letter-spacing: 2px;
}

.weekend {
  color: #a00;
  font-weight: 700;
}

.dtr-footer {
  margin-top: 14px;
  font-size: 11px;
}

.dtr-total {
  font-weight: 700;
  margin-bottom: 8px;
}

.dtr-signatures {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}

.dtr-signatures .line {
  flex: 1;
  border-bottom: 1px solid #222;
  height: 1px;
}

.dtr-office {
  margin-top: 6px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(7, 15, 30, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 200;
}

.modal-card {
  width: min(680px, 100%);
  background: white;
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.modal-card.large {
  width: min(900px, 96vw);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}

#stat-modal {
  place-items: start center;
  padding-top: 90px;
}

.modal-body {
  overflow: auto;
  max-height: 62vh;
}

.modal-subtitle {
  margin: 0 0 10px;
  font-size: 12px;
  color: #6673a0;
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}

@media (max-width: 780px) {
  .tabs {
    flex-wrap: wrap;
  }
  .time-row {
    flex-direction: column;
  }
  .form-grid.two {
    grid-template-columns: 1fr;
  }
}
