:root {
  --background: #091321;
  --sidebar: #0d192a;
  --panel: #111f33;
  --panel-dark: #0c1727;
  --line: #304866;
  --text: #eff6ff;
  --muted: #a9bbd0;
  --blue: #2563eb;
  --green: #16a34a;
  --yellow: #d97706;
  --red: #dc2626;
  --purple: #7c3aed;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--background);
  color: var(--text);
}

header {
  min-height: 70px;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--sidebar);
  border-bottom: 1px solid var(--line);
}

body.user-mode header {
  display: none;
}

button {
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  color: white;
  background: var(--blue);
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

button:hover {
  opacity: 0.88;
}

.btn-secondary {
  background: #334155;
}

.btn-success {
  background: var(--green);
}

.btn-warning {
  background: var(--yellow);
}

.btn-danger {
  background: #b91c1c;
}

.btn-purple {
  background: var(--purple);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon,
.hub-icon {
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--blue);
  color: white;
  font-weight: bold;
}

.brand-icon {
  width: 40px;
  height: 40px;
  font-size: 16px;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
}

.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.user-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.user-hub {
  width: min(880px, 100%);
  text-align: center;
}

.user-hub-title {
  margin-bottom: 28px;
}

.hub-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  font-size: 24px;
}

.user-hub-title h1 {
  margin: 0;
  font-size: 34px;
}

.user-hub-title p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.user-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.user-menu-card {
  min-height: 210px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
  text-align: center;
}

.user-menu-card:hover {
  transform: translateY(-3px);
  border-color: var(--blue);
  opacity: 1;
}

.attendance-card {
  background: linear-gradient(145deg, #17345d, #111f33);
}

.instructions-card {
  background: linear-gradient(145deg, #2c2554, #111f33);
}

.admin-card {
  background: linear-gradient(145deg, #20334a, #111f33);
}

.portal-card-link {
  background: linear-gradient(145deg, #15483f, #111f33);
}

.user-menu-icon {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  font-size: 27px;
}

.user-menu-title {
  font-size: 19px;
  font-weight: bold;
}

.user-menu-text {
  margin-top: 8px;
  color: #c7d5e7;
  font-size: 13px;
  font-weight: normal;
  line-height: 1.4;
}

.user-instructions {
  max-width: 650px;
  margin: 22px auto 0;
  padding: 20px 26px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--muted);
  text-align: left;
  line-height: 1.6;
}

.user-instructions h3,
.user-instructions strong {
  color: var(--text);
}

.page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 28px 20px;
}

.hidden {
  display: none !important;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
}

.inner-card {
  background: var(--panel-dark);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
}

.attendance-user-card {
  max-width: 720px;
  margin: 45px auto;
  padding: 30px;
}

.attendance-user-card h2 {
  margin: 16px 0 0;
  text-align: center;
  font-size: 30px;
}

.user-page-top {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.kiosk-subtitle {
  margin: 8px 0 25px;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}

.user-form-actions {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.kiosk-message {
  min-height: 68px;
  margin-top: 20px;
  padding: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1727;
  color: var(--muted);
  text-align: center;
  line-height: 1.4;
}

.message-success {
  border-color: rgba(34, 197, 94, 0.55);
  background: rgba(34, 197, 94, 0.1);
  color: #86efac;
}

.message-error {
  border-color: rgba(239, 68, 68, 0.55);
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.message-info {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.1);
  color: #93c5fd;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
}

.form-group.full {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #091522;
  color: var(--text);
  font-size: 15px;
}

textarea {
  min-height: 76px;
  resize: vertical;
}

.form-actions {
  margin-top: 15px;
}

.kiosk-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
  margin-top: 22px;
}

.kiosk-actions button {
  min-height: 90px;
  border-radius: 10px;
  font-size: 21px;
}

.login-card {
  max-width: 470px;
  margin: 32px auto;
}

.login-card h2 {
  margin-top: 22px;
}

.login-card .form-group {
  margin-bottom: 14px;
}

.login-card button[type="submit"] {
  width: 100%;
}

.muted {
  color: var(--muted);
  line-height: 1.4;
}

.page-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.page-title h2 {
  margin: 0;
  font-size: 26px;
}

.page-title p {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.4;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.section-title {
  margin: 0 0 6px;
  font-size: 18px;
}

.section-subtitle {
  margin: 0 0 17px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.section-gap {
  margin-top: 18px;
}

.no-top-margin {
  margin-top: 0;
}

.collapsible-body.collapsed {
  display: none;
}

.admin-section {
  margin-bottom: 18px;
  border-top: 3px solid var(--blue);
  scroll-margin-top: 18px;
}

.leave-section {
  border-top-color: var(--purple);
}

.admin-layout {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  transition: grid-template-columns 0.2s ease;
}

.admin-layout.menu-collapsed {
  grid-template-columns: 65px minmax(0, 1fr);
}

.admin-menu {
  position: sticky;
  top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--sidebar);
}

.admin-menu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}

.admin-menu-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  white-space: nowrap;
}

.menu-toggle {
  width: 100%;
  padding: 9px;
  background: #334155;
}

.admin-menu nav {
  padding: 8px;
}

.menu-button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 3px 0;
  padding: 11px 10px;
  border-radius: 7px;
  background: transparent;
  color: #cfdaea;
  text-align: left;
  white-space: nowrap;
}

.menu-button:hover {
  background: #1a2d48;
  color: white;
}

.menu-icon {
  width: 22px;
  text-align: center;
  font-size: 16px;
}

.admin-layout.menu-collapsed .menu-label,
.admin-layout.menu-collapsed .admin-menu-title {
  display: none;
}

.admin-layout.menu-collapsed .menu-button {
  justify-content: center;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 15px;
}

.metric-card {
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}

.metric-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.metric-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: bold;
}

.metric-text {
  font-size: 20px;
}

.metric-note {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
}

.leave-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.leave-summary-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-dark);
}

.leave-summary-card .label {
  color: var(--muted);
  font-size: 10px;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.leave-summary-card .value {
  margin-top: 7px;
  font-size: 23px;
  font-weight: bold;
}

.success-text {
  color: #86efac;
}

.warning-text {
  color: #fcd34d;
}

.blue-text {
  color: #93c5fd;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.admin-toolbar input {
  max-width: 340px;
  padding: 10px;
  font-size: 13px;
}

.admin-toolbar select {
  width: auto;
  padding: 10px;
  font-size: 13px;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(290px, 1fr);
  gap: 16px;
  margin-top: 18px;
}

.equal-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th {
  padding: 12px;
  background: #1a2d48;
  color: #c3d2e5;
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

td {
  padding: 12px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  vertical-align: top;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

.badge {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 10px;
  font-weight: bold;
}

.badge-green {
  color: #86efac;
  background: rgba(34, 197, 94, 0.18);
}

.badge-yellow {
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.18);
}

.badge-red {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.18);
}

.badge-blue {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.18);
}

.badge-gray {
  color: #dbe4ef;
  background: rgba(100, 116, 139, 0.25);
}

.badge-purple {
  color: #d8b4fe;
  background: rgba(124, 58, 237, 0.2);
}

.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.list-item:last-child {
  border-bottom: 0;
}

.list-title {
  font-size: 13px;
  font-weight: bold;
}

.list-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.small-muted {
  color: var(--muted);
  font-size: 11px;
}

.attendance-day {
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--panel-dark);
}

.attendance-day-header {
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #182d49;
  color: white;
  text-align: left;
  font-size: 14px;
}

.attendance-day-header:hover {
  background: #213b5f;
}

.attendance-day-title {
  font-weight: bold;
}

.attendance-day-count {
  color: #c9dbef;
  font-size: 12px;
  font-weight: normal;
}

.attendance-day-body.collapsed {
  display: none;
}

.attendance-day-body .table-wrap {
  border: 0;
  border-radius: 0;
}

.compact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compact-actions button {
  padding: 7px 9px;
  font-size: 11px;
}

.backup-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.import-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 7px;
  background: #334155;
  color: white;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.import-label input {
  display: none;
}

.empty {
  padding: 26px;
  color: var(--muted);
  text-align: center;
}

.notice {
  margin-top: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

/* ==========================================================================
   Base refinements for touch devices
   ========================================================================== */

html {
  -webkit-text-size-adjust: 100%;
}

button,
.import-label {
  touch-action: manipulation;
}

@supports (height: 100dvh) {
  body,
  .user-screen {
    min-height: 100dvh;
  }
}

/* No hover lift on touch screens, where it just sticks after a tap */
@media (hover: none) {
  .user-menu-card:hover {
    transform: none;
  }

  button:hover {
    opacity: 1;
  }
}

/* ==========================================================================
   Tablet and below (960px): single-column dashboard, sticky section nav
   ========================================================================== */

@media (max-width: 960px) {
  .admin-layout,
  .admin-layout.menu-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  /* The collapse toggle has no job when the menu is a top bar */
  .admin-menu-top {
    display: none;
  }

  .admin-menu {
    position: sticky;
    top: 0;
    z-index: 20;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
  }

  .admin-menu nav {
    display: flex;
    gap: 6px;
    padding: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .admin-menu nav::-webkit-scrollbar {
    display: none;
  }

  .menu-button {
    width: auto;
    min-width: max-content;
    flex: 0 0 auto;
    margin: 0;
    padding: 10px 14px;
    border: 1px solid var(--line);
    background: #14253d;
  }

  .admin-layout.menu-collapsed .menu-label {
    display: inline;
  }

  .admin-layout.menu-collapsed .menu-button {
    justify-content: flex-start;
  }

  .admin-section {
    scroll-margin-top: 76px;
  }

  .two-column,
  .equal-columns {
    grid-template-columns: minmax(0, 1fr);
  }

  .user-menu-grid {
    grid-template-columns: 1fr;
    max-width: 440px;
    margin: 0 auto;
  }

  .user-menu-card {
    min-height: 150px;
  }
}

/* ==========================================================================
   Phone (720px and below)
   ========================================================================== */

@media (max-width: 720px) {
  /* ----- Page frame and safe areas ----- */

  .page,
  .user-screen {
    padding:
      20px
      max(14px, env(safe-area-inset-right))
      calc(20px + env(safe-area-inset-bottom))
      max(14px, env(safe-area-inset-left));
  }

  header {
    min-height: 56px;
    padding: 10px max(14px, env(safe-area-inset-right)) 10px max(14px, env(safe-area-inset-left));
  }

  .brand {
    gap: 10px;
  }

  .brand-icon {
    width: 34px;
    height: 34px;
    font-size: 14px;
  }

  .brand h1 {
    font-size: 14px;
  }

  .brand p {
    display: none;
  }

  /* Every screen already has its own back / User Menu button */
  header > button {
    display: none;
  }

  /* ----- Touch-friendly controls ----- */

  button,
  .import-label {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    min-height: 48px;
    padding: 12px 14px;
    font-size: 16px; /* 16px stops iOS from zooming the page on focus */
  }

  textarea {
    min-height: 90px;
  }

  input[type="date"],
  input[type="time"] {
    -webkit-appearance: none;
    appearance: none;
  }

  .form-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .form-group label {
    font-size: 13px;
  }

  .card,
  .admin-section.card {
    padding: 16px;
  }

  .inner-card {
    padding: 14px;
  }

  /* ----- User menu: compact horizontal cards instead of tall tiles ----- */

  .user-hub-title {
    margin-bottom: 20px;
  }

  .hub-icon {
    width: 54px;
    height: 54px;
    font-size: 20px;
  }

  .user-hub-title h1 {
    font-size: 28px;
  }

  .user-hub-title p {
    font-size: 14px;
  }

  .user-menu-grid {
    gap: 12px;
  }

  .user-menu-card {
    min-height: 0;
    padding: 16px 18px;
    display: grid;
    grid-template-columns: 48px 1fr;
    grid-template-areas:
      "icon title"
      "icon text";
    column-gap: 16px;
    row-gap: 2px;
    align-items: center;
    justify-content: stretch;
    text-align: left;
  }

  .user-menu-icon {
    grid-area: icon;
    width: 48px;
    height: 48px;
    margin: 0;
    font-size: 22px;
  }

  .user-menu-title {
    grid-area: title;
    font-size: 17px;
  }

  .user-menu-text {
    grid-area: text;
    margin-top: 0;
    font-size: 13px;
  }

  .user-instructions {
    padding: 16px 18px;
  }

  /* ----- Check in / check out ----- */

  .attendance-user-card {
    margin: 8px auto;
    padding: 20px 16px;
  }

  .attendance-user-card h2 {
    font-size: 24px;
  }

  .kiosk-subtitle {
    margin-bottom: 20px;
    font-size: 14px;
  }

  .user-page-top {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .user-page-top button {
    flex: 1 1 0;
  }

  /* Two big buttons side by side read better than two stacked slabs */
  .kiosk-actions {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 18px;
  }

  .kiosk-actions button {
    min-height: 84px;
    font-size: 17px;
  }

  .user-form-actions button {
    width: 100%;
  }

  .kiosk-message {
    min-height: 60px;
    font-size: 14px;
  }

  .login-card {
    margin: 8px auto;
  }

  .login-card h2 {
    margin-top: 16px;
  }

  /* ----- Dashboard header ----- */

  .page-title {
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
  }

  .page-title h2 {
    font-size: 22px;
  }

  .page-title p {
    font-size: 13px;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions button {
    flex: 1 1 0;
  }

  .section-header {
    flex-direction: column;
    gap: 12px;
  }

  .section-header button {
    width: 100%;
  }

  .admin-menu nav {
    padding: 6px;
  }

  .menu-button {
    padding: 9px 12px;
    font-size: 13px;
  }

  .admin-section {
    margin-bottom: 14px;
    scroll-margin-top: 68px;
  }

  /* ----- Overview metrics and leave summary ----- */

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  /* With an odd number of cards, let the last one span the row */
  .metric-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .metric-card {
    padding: 14px;
  }

  .metric-value {
    font-size: 24px;
  }

  .metric-text {
    font-size: 17px;
  }

  .metric-note {
    font-size: 11px;
  }

  .leave-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .leave-summary-card {
    padding: 12px 10px;
  }

  .leave-summary-card .value {
    font-size: 21px;
  }

  /* ----- Toolbars ----- */

  .admin-toolbar {
    gap: 8px;
  }

  .admin-toolbar input,
  .admin-toolbar select {
    width: 100%;
    max-width: none;
    font-size: 16px;
  }

  .admin-toolbar button {
    flex: 1 1 calc(50% - 4px);
  }

  /* ----- Tables become stacked cards ----- */

  .table-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
  }

  table {
    white-space: normal;
  }

  thead {
    display: none;
  }

  tbody tr {
    margin-bottom: 10px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
  }

  tbody tr:last-child {
    margin-bottom: 0;
  }

  td {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 10px 14px;
    border-top: 1px solid rgba(48, 72, 102, 0.6);
    text-align: right;
    word-break: break-word;
  }

  td:first-child {
    border-top: 0;
  }

  td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    padding-top: 2px;
    color: var(--muted);
    font-size: 10px;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-align: left;
    text-transform: uppercase;
  }

  td[data-label="Action"] {
    display: block;
    text-align: left;
  }

  td[data-label="Action"]::before {
    display: none;
  }

  td.empty {
    display: block;
    text-align: center;
  }

  td.empty::before {
    display: none;
  }

  .compact-actions {
    gap: 8px;
  }

  .compact-actions button {
    flex: 1 1 0;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 12px;
  }

  /* ----- Attendance day groups ----- */

  .attendance-day-header {
    padding: 12px 14px;
    font-size: 13px;
  }

  .attendance-day-count {
    display: block;
    margin-top: 3px;
    line-height: 1.4;
  }

  .attendance-day-toggle {
    flex: 0 0 auto;
    font-size: 12px;
    white-space: nowrap;
  }

  .attendance-day-body .table-wrap {
    padding: 10px;
  }

  /* ----- Lists (roster, administrators, activity) ----- */

  .list-item {
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .list-item > div:first-child {
    flex: 1 1 180px;
    min-width: 0;
  }

  .list-item .compact-actions {
    width: 100%;
  }

  /* ----- Backup ----- */

  .backup-actions {
    flex-direction: column;
  }

  .backup-actions > * {
    width: 100%;
  }
}

/* ==========================================================================
   Small phones (400px and below)
   ========================================================================== */

@media (max-width: 400px) {
  .user-hub-title h1 {
    font-size: 25px;
  }

  .page-title h2 {
    font-size: 20px;
  }

  .metric-value {
    font-size: 22px;
  }

  .metric-text {
    font-size: 15px;
  }

  .leave-summary-card .label {
    font-size: 9px;
  }

  .leave-summary-card .value {
    font-size: 19px;
  }

  .user-menu-card {
    padding: 14px 16px;
    column-gap: 14px;
  }
}

/* Very narrow screens: stack the check-in buttons */
@media (max-width: 359px) {
  .kiosk-actions {
    grid-template-columns: 1fr;
  }

  .kiosk-actions button {
    min-height: 72px;
  }
}

.header-actions button {
  white-space: nowrap;
}

/* ==========================================================================
   Sign-in, PIN display and edit dialog
   ========================================================================== */

.login-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

.btn-link {
  min-height: 0;
  padding: 6px 8px;
  border: 0;
  background: transparent;
  color: #93c5fd;
  font-size: 13px;
  text-decoration: underline;
  cursor: pointer;
}

.input-row {
  display: flex;
  gap: 8px;
}

.input-row input {
  flex: 1 1 auto;
  min-width: 0;
}

.input-row button {
  flex: 0 0 auto;
}

.pin-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}

.pin-value {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  letter-spacing: 1px;
  color: var(--text);
}

#participantNotice:empty {
  display: none;
}

.edit-dialog {
  width: min(480px, calc(100vw - 28px));
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
}

.edit-dialog::backdrop {
  background: rgba(3, 8, 16, 0.7);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

@media (max-width: 720px) {
  .edit-dialog {
    width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
    overflow-y: auto;
    padding: 16px;
  }

  .dialog-actions button {
    flex: 1 1 0;
  }

  .login-actions button[type="submit"] {
    flex: 1 1 100%;
  }
}

/* ==========================================================================
   Round 2: menu toggle, greeting, calendar icons, roster dialogs, tabs,
   manual entry / activity panels, export
   ========================================================================== */

/* Hamburger sits neatly in the menu header instead of stretching across it */
.admin-menu-top {
  padding: 8px 10px;
}

.menu-toggle {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #14253d;
  font-size: 18px;
  line-height: 1;
}

.admin-layout.menu-collapsed .admin-menu-top {
  justify-content: center;
}

.admin-greeting {
  margin: 0 0 4px;
  color: #93c5fd;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 0.3px;
}

/* White calendar and clock icons on the dark inputs */
input[type="date"],
input[type="time"] {
  color-scheme: dark;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  filter: invert(1);
  opacity: 1;
}

/* Roster and administrator pop-outs */
.list-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--text);
}

.list-dialog::backdrop {
  background: rgba(3, 8, 16, 0.7);
}

.list-dialog[open] {
  display: flex;
  flex-direction: column;
}

.list-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.list-dialog-head h3 {
  margin: 0;
}

.list-dialog-body {
  min-height: 0;
  padding: 16px 20px 20px;
  overflow-y: auto;
}

.list-dialog-body .admin-toolbar {
  margin-bottom: 12px;
}

.rank-heading {
  position: sticky;
  top: -16px;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 6px;
  padding: 6px 10px;
  border-radius: 6px;
  background: #1c3354;
  color: #cfe0f7;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.6px;
}

.rank-group:first-child .rank-heading {
  margin-top: 0;
}

.summary-line {
  margin: 0 0 12px;
  color: var(--muted);
}

/* Check in / check out tabs */
.attendance-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0 20px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1626;
}

.attendance-tab {
  min-height: 46px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  font-weight: bold;
}

.attendance-tab.active[data-tab="checkin"] {
  background: var(--green);
  color: white;
}

.attendance-tab.active[data-tab="checkout"] {
  background: var(--yellow);
  color: white;
}

.attendance-panel .kiosk-actions {
  grid-template-columns: 1fr;
}

/* Manual entry (compact) beside a scrolling activity log of the same height */
.admin-tools-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: stretch;
}

.admin-tools-grid .compact-form .form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.admin-tools-grid .compact-form .form-group label {
  font-size: 12px;
}

.admin-tools-grid .compact-form input,
.admin-tools-grid .compact-form select {
  padding: 8px 10px;
}

.activity-card {
  position: relative;
  min-height: 320px;
}

.activity-scroll {
  position: absolute;
  top: 56px;
  right: 14px;
  bottom: 14px;
  left: 20px;
  padding-right: 6px;
  overflow-y: auto;
}

.export-range {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 14px;
}

.export-range .form-group {
  margin: 0;
}

@media (max-width: 960px) {
  .admin-tools-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .activity-card {
    min-height: 0;
  }

  .activity-scroll {
    position: static;
    max-height: 320px;
    padding-right: 4px;
  }
}

@media (max-width: 720px) {
  .list-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
  }

  .list-dialog-head,
  .list-dialog-body {
    padding-left: 14px;
    padding-right: 14px;
  }

  .admin-tools-grid .compact-form .form-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .export-range > * {
    flex: 1 1 140px;
  }

  .export-range button {
    flex-basis: 100%;
  }
}


/* Workout details: tooltip on the exercise badge, check-out notes box */
.has-tip {
  display: inline-block;
  border-radius: 999px;
  cursor: help;
  outline-offset: 2px;
}

.has-tip .badge {
  box-shadow: 0 0 0 1px rgba(147, 197, 253, 0.55);
}

.tip-box {
  position: fixed;
  z-index: 1000;
  display: none;
  max-width: min(300px, calc(100vw - 16px));
  padding: 10px 12px;
  border: 1px solid #3b82f6;
  border-radius: 8px;
  background: #0b1626;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  color: #eff6ff;
  font-size: 13px;
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
  word-break: break-word;
  pointer-events: none;
}

/* Check-out workout list: exercise + amount + Add */
.workout-add {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workout-add > select {
  flex: 2 1 190px;
  min-width: 0;
}

.workout-add > input {
  flex: 1 1 110px;
  min-width: 0;
}

.workout-add > .hidden {
  display: none;
}

.workout-add-button {
  min-width: 76px;
}


.workout-list {
  display: grid;
  gap: 6px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.workout-list:empty {
  display: none;
}

.workout-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-dark);
}

.workout-item-text {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  min-width: 0;
  word-break: break-word;
}

.workout-item-text span {
  color: #93c5fd;
}

.workout-remove {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.workout-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

/* Participant portal (view-only) */
.portal-card {
  max-width: 760px;
  margin: 32px auto;
}

.portal-card h2 {
  margin: 14px 0 6px;
}

.portal-card .form-group {
  margin-bottom: 14px;
}

.portal-card form button[type="submit"] {
  width: 100%;
}

.portal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-top: 6px;
}

.portal-head h2 {
  margin-top: 2px;
}

.portal-head p {
  margin: 0;
}

.portal-hello {
  color: #93c5fd;
  font-size: 15px;
  font-weight: bold;
}

.portal-today {
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-dark);
  font-weight: bold;
}

.portal-metrics {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.portal-metrics .metric-card {
  padding: 13px;
}

.portal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 10px;
}

.portal-section-head h3 {
  margin: 0;
  font-size: 17px;
}

.portal-section-head select {
  width: auto;
  min-width: 170px;
}

.portal-records {
  display: grid;
  gap: 10px;
}

.portal-record {
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-dark);
}

.portal-record-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.portal-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.portal-times {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.portal-workouts {
  display: grid;
  gap: 4px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.portal-workouts li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid rgba(48, 72, 102, 0.6);
  font-size: 14px;
}

.portal-workouts li span {
  color: #93c5fd;
  text-align: right;
}

.portal-notes {
  margin: 10px 0 0;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
}

.portal-empty,
.portal-muted {
  color: var(--muted);
  font-size: 13px;
}

.portal-records > .portal-empty {
  margin: 4px 0;
}

.portal-leave {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.portal-leave li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-dark);
  font-size: 14px;
}

@media (max-width: 560px) {
  .portal-card {
    margin: 14px auto;
  }

  .portal-head {
    flex-direction: column;
  }

  .portal-metrics {
    grid-template-columns: minmax(0, 1fr);
  }

  .portal-section-head {
    flex-wrap: wrap;
  }

  .portal-section-head select {
    min-width: 0;
    width: 100%;
  }
}

.label-note {
  color: var(--muted);
  font-weight: normal;
}


/* Leave History pop-out */
.wide-dialog {
  width: min(1080px, calc(100vw - 28px));
}

.list-dialog-head .section-subtitle {
  margin: 4px 0 0;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel-dark);
  color: var(--muted);
  font-size: 13px;
  font-weight: bold;
}

.chip.active {
  border-color: var(--purple);
  background: rgba(124, 58, 237, 0.25);
  color: #fff;
}

.chip-count {
  display: inline-block;
  min-width: 20px;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 11px;
  text-align: center;
}

.week-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.week-bar.hidden {
  display: none;
}

.week-label {
  flex: 1 1 200px;
  font-weight: bold;
  text-align: center;
}

.overview-heading {
  margin: 14px 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.overview-more {
  padding: 6px 0 0;
}

.section-header .header-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}