@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
  --paper: #F7F5F0;
  --paper-raised: #FFFFFF;
  --ink: #1C2333;
  --ink-soft: #5B6473;
  --line: #E1DDD3;
  --working: #2F6F5E;
  --working-bg: #E7F0EC;
  --idle: #B5551F;
  --idle-bg: #F7E9DD;
  --overtime: #7B4B94;
  --overtime-bg: #F0E7F3;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .display {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
}

.mono {
  font-family: 'IBM Plex Mono', monospace;
}

a { color: inherit; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--paper-raised);
}

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

.brand-mark {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
  display: flex; align-items: center; justify-content: center;
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 13px;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px;
}

/* ---- Punch card: the signature element ---- */
.punchcard {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 32px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
}

.punchcard::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
}

.punchcard.state-working::before { background: var(--working); }
.punchcard.state-idle::before { background: var(--idle); }

.punchcard .status-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  font-weight: 600;
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
}
.state-working .status-dot { background: var(--working); box-shadow: 0 0 0 4px var(--working-bg); animation: pulse 2s infinite; }
.state-idle .status-dot { background: var(--idle); box-shadow: 0 0 0 4px var(--idle-bg); animation: pulse 2s infinite; }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.punchcard .elapsed {
  font-size: 42px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.punchcard .task-name {
  font-size: 15px;
  color: var(--ink-soft);
  margin-top: 4px;
}

.punchcard .actions button { margin-left: 8px; }

/* ---- Buttons ---- */
button {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--paper-raised);
  color: var(--ink);
  padding: 10px 16px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease;
}
button:hover { background: var(--paper); }
button:active { transform: scale(0.98); }
button.primary { background: var(--ink); color: var(--paper); border-color: var(--ink); }
button.primary:hover { background: #2b3348; }
button.danger { color: var(--idle); border-color: var(--idle-bg); }
button.small { padding: 6px 10px; font-size: 12px; }

input, textarea, select {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-raised);
  color: var(--ink);
  width: 100%;
}
input:focus, textarea:focus, select:focus, button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}

/* ---- Layout grid ---- */
.grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 24px;
  margin-top: 24px;
}
@media (max-width: 880px) { .grid-2 { grid-template-columns: 1fr; } }

.panel {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
}
.panel h2 { font-size: 18px; margin-bottom: 14px; }
.panel .eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-soft); font-weight: 600; margin-bottom: 6px;
}

/* Task stub - torn-ticket look, echoes the punch-card metaphor */
.task-stub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px dashed var(--line);
}
.task-stub:last-child { border-bottom: none; }
.task-stub .title { font-weight: 500; }
.task-stub .title.done { text-decoration: line-through; color: var(--ink-soft); }
.task-stub .meta { font-size: 12px; color: var(--ink-soft); }
.task-stub .badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 5px;
  letter-spacing: 0.04em;
}
.badge.pending { background: var(--paper); color: var(--ink-soft); }
.badge.in_progress { background: var(--working-bg); color: var(--working); }
.badge.completed { background: #E9EFE6; color: #4C7A3C; }
.badge.carried_forward { background: var(--overtime-bg); color: var(--overtime); }

/* Tabs */
.tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.tabs button { border-radius: 999px; padding: 6px 14px; font-size: 13px; }
.tabs button.active { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* Sticky notes */
.notes-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.sticky {
  border-radius: 4px;
  padding: 12px;
  min-height: 110px;
  font-size: 13px;
  box-shadow: 0 3px 8px rgba(0,0,0,0.06);
  transform: rotate(-0.6deg);
  display: flex; flex-direction: column; gap: 6px;
}
.sticky:nth-child(even) { transform: rotate(0.7deg); }
.sticky textarea {
  border: none; background: transparent; resize: none; flex: 1;
  font-family: 'Inter', sans-serif; padding: 0;
}
.sticky textarea:focus { outline: none; }
.sticky .sticky-top { display: flex; justify-content: flex-end; }

/* Admin roster */
.roster {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 14px;
}
.roster-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px;
}
.roster-card.working { border-left-color: var(--working); }
.roster-card.idle { border-left-color: var(--idle); }
.roster-card .name { font-weight: 600; }
.roster-card .dept { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }
.roster-card .state-line { font-size: 13px; display: flex; align-items: center; gap: 6px; }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-soft);
  font-size: 14px;
}

.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 36px;
  width: 340px;
}
.login-card h1 { font-size: 24px; margin-bottom: 4px; }
.login-card .sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 22px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
.login-error { color: var(--idle); font-size: 13px; min-height: 18px; }

/* ---- Landing / sign-in hero (index.html) ---- */
.auth-shell {
  min-height: 100vh;
  display: flex;
}

.auth-hero {
  flex: 1 1 56%;
  background: linear-gradient(160deg, #1C2333 0%, #232C44 100%);
  color: var(--paper);
  display: flex;
  align-items: center;
  padding: 56px 64px;
  position: relative;
  overflow: hidden;
}

.auth-hero::before,
.auth-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.07);
  pointer-events: none;
}
.auth-hero::before { top: -140px; right: -170px; width: 480px; height: 480px; }
.auth-hero::after { top: -95px; right: -125px; width: 380px; height: 380px; border-color: rgba(255,255,255,0.05); }

.auth-hero-inner {
  max-width: 460px;
  position: relative;
  z-index: 1;
}

.hero-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 52px;
}

.hero-mark { width: 26px; height: 26px; color: var(--paper); flex-shrink: 0; }

.hero-wordmark {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 18px;
  letter-spacing: -0.01em;
}

.hero-headline {
  font-family: 'Fraunces', serif;
  font-weight: 600;
  font-size: 42px;
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin-bottom: 18px;
  color: var(--paper);
}

.hero-sub {
  font-size: 15px;
  line-height: 1.65;
  color: #C4C9D6;
  margin-bottom: 30px;
  max-width: 420px;
}

.hero-clock {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 18px 22px;
  margin-bottom: 32px;
  display: inline-block;
}

.hero-clock-time {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--paper);
  margin-bottom: 8px;
}

.hero-clock-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #A8AEC0;
}

.hero-features {
  list-style: none;
  padding: 0;
  margin: 0 0 36px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hero-features li {
  font-size: 14px;
  color: #C4C9D6;
  padding-left: 18px;
  position: relative;
  line-height: 1.5;
}

.hero-features li::before {
  content: "";
  position: absolute;
  left: 0; top: 7px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--working);
}

.hero-features strong { color: var(--paper); font-weight: 600; }

.hero-footnote {
  font-size: 12px;
  color: #7D8399;
  letter-spacing: 0.02em;
}

.auth-form-side {
  flex: 1 1 44%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--paper);
}

.auth-form-side .login-card {
  border: none;
  box-shadow: none;
  padding: 0;
  width: 100%;
  max-width: 340px;
}

@media (max-width: 900px) {
  .auth-shell { flex-direction: column; }
  .auth-hero { padding: 44px 28px 36px; }
  .auth-hero::before, .auth-hero::after { display: none; }
  .hero-headline { font-size: 30px; }
  .hero-brand { margin-bottom: 32px; }
  .hero-features { margin-bottom: 24px; }
  .auth-form-side { padding: 32px 24px 56px; }
}

/* ---- Logo chip (BDH logo on light or dark backgrounds) ---- */
.logo-chip {
  background: #fff;
  border-radius: 7px;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  line-height: 0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.logo-chip img { height: 22px; width: auto; display: block; }
.logo-chip.large img { height: 28px; }

/* ---- Admin dashboard: accent bar, live badge, KPI cards, activity feed ---- */
.topbar-accent {
  height: 3px;
  background: linear-gradient(90deg, var(--working), var(--overtime), var(--idle));
}

.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
  margin-top: 2px;
}
.live-badge .status-dot { background: #ccc; box-shadow: none; animation: none; }
.live-badge.connected .status-dot { background: var(--working); box-shadow: 0 0 0 3px var(--working-bg); animation: pulse 2s infinite; }

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.kpi-card::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(28,35,51,0.09); }

.kpi-working::before { background: var(--working); }
.kpi-idle::before { background: var(--idle); }
.kpi-neutral::before { background: var(--ink-soft); opacity: 0.35; }
.kpi-productivity::before { background: var(--working); opacity: 0.6; }
.kpi-overtime::before { background: var(--overtime); }

.kpi-value {
  font-size: 30px;
  font-weight: 600;
  line-height: 1;
  margin-bottom: 8px;
  color: var(--ink);
}

.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
}

.activity-feed {
  max-height: 280px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 4px;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  animation: activityIn 0.35s ease;
}
.activity-item:last-child { border-bottom: none; }
.activity-item .status-dot { flex-shrink: 0; }
.activity-item .who { font-weight: 600; }
.activity-item .what { color: var(--ink-soft); }
.activity-item .time {
  margin-left: auto;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: var(--ink-soft);
  flex-shrink: 0;
}

@keyframes activityIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Performance ring + quick-add chips (employee dashboard) ---- */
.punch-row {
  display: flex;
  gap: 16px;
  align-items: stretch;
}
.punch-row .punchcard { flex: 1 1 auto; }

.perf-card {
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  width: 190px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.perf-ring {
  width: 88px; height: 88px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: conic-gradient(var(--line) 0%, var(--line) 0);
  margin-bottom: 10px;
  transition: background 0.4s ease;
}
.perf-ring-inner {
  width: 70px; height: 70px;
  border-radius: 50%;
  background: var(--paper-raised);
  display: flex; align-items: center; justify-content: center;
}
.perf-pct { font-size: 18px; font-weight: 600; }

.perf-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 6px;
}
.perf-message { font-size: 12px; color: var(--ink-soft); line-height: 1.4; }

.quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease;
}
.chip:hover { background: var(--working-bg); border-color: var(--working); }
.chip:active { transform: scale(0.97); }
.chip:disabled { opacity: 0.5; cursor: default; }

@media (max-width: 700px) {
  .punch-row { flex-direction: column; }
  .perf-card { width: auto; flex-direction: row; justify-content: flex-start; gap: 14px; text-align: left; }
  .perf-ring { margin-bottom: 0; }
}

/* ---- Employee drill-down modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(28,35,51,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card {
  background: var(--paper-raised);
  border-radius: var(--radius);
  width: 100%; max-width: 640px;
  max-height: 82vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 50px rgba(28,35,51,0.25);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 22px 24px 16px;
  border-bottom: 1px solid var(--line);
}
.modal-header h2 { font-size: 19px; }
.modal-body {
  padding: 16px 24px 24px;
  overflow-y: auto;
}
.drilldown-day-heading {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  font-weight: 600;
  margin: 18px 0 6px;
}
.drilldown-day-heading:first-child { margin-top: 0; }

.emp-link {
  background: none; border: none; padding: 0;
  color: var(--ink);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--line);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: inherit;
}
.emp-link:hover { text-decoration-color: var(--ink); }

/* ---- Task requests (assign to colleague / accept-reject) ---- */
.request-item {
  padding: 12px 4px;
  border-bottom: 1px dashed var(--line);
}
.request-item:last-child { border-bottom: none; }
.request-item .title { font-weight: 500; margin-bottom: 2px; }
.request-item .meta { font-size: 12px; color: var(--ink-soft); margin-bottom: 8px; }
.request-item .reject-reason {
  font-size: 12px;
  color: var(--idle);
  background: var(--idle-bg);
  border-radius: 6px;
  padding: 6px 9px;
  margin-top: 6px;
}
.request-actions { display: flex; gap: 8px; }
.reject-form {
  display: none;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}
.reject-form.open { display: flex; }
.reject-form textarea {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  resize: vertical;
  min-height: 50px;
}
