:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --ink: #17202f;
  --muted: #637083;
  --line: #dbe2ec;
  --primary: #117c6f;
  --primary-dark: #075e55;
  --accent: #d95f32;
  --danger: #b42318;
  --success: #137a43;
  --shadow: 0 18px 45px rgba(29, 44, 64, .12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(rgba(12, 32, 43, .78), rgba(12, 32, 43, .72)),
    url("https://images.unsplash.com/photo-1497366811353-6870744d04b2?auto=format&fit=crop&w=1600&q=80") center/cover;
}

.tablet-login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(260px, 34vw) 1fr;
  background: #0f1722;
  color: #fff;
}

.tablet-clock {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  padding: 40px;
  background:
    linear-gradient(rgba(17, 28, 40, .78), rgba(17, 28, 40, .84)),
    url("https://images.unsplash.com/photo-1497215728101-856f4ea42174?auto=format&fit=crop&w=1200&q=80") center/cover;
}

.tablet-clock span {
  color: #cbd6e2;
  font-weight: 800;
  text-transform: uppercase;
}

.tablet-clock strong {
  font-size: clamp(48px, 8vw, 96px);
  line-height: 1;
  letter-spacing: 0;
}

.tablet-clock p {
  color: #fff;
  font-weight: 800;
  font-size: 22px;
}

.kiosk-panel {
  display: grid;
  align-content: center;
  gap: 18px;
  padding: 34px;
  background: var(--bg);
  color: var(--ink);
}

.kiosk-copy h1 {
  font-size: clamp(34px, 5vw, 64px);
  margin-bottom: 8px;
}

.pin-layout {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(280px, 1fr);
  gap: 24px;
  align-items: stretch;
}

.pin-input {
  grid-column: 1;
  height: 76px;
  text-align: center;
  font-size: 42px;
  letter-spacing: 12px;
  font-weight: 900;
}

.pin-pad {
  grid-column: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(82px, 1fr));
  gap: 12px;
}

.pin-pad button {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 28px;
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(29, 44, 64, .08);
}

.pin-pad button:active {
  transform: translateY(1px);
  background: #e8f4f2;
}

.camera-card {
  grid-column: 2;
  grid-row: 1 / span 3;
  min-height: 100%;
  overflow: hidden;
  position: relative;
  border-radius: 8px;
  background: #111a25;
  box-shadow: var(--shadow);
}

.camera-card video {
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-card div {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(17, 26, 37, .82);
  color: #fff;
  font-weight: 800;
  text-align: center;
}

.admin-entry {
  justify-self: start;
  color: var(--primary-dark);
  font-weight: 800;
}

.punch-submit-btn {
  grid-column: 1;
  min-height: 72px;
  border: 0;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 14px 28px rgba(17, 124, 111, .22);
}

.punch-submit-btn:disabled {
  cursor: not-allowed;
  background: #aeb9c6;
  box-shadow: none;
}

.punch-submit-btn:not(:disabled):active {
  transform: translateY(1px);
}

.admin-login-panel {
  align-self: center;
  justify-self: center;
  color: var(--ink);
}

.login-panel {
  width: min(420px, 100%);
  background: rgba(255,255,255,.95);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 34px;
}

.brand-mark, .side-brand span {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 30px; margin-bottom: 8px; }
h2 { font-size: clamp(32px, 5vw, 56px); margin-bottom: 12px; letter-spacing: 0; }
h3 { font-size: 18px; margin-bottom: 18px; }
p, .muted { color: var(--muted); }

.form-stack { display: grid; gap: 14px; }
label { display: grid; gap: 7px; color: #2d394b; font-weight: 700; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; }

.primary-btn, .secondary-btn, .ghost-btn, .punch-btn, .link-btn {
  border: 0;
  border-radius: 8px;
  min-height: 46px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 800;
  display: inline-grid;
  place-items: center;
}
.primary-btn { background: var(--primary); color: #fff; }
.secondary-btn { background: #e9edf3; color: var(--ink); }
.primary-btn:hover, .punch-btn:hover { background: var(--primary-dark); }
.secondary-btn:hover { background: #dce3ec; }
.ghost-btn { width: 100%; background: #eef3f7; color: var(--ink); }
.punch-btn { min-height: 72px; background: var(--primary); color: #fff; font-size: 18px; }
.link-btn { margin-top: 12px; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px;
  background: #111a25;
  color: #fff;
}

.side-brand { display: flex; align-items: center; gap: 12px; }
.sidebar nav { display: grid; gap: 8px; }
.sidebar nav a {
  padding: 12px 14px;
  border-radius: 8px;
  color: #cbd6e2;
  font-weight: 700;
}
.sidebar nav a.active, .sidebar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar form { margin-top: auto; }

.content { padding: 30px; overflow-x: hidden; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.topbar span, .eyebrow { color: var(--muted); font-weight: 800; text-transform: uppercase; font-size: 12px; letter-spacing: 0; }
.topbar h1 { margin: 4px 0 0; font-size: 26px; }
.role-pill, .chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 8px;
  padding: 0 10px;
  background: #e8f4f2;
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 13px;
}

.alert {
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 700;
}
.alert.success { background: #e8f7ee; color: var(--success); }
.alert.error { background: #fdeceb; color: var(--danger); }

.hero-board {
  display: grid;
  grid-template-columns: 1.2fr minmax(260px, 420px);
  gap: 24px;
  align-items: end;
  min-height: 290px;
  padding: 34px;
  border-radius: 8px;
  background:
    linear-gradient(115deg, rgba(255,255,255,.95) 0%, rgba(255,255,255,.78) 55%, rgba(255,255,255,.25) 100%),
    url("https://images.unsplash.com/photo-1551836022-d5d88e9218df?auto=format&fit=crop&w=1600&q=80") center/cover;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.punch-form { display: grid; gap: 12px; }
.grid { display: grid; gap: 22px; }
.grid.two { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 8px 22px rgba(29, 44, 64, .06);
}

.timeline { display: grid; gap: 12px; }
.timeline div, .stats div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}
.timeline div:last-child, .stats div:last-child { border-bottom: 0; }
.timeline span, .stats span { color: var(--muted); }
.stats strong { font-size: 22px; }

.check { display: flex; align-items: center; gap: 10px; }
.check input { width: auto; }
.filters {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
}

.manual-punch-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  align-items: end;
}

.table-panel { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
td small { display: block; color: var(--muted); margin-top: 3px; }
.mini-link { color: var(--primary); font-weight: 800; }
.chip { margin: 0 6px 6px 0; background: #f1f4f8; color: var(--ink); }
.photo-thumb {
  display: inline-block;
  width: 52px;
  height: 52px;
  margin: 0 6px 6px 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #eef3f7;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (max-width: 900px) {
  .tablet-login-shell { grid-template-columns: 1fr; }
  .tablet-clock {
    min-height: 220px;
    padding: 26px;
  }
  .pin-layout { grid-template-columns: 1fr; }
  .pin-input, .pin-pad, .camera-card, .punch-submit-btn {
    grid-column: 1;
    grid-row: auto;
  }
  .camera-card video { min-height: 300px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
  }
  .sidebar nav { display: flex; flex-wrap: wrap; }
  .sidebar form { margin-top: 0; margin-left: auto; }
  .hero-board, .grid.two, .filters, .manual-punch-form { grid-template-columns: 1fr; }
  .content { padding: 20px; }
}

@media (max-width: 560px) {
  .kiosk-panel { padding: 20px; }
  .pin-pad { gap: 9px; }
  .pin-pad button { min-height: 66px; font-size: 24px; }
  .login-panel, .hero-board, .panel { padding: 20px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .sidebar { padding: 18px; }
  .sidebar form { width: 100%; margin-left: 0; }
}
