* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f2f2f7;
  color: #1c1c1e;
  padding-bottom: 40px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #ffffff;
  border-bottom: 1px solid #e5e5ea;
  position: sticky;
  top: 0;
  z-index: 10;
}

header h1 {
  font-size: 19px;
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 14px;
}

.header-actions a,
.header-actions a:visited {
  text-decoration: none;
  font-size: 20px;
  color: #007aff;
}

.clock {
  text-align: center;
  font-size: 15px;
  color: #8e8e93;
  padding: 10px 0 4px;
  font-variant-numeric: tabular-nums;
}

.center-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 55vh;
  padding: 20px;
}

.punch-btn-big {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: none;
  background: #007aff;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,122,255,0.35);
  transition: transform 0.1s ease;
  -webkit-tap-highlight-color: transparent;
}

.punch-btn-big:active:not(:disabled) {
  transform: scale(0.96);
}

.punch-btn-big:disabled {
  background: #d1d1d6;
  box-shadow: none;
}

.punch-btn-big .btn-label {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
}

.punch-btn-big .btn-sub {
  font-size: 14px;
  opacity: 0.9;
}

.status-message {
  text-align: center;
  font-size: 17px;
  color: #6e6e73;
  line-height: 1.6;
}

.status-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.cancel-link {
  text-align: center;
  margin-top: 4px;
}

.cancel-link a {
  color: #ff3b30;
  font-size: 14px;
  text-decoration: none;
}

#message {
  text-align: center;
  min-height: 20px;
  font-size: 14px;
  padding: 0 20px;
}

.msg-success { color: #34c759; font-weight: 600; }
.msg-error { color: #ff3b30; font-weight: 600; }

h2 {
  padding: 0 20px;
  font-size: 17px;
  max-width: 480px;
  margin: 32px auto 8px;
}

.table-wrap {
  padding: 0 20px;
  max-width: 480px;
  margin: 0 auto 8px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  font-size: 13px;
}

th, td {
  padding: 10px 8px;
  text-align: center;
  border-bottom: 1px solid #e5e5ea;
}

th {
  background: #f2f2f7;
  font-size: 12px;
  color: #6e6e73;
}

.empty {
  color: #8e8e93;
  padding: 20px;
}

/* Login */
.login-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 32px 24px;
  width: 100%;
  max-width: 340px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  text-align: center;
}

.login-card h1 {
  font-size: 22px;
  margin-bottom: 20px;
}

.login-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card input {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #d1d1d6;
  font-size: 16px;
}

.login-card button,
.admin-form button {
  padding: 14px;
  border: none;
  border-radius: 12px;
  background: #007aff;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  margin-top: 6px;
}

.error { color: #ff3b30; font-size: 14px; }
.success { color: #34c759; text-align: center; font-size: 14px; }

/* Admin */
.admin-form {
  max-width: 480px;
  margin: 16px auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

fieldset {
  border: 1px solid #e5e5ea;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  margin: 0;
}

.block-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
}

.admin-form label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: #6e6e73;
  gap: 4px;
  margin-top: 10px;
}

.admin-form input {
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #d1d1d6;
  font-size: 15px;
  color: #1c1c1e;
}

.time-row {
  display: flex;
  gap: 10px;
}

.time-row label {
  flex: 1;
}

.date-picker-form {
  max-width: 480px;
}

.small-btn {
  padding: 6px 10px;
  border: none;
  border-radius: 8px;
  background: #f2f2f7;
  font-size: 14px;
}

.small-btn.danger {
  color: #ff3b30;
}

.summary-cards {
  display: flex;
  gap: 12px;
  padding: 0 20px;
  max-width: 480px;
  margin: 0 auto;
}

.summary-card {
  flex: 1;
  background: #fff;
  border-radius: 14px;
  padding: 14px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.summary-title {
  font-size: 12px;
  color: #8e8e93;
  margin-bottom: 4px;
}

.summary-total {
  font-size: 16px;
  font-weight: 600;
}

.summary-balance {
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}

.summary-cumulative {
  text-align: center;
  font-size: 13px;
  color: #6e6e73;
  padding: 10px 20px 0;
}

.positive { color: #34c759; }
.negative { color: #ff3b30; }

.row-absence td {
  background: #fff9e6;
  font-style: italic;
  color: #6e6e73;
}

.hint {
  font-size: 13px;
  color: #8e8e93;
  padding: 0 20px;
  max-width: 480px;
  margin: 8px auto;
}

.help-content {
  max-width: 480px;
  margin: 16px auto;
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.help-content fieldset {
  text-align: left;
}

.help-content .block-title {
  font-size: 15px;
}

.help-content p, .help-content li {
  font-size: 14px;
  line-height: 1.5;
  color: #3c3c43;
}

.help-content ul {
  margin: 6px 0;
  padding-left: 20px;
}

.app-footer {
  text-align: center;
  font-size: 12px;
  color: #aeaeb2;
  padding: 32px 20px 8px;
}

.tabs {
  display: flex;
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 20px 0;
  gap: 8px;
  margin-bottom: 40px;
}

.tab {
  flex: 1;
  text-align: center;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  color: #6e6e73;
  background: #fff;
  padding: 10px 6px;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

.tab.active {
  background: #007aff;
  color: #fff;
}

.month-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  max-width: 480px;
  margin: 0 auto 12px;
  padding: 0 20px;
}

.month-nav-btn {
  text-decoration: none;
  font-size: 20px;
  font-weight: 600;
  color: #007aff;
  padding: 4px 10px;
}

.month-nav-btn.disabled {
  color: #d1d1d6;
}

.month-nav-label {
  font-size: 15px;
  font-weight: 600;
  min-width: 140px;
  text-align: center;
}

.code-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f2f2f7;
  border-radius: 10px;
  padding: 10px 12px;
}

.code-row code {
  flex: 1;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  word-break: break-all;
  color: #1c1c1e;
}

.copy-btn {
  flex-shrink: 0;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: #007aff;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}
