:root {
  --surface-2: #f4f6f9;
  --card: #ffffff;
  --text: #0b0b0b;
  --text-secondary: #52514e;
  --muted: #898781;
  --border: #e1e0d9;
  --navy: #12233f;
  --blue: #2a78d6;
  --blue-dark: #1c5cab;
  --good: #0ca30c;
  --good-dark: #087a08;
  --critical: #d03b3b;
  --critical-dark: #a82e2e;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
}

.hidden { display: none !important; }

.screen {
  min-height: 100vh;
  width: 100%;
}

/* ----------------------------------------------------- Centered cards */
#screen-company, #screen-login {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 28px 24px 32px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(11,11,11,0.07);
  text-align: center;
}

.brand-icon {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  margin-bottom: 8px;
}

h1 {
  font-size: 21px;
  margin: 4px 0 2px;
  color: var(--navy);
}

.subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 2px 0 20px;
}

.fineprint {
  color: var(--muted);
  font-size: 12px;
  margin-top: 18px;
}

/* ----------------------------------------------------- Company list */
.company-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.company-btn {
  padding: 14px 16px;
  font-size: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.company-btn:active { background: #e8ebf0; }

/* ----------------------------------------------------- Login fields */
.field-label {
  display: block;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 14px 0 6px;
}

.text-input {
  width: 100%;
  padding: 12px 14px;
  font-size: 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
}

.text-input:focus { outline: 2px solid var(--blue); }

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 6px 0 16px;
}

.pin-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
}

.pin-dot.filled {
  background: var(--navy);
  border-color: var(--navy);
}

.pinpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.pinpad button {
  padding: 16px 0;
  font-size: 20px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}

.pinpad button:active { background: #e8ebf0; }

.pinpad .key-muted {
  font-size: 14px;
  color: var(--text-secondary);
}

.error-msg {
  color: var(--critical);
  font-size: 13px;
  margin: 0 0 12px;
}

.primary-btn {
  width: 100%;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
}

.primary-btn:disabled {
  background: var(--muted);
  cursor: not-allowed;
}

.link-btn {
  display: inline-block;
  margin-top: 14px;
  background: none;
  border: none;
  color: var(--blue);
  font-size: 14px;
  cursor: pointer;
  padding: 6px;
}

/* --------------------------------------------------------- Main screen */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--navy);
  color: #fff;
  padding: 16px 20px;
}

.main-employee-name {
  font-size: 17px;
  font-weight: 600;
}

.main-company-name {
  font-size: 13px;
  opacity: 0.8;
}

.icon-btn {
  background: rgba(255,255,255,0.12);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
}

.main-body {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  text-align: center;
}

.status-badge {
  display: inline-block;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 24px;
}

.status-badge.status-in {
  background: #e3f6e3;
  color: var(--good-dark);
}

.status-badge.status-out {
  background: #f6e9e9;
  color: var(--critical-dark);
}

.clock-btn {
  width: 220px;
  height: 220px;
  max-width: 70vw;
  max-height: 70vw;
  border-radius: 50%;
  border: none;
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(11,11,11,0.15);
}

.clock-btn:disabled { opacity: 0.6; cursor: wait; }

.clock-btn.clock-in { background: linear-gradient(145deg, var(--good), var(--good-dark)); }
.clock-btn.clock-out { background: linear-gradient(145deg, var(--critical), var(--critical-dark)); }

.main-message {
  margin-top: 20px;
  font-size: 14px;
  color: var(--good-dark);
}

.main-message.error { color: var(--critical); }

.history-section {
  margin-top: 36px;
  text-align: left;
}

.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.history-header h2 {
  font-size: 15px;
  color: var(--text-secondary);
  margin: 0;
}

.history-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.history-row:last-child { border-bottom: none; }

.history-empty {
  padding: 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.hist-type {
  font-weight: 700;
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 6px;
  width: 36px;
  text-align: center;
}

.hist-in { background: #e3f6e3; color: var(--good-dark); }
.hist-out { background: #f6e9e9; color: var(--critical-dark); }

.hist-date { color: var(--text-secondary); flex: 1; }
.hist-time { color: var(--muted); }
