/* --- RESET & BASE --- */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #2d3748;
  background-color: #f7fafc;
}

a { color: #3182ce; }
a:hover { color: #2b6cb0; }

/* --- FORM ELEMENTS (shared) --- */
.form-group { margin-bottom: 1.25rem; }
.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4a5568;
  margin-bottom: 0.4rem;
}
.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 1rem;
  font-family: inherit;
  color: #2d3748;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #3182ce;
  box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.2);
}
.submit-btn {
  background-color: #3182ce;
  color: #ffffff;
  border: none;
  padding: 0.8rem 1.75rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.submit-btn:hover { background-color: #2b6cb0; }

.form-alert {
  display: none;
  padding: 1rem;
  margin-top: 1rem;
  border-radius: 6px;
  font-size: 0.95rem;
}
.form-alert.success { display: block; background: #c6f6d5; color: #22543d; border: 1px solid #9ae6b4; }
.form-alert.error   { display: block; background: #fed7d7; color: #742a2a; border: 1px solid #feb2b2; }

/* --- LOGIN PAGE --- */
.login-page {
  background: #f7fafc;
  min-height: 100vh;
  border: 2px solid #000000;
  box-sizing: border-box;
}
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
}
.login-card {
  background: #fff;
  width: 100%;
  max-width: 420px;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}
.login-brand {
  display: block;
  background: #000000;
  padding: 1.25rem 2rem;
  line-height: 0;
}
.login-brand img { width: 100%; height: auto; display: block; }
.login-body { padding: 2rem 2.5rem 2.5rem 2.5rem; }
.login-card h1 { font-size: 1.5rem; color: #1a202c; margin-bottom: 0.25rem; }
.login-sub { color: #4a5568; margin-bottom: 1.5rem; }
.login-btn { width: 100%; margin-top: 0.5rem; }

.login-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: -0.25rem 0 1.25rem 0;
  font-size: 0.85rem;
}
.remember { display: flex; align-items: center; gap: 0.4rem; color: #4a5568; cursor: pointer; }
.remember input { width: auto; margin: 0; }
.forgot { color: #3182ce; text-decoration: none; }
.forgot:hover { text-decoration: underline; }

.login-foot {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.8rem;
  color: #a0aec0;
  text-align: center;
  margin-bottom: 0;
}

/* Role pills (used in intranet header) */
.role {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.role-manager  { background: #fed7e2; color: #97266d; }
.role-employee { background: #bee3f8; color: #2a4365; }

/* Dashboard app launcher grid */
.app-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
.app-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  background-color: #2d3748;  /* fallback if Unsplash image fails */
  background-size: cover;
  background-position: center;
  padding: 0;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  text-decoration: none;
  color: #1a202c;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  position: relative;
  min-height: 140px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 600px) {
  .app-grid { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.5rem; }
  .app-card { min-height: 240px; }
}
.app-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.1);
  border-color: #cbd5e0;
}
.app-card:focus-visible {
  outline: 3px solid #3182ce;
  outline-offset: 2px;
}
/* Dark gradient overlay so text stays readable on any photo */
.app-card-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.25) 0%, rgba(0,0,0,0.65) 100%);
  pointer-events: none;
}
.app-card-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 1.5rem 1.25rem;
  width: 100%;
  height: 100%;
  color: #ffffff;
}
@media (min-width: 600px) {
  .app-card-content { padding: 2rem 1.75rem; }
}
.app-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, 0.95);
  margin-bottom: 0.25rem;
  flex-shrink: 0;
}
.app-icon svg { width: 26px; height: 26px; }
.app-card.app-blue  .app-icon { color: #2b6cb0; }
.app-card.app-green .app-icon { color: #276749; }
.app-title { font-size: 1.25rem; font-weight: 700; color: #ffffff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.app-blurb { color: rgba(255, 255, 255, 0.92); font-size: 0.95rem; line-height: 1.5; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.app-cta {
  margin-top: auto;
  font-size: 0.9rem; font-weight: 600; color: #ffffff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* --- INTRANET PAGES --- */
.intra-header {
  background: #000000;
  color: #fff;
  padding: 0.85rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 100;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}
.intra-header .brand { display: flex; align-items: center; gap: 1rem; }
.intra-header .brand img { height: calc(100% - 1rem); width: auto; max-height: 56px; display: block; }
.intra-header .who { color: #cbd5e0; font-size: 0.9rem; }
.intra-header .who strong { color: #fff; }
.intra-header a.logout {
  color: #cbd5e0; text-decoration: none; font-size: 0.9rem;
  padding: 0.5rem 0.85rem; border: 1px solid #4a5568; border-radius: 6px;
  min-height: 40px; display: inline-flex; align-items: center;
}
.intra-header a.logout:hover { color: #fff; border-color: #cbd5e0; }

.intra-main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1rem; }
.intra-main h2 { font-size: 1.5rem; margin-bottom: 0.25rem; color: #1a202c; line-height: 1.2; }
.intra-main .lead { color: #4a5568; margin-bottom: 1.5rem; font-size: 1rem; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.25rem;
  margin-bottom: 2.5rem;
}
.stat-card {
  background: #fff;
  border-radius: 8px;
  padding: 1.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.stat-card .label { font-size: 0.85rem; color: #4a5568; margin-bottom: 0.4rem; }
.stat-card .value { font-size: 1.8rem; font-weight: 700; color: #1a202c; }
.stat-card .delta { font-size: 0.8rem; color: #38a169; margin-top: 0.25rem; }

.section { background: #fff; border-radius: 8px; padding: 1.5rem; box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); margin-bottom: 1.5rem; }
.section h3 { font-size: 1.15rem; margin-bottom: 1rem; color: #2d3748; }

table.simple { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.simple th, table.simple td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid #e2e8f0; }
table.simple th { color: #4a5568; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-green { background: #c6f6d5; color: #22543d; }
.badge-yellow { background: #fefcbf; color: #744210; }
.badge-red { background: #fed7d7; color: #742a2a; }
.badge-gray { background: #e2e8f0; color: #2d3748; }

/* --- CLOCK IN/OUT APP --- */
.clock-now {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 1.5rem;
  padding: 1rem 1.25rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}
.clock-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}
.clock-time { font-size: 1.4rem; font-weight: 700; color: #1a202c; font-variant-numeric: tabular-nums; line-height: 1.1; }
.clock-date { font-size: 1.4rem; font-weight: 600; color: #4a5568; }
.clock-location { font-size: 0.85rem; color: #718096; font-variant-numeric: tabular-nums; margin-top: 0.25rem; }

.clock-options { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 1.25rem; }
.clock-option {
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease, opacity 0.12s ease;
}
.clock-color-blue   { background: #ebf8ff; }
.clock-color-indigo { background: #ebf4ff; }
.clock-color-teal   { background: #e6fffa; }
.clock-color-purple { background: #faf5ff; }
.clock-color-orange { background: #fffaf0; }
.clock-color-gray   { background: #f7fafc; }

.clock-option.is-locked { opacity: 0.45; pointer-events: none; }
.clock-option.is-locked .clock-option-btn:hover { background: transparent; }

.clock-option-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: transparent;
  border: 0;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: #1a202c;
  cursor: pointer;
  text-align: left;
  min-height: 70px;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 600px) {
  .clock-option-btn { min-height: 120px; padding: 1.5rem 1.5rem; font-size: 1.1rem; }
}
.clock-option-btn:focus-visible { outline: 3px solid #3182ce; outline-offset: -3px; }
.clock-option-label { flex: 1; }

/* Selected: solid colour background, white text */
.clock-color-blue.is-selected   { background: #3182ce; }
.clock-color-indigo.is-selected { background: #5a67d8; }
.clock-color-teal.is-selected   { background: #319795; }
.clock-color-purple.is-selected { background: #805ad5; }
.clock-color-orange.is-selected { background: #dd6b20; }
.clock-option.is-selected .clock-option-btn { color: #fff; }
.clock-option.is-selected .clock-option-btn:hover { background: transparent; }

.clock-option-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.2s ease;
}
.clock-option.is-selected .clock-option-body { max-height: 200px; }
.clock-option-note {
  display: block;
  width: 100%;
  border: 0;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.75rem 1rem;
  font: inherit;
  font-size: 0.95rem;
  color: #1a202c;
  background: #fff;
  resize: vertical;
  min-height: 60px;
}
.clock-option-note:focus { outline: none; background: #f7fafc; }

/* Single bottom action button */
.clock-action {
  display: block;
  width: 100%;
  padding: 1rem 1.5rem;
  background: #38a169;
  color: #fff;
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  min-height: 56px;
  transition: background-color 0.15s ease, opacity 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.clock-action:hover:not(:disabled) { background: #2f855a; }
.clock-action:disabled { background: #cbd5e0; cursor: not-allowed; opacity: 0.7; }
.clock-action.is-clocked-in { background: #c53030; }
.clock-action.is-clocked-in:hover { background: #9b2c2c; }

.clock-status {
  margin-top: 0.75rem;
  text-align: center;
  font-size: 0.95rem;
  color: #4a5568;
  min-height: 1.4em;
}
.clock-status.is-on { color: #22543d; font-weight: 600; }

.clock-history {
  margin-top: 1.5rem;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  padding: 0.75rem 1rem;
}
.clock-history summary {
  cursor: pointer;
  font-weight: 600;
  color: #2d3748;
  list-style: none;
}
.clock-history summary::-webkit-details-marker { display: none; }
.clock-history summary::before { content: '\25B8'; margin-right: 0.4rem; color: #a0aec0; }
.clock-history[open] summary::before { content: '\25BE'; }
.clock-history ul { list-style: none; margin-top: 0.75rem; padding: 0; }
.clock-history li { padding: 0.5rem 0; border-top: 1px solid #edf2f7; font-size: 0.9rem; color: #2d3748; display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: baseline; }
.clock-history li:first-child { border-top: 0; }
.clock-history li .muted { color: #a0aec0; font-size: 0.85rem; }
.clock-history li .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 0.35rem; flex-shrink: 0; }
.clock-history .dot-blue   { background: #3182ce; }
.clock-history .dot-indigo { background: #5a67d8; }
.clock-history .dot-teal   { background: #319795; }
.clock-history .dot-purple { background: #805ad5; }
.clock-history .dot-orange { background: #dd6b20; }
.clock-history .dot-gray   { background: #a0aec0; }
.clock-history-note { color: #4a5568; font-size: 0.85rem; margin-top: 0.2rem; white-space: pre-wrap; flex-basis: 100%; }
.clock-history-empty { color: #a0aec0; font-style: italic; }
